Merge branch 'master' into getarchivedquotes

This commit is contained in:
Nicolas Stepien 2012-06-16 18:00:48 +02:00
commit 0b4cfe7009
2 changed files with 155 additions and 75 deletions

View File

@ -2227,7 +2227,7 @@
} }
}, },
dialog: function() { dialog: function() {
var arr, back, checked, description, dialog, favicon, fileInfo, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, overlay, ta, time, tr, ul, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3; var arr, back, checked, description, dialog, favicon, fileInfo, filter, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, overlay, sauce, time, tr, ul, _i, _len, _ref, _ref1, _ref2;
dialog = $.el('div', { dialog = $.el('div', {
id: 'options', id: 'options',
className: 'reply dialog', className: 'reply dialog',
@ -2260,32 +2260,25 @@
<li>$3: MD5 hash.</li>\ <li>$3: MD5 hash.</li>\
<li>$4: Current board.</li>\ <li>$4: Current board.</li>\
</ul>\ </ul>\
<textarea name=sauces id=sauces></textarea>\ <textarea name=sauces id=sauces class=field></textarea>\
</div>\ </div>\
<input type=radio name=tab hidden id=filter_tab>\ <input type=radio name=tab hidden id=filter_tab>\
<div>\ <div>\
<div class=warning><code>Filter</code> is disabled.</div>\ <div class=warning><code>Filter</code> is disabled.</div>\
Use <a href=https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions>regular expressions</a>, one per line.<br>\ <select name=filter>\
Lines starting with a <code>#</code> will be ignored.<br>\ <option value=guide>Guide</option>\
For example, <code>/weeaboo/i</code> will filter posts containing `weeaboo` case-insensitive.\ <option value=name>Name</option>\
<ul>You can use these settings with each regular expression, separate them with semicolons:\ <option value=uniqueid>Unique ID</option>\
<li>Per boards, separate them with commas. It is global if not specified.<br>For example: <code>boards:a,jp;</code>.</li>\ <option value=tripcode>Tripcode</option>\
<li>Filter OPs only along with their threads (`only`), replies only (`no`, this is default), or both (`yes`).<br>For example: <code>op:only;</code>, <code>op:no;</code> or <code>op:yes;</code>.</li>\ <option value=mod>Admin/Mod</option>\
<li>Overrule the `Show Stubs` setting if specified: create a stub (`yes`) or not (`no`).<br>For example: <code>stub:yes;</code> or <code>stub:no;</code></li>\ <option value=email>E-mail</option>\
<li>Highlight instead of hiding. You can specify a class name to use with a userstyle.<br>For example: <code>highlight;</code> or <code>highlight:wallpaper;</code>.</li>\ <option value=subject>Subject</option>\
<li>Highlighted OPs will have their threads put on top of board pages by default.<br>For example: <code>top:yes</code> or <code>top:no</code>.</li>\ <option value=comment>Comment</option>\
</ul>\ <option value=filename>Filename</option>\
<p>Name:<br><textarea name=name></textarea></p>\ <option value=dimensions>Image dimensions</option>\
<p>Unique ID:<br><textarea name=uniqueid></textarea></p>\ <option value=filesize>Filesize</option>\
<p>Tripcode:<br><textarea name=tripcode></textarea></p>\ <option value=md5>Image MD5 (uses exact string matching, not regular expressions)</option>\
<p>Admin/Mod:<br><textarea name=mod></textarea></p>\ </select>\
<p>E-mail:<br><textarea name=email></textarea></p>\
<p>Subject:<br><textarea name=subject></textarea></p>\
<p>Comment:<br><textarea name=comment></textarea></p>\
<p>Filename:<br><textarea name=filename></textarea></p>\
<p>Image dimensions:<br><textarea name=dimensions></textarea></p>\
<p>Filesize:<br><textarea name=filesize></textarea></p>\
<p>Image MD5 (uses exact string matching, not regular expressions):<br><textarea name=md5></textarea></p>\
</div>\ </div>\
<input type=radio name=tab hidden id=rice_tab>\ <input type=radio name=tab hidden id=rice_tab>\
<div>\ <div>\
@ -2361,13 +2354,11 @@
}); });
$.on($('button', li), 'click', Options.clearHidden); $.on($('button', li), 'click', Options.clearHidden);
$.add($('ul:nth-child(2)', dialog), li); $.add($('ul:nth-child(2)', dialog), li);
_ref1 = $$('textarea', dialog); filter = $('select[name=filter]', dialog);
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { $.on(filter, 'change', Options.filter);
ta = _ref1[_i]; sauce = $('#sauces', dialog);
ta.textContent = $.get(ta.name, Conf[ta.name]); sauce.value = $.get(sauce.name, Conf[sauce.name]);
ta.className = 'field'; $.on(sauce, 'change', $.cb.value);
$.on(ta, 'change', $.cb.value);
}
(back = $('[name=backlink]', dialog)).value = $.get('backlink', Conf['backlink']); (back = $('[name=backlink]', dialog)).value = $.get('backlink', Conf['backlink']);
(time = $('[name=time]', dialog)).value = $.get('time', Conf['time']); (time = $('[name=time]', dialog)).value = $.get('time', Conf['time']);
(fileInfo = $('[name=fileInfo]', dialog)).value = $.get('fileInfo', Conf['fileInfo']); (fileInfo = $('[name=fileInfo]', dialog)).value = $.get('fileInfo', Conf['fileInfo']);
@ -2377,13 +2368,13 @@
$.on(time, 'input', Options.time); $.on(time, 'input', Options.time);
$.on(fileInfo, 'input', $.cb.value); $.on(fileInfo, 'input', $.cb.value);
$.on(fileInfo, 'input', Options.fileInfo); $.on(fileInfo, 'input', Options.fileInfo);
favicon = $('select', dialog); favicon = $('select[name=favicon]', dialog);
favicon.value = $.get('favicon', Conf['favicon']); favicon.value = $.get('favicon', Conf['favicon']);
$.on(favicon, 'change', $.cb.value); $.on(favicon, 'change', $.cb.value);
$.on(favicon, 'change', Options.favicon); $.on(favicon, 'change', Options.favicon);
_ref2 = Config.hotkeys; _ref1 = Config.hotkeys;
for (key in _ref2) { for (key in _ref1) {
arr = _ref2[key]; arr = _ref1[key];
tr = $.el('tr', { tr = $.el('tr', {
innerHTML: "<td>" + arr[1] + "</td><td><input name=" + key + " class=field></td>" innerHTML: "<td>" + arr[1] + "</td><td><input name=" + key + " class=field></td>"
}); });
@ -2393,9 +2384,9 @@
$.add($('#keybinds_tab + div tbody', dialog), tr); $.add($('#keybinds_tab + div tbody', dialog), tr);
} }
indicators = {}; indicators = {};
_ref3 = $$('.warning', dialog); _ref2 = $$('.warning', dialog);
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
indicator = _ref3[_j]; indicator = _ref2[_i];
key = indicator.firstChild.textContent; key = indicator.firstChild.textContent;
indicator.hidden = $.get(key, Conf[key]); indicator.hidden = $.get(key, Conf[key]);
indicators[key] = indicator; indicators[key] = indicator;
@ -2414,6 +2405,7 @@
$.add(d.body, overlay); $.add(d.body, overlay);
d.body.style.setProperty('width', "" + d.body.clientWidth + "px", null); d.body.style.setProperty('width', "" + d.body.clientWidth + "px", null);
$.addClass(d.body, 'unscroll'); $.addClass(d.body, 'unscroll');
Options.filter.call(filter);
Options.backlink.call(back); Options.backlink.call(back);
Options.time.call(time); Options.time.call(time);
Options.fileInfo.call(fileInfo); Options.fileInfo.call(fileInfo);
@ -2443,6 +2435,50 @@
this.value = key; this.value = key;
return $.cb.value.call(this); return $.cb.value.call(this);
}, },
filter: function() {
var el, name, ta;
el = this.nextSibling;
if ((name = this.value) !== 'guide') {
ta = $.el('textarea', {
name: name,
className: 'field',
value: $.get(name, Conf[name])
});
$.on(ta, 'change', $.cb.value);
$.replace(el, ta);
return;
}
if (el) {
$.rm(el);
}
return $.after(this, $.el('article', {
innerHTML: '<p>Use <a href=https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions>regular expressions</a>, one per line.<br>\
Lines starting with a <code>#</code> will be ignored.<br>\
For example, <code>/weeaboo/i</code> will filter posts containing the string `<code>weeaboo</code>`, case-insensitive.</p>\
<ul>You can use these settings with each regular expression, separate them with semicolons:\
<li>\
Per boards, separate them with commas. It is global if not specified.<br>\
For example: <code>boards:a,jp;</code>.\
</li>\
<li>\
Filter OPs only along with their threads (`only`), replies only (`no`, this is default), or both (`yes`).<br>\
For example: <code>op:only;</code>, <code>op:no;</code> or <code>op:yes;</code>.\
</li>\
<li>\
Overrule the `Show Stubs` setting if specified: create a stub (`yes`) or not (`no`).<br>\
For example: <code>stub:yes;</code> or <code>stub:no;</code>\
</li>\
<li>\
Highlight instead of hiding. You can specify a class name to use with a userstyle.<br>\
For example: <code>highlight;</code> or <code>highlight:wallpaper;</code>.\
</li>\
<li>\
Highlighted OPs will have their threads put on top of board pages by default.<br>\
For example: <code>top:yes;</code> or <code>top:no;</code>.\
</li>\
</ul>'
}));
},
time: function() { time: function() {
Time.foo(); Time.foo();
Time.date = new Date(); Time.date = new Date();
@ -4895,9 +4931,16 @@ body.unscroll {\
float: right;\ float: right;\
}\ }\
#options ul {\ #options ul {\
list-style: none;\
padding: 0;\ padding: 0;\
}\ }\
#options article li {\
margin: 10px 0 10px 2em;\
}\
#options code {\
background: hsla(0, 0%, 100%, .5);\
color: #000;\
padding: 0 1px;\
}\
#options label {\ #options label {\
text-decoration: underline;\ text-decoration: underline;\
}\ }\
@ -4907,13 +4950,10 @@ body.unscroll {\
}\ }\
#content textarea {\ #content textarea {\
font-family: monospace;\ font-family: monospace;\
min-height: 100px;\ min-height: 350px;\
resize: vertical;\ resize: vertical;\
width: 100%;\ width: 100%;\
}\ }\
#sauces {\
height: 300px;\
}\
\ \
#updater {\ #updater {\
text-align: right;\ text-align: right;\

View File

@ -1731,32 +1731,25 @@ Options =
<li>$3: MD5 hash.</li> <li>$3: MD5 hash.</li>
<li>$4: Current board.</li> <li>$4: Current board.</li>
</ul> </ul>
<textarea name=sauces id=sauces></textarea> <textarea name=sauces id=sauces class=field></textarea>
</div> </div>
<input type=radio name=tab hidden id=filter_tab> <input type=radio name=tab hidden id=filter_tab>
<div> <div>
<div class=warning><code>Filter</code> is disabled.</div> <div class=warning><code>Filter</code> is disabled.</div>
Use <a href=https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions>regular expressions</a>, one per line.<br> <select name=filter>
Lines starting with a <code>#</code> will be ignored.<br> <option value=guide>Guide</option>
For example, <code>/weeaboo/i</code> will filter posts containing `weeaboo` case-insensitive. <option value=name>Name</option>
<ul>You can use these settings with each regular expression, separate them with semicolons: <option value=uniqueid>Unique ID</option>
<li>Per boards, separate them with commas. It is global if not specified.<br>For example: <code>boards:a,jp;</code>.</li> <option value=tripcode>Tripcode</option>
<li>Filter OPs only along with their threads (`only`), replies only (`no`, this is default), or both (`yes`).<br>For example: <code>op:only;</code>, <code>op:no;</code> or <code>op:yes;</code>.</li> <option value=mod>Admin/Mod</option>
<li>Overrule the `Show Stubs` setting if specified: create a stub (`yes`) or not (`no`).<br>For example: <code>stub:yes;</code> or <code>stub:no;</code></li> <option value=email>E-mail</option>
<li>Highlight instead of hiding. You can specify a class name to use with a userstyle.<br>For example: <code>highlight;</code> or <code>highlight:wallpaper;</code>.</li> <option value=subject>Subject</option>
<li>Highlighted OPs will have their threads put on top of board pages by default.<br>For example: <code>top:yes</code> or <code>top:no</code>.</li> <option value=comment>Comment</option>
</ul> <option value=filename>Filename</option>
<p>Name:<br><textarea name=name></textarea></p> <option value=dimensions>Image dimensions</option>
<p>Unique ID:<br><textarea name=uniqueid></textarea></p> <option value=filesize>Filesize</option>
<p>Tripcode:<br><textarea name=tripcode></textarea></p> <option value=md5>Image MD5 (uses exact string matching, not regular expressions)</option>
<p>Admin/Mod:<br><textarea name=mod></textarea></p> </select>
<p>E-mail:<br><textarea name=email></textarea></p>
<p>Subject:<br><textarea name=subject></textarea></p>
<p>Comment:<br><textarea name=comment></textarea></p>
<p>Filename:<br><textarea name=filename></textarea></p>
<p>Image dimensions:<br><textarea name=dimensions></textarea></p>
<p>Filesize:<br><textarea name=filesize></textarea></p>
<p>Image MD5 (uses exact string matching, not regular expressions):<br><textarea name=md5></textarea></p>
</div> </div>
<input type=radio name=tab hidden id=rice_tab> <input type=radio name=tab hidden id=rice_tab>
<div> <div>
@ -1827,11 +1820,14 @@ Options =
$.on $('button', li), 'click', Options.clearHidden $.on $('button', li), 'click', Options.clearHidden
$.add $('ul:nth-child(2)', dialog), li $.add $('ul:nth-child(2)', dialog), li
#filter & sauce #filter
for ta in $$ 'textarea', dialog filter = $ 'select[name=filter]', dialog
ta.textContent = $.get ta.name, Conf[ta.name] $.on filter, 'change', Options.filter
ta.className = 'field'
$.on ta, 'change', $.cb.value #sauce
sauce = $ '#sauces', dialog
sauce.value = $.get sauce.name, Conf[sauce.name]
$.on sauce, 'change', $.cb.value
#rice #rice
(back = $ '[name=backlink]', dialog).value = $.get 'backlink', Conf['backlink'] (back = $ '[name=backlink]', dialog).value = $.get 'backlink', Conf['backlink']
@ -1843,7 +1839,7 @@ Options =
$.on time, 'input', Options.time $.on time, 'input', Options.time
$.on fileInfo, 'input', $.cb.value $.on fileInfo, 'input', $.cb.value
$.on fileInfo, 'input', Options.fileInfo $.on fileInfo, 'input', Options.fileInfo
favicon = $ 'select', dialog favicon = $ 'select[name=favicon]', dialog
favicon.value = $.get 'favicon', Conf['favicon'] favicon.value = $.get 'favicon', Conf['favicon']
$.on favicon, 'change', $.cb.value $.on favicon, 'change', $.cb.value
$.on favicon, 'change', Options.favicon $.on favicon, 'change', Options.favicon
@ -1874,6 +1870,7 @@ Options =
d.body.style.setProperty 'width', "#{d.body.clientWidth}px", null d.body.style.setProperty 'width', "#{d.body.clientWidth}px", null
$.addClass d.body, 'unscroll' $.addClass d.body, 'unscroll'
Options.filter.call filter
Options.backlink.call back Options.backlink.call back
Options.time.call time Options.time.call time
Options.fileInfo.call fileInfo Options.fileInfo.call fileInfo
@ -1898,6 +1895,45 @@ Options =
return unless (key = Keybinds.keyCode e)? return unless (key = Keybinds.keyCode e)?
@value = key @value = key
$.cb.value.call @ $.cb.value.call @
filter: ->
el = @nextSibling
if (name = @value) isnt 'guide'
ta = $.el 'textarea',
name: name
className: 'field'
value: $.get name, Conf[name]
$.on ta, 'change', $.cb.value
$.replace el, ta
return
$.rm el if el
$.after @, $.el 'article',
innerHTML: '<p>Use <a href=https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions>regular expressions</a>, one per line.<br>
Lines starting with a <code>#</code> will be ignored.<br>
For example, <code>/weeaboo/i</code> will filter posts containing the string `<code>weeaboo</code>`, case-insensitive.</p>
<ul>You can use these settings with each regular expression, separate them with semicolons:
<li>
Per boards, separate them with commas. It is global if not specified.<br>
For example: <code>boards:a,jp;</code>.
</li>
<li>
Filter OPs only along with their threads (`only`), replies only (`no`, this is default), or both (`yes`).<br>
For example: <code>op:only;</code>, <code>op:no;</code> or <code>op:yes;</code>.
</li>
<li>
Overrule the `Show Stubs` setting if specified: create a stub (`yes`) or not (`no`).<br>
For example: <code>stub:yes;</code> or <code>stub:no;</code>
</li>
<li>
Highlight instead of hiding. You can specify a class name to use with a userstyle.<br>
For example: <code>highlight;</code> or <code>highlight:wallpaper;</code>.
</li>
<li>
Highlighted OPs will have their threads put on top of board pages by default.<br>
For example: <code>top:yes;</code> or <code>top:no;</code>.
</li>
</ul>'
time: -> time: ->
Time.foo() Time.foo()
Time.date = new Date() Time.date = new Date()
@ -3846,9 +3882,16 @@ body.unscroll {
float: right; float: right;
} }
#options ul { #options ul {
list-style: none;
padding: 0; padding: 0;
} }
#options article li {
margin: 10px 0 10px 2em;
}
#options code {
background: hsla(0, 0%, 100%, .5);
color: #000;
padding: 0 1px;
}
#options label { #options label {
text-decoration: underline; text-decoration: underline;
} }
@ -3858,13 +3901,10 @@ body.unscroll {
} }
#content textarea { #content textarea {
font-family: monospace; font-family: monospace;
min-height: 100px; min-height: 350px;
resize: vertical; resize: vertical;
width: 100%; width: 100%;
} }
#sauces {
height: 300px;
}
#updater { #updater {
text-align: right; text-align: right;