Remove loops to select options. Capitalize Fit Width, etc.

This commit is contained in:
Nicolas Stepien 2012-01-08 06:10:48 +01:00
parent fa9ac02b62
commit 9493421a9e
2 changed files with 24 additions and 45 deletions

View File

@ -1238,7 +1238,7 @@
} }
}, },
dialog: function() { dialog: function() {
var arr, back, checked, description, dialog, favicon, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, option, overlay, ta, time, ul, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref, _ref2, _ref3, _ref4, _ref5; var arr, back, checked, description, dialog, favicon, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, overlay, ta, time, ul, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4;
dialog = ui.dialog('options', '', '\ dialog = ui.dialog('options', '', '\
<div id=optionsbar>\ <div id=optionsbar>\
<div id=credits>\ <div id=credits>\
@ -1297,11 +1297,11 @@
<div class=error><code>Unread Count</code> is disabled.</div>\ <div class=error><code>Unread Count</code> is disabled.</div>\
Unread favicons<br>\ Unread favicons<br>\
<select name=favicon>\ <select name=favicon>\
<option>ferongr</option>\ <option value=ferongr>ferongr</option>\
<option>xat-</option>\ <option value=xat->xat-</option>\
<option>Mayhem</option>\ <option value=Mayhem>Mayhem</option>\
<option>Original</option>\ <option value=Original>Original</option>\
<option>None</option>\ <option value=None>None</option>\
</select>\ </select>\
<span></span>\ <span></span>\
</div>\ </div>\
@ -1373,27 +1373,20 @@
$.on(time, 'keyup', $.cb.value); $.on(time, 'keyup', $.cb.value);
$.on(time, 'keyup', options.time); $.on(time, 'keyup', options.time);
favicon = $('select', dialog); favicon = $('select', dialog);
_ref3 = favicon.options; favicon.value = conf['favicon'];
for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
option = _ref3[_j];
if (option.textContent === conf['favicon']) {
option.selected = true;
break;
}
}
$.on(favicon, 'change', $.cb.value); $.on(favicon, 'change', $.cb.value);
$.on(favicon, 'change', options.favicon); $.on(favicon, 'change', options.favicon);
_ref4 = $$('#keybinds_tab + div input', dialog); _ref3 = $$('#keybinds_tab + div input', dialog);
for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) { for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
input = _ref4[_k]; input = _ref3[_j];
input.type = 'text'; input.type = 'text';
input.value = conf[input.name]; input.value = conf[input.name];
$.on(input, 'keydown', options.keybind); $.on(input, 'keydown', options.keybind);
} }
indicators = {}; indicators = {};
_ref5 = $$('.error', dialog); _ref4 = $$('.error', dialog);
for (_l = 0, _len4 = _ref5.length; _l < _len4; _l++) { for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) {
indicator = _ref5[_l]; indicator = _ref4[_k];
key = indicator.firstChild.textContent; key = indicator.firstChild.textContent;
indicator.hidden = conf[key]; indicator.hidden = conf[key];
indicators[key] = indicator; indicators[key] = indicator;
@ -3045,21 +3038,14 @@
if (!thumb.hidden) return imgExpand.expand(thumb); if (!thumb.hidden) return imgExpand.expand(thumb);
}, },
dialog: function() { dialog: function() {
var controls, form, imageType, option, select, _i, _len, _ref; var controls, form, imageType, select;
controls = $.el('div', { controls = $.el('div', {
id: 'imgControls', id: 'imgControls',
innerHTML: "<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit height</option><option>fit screen</option></select> <label>Expand Images<input type=checkbox id=imageExpand></label>" innerHTML: "<select id=imageType name=imageType><option value=full>Full</option><option value='fit width'>Fit Width</option><option value='fit height'>Fit Height</option value='fit screen'><option value='fit screen'>Fit Screen</option></select><label>Expand Images<input type=checkbox id=imageExpand></label>"
}); });
imageType = $.get('imageType', 'full'); imageType = $.get('imageType', 'full');
select = $('select', controls); select = $('select', controls);
_ref = select.options; select.value = imageType;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
option = _ref[_i];
if (option.textContent === imageType) {
option.selected = true;
break;
}
}
imgExpand.cb.typeChange.call(select); imgExpand.cb.typeChange.call(select);
$.on(select, 'change', $.cb.value); $.on(select, 'change', $.cb.value);
$.on(select, 'change', imgExpand.cb.typeChange); $.on(select, 'change', imgExpand.cb.typeChange);

View File

@ -959,11 +959,11 @@ options =
<div class=error><code>Unread Count</code> is disabled.</div> <div class=error><code>Unread Count</code> is disabled.</div>
Unread favicons<br> Unread favicons<br>
<select name=favicon> <select name=favicon>
<option>ferongr</option> <option value=ferongr>ferongr</option>
<option>xat-</option> <option value=xat->xat-</option>
<option>Mayhem</option> <option value=Mayhem>Mayhem</option>
<option>Original</option> <option value=Original>Original</option>
<option>None</option> <option value=None>None</option>
</select> </select>
<span></span> <span></span>
</div> </div>
@ -1031,10 +1031,7 @@ options =
$.on time, 'keyup', $.cb.value $.on time, 'keyup', $.cb.value
$.on time, 'keyup', options.time $.on time, 'keyup', options.time
favicon = $ 'select', dialog favicon = $ 'select', dialog
for option in favicon.options favicon.value = conf['favicon']
if option.textContent is conf['favicon']
option.selected = true
break
$.on favicon, 'change', $.cb.value $.on favicon, 'change', $.cb.value
$.on favicon, 'change', options.favicon $.on favicon, 'change', options.favicon
@ -2360,14 +2357,10 @@ imgExpand =
controls = $.el 'div', controls = $.el 'div',
id: 'imgControls' id: 'imgControls'
innerHTML: innerHTML:
"<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit height</option><option>fit screen</option></select> "<select id=imageType name=imageType><option value=full>Full</option><option value='fit width'>Fit Width</option><option value='fit height'>Fit Height</option value='fit screen'><option value='fit screen'>Fit Screen</option></select><label>Expand Images<input type=checkbox id=imageExpand></label>"
<label>Expand Images<input type=checkbox id=imageExpand></label>"
imageType = $.get 'imageType', 'full' imageType = $.get 'imageType', 'full'
select = $ 'select', controls select = $ 'select', controls
for option in select.options select.value = imageType
if option.textContent is imageType
option.selected = true
break
imgExpand.cb.typeChange.call select imgExpand.cb.typeChange.call select
$.on select, 'change', $.cb.value $.on select, 'change', $.cb.value
$.on select, 'change', imgExpand.cb.typeChange $.on select, 'change', imgExpand.cb.typeChange