aboutsummaryrefslogtreecommitdiffstats
path: root/google-docs-last-edit-label.user.js
diff options
context:
space:
mode:
Diffstat (limited to 'google-docs-last-edit-label.user.js')
-rw-r--r--google-docs-last-edit-label.user.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/google-docs-last-edit-label.user.js b/google-docs-last-edit-label.user.js
index 64b3f1d..9ae9ec5 100644
--- a/google-docs-last-edit-label.user.js
+++ b/google-docs-last-edit-label.user.js
@@ -3,7 +3,6 @@
// @description Show a tooltip when hovering over the last edit time label
// @namespace com.teddywing
// @version 0.0.1
-// @run-at document-idle
// @match https://docs.google.com/*
// ==/UserScript==
@@ -23,5 +22,23 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
+var observer = new MutationObserver(
+ function(mutation_list) {
+ for (var i = 0; i < mutation_list.length; i++) {
+ var mutation = mutation_list[i];
+ var last_edit_label = mutation.target;
+
+ last_edit_label.setAttribute('title', last_edit_label.textContent);
+
+ return;
+ }
+ }
+);
+
var last_edit_label = document.querySelector('.docs-title-save-label-text');
-last_edit_label.setAttribute('title', last_edit_label.textContent);
+observer.observe(
+ last_edit_label,
+ {
+ childList: true
+ }
+);