mv config flattening into Main.init
This commit is contained in:
parent
6d7bd16653
commit
3fa7368b6b
@ -73,7 +73,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, Anonymize, AutoGif, Conf, Config, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, ImageExpand, ImageHover, Keybinds, Main, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportButton, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Threading, Time, TitlePost, UI, Unread, Updater, Watcher, flatten, _base;
|
var $, $$, Anonymize, AutoGif, Config, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, ImageExpand, ImageHover, Keybinds, Main, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportButton, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Threading, Time, TitlePost, UI, Unread, Updater, Watcher, _base;
|
||||||
|
|
||||||
Config = {
|
Config = {
|
||||||
main: {
|
main: {
|
||||||
@ -192,22 +192,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Conf = {};
|
|
||||||
|
|
||||||
(flatten = function(parent, obj) {
|
|
||||||
var key, val;
|
|
||||||
if (obj instanceof Array) {
|
|
||||||
Conf[parent] = obj[0];
|
|
||||||
} else if (typeof obj === 'object') {
|
|
||||||
for (key in obj) {
|
|
||||||
val = obj[key];
|
|
||||||
flatten(key, val);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Conf[parent] = obj;
|
|
||||||
}
|
|
||||||
})(null, Config);
|
|
||||||
|
|
||||||
UI = {
|
UI = {
|
||||||
dialog: function(id, position, html) {
|
dialog: function(id, position, html) {
|
||||||
var el, saved;
|
var el, saved;
|
||||||
@ -3790,7 +3774,21 @@
|
|||||||
|
|
||||||
Main = {
|
Main = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var cutoff, hiddenThreads, id, key, now, path, pathname, temp, timestamp, val, _ref;
|
var Conf, cutoff, flatten, hiddenThreads, id, key, now, path, pathname, temp, timestamp, val, _ref;
|
||||||
|
Conf = {};
|
||||||
|
(flatten = function(parent, obj) {
|
||||||
|
var key, val;
|
||||||
|
if (obj instanceof Array) {
|
||||||
|
Conf[parent] = obj[0];
|
||||||
|
} else if (typeof obj === 'object') {
|
||||||
|
for (key in obj) {
|
||||||
|
val = obj[key];
|
||||||
|
flatten(key, val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Conf[parent] = obj;
|
||||||
|
}
|
||||||
|
})(null, Config);
|
||||||
path = location.pathname;
|
path = location.pathname;
|
||||||
pathname = path.slice(1).split('/');
|
pathname = path.slice(1).split('/');
|
||||||
Main.BOARD = pathname[0], temp = pathname[1];
|
Main.BOARD = pathname[0], temp = pathname[1];
|
||||||
|
|||||||
@ -154,19 +154,6 @@ Config =
|
|||||||
'Auto Update': [true, 'Automatically fetch new posts']
|
'Auto Update': [true, 'Automatically fetch new posts']
|
||||||
'Interval': 30
|
'Interval': 30
|
||||||
|
|
||||||
# flatten the config
|
|
||||||
Conf = {}
|
|
||||||
(flatten = (parent, obj) ->
|
|
||||||
if obj instanceof Array
|
|
||||||
Conf[parent] = obj[0]
|
|
||||||
else if typeof obj is 'object'
|
|
||||||
for key, val of obj
|
|
||||||
flatten key, val
|
|
||||||
else # string or number
|
|
||||||
Conf[parent] = obj
|
|
||||||
return
|
|
||||||
) null, Config
|
|
||||||
|
|
||||||
UI =
|
UI =
|
||||||
dialog: (id, position, html) ->
|
dialog: (id, position, html) ->
|
||||||
el = $.d.createElement 'div'
|
el = $.d.createElement 'div'
|
||||||
@ -3153,6 +3140,19 @@ ImageExpand =
|
|||||||
|
|
||||||
Main =
|
Main =
|
||||||
init: ->
|
init: ->
|
||||||
|
# flatten the config
|
||||||
|
Conf = {}
|
||||||
|
(flatten = (parent, obj) ->
|
||||||
|
if obj instanceof Array
|
||||||
|
Conf[parent] = obj[0]
|
||||||
|
else if typeof obj is 'object'
|
||||||
|
for key, val of obj
|
||||||
|
flatten key, val
|
||||||
|
else # string or number
|
||||||
|
Conf[parent] = obj
|
||||||
|
return
|
||||||
|
) null, Config
|
||||||
|
|
||||||
path = location.pathname
|
path = location.pathname
|
||||||
pathname = path[1..].split '/'
|
pathname = path[1..].split '/'
|
||||||
[Main.BOARD, temp] = pathname
|
[Main.BOARD, temp] = pathname
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user