Keybinds
This commit is contained in:
parent
f10b3ad9f6
commit
13d5542997
@ -15245,7 +15245,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;
|
var form, key, notification, notifications, op, searchInput, target, thread, threadRoot, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4;
|
||||||
if (!(key = Keybinds.keyCode(e))) {
|
if (!(key = Keybinds.keyCode(e))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -15258,7 +15258,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (g.VIEW !== 'catalog') {
|
if (!(((_ref1 = g.VIEW) !== 'index' && _ref1 !== 'thread') || g.VIEW === 'index' && Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog')) {
|
||||||
threadRoot = Nav.getThread();
|
threadRoot = Nav.getThread();
|
||||||
if (op = $('.op', threadRoot)) {
|
if (op = $('.op', threadRoot)) {
|
||||||
thread = Get.postFromNode(op).thread;
|
thread = Get.postFromNode(op).thread;
|
||||||
@ -15277,120 +15277,117 @@
|
|||||||
Keybinds.qr();
|
Keybinds.qr();
|
||||||
break;
|
break;
|
||||||
case Conf['Open QR']:
|
case Conf['Open QR']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.qr(threadRoot);
|
||||||
}
|
}
|
||||||
Keybinds.qr(threadRoot);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Open settings']:
|
case Conf['Open settings']:
|
||||||
Settings.open();
|
Settings.open();
|
||||||
break;
|
break;
|
||||||
case Conf['Close']:
|
case Conf['Close']:
|
||||||
if ($.id('fourchanx-settings')) {
|
if (Settings.dialog) {
|
||||||
Settings.close();
|
Settings.close();
|
||||||
} else if ((notifications = $$('.notification')).length) {
|
} else if ((notifications = $$('.notification')).length) {
|
||||||
for (_i = 0, _len = notifications.length; _i < _len; _i++) {
|
for (_i = 0, _len = notifications.length; _i < _len; _i++) {
|
||||||
notification = notifications[_i];
|
notification = notifications[_i];
|
||||||
$('.close', notification).click();
|
$('.close', notification).click();
|
||||||
}
|
}
|
||||||
} else if (QR.nodes) {
|
} else if (QR.nodes && !(QR.nodes.el.hidden || window.getComputedStyle(QR.nodes.form).display === 'none')) {
|
||||||
if (Conf['Persistent QR']) {
|
if (Conf['Persistent QR']) {
|
||||||
QR.hide();
|
QR.hide();
|
||||||
} else {
|
} else {
|
||||||
QR.close();
|
QR.close();
|
||||||
}
|
}
|
||||||
|
} else if (Embedding.lastEmbed) {
|
||||||
|
Embedding.closeFloat();
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
case Conf['Spoiler tags']:
|
case Conf['Spoiler tags']:
|
||||||
if (target.nodeName !== 'TEXTAREA') {
|
if (target.nodeName === 'TEXTAREA') {
|
||||||
return;
|
Keybinds.tags('spoiler', target);
|
||||||
}
|
}
|
||||||
Keybinds.tags('spoiler', target);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Code tags']:
|
case Conf['Code tags']:
|
||||||
if (target.nodeName !== 'TEXTAREA') {
|
if (target.nodeName === 'TEXTAREA') {
|
||||||
return;
|
Keybinds.tags('code', target);
|
||||||
}
|
}
|
||||||
Keybinds.tags('code', target);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Eqn tags']:
|
case Conf['Eqn tags']:
|
||||||
if (target.nodeName !== 'TEXTAREA') {
|
if (target.nodeName === 'TEXTAREA') {
|
||||||
return;
|
Keybinds.tags('eqn', target);
|
||||||
}
|
}
|
||||||
Keybinds.tags('eqn', target);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Math tags']:
|
case Conf['Math tags']:
|
||||||
if (target.nodeName !== 'TEXTAREA') {
|
if (target.nodeName === 'TEXTAREA') {
|
||||||
return;
|
Keybinds.tags('math', target);
|
||||||
}
|
}
|
||||||
Keybinds.tags('math', target);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Toggle sage']:
|
case Conf['Toggle sage']:
|
||||||
if (QR.nodes) {
|
if (QR.nodes && !QR.nodes.el.hidden) {
|
||||||
Keybinds.sage();
|
Keybinds.sage();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Conf['Submit QR']:
|
case Conf['Submit QR']:
|
||||||
if (QR.nodes && !QR.status()) {
|
if (QR.nodes && !QR.nodes.el.hidden && !QR.status()) {
|
||||||
QR.submit();
|
QR.submit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Conf['Post Without Name']:
|
case Conf['Post Without Name']:
|
||||||
if (QR.nodes && !QR.status()) {
|
if (!(QR.nodes && !QR.status())) {
|
||||||
Keybinds.name();
|
return;
|
||||||
QR.submit();
|
|
||||||
}
|
}
|
||||||
|
Keybinds.name();
|
||||||
|
QR.submit();
|
||||||
break;
|
break;
|
||||||
case Conf['Update']:
|
case Conf['Update']:
|
||||||
switch (g.VIEW) {
|
switch (g.VIEW) {
|
||||||
case 'thread':
|
case 'thread':
|
||||||
ThreadUpdater.update();
|
if (Conf['Thread Updater']) {
|
||||||
|
ThreadUpdater.update();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'index':
|
case 'index':
|
||||||
if (Conf['JSON Navigation']) {
|
if (Conf['JSON Navigation']) {
|
||||||
Index.update();
|
Index.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
case Conf['Watch']:
|
case Conf['Watch']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (!thread) {
|
||||||
return;
|
ThreadWatcher.toggle(thread);
|
||||||
}
|
}
|
||||||
ThreadWatcher.toggle(thread);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Expand image']:
|
case Conf['Expand image']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.img(threadRoot);
|
||||||
}
|
}
|
||||||
Keybinds.img(threadRoot);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Expand images']:
|
case Conf['Expand images']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.img(threadRoot, true);
|
||||||
}
|
}
|
||||||
Keybinds.img(threadRoot, true);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Open Gallery']:
|
case Conf['Open Gallery']:
|
||||||
if (g.VIEW === 'catalog') {
|
if ((_ref2 = g.VIEW) === 'index' || _ref2 === 'thread') {
|
||||||
return;
|
Gallery.cb.toggle();
|
||||||
}
|
}
|
||||||
Gallery.cb.toggle();
|
|
||||||
break;
|
break;
|
||||||
case Conf['fappeTyme']:
|
case Conf['fappeTyme']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (Conf['Fappe Tyme'] && ((_ref3 = g.VIEW) === 'index' || _ref3 === 'thread') && g.BOARD !== 'f') {
|
||||||
return;
|
FappeTyme.cb.toggle.call({
|
||||||
|
name: 'fappe'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
FappeTyme.cb.toggle.call({
|
|
||||||
name: 'fappe'
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case Conf['werkTyme']:
|
case Conf['werkTyme']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (g.VIEW === 'catalog') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FappeTyme.cb.toggle.call({
|
if (Conf['Fappe Tyme'] && ((_ref4 = g.VIEW) === 'index' || _ref4 === 'thread') && g.BOARD !== 'f') {
|
||||||
name: 'werk'
|
FappeTyme.cb.toggle.call({
|
||||||
});
|
name: 'werk'
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Conf['Front page']:
|
case Conf['Front page']:
|
||||||
if (Conf['JSON Navigation'] && g.VIEW === 'index') {
|
if (Conf['JSON Navigation'] && g.VIEW === 'index') {
|
||||||
@ -15436,7 +15433,6 @@
|
|||||||
}
|
}
|
||||||
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box');
|
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box');
|
||||||
Header.scrollToIfNeeded(searchInput);
|
Header.scrollToIfNeeded(searchInput);
|
||||||
searchInput.click();
|
|
||||||
searchInput.focus();
|
searchInput.focus();
|
||||||
break;
|
break;
|
||||||
case Conf['Paged mode']:
|
case Conf['Paged mode']:
|
||||||
@ -15476,62 +15472,63 @@
|
|||||||
Index.setIndexMode('catalog');
|
Index.setIndexMode('catalog');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Conf['Next thread']:
|
case Conf['Cycle sort type']:
|
||||||
if (g.VIEW !== 'index' || Conf['Index Mode'] === 'catalog') {
|
if (Conf['JSON Navigation'] && g.VIEW === 'index' && g.BOARD !== 'f') {
|
||||||
return;
|
Index.cycleSortType();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Conf['Next thread']:
|
||||||
|
if (g.VIEW === 'index' && threadRoot) {
|
||||||
|
Nav.scroll(+1);
|
||||||
}
|
}
|
||||||
Nav.scroll(+1);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Previous thread']:
|
case Conf['Previous thread']:
|
||||||
if (g.VIEW !== 'index' || Conf['Index Mode'] === 'catalog') {
|
if (g.VIEW === 'index' && threadRoot) {
|
||||||
return;
|
Nav.scroll(-1);
|
||||||
}
|
}
|
||||||
Nav.scroll(-1);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Expand thread']:
|
case Conf['Expand thread']:
|
||||||
if (g.VIEW !== 'index' || Conf['Index Mode'] === 'catalog') {
|
if (g.VIEW === 'index' && threadRoot) {
|
||||||
return;
|
ExpandThread.toggle(thread);
|
||||||
}
|
}
|
||||||
ExpandThread.toggle(thread);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Open thread']:
|
case Conf['Open thread']:
|
||||||
if (g.VIEW !== 'index' || Conf['Index Mode'] === 'catalog') {
|
if (g.VIEW === 'index' && threadRoot) {
|
||||||
return;
|
Keybinds.open(thread);
|
||||||
}
|
}
|
||||||
Keybinds.open(thread);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Open thread tab']:
|
case Conf['Open thread tab']:
|
||||||
if (g.VIEW !== 'index' || Conf['Index Mode'] === 'catalog') {
|
if (g.VIEW === 'index' && threadRoot) {
|
||||||
return;
|
Keybinds.open(thread, true);
|
||||||
}
|
}
|
||||||
Keybinds.open(thread, true);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Next reply']:
|
case Conf['Next reply']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.hl(+1, threadRoot);
|
||||||
}
|
}
|
||||||
Keybinds.hl(+1, threadRoot);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Previous reply']:
|
case Conf['Previous reply']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.hl(-1, threadRoot);
|
||||||
}
|
}
|
||||||
Keybinds.hl(-1, threadRoot);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Deselect reply']:
|
case Conf['Deselect reply']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.hl(0, threadRoot);
|
||||||
}
|
}
|
||||||
Keybinds.hl(0, threadRoot);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Hide']:
|
case Conf['Hide']:
|
||||||
PostHiding.toggle(thread.OP);
|
PostHiding.toggle(thread.OP);
|
||||||
break;
|
break;
|
||||||
case Conf['Previous Post Quoting You']:
|
case Conf['Previous Post Quoting You']:
|
||||||
QuoteMarkers.cb.seek('preceding');
|
if (threadRoot) {
|
||||||
|
QuoteMarkers.cb.seek('preceding');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Conf['Next Post Quoting You']:
|
case Conf['Next Post Quoting You']:
|
||||||
QuoteMarkers.cb.seek('following');
|
if (threadRoot) {
|
||||||
|
QuoteMarkers.cb.seek('following');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@ -15595,7 +15592,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
tags: function(tag, ta) {
|
tags: function(tag, ta) {
|
||||||
var range, selEnd, selStart, value;
|
var range, selEnd, selStart, supported, value;
|
||||||
|
supported = (function() {
|
||||||
|
switch (tag) {
|
||||||
|
case 'spoiler':
|
||||||
|
return !!$('.postForm input[name=spoiler]');
|
||||||
|
case 'code':
|
||||||
|
return g.BOARD.ID === 'g';
|
||||||
|
case 'math':
|
||||||
|
case 'eqn':
|
||||||
|
return g.BOARD.ID === 'sci';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
if (!supported) {
|
||||||
|
new Notice('warning', "[" + tag + "] tags are not supported on /" + g.BOARD + "/.", 20);
|
||||||
|
}
|
||||||
value = ta.value;
|
value = ta.value;
|
||||||
selStart = ta.selectionStart;
|
selStart = ta.selectionStart;
|
||||||
selEnd = ta.selectionEnd;
|
selEnd = ta.selectionEnd;
|
||||||
|
|||||||
@ -15266,7 +15266,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;
|
var form, key, notification, notifications, op, searchInput, target, thread, threadRoot, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4;
|
||||||
if (!(key = Keybinds.keyCode(e))) {
|
if (!(key = Keybinds.keyCode(e))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -15279,7 +15279,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (g.VIEW !== 'catalog') {
|
if (!(((_ref1 = g.VIEW) !== 'index' && _ref1 !== 'thread') || g.VIEW === 'index' && Conf['JSON Navigation'] && Conf['Index Mode'] === 'catalog')) {
|
||||||
threadRoot = Nav.getThread();
|
threadRoot = Nav.getThread();
|
||||||
if (op = $('.op', threadRoot)) {
|
if (op = $('.op', threadRoot)) {
|
||||||
thread = Get.postFromNode(op).thread;
|
thread = Get.postFromNode(op).thread;
|
||||||
@ -15298,120 +15298,117 @@
|
|||||||
Keybinds.qr();
|
Keybinds.qr();
|
||||||
break;
|
break;
|
||||||
case Conf['Open QR']:
|
case Conf['Open QR']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.qr(threadRoot);
|
||||||
}
|
}
|
||||||
Keybinds.qr(threadRoot);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Open settings']:
|
case Conf['Open settings']:
|
||||||
Settings.open();
|
Settings.open();
|
||||||
break;
|
break;
|
||||||
case Conf['Close']:
|
case Conf['Close']:
|
||||||
if ($.id('fourchanx-settings')) {
|
if (Settings.dialog) {
|
||||||
Settings.close();
|
Settings.close();
|
||||||
} else if ((notifications = $$('.notification')).length) {
|
} else if ((notifications = $$('.notification')).length) {
|
||||||
for (_i = 0, _len = notifications.length; _i < _len; _i++) {
|
for (_i = 0, _len = notifications.length; _i < _len; _i++) {
|
||||||
notification = notifications[_i];
|
notification = notifications[_i];
|
||||||
$('.close', notification).click();
|
$('.close', notification).click();
|
||||||
}
|
}
|
||||||
} else if (QR.nodes) {
|
} else if (QR.nodes && !(QR.nodes.el.hidden || window.getComputedStyle(QR.nodes.form).display === 'none')) {
|
||||||
if (Conf['Persistent QR']) {
|
if (Conf['Persistent QR']) {
|
||||||
QR.hide();
|
QR.hide();
|
||||||
} else {
|
} else {
|
||||||
QR.close();
|
QR.close();
|
||||||
}
|
}
|
||||||
|
} else if (Embedding.lastEmbed) {
|
||||||
|
Embedding.closeFloat();
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
case Conf['Spoiler tags']:
|
case Conf['Spoiler tags']:
|
||||||
if (target.nodeName !== 'TEXTAREA') {
|
if (target.nodeName === 'TEXTAREA') {
|
||||||
return;
|
Keybinds.tags('spoiler', target);
|
||||||
}
|
}
|
||||||
Keybinds.tags('spoiler', target);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Code tags']:
|
case Conf['Code tags']:
|
||||||
if (target.nodeName !== 'TEXTAREA') {
|
if (target.nodeName === 'TEXTAREA') {
|
||||||
return;
|
Keybinds.tags('code', target);
|
||||||
}
|
}
|
||||||
Keybinds.tags('code', target);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Eqn tags']:
|
case Conf['Eqn tags']:
|
||||||
if (target.nodeName !== 'TEXTAREA') {
|
if (target.nodeName === 'TEXTAREA') {
|
||||||
return;
|
Keybinds.tags('eqn', target);
|
||||||
}
|
}
|
||||||
Keybinds.tags('eqn', target);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Math tags']:
|
case Conf['Math tags']:
|
||||||
if (target.nodeName !== 'TEXTAREA') {
|
if (target.nodeName === 'TEXTAREA') {
|
||||||
return;
|
Keybinds.tags('math', target);
|
||||||
}
|
}
|
||||||
Keybinds.tags('math', target);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Toggle sage']:
|
case Conf['Toggle sage']:
|
||||||
if (QR.nodes) {
|
if (QR.nodes && !QR.nodes.el.hidden) {
|
||||||
Keybinds.sage();
|
Keybinds.sage();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Conf['Submit QR']:
|
case Conf['Submit QR']:
|
||||||
if (QR.nodes && !QR.status()) {
|
if (QR.nodes && !QR.nodes.el.hidden && !QR.status()) {
|
||||||
QR.submit();
|
QR.submit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Conf['Post Without Name']:
|
case Conf['Post Without Name']:
|
||||||
if (QR.nodes && !QR.status()) {
|
if (!(QR.nodes && !QR.status())) {
|
||||||
Keybinds.name();
|
return;
|
||||||
QR.submit();
|
|
||||||
}
|
}
|
||||||
|
Keybinds.name();
|
||||||
|
QR.submit();
|
||||||
break;
|
break;
|
||||||
case Conf['Update']:
|
case Conf['Update']:
|
||||||
switch (g.VIEW) {
|
switch (g.VIEW) {
|
||||||
case 'thread':
|
case 'thread':
|
||||||
ThreadUpdater.update();
|
if (Conf['Thread Updater']) {
|
||||||
|
ThreadUpdater.update();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'index':
|
case 'index':
|
||||||
if (Conf['JSON Navigation']) {
|
if (Conf['JSON Navigation']) {
|
||||||
Index.update();
|
Index.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
case Conf['Watch']:
|
case Conf['Watch']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (!thread) {
|
||||||
return;
|
ThreadWatcher.toggle(thread);
|
||||||
}
|
}
|
||||||
ThreadWatcher.toggle(thread);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Expand image']:
|
case Conf['Expand image']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.img(threadRoot);
|
||||||
}
|
}
|
||||||
Keybinds.img(threadRoot);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Expand images']:
|
case Conf['Expand images']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.img(threadRoot, true);
|
||||||
}
|
}
|
||||||
Keybinds.img(threadRoot, true);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Open Gallery']:
|
case Conf['Open Gallery']:
|
||||||
if (g.VIEW === 'catalog') {
|
if ((_ref2 = g.VIEW) === 'index' || _ref2 === 'thread') {
|
||||||
return;
|
Gallery.cb.toggle();
|
||||||
}
|
}
|
||||||
Gallery.cb.toggle();
|
|
||||||
break;
|
break;
|
||||||
case Conf['fappeTyme']:
|
case Conf['fappeTyme']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (Conf['Fappe Tyme'] && ((_ref3 = g.VIEW) === 'index' || _ref3 === 'thread') && g.BOARD !== 'f') {
|
||||||
return;
|
FappeTyme.cb.toggle.call({
|
||||||
|
name: 'fappe'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
FappeTyme.cb.toggle.call({
|
|
||||||
name: 'fappe'
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case Conf['werkTyme']:
|
case Conf['werkTyme']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (g.VIEW === 'catalog') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FappeTyme.cb.toggle.call({
|
if (Conf['Fappe Tyme'] && ((_ref4 = g.VIEW) === 'index' || _ref4 === 'thread') && g.BOARD !== 'f') {
|
||||||
name: 'werk'
|
FappeTyme.cb.toggle.call({
|
||||||
});
|
name: 'werk'
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Conf['Front page']:
|
case Conf['Front page']:
|
||||||
if (Conf['JSON Navigation'] && g.VIEW === 'index') {
|
if (Conf['JSON Navigation'] && g.VIEW === 'index') {
|
||||||
@ -15457,7 +15454,6 @@
|
|||||||
}
|
}
|
||||||
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box');
|
searchInput = Conf['JSON Navigation'] ? Index.searchInput : $.id('search-box');
|
||||||
Header.scrollToIfNeeded(searchInput);
|
Header.scrollToIfNeeded(searchInput);
|
||||||
searchInput.click();
|
|
||||||
searchInput.focus();
|
searchInput.focus();
|
||||||
break;
|
break;
|
||||||
case Conf['Paged mode']:
|
case Conf['Paged mode']:
|
||||||
@ -15497,62 +15493,63 @@
|
|||||||
Index.setIndexMode('catalog');
|
Index.setIndexMode('catalog');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Conf['Next thread']:
|
case Conf['Cycle sort type']:
|
||||||
if (g.VIEW !== 'index' || Conf['Index Mode'] === 'catalog') {
|
if (Conf['JSON Navigation'] && g.VIEW === 'index' && g.BOARD !== 'f') {
|
||||||
return;
|
Index.cycleSortType();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Conf['Next thread']:
|
||||||
|
if (g.VIEW === 'index' && threadRoot) {
|
||||||
|
Nav.scroll(+1);
|
||||||
}
|
}
|
||||||
Nav.scroll(+1);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Previous thread']:
|
case Conf['Previous thread']:
|
||||||
if (g.VIEW !== 'index' || Conf['Index Mode'] === 'catalog') {
|
if (g.VIEW === 'index' && threadRoot) {
|
||||||
return;
|
Nav.scroll(-1);
|
||||||
}
|
}
|
||||||
Nav.scroll(-1);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Expand thread']:
|
case Conf['Expand thread']:
|
||||||
if (g.VIEW !== 'index' || Conf['Index Mode'] === 'catalog') {
|
if (g.VIEW === 'index' && threadRoot) {
|
||||||
return;
|
ExpandThread.toggle(thread);
|
||||||
}
|
}
|
||||||
ExpandThread.toggle(thread);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Open thread']:
|
case Conf['Open thread']:
|
||||||
if (g.VIEW !== 'index' || Conf['Index Mode'] === 'catalog') {
|
if (g.VIEW === 'index' && threadRoot) {
|
||||||
return;
|
Keybinds.open(thread);
|
||||||
}
|
}
|
||||||
Keybinds.open(thread);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Open thread tab']:
|
case Conf['Open thread tab']:
|
||||||
if (g.VIEW !== 'index' || Conf['Index Mode'] === 'catalog') {
|
if (g.VIEW === 'index' && threadRoot) {
|
||||||
return;
|
Keybinds.open(thread, true);
|
||||||
}
|
}
|
||||||
Keybinds.open(thread, true);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Next reply']:
|
case Conf['Next reply']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.hl(+1, threadRoot);
|
||||||
}
|
}
|
||||||
Keybinds.hl(+1, threadRoot);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Previous reply']:
|
case Conf['Previous reply']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.hl(-1, threadRoot);
|
||||||
}
|
}
|
||||||
Keybinds.hl(-1, threadRoot);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Deselect reply']:
|
case Conf['Deselect reply']:
|
||||||
if (g.VIEW === 'catalog') {
|
if (threadRoot) {
|
||||||
return;
|
Keybinds.hl(0, threadRoot);
|
||||||
}
|
}
|
||||||
Keybinds.hl(0, threadRoot);
|
|
||||||
break;
|
break;
|
||||||
case Conf['Hide']:
|
case Conf['Hide']:
|
||||||
PostHiding.toggle(thread.OP);
|
PostHiding.toggle(thread.OP);
|
||||||
break;
|
break;
|
||||||
case Conf['Previous Post Quoting You']:
|
case Conf['Previous Post Quoting You']:
|
||||||
QuoteMarkers.cb.seek('preceding');
|
if (threadRoot) {
|
||||||
|
QuoteMarkers.cb.seek('preceding');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Conf['Next Post Quoting You']:
|
case Conf['Next Post Quoting You']:
|
||||||
QuoteMarkers.cb.seek('following');
|
if (threadRoot) {
|
||||||
|
QuoteMarkers.cb.seek('following');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@ -15616,7 +15613,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
tags: function(tag, ta) {
|
tags: function(tag, ta) {
|
||||||
var range, selEnd, selStart, value;
|
var range, selEnd, selStart, supported, value;
|
||||||
|
supported = (function() {
|
||||||
|
switch (tag) {
|
||||||
|
case 'spoiler':
|
||||||
|
return !!$('.postForm input[name=spoiler]');
|
||||||
|
case 'code':
|
||||||
|
return g.BOARD.ID === 'g';
|
||||||
|
case 'math':
|
||||||
|
case 'eqn':
|
||||||
|
return g.BOARD.ID === 'sci';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
if (!supported) {
|
||||||
|
new Notice('warning', "[" + tag + "] tags are not supported on /" + g.BOARD + "/.", 20);
|
||||||
|
}
|
||||||
value = ta.value;
|
value = ta.value;
|
||||||
selStart = ta.selectionStart;
|
selStart = ta.selectionStart;
|
||||||
selEnd = ta.selectionEnd;
|
selEnd = ta.selectionEnd;
|
||||||
|
|||||||
@ -22,81 +22,74 @@ Keybinds =
|
|||||||
return if target.nodeName is 'EMBED' # Prevent keybinds from firing on /f/ embeds.
|
return if target.nodeName is 'EMBED' # Prevent keybinds from firing on /f/ embeds.
|
||||||
if target.nodeName in ['INPUT', 'TEXTAREA']
|
if target.nodeName in ['INPUT', 'TEXTAREA']
|
||||||
return unless /(Esc|Alt|Ctrl|Meta|Shift\+\w{2,})/.test key
|
return unless /(Esc|Alt|Ctrl|Meta|Shift\+\w{2,})/.test key
|
||||||
unless g.VIEW is 'catalog'
|
unless g.VIEW not in ['index', 'thread'] or g.VIEW is 'index' and Conf['JSON Navigation'] and Conf['Index Mode'] is 'catalog'
|
||||||
threadRoot = Nav.getThread()
|
threadRoot = Nav.getThread()
|
||||||
if op = $ '.op', threadRoot
|
if op = $ '.op', threadRoot
|
||||||
thread = Get.postFromNode(op).thread
|
thread = Get.postFromNode(op).thread
|
||||||
switch key
|
switch key
|
||||||
# QR & Options
|
# QR & Options
|
||||||
when Conf['Toggle board list']
|
when Conf['Toggle board list']
|
||||||
if Conf['Custom Board Navigation']
|
Header.toggleBoardList() if Conf['Custom Board Navigation']
|
||||||
Header.toggleBoardList()
|
|
||||||
when Conf['Toggle header']
|
when Conf['Toggle header']
|
||||||
Header.toggleBarVisibility()
|
Header.toggleBarVisibility()
|
||||||
when Conf['Open empty QR']
|
when Conf['Open empty QR']
|
||||||
Keybinds.qr()
|
Keybinds.qr()
|
||||||
when Conf['Open QR']
|
when Conf['Open QR']
|
||||||
return if g.VIEW is 'catalog'
|
Keybinds.qr threadRoot if threadRoot
|
||||||
Keybinds.qr threadRoot
|
|
||||||
when Conf['Open settings']
|
when Conf['Open settings']
|
||||||
Settings.open()
|
Settings.open()
|
||||||
when Conf['Close']
|
when Conf['Close']
|
||||||
if $.id 'fourchanx-settings'
|
if Settings.dialog
|
||||||
Settings.close()
|
Settings.close()
|
||||||
else if (notifications = $$ '.notification').length
|
else if (notifications = $$ '.notification').length
|
||||||
for notification in notifications
|
for notification in notifications
|
||||||
$('.close', notification).click()
|
$('.close', notification).click()
|
||||||
else if QR.nodes
|
else if QR.nodes and not (QR.nodes.el.hidden or window.getComputedStyle(QR.nodes.form).display is 'none')
|
||||||
if Conf['Persistent QR']
|
if Conf['Persistent QR']
|
||||||
QR.hide()
|
QR.hide()
|
||||||
else
|
else
|
||||||
QR.close()
|
QR.close()
|
||||||
|
else if Embedding.lastEmbed
|
||||||
|
Embedding.closeFloat()
|
||||||
|
return
|
||||||
when Conf['Spoiler tags']
|
when Conf['Spoiler tags']
|
||||||
return if target.nodeName isnt 'TEXTAREA'
|
Keybinds.tags 'spoiler', target if target.nodeName is 'TEXTAREA'
|
||||||
Keybinds.tags 'spoiler', target
|
|
||||||
when Conf['Code tags']
|
when Conf['Code tags']
|
||||||
return if target.nodeName isnt 'TEXTAREA'
|
Keybinds.tags 'code', target if target.nodeName is 'TEXTAREA'
|
||||||
Keybinds.tags 'code', target
|
|
||||||
when Conf['Eqn tags']
|
when Conf['Eqn tags']
|
||||||
return if target.nodeName isnt 'TEXTAREA'
|
Keybinds.tags 'eqn', target if target.nodeName is 'TEXTAREA'
|
||||||
Keybinds.tags 'eqn', target
|
|
||||||
when Conf['Math tags']
|
when Conf['Math tags']
|
||||||
return if target.nodeName isnt 'TEXTAREA'
|
Keybinds.tags 'math', target if target.nodeName is 'TEXTAREA'
|
||||||
Keybinds.tags 'math', target
|
|
||||||
when Conf['Toggle sage']
|
when Conf['Toggle sage']
|
||||||
Keybinds.sage() if QR.nodes
|
Keybinds.sage() if QR.nodes and !QR.nodes.el.hidden
|
||||||
when Conf['Submit QR']
|
when Conf['Submit QR']
|
||||||
QR.submit() if QR.nodes and !QR.status()
|
QR.submit() if QR.nodes and !QR.nodes.el.hidden and !QR.status()
|
||||||
when Conf['Post Without Name']
|
when Conf['Post Without Name']
|
||||||
if QR.nodes and !QR.status()
|
return unless QR.nodes and !QR.status()
|
||||||
Keybinds.name()
|
Keybinds.name()
|
||||||
QR.submit()
|
QR.submit()
|
||||||
# Index/Thread related
|
# Index/Thread related
|
||||||
when Conf['Update']
|
when Conf['Update']
|
||||||
switch g.VIEW
|
switch g.VIEW
|
||||||
when 'thread'
|
when 'thread'
|
||||||
ThreadUpdater.update()
|
ThreadUpdater.update() if Conf['Thread Updater']
|
||||||
when 'index'
|
when 'index'
|
||||||
if Conf['JSON Navigation'] then Index.update()
|
Index.update() if Conf['JSON Navigation']
|
||||||
|
return
|
||||||
when Conf['Watch']
|
when Conf['Watch']
|
||||||
return if g.VIEW is 'catalog'
|
ThreadWatcher.toggle thread unless thread
|
||||||
ThreadWatcher.toggle thread
|
|
||||||
# Images
|
# Images
|
||||||
when Conf['Expand image']
|
when Conf['Expand image']
|
||||||
return if g.VIEW is 'catalog'
|
Keybinds.img threadRoot if threadRoot
|
||||||
Keybinds.img threadRoot
|
|
||||||
when Conf['Expand images']
|
when Conf['Expand images']
|
||||||
return if g.VIEW is 'catalog'
|
Keybinds.img threadRoot, true if threadRoot
|
||||||
Keybinds.img threadRoot, true
|
|
||||||
when Conf['Open Gallery']
|
when Conf['Open Gallery']
|
||||||
return if g.VIEW is 'catalog'
|
Gallery.cb.toggle() if g.VIEW in ['index', 'thread']
|
||||||
Gallery.cb.toggle()
|
|
||||||
when Conf['fappeTyme']
|
when Conf['fappeTyme']
|
||||||
return if g.VIEW is 'catalog'
|
FappeTyme.cb.toggle.call {name: 'fappe'} if Conf['Fappe Tyme'] and g.VIEW in ['index', 'thread'] and g.BOARD isnt 'f'
|
||||||
FappeTyme.cb.toggle.call {name: 'fappe'}
|
|
||||||
when Conf['werkTyme']
|
when Conf['werkTyme']
|
||||||
return if g.VIEW is 'catalog'
|
return if g.VIEW is 'catalog'
|
||||||
FappeTyme.cb.toggle.call {name: 'werk'}
|
FappeTyme.cb.toggle.call {name: 'werk'} if Conf['Fappe Tyme'] and g.VIEW in ['index', 'thread'] and g.BOARD isnt 'f'
|
||||||
# Board Navigation
|
# Board Navigation
|
||||||
when Conf['Front page']
|
when Conf['Front page']
|
||||||
if Conf['JSON Navigation'] and g.VIEW is 'index'
|
if Conf['JSON Navigation'] and g.VIEW is 'index'
|
||||||
@ -125,7 +118,6 @@ Keybinds =
|
|||||||
return unless g.VIEW is 'index'
|
return unless g.VIEW is 'index'
|
||||||
searchInput = if Conf['JSON Navigation'] then Index.searchInput else $.id('search-box')
|
searchInput = if Conf['JSON Navigation'] then Index.searchInput else $.id('search-box')
|
||||||
Header.scrollToIfNeeded searchInput
|
Header.scrollToIfNeeded searchInput
|
||||||
searchInput.click()
|
|
||||||
searchInput.focus()
|
searchInput.focus()
|
||||||
when Conf['Paged mode']
|
when Conf['Paged mode']
|
||||||
return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'paged'
|
return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'paged'
|
||||||
@ -146,38 +138,32 @@ Keybinds =
|
|||||||
return window.location = "/#{g.BOARD}/catalog" unless Conf['JSON Navigation']
|
return window.location = "/#{g.BOARD}/catalog" unless Conf['JSON Navigation']
|
||||||
return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'catalog'
|
return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'catalog'
|
||||||
Index.setIndexMode 'catalog'
|
Index.setIndexMode 'catalog'
|
||||||
|
when Conf['Cycle sort type']
|
||||||
|
Index.cycleSortType() if Conf['JSON Navigation'] and g.VIEW is 'index' and g.BOARD isnt 'f'
|
||||||
# Thread Navigation
|
# Thread Navigation
|
||||||
when Conf['Next thread']
|
when Conf['Next thread']
|
||||||
return if g.VIEW isnt 'index' or Conf['Index Mode'] is 'catalog'
|
Nav.scroll +1 if g.VIEW is 'index' and threadRoot
|
||||||
Nav.scroll +1
|
|
||||||
when Conf['Previous thread']
|
when Conf['Previous thread']
|
||||||
return if g.VIEW isnt 'index' or Conf['Index Mode'] is 'catalog'
|
Nav.scroll -1 if g.VIEW is 'index' and threadRoot
|
||||||
Nav.scroll -1
|
|
||||||
when Conf['Expand thread']
|
when Conf['Expand thread']
|
||||||
return if g.VIEW isnt 'index' or Conf['Index Mode'] is 'catalog'
|
ExpandThread.toggle thread if g.VIEW is 'index' and threadRoot
|
||||||
ExpandThread.toggle thread
|
|
||||||
when Conf['Open thread']
|
when Conf['Open thread']
|
||||||
return if g.VIEW isnt 'index' or Conf['Index Mode'] is 'catalog'
|
Keybinds.open thread if g.VIEW is 'index' and threadRoot
|
||||||
Keybinds.open thread
|
|
||||||
when Conf['Open thread tab']
|
when Conf['Open thread tab']
|
||||||
return if g.VIEW isnt 'index' or Conf['Index Mode'] is 'catalog'
|
Keybinds.open thread, true if g.VIEW is 'index' and threadRoot
|
||||||
Keybinds.open thread, true
|
|
||||||
# Reply Navigation
|
# Reply Navigation
|
||||||
when Conf['Next reply']
|
when Conf['Next reply']
|
||||||
return if g.VIEW is 'catalog'
|
Keybinds.hl +1, threadRoot if threadRoot
|
||||||
Keybinds.hl +1, threadRoot
|
|
||||||
when Conf['Previous reply']
|
when Conf['Previous reply']
|
||||||
return if g.VIEW is 'catalog'
|
Keybinds.hl -1, threadRoot if threadRoot
|
||||||
Keybinds.hl -1, threadRoot
|
|
||||||
when Conf['Deselect reply']
|
when Conf['Deselect reply']
|
||||||
return if g.VIEW is 'catalog'
|
Keybinds.hl 0, threadRoot if threadRoot
|
||||||
Keybinds.hl 0, threadRoot
|
|
||||||
when Conf['Hide']
|
when Conf['Hide']
|
||||||
PostHiding.toggle thread.OP
|
PostHiding.toggle thread.OP
|
||||||
when Conf['Previous Post Quoting You']
|
when Conf['Previous Post Quoting You']
|
||||||
QuoteMarkers.cb.seek 'preceding'
|
QuoteMarkers.cb.seek 'preceding' if threadRoot
|
||||||
when Conf['Next Post Quoting You']
|
when Conf['Next Post Quoting You']
|
||||||
QuoteMarkers.cb.seek 'following'
|
QuoteMarkers.cb.seek 'following' if threadRoot
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@ -217,11 +203,17 @@ Keybinds =
|
|||||||
if thread?
|
if thread?
|
||||||
QR.quote.call $ 'input', $('.post.highlight', thread) or thread
|
QR.quote.call $ 'input', $('.post.highlight', thread) or thread
|
||||||
|
|
||||||
do QR.nodes.com.focus
|
QR.nodes.com.focus()
|
||||||
if Conf['QR Shortcut']
|
if Conf['QR Shortcut']
|
||||||
$.rmClass $('.qr-shortcut'), 'disabled'
|
$.rmClass $('.qr-shortcut'), 'disabled'
|
||||||
|
|
||||||
tags: (tag, ta) ->
|
tags: (tag, ta) ->
|
||||||
|
supported = switch tag
|
||||||
|
when 'spoiler' then !!$ '.postForm input[name=spoiler]'
|
||||||
|
when 'code' then g.BOARD.ID is 'g'
|
||||||
|
when 'math', 'eqn' then g.BOARD.ID is 'sci'
|
||||||
|
new Notice 'warning', "[#{tag}] tags are not supported on /#{g.BOARD}/.", 20 unless supported
|
||||||
|
|
||||||
value = ta.value
|
value = ta.value
|
||||||
selStart = ta.selectionStart
|
selStart = ta.selectionStart
|
||||||
selEnd = ta.selectionEnd
|
selEnd = ta.selectionEnd
|
||||||
@ -248,11 +240,11 @@ Keybinds =
|
|||||||
|
|
||||||
img: (thread, all) ->
|
img: (thread, all) ->
|
||||||
if all
|
if all
|
||||||
do ImageExpand.cb.toggleAll
|
ImageExpand.cb.toggleAll()
|
||||||
else
|
else
|
||||||
post = Get.postFromNode $('.post.highlight', thread) or $ '.op', thread
|
post = Get.postFromNode $('.post.highlight', thread) or $ '.op', thread
|
||||||
ImageExpand.toggle post
|
ImageExpand.toggle post
|
||||||
|
|
||||||
open: (thread, tab) ->
|
open: (thread, tab) ->
|
||||||
return if g.VIEW isnt 'index'
|
return if g.VIEW isnt 'index'
|
||||||
url = Build.path thread.board.ID, thread.ID
|
url = Build.path thread.board.ID, thread.ID
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user