From 4cfa27f38ce522594a6f7ca09f663f5459eb7d47 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 9 Dec 2011 14:07:26 +0100 Subject: [PATCH] Fix compatibility with Tampermonkey, close #33 --- 4chan_x.user.js | 4 ++-- changelog | 1 + script.coffee | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index e8cd84a83..9fc3b82fa 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3012,7 +3012,7 @@ g.PAGENUM = parseInt(temp) || 0; } if (location.hostname === 'sys.4chan.org') { - if (d.body) { + if (/interactive|complete/.test(d.readyState)) { qr.sys(); } else { $.on(d, 'DOMContentLoaded', qr.sys); @@ -3054,7 +3054,7 @@ if (conf['Quote Backlinks']) quoteBacklink.init(); if (conf['Indicate OP quote']) quoteOP.init(); if (conf['Indicate Cross-thread Quotes']) quoteDR.init(); - if (d.body) { + if (/interactive|complete/.test(d.readyState)) { return Main.onLoad(); } else { return $.on(d, 'DOMContentLoaded', Main.onLoad); diff --git a/changelog b/changelog index 78618767b..8bcdeccaf 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - mayhem fix favicon updating on Opera + fix compatibility with Tampermonkey 2.23.0 - mayhem diff --git a/script.coffee b/script.coffee index 71fd939ad..1d94e2339 100644 --- a/script.coffee +++ b/script.coffee @@ -2328,7 +2328,7 @@ Main = g.PAGENUM = parseInt(temp) or 0 if location.hostname is 'sys.4chan.org' - if d.body + if /interactive|complete/.test d.readyState qr.sys() else $.on d, 'DOMContentLoaded', qr.sys @@ -2404,7 +2404,7 @@ Main = quoteDR.init() - if d.body + if /interactive|complete/.test d.readyState Main.onLoad() else $.on d, 'DOMContentLoaded', Main.onLoad