Merge branch 'master' of github.com:MayhemYDG/4chan-x

This commit is contained in:
Nicolas Stepien 2013-01-03 15:20:20 +01:00
commit 7b0c961805
3 changed files with 70 additions and 45 deletions

View File

@ -86,8 +86,8 @@
Config = { Config = {
main: { main: {
Enhancing: { Enhancing: {
'Disable 4chan\'s extension': [true, 'Avoid conflicts between 4chan X and 4chan\'s inline extension.'], 'Disable 4chan\'s extension': [true, 'Avoid conflicts between 4chan X and 4chan\'s inline extension'],
'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'],
'404 Redirect': [true, 'Redirect dead threads and images'], '404 Redirect': [true, 'Redirect dead threads and images'],
'Keybinds': [true, 'Binds actions to keys'], 'Keybinds': [true, 'Binds actions to keys'],
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'], 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'],
@ -112,14 +112,14 @@
'Image Hover': [false, 'Show full image on mouseover'], 'Image Hover': [false, 'Show full image on mouseover'],
'Sauce': [true, 'Add sauce to images'], 'Sauce': [true, 'Add sauce to images'],
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'], 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'],
'Expand From Current': [false, 'Expand images from current position to thread end.'] 'Expand From Current': [false, 'Expand images from current position to thread end']
}, },
Menu: { Menu: {
'Menu': [true, 'Add a drop-down menu in posts.'], 'Menu': [true, 'Add a drop-down menu in posts'],
'Report Link': [true, 'Add a report link to the menu.'], 'Report Link': [true, 'Add a report link to the menu'],
'Delete Link': [true, 'Add post and image deletion links to the menu.'], 'Delete Link': [true, 'Add post and image deletion links to the menu'],
'Download Link': [true, 'Add a download with original filename link to the menu. Chrome-only currently.'], 'Download Link': [true, 'Add a download with original filename link to the menu (Chrome only)'],
'Archive Link': [true, 'Add an archive link to the menu.'] 'Archive Link': [true, 'Add an archive link to the menu']
}, },
Monitoring: { Monitoring: {
'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'], 'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'],
@ -132,15 +132,15 @@
'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to']
}, },
Posting: { Posting: {
'Quick Reply': [true, 'Reply without leaving the page.'], 'Quick Reply': [true, 'Reply without leaving the page'],
'Cooldown': [true, 'Prevent "flood detected" errors.'], 'Cooldown': [true, 'Prevent "flood detected" errors'],
'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'], 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting'],
'Auto Hide QR': [true, 'Automatically hide the quick reply when posting.'], 'Auto Hide QR': [true, 'Automatically hide the quick reply when posting'],
'Open Reply in New Tab': [false, 'Open replies in a new tab that are made from the main board.'], 'Open Reply in New Tab': [false, 'Open replies in a new tab that are made from the main board'],
'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only).'], 'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only)'],
'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'], 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting'],
'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'], 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting'],
'Hide Original Post Form': [true, 'Replace the normal post form with a shortcut to open the QR.'] 'Hide Original Post Form': [true, 'Replace the normal post form with a shortcut to open the QR']
}, },
Quoting: { Quoting: {
'Quote Backlinks': [true, 'Add quote backlinks'], 'Quote Backlinks': [true, 'Add quote backlinks'],
@ -200,6 +200,7 @@
}, },
updater: { updater: {
checkbox: { checkbox: {
'Beep': [false, 'Beep on new post to completely read thread'],
'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.'],
'Scroll BG': [false, 'Scroll background tabs'], 'Scroll BG': [false, 'Scroll background tabs'],
'Verbose': [true, 'Show countdown timer, new post count'], 'Verbose': [true, 'Show countdown timer, new post count'],
@ -514,6 +515,9 @@
} }
size = unit > 1 ? Math.round(size * 100) / 100 : Math.round(size); size = unit > 1 ? Math.round(size * 100) / 100 : Math.round(size);
return "" + size + " " + ['B', 'KB', 'MB', 'GB'][unit]; return "" + size + " " + ['B', 'KB', 'MB', 'GB'][unit];
},
hidden: function() {
return d.hidden || d.oHidden || d.mozHidden || d.webkitHidden;
} }
}); });
@ -1837,7 +1841,7 @@
if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) { if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) {
$('[autocomplete]', QR.el).focus(); $('[autocomplete]', QR.el).focus();
} }
if (d.hidden || d.oHidden || d.mozHidden || d.webkitHidden) { if ($.hidden()) {
return alert(el.textContent); return alert(el.textContent);
} }
}, },
@ -3031,6 +3035,14 @@
$.on(d, 'QRPostSuccessful', this.cb.post); $.on(d, 'QRPostSuccessful', this.cb.post);
return $.on(d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', this.cb.visibility); return $.on(d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', this.cb.visibility);
}, },
/*
http://freesound.org/people/pierrecartoons1979/sounds/90112/
cc-by-nc-3.0
*/
audio: $.el('audio', {
src: 'data:audio/wav;base64,UklGRjQDAABXQVZFZm10IBAAAAABAAEAgD4AAIA+AAABAAgAc21wbDwAAABBAAADAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkYXRhzAIAAGMms8em0tleMV4zIpLVo8nhfSlcPR102Ki+5JspVEkdVtKzs+K1NEhUIT7DwKrcy0g6WygsrM2k1NpiLl0zIY/WpMrjgCdbPhxw2Kq+5Z4qUkkdU9K1s+K5NkVTITzBwqnczko3WikrqM+l1NxlLF0zIIvXpsnjgydZPhxs2ay95aIrUEkdUdC3suK8N0NUIjq+xKrcz002WioppdGm091pK1w0IIjYp8jkhydXPxxq2K295aUrTkoeTs65suK+OUFUIzi7xqrb0VA0WSoootKm0t5tKlo1H4TYqMfkiydWQBxm16+85actTEseS8y7seHAPD9TIza5yKra01QyWSson9On0d5wKVk2H4DYqcfkjidUQB1j1rG75KsvSkseScu8seDCPz1TJDW2yara1FYxWSwnm9Sn0N9zKVg2H33ZqsXkkihSQR1g1bK65K0wSEsfR8i+seDEQTxUJTOzy6rY1VowWC0mmNWoz993KVc3H3rYq8TklSlRQh1d1LS647AyR0wgRMbAsN/GRDpTJTKwzKrX1l4vVy4lldWpzt97KVY4IXbUr8LZljVPRCxhw7W3z6ZISkw1VK+4sMWvXEhSPk6buay9sm5JVkZNiLWqtrJ+TldNTnquqbCwilZXU1BwpKirrpNgWFhTaZmnpquZbFlbVmWOpaOonHZcXlljhaGhpZ1+YWBdYn2cn6GdhmdhYGN3lp2enIttY2Jjco+bnJuOdGZlZXCImJqakHpoZ2Zug5WYmZJ/bGlobX6RlpeSg3BqaW16jZSVkoZ0bGtteImSk5KIeG5tbnaFkJKRinxxbm91gY2QkIt/c3BwdH6Kj4+LgnZxcXR8iI2OjIR5c3J0e4WLjYuFe3VzdHmCioyLhn52dHR5gIiKioeAeHV1eH+GiYqHgXp2dnh9hIiJh4J8eHd4fIKHiIeDfXl4eHyBhoeHhH96eHmA'
}),
cb: { cb: {
post: function() { post: function() {
if (!Conf['Auto Update This']) { if (!Conf['Auto Update This']) {
@ -3040,9 +3052,7 @@
return setTimeout(Updater.update, 500); return setTimeout(Updater.update, 500);
}, },
visibility: function() { visibility: function() {
var state; if ($.hidden()) {
state = d.visibilityState || d.oVisibilityState || d.mozVisibilityState || d.webkitVisibilityState;
if (state !== 'visible') {
return; return;
} }
Updater.unsuccessfulFetchCount = 0; Updater.unsuccessfulFetchCount = 0;
@ -3078,7 +3088,7 @@
return Updater.scrollBG = this.checked ? function() { return Updater.scrollBG = this.checked ? function() {
return true; return true;
} : function() { } : function() {
return !(d.hidden || d.oHidden || d.mozHidden || d.webkitHidden); return !$.hidden();
}; };
}, },
load: function() { load: function() {
@ -3149,6 +3159,9 @@
Updater.count.className = count ? 'new' : null; Updater.count.className = count ? 'new' : null;
} }
if (count) { if (count) {
if (Conf['Beep'] && $.hidden() && (Unread.replies.length === 0)) {
Updater.audio.play();
}
Updater.unsuccessfulFetchCount = 0; Updater.unsuccessfulFetchCount = 0;
} else { } else {
Updater.unsuccessfulFetchCount++; Updater.unsuccessfulFetchCount++;
@ -3174,7 +3187,7 @@
var i, j; var i, j;
i = +Conf['Interval']; i = +Conf['Interval'];
j = Math.min(this.unsuccessfulFetchCount, 9); j = Math.min(this.unsuccessfulFetchCount, 9);
if (!(d.hidden || d.oHidden || d.mozHidden || d.webkitHidden)) { if (!$.hidden()) {
j = Math.min(j, 6); j = Math.min(j, 6);
} }
return Math.max(i, [5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]); return Math.max(i, [5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]);

View File

@ -1,4 +1,6 @@
master master
- aeosynth
Beep on new post to completely read thread
- Mayhem - Mayhem
Fix dead quotes. Fix dead quotes.

View File

@ -1,8 +1,8 @@
Config = Config =
main: main:
Enhancing: Enhancing:
'Disable 4chan\'s extension': [true, 'Avoid conflicts between 4chan X and 4chan\'s inline extension.'] 'Disable 4chan\'s extension': [true, 'Avoid conflicts between 4chan X and 4chan\'s inline extension']
'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']
'404 Redirect': [true, 'Redirect dead threads and images'] '404 Redirect': [true, 'Redirect dead threads and images']
'Keybinds': [true, 'Binds actions to keys'] 'Keybinds': [true, 'Binds actions to keys']
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'] 'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time']
@ -25,13 +25,13 @@ Config =
'Image Hover': [false, 'Show full image on mouseover'] 'Image Hover': [false, 'Show full image on mouseover']
'Sauce': [true, 'Add sauce to images'] 'Sauce': [true, 'Add sauce to images']
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
'Expand From Current': [false, 'Expand images from current position to thread end.'] 'Expand From Current': [false, 'Expand images from current position to thread end']
Menu: Menu:
'Menu': [true, 'Add a drop-down menu in posts.'] 'Menu': [true, 'Add a drop-down menu in posts']
'Report Link': [true, 'Add a report link to the menu.'] 'Report Link': [true, 'Add a report link to the menu']
'Delete Link': [true, 'Add post and image deletion links to the menu.'] 'Delete Link': [true, 'Add post and image deletion links to the menu']
'Download Link': [true, 'Add a download with original filename link to the menu. Chrome-only currently.'] 'Download Link': [true, 'Add a download with original filename link to the menu (Chrome only)']
'Archive Link': [true, 'Add an archive link to the menu.'] 'Archive Link': [true, 'Add an archive link to the menu']
Monitoring: Monitoring:
'Thread Updater': [true, 'Update threads. Has more options in its own dialog.'] 'Thread Updater': [true, 'Update threads. Has more options in its own dialog.']
'Unread Count': [true, 'Show unread post count in tab title'] 'Unread Count': [true, 'Show unread post count in tab title']
@ -42,15 +42,15 @@ Config =
'Auto Watch': [true, 'Automatically watch threads that you start'] 'Auto Watch': [true, 'Automatically watch threads that you start']
'Auto Watch Reply': [false, 'Automatically watch threads that you reply to'] 'Auto Watch Reply': [false, 'Automatically watch threads that you reply to']
Posting: Posting:
'Quick Reply': [true, 'Reply without leaving the page.'] 'Quick Reply': [true, 'Reply without leaving the page']
'Cooldown': [true, 'Prevent "flood detected" errors.'] 'Cooldown': [true, 'Prevent "flood detected" errors']
'Persistent QR': [false, 'The Quick reply won\'t disappear after posting.'] 'Persistent QR': [false, 'The Quick reply won\'t disappear after posting']
'Auto Hide QR': [true, 'Automatically hide the quick reply when posting.'] 'Auto Hide QR': [true, 'Automatically hide the quick reply when posting']
'Open Reply in New Tab': [false, 'Open replies in a new tab that are made from the main board.'] 'Open Reply in New Tab': [false, 'Open replies in a new tab that are made from the main board']
'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only).'] 'Remember QR size': [false, 'Remember the size of the Quick reply (Firefox only)']
'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting.'] 'Remember Subject': [false, 'Remember the subject field, instead of resetting after posting']
'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting.'] 'Remember Spoiler': [false, 'Remember the spoiler state, instead of resetting after posting']
'Hide Original Post Form': [true, 'Replace the normal post form with a shortcut to open the QR.'] 'Hide Original Post Form': [true, 'Replace the normal post form with a shortcut to open the QR']
Quoting: Quoting:
'Quote Backlinks': [true, 'Add quote backlinks'] 'Quote Backlinks': [true, 'Add quote backlinks']
'OP Backlinks': [false, 'Add backlinks to the OP'] 'OP Backlinks': [false, 'Add backlinks to the OP']
@ -159,6 +159,7 @@ Config =
hide: ['x', 'Hide thread'] hide: ['x', 'Hide thread']
updater: updater:
checkbox: checkbox:
'Beep': [false, 'Beep on new post to completely read thread']
'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.']
'Scroll BG': [false, 'Scroll background tabs'] 'Scroll BG': [false, 'Scroll background tabs']
'Verbose': [true, 'Show countdown timer, new post count'] 'Verbose': [true, 'Show countdown timer, new post count']
@ -396,6 +397,8 @@ $.extend $,
# Round to an integer otherwise. # Round to an integer otherwise.
Math.round size Math.round size
"#{size} #{['B', 'KB', 'MB', 'GB'][unit]}" "#{size} #{['B', 'KB', 'MB', 'GB'][unit]}"
hidden: ->
d.hidden or d.oHidden or d.mozHidden or d.webkitHidden
$.cache.requests = {} $.cache.requests = {}
@ -1419,7 +1422,7 @@ QR =
if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent
# Focus the captcha input on captcha error. # Focus the captcha input on captcha error.
$('[autocomplete]', QR.el).focus() $('[autocomplete]', QR.el).focus()
alert el.textContent if d.hidden or d.oHidden or d.mozHidden or d.webkitHidden alert el.textContent if $.hidden()
cleanError: -> cleanError: ->
$('.warning', QR.el).textContent = null $('.warning', QR.el).textContent = null
@ -2457,14 +2460,19 @@ Updater =
$.on d, 'QRPostSuccessful', @cb.post $.on d, 'QRPostSuccessful', @cb.post
$.on d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', @cb.visibility $.on d, 'visibilitychange ovisibilitychange mozvisibilitychange webkitvisibilitychange', @cb.visibility
###
http://freesound.org/people/pierrecartoons1979/sounds/90112/
cc-by-nc-3.0
###
audio: $.el('audio', src: 'data:audio/wav;base64,UklGRjQDAABXQVZFZm10IBAAAAABAAEAgD4AAIA+AAABAAgAc21wbDwAAABBAAADAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkYXRhzAIAAGMms8em0tleMV4zIpLVo8nhfSlcPR102Ki+5JspVEkdVtKzs+K1NEhUIT7DwKrcy0g6WygsrM2k1NpiLl0zIY/WpMrjgCdbPhxw2Kq+5Z4qUkkdU9K1s+K5NkVTITzBwqnczko3WikrqM+l1NxlLF0zIIvXpsnjgydZPhxs2ay95aIrUEkdUdC3suK8N0NUIjq+xKrcz002WioppdGm091pK1w0IIjYp8jkhydXPxxq2K295aUrTkoeTs65suK+OUFUIzi7xqrb0VA0WSoootKm0t5tKlo1H4TYqMfkiydWQBxm16+85actTEseS8y7seHAPD9TIza5yKra01QyWSson9On0d5wKVk2H4DYqcfkjidUQB1j1rG75KsvSkseScu8seDCPz1TJDW2yara1FYxWSwnm9Sn0N9zKVg2H33ZqsXkkihSQR1g1bK65K0wSEsfR8i+seDEQTxUJTOzy6rY1VowWC0mmNWoz993KVc3H3rYq8TklSlRQh1d1LS647AyR0wgRMbAsN/GRDpTJTKwzKrX1l4vVy4lldWpzt97KVY4IXbUr8LZljVPRCxhw7W3z6ZISkw1VK+4sMWvXEhSPk6buay9sm5JVkZNiLWqtrJ+TldNTnquqbCwilZXU1BwpKirrpNgWFhTaZmnpquZbFlbVmWOpaOonHZcXlljhaGhpZ1+YWBdYn2cn6GdhmdhYGN3lp2enIttY2Jjco+bnJuOdGZlZXCImJqakHpoZ2Zug5WYmZJ/bGlobX6RlpeSg3BqaW16jZSVkoZ0bGtteImSk5KIeG5tbnaFkJKRinxxbm91gY2QkIt/c3BwdH6Kj4+LgnZxcXR8iI2OjIR5c3J0e4WLjYuFe3VzdHmCioyLhn52dHR5gIiKioeAeHV1eH+GiYqHgXp2dnh9hIiJh4J8eHd4fIKHiIeDfXl4eHyBhoeHhH96eHmA')
cb: cb:
post: -> post: ->
return unless Conf['Auto Update This'] return unless Conf['Auto Update This']
Updater.unsuccessfulFetchCount = 0 Updater.unsuccessfulFetchCount = 0
setTimeout Updater.update, 500 setTimeout Updater.update, 500
visibility: -> visibility: ->
state = d.visibilityState or d.oVisibilityState or d.mozVisibilityState or d.webkitVisibilityState return if $.hidden()
return if state isnt 'visible'
# Reset the counter when we focus this tab. # Reset the counter when we focus this tab.
Updater.unsuccessfulFetchCount = 0 Updater.unsuccessfulFetchCount = 0
if Updater.timer.textContent < -Conf['Interval'] if Updater.timer.textContent < -Conf['Interval']
@ -2492,7 +2500,7 @@ Updater =
if @checked if @checked
-> true -> true
else else
-> !(d.hidden or d.oHidden or d.mozHidden or d.webkitHidden) -> ! $.hidden()
load: -> load: ->
switch @status switch @status
when 404 when 404
@ -2547,6 +2555,8 @@ Updater =
Updater.count.className = if count then 'new' else null Updater.count.className = if count then 'new' else null
if count if count
if Conf['Beep'] and $.hidden() and (Unread.replies.length is 0)
Updater.audio.play()
Updater.unsuccessfulFetchCount = 0 Updater.unsuccessfulFetchCount = 0
else else
Updater.unsuccessfulFetchCount++ Updater.unsuccessfulFetchCount++
@ -2570,7 +2580,7 @@ Updater =
getInterval: -> getInterval: ->
i = +Conf['Interval'] i = +Conf['Interval']
j = Math.min @unsuccessfulFetchCount, 9 j = Math.min @unsuccessfulFetchCount, 9
unless d.hidden or d.oHidden or d.mozHidden or d.webkitHidden unless $.hidden()
# Don't increase the refresh rate too much on visible tabs. # Don't increase the refresh rate too much on visible tabs.
j = Math.min j, 6 j = Math.min j, 6
Math.max i, [5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j] Math.max i, [5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]