From 558fa8956d40d7f9ae8a86556c2de4ffa7820b29 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 15 Feb 2012 01:59:21 +0100 Subject: [PATCH] Tell Greasemonkey users to install Scriptish. I can't even get the iframes to load correctly anymore. --- 4chan_x.user.js | 12 +++++++++--- script.coffee | 8 ++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 5a23ac813..278d61eb9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -71,7 +71,7 @@ */ (function() { - var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, SECOND, Time, VERSION, anonymize, conf, config, d, engine, expandComment, expandThread, filter, flatten, g, getTitle, imgExpand, imgGif, imgHover, key, keybinds, log, message, nav, options, qr, quoteBacklink, quoteDR, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, strikethroughQuotes, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher, _base, + var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, SECOND, Time, VERSION, anonymize, conf, config, d, engine, expandComment, expandThread, filter, flatten, g, getTitle, imgExpand, imgGif, imgHover, key, keybinds, log, message, nav, options, qr, quoteBacklink, quoteDR, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, strikethroughQuotes, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher, __slice = Array.prototype.slice; config = { @@ -183,7 +183,13 @@ } }; - log = typeof (_base = console.log).bind === "function" ? _base.bind(console) : void 0; + try { + log = console.log.bind(console); + } catch (error) { + if (location.hostname === 'boards.4chan.org' && confirm('You appear to be using Greasemonkey.\nYou need to use the superior and stable alternative Scriptish for 4chan X to function correctly.')) { + GM_openInTab('https://addons.mozilla.org/firefox/addon/scriptish/'); + } + } conf = {}; @@ -3461,7 +3467,7 @@ if (host !== 'boards.4chan.org') { message.send({ req: 'iframeLoad', - id: location.hostname.split('.')[0] + id: host.split('.')[0] }); } return $.rm(script); diff --git a/script.coffee b/script.coffee index 92def3bda..e4266cd46 100644 --- a/script.coffee +++ b/script.coffee @@ -110,7 +110,11 @@ config = # XXX Chrome can't into {log} = console # XXX GreaseMonkey can't into console.log.bind -log = console.log.bind? console +try + log = console.log.bind console +catch error + if location.hostname is 'boards.4chan.org' and confirm 'You appear to be using Greasemonkey.\nYou need to use the superior and stable alternative Scriptish for 4chan X to function correctly.' + GM_openInTab 'https://addons.mozilla.org/firefox/addon/scriptish/' # flatten the config conf = {} @@ -2698,7 +2702,7 @@ message = if host is 'sys.4chan.org' message.send req: 'status', ready: true if host isnt 'boards.4chan.org' - message.send req: 'iframeLoad', id: location.hostname.split('.')[0] + message.send req: 'iframeLoad', id: host.split('.')[0] $.rm script loadControl: ->