From 17d7967551f222687c3d27e4679f2af0ee17c9be Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Sun, 21 Apr 2013 19:32:56 -0700 Subject: [PATCH] I refuse to support 4chanJS. --- builds/4chan-X.js | 24 +++++--------------- builds/4chan-X.user.js | 24 +++++--------------- builds/crx/script.js | 24 +++++--------------- src/config.coffee | 4 ---- src/features/misc/expandthread.coffee | 7 ++---- src/features/misc/header.coffee | 4 ++-- src/features/monitoring/threadupdater.coffee | 5 +--- src/settings.coffee | 3 +-- 8 files changed, 24 insertions(+), 71 deletions(-) diff --git a/builds/4chan-X.js b/builds/4chan-X.js index d6385902d..c11c67ca9 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -54,7 +54,6 @@ 'Miscellaneous': { 'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'], 'External Catalog': [false, 'Link to external catalog instead of the internal one.'], - 'Enable 4chan\'s Extension': [false, 'Compatibility between 4chan X and 4chan\'s inline extension is NOT guaranteed.'], 'Custom Board Navigation': [true, 'Show custom links instead of the full board list.'], 'Announcement Hiding': [true, 'Add button to hide 4chan announcements.'], '404 Redirect': [true, 'Redirect dead threads and images.'], @@ -4442,11 +4441,7 @@ } Main.callbackNodes(Post, posts); $.after(a, nodes); - if (Conf['Enable 4chan\'s Extension']) { - return $.globalEval("Parser.parseThread(" + thread.ID + ", 1, " + nodes.length + ")"); - } else { - return Fourchan.parseThread(thread.ID, 1, nodes.length); - } + return Fourchan.parseThread(thread.ID, 1, nodes.length); } }; @@ -4680,7 +4675,7 @@ }; }, setBoardList: function() { - var a, btn, customBoardList, fullBoardList, nav; + var a, btn, customBoardList, fullBoardList, nav, settings; Header.nav = nav = $.id('boardNavDesktop'); if (a = $("a[href*='/" + g.BOARD + "/']", nav)) { @@ -4699,9 +4694,9 @@ $.sync('Boards Navigation', Header.changeBarPosition); Header.setBarVisibility(Conf['Header auto-hide']); $.sync('Header auto-hide', Header.setBarVisibility); - $.after(nav, $.id('navtopright')); + settings = $.id('navtopright'); $.add(fullBoardList, __slice.call(nav.childNodes)); - $.add(nav, [Header.menuButton, customBoardList, fullBoardList, Header.shortcuts, Header.bar, Header.toggle]); + $.add(nav, [Header.menuButton, customBoardList, fullBoardList, Header.shortcuts, Header.bar, Header.toggle, settings]); if (Conf['Custom Board Navigation']) { Header.generateBoardList(Conf['boardnav']); $.sync('boardnav', Header.generateBoardList); @@ -6142,11 +6137,7 @@ threadID = ThreadUpdater.thread.ID; length = $$('.thread > .postContainer', ThreadUpdater.root).length; - if (Conf['Enable 4chan\'s Extension']) { - return $.globalEval("Parser.parseThread(" + threadID + ", " + (-count) + ")"); - } else { - return Fourchan.parseThread(threadID, length - count, length); - } + return Fourchan.parseThread(threadID, length - count, length); }); } return $.event('ThreadUpdate', { @@ -8465,7 +8456,7 @@ return $.asap((function() { return $.id('boardNavMobile'); }), function() { - return $.prepend($.id('navtopright'), [$.tn(' ['), link, $.tn('] ')]); + return $.replace($.id('settingsWindowLink'), link); }); }); $.get('previousversion', null, function(item) { @@ -8499,9 +8490,6 @@ $.on(d, 'OpenSettings', function(e) { return Settings.open(e.detail); }); - if (Conf['Enable 4chan\'s Extension']) { - return; - } settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; if (settings.disableAll) { return; diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 673e5459b..f5d547ff1 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -54,7 +54,6 @@ 'Miscellaneous': { 'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'], 'External Catalog': [false, 'Link to external catalog instead of the internal one.'], - 'Enable 4chan\'s Extension': [false, 'Compatibility between 4chan X and 4chan\'s inline extension is NOT guaranteed.'], 'Custom Board Navigation': [true, 'Show custom links instead of the full board list.'], 'Announcement Hiding': [true, 'Add button to hide 4chan announcements.'], '404 Redirect': [true, 'Redirect dead threads and images.'], @@ -4434,11 +4433,7 @@ } Main.callbackNodes(Post, posts); $.after(a, nodes); - if (Conf['Enable 4chan\'s Extension']) { - return $.globalEval("Parser.parseThread(" + thread.ID + ", 1, " + nodes.length + ")"); - } else { - return Fourchan.parseThread(thread.ID, 1, nodes.length); - } + return Fourchan.parseThread(thread.ID, 1, nodes.length); } }; @@ -4672,7 +4667,7 @@ }; }, setBoardList: function() { - var a, btn, customBoardList, fullBoardList, nav; + var a, btn, customBoardList, fullBoardList, nav, settings; Header.nav = nav = $.id('boardNavDesktop'); if (a = $("a[href*='/" + g.BOARD + "/']", nav)) { @@ -4691,9 +4686,9 @@ $.sync('Boards Navigation', Header.changeBarPosition); Header.setBarVisibility(Conf['Header auto-hide']); $.sync('Header auto-hide', Header.setBarVisibility); - $.after(nav, $.id('navtopright')); + settings = $.id('navtopright'); $.add(fullBoardList, __slice.call(nav.childNodes)); - $.add(nav, [Header.menuButton, customBoardList, fullBoardList, Header.shortcuts, Header.bar, Header.toggle]); + $.add(nav, [Header.menuButton, customBoardList, fullBoardList, Header.shortcuts, Header.bar, Header.toggle, settings]); if (Conf['Custom Board Navigation']) { Header.generateBoardList(Conf['boardnav']); $.sync('boardnav', Header.generateBoardList); @@ -6134,11 +6129,7 @@ threadID = ThreadUpdater.thread.ID; length = $$('.thread > .postContainer', ThreadUpdater.root).length; - if (Conf['Enable 4chan\'s Extension']) { - return $.globalEval("Parser.parseThread(" + threadID + ", " + (-count) + ")"); - } else { - return Fourchan.parseThread(threadID, length - count, length); - } + return Fourchan.parseThread(threadID, length - count, length); }); } return $.event('ThreadUpdate', { @@ -8482,7 +8473,7 @@ return $.asap((function() { return $.id('boardNavMobile'); }), function() { - return $.prepend($.id('navtopright'), [$.tn(' ['), link, $.tn('] ')]); + return $.replace($.id('settingsWindowLink'), link); }); }); $.get('previousversion', null, function(item) { @@ -8516,9 +8507,6 @@ $.on(d, 'OpenSettings', function(e) { return Settings.open(e.detail); }); - if (Conf['Enable 4chan\'s Extension']) { - return; - } settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; if (settings.disableAll) { return; diff --git a/builds/crx/script.js b/builds/crx/script.js index 88d717d39..961259599 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -10,7 +10,6 @@ 'Miscellaneous': { 'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'], 'External Catalog': [false, 'Link to external catalog instead of the internal one.'], - 'Enable 4chan\'s Extension': [false, 'Compatibility between 4chan X and 4chan\'s inline extension is NOT guaranteed.'], 'Custom Board Navigation': [true, 'Show custom links instead of the full board list.'], 'Announcement Hiding': [true, 'Add button to hide 4chan announcements.'], '404 Redirect': [true, 'Redirect dead threads and images.'], @@ -4355,11 +4354,7 @@ } Main.callbackNodes(Post, posts); $.after(a, nodes); - if (Conf['Enable 4chan\'s Extension']) { - return $.globalEval("Parser.parseThread(" + thread.ID + ", 1, " + nodes.length + ")"); - } else { - return Fourchan.parseThread(thread.ID, 1, nodes.length); - } + return Fourchan.parseThread(thread.ID, 1, nodes.length); } }; @@ -4593,7 +4588,7 @@ }; }, setBoardList: function() { - var a, btn, customBoardList, fullBoardList, nav; + var a, btn, customBoardList, fullBoardList, nav, settings; Header.nav = nav = $.id('boardNavDesktop'); if (a = $("a[href*='/" + g.BOARD + "/']", nav)) { @@ -4612,9 +4607,9 @@ $.sync('Boards Navigation', Header.changeBarPosition); Header.setBarVisibility(Conf['Header auto-hide']); $.sync('Header auto-hide', Header.setBarVisibility); - $.after(nav, $.id('navtopright')); + settings = $.id('navtopright'); $.add(fullBoardList, __slice.call(nav.childNodes)); - $.add(nav, [Header.menuButton, customBoardList, fullBoardList, Header.shortcuts, Header.bar, Header.toggle]); + $.add(nav, [Header.menuButton, customBoardList, fullBoardList, Header.shortcuts, Header.bar, Header.toggle, settings]); if (Conf['Custom Board Navigation']) { Header.generateBoardList(Conf['boardnav']); $.sync('boardnav', Header.generateBoardList); @@ -6055,11 +6050,7 @@ threadID = ThreadUpdater.thread.ID; length = $$('.thread > .postContainer', ThreadUpdater.root).length; - if (Conf['Enable 4chan\'s Extension']) { - return $.globalEval("Parser.parseThread(" + threadID + ", " + (-count) + ")"); - } else { - return Fourchan.parseThread(threadID, length - count, length); - } + return Fourchan.parseThread(threadID, length - count, length); }); } return $.event('ThreadUpdate', { @@ -8384,7 +8375,7 @@ return $.asap((function() { return $.id('boardNavMobile'); }), function() { - return $.prepend($.id('navtopright'), [$.tn(' ['), link, $.tn('] ')]); + return $.replace($.id('settingsWindowLink'), link); }); }); $.get('previousversion', null, function(item) { @@ -8418,9 +8409,6 @@ $.on(d, 'OpenSettings', function(e) { return Settings.open(e.detail); }); - if (Conf['Enable 4chan\'s Extension']) { - return; - } settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; if (settings.disableAll) { return; diff --git a/src/config.coffee b/src/config.coffee index 794510533..8e8bb32f7 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -9,10 +9,6 @@ Config = false 'Link to external catalog instead of the internal one.' ] - 'Enable 4chan\'s Extension': [ - false - 'Compatibility between <%= meta.name %> and 4chan\'s inline extension is NOT guaranteed.' - ] 'Custom Board Navigation': [ true 'Show custom links instead of the full board list.' diff --git a/src/features/misc/expandthread.coffee b/src/features/misc/expandthread.coffee index 17dd135c4..10527e949 100644 --- a/src/features/misc/expandthread.coffee +++ b/src/features/misc/expandthread.coffee @@ -94,8 +94,5 @@ ExpandThread = Main.callbackNodes Post, posts $.after a, nodes - # Enable 4chan features. - if Conf['Enable 4chan\'s Extension'] - $.globalEval "Parser.parseThread(#{thread.ID}, 1, #{nodes.length})" - else - Fourchan.parseThread thread.ID, 1, nodes.length \ No newline at end of file + # 4chan features. + Fourchan.parseThread thread.ID, 1, nodes.length \ No newline at end of file diff --git a/src/features/misc/header.coffee b/src/features/misc/header.coffee index 13f4c6280..b7e96d8c1 100644 --- a/src/features/misc/header.coffee +++ b/src/features/misc/header.coffee @@ -82,10 +82,10 @@ Header = Header.setBarVisibility Conf['Header auto-hide'] $.sync 'Header auto-hide', Header.setBarVisibility - $.after nav, $.id 'navtopright' + settings = $.id 'navtopright' $.add fullBoardList, [nav.childNodes...] - $.add nav, [Header.menuButton, customBoardList, fullBoardList, Header.shortcuts, Header.bar, Header.toggle] + $.add nav, [Header.menuButton, customBoardList, fullBoardList, Header.shortcuts, Header.bar, Header.toggle, settings] if Conf['Custom Board Navigation'] Header.generateBoardList Conf['boardnav'] diff --git a/src/features/monitoring/threadupdater.coffee b/src/features/monitoring/threadupdater.coffee index 119296a73..cd58f174b 100644 --- a/src/features/monitoring/threadupdater.coffee +++ b/src/features/monitoring/threadupdater.coffee @@ -289,10 +289,7 @@ ThreadUpdater = # Enable 4chan features. threadID = ThreadUpdater.thread.ID {length} = $$ '.thread > .postContainer', ThreadUpdater.root - if Conf['Enable 4chan\'s Extension'] - $.globalEval "Parser.parseThread(#{threadID}, #{-count})" - else - Fourchan.parseThread threadID, length - count, length + Fourchan.parseThread threadID, length - count, length $.event 'ThreadUpdate', 404: false diff --git a/src/settings.coffee b/src/settings.coffee index e1117447d..494adf72b 100644 --- a/src/settings.coffee +++ b/src/settings.coffee @@ -12,7 +12,7 @@ Settings = # Wait for #boardNavMobile instead of #boardNavDesktop, # it might be incomplete otherwise. $.asap (-> $.id 'boardNavMobile'), -> - $.prepend $.id('navtopright'), [$.tn(' ['), link, $.tn('] ')] + $.replace $.id('settingsWindowLink'), link $.get 'previousversion', null, (item) -> if previous = item['previousversion'] @@ -40,7 +40,6 @@ Settings = $.on d, 'AddSettingsSection', Settings.addSection $.on d, 'OpenSettings', (e) -> Settings.open e.detail - return if Conf['Enable 4chan\'s Extension'] settings = JSON.parse(localStorage.getItem '4chan-settings') or {} return if settings.disableAll settings.disableAll = true