From 50fb9dd522dcd5f6b70761a897df7700d8ed4cd0 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 25 Aug 2011 07:21:59 +0200 Subject: [PATCH] Remove a loop, remove unused bindings, move a binding next to its element declaration. --- 4chan_x.user.js | 21 ++++++--------------- script.coffee | 6 ++---- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3b7137f0f..fd2bc5414 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1065,7 +1065,7 @@ return $.replace(home, a); }, dialog: function() { - var arr, checked, description, dialog, hiddenNum, hiddenThreads, hidingul, html, input, key, li, link, main, obj, overlay, ul, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4; + var arr, checked, description, dialog, hiddenNum, hiddenThreads, hidingul, html, input, key, li, main, obj, overlay, ul, _i, _len, _ref, _ref2; hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {}); hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length; html = "
| | |

Format specifiers (source)
SpecifierDescriptionValues/Example
Year
%ytwo digit year00-99
Month
%bmonth, abbreviatedJun
%Bmonth, full lengthJune
%mmonth, zero padded06
Day
%aweekday, abbreviatedSat
%Aweekday, fullSaturday
%dday of the month, zero padded03
%eday of the month3
Time
%Hhour (24 hour clock) zero padded13
%l (lowercase L)hour (12 hour clock)1
%I (uppercase i)hour (12 hour clock) zero padded01
%khour (24 hour clock)13
%Mminutes, zero padded54
%pupper case AM or PMPM
%Plower case am or pmpm
ActionsKeybinds
Close Options or QR
Quick spoiler
Open QR with post number inserted
Open QR without post number inserted
Submit post
Select next reply
Select previous reply
See next thread
See previous thread
Jump to the next page
Jump to the previous page
Jump to page 0
Open thread in current tab
Open thread in new tab
Expand thread
Watch thread
Hide thread
Expand selected image
Expand all images
Update now
Reset the unread count to 0
"; @@ -1090,6 +1090,7 @@ li = $.el('li', { innerHTML: ": " + description + "" }); + $.bind($('input', li), 'click', $.cb.checked); $.append(ul, li); } $.append(main, ul); @@ -1098,22 +1099,12 @@ innerHTML: " : Forget all hidden posts. Useful if you accidentally hide a post and have `show stubs` disabled." }); $.append(hidingul, li); - _ref2 = $$('#main input', dialog); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - input = _ref2[_i]; - $.bind(input, 'click', $.cb.checked); - } - $.bind($('button', dialog), 'click', options.clearHidden); - _ref3 = $$('#floaty a', dialog); - for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { - link = _ref3[_j]; - $.bind(link, 'click', options.tab); - } + $.bind($('button', li), 'click', options.clearHidden); $.bind($('textarea[name=flavors]', dialog), 'change', $.cb.value); $.bind($('input[name=time]', dialog), 'keyup', options.time); - _ref4 = $$('#keybinds input', dialog); - for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) { - input = _ref4[_k]; + _ref2 = $$('#keybinds input', dialog); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + input = _ref2[_i]; input.value = conf[input.name]; $.bind(input, 'keydown', options.keybind); } diff --git a/script.coffee b/script.coffee index 0e0180ccd..090d56b5c 100644 --- a/script.coffee +++ b/script.coffee @@ -879,16 +879,14 @@ options = description = arr[1] li = $.el 'li', innerHTML: ": #{description}" + $.bind $('input', li), 'click', $.cb.checked $.append ul, li $.append main, ul li = $.el 'li', innerHTML: " : Forget all hidden posts. Useful if you accidentally hide a post and have `show stubs` disabled." $.append hidingul, li + $.bind $('button', li), 'click', options.clearHidden - for input in $$ '#main input', dialog - $.bind input, 'click', $.cb.checked - $.bind $('button', dialog), 'click', options.clearHidden - $.bind link, 'click', options.tab for link in $$ '#floaty a', dialog $.bind $('textarea[name=flavors]', dialog), 'change', $.cb.value $.bind $('input[name=time]', dialog), 'keyup', options.time for input in $$ '#keybinds input', dialog