Fix style settings, incorrect main settings attribute

This commit is contained in:
Zixaphir 2015-01-10 02:58:42 -07:00
parent 54c5b59946
commit eda8a65132
5 changed files with 87 additions and 71 deletions

View File

@ -4369,29 +4369,27 @@
} }
$.asap((function() { $.asap((function() {
return $.id('boardNavMobile') || d.readyState !== 'loading'; return $.id('boardNavMobile') || d.readyState !== 'loading';
}), Header.setBoardList); }), _this.setBoardList);
$.prepend(d.body, _this.bar); $.prepend(d.body, _this.bar);
$.add(d.body, Header.hover); $.add(d.body, _this.hover);
return _this.setBarPosition(Conf['Bottom Header']); return _this.setBarPosition(Conf['Bottom Header']);
}; };
})(this)); })(this));
return $.ready((function(_this) { return $.ready(function() {
return function() { var a, footer, _i, _len, _ref, _results;
var a, footer, _i, _len, _ref, _results; if (a = $("a[href*='/" + g.BOARD + "/']", footer = $.id('boardNavDesktopFoot'))) {
if (a = $("a[href*='/" + g.BOARD + "/']", footer = $.id('boardNavDesktopFoot'))) { a.className = 'current';
a.className = 'current'; }
if (Conf['JSON Navigation']) {
_ref = $$('a', footer);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
a = _ref[_i];
_results.push($.on(a, 'click', Navigate.navigate));
} }
if (Conf['JSON Navigation']) { return _results;
_ref = $$('a', footer); }
_results = []; });
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
a = _ref[_i];
_results.push($.on(a, 'click', Navigate.navigate));
}
return _results;
}
};
})(this));
}, },
bar: $.el('div', { bar: $.el('div', {
id: 'header-bar' id: 'header-bar'
@ -4454,7 +4452,6 @@
fullBoardList.normalize(); fullBoardList.normalize();
btn = $('.hide-board-list-button', fullBoardList); btn = $('.hide-board-list-button', fullBoardList);
$.on(btn, 'click', Header.toggleBoardList); $.on(btn, 'click', Header.toggleBoardList);
$.rm($('#navtopright', fullBoardList));
shortcuts = $.el('span', { shortcuts = $.el('span', {
id: 'shortcuts' id: 'shortcuts'
}); });
@ -5556,7 +5553,14 @@
pageNum = null; pageNum = null;
} }
onload = function(e) { onload = function(e) {
return Index.load(e, pageNum); var err;
try {
return Index.load(e, pageNum);
} catch (_error) {
err = _error;
console.error(err.message);
return console.error(err.stack);
}
}; };
Index.req = $.ajax("//a.4cdn.org/" + g.BOARD.ID + "/catalog.json", { Index.req = $.ajax("//a.4cdn.org/" + g.BOARD.ID + "/catalog.json", {
onabort: onload, onabort: onload,
@ -18845,7 +18849,7 @@
div = $.el('div'); div = $.el('div');
$.add(div, [ $.add(div, [
UI.checkbox(key, key, false), $.el('span', { UI.checkbox(key, key, false), $.el('span', {
"class": 'description', className: 'description',
textContent: ": " + description textContent: ": " + description
}) })
]); ]);
@ -19279,7 +19283,7 @@
return $.cb.value.call(this); return $.cb.value.call(this);
}, },
style: function(section) { style: function(section) {
var arr, description, div, fs, html, input, inputs, items, key, name, nodes, obj, span, type, value, _i, _len, _ref; var arr, box, description, div, fs, html, input, inputs, items, key, name, nodes, obj, span, type, value, _i, _len, _ref;
nodes = $.frag(); nodes = $.frag();
items = {}; items = {};
inputs = {}; inputs = {};
@ -19317,7 +19321,8 @@
textContent: description textContent: description
}); });
span.style.display = 'none'; span.style.display = 'none';
$.add(div, [UI.checkbox(key, key), span]); $.add(div, [box = UI.checkbox(key, key), span]);
box.className = 'option';
input = $('input', div); input = $('input', div);
} }
items[key] = Conf[key]; items[key] = Conf[key];

View File

@ -4398,29 +4398,27 @@
} }
$.asap((function() { $.asap((function() {
return $.id('boardNavMobile') || d.readyState !== 'loading'; return $.id('boardNavMobile') || d.readyState !== 'loading';
}), Header.setBoardList); }), _this.setBoardList);
$.prepend(d.body, _this.bar); $.prepend(d.body, _this.bar);
$.add(d.body, Header.hover); $.add(d.body, _this.hover);
return _this.setBarPosition(Conf['Bottom Header']); return _this.setBarPosition(Conf['Bottom Header']);
}; };
})(this)); })(this));
return $.ready((function(_this) { return $.ready(function() {
return function() { var a, footer, _i, _len, _ref, _results;
var a, footer, _i, _len, _ref, _results; if (a = $("a[href*='/" + g.BOARD + "/']", footer = $.id('boardNavDesktopFoot'))) {
if (a = $("a[href*='/" + g.BOARD + "/']", footer = $.id('boardNavDesktopFoot'))) { a.className = 'current';
a.className = 'current'; }
if (Conf['JSON Navigation']) {
_ref = $$('a', footer);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
a = _ref[_i];
_results.push($.on(a, 'click', Navigate.navigate));
} }
if (Conf['JSON Navigation']) { return _results;
_ref = $$('a', footer); }
_results = []; });
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
a = _ref[_i];
_results.push($.on(a, 'click', Navigate.navigate));
}
return _results;
}
};
})(this));
}, },
bar: $.el('div', { bar: $.el('div', {
id: 'header-bar' id: 'header-bar'
@ -4483,7 +4481,6 @@
fullBoardList.normalize(); fullBoardList.normalize();
btn = $('.hide-board-list-button', fullBoardList); btn = $('.hide-board-list-button', fullBoardList);
$.on(btn, 'click', Header.toggleBoardList); $.on(btn, 'click', Header.toggleBoardList);
$.rm($('#navtopright', fullBoardList));
shortcuts = $.el('span', { shortcuts = $.el('span', {
id: 'shortcuts' id: 'shortcuts'
}); });
@ -5585,7 +5582,14 @@
pageNum = null; pageNum = null;
} }
onload = function(e) { onload = function(e) {
return Index.load(e, pageNum); var err;
try {
return Index.load(e, pageNum);
} catch (_error) {
err = _error;
console.error(err.message);
return console.error(err.stack);
}
}; };
Index.req = $.ajax("//a.4cdn.org/" + g.BOARD.ID + "/catalog.json", { Index.req = $.ajax("//a.4cdn.org/" + g.BOARD.ID + "/catalog.json", {
onabort: onload, onabort: onload,
@ -18882,7 +18886,7 @@
div = $.el('div'); div = $.el('div');
$.add(div, [ $.add(div, [
UI.checkbox(key, key, false), $.el('span', { UI.checkbox(key, key, false), $.el('span', {
"class": 'description', className: 'description',
textContent: ": " + description textContent: ": " + description
}) })
]); ]);
@ -19314,7 +19318,7 @@
return $.cb.value.call(this); return $.cb.value.call(this);
}, },
style: function(section) { style: function(section) {
var arr, description, div, fs, html, input, inputs, items, key, name, nodes, obj, span, type, value, _i, _len, _ref; var arr, box, description, div, fs, html, input, inputs, items, key, name, nodes, obj, span, type, value, _i, _len, _ref;
nodes = $.frag(); nodes = $.frag();
items = {}; items = {};
inputs = {}; inputs = {};
@ -19352,7 +19356,8 @@
textContent: description textContent: description
}); });
span.style.display = 'none'; span.style.display = 'none';
$.add(div, [UI.checkbox(key, key), span]); $.add(div, [box = UI.checkbox(key, key), span]);
box.className = 'option';
input = $('input', div); input = $('input', div);
} }
items[key] = Conf[key]; items[key] = Conf[key];

View File

@ -71,12 +71,12 @@ Header =
return unless Main.isThisPageLegit() return unless Main.isThisPageLegit()
# Wait for #boardNavMobile instead of #boardNavDesktop, # Wait for #boardNavMobile instead of #boardNavDesktop,
# it might be incomplete otherwise. # it might be incomplete otherwise.
$.asap (-> $.id('boardNavMobile') or d.readyState isnt 'loading'), Header.setBoardList $.asap (-> $.id('boardNavMobile') or d.readyState isnt 'loading'), @setBoardList
$.prepend d.body, @bar $.prepend d.body, @bar
$.add d.body, Header.hover $.add d.body, @hover
@setBarPosition Conf['Bottom Header'] @setBarPosition Conf['Bottom Header']
$.ready => $.ready ->
if a = $ "a[href*='/#{g.BOARD}/']", footer = $.id 'boardNavDesktopFoot' if a = $ "a[href*='/#{g.BOARD}/']", footer = $.id 'boardNavDesktopFoot'
a.className = 'current' a.className = 'current'
if Conf['JSON Navigation'] if Conf['JSON Navigation']
@ -137,8 +137,6 @@ Header =
btn = $ '.hide-board-list-button', fullBoardList btn = $ '.hide-board-list-button', fullBoardList
$.on btn, 'click', Header.toggleBoardList $.on btn, 'click', Header.toggleBoardList
$.rm $ '#navtopright', fullBoardList
shortcuts = $.el 'span', shortcuts = $.el 'span',
id: 'shortcuts' id: 'shortcuts'

View File

@ -29,6 +29,7 @@ Index =
{ el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="infinite"> Infinite scrolling' } { el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="infinite"> Infinite scrolling' }
{ el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="all pages"> All threads' } { el: $.el 'label', innerHTML: '<input type=radio name="Index Mode" value="all pages"> All threads' }
] ]
for label in modeEntry.subEntries for label in modeEntry.subEntries
input = label.el.firstChild input = label.el.firstChild
input.checked = Conf['Index Mode'] is input.value input.checked = Conf['Index Mode'] is input.value
@ -338,14 +339,14 @@ Index =
size: (e) -> size: (e) ->
if Conf['Index Mode'] isnt 'catalog' if Conf['Index Mode'] isnt 'catalog'
$.rmClass Index.root, 'catalog-small' $.rmClass Index.root, 'catalog-small'
$.rmClass Index.root, 'catalog-large' $.rmClass Index.root, 'catalog-large'
else if Conf['Index Size'] is 'small' else if Conf['Index Size'] is 'small'
$.addClass Index.root, 'catalog-small' $.addClass Index.root, 'catalog-small'
$.rmClass Index.root, 'catalog-large' $.rmClass Index.root, 'catalog-large'
else else
$.addClass Index.root, 'catalog-large' $.addClass Index.root, 'catalog-large'
$.rmClass Index.root, 'catalog-small' $.rmClass Index.root, 'catalog-small'
Index.buildIndex() if e Index.buildIndex() if e
threadsNum: -> threadsNum: ->
@ -545,7 +546,12 @@ Index =
), 3 * $.SECOND - (Date.now() - now) ), 3 * $.SECOND - (Date.now() - now)
pageNum = null if typeof pageNum isnt 'number' # event pageNum = null if typeof pageNum isnt 'number' # event
onload = (e) -> Index.load e, pageNum onload = (e) ->
try
Index.load e, pageNum
catch err
console.error err.message
console.error err.stack
Index.req = $.ajax "//a.4cdn.org/#{g.BOARD.ID}/catalog.json", Index.req = $.ajax "//a.4cdn.org/#{g.BOARD.ID}/catalog.json",
onabort: onload onabort: onload
onloadend: onload onloadend: onload

View File

@ -13,7 +13,7 @@ Settings =
order: 1 order: 1
add = @addSection add = @addSection
add 'Style', @style add 'Style', @style
add 'Themes', @themes add 'Themes', @themes
add 'Mascots', @mascots add 'Mascots', @mascots
@ -122,7 +122,7 @@ Settings =
div = $.el 'div' div = $.el 'div'
$.add div, [ $.add div, [
UI.checkbox key, key, false UI.checkbox key, key, false
$.el 'span', class: 'description', textContent: ": #{description}" $.el 'span', className: 'description', textContent: ": #{description}"
] ]
input = $ 'input', div input = $ 'input', div
$.on $('label', div), 'mouseover', Settings.mouseover $.on $('label', div), 'mouseover', Settings.mouseover
@ -183,7 +183,7 @@ Settings =
return unless file = @files[0] return unless file = @files[0]
unless confirm 'Your current settings will be entirely overwritten, are you sure?' unless confirm 'Your current settings will be entirely overwritten, are you sure?'
new Notice 'info', "Import aborted.", 1 new Notice 'info', "Import aborted.", 1
return return
reader = new FileReader() reader = new FileReader()
reader.onload = (e) -> reader.onload = (e) ->
@ -471,14 +471,16 @@ Settings =
span = $.el 'span', span = $.el 'span',
class: 'description' class: 'description'
textContent: description textContent: description
span.style.display = 'none' span.style.display = 'none'
$.add div, [ $.add div, [
UI.checkbox key, key box = UI.checkbox key, key
span span
] ]
box.className = 'option'
input = $ 'input', div input = $ 'input', div
items[key] = Conf[key] items[key] = Conf[key]
@ -534,7 +536,7 @@ Settings =
div = $.el 'div', div = $.el 'div',
className: "theme #{if name is Conf[g.THEMESTRING] then 'selectedtheme' else ''}" className: "theme #{if name is Conf[g.THEMESTRING] then 'selectedtheme' else ''}"
id: name id: name
$.extend div, <%= importHTML('Settings/Theme') %> $.extend div, <%= importHTML('Settings/Theme') %>
div.style.backgroundColor = theme['Background Color'] div.style.backgroundColor = theme['Background Color']
@ -554,7 +556,7 @@ Settings =
div = $.el 'div', div = $.el 'div',
id: 'addthemes' id: 'addthemes'
$.extend div, <%= importHTML('Settings/Batch-Theme') %> $.extend div, <%= importHTML('Settings/Batch-Theme') %>
$.on $("#newtheme", div), 'click', -> $.on $("#newtheme", div), 'click', ->
@ -585,7 +587,7 @@ Settings =
div = $.el 'div', div = $.el 'div',
id: name id: name
className: theme className: theme
$.extend div, <%= importHTML('Settings/Deleted-Theme') %> $.extend div, <%= importHTML('Settings/Deleted-Theme') %>
$.on div, 'click', cb.restore $.on div, 'click', cb.restore
@ -681,7 +683,7 @@ Settings =
mascotEl = $.el 'div', mascotEl = $.el 'div',
id: name id: name
className: if name in Conf[g.MASCOTSTRING] then 'mascot enabled' else 'mascot' className: if name in Conf[g.MASCOTSTRING] then 'mascot enabled' else 'mascot'
$.extend div, <%= importHTML('Settings/Mascot') %> $.extend div, <%= importHTML('Settings/Mascot') %>
$.on mascotEl, 'click', cb.select $.on mascotEl, 'click', cb.select
@ -691,7 +693,7 @@ Settings =
batchmascots = $.el 'div', batchmascots = $.el 'div',
id: "mascots_batch" id: "mascots_batch"
$.extend batchmascots, <%= importHTML('Settings/Batch-Mascot') %> $.extend batchmascots, <%= importHTML('Settings/Batch-Mascot') %>
$.on $('#clear', batchmascots), 'click', -> $.on $('#clear', batchmascots), 'click', ->
@ -732,9 +734,9 @@ Settings =
for name in keys when name in Conf["Deleted Mascots"] for name in keys when name in Conf["Deleted Mascots"]
mascot = Mascots[name] mascot = Mascots[name]
mascotEl = $.el 'div', mascotEl = $.el 'div',
className: 'mascot' className: 'mascot'
id: name id: name
$.extend mascotEl, <%= importHTML('Settings/Mascot') %> $.extend mascotEl, <%= importHTML('Settings/Mascot') %>
$.on mascotEl, 'click', cb.restore $.on mascotEl, 'click', cb.restore