Merge branch 'master' of https://github.com/MayhemYDG/4chan-x
This commit is contained in:
commit
9e6c6b7cf0
122
4chan_x.user.js
122
4chan_x.user.js
@ -157,28 +157,28 @@
|
|||||||
fileInfoT: '%l (%s, %r)',
|
fileInfoT: '%l (%s, %r)',
|
||||||
favicon: 'ferongr',
|
favicon: 'ferongr',
|
||||||
hotkeys: {
|
hotkeys: {
|
||||||
|
openQR: ['i', 'Open QR with post number inserted'],
|
||||||
|
openEmptyQR: ['I', 'Open QR without post number inserted'],
|
||||||
openOptions: ['ctrl+o', 'Open Options'],
|
openOptions: ['ctrl+o', 'Open Options'],
|
||||||
close: ['Esc', 'Close Options or QR'],
|
close: ['Esc', 'Close Options or QR'],
|
||||||
spoiler: ['ctrl+s', 'Quick spoiler'],
|
spoiler: ['ctrl+s', 'Quick spoiler'],
|
||||||
openQR: ['i', 'Open QR with post number inserted'],
|
|
||||||
openEmptyQR: ['I', 'Open QR without post number inserted'],
|
|
||||||
submit: ['alt+s', 'Submit post'],
|
submit: ['alt+s', 'Submit post'],
|
||||||
nextReply: ['J', 'Select next reply'],
|
|
||||||
previousReply: ['K', 'Select previous reply'],
|
|
||||||
nextThread: ['n', 'See next thread'],
|
|
||||||
previousThread: ['p', 'See previous thread'],
|
|
||||||
nextPage: ['L', 'Jump to the next page'],
|
|
||||||
previousPage: ['H', 'Jump to the previous page'],
|
|
||||||
zero: ['0', 'Jump to page 0'],
|
|
||||||
openThreadTab: ['o', 'Open thread in current tab'],
|
|
||||||
openThread: ['O', 'Open thread in new tab'],
|
|
||||||
expandThread: ['e', 'Expand thread'],
|
|
||||||
watch: ['w', 'Watch thread'],
|
watch: ['w', 'Watch thread'],
|
||||||
hide: ['x', 'Hide thread'],
|
update: ['u', 'Update now'],
|
||||||
|
unreadCountTo0: ['z', 'Reset unread status'],
|
||||||
expandImage: ['m', 'Expand selected image'],
|
expandImage: ['m', 'Expand selected image'],
|
||||||
expandAllImages: ['M', 'Expand all images'],
|
expandAllImages: ['M', 'Expand all images'],
|
||||||
update: ['u', 'Update now'],
|
zero: ['0', 'Jump to page 0'],
|
||||||
unreadCountTo0: ['z', 'Reset unread status']
|
nextPage: ['L', 'Jump to the next page'],
|
||||||
|
previousPage: ['H', 'Jump to the previous page'],
|
||||||
|
nextThread: ['n', 'See next thread'],
|
||||||
|
previousThread: ['p', 'See previous thread'],
|
||||||
|
expandThread: ['e', 'Expand thread'],
|
||||||
|
openThreadTab: ['o', 'Open thread in current tab'],
|
||||||
|
openThread: ['O', 'Open thread in new tab'],
|
||||||
|
nextReply: ['J', 'Select next reply'],
|
||||||
|
previousReply: ['K', 'Select previous reply'],
|
||||||
|
hide: ['x', 'Hide thread']
|
||||||
},
|
},
|
||||||
updater: {
|
updater: {
|
||||||
checkbox: {
|
checkbox: {
|
||||||
@ -978,6 +978,12 @@
|
|||||||
}
|
}
|
||||||
thread = Nav.getThread();
|
thread = Nav.getThread();
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
case conf.openQR:
|
||||||
|
Keybinds.qr(thread, true);
|
||||||
|
break;
|
||||||
|
case conf.openEmptyQR:
|
||||||
|
Keybinds.qr(thread);
|
||||||
|
break;
|
||||||
case conf.openOptions:
|
case conf.openOptions:
|
||||||
if (!$.id('overlay')) Options.dialog();
|
if (!$.id('overlay')) Options.dialog();
|
||||||
break;
|
break;
|
||||||
@ -988,6 +994,9 @@
|
|||||||
qr.close();
|
qr.close();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case conf.submit:
|
||||||
|
if (qr.el && !qr.status()) qr.submit();
|
||||||
|
break;
|
||||||
case conf.spoiler:
|
case conf.spoiler:
|
||||||
ta = e.target;
|
ta = e.target;
|
||||||
if (ta.nodeName !== 'TEXTAREA') return;
|
if (ta.nodeName !== 'TEXTAREA') return;
|
||||||
@ -998,52 +1007,24 @@
|
|||||||
range = 9 + selEnd;
|
range = 9 + selEnd;
|
||||||
ta.setSelectionRange(range, range);
|
ta.setSelectionRange(range, range);
|
||||||
break;
|
break;
|
||||||
case conf.zero:
|
case conf.watch:
|
||||||
window.location = "/" + g.BOARD + "/0#0";
|
Watcher.toggle(thread);
|
||||||
break;
|
|
||||||
case conf.openEmptyQR:
|
|
||||||
Keybinds.qr(thread);
|
|
||||||
break;
|
|
||||||
case conf.openQR:
|
|
||||||
Keybinds.qr(thread, true);
|
|
||||||
break;
|
|
||||||
case conf.nextReply:
|
|
||||||
Keybinds.hl.next(thread);
|
|
||||||
break;
|
|
||||||
case conf.previousReply:
|
|
||||||
Keybinds.hl.prev(thread);
|
|
||||||
break;
|
|
||||||
case conf.expandAllImages:
|
|
||||||
Keybinds.img(thread, true);
|
|
||||||
break;
|
|
||||||
case conf.openThread:
|
|
||||||
Keybinds.open(thread);
|
|
||||||
break;
|
|
||||||
case conf.expandThread:
|
|
||||||
ExpandThread.toggle(thread);
|
|
||||||
break;
|
|
||||||
case conf.expandImage:
|
|
||||||
Keybinds.img(thread);
|
|
||||||
break;
|
|
||||||
case conf.nextThread:
|
|
||||||
if (g.REPLY) return;
|
|
||||||
Nav.scroll(+1);
|
|
||||||
break;
|
|
||||||
case conf.openThreadTab:
|
|
||||||
Keybinds.open(thread, true);
|
|
||||||
break;
|
|
||||||
case conf.previousThread:
|
|
||||||
if (g.REPLY) return;
|
|
||||||
Nav.scroll(-1);
|
|
||||||
break;
|
break;
|
||||||
case conf.update:
|
case conf.update:
|
||||||
Updater.update();
|
Updater.update();
|
||||||
break;
|
break;
|
||||||
case conf.watch:
|
case conf.unreadCountTo0:
|
||||||
Watcher.toggle(thread);
|
Unread.replies = [];
|
||||||
|
Unread.update();
|
||||||
break;
|
break;
|
||||||
case conf.hide:
|
case conf.expandImage:
|
||||||
ThreadHiding.toggle(thread);
|
Keybinds.img(thread);
|
||||||
|
break;
|
||||||
|
case conf.expandAllImages:
|
||||||
|
Keybinds.img(thread, true);
|
||||||
|
break;
|
||||||
|
case conf.zero:
|
||||||
|
window.location = "/" + g.BOARD + "/0#0";
|
||||||
break;
|
break;
|
||||||
case conf.nextPage:
|
case conf.nextPage:
|
||||||
if ((_ref = $('input[value=Next]')) != null) _ref.click();
|
if ((_ref = $('input[value=Next]')) != null) _ref.click();
|
||||||
@ -1051,12 +1032,31 @@
|
|||||||
case conf.previousPage:
|
case conf.previousPage:
|
||||||
if ((_ref2 = $('input[value=Previous]')) != null) _ref2.click();
|
if ((_ref2 = $('input[value=Previous]')) != null) _ref2.click();
|
||||||
break;
|
break;
|
||||||
case conf.submit:
|
case conf.nextThread:
|
||||||
if (qr.el && !qr.status()) qr.submit();
|
if (g.REPLY) return;
|
||||||
|
Nav.scroll(+1);
|
||||||
break;
|
break;
|
||||||
case conf.unreadCountTo0:
|
case conf.previousThread:
|
||||||
Unread.replies = [];
|
if (g.REPLY) return;
|
||||||
Unread.update();
|
Nav.scroll(-1);
|
||||||
|
break;
|
||||||
|
case conf.expandThread:
|
||||||
|
ExpandThread.toggle(thread);
|
||||||
|
break;
|
||||||
|
case conf.openThread:
|
||||||
|
Keybinds.open(thread);
|
||||||
|
break;
|
||||||
|
case conf.openThreadTab:
|
||||||
|
Keybinds.open(thread, true);
|
||||||
|
break;
|
||||||
|
case conf.nextReply:
|
||||||
|
Keybinds.hl.next(thread);
|
||||||
|
break;
|
||||||
|
case conf.previousReply:
|
||||||
|
Keybinds.hl.prev(thread);
|
||||||
|
break;
|
||||||
|
case conf.hide:
|
||||||
|
ThreadHiding.toggle(thread);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|||||||
114
script.coffee
114
script.coffee
@ -117,28 +117,34 @@ config =
|
|||||||
fileInfoT: '%l (%s, %r)'
|
fileInfoT: '%l (%s, %r)'
|
||||||
favicon: 'ferongr'
|
favicon: 'ferongr'
|
||||||
hotkeys:
|
hotkeys:
|
||||||
|
# QR & Options
|
||||||
|
openQR: ['i', 'Open QR with post number inserted']
|
||||||
|
openEmptyQR: ['I', 'Open QR without post number inserted']
|
||||||
openOptions: ['ctrl+o', 'Open Options']
|
openOptions: ['ctrl+o', 'Open Options']
|
||||||
close: ['Esc', 'Close Options or QR']
|
close: ['Esc', 'Close Options or QR']
|
||||||
spoiler: ['ctrl+s', 'Quick spoiler']
|
spoiler: ['ctrl+s', 'Quick spoiler']
|
||||||
openQR: ['i', 'Open QR with post number inserted']
|
|
||||||
openEmptyQR: ['I', 'Open QR without post number inserted']
|
|
||||||
submit: ['alt+s', 'Submit post']
|
submit: ['alt+s', 'Submit post']
|
||||||
nextReply: ['J', 'Select next reply']
|
# Thread related
|
||||||
previousReply: ['K', 'Select previous reply']
|
|
||||||
nextThread: ['n', 'See next thread']
|
|
||||||
previousThread: ['p', 'See previous thread']
|
|
||||||
nextPage: ['L', 'Jump to the next page']
|
|
||||||
previousPage: ['H', 'Jump to the previous page']
|
|
||||||
zero: ['0', 'Jump to page 0']
|
|
||||||
openThreadTab: ['o', 'Open thread in current tab']
|
|
||||||
openThread: ['O', 'Open thread in new tab']
|
|
||||||
expandThread: ['e', 'Expand thread']
|
|
||||||
watch: ['w', 'Watch thread']
|
watch: ['w', 'Watch thread']
|
||||||
hide: ['x', 'Hide thread']
|
|
||||||
expandImage: ['m', 'Expand selected image']
|
|
||||||
expandAllImages: ['M', 'Expand all images']
|
|
||||||
update: ['u', 'Update now']
|
update: ['u', 'Update now']
|
||||||
unreadCountTo0: ['z', 'Reset unread status']
|
unreadCountTo0: ['z', 'Reset unread status']
|
||||||
|
# Images
|
||||||
|
expandImage: ['m', 'Expand selected image']
|
||||||
|
expandAllImages: ['M', 'Expand all images']
|
||||||
|
# Board Navigation
|
||||||
|
zero: ['0', 'Jump to page 0']
|
||||||
|
nextPage: ['L', 'Jump to the next page']
|
||||||
|
previousPage: ['H', 'Jump to the previous page']
|
||||||
|
# Thread Navigation
|
||||||
|
nextThread: ['n', 'See next thread']
|
||||||
|
previousThread: ['p', 'See previous thread']
|
||||||
|
expandThread: ['e', 'Expand thread']
|
||||||
|
openThreadTab: ['o', 'Open thread in current tab']
|
||||||
|
openThread: ['O', 'Open thread in new tab']
|
||||||
|
# Reply Navigation
|
||||||
|
nextReply: ['J', 'Select next reply']
|
||||||
|
previousReply: ['K', 'Select previous reply']
|
||||||
|
hide: ['x', 'Hide thread']
|
||||||
updater:
|
updater:
|
||||||
checkbox:
|
checkbox:
|
||||||
'Scrolling': [false, 'Scroll updated posts into view. Only enabled at bottom of page.']
|
'Scrolling': [false, 'Scroll updated posts into view. Only enabled at bottom of page.']
|
||||||
@ -817,6 +823,11 @@ Keybinds =
|
|||||||
|
|
||||||
thread = Nav.getThread()
|
thread = Nav.getThread()
|
||||||
switch key
|
switch key
|
||||||
|
# QR & Options
|
||||||
|
when conf.openQR
|
||||||
|
Keybinds.qr thread, true
|
||||||
|
when conf.openEmptyQR
|
||||||
|
Keybinds.qr thread
|
||||||
when conf.openOptions
|
when conf.openOptions
|
||||||
Options.dialog() unless $.id 'overlay'
|
Options.dialog() unless $.id 'overlay'
|
||||||
when conf.close
|
when conf.close
|
||||||
@ -824,6 +835,8 @@ Keybinds =
|
|||||||
Options.close.call o
|
Options.close.call o
|
||||||
else if qr.el
|
else if qr.el
|
||||||
qr.close()
|
qr.close()
|
||||||
|
when conf.submit
|
||||||
|
qr.submit() if qr.el and !qr.status()
|
||||||
when conf.spoiler
|
when conf.spoiler
|
||||||
ta = e.target
|
ta = e.target
|
||||||
return if ta.nodeName isnt 'TEXTAREA'
|
return if ta.nodeName isnt 'TEXTAREA'
|
||||||
@ -836,51 +849,50 @@ Keybinds =
|
|||||||
value[...selStart] +
|
value[...selStart] +
|
||||||
'[spoiler]' + value[selStart...selEnd] + '[/spoiler]' +
|
'[spoiler]' + value[selStart...selEnd] + '[/spoiler]' +
|
||||||
value[selEnd..]
|
value[selEnd..]
|
||||||
range = 9 + selEnd
|
|
||||||
|
|
||||||
|
range = 9 + selEnd
|
||||||
# Move the caret to the end of the selection.
|
# Move the caret to the end of the selection.
|
||||||
ta.setSelectionRange range, range
|
ta.setSelectionRange range, range
|
||||||
when conf.zero
|
# Thread related
|
||||||
window.location = "/#{g.BOARD}/0#0"
|
|
||||||
when conf.openEmptyQR
|
|
||||||
Keybinds.qr thread
|
|
||||||
when conf.openQR
|
|
||||||
Keybinds.qr thread, true
|
|
||||||
when conf.nextReply
|
|
||||||
Keybinds.hl.next thread
|
|
||||||
when conf.previousReply
|
|
||||||
Keybinds.hl.prev thread
|
|
||||||
when conf.expandAllImages
|
|
||||||
Keybinds.img thread, true
|
|
||||||
when conf.openThread
|
|
||||||
Keybinds.open thread
|
|
||||||
when conf.expandThread
|
|
||||||
ExpandThread.toggle thread
|
|
||||||
when conf.expandImage
|
|
||||||
Keybinds.img thread
|
|
||||||
when conf.nextThread
|
|
||||||
return if g.REPLY
|
|
||||||
Nav.scroll +1
|
|
||||||
when conf.openThreadTab
|
|
||||||
Keybinds.open thread, true
|
|
||||||
when conf.previousThread
|
|
||||||
return if g.REPLY
|
|
||||||
Nav.scroll -1
|
|
||||||
when conf.update
|
|
||||||
Updater.update()
|
|
||||||
when conf.watch
|
when conf.watch
|
||||||
Watcher.toggle thread
|
Watcher.toggle thread
|
||||||
when conf.hide
|
when conf.update
|
||||||
ThreadHiding.toggle thread
|
Updater.update()
|
||||||
|
when conf.unreadCountTo0
|
||||||
|
Unread.replies = []
|
||||||
|
Unread.update()
|
||||||
|
# Images
|
||||||
|
when conf.expandImage
|
||||||
|
Keybinds.img thread
|
||||||
|
when conf.expandAllImages
|
||||||
|
Keybinds.img thread, true
|
||||||
|
# Board Navigation
|
||||||
|
when conf.zero
|
||||||
|
window.location = "/#{g.BOARD}/0#0"
|
||||||
when conf.nextPage
|
when conf.nextPage
|
||||||
$('input[value=Next]')?.click()
|
$('input[value=Next]')?.click()
|
||||||
when conf.previousPage
|
when conf.previousPage
|
||||||
$('input[value=Previous]')?.click()
|
$('input[value=Previous]')?.click()
|
||||||
when conf.submit
|
# Thread Navigation
|
||||||
qr.submit() if qr.el and !qr.status()
|
when conf.nextThread
|
||||||
when conf.unreadCountTo0
|
return if g.REPLY
|
||||||
Unread.replies = []
|
Nav.scroll +1
|
||||||
Unread.update()
|
when conf.previousThread
|
||||||
|
return if g.REPLY
|
||||||
|
Nav.scroll -1
|
||||||
|
when conf.expandThread
|
||||||
|
ExpandThread.toggle thread
|
||||||
|
when conf.openThread
|
||||||
|
Keybinds.open thread
|
||||||
|
when conf.openThreadTab
|
||||||
|
Keybinds.open thread, true
|
||||||
|
# Reply Navigation
|
||||||
|
when conf.nextReply
|
||||||
|
Keybinds.hl.next thread
|
||||||
|
when conf.previousReply
|
||||||
|
Keybinds.hl.prev thread
|
||||||
|
when conf.hide
|
||||||
|
ThreadHiding.toggle thread
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user