Compile and stuff.

This commit is contained in:
Nicolas Stepien 2012-08-25 01:43:22 +02:00
parent 29285863cc
commit c954544048
2 changed files with 76 additions and 80 deletions

View File

@ -78,31 +78,31 @@
Config = { Config = {
main: { main: {
Enhancing: { Enhancing: {
'404 Redirect': [true, 'Redirect dead threads and images'], '404 Redirect': [true, 'Redirect dead threads and images.'],
'Keybinds': [true, 'Binds actions to keys'], 'Keybinds': [true, 'Bind actions to keyboard shortcuts.'],
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'], 'Time Formatting': [true, 'Localize and format timestamps arbitrarily.'],
'File Info Formatting': [true, 'Reformats the file information'], 'File Info Formatting': [true, 'Reformat the file information.'],
'Comment Expansion': [true, 'Expand too long comments'], 'Comment Expansion': [true, 'Can expand too long comments.'],
'Thread Expansion': [true, 'View all replies'], 'Thread Expansion': [true, 'Can expand threads to view all replies.'],
'Index Navigation': [true, 'Navigate to previous / next thread'], 'Index Navigation': [false, 'Navigate to previous / next thread.'],
'Reply Navigation': [false, 'Navigate to top / bottom of thread'], 'Reply Navigation': [false, 'Navigate to top / bottom of thread.'],
'Check for Updates': [true, 'Check for updated versions of 4chan X'] 'Check for Updates': [true, 'Check for updated versions of 4chan X.']
}, },
Filtering: { Filtering: {
'Anonymize': [false, 'Make everybody anonymous'], 'Anonymize': [false, 'Turn everyone Anonymous.'],
'Filter': [true, 'Self-moderation placebo'], 'Filter': [true, 'Self-moderation placebo.'],
'Recursive Filtering': [true, 'Filter replies of filtered posts, recursively'], 'Recursive Filtering': [true, 'Filter replies of filtered posts, recursively.'],
'Reply Hiding': [true, 'Hide single replies'], 'Reply Hiding': [true, 'Hide single replies.'],
'Thread Hiding': [true, 'Hide entire threads'], 'Thread Hiding': [true, 'Hide entire threads.'],
'Show Stubs': [true, 'Of hidden threads / replies'] 'Stubs': [true, 'Make stubs of hidden threads / replies.']
}, },
Imaging: { Imaging: {
'Image Auto-Gif': [false, 'Animate gif thumbnails'], 'Image Auto-Gif': [false, 'Animate GIF thumbnails.'],
'Image Expansion': [true, 'Expand images'], 'Image Expansion': [true, 'Expand images.'],
'Image Hover': [false, 'Show full image on mouseover'], 'Expand From Position': [true, 'Expand all images only from current position to thread end.'],
'Sauce': [true, 'Add sauce to images'], 'Image Hover': [false, 'Show full image on mouseover.'],
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'], 'Sauce': [true, 'Add sauce links to images.'],
'Expand From Current': [false, 'Expand images from current position to thread end.'] 'Reveal Spoilers': [false, 'Reveal spoiler thumbnails.']
}, },
Menu: { Menu: {
'Menu': [true, 'Add a drop-down menu in posts.'], 'Menu': [true, 'Add a drop-down menu in posts.'],
@ -112,47 +112,45 @@
'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, 'Fetch and insert new replies. Has more options in its own dialog.'],
'Unread Count': [true, 'Show unread post count in tab title'], 'Unread Count': [true, 'Show the unread posts count in the tab title.'],
'Unread Favicon': [true, 'Show a different favicon when there are unread posts'], 'Unread Favicon': [true, 'Show a different favicon when there are unread posts.'],
'Post in Title': [true, 'Show the op\'s post in the tab title'], 'Post in Title': [true, 'Show the thread\'s subject in the tab title.'],
'Thread Stats': [true, 'Display reply and image count'], 'Thread Stats': [true, 'Display reply and image count.'],
'Thread Watcher': [true, 'Bookmark threads'], 'Thread Watcher': [true, 'Bookmark threads.'],
'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, 'WMD.'],
'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': [false, '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 posted from the board pages in a new tab.'],
'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.'],
'Quote Highlighting': [true, 'Highlight the previewed post'], 'Quote Inline': [true, 'Inline quoted post on click.'],
'Quote Inline': [true, 'Show quoted post inline on quote click'], 'Forward Hiding': [true, 'Hide original posts of inlined backlinks.'],
'Quote Preview': [true, 'Show quote content on hover'], 'Quote Preview': [true, 'Show quoted post on hover.'],
'Resurrect Quotes': [true, 'Linkify dead quotes to archives'], 'Quote Highlighting': [true, 'Highlight the previewed post.'],
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'], 'Resurrect Quotes': [true, 'Linkify dead quotes to archives.'],
'Indicate Cross-thread Quotes': [true, 'Add \'(Cross-thread)\' to cross-threads quotes'], 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes.'],
'Forward Hiding': [true, 'Hide original posts of inlined backlinks'] 'Indicate Cross-thread Quotes': [true, 'Add \'(Cross-thread)\' to cross-threads quotes.']
} }
}, },
filter: { filter: {
name: ['# Filter any namefags:', '#/^(?!Anonymous$)/'].join('\n'), name: ['# Filter any namefags:', '#/^(?!Anonymous$)/'].join('\n'),
uniqueid: ['# Filter a specific ID:', '#/Txhvk1Tl/'].join('\n'), uniqueid: ['# Filter a specific ID:', '#/Txhvk1Tl/'].join('\n'),
tripcode: ['# Filter any tripfags', '#/^!/'].join('\n'), tripcode: ['# Filter any tripfags', '#/^!/'].join('\n'),
mod: ['# Set a custom class for mods:', '#/Mod$/;highlight:mod;op:yes', '# Set a custom class for moot:', '#/Admin$/;highlight:moot;op:yes'].join('\n'), capcode: ['# Set a custom class for mods:', '#/Mod$/;highlight:mod;op:yes', '# Set a custom class for moot:', '#/Admin$/;highlight:moot;op:yes'].join('\n'),
email: ['# Filter any e-mails that are not `sage` on /a/ and /jp/:', '#/^(?!sage$)/;boards:a,jp'].join('\n'), email: ['# Filter any e-mails that are not `sage` on /a/ and /jp/:', '#/^(?!sage$)/;boards:a,jp'].join('\n'),
subject: ['# Filter Generals on /v/:', '#/general/i;boards:v;op:only'].join('\n'), subject: ['# Filter Generals on /v/:', '#/general/i;boards:v;op:only'].join('\n'),
comment: ['# Filter Stallman copypasta on /g/:', '#/what you\'re refer+ing to as linux/i;boards:g'].join('\n'), comment: ['# Filter Stallman copypasta on /g/:', '#/what you\'re refer+ing to as linux/i;boards:g'].join('\n'),
country: [''].join('\n'), flag: [''].join('\n'),
filename: [''].join('\n'), filename: [''].join('\n'),
dimensions: ['# Highlight potential wallpapers:', '#/1920x1080/;op:yes;highlight;top:no;boards:w,wg'].join('\n'), dimensions: ['# Highlight potential wallpapers:', '#/1920x1080/;op:yes;highlight;top:no;boards:w,wg'].join('\n'),
filesize: [''].join('\n'), filesize: [''].join('\n'),
@ -164,39 +162,39 @@
fileInfo: '%l (%p%s, %r)', fileInfo: '%l (%p%s, %r)',
favicon: 'ferongr', favicon: 'ferongr',
hotkeys: { hotkeys: {
openQR: ['i', 'Open QR with post number inserted'], 'open QR': ['q', 'Open QR with post number inserted.'],
openEmptyQR: ['I', 'Open QR without post number inserted'], 'open empty QR': ['Q', 'Open QR without post number inserted.'],
openOptions: ['ctrl+o', 'Open Options'], 'open options': ['alt+o', 'Open Options.'],
close: ['Esc', 'Close Options or QR'], 'close': ['Esc', 'Close Options or QR.'],
spoiler: ['ctrl+s', 'Quick spoiler tags'], 'spoiler tags': ['ctrl+s', 'Insert spoiler tags.'],
code: ['alt+c', 'Quick code tags'], 'code tags': ['alt+c', 'Insert code tags.'],
submit: ['alt+s', 'Submit post'], 'submit QR': ['alt+s', 'Submit post.'],
watch: ['w', 'Watch thread'], 'watch': ['w', 'Watch thread.'],
update: ['u', 'Update now'], 'update': ['u', 'Update the thread now.'],
unreadCountTo0: ['z', 'Reset unread status'], 'reset unread count': ['r', 'Reset unread status.'],
expandImage: ['m', 'Expand selected image'], 'expand image': ['E', 'Expand selected image.'],
expandAllImages: ['M', 'Expand all images'], 'expand images': ['e', 'Expand all images.'],
zero: ['0', 'Jump to page 0'], 'front page': ['0', 'Jump to page 0.'],
nextPage: ['L', 'Jump to the next page'], 'next page': ['Right', 'Jump to the next page.'],
previousPage: ['H', 'Jump to the previous page'], 'previous page': ['Left', 'Jump to the previous page.'],
nextThread: ['n', 'See next thread'], 'next thread': ['Down', 'See next thread.'],
previousThread: ['p', 'See previous thread'], 'previous thread': ['Up', 'See previous thread.'],
expandThread: ['e', 'Expand thread'], 'expand thread': ['ctrl+e', 'Expand thread.'],
openThreadTab: ['o', 'Open thread in current tab'], 'open thread': ['o', 'Open thread in current tab.'],
openThread: ['O', 'Open thread in new tab'], 'open thread tab': ['O', 'Open thread in new tab.'],
nextReply: ['J', 'Select next reply'], 'next reply': ['j', 'Select next reply.'],
previousReply: ['K', 'Select previous reply'], 'previous reply': ['k', 'Select previous reply.'],
hide: ['x', 'Hide thread'] 'hide': ['x', 'Hide thread.']
}, },
updater: { updater: {
checkbox: { checkbox: {
'Scrolling': [false, 'Scroll updated posts into view. Only enabled at bottom of page.'], 'Auto Scroll': [false, 'Scroll updated posts into view. Only enabled at bottom of page.'],
'Scroll BG': [false, 'Scroll background tabs'], 'Scroll BG': [false, 'Auto-scroll background tabs.'],
'Verbose': [true, 'Show countdown timer, new post count'], 'Auto Update': [true, 'Automatically fetch new posts.']
'Auto Update': [true, 'Automatically fetch new posts']
}, },
'Interval': 30 'Interval': 30
} },
imageFit: 'fit width'
}; };
if (!/^(boards|images|sys)\.4chan\.org$/.test(location.hostname)) { if (!/^(boards|images|sys)\.4chan\.org$/.test(location.hostname)) {
@ -241,8 +239,8 @@
style = UI.el.style; style = UI.el.style;
style.left = left; style.left = left;
style.top = top; style.top = top;
style.right = left === null ? '0px' : null; style.right = left ? null : '0px';
return style.bottom = top === null ? '0px' : null; return style.bottom = top ? null : '0px';
}, },
dragend: function() { dragend: function() {
localStorage.setItem("" + Main.namespace + UI.el.id + ".position", UI.el.style.cssText); localStorage.setItem("" + Main.namespace + UI.el.id + ".position", UI.el.style.cssText);

View File

@ -179,7 +179,7 @@ UI =
el.querySelector('.move').addEventListener 'mousedown', UI.dragstart, false el.querySelector('.move').addEventListener 'mousedown', UI.dragstart, false
el el
dragstart: (e) -> dragstart: (e) ->
#prevent text selection # prevent text selection
e.preventDefault() e.preventDefault()
UI.el = el = @parentNode UI.el = el = @parentNode
d.addEventListener 'mousemove', UI.drag, false d.addEventListener 'mousemove', UI.drag, false
@ -201,13 +201,11 @@ UI =
if top < 10 then '0px' if top < 10 then '0px'
else if UI.height - top < 10 then null else if UI.height - top < 10 then null
else top + 'px' else top + 'px'
#using null instead of '' is 4% faster
#these 4 statements are 40% faster than 1 style.cssText
{style} = UI.el {style} = UI.el
style.left = left style.left = left
style.top = top style.top = top
style.right = if left is null then '0px' else null style.right = if left then null else '0px'
style.bottom = if top is null then '0px' else null style.bottom = if top then null else '0px'
dragend: -> dragend: ->
localStorage.setItem "#{Main.namespace}#{UI.el.id}.position", UI.el.style.cssText localStorage.setItem "#{Main.namespace}#{UI.el.id}.position", UI.el.style.cssText
d.removeEventListener 'mousemove', UI.drag, false d.removeEventListener 'mousemove', UI.drag, false