Merge pull request #873 from ccd0/master

Yet more bugfixes.
This commit is contained in:
Zixaphir 2015-01-26 16:53:11 -07:00
commit 815bd5e0b7
15 changed files with 141 additions and 131 deletions

View File

@ -1,5 +1,5 @@
/* /*
* appchan x - Version 2.10.4 - 2015-01-24 * appchan x - Version 2.10.4 - 2015-01-26
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -28,7 +28,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* appchan x - Version 2.10.4 - 2015-01-24 * appchan x - Version 2.10.4 - 2015-01-26
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -163,7 +163,8 @@
'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'], 'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'],
'Show Support Message': [true, 'Warn if your browser is unsupported. appchan x may not operate correctly on unsupported browser versions.'], 'Show Support Message': [true, 'Warn if your browser is unsupported. appchan x may not operate correctly on unsupported browser versions.'],
'Normalize URL': [true, 'Rewrite the URL of the current page, removing stubs and changing /res/ to /thread/.'], 'Normalize URL': [true, 'Rewrite the URL of the current page, removing stubs and changing /res/ to /thread/.'],
'Announcement Hiding': [true, 'Enable announcements to be hidden.'] 'Announcement Hiding': [true, 'Enable announcements to be hidden.'],
'Disable Autoplaying Sounds': [false, 'Prevent sounds on the page from autoplaying.']
}, },
'Linkification': { 'Linkification': {
'Linkify': [true, 'Convert text into links where applicable.'], 'Linkify': [true, 'Convert text into links where applicable.'],
@ -4927,8 +4928,8 @@
Index = { Index = {
showHiddenThreads: false, showHiddenThreads: false,
init: function() { init: function() {
var anchorEntry, input, label, modeEntry, name, pinEntry, refNavEntry, repliesEntry, returnLink, select, sortEntry, targetEntry, threadNumEntry, threadsNumInput, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2; var anchorEntry, input, label, modeEntry, name, pinEntry, refNavEntry, repliesEntry, returnLink, select, sortEntry, targetEntry, threadNumEntry, threadsNumInput, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3;
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation']) { if (!(Conf['JSON Navigation'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
this.board = "" + g.BOARD; this.board = "" + g.BOARD;
@ -4969,9 +4970,9 @@
} }
] ]
}; };
_ref = modeEntry.subEntries; _ref1 = modeEntry.subEntries;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
label = _ref[_i]; label = _ref1[_i];
input = label.el.firstChild; input = label.el.firstChild;
input.checked = Conf['Index Mode'] === input.value; input.checked = Conf['Index Mode'] === input.value;
$.on(input, 'change', $.cb.value); $.on(input, 'change', $.cb.value);
@ -5018,9 +5019,9 @@
pinEntry.el.title = 'Move watched threads to the start of the index.'; pinEntry.el.title = 'Move watched threads to the start of the index.';
anchorEntry.el.title = 'Move hidden threads to the end of the index.'; anchorEntry.el.title = 'Move hidden threads to the end of the index.';
refNavEntry.el.title = 'Refresh index when navigating through pages.'; refNavEntry.el.title = 'Refresh index when navigating through pages.';
_ref1 = [targetEntry, repliesEntry, pinEntry, anchorEntry, refNavEntry]; _ref2 = [targetEntry, repliesEntry, pinEntry, anchorEntry, refNavEntry];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
label = _ref1[_j]; label = _ref2[_j];
input = label.el.firstChild; input = label.el.firstChild;
name = input.name; name = input.name;
input.checked = Conf[name]; input.checked = Conf[name];
@ -5071,9 +5072,9 @@
$.on(this.searchInput, 'input', this.onSearchInput); $.on(this.searchInput, 'input', this.onSearchInput);
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch); $.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
$.on($('#hidden-toggle a', this.navLinks), 'click', this.cb.toggleHiddenThreads); $.on($('#hidden-toggle a', this.navLinks), 'click', this.cb.toggleHiddenThreads);
_ref2 = [this.selectMode, this.selectSort, this.selectSize]; _ref3 = [this.selectMode, this.selectSort, this.selectSize];
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) {
select = _ref2[_k]; select = _ref3[_k];
select.value = Conf[select.name]; select.value = Conf[select.name];
$.on(select, 'change', $.cb.value); $.on(select, 'change', $.cb.value);
} }
@ -5116,17 +5117,17 @@
$.asap((function() { $.asap((function() {
return $('.board', doc) || d.readyState !== 'loading'; return $('.board', doc) || d.readyState !== 'loading';
}), function() { }), function() {
var board, navLink, _l, _len3, _ref3, _ref4; var board, navLink, _l, _len3, _ref4, _ref5;
_ref3 = $$('.navLinks'); _ref4 = $$('.navLinks');
for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { for (_l = 0, _len3 = _ref4.length; _l < _len3; _l++) {
navLink = _ref3[_l]; navLink = _ref4[_l];
$.rm(navLink); $.rm(navLink);
} }
if ((_ref4 = $.id('search-box')) != null) { if ((_ref5 = $.id('search-box')) != null) {
_ref4.parentNode.remove(); _ref5.parentNode.remove();
} }
$.after($.x('child::form/preceding-sibling::hr[1]'), Index.navLinks); $.after($.x('child::form/preceding-sibling::hr[1]'), Index.navLinks);
if (g.VIEW !== 'index') { if (g.VIEW !== 'index' || Index.root.parentElement) {
return; return;
} }
board = $('.board'); board = $('.board');
@ -7783,8 +7784,8 @@
}, },
menu: { menu: {
init: function() { init: function() {
var apply, makeStub, replies, thisPost; var apply, makeStub, replies, thisPost, _ref;
if (!Conf['Menu'] || !Conf['Post Hiding Link']) { if (!(Conf['Menu'] && Conf['Post Hiding Link'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread'))) {
return; return;
} }
apply = { apply = {
@ -7880,16 +7881,13 @@
}, },
subEntries: [apply, thisPost, replies] subEntries: [apply, thisPost, replies]
}); });
if (g.VIEW !== 'index') {
return;
}
return Menu.menu.addEntry({ return Menu.menu.addEntry({
el: $.el('a', { el: $.el('a', {
href: 'javascript:;' href: 'javascript:;'
}), }),
order: 20, order: 20,
open: function(post) { open: function(post) {
if (post.isReply) { if (g.VIEW !== 'index' || post.isReply) {
return false; return false;
} }
this.el.textContent = post.isHidden ? 'Unhide thread' : 'Hide thread'; this.el.textContent = post.isHidden ? 'Unhide thread' : 'Hide thread';
@ -10999,13 +10997,13 @@
FappeTyme = { FappeTyme = {
init: function() { init: function() {
var el, lc, type, _i, _len, _ref; var el, lc, type, _i, _len, _ref, _ref1;
if (!(Conf['Fappe Tyme'] || Conf['Werk Tyme']) || g.BOARD.ID === 'f') { if (!((Conf['Fappe Tyme'] || Conf['Werk Tyme']) && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
_ref = ["Fappe", "Werk"]; _ref1 = ["Fappe", "Werk"];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
type = _ref[_i]; type = _ref1[_i];
if (!Conf["" + type + " Tyme"]) { if (!Conf["" + type + " Tyme"]) {
continue; continue;
} }
@ -11055,7 +11053,7 @@
Gallery = { Gallery = {
init: function() { init: function() {
var el, _ref; var el, _ref;
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Gallery']) || g.BOARD === 'f') { if (!(this.enabled = Conf['Gallery'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
this.delay = Conf['Slide Delay']; this.delay = Conf['Slide Delay'];
@ -11431,8 +11429,8 @@
}, },
menu: { menu: {
init: function() { init: function() {
var el, _ref; var el;
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Gallery'])) { if (!Gallery.enabled) {
return; return;
} }
el = $.el('span', { el = $.el('span', {
@ -11622,7 +11620,7 @@
ImageExpand = { ImageExpand = {
init: function() { init: function() {
var _ref; var _ref;
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Image Expansion'])) { if (!(this.enabled = Conf['Image Expansion'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
this.EAI = $.el('a', { this.EAI = $.el('a', {
@ -11981,8 +11979,8 @@
}, },
menu: { menu: {
init: function() { init: function() {
var conf, createSubEntry, el, name, subEntries, _ref, _ref1; var conf, createSubEntry, el, name, subEntries, _ref;
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Image Expansion'])) { if (!ImageExpand.enabled) {
return; return;
} }
el = $.el('span', { el = $.el('span', {
@ -11991,9 +11989,9 @@
}); });
createSubEntry = ImageExpand.menu.createSubEntry; createSubEntry = ImageExpand.menu.createSubEntry;
subEntries = []; subEntries = [];
_ref1 = Config.imageExpansion; _ref = Config.imageExpansion;
for (name in _ref1) { for (name in _ref) {
conf = _ref1[name]; conf = _ref[name];
subEntries.push(createSubEntry(name, conf[1])); subEntries.push(createSubEntry(name, conf[1]));
} }
return Header.menu.addEntry({ return Header.menu.addEntry({
@ -12144,10 +12142,10 @@
ImageLoader = { ImageLoader = {
init: function() { init: function() {
var prefetch, _ref; var prefetch, _ref;
if ((_ref = g.VIEW) !== 'index' && _ref !== 'thread') { if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
if (!(Conf["Image Prefetching"] || Conf["Replace JPG"] || Conf["Replace PNG"] || Conf["Replace GIF"] || Conf["Replace WEBM"])) { if (!(Conf['Image Prefetching'] || Conf['Replace JPG'] || Conf['Replace PNG'] || Conf['Replace GIF'] || Conf['Replace WEBM'])) {
return; return;
} }
Post.callbacks.push({ Post.callbacks.push({
@ -13430,7 +13428,8 @@
Labels = { Labels = {
init: function() { init: function() {
if (!Conf['Menu']) { var _ref;
if (!(Conf['Menu'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread'))) {
return; return;
} }
return Menu.menu.addEntry({ return Menu.menu.addEntry({
@ -14297,7 +14296,7 @@
ThreadWatcher = { ThreadWatcher = {
init: function() { init: function() {
var el; var el, _ref;
if (!Conf['Thread Watcher']) { if (!Conf['Thread Watcher']) {
return; return;
} }
@ -14329,7 +14328,7 @@
}); });
} }
ThreadWatcher.fetchAuto(); ThreadWatcher.fetchAuto();
if (Conf['JSON Navigation'] && Conf['Menu'] && g.BOARD.ID !== 'f') { if (Conf['JSON Navigation'] && Conf['Menu'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f') {
Menu.menu.addEntry({ Menu.menu.addEntry({
el: $.el('a', { el: $.el('a', {
href: 'javascript:;' href: 'javascript:;'
@ -16288,7 +16287,7 @@
return Conf[hotkey] = key; return Conf[hotkey] = key;
}, },
keydown: function(e) { keydown: function(e) {
var form, key, notification, notifications, op, searchInput, target, thread, threadRoot, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6; var form, key, notification, notifications, op, searchInput, target, thread, threadRoot, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
if (!(key = Keybinds.keyCode(e))) { if (!(key = Keybinds.keyCode(e))) {
return; return;
} }
@ -16419,25 +16418,25 @@
ThreadWatcher.toggle(thread); ThreadWatcher.toggle(thread);
break; break;
case Conf['Expand image']: case Conf['Expand image']:
if (!threadRoot) { if (!(ImageExpand.enabled && threadRoot)) {
return; return;
} }
Keybinds.img(threadRoot); Keybinds.img(threadRoot);
break; break;
case Conf['Expand images']: case Conf['Expand images']:
if (!threadRoot) { if (!(ImageExpand.enabled && threadRoot)) {
return; return;
} }
Keybinds.img(threadRoot, true); Keybinds.img(threadRoot, true);
break; break;
case Conf['Open Gallery']: case Conf['Open Gallery']:
if ((_ref2 = g.VIEW) !== 'index' && _ref2 !== 'thread') { if (!Gallery.enabled) {
return; return;
} }
Gallery.cb.toggle(); Gallery.cb.toggle();
break; break;
case Conf['fappeTyme']: case Conf['fappeTyme']:
if (!Conf['Fappe Tyme'] || ((_ref3 = g.VIEW) !== 'index' && _ref3 !== 'thread') || g.BOARD === 'f') { if (!(Conf['Fappe Tyme'] && ((_ref2 = g.VIEW) === 'index' || _ref2 === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
FappeTyme.cb.toggle.call({ FappeTyme.cb.toggle.call({
@ -16445,7 +16444,7 @@
}); });
break; break;
case Conf['werkTyme']: case Conf['werkTyme']:
if (!Conf['Fappe Tyme'] || ((_ref4 = g.VIEW) !== 'index' && _ref4 !== 'thread') || g.BOARD === 'f') { if (!(Conf['Werk Tyme'] && ((_ref3 = g.VIEW) === 'index' || _ref3 === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
FappeTyme.cb.toggle.call({ FappeTyme.cb.toggle.call({
@ -16467,7 +16466,7 @@
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Navigation']) {
if ((_ref5 = Conf['Index Mode']) !== 'paged' && _ref5 !== 'infinite') { if ((_ref4 = Conf['Index Mode']) !== 'paged' && _ref4 !== 'infinite') {
return; return;
} }
$('.next button', Index.pagelist).click(); $('.next button', Index.pagelist).click();
@ -16482,7 +16481,7 @@
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Navigation']) {
if ((_ref6 = Conf['Index Mode']) !== 'paged' && _ref6 !== 'infinite') { if ((_ref5 = Conf['Index Mode']) !== 'paged' && _ref5 !== 'infinite') {
return; return;
} }
$('.prev button', Index.pagelist).click(); $('.prev button', Index.pagelist).click();
@ -16771,6 +16770,9 @@
if (!Conf['Reply Navigation']) { if (!Conf['Reply Navigation']) {
return; return;
} }
break;
default:
return;
} }
prev = $.el('a', { prev = $.el('a', {
href: 'javascript:;', href: 'javascript:;',
@ -18494,7 +18496,8 @@
Navigate = { Navigate = {
path: window.location.pathname, path: window.location.pathname,
init: function() { init: function() {
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation']) { var _ref;
if (!(Conf['JSON Navigation'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
$.on(window, 'popstate', Navigate.popstate); $.on(window, 'popstate', Navigate.popstate);

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // Generated by CoffeeScript
/* /*
* appchan x - Version 2.10.4 - 2015-01-24 * appchan x - Version 2.10.4 - 2015-01-26
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -135,7 +135,8 @@
'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'], 'Reveal Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled, or make the text appear hovered if Remove Spoiler is disabled.'],
'Show Support Message': [true, 'Warn if your browser is unsupported. appchan x may not operate correctly on unsupported browser versions.'], 'Show Support Message': [true, 'Warn if your browser is unsupported. appchan x may not operate correctly on unsupported browser versions.'],
'Normalize URL': [true, 'Rewrite the URL of the current page, removing stubs and changing /res/ to /thread/.'], 'Normalize URL': [true, 'Rewrite the URL of the current page, removing stubs and changing /res/ to /thread/.'],
'Announcement Hiding': [true, 'Enable announcements to be hidden.'] 'Announcement Hiding': [true, 'Enable announcements to be hidden.'],
'Disable Autoplaying Sounds': [false, 'Prevent sounds on the page from autoplaying.']
}, },
'Linkification': { 'Linkification': {
'Linkify': [true, 'Convert text into links where applicable.'], 'Linkify': [true, 'Convert text into links where applicable.'],
@ -4952,8 +4953,8 @@
Index = { Index = {
showHiddenThreads: false, showHiddenThreads: false,
init: function() { init: function() {
var anchorEntry, input, label, modeEntry, name, pinEntry, refNavEntry, repliesEntry, returnLink, select, sortEntry, targetEntry, threadNumEntry, threadsNumInput, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2; var anchorEntry, input, label, modeEntry, name, pinEntry, refNavEntry, repliesEntry, returnLink, select, sortEntry, targetEntry, threadNumEntry, threadsNumInput, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3;
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation']) { if (!(Conf['JSON Navigation'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
this.board = "" + g.BOARD; this.board = "" + g.BOARD;
@ -4994,9 +4995,9 @@
} }
] ]
}; };
_ref = modeEntry.subEntries; _ref1 = modeEntry.subEntries;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
label = _ref[_i]; label = _ref1[_i];
input = label.el.firstChild; input = label.el.firstChild;
input.checked = Conf['Index Mode'] === input.value; input.checked = Conf['Index Mode'] === input.value;
$.on(input, 'change', $.cb.value); $.on(input, 'change', $.cb.value);
@ -5043,9 +5044,9 @@
pinEntry.el.title = 'Move watched threads to the start of the index.'; pinEntry.el.title = 'Move watched threads to the start of the index.';
anchorEntry.el.title = 'Move hidden threads to the end of the index.'; anchorEntry.el.title = 'Move hidden threads to the end of the index.';
refNavEntry.el.title = 'Refresh index when navigating through pages.'; refNavEntry.el.title = 'Refresh index when navigating through pages.';
_ref1 = [targetEntry, repliesEntry, pinEntry, anchorEntry, refNavEntry]; _ref2 = [targetEntry, repliesEntry, pinEntry, anchorEntry, refNavEntry];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
label = _ref1[_j]; label = _ref2[_j];
input = label.el.firstChild; input = label.el.firstChild;
name = input.name; name = input.name;
input.checked = Conf[name]; input.checked = Conf[name];
@ -5096,9 +5097,9 @@
$.on(this.searchInput, 'input', this.onSearchInput); $.on(this.searchInput, 'input', this.onSearchInput);
$.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch); $.on($('#index-search-clear', this.navLinks), 'click', this.clearSearch);
$.on($('#hidden-toggle a', this.navLinks), 'click', this.cb.toggleHiddenThreads); $.on($('#hidden-toggle a', this.navLinks), 'click', this.cb.toggleHiddenThreads);
_ref2 = [this.selectMode, this.selectSort, this.selectSize]; _ref3 = [this.selectMode, this.selectSort, this.selectSize];
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) {
select = _ref2[_k]; select = _ref3[_k];
select.value = Conf[select.name]; select.value = Conf[select.name];
$.on(select, 'change', $.cb.value); $.on(select, 'change', $.cb.value);
} }
@ -5141,17 +5142,17 @@
$.asap((function() { $.asap((function() {
return $('.board', doc) || d.readyState !== 'loading'; return $('.board', doc) || d.readyState !== 'loading';
}), function() { }), function() {
var board, navLink, _l, _len3, _ref3, _ref4; var board, navLink, _l, _len3, _ref4, _ref5;
_ref3 = $$('.navLinks'); _ref4 = $$('.navLinks');
for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { for (_l = 0, _len3 = _ref4.length; _l < _len3; _l++) {
navLink = _ref3[_l]; navLink = _ref4[_l];
$.rm(navLink); $.rm(navLink);
} }
if ((_ref4 = $.id('search-box')) != null) { if ((_ref5 = $.id('search-box')) != null) {
_ref4.parentNode.remove(); _ref5.parentNode.remove();
} }
$.after($.x('child::form/preceding-sibling::hr[1]'), Index.navLinks); $.after($.x('child::form/preceding-sibling::hr[1]'), Index.navLinks);
if (g.VIEW !== 'index') { if (g.VIEW !== 'index' || Index.root.parentElement) {
return; return;
} }
board = $('.board'); board = $('.board');
@ -7824,8 +7825,8 @@
}, },
menu: { menu: {
init: function() { init: function() {
var apply, makeStub, replies, thisPost; var apply, makeStub, replies, thisPost, _ref;
if (!Conf['Menu'] || !Conf['Post Hiding Link']) { if (!(Conf['Menu'] && Conf['Post Hiding Link'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread'))) {
return; return;
} }
apply = { apply = {
@ -7921,16 +7922,13 @@
}, },
subEntries: [apply, thisPost, replies] subEntries: [apply, thisPost, replies]
}); });
if (g.VIEW !== 'index') {
return;
}
return Menu.menu.addEntry({ return Menu.menu.addEntry({
el: $.el('a', { el: $.el('a', {
href: 'javascript:;' href: 'javascript:;'
}), }),
order: 20, order: 20,
open: function(post) { open: function(post) {
if (post.isReply) { if (g.VIEW !== 'index' || post.isReply) {
return false; return false;
} }
this.el.textContent = post.isHidden ? 'Unhide thread' : 'Hide thread'; this.el.textContent = post.isHidden ? 'Unhide thread' : 'Hide thread';
@ -11035,13 +11033,13 @@
FappeTyme = { FappeTyme = {
init: function() { init: function() {
var el, lc, type, _i, _len, _ref; var el, lc, type, _i, _len, _ref, _ref1;
if (!(Conf['Fappe Tyme'] || Conf['Werk Tyme']) || g.BOARD.ID === 'f') { if (!((Conf['Fappe Tyme'] || Conf['Werk Tyme']) && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
_ref = ["Fappe", "Werk"]; _ref1 = ["Fappe", "Werk"];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
type = _ref[_i]; type = _ref1[_i];
if (!Conf["" + type + " Tyme"]) { if (!Conf["" + type + " Tyme"]) {
continue; continue;
} }
@ -11091,7 +11089,7 @@
Gallery = { Gallery = {
init: function() { init: function() {
var el, _ref; var el, _ref;
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Gallery']) || g.BOARD === 'f') { if (!(this.enabled = Conf['Gallery'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
this.delay = Conf['Slide Delay']; this.delay = Conf['Slide Delay'];
@ -11467,8 +11465,8 @@
}, },
menu: { menu: {
init: function() { init: function() {
var el, _ref; var el;
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Gallery'])) { if (!Gallery.enabled) {
return; return;
} }
el = $.el('span', { el = $.el('span', {
@ -11645,7 +11643,7 @@
ImageExpand = { ImageExpand = {
init: function() { init: function() {
var _ref; var _ref;
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Image Expansion'])) { if (!(this.enabled = Conf['Image Expansion'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
this.EAI = $.el('a', { this.EAI = $.el('a', {
@ -12004,8 +12002,8 @@
}, },
menu: { menu: {
init: function() { init: function() {
var conf, createSubEntry, el, name, subEntries, _ref, _ref1; var conf, createSubEntry, el, name, subEntries, _ref;
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Image Expansion'])) { if (!ImageExpand.enabled) {
return; return;
} }
el = $.el('span', { el = $.el('span', {
@ -12014,9 +12012,9 @@
}); });
createSubEntry = ImageExpand.menu.createSubEntry; createSubEntry = ImageExpand.menu.createSubEntry;
subEntries = []; subEntries = [];
_ref1 = Config.imageExpansion; _ref = Config.imageExpansion;
for (name in _ref1) { for (name in _ref) {
conf = _ref1[name]; conf = _ref[name];
subEntries.push(createSubEntry(name, conf[1])); subEntries.push(createSubEntry(name, conf[1]));
} }
return Header.menu.addEntry({ return Header.menu.addEntry({
@ -12167,10 +12165,10 @@
ImageLoader = { ImageLoader = {
init: function() { init: function() {
var prefetch, _ref; var prefetch, _ref;
if ((_ref = g.VIEW) !== 'index' && _ref !== 'thread') { if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
if (!(Conf["Image Prefetching"] || Conf["Replace JPG"] || Conf["Replace PNG"] || Conf["Replace GIF"] || Conf["Replace WEBM"])) { if (!(Conf['Image Prefetching'] || Conf['Replace JPG'] || Conf['Replace PNG'] || Conf['Replace GIF'] || Conf['Replace WEBM'])) {
return; return;
} }
Post.callbacks.push({ Post.callbacks.push({
@ -13453,7 +13451,8 @@
Labels = { Labels = {
init: function() { init: function() {
if (!Conf['Menu']) { var _ref;
if (!(Conf['Menu'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread'))) {
return; return;
} }
return Menu.menu.addEntry({ return Menu.menu.addEntry({
@ -14320,7 +14319,7 @@
ThreadWatcher = { ThreadWatcher = {
init: function() { init: function() {
var el; var el, _ref;
if (!Conf['Thread Watcher']) { if (!Conf['Thread Watcher']) {
return; return;
} }
@ -14352,7 +14351,7 @@
}); });
} }
ThreadWatcher.fetchAuto(); ThreadWatcher.fetchAuto();
if (Conf['JSON Navigation'] && Conf['Menu'] && g.BOARD.ID !== 'f') { if (Conf['JSON Navigation'] && Conf['Menu'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f') {
Menu.menu.addEntry({ Menu.menu.addEntry({
el: $.el('a', { el: $.el('a', {
href: 'javascript:;' href: 'javascript:;'
@ -16310,7 +16309,7 @@
return Conf[hotkey] = key; return Conf[hotkey] = key;
}, },
keydown: function(e) { keydown: function(e) {
var form, key, notification, notifications, op, searchInput, target, thread, threadRoot, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6; var form, key, notification, notifications, op, searchInput, target, thread, threadRoot, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
if (!(key = Keybinds.keyCode(e))) { if (!(key = Keybinds.keyCode(e))) {
return; return;
} }
@ -16441,25 +16440,25 @@
ThreadWatcher.toggle(thread); ThreadWatcher.toggle(thread);
break; break;
case Conf['Expand image']: case Conf['Expand image']:
if (!threadRoot) { if (!(ImageExpand.enabled && threadRoot)) {
return; return;
} }
Keybinds.img(threadRoot); Keybinds.img(threadRoot);
break; break;
case Conf['Expand images']: case Conf['Expand images']:
if (!threadRoot) { if (!(ImageExpand.enabled && threadRoot)) {
return; return;
} }
Keybinds.img(threadRoot, true); Keybinds.img(threadRoot, true);
break; break;
case Conf['Open Gallery']: case Conf['Open Gallery']:
if ((_ref2 = g.VIEW) !== 'index' && _ref2 !== 'thread') { if (!Gallery.enabled) {
return; return;
} }
Gallery.cb.toggle(); Gallery.cb.toggle();
break; break;
case Conf['fappeTyme']: case Conf['fappeTyme']:
if (!Conf['Fappe Tyme'] || ((_ref3 = g.VIEW) !== 'index' && _ref3 !== 'thread') || g.BOARD === 'f') { if (!(Conf['Fappe Tyme'] && ((_ref2 = g.VIEW) === 'index' || _ref2 === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
FappeTyme.cb.toggle.call({ FappeTyme.cb.toggle.call({
@ -16467,7 +16466,7 @@
}); });
break; break;
case Conf['werkTyme']: case Conf['werkTyme']:
if (!Conf['Fappe Tyme'] || ((_ref4 = g.VIEW) !== 'index' && _ref4 !== 'thread') || g.BOARD === 'f') { if (!(Conf['Werk Tyme'] && ((_ref3 = g.VIEW) === 'index' || _ref3 === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
FappeTyme.cb.toggle.call({ FappeTyme.cb.toggle.call({
@ -16489,7 +16488,7 @@
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Navigation']) {
if ((_ref5 = Conf['Index Mode']) !== 'paged' && _ref5 !== 'infinite') { if ((_ref4 = Conf['Index Mode']) !== 'paged' && _ref4 !== 'infinite') {
return; return;
} }
$('.next button', Index.pagelist).click(); $('.next button', Index.pagelist).click();
@ -16504,7 +16503,7 @@
return; return;
} }
if (Conf['JSON Navigation']) { if (Conf['JSON Navigation']) {
if ((_ref6 = Conf['Index Mode']) !== 'paged' && _ref6 !== 'infinite') { if ((_ref5 = Conf['Index Mode']) !== 'paged' && _ref5 !== 'infinite') {
return; return;
} }
$('.prev button', Index.pagelist).click(); $('.prev button', Index.pagelist).click();
@ -16793,6 +16792,9 @@
if (!Conf['Reply Navigation']) { if (!Conf['Reply Navigation']) {
return; return;
} }
break;
default:
return;
} }
prev = $.el('a', { prev = $.el('a', {
href: 'javascript:;', href: 'javascript:;',
@ -18522,8 +18524,8 @@
Navigate = { Navigate = {
path: window.location.pathname, path: window.location.pathname,
init: function() { init: function() {
var popstateHack; var popstateHack, _ref;
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation']) { if (!(Conf['JSON Navigation'] && ((_ref = g.VIEW) === 'index' || _ref === 'thread') && g.BOARD.ID !== 'f')) {
return; return;
} }
popstateHack = function() { popstateHack = function() {

View File

@ -75,7 +75,7 @@ PostHiding =
menu: menu:
init: -> init: ->
return if !Conf['Menu'] or !Conf['Post Hiding Link'] return unless Conf['Menu'] and Conf['Post Hiding Link'] and g.VIEW in ['index', 'thread']
# Hide # Hide
apply = apply =
@ -132,12 +132,11 @@ PostHiding =
true true
subEntries: [apply, thisPost, replies] subEntries: [apply, thisPost, replies]
return if g.VIEW isnt 'index'
Menu.menu.addEntry Menu.menu.addEntry
el: $.el 'a', href: 'javascript:;' el: $.el 'a', href: 'javascript:;'
order: 20 order: 20
open: (post) -> open: (post) ->
return false if post.isReply return false if g.VIEW isnt 'index' or post.isReply
@el.textContent = if post.isHidden @el.textContent = if post.isHidden
'Unhide thread' 'Unhide thread'
else else

View File

@ -94,6 +94,10 @@ Config =
true true
'Enable announcements to be hidden.' 'Enable announcements to be hidden.'
] ]
'Disable Autoplaying Sounds': [
false
'Prevent sounds on the page from autoplaying.'
]
'Linkification': 'Linkification':
'Linkify': [ 'Linkify': [

View File

@ -1,7 +1,7 @@
Index = Index =
showHiddenThreads: false showHiddenThreads: false
init: -> init: ->
return if g.BOARD.ID is 'f' or !Conf['JSON Navigation'] return unless Conf['JSON Navigation'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f'
@board = "#{g.BOARD}" @board = "#{g.BOARD}"
@ -155,7 +155,7 @@ Index =
$.id('search-box')?.parentNode.remove() $.id('search-box')?.parentNode.remove()
$.after $.x('child::form/preceding-sibling::hr[1]'), Index.navLinks $.after $.x('child::form/preceding-sibling::hr[1]'), Index.navLinks
return if g.VIEW isnt 'index' return if g.VIEW isnt 'index' or Index.root.parentElement
board = $ '.board' board = $ '.board'
$.replace board, Index.root $.replace board, Index.root

View File

@ -1,7 +1,7 @@
Navigate = Navigate =
path: window.location.pathname path: window.location.pathname
init: -> init: ->
return if g.BOARD.ID is 'f' or !Conf['JSON Navigation'] return unless Conf['JSON Navigation'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f'
<% if (type === 'crx') { %> <% if (type === 'crx') { %>
# blink/webkit throw a popstate on page load. Not what we want. # blink/webkit throw a popstate on page load. Not what we want.

View File

@ -1,6 +1,6 @@
FappeTyme = FappeTyme =
init: -> init: ->
return if !(Conf['Fappe Tyme'] or Conf['Werk Tyme']) or g.BOARD.ID is 'f' return unless (Conf['Fappe Tyme'] or Conf['Werk Tyme']) and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f'
for type in ["Fappe", "Werk"] when Conf["#{type} Tyme"] for type in ["Fappe", "Werk"] when Conf["#{type} Tyme"]
lc = type.toLowerCase() lc = type.toLowerCase()

View File

@ -1,6 +1,6 @@
Gallery = Gallery =
init: -> init: ->
return if not (g.VIEW in ['index', 'thread'] and Conf['Gallery']) or g.BOARD is 'f' return unless @enabled = Conf['Gallery'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f'
@delay = Conf['Slide Delay'] @delay = Conf['Slide Delay']
@ -297,7 +297,7 @@ Gallery =
menu: menu:
init: -> init: ->
return unless g.VIEW in ['index', 'thread'] and Conf['Gallery'] return unless Gallery.enabled
el = $.el 'span', el = $.el 'span',
textContent: 'Gallery' textContent: 'Gallery'

View File

@ -1,6 +1,6 @@
ImageExpand = ImageExpand =
init: -> init: ->
return unless g.VIEW in ['index', 'thread'] and Conf['Image Expansion'] return unless @enabled = Conf['Image Expansion'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f'
@EAI = $.el 'a', @EAI = $.el 'a',
id: 'img-controls' id: 'img-controls'
@ -280,7 +280,7 @@ ImageExpand =
menu: menu:
init: -> init: ->
return unless g.VIEW in ['index', 'thread'] and Conf['Image Expansion'] return unless ImageExpand.enabled
el = $.el 'span', el = $.el 'span',
textContent: 'Image Expansion' textContent: 'Image Expansion'

View File

@ -1,8 +1,8 @@
ImageLoader = ImageLoader =
init: -> init: ->
return unless g.VIEW in ['index', 'thread'] return unless g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f'
return unless Conf["Image Prefetching"] or return unless Conf['Image Prefetching'] or
Conf["Replace JPG"] or Conf["Replace PNG"] or Conf["Replace GIF"] or Conf["Replace WEBM"] Conf['Replace JPG'] or Conf['Replace PNG'] or Conf['Replace GIF'] or Conf['Replace WEBM']
Post.callbacks.push Post.callbacks.push
name: 'Image Replace' name: 'Image Replace'

View File

@ -1,6 +1,6 @@
Labels = Labels =
init: -> init: ->
return if !Conf['Menu'] return unless Conf['Menu'] and g.VIEW in ['index', 'thread']
Menu.menu.addEntry Menu.menu.addEntry
el: $.el 'div', textContent: 'Labels' el: $.el 'div', textContent: 'Labels'

View File

@ -93,19 +93,19 @@ Keybinds =
ThreadWatcher.toggle thread ThreadWatcher.toggle thread
# Images # Images
when Conf['Expand image'] when Conf['Expand image']
return unless threadRoot return unless ImageExpand.enabled and threadRoot
Keybinds.img threadRoot Keybinds.img threadRoot
when Conf['Expand images'] when Conf['Expand images']
return unless threadRoot return unless ImageExpand.enabled and threadRoot
Keybinds.img threadRoot, true Keybinds.img threadRoot, true
when Conf['Open Gallery'] when Conf['Open Gallery']
return unless g.VIEW in ['index', 'thread'] return unless Gallery.enabled
Gallery.cb.toggle() Gallery.cb.toggle()
when Conf['fappeTyme'] when Conf['fappeTyme']
return if !Conf['Fappe Tyme'] or g.VIEW not in ['index', 'thread'] or g.BOARD is 'f' return unless Conf['Fappe Tyme'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f'
FappeTyme.cb.toggle.call {name: 'fappe'} FappeTyme.cb.toggle.call {name: 'fappe'}
when Conf['werkTyme'] when Conf['werkTyme']
return if !Conf['Fappe Tyme'] or g.VIEW not in ['index', 'thread'] or g.BOARD is 'f' return unless Conf['Werk Tyme'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f'
FappeTyme.cb.toggle.call {name: 'werk'} FappeTyme.cb.toggle.call {name: 'werk'}
# Board Navigation # Board Navigation
when Conf['Front page'] when Conf['Front page']

View File

@ -5,6 +5,8 @@ Nav =
return unless Conf['Index Navigation'] return unless Conf['Index Navigation']
when 'thread' when 'thread'
return unless Conf['Reply Navigation'] return unless Conf['Reply Navigation']
else
return
prev = $.el 'a', prev = $.el 'a',
href: 'javascript:;' href: 'javascript:;'

View File

@ -29,7 +29,7 @@ ThreadWatcher =
ThreadWatcher.fetchAuto() ThreadWatcher.fetchAuto()
if Conf['JSON Navigation'] and Conf['Menu'] and g.BOARD.ID isnt 'f' if Conf['JSON Navigation'] and Conf['Menu'] and g.VIEW in ['index', 'thread'] and g.BOARD.ID isnt 'f'
Menu.menu.addEntry Menu.menu.addEntry
el: $.el 'a', href: 'javascript:;' el: $.el 'a', href: 'javascript:;'
order: 6 order: 6