From 33d650b530656bca5eedd6491380e52cf57adfd5 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 25 Sep 2011 05:24:25 +0200 Subject: [PATCH] Set up options --- 4chan_x.user.js | 40 ++++++++++++++++++++++++++++++++++------ script.coffee | 30 +++++++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 9 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 02b2a40f8..1a78e95e4 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -116,6 +116,15 @@ 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'] } }, + filter: { + name: '', + trip: '', + mail: '', + sub: '', + com: '', + file: '', + md5: '' + }, flavors: ['http://iqdb.org/?url=', 'http://google.com/searchbyimage?image_url=', '#http://regex.info/exif.cgi?url=', '#http://tineye.com/search?url=', '#http://saucenao.com/search.php?db=999&url=', '#http://imgur.com/upload?url='].join('\n'), time: '%m/%d/%y(%a)%H:%M', backlink: '>>%id', @@ -1127,7 +1136,7 @@ return $.replace(home, a); }, dialog: function() { - var arr, back, checked, description, dialog, flavors, hiddenNum, hiddenThreads, input, key, li, obj, overlay, time, ul, _i, _len, _ref, _ref2; + var arr, back, checked, description, dialog, hiddenNum, hiddenThreads, input, key, li, obj, overlay, ta, time, ul, _i, _j, _len, _len2, _ref, _ref2, _ref3; dialog = $.el('div', { id: 'options', innerHTML: '\ @@ -1141,6 +1150,7 @@ \
\ \ + | \ | \ | \ | \ @@ -1152,6 +1162,18 @@
\ \ \ + \ +
\ + Filters are case-insensitive. One filter per line.
\ + You can use regular expressions, without opening and ending `/`, and without flags.\ +

Name:

\ +

Tripcode:

\ +

E-mail:

\ +

Subject:

\ +

Comment:

\ +

Filename:

\ +

Image MD5:

\ +
\ \
\
    \ @@ -1224,15 +1246,19 @@ }); $.bind($('button', li), 'click', options.clearHidden); $.add($('ul:nth-child(2)', dialog), li); - (flavors = $('#flavors', dialog)).textContent = conf['flavors']; - $.bind(flavors, 'change', $.cb.value); + _ref2 = $$('textarea', dialog); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + ta = _ref2[_i]; + ta.textContent = conf[ta.name]; + $.bind(ta, 'change', $.cb.value); + } (back = $('[name=backlink]', dialog)).value = conf['backlink']; (time = $('[name=time]', dialog)).value = conf['time']; $.bind(back, 'keyup', options.backlink); $.bind(time, 'keyup', options.time); - _ref2 = $$('#keybinds input', dialog); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - input = _ref2[_i]; + _ref3 = $$('#keybinds input', dialog); + for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { + input = _ref3[_j]; input.type = 'text'; input.value = conf[input.name]; $.bind(input, 'keydown', options.keybind); @@ -3134,6 +3160,8 @@ }\ #content textarea {\ margin: 0;\ + min-height: 100px;\ + resize: vertical;\ width: 100%;\ }\ \ diff --git a/script.coffee b/script.coffee index 6b30170de..43cf7be14 100644 --- a/script.coffee +++ b/script.coffee @@ -44,6 +44,14 @@ config = 'Quote Inline': [true, 'Show quoted post inline on quote click'] 'Quote Preview': [true, 'Show quote content on hover'] 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'] + filter: + name: '' + trip: '' + mail: '' + sub: '' + com: '' + file: '' + md5: '' flavors: [ 'http://iqdb.org/?url=' 'http://google.com/searchbyimage?image_url=' @@ -813,6 +821,7 @@ options =
+ | | | | @@ -824,6 +833,18 @@ options =
+ +
+ Filters are case-insensitive. One filter per line.
+ You can use regular expressions, without opening and ending `/`, and without flags. +

Name:

+

Tripcode:

+

E-mail:

+

Subject:

+

Comment:

+

Filename:

+

Image MD5:

+
    @@ -891,9 +912,10 @@ options = $.bind $('button', li), 'click', options.clearHidden $.add $('ul:nth-child(2)', dialog), li - #sauce - (flavors = $ '#flavors', dialog).textContent = conf['flavors'] - $.bind flavors, 'change', $.cb.value + #filter & sauce + for ta in $$ 'textarea', dialog + ta.textContent = conf[ta.name] + $.bind ta, 'change', $.cb.value #rice (back = $ '[name=backlink]', dialog).value = conf['backlink'] @@ -2389,6 +2411,8 @@ Main = } #content textarea { margin: 0; + min-height: 100px; + resize: vertical; width: 100%; }