diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index cc32286fd..4921f2659 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -7400,7 +7400,7 @@ } }, secondNode: function() { - var backlink, container, post, quoteID, _i, _j, _len, _len1, _ref, _ref1; + var backlink, container, map, post, quoteID, _i, _j, _len, _len1, _ref; if (!(this.isReply || Conf['OP Backlinks'])) { return; } @@ -7416,10 +7416,9 @@ this.nodes.backlinkContainer = container = $.el('span', { className: 'backlink-container' }); - if (this.fullID in QuoteBacklink.map) { - _ref1 = QuoteBacklink.map[this.fullID]; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - quoteID = _ref1[_j]; + if (map = QuoteBacklink.map[this.fullID]) { + for (_j = 0, _len1 = map.length; _j < _len1; _j++) { + quoteID = map[_j]; if (post = g.posts[quoteID]) { $.add(container, QuoteBacklink.buildBacklink(this, post)); } @@ -8111,10 +8110,6 @@ if (Conf['Comment Expansion']) { ExpandComment.callbacks.push(this.node); } - if (Conf['Link Title']) { - $.sync('CachedTitles', Linkify.titleSync); - this.clean(); - } return Post.callbacks.push({ name: 'Linkify', cb: this.node @@ -8317,22 +8312,6 @@ } } }, - clean: function() { - var age, pruned, uid, _, _ref, _ref1; - pruned = false; - _ref = Conf['CachedTitles']; - for (uid in _ref) { - _ref1 = _ref[uid], _ = _ref1[0], age = _ref1[1]; - if (!(age + $.DAY > Date.now())) { - continue; - } - pruned = true; - delete Conf['CachedTitles'][uid]; - } - if (pruned) { - return $.set('CachedTitles', Conf['CachedTitles']); - } - }, cb: { toggle: function() { var string, _ref; @@ -16523,7 +16502,7 @@ if ('f' === boardID || 'f' === g.BOARD.ID) { return; } - if (e) { + if (e != null) { e.preventDefault(); } if (Index.isSearching) { @@ -17958,9 +17937,8 @@ } if (!Conf['JSON Navigation'] || g.VIEW === 'thread') { Main.initThread(); - } else { - $.event('4chanXInitFinished'); } + $.event('4chanXInitFinished'); test = $.el('span'); test.classList.add('a', 'b'); if (test.className !== 'a b') { @@ -18015,7 +17993,6 @@ } Thread.callbacks.execute(threads); Post.callbacks.execute(posts); - $.event('4chanXInitFinished'); } return $.get('previousversion', null, function(_arg) { var changelog, el, previousversion; diff --git a/builds/crx/script.js b/builds/crx/script.js index 0248c5650..3bd5ffd94 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -7451,7 +7451,7 @@ } }, secondNode: function() { - var backlink, container, post, quoteID, _i, _j, _len, _len1, _ref, _ref1; + var backlink, container, map, post, quoteID, _i, _j, _len, _len1, _ref; if (!(this.isReply || Conf['OP Backlinks'])) { return; } @@ -7467,10 +7467,9 @@ this.nodes.backlinkContainer = container = $.el('span', { className: 'backlink-container' }); - if (this.fullID in QuoteBacklink.map) { - _ref1 = QuoteBacklink.map[this.fullID]; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - quoteID = _ref1[_j]; + if (map = QuoteBacklink.map[this.fullID]) { + for (_j = 0, _len1 = map.length; _j < _len1; _j++) { + quoteID = map[_j]; if (post = g.posts[quoteID]) { $.add(container, QuoteBacklink.buildBacklink(this, post)); } @@ -8162,10 +8161,6 @@ if (Conf['Comment Expansion']) { ExpandComment.callbacks.push(this.node); } - if (Conf['Link Title']) { - $.sync('CachedTitles', Linkify.titleSync); - this.clean(); - } return Post.callbacks.push({ name: 'Linkify', cb: this.node @@ -8368,22 +8363,6 @@ } } }, - clean: function() { - var age, pruned, uid, _, _ref, _ref1; - pruned = false; - _ref = Conf['CachedTitles']; - for (uid in _ref) { - _ref1 = _ref[uid], _ = _ref1[0], age = _ref1[1]; - if (!(age + $.DAY > Date.now())) { - continue; - } - pruned = true; - delete Conf['CachedTitles'][uid]; - } - if (pruned) { - return $.set('CachedTitles', Conf['CachedTitles']); - } - }, cb: { toggle: function() { var string, _ref; @@ -16547,7 +16526,7 @@ if ('f' === boardID || 'f' === g.BOARD.ID) { return; } - if (e) { + if (e != null) { e.preventDefault(); } if (Index.isSearching) { @@ -17974,9 +17953,8 @@ } if (!Conf['JSON Navigation'] || g.VIEW === 'thread') { Main.initThread(); - } else { - $.event('4chanXInitFinished'); } + $.event('4chanXInitFinished'); try { return localStorage.getItem('4chan-settings'); } catch (_error) { @@ -18016,7 +17994,6 @@ } Thread.callbacks.execute(threads); Post.callbacks.execute(posts); - $.event('4chanXInitFinished'); } return $.get('previousversion', null, function(_arg) { var changelog, el, previousversion; diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 713e9204a..63395b6fa 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -197,9 +197,9 @@ Main = # Parse HTML or skip it and start building from JSON. if !Conf['JSON Navigation'] or g.VIEW is 'thread' - Main.initThread() - else - $.event '4chanXInitFinished' + Main.initThread() + + $.event '4chanXInitFinished' <% if (type === 'userscript') { %> test = $.el 'span' @@ -242,8 +242,6 @@ Main = Thread.callbacks.execute threads Post.callbacks.execute posts - $.event '4chanXInitFinished' - $.get 'previousversion', null, ({previousversion}) -> return if previousversion is g.VERSION if previousversion diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index a7f914b8b..f116b97a7 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -190,7 +190,7 @@ Navigate = navigate: (e) -> return if @hostname isnt 'boards.4chan.org' or window.location.hostname is 'rs.4chan.org' - if e + if e if e.shiftKey or e.ctrlKey or (e.type is 'click' and e.button isnt 0) # Not simply a left click Navigate.setMode @ unless e?.button is 2 # Right Click return @@ -212,7 +212,7 @@ Navigate = [_, boardID, view, threadID] = @pathname.split '/' return if 'f' in [boardID, g.BOARD.ID] - e.preventDefault() if e + e?.preventDefault() Index.clearSearch() if Index.isSearching Navigate.title = -> return @@ -232,7 +232,7 @@ Navigate = history.pushState 'internal', '', path unless @id is 'popState' Navigate.path = @pathname - + Navigate.setMode @ unless view is 'index' and 'index' is g.VIEW and boardID is g.BOARD.ID diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 86f691e75..b8438f8b4 100755 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -5,10 +5,6 @@ Linkify = if Conf['Comment Expansion'] ExpandComment.callbacks.push @node - if Conf['Link Title'] - $.sync 'CachedTitles', Linkify.titleSync - @clean() - Post.callbacks.push name: 'Linkify' cb: @node @@ -185,13 +181,6 @@ Linkify = link.innerHTML = "[#{key}] Title Link Blocked (are you using NoScript?)" return - clean: -> - pruned = false - for uid, [_, age] of Conf['CachedTitles'] when age + $.DAY > Date.now() - pruned = true - delete Conf['CachedTitles'][uid] - $.set 'CachedTitles', Conf['CachedTitles'] if pruned - cb: toggle: -> [string, @textContent] = if $.hasClass @, "embedded" diff --git a/src/Quotelinks/QuoteBacklink.coffee b/src/Quotelinks/QuoteBacklink.coffee index eaf989859..a475aef42 100755 --- a/src/Quotelinks/QuoteBacklink.coffee +++ b/src/Quotelinks/QuoteBacklink.coffee @@ -47,10 +47,9 @@ QuoteBacklink = return @nodes.backlinkContainer = container = $.el 'span', className: 'backlink-container' - if @fullID of QuoteBacklink.map - for quoteID in QuoteBacklink.map[@fullID] - if post = g.posts[quoteID] # Post hasn't been collected since. - $.add container, QuoteBacklink.buildBacklink @, post + if map = QuoteBacklink.map[@fullID] + for quoteID in map when post = g.posts[quoteID] # Post hasn't been collected since. + $.add container, QuoteBacklink.buildBacklink @, post $.add @nodes.info, container