Load conf[]s in Main.init.

This commit is contained in:
Nicolas Stepien 2012-03-08 01:14:14 +01:00
parent 2cca11230a
commit 6bc5f5d9be
2 changed files with 13 additions and 13 deletions

View File

@ -73,7 +73,7 @@
*/ */
(function() { (function() {
var $, $$, Anonymize, AutoGif, DAY, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, HOUR, ImageExpand, ImageHover, Keybinds, MINUTE, Main, NAMESPACE, Nav, Options, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Redirect, ReplyHiding, ReportButton, RevealSpoilers, SECOND, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Threading, Time, TitlePost, Unread, Updater, VERSION, Watcher, conf, config, d, engine, flatten, g, key, log, qr, ui, val, _base; var $, $$, Anonymize, AutoGif, DAY, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, HOUR, ImageExpand, ImageHover, Keybinds, MINUTE, Main, NAMESPACE, Nav, Options, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Redirect, ReplyHiding, ReportButton, RevealSpoilers, SECOND, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Threading, Time, TitlePost, Unread, Updater, VERSION, Watcher, conf, config, d, engine, flatten, g, log, qr, ui, _base;
config = { config = {
main: { main: {
@ -534,11 +534,6 @@
} }
}); });
for (key in conf) {
val = conf[key];
conf[key] = $.get(key, val);
}
$$ = function(selector, root) { $$ = function(selector, root) {
if (root == null) root = d.body; if (root == null) root = d.body;
return Array.prototype.slice.call(root.querySelectorAll(selector)); return Array.prototype.slice.call(root.querySelectorAll(selector));
@ -972,7 +967,7 @@
return $.on(d, 'keydown', Keybinds.keydown); return $.on(d, 'keydown', Keybinds.keydown);
}, },
keydown: function(e) { keydown: function(e) {
var o, range, selEnd, selStart, ta, thread, value, _ref, _ref2; var key, o, range, selEnd, selStart, ta, thread, value, _ref, _ref2;
if (!(key = Keybinds.keyCode(e)) || /TEXTAREA|INPUT/.test(e.target.nodeName) && !(e.altKey || e.ctrlKey || e.keyCode === 27)) { if (!(key = Keybinds.keyCode(e)) || /TEXTAREA|INPUT/.test(e.target.nodeName) && !(e.altKey || e.ctrlKey || e.keyCode === 27)) {
return; return;
} }
@ -1064,7 +1059,7 @@
return e.preventDefault(); return e.preventDefault();
}, },
keyCode: function(e) { keyCode: function(e) {
var c, kc; var c, kc, key;
key = (function() { key = (function() {
switch (kc = e.keyCode) { switch (kc = e.keyCode) {
case 8: case 8:
@ -2372,6 +2367,7 @@
return g.hiddenReplies = {}; return g.hiddenReplies = {};
}, },
keybind: function(e) { keybind: function(e) {
var key;
if (e.keyCode === 9) return; if (e.keyCode === 9) return;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@ -3837,7 +3833,7 @@
Main = { Main = {
init: function() { init: function() {
var cutoff, hiddenThreads, id, now, path, pathname, temp, timestamp, _ref; var cutoff, hiddenThreads, id, key, now, path, pathname, temp, timestamp, val, _ref;
path = location.pathname; path = location.pathname;
pathname = path.slice(1).split('/'); pathname = path.slice(1).split('/');
g.BOARD = pathname[0], temp = pathname[1]; g.BOARD = pathname[0], temp = pathname[1];
@ -3847,6 +3843,10 @@
} else { } else {
g.PAGENUM = parseInt(temp) || 0; g.PAGENUM = parseInt(temp) || 0;
} }
for (key in conf) {
val = conf[key];
conf[key] = $.get(key, val);
}
$.on(window, 'message', Main.message); $.on(window, 'message', Main.message);
switch (location.hostname) { switch (location.hostname) {
case 'sys.4chan.org': case 'sys.4chan.org':

View File

@ -449,10 +449,6 @@ $.extend $,
name = NAMESPACE + name name = NAMESPACE + name
localStorage[name] = JSON.stringify value localStorage[name] = JSON.stringify value
#load values from localStorage
for key, val of conf
conf[key] = $.get key, val
$$ = (selector, root=d.body) -> $$ = (selector, root=d.body) ->
Array::slice.call root.querySelectorAll selector Array::slice.call root.querySelectorAll selector
@ -3143,6 +3139,10 @@ Main =
else else
g.PAGENUM = parseInt(temp) or 0 g.PAGENUM = parseInt(temp) or 0
#load values from localStorage
for key, val of conf
conf[key] = $.get key, val
$.on window, 'message', Main.message $.on window, 'message', Main.message
switch location.hostname switch location.hostname