Set up options

This commit is contained in:
Nicolas Stepien 2011-09-25 05:24:25 +02:00
parent 9f3736eb12
commit 33d650b530
2 changed files with 61 additions and 9 deletions

View File

@ -116,6 +116,15 @@
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'] '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'), 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', time: '%m/%d/%y(%a)%H:%M',
backlink: '>>%id', backlink: '>>%id',
@ -1127,7 +1136,7 @@
return $.replace(home, a); return $.replace(home, a);
}, },
dialog: function() { 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', { dialog = $.el('div', {
id: 'options', id: 'options',
innerHTML: '\ innerHTML: '\
@ -1141,6 +1150,7 @@
</div>\ </div>\
<div>\ <div>\
<label for=main_tab>Main</label>\ <label for=main_tab>Main</label>\
| <label for=filter_tab>Filter</label>\
| <label for=flavors_tab>Sauce</label>\ | <label for=flavors_tab>Sauce</label>\
| <label for=rice_tab>Rice</label>\ | <label for=rice_tab>Rice</label>\
| <label for=keybinds_tab>Keybinds</label>\ | <label for=keybinds_tab>Keybinds</label>\
@ -1152,6 +1162,18 @@
<div id=main></div>\ <div id=main></div>\
<input type=radio name=tab hidden id=flavors_tab>\ <input type=radio name=tab hidden id=flavors_tab>\
<textarea name=flavors id=flavors></textarea>\ <textarea name=flavors id=flavors></textarea>\
<input type=radio name=tab hidden id=filter_tab>\
<div id=filter>\
Filters are case-insensitive. One filter per line.<br>\
You can use <a href=https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions>regular expressions</a>, without opening and ending `/`, and without flags.\
<p>Name:<br><textarea name=name></textarea></p>\
<p>Tripcode:<br><textarea name=trip></textarea></p>\
<p>E-mail:<br><textarea name=mail></textarea></p>\
<p>Subject:<br><textarea name=sub></textarea></p>\
<p>Comment:<br><textarea name=com></textarea></p>\
<p>Filename:<br><textarea name=file></textarea></p>\
<p>Image MD5:<br><textarea name=md5></textarea></p>\
</div>\
<input type=radio name=tab hidden id=rice_tab>\ <input type=radio name=tab hidden id=rice_tab>\
<div id=rice>\ <div id=rice>\
<ul>\ <ul>\
@ -1224,15 +1246,19 @@
}); });
$.bind($('button', li), 'click', options.clearHidden); $.bind($('button', li), 'click', options.clearHidden);
$.add($('ul:nth-child(2)', dialog), li); $.add($('ul:nth-child(2)', dialog), li);
(flavors = $('#flavors', dialog)).textContent = conf['flavors']; _ref2 = $$('textarea', dialog);
$.bind(flavors, 'change', $.cb.value); 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']; (back = $('[name=backlink]', dialog)).value = conf['backlink'];
(time = $('[name=time]', dialog)).value = conf['time']; (time = $('[name=time]', dialog)).value = conf['time'];
$.bind(back, 'keyup', options.backlink); $.bind(back, 'keyup', options.backlink);
$.bind(time, 'keyup', options.time); $.bind(time, 'keyup', options.time);
_ref2 = $$('#keybinds input', dialog); _ref3 = $$('#keybinds input', dialog);
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
input = _ref2[_i]; input = _ref3[_j];
input.type = 'text'; input.type = 'text';
input.value = conf[input.name]; input.value = conf[input.name];
$.bind(input, 'keydown', options.keybind); $.bind(input, 'keydown', options.keybind);
@ -3134,6 +3160,8 @@
}\ }\
#content textarea {\ #content textarea {\
margin: 0;\ margin: 0;\
min-height: 100px;\
resize: vertical;\
width: 100%;\ width: 100%;\
}\ }\
\ \

View File

@ -44,6 +44,14 @@ config =
'Quote Inline': [true, 'Show quoted post inline on quote click'] 'Quote Inline': [true, 'Show quoted post inline on quote click']
'Quote Preview': [true, 'Show quote content on hover'] 'Quote Preview': [true, 'Show quote content on hover']
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'] 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes']
filter:
name: ''
trip: ''
mail: ''
sub: ''
com: ''
file: ''
md5: ''
flavors: [ flavors: [
'http://iqdb.org/?url=' 'http://iqdb.org/?url='
'http://google.com/searchbyimage?image_url=' 'http://google.com/searchbyimage?image_url='
@ -813,6 +821,7 @@ options =
</div> </div>
<div> <div>
<label for=main_tab>Main</label> <label for=main_tab>Main</label>
| <label for=filter_tab>Filter</label>
| <label for=flavors_tab>Sauce</label> | <label for=flavors_tab>Sauce</label>
| <label for=rice_tab>Rice</label> | <label for=rice_tab>Rice</label>
| <label for=keybinds_tab>Keybinds</label> | <label for=keybinds_tab>Keybinds</label>
@ -824,6 +833,18 @@ options =
<div id=main></div> <div id=main></div>
<input type=radio name=tab hidden id=flavors_tab> <input type=radio name=tab hidden id=flavors_tab>
<textarea name=flavors id=flavors></textarea> <textarea name=flavors id=flavors></textarea>
<input type=radio name=tab hidden id=filter_tab>
<div id=filter>
Filters are case-insensitive. One filter per line.<br>
You can use <a href=https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions>regular expressions</a>, without opening and ending `/`, and without flags.
<p>Name:<br><textarea name=name></textarea></p>
<p>Tripcode:<br><textarea name=trip></textarea></p>
<p>E-mail:<br><textarea name=mail></textarea></p>
<p>Subject:<br><textarea name=sub></textarea></p>
<p>Comment:<br><textarea name=com></textarea></p>
<p>Filename:<br><textarea name=file></textarea></p>
<p>Image MD5:<br><textarea name=md5></textarea></p>
</div>
<input type=radio name=tab hidden id=rice_tab> <input type=radio name=tab hidden id=rice_tab>
<div id=rice> <div id=rice>
<ul> <ul>
@ -891,9 +912,10 @@ options =
$.bind $('button', li), 'click', options.clearHidden $.bind $('button', li), 'click', options.clearHidden
$.add $('ul:nth-child(2)', dialog), li $.add $('ul:nth-child(2)', dialog), li
#sauce #filter & sauce
(flavors = $ '#flavors', dialog).textContent = conf['flavors'] for ta in $$ 'textarea', dialog
$.bind flavors, 'change', $.cb.value ta.textContent = conf[ta.name]
$.bind ta, 'change', $.cb.value
#rice #rice
(back = $ '[name=backlink]', dialog).value = conf['backlink'] (back = $ '[name=backlink]', dialog).value = conf['backlink']
@ -2389,6 +2411,8 @@ Main =
} }
#content textarea { #content textarea {
margin: 0; margin: 0;
min-height: 100px;
resize: vertical;
width: 100%; width: 100%;
} }