I refuse to support 4chanJS.

This commit is contained in:
Zixaphir 2013-04-21 19:32:56 -07:00
parent 6257982bf0
commit 17d7967551
8 changed files with 24 additions and 71 deletions

View File

@ -54,7 +54,6 @@
'Miscellaneous': { 'Miscellaneous': {
'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'], '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.'], '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.'], 'Custom Board Navigation': [true, 'Show custom links instead of the full board list.'],
'Announcement Hiding': [true, 'Add button to hide 4chan announcements.'], 'Announcement Hiding': [true, 'Add button to hide 4chan announcements.'],
'404 Redirect': [true, 'Redirect dead threads and images.'], '404 Redirect': [true, 'Redirect dead threads and images.'],
@ -4442,11 +4441,7 @@
} }
Main.callbackNodes(Post, posts); Main.callbackNodes(Post, posts);
$.after(a, nodes); $.after(a, nodes);
if (Conf['Enable 4chan\'s Extension']) { return Fourchan.parseThread(thread.ID, 1, nodes.length);
return $.globalEval("Parser.parseThread(" + thread.ID + ", 1, " + nodes.length + ")");
} else {
return Fourchan.parseThread(thread.ID, 1, nodes.length);
}
} }
}; };
@ -4680,7 +4675,7 @@
}; };
}, },
setBoardList: function() { setBoardList: function() {
var a, btn, customBoardList, fullBoardList, nav; var a, btn, customBoardList, fullBoardList, nav, settings;
Header.nav = nav = $.id('boardNavDesktop'); Header.nav = nav = $.id('boardNavDesktop');
if (a = $("a[href*='/" + g.BOARD + "/']", nav)) { if (a = $("a[href*='/" + g.BOARD + "/']", nav)) {
@ -4699,9 +4694,9 @@
$.sync('Boards Navigation', Header.changeBarPosition); $.sync('Boards Navigation', Header.changeBarPosition);
Header.setBarVisibility(Conf['Header auto-hide']); Header.setBarVisibility(Conf['Header auto-hide']);
$.sync('Header auto-hide', Header.setBarVisibility); $.sync('Header auto-hide', Header.setBarVisibility);
$.after(nav, $.id('navtopright')); settings = $.id('navtopright');
$.add(fullBoardList, __slice.call(nav.childNodes)); $.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']) { if (Conf['Custom Board Navigation']) {
Header.generateBoardList(Conf['boardnav']); Header.generateBoardList(Conf['boardnav']);
$.sync('boardnav', Header.generateBoardList); $.sync('boardnav', Header.generateBoardList);
@ -6142,11 +6137,7 @@
threadID = ThreadUpdater.thread.ID; threadID = ThreadUpdater.thread.ID;
length = $$('.thread > .postContainer', ThreadUpdater.root).length; length = $$('.thread > .postContainer', ThreadUpdater.root).length;
if (Conf['Enable 4chan\'s Extension']) { return Fourchan.parseThread(threadID, length - count, length);
return $.globalEval("Parser.parseThread(" + threadID + ", " + (-count) + ")");
} else {
return Fourchan.parseThread(threadID, length - count, length);
}
}); });
} }
return $.event('ThreadUpdate', { return $.event('ThreadUpdate', {
@ -8465,7 +8456,7 @@
return $.asap((function() { return $.asap((function() {
return $.id('boardNavMobile'); return $.id('boardNavMobile');
}), function() { }), function() {
return $.prepend($.id('navtopright'), [$.tn(' ['), link, $.tn('] ')]); return $.replace($.id('settingsWindowLink'), link);
}); });
}); });
$.get('previousversion', null, function(item) { $.get('previousversion', null, function(item) {
@ -8499,9 +8490,6 @@
$.on(d, 'OpenSettings', function(e) { $.on(d, 'OpenSettings', function(e) {
return Settings.open(e.detail); return Settings.open(e.detail);
}); });
if (Conf['Enable 4chan\'s Extension']) {
return;
}
settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; settings = JSON.parse(localStorage.getItem('4chan-settings')) || {};
if (settings.disableAll) { if (settings.disableAll) {
return; return;

View File

@ -54,7 +54,6 @@
'Miscellaneous': { 'Miscellaneous': {
'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'], '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.'], '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.'], 'Custom Board Navigation': [true, 'Show custom links instead of the full board list.'],
'Announcement Hiding': [true, 'Add button to hide 4chan announcements.'], 'Announcement Hiding': [true, 'Add button to hide 4chan announcements.'],
'404 Redirect': [true, 'Redirect dead threads and images.'], '404 Redirect': [true, 'Redirect dead threads and images.'],
@ -4434,11 +4433,7 @@
} }
Main.callbackNodes(Post, posts); Main.callbackNodes(Post, posts);
$.after(a, nodes); $.after(a, nodes);
if (Conf['Enable 4chan\'s Extension']) { return Fourchan.parseThread(thread.ID, 1, nodes.length);
return $.globalEval("Parser.parseThread(" + thread.ID + ", 1, " + nodes.length + ")");
} else {
return Fourchan.parseThread(thread.ID, 1, nodes.length);
}
} }
}; };
@ -4672,7 +4667,7 @@
}; };
}, },
setBoardList: function() { setBoardList: function() {
var a, btn, customBoardList, fullBoardList, nav; var a, btn, customBoardList, fullBoardList, nav, settings;
Header.nav = nav = $.id('boardNavDesktop'); Header.nav = nav = $.id('boardNavDesktop');
if (a = $("a[href*='/" + g.BOARD + "/']", nav)) { if (a = $("a[href*='/" + g.BOARD + "/']", nav)) {
@ -4691,9 +4686,9 @@
$.sync('Boards Navigation', Header.changeBarPosition); $.sync('Boards Navigation', Header.changeBarPosition);
Header.setBarVisibility(Conf['Header auto-hide']); Header.setBarVisibility(Conf['Header auto-hide']);
$.sync('Header auto-hide', Header.setBarVisibility); $.sync('Header auto-hide', Header.setBarVisibility);
$.after(nav, $.id('navtopright')); settings = $.id('navtopright');
$.add(fullBoardList, __slice.call(nav.childNodes)); $.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']) { if (Conf['Custom Board Navigation']) {
Header.generateBoardList(Conf['boardnav']); Header.generateBoardList(Conf['boardnav']);
$.sync('boardnav', Header.generateBoardList); $.sync('boardnav', Header.generateBoardList);
@ -6134,11 +6129,7 @@
threadID = ThreadUpdater.thread.ID; threadID = ThreadUpdater.thread.ID;
length = $$('.thread > .postContainer', ThreadUpdater.root).length; length = $$('.thread > .postContainer', ThreadUpdater.root).length;
if (Conf['Enable 4chan\'s Extension']) { return Fourchan.parseThread(threadID, length - count, length);
return $.globalEval("Parser.parseThread(" + threadID + ", " + (-count) + ")");
} else {
return Fourchan.parseThread(threadID, length - count, length);
}
}); });
} }
return $.event('ThreadUpdate', { return $.event('ThreadUpdate', {
@ -8482,7 +8473,7 @@
return $.asap((function() { return $.asap((function() {
return $.id('boardNavMobile'); return $.id('boardNavMobile');
}), function() { }), function() {
return $.prepend($.id('navtopright'), [$.tn(' ['), link, $.tn('] ')]); return $.replace($.id('settingsWindowLink'), link);
}); });
}); });
$.get('previousversion', null, function(item) { $.get('previousversion', null, function(item) {
@ -8516,9 +8507,6 @@
$.on(d, 'OpenSettings', function(e) { $.on(d, 'OpenSettings', function(e) {
return Settings.open(e.detail); return Settings.open(e.detail);
}); });
if (Conf['Enable 4chan\'s Extension']) {
return;
}
settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; settings = JSON.parse(localStorage.getItem('4chan-settings')) || {};
if (settings.disableAll) { if (settings.disableAll) {
return; return;

View File

@ -10,7 +10,6 @@
'Miscellaneous': { 'Miscellaneous': {
'Catalog Links': [true, 'Turn Navigation links into links to each board\'s catalog.'], '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.'], '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.'], 'Custom Board Navigation': [true, 'Show custom links instead of the full board list.'],
'Announcement Hiding': [true, 'Add button to hide 4chan announcements.'], 'Announcement Hiding': [true, 'Add button to hide 4chan announcements.'],
'404 Redirect': [true, 'Redirect dead threads and images.'], '404 Redirect': [true, 'Redirect dead threads and images.'],
@ -4355,11 +4354,7 @@
} }
Main.callbackNodes(Post, posts); Main.callbackNodes(Post, posts);
$.after(a, nodes); $.after(a, nodes);
if (Conf['Enable 4chan\'s Extension']) { return Fourchan.parseThread(thread.ID, 1, nodes.length);
return $.globalEval("Parser.parseThread(" + thread.ID + ", 1, " + nodes.length + ")");
} else {
return Fourchan.parseThread(thread.ID, 1, nodes.length);
}
} }
}; };
@ -4593,7 +4588,7 @@
}; };
}, },
setBoardList: function() { setBoardList: function() {
var a, btn, customBoardList, fullBoardList, nav; var a, btn, customBoardList, fullBoardList, nav, settings;
Header.nav = nav = $.id('boardNavDesktop'); Header.nav = nav = $.id('boardNavDesktop');
if (a = $("a[href*='/" + g.BOARD + "/']", nav)) { if (a = $("a[href*='/" + g.BOARD + "/']", nav)) {
@ -4612,9 +4607,9 @@
$.sync('Boards Navigation', Header.changeBarPosition); $.sync('Boards Navigation', Header.changeBarPosition);
Header.setBarVisibility(Conf['Header auto-hide']); Header.setBarVisibility(Conf['Header auto-hide']);
$.sync('Header auto-hide', Header.setBarVisibility); $.sync('Header auto-hide', Header.setBarVisibility);
$.after(nav, $.id('navtopright')); settings = $.id('navtopright');
$.add(fullBoardList, __slice.call(nav.childNodes)); $.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']) { if (Conf['Custom Board Navigation']) {
Header.generateBoardList(Conf['boardnav']); Header.generateBoardList(Conf['boardnav']);
$.sync('boardnav', Header.generateBoardList); $.sync('boardnav', Header.generateBoardList);
@ -6055,11 +6050,7 @@
threadID = ThreadUpdater.thread.ID; threadID = ThreadUpdater.thread.ID;
length = $$('.thread > .postContainer', ThreadUpdater.root).length; length = $$('.thread > .postContainer', ThreadUpdater.root).length;
if (Conf['Enable 4chan\'s Extension']) { return Fourchan.parseThread(threadID, length - count, length);
return $.globalEval("Parser.parseThread(" + threadID + ", " + (-count) + ")");
} else {
return Fourchan.parseThread(threadID, length - count, length);
}
}); });
} }
return $.event('ThreadUpdate', { return $.event('ThreadUpdate', {
@ -8384,7 +8375,7 @@
return $.asap((function() { return $.asap((function() {
return $.id('boardNavMobile'); return $.id('boardNavMobile');
}), function() { }), function() {
return $.prepend($.id('navtopright'), [$.tn(' ['), link, $.tn('] ')]); return $.replace($.id('settingsWindowLink'), link);
}); });
}); });
$.get('previousversion', null, function(item) { $.get('previousversion', null, function(item) {
@ -8418,9 +8409,6 @@
$.on(d, 'OpenSettings', function(e) { $.on(d, 'OpenSettings', function(e) {
return Settings.open(e.detail); return Settings.open(e.detail);
}); });
if (Conf['Enable 4chan\'s Extension']) {
return;
}
settings = JSON.parse(localStorage.getItem('4chan-settings')) || {}; settings = JSON.parse(localStorage.getItem('4chan-settings')) || {};
if (settings.disableAll) { if (settings.disableAll) {
return; return;

View File

@ -9,10 +9,6 @@ Config =
false false
'Link to external catalog instead of the internal one.' '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': [ 'Custom Board Navigation': [
true true
'Show custom links instead of the full board list.' 'Show custom links instead of the full board list.'

View File

@ -94,8 +94,5 @@ ExpandThread =
Main.callbackNodes Post, posts Main.callbackNodes Post, posts
$.after a, nodes $.after a, nodes
# Enable 4chan features. # 4chan features.
if Conf['Enable 4chan\'s Extension'] Fourchan.parseThread thread.ID, 1, nodes.length
$.globalEval "Parser.parseThread(#{thread.ID}, 1, #{nodes.length})"
else
Fourchan.parseThread thread.ID, 1, nodes.length

View File

@ -82,10 +82,10 @@ Header =
Header.setBarVisibility Conf['Header auto-hide'] Header.setBarVisibility Conf['Header auto-hide']
$.sync 'Header auto-hide', Header.setBarVisibility $.sync 'Header auto-hide', Header.setBarVisibility
$.after nav, $.id 'navtopright' settings = $.id 'navtopright'
$.add fullBoardList, [nav.childNodes...] $.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'] if Conf['Custom Board Navigation']
Header.generateBoardList Conf['boardnav'] Header.generateBoardList Conf['boardnav']

View File

@ -289,10 +289,7 @@ ThreadUpdater =
# Enable 4chan features. # Enable 4chan features.
threadID = ThreadUpdater.thread.ID threadID = ThreadUpdater.thread.ID
{length} = $$ '.thread > .postContainer', ThreadUpdater.root {length} = $$ '.thread > .postContainer', ThreadUpdater.root
if Conf['Enable 4chan\'s Extension'] Fourchan.parseThread threadID, length - count, length
$.globalEval "Parser.parseThread(#{threadID}, #{-count})"
else
Fourchan.parseThread threadID, length - count, length
$.event 'ThreadUpdate', $.event 'ThreadUpdate',
404: false 404: false

View File

@ -12,7 +12,7 @@ Settings =
# Wait for #boardNavMobile instead of #boardNavDesktop, # Wait for #boardNavMobile instead of #boardNavDesktop,
# it might be incomplete otherwise. # it might be incomplete otherwise.
$.asap (-> $.id 'boardNavMobile'), -> $.asap (-> $.id 'boardNavMobile'), ->
$.prepend $.id('navtopright'), [$.tn(' ['), link, $.tn('] ')] $.replace $.id('settingsWindowLink'), link
$.get 'previousversion', null, (item) -> $.get 'previousversion', null, (item) ->
if previous = item['previousversion'] if previous = item['previousversion']
@ -40,7 +40,6 @@ Settings =
$.on d, 'AddSettingsSection', Settings.addSection $.on d, 'AddSettingsSection', Settings.addSection
$.on d, 'OpenSettings', (e) -> Settings.open e.detail $.on d, 'OpenSettings', (e) -> Settings.open e.detail
return if Conf['Enable 4chan\'s Extension']
settings = JSON.parse(localStorage.getItem '4chan-settings') or {} settings = JSON.parse(localStorage.getItem '4chan-settings') or {}
return if settings.disableAll return if settings.disableAll
settings.disableAll = true settings.disableAll = true