diff --git a/4chan_x.user.js b/4chan_x.user.js index b7ac5972b..5f8a70864 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -73,7 +73,7 @@ */ (function() { - var $, $$, Anonymize, AutoGif, Conf, Config, DAY, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, HOUR, ImageExpand, ImageHover, Keybinds, MINUTE, Main, NAMESPACE, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportButton, RevealSpoilers, SECOND, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Threading, Time, TitlePost, Unread, Updater, VERSION, Watcher, d, engine, flatten, ui, _base; + var $, $$, Anonymize, AutoGif, Conf, Config, DAY, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, HOUR, ImageExpand, ImageHover, Keybinds, MINUTE, Main, NAMESPACE, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportButton, RevealSpoilers, SECOND, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Threading, Time, TitlePost, Unread, Updater, VERSION, Watcher, d, flatten, ui, _base; Config = { main: { @@ -220,8 +220,6 @@ DAY = 24 * HOUR; - engine = /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase(); - d = document; ui = { @@ -1741,7 +1739,7 @@ \
\ '); - if (Conf['Remember QR size'] && engine === 'gecko') { + if (Conf['Remember QR size'] && Main.engine === 'gecko') { $.on(ta = $('textarea', QR.el), 'mouseup', function() { return $.set('QR.size', this.style.cssText); }); @@ -1896,7 +1894,7 @@ QR.status({ progress: '...' }); - if (engine === 'gecko' && reply.file) { + if (Main.engine === 'gecko' && reply.file) { file = {}; reader = new FileReader(); reader.onload = function() { @@ -2017,7 +2015,7 @@ var boundary, callbacks, form, i, name, opts, parts, toBin, url, val; url = data.postURL; delete data.postURL; - if (engine === 'gecko' && data.upfile) { + if (Main.engine === 'gecko' && data.upfile) { if (!data.binary) { toBin = function(data, name, val) { var bb, r; @@ -3764,7 +3762,7 @@ url = href + '?' + Date.now(); } timeoutID = setTimeout(ImageExpand.expand, 10000, thumb, url); - if (!(engine === 'webkit' && url.split('/')[2] === 'images.4chan.org')) { + if (!(Main.engine === 'webkit' && url.split('/')[2] === 'images.4chan.org')) { return; } return $.ajax(url, { @@ -3903,7 +3901,7 @@ } if (!$.id('navtopr')) return; $.addClass(d.body, "chanx_" + (VERSION.split('.')[1])); - $.addClass(d.body, engine); + $.addClass(d.body, Main.engine); _ref = ['navtop', 'navbot']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { nav = _ref[_i]; @@ -4050,6 +4048,7 @@ target = e.target; if (target.nodeName === 'TABLE') return Main.node([Main.preParse(target)]); }, + engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase(), callbacks: [], css: '\ /* dialog styling */\ diff --git a/script.coffee b/script.coffee index 08ebfdaa7..8e101af6f 100644 --- a/script.coffee +++ b/script.coffee @@ -173,7 +173,6 @@ SECOND = 1000 MINUTE = 60*SECOND HOUR = 60*MINUTE DAY = 24*HOUR -engine = /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase() d = document ui = @@ -1435,7 +1434,7 @@ QR =
' - if Conf['Remember QR size'] and engine is 'gecko' + if Conf['Remember QR size'] and Main.engine is 'gecko' $.on ta = $('textarea', QR.el), 'mouseup', -> $.set 'QR.size', @style.cssText ta.style.cssText = $.get 'QR.size', '' @@ -1577,7 +1576,7 @@ QR = # Provide some feedback that we're starting to submit. QR.status progress: '...' - if engine is 'gecko' and reply.file + if Main.engine is 'gecko' and reply.file # https://bugzilla.mozilla.org/show_bug.cgi?id=673742 # We plan to allow postMessaging Files and FileLists across origins, # that just needs a more in depth security review. @@ -1696,7 +1695,7 @@ QR = delete data.postURL # File with filename upload fix from desuwa - if engine is 'gecko' and data.upfile + if Main.engine is 'gecko' and data.upfile # All of this is fucking retarded. unless data.binary toBin = (data, name, val) -> @@ -3130,7 +3129,7 @@ ImageExpand = timeoutID = setTimeout ImageExpand.expand, 10000, thumb, url # Only Chrome let userscript break through cross domain requests. # Don't check it 404s in the archivers. - return unless engine is 'webkit' and url.split('/')[2] is 'images.4chan.org' + return unless Main.engine is 'webkit' and url.split('/')[2] is 'images.4chan.org' $.ajax url, onreadystatechange: (-> clearTimeout timeoutID if @status is 404), type: 'head' @@ -3279,7 +3278,7 @@ Main = unless $.id 'navtopr' return $.addClass d.body, "chanx_#{VERSION.split('.')[1]}" - $.addClass d.body, engine + $.addClass d.body, Main.engine for nav in ['navtop', 'navbot'] $.addClass $("a[href$='/#{Main.BOARD}/']", $.id nav), 'current' form = $ 'form[name=delform]' @@ -3389,6 +3388,7 @@ Main = {target} = e Main.node [Main.preParse target] if target.nodeName is 'TABLE' + engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase() callbacks: [] css: ' /* dialog styling */