diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 2ea12029b..ec5b824a0 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -4369,29 +4369,27 @@ } $.asap((function() { return $.id('boardNavMobile') || d.readyState !== 'loading'; - }), Header.setBoardList); + }), _this.setBoardList); $.prepend(d.body, _this.bar); - $.add(d.body, Header.hover); + $.add(d.body, _this.hover); return _this.setBarPosition(Conf['Bottom Header']); }; })(this)); - return $.ready((function(_this) { - return function() { - var a, footer, _i, _len, _ref, _results; - if (a = $("a[href*='/" + g.BOARD + "/']", footer = $.id('boardNavDesktopFoot'))) { - a.className = 'current'; + return $.ready(function() { + var a, footer, _i, _len, _ref, _results; + if (a = $("a[href*='/" + g.BOARD + "/']", footer = $.id('boardNavDesktopFoot'))) { + 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']) { - _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)); + return _results; + } + }); }, bar: $.el('div', { id: 'header-bar' @@ -4454,7 +4452,6 @@ fullBoardList.normalize(); btn = $('.hide-board-list-button', fullBoardList); $.on(btn, 'click', Header.toggleBoardList); - $.rm($('#navtopright', fullBoardList)); shortcuts = $.el('span', { id: 'shortcuts' }); @@ -5556,7 +5553,14 @@ pageNum = null; } 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", { onabort: onload, @@ -18845,7 +18849,7 @@ div = $.el('div'); $.add(div, [ UI.checkbox(key, key, false), $.el('span', { - "class": 'description', + className: 'description', textContent: ": " + description }) ]); @@ -19279,7 +19283,7 @@ return $.cb.value.call(this); }, 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(); items = {}; inputs = {}; @@ -19317,7 +19321,8 @@ textContent: description }); 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); } items[key] = Conf[key]; diff --git a/builds/crx/script.js b/builds/crx/script.js index b2addcf5f..ea2412a0c 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -4398,29 +4398,27 @@ } $.asap((function() { return $.id('boardNavMobile') || d.readyState !== 'loading'; - }), Header.setBoardList); + }), _this.setBoardList); $.prepend(d.body, _this.bar); - $.add(d.body, Header.hover); + $.add(d.body, _this.hover); return _this.setBarPosition(Conf['Bottom Header']); }; })(this)); - return $.ready((function(_this) { - return function() { - var a, footer, _i, _len, _ref, _results; - if (a = $("a[href*='/" + g.BOARD + "/']", footer = $.id('boardNavDesktopFoot'))) { - a.className = 'current'; + return $.ready(function() { + var a, footer, _i, _len, _ref, _results; + if (a = $("a[href*='/" + g.BOARD + "/']", footer = $.id('boardNavDesktopFoot'))) { + 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']) { - _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)); + return _results; + } + }); }, bar: $.el('div', { id: 'header-bar' @@ -4483,7 +4481,6 @@ fullBoardList.normalize(); btn = $('.hide-board-list-button', fullBoardList); $.on(btn, 'click', Header.toggleBoardList); - $.rm($('#navtopright', fullBoardList)); shortcuts = $.el('span', { id: 'shortcuts' }); @@ -5585,7 +5582,14 @@ pageNum = null; } 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", { onabort: onload, @@ -18882,7 +18886,7 @@ div = $.el('div'); $.add(div, [ UI.checkbox(key, key, false), $.el('span', { - "class": 'description', + className: 'description', textContent: ": " + description }) ]); @@ -19314,7 +19318,7 @@ return $.cb.value.call(this); }, 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(); items = {}; inputs = {}; @@ -19352,7 +19356,8 @@ textContent: description }); 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); } items[key] = Conf[key]; diff --git a/src/General/Header.coffee b/src/General/Header.coffee index 07a01d55f..8ec869f0c 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -71,12 +71,12 @@ Header = return unless Main.isThisPageLegit() # Wait for #boardNavMobile instead of #boardNavDesktop, # 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 - $.add d.body, Header.hover + $.add d.body, @hover @setBarPosition Conf['Bottom Header'] - $.ready => + $.ready -> if a = $ "a[href*='/#{g.BOARD}/']", footer = $.id 'boardNavDesktopFoot' a.className = 'current' if Conf['JSON Navigation'] @@ -137,8 +137,6 @@ Header = btn = $ '.hide-board-list-button', fullBoardList $.on btn, 'click', Header.toggleBoardList - $.rm $ '#navtopright', fullBoardList - shortcuts = $.el 'span', id: 'shortcuts' diff --git a/src/General/Index.coffee b/src/General/Index.coffee index b0a1b2b7d..751564592 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -29,6 +29,7 @@ Index = { el: $.el 'label', innerHTML: ' Infinite scrolling' } { el: $.el 'label', innerHTML: ' All threads' } ] + for label in modeEntry.subEntries input = label.el.firstChild input.checked = Conf['Index Mode'] is input.value @@ -338,14 +339,14 @@ Index = size: (e) -> if Conf['Index Mode'] isnt 'catalog' - $.rmClass Index.root, 'catalog-small' - $.rmClass Index.root, 'catalog-large' + $.rmClass Index.root, 'catalog-small' + $.rmClass Index.root, 'catalog-large' else if Conf['Index Size'] is 'small' - $.addClass Index.root, 'catalog-small' - $.rmClass Index.root, 'catalog-large' + $.addClass Index.root, 'catalog-small' + $.rmClass Index.root, 'catalog-large' else - $.addClass Index.root, 'catalog-large' - $.rmClass Index.root, 'catalog-small' + $.addClass Index.root, 'catalog-large' + $.rmClass Index.root, 'catalog-small' Index.buildIndex() if e threadsNum: -> @@ -545,7 +546,12 @@ Index = ), 3 * $.SECOND - (Date.now() - now) 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", onabort: onload onloadend: onload diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 5c1822c1e..482f9e070 100755 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -13,7 +13,7 @@ Settings = order: 1 add = @addSection - + add 'Style', @style add 'Themes', @themes add 'Mascots', @mascots @@ -122,7 +122,7 @@ Settings = div = $.el 'div' $.add div, [ UI.checkbox key, key, false - $.el 'span', class: 'description', textContent: ": #{description}" + $.el 'span', className: 'description', textContent: ": #{description}" ] input = $ 'input', div $.on $('label', div), 'mouseover', Settings.mouseover @@ -183,7 +183,7 @@ Settings = return unless file = @files[0] unless confirm 'Your current settings will be entirely overwritten, are you sure?' new Notice 'info', "Import aborted.", 1 - return + return reader = new FileReader() reader.onload = (e) -> @@ -471,14 +471,16 @@ Settings = span = $.el 'span', class: 'description' textContent: description - + span.style.display = 'none' $.add div, [ - UI.checkbox key, key + box = UI.checkbox key, key span ] - + + box.className = 'option' + input = $ 'input', div items[key] = Conf[key] @@ -534,7 +536,7 @@ Settings = div = $.el 'div', className: "theme #{if name is Conf[g.THEMESTRING] then 'selectedtheme' else ''}" id: name - + $.extend div, <%= importHTML('Settings/Theme') %> div.style.backgroundColor = theme['Background Color'] @@ -554,7 +556,7 @@ Settings = div = $.el 'div', id: 'addthemes' - + $.extend div, <%= importHTML('Settings/Batch-Theme') %> $.on $("#newtheme", div), 'click', -> @@ -585,7 +587,7 @@ Settings = div = $.el 'div', id: name className: theme - + $.extend div, <%= importHTML('Settings/Deleted-Theme') %> $.on div, 'click', cb.restore @@ -681,7 +683,7 @@ Settings = mascotEl = $.el 'div', id: name className: if name in Conf[g.MASCOTSTRING] then 'mascot enabled' else 'mascot' - + $.extend div, <%= importHTML('Settings/Mascot') %> $.on mascotEl, 'click', cb.select @@ -691,7 +693,7 @@ Settings = batchmascots = $.el 'div', id: "mascots_batch" - + $.extend batchmascots, <%= importHTML('Settings/Batch-Mascot') %> $.on $('#clear', batchmascots), 'click', -> @@ -732,9 +734,9 @@ Settings = for name in keys when name in Conf["Deleted Mascots"] mascot = Mascots[name] mascotEl = $.el 'div', - className: 'mascot' + className: 'mascot' id: name - + $.extend mascotEl, <%= importHTML('Settings/Mascot') %> $.on mascotEl, 'click', cb.restore