diff --git a/builds/appchan-x.js b/builds/appchan-x.js index d6c6fe716..deb4fb40d 100644 --- a/builds/appchan-x.js +++ b/builds/appchan-x.js @@ -5146,7 +5146,7 @@ return section.scrollTop = 0; }, main: function(section) { - var arr, button, description, div, fs, hiddenNum, input, inputs, items, key, obj, unhide, _ref; + var arr, button, description, div, fs, hiddenNum, input, inputs, items, key, obj, _ref; section.innerHTML = "
\n \n \n \n
\n

"; $.on($('.export', section), 'click', Settings["export"]); @@ -5235,17 +5235,7 @@ return $["delete"](['hiddenThreads', 'hiddenPosts']); }); }); - $.after($('input[name="Stubs"]', section).parentNode.parentNode, div); - div = $.el('div', { - innerHTML: ": Unhide the navigation bar." - }); - unhide = $('button', div); - $.on(unhide, 'click', function() { - return Header.setBarPosition.call({ - textContent: "sticky top" - }); - }); - return $.after($('input[name="Check for Updates"]', section).parentNode.parentNode, div); + return $.after($('input[name="Stubs"]', section).parentNode.parentNode, div); }, "export": function(now, data) { var a, db, p, _i, _len; @@ -6159,11 +6149,7 @@ Header.setBarPosition.call({ textContent: "" + Conf['Boards Navigation'] }); - $.sync('Boards Navigation', function() { - return Header.setBarPosition.call({ - textContent: "" + Conf['Boards Navigation'] - }); - }); + $.sync('Boards Navigation', Header.changeBarPosition); Header.setBarVisibility(Conf['Header auto-hide']); $.sync('Header auto-hide', Header.setBarVisibility); $.prepend(d.body, settings = $.id('navtopright')); @@ -6250,33 +6236,33 @@ }, setBarPosition: function() { $.event('CloseMenu'); - switch (this.textContent) { + Header.changeBarPosition(this.textContent); + Conf['Boards Navigation'] = this.textContent; + return $.set('Boards Navigation', this.textContent); + }, + changeBarPosition: function(setting) { + switch (setting) { case 'sticky top': $.addClass(doc, 'top'); $.addClass(doc, 'fixed'); $.rmClass(doc, 'bottom'); - $.rmClass(doc, 'hide'); - break; + return $.rmClass(doc, 'hide'); case 'sticky bottom': $.rmClass(doc, 'top'); $.addClass(doc, 'fixed'); $.addClass(doc, 'bottom'); - $.rmClass(doc, 'hide'); - break; + return $.rmClass(doc, 'hide'); case 'top': $.addClass(doc, 'top'); $.rmClass(doc, 'fixed'); $.rmClass(doc, 'bottom'); - $.rmClass(doc, 'hide'); - break; + return $.rmClass(doc, 'hide'); case 'hide': $.rmClass(doc, 'top'); $.rmClass(doc, 'fixed'); $.rmClass(doc, 'bottom'); - $.addClass(doc, 'hide'); + return $.addClass(doc, 'hide'); } - Conf['Boards Navigation'] = this.textContent; - return $.set('Boards Navigation', this.textContent); }, setBarVisibility: function(hide) { Header.headerToggler.firstElementChild.checked = hide; diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 9abca808b..a98b68988 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -5137,7 +5137,7 @@ return section.scrollTop = 0; }, main: function(section) { - var arr, button, description, div, fs, hiddenNum, input, inputs, items, key, obj, unhide, _ref; + var arr, button, description, div, fs, hiddenNum, input, inputs, items, key, obj, _ref; section.innerHTML = "
\n \n \n \n
\n

"; $.on($('.export', section), 'click', Settings["export"]); @@ -5226,17 +5226,7 @@ return $["delete"](['hiddenThreads', 'hiddenPosts']); }); }); - $.after($('input[name="Stubs"]', section).parentNode.parentNode, div); - div = $.el('div', { - innerHTML: ": Unhide the navigation bar." - }); - unhide = $('button', div); - $.on(unhide, 'click', function() { - return Header.setBarPosition.call({ - textContent: "sticky top" - }); - }); - return $.after($('input[name="Check for Updates"]', section).parentNode.parentNode, div); + return $.after($('input[name="Stubs"]', section).parentNode.parentNode, div); }, "export": function(now, data) { var a, db, p, _i, _len; @@ -6150,11 +6140,7 @@ Header.setBarPosition.call({ textContent: "" + Conf['Boards Navigation'] }); - $.sync('Boards Navigation', function() { - return Header.setBarPosition.call({ - textContent: "" + Conf['Boards Navigation'] - }); - }); + $.sync('Boards Navigation', Header.changeBarPosition); Header.setBarVisibility(Conf['Header auto-hide']); $.sync('Header auto-hide', Header.setBarVisibility); $.prepend(d.body, settings = $.id('navtopright')); @@ -6241,33 +6227,33 @@ }, setBarPosition: function() { $.event('CloseMenu'); - switch (this.textContent) { + Header.changeBarPosition(this.textContent); + Conf['Boards Navigation'] = this.textContent; + return $.set('Boards Navigation', this.textContent); + }, + changeBarPosition: function(setting) { + switch (setting) { case 'sticky top': $.addClass(doc, 'top'); $.addClass(doc, 'fixed'); $.rmClass(doc, 'bottom'); - $.rmClass(doc, 'hide'); - break; + return $.rmClass(doc, 'hide'); case 'sticky bottom': $.rmClass(doc, 'top'); $.addClass(doc, 'fixed'); $.addClass(doc, 'bottom'); - $.rmClass(doc, 'hide'); - break; + return $.rmClass(doc, 'hide'); case 'top': $.addClass(doc, 'top'); $.rmClass(doc, 'fixed'); $.rmClass(doc, 'bottom'); - $.rmClass(doc, 'hide'); - break; + return $.rmClass(doc, 'hide'); case 'hide': $.rmClass(doc, 'top'); $.rmClass(doc, 'fixed'); $.rmClass(doc, 'bottom'); - $.addClass(doc, 'hide'); + return $.addClass(doc, 'hide'); } - Conf['Boards Navigation'] = this.textContent; - return $.set('Boards Navigation', this.textContent); }, setBarVisibility: function(hide) { Header.headerToggler.firstElementChild.checked = hide; diff --git a/builds/appchan-x.zip b/builds/appchan-x.zip index 5a46194ec..55350cc12 100644 Binary files a/builds/appchan-x.zip and b/builds/appchan-x.zip differ diff --git a/builds/crx.crx b/builds/crx.crx index 5a0cb87dc..41e063d0c 100644 Binary files a/builds/crx.crx and b/builds/crx.crx differ diff --git a/builds/crx/script.js b/builds/crx/script.js index 03c535102..fb7918594 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -5082,7 +5082,7 @@ return section.scrollTop = 0; }, main: function(section) { - var arr, button, description, div, fs, hiddenNum, input, inputs, items, key, obj, unhide, _ref; + var arr, button, description, div, fs, hiddenNum, input, inputs, items, key, obj, _ref; section.innerHTML = "
\n \n \n \n
\n

"; $.on($('.export', section), 'click', Settings["export"]); @@ -5171,17 +5171,7 @@ return $["delete"](['hiddenThreads', 'hiddenPosts']); }); }); - $.after($('input[name="Stubs"]', section).parentNode.parentNode, div); - div = $.el('div', { - innerHTML: ": Unhide the navigation bar." - }); - unhide = $('button', div); - $.on(unhide, 'click', function() { - return Header.setBarPosition.call({ - textContent: "sticky top" - }); - }); - return $.after($('input[name="Check for Updates"]', section).parentNode.parentNode, div); + return $.after($('input[name="Stubs"]', section).parentNode.parentNode, div); }, "export": function(now, data) { var a, db, p, _i, _len; @@ -6095,11 +6085,7 @@ Header.setBarPosition.call({ textContent: "" + Conf['Boards Navigation'] }); - $.sync('Boards Navigation', function() { - return Header.setBarPosition.call({ - textContent: "" + Conf['Boards Navigation'] - }); - }); + $.sync('Boards Navigation', Header.changeBarPosition); Header.setBarVisibility(Conf['Header auto-hide']); $.sync('Header auto-hide', Header.setBarVisibility); $.prepend(d.body, settings = $.id('navtopright')); @@ -6186,33 +6172,33 @@ }, setBarPosition: function() { $.event('CloseMenu'); - switch (this.textContent) { + Header.changeBarPosition(this.textContent); + Conf['Boards Navigation'] = this.textContent; + return $.set('Boards Navigation', this.textContent); + }, + changeBarPosition: function(setting) { + switch (setting) { case 'sticky top': $.addClass(doc, 'top'); $.addClass(doc, 'fixed'); $.rmClass(doc, 'bottom'); - $.rmClass(doc, 'hide'); - break; + return $.rmClass(doc, 'hide'); case 'sticky bottom': $.rmClass(doc, 'top'); $.addClass(doc, 'fixed'); $.addClass(doc, 'bottom'); - $.rmClass(doc, 'hide'); - break; + return $.rmClass(doc, 'hide'); case 'top': $.addClass(doc, 'top'); $.rmClass(doc, 'fixed'); $.rmClass(doc, 'bottom'); - $.rmClass(doc, 'hide'); - break; + return $.rmClass(doc, 'hide'); case 'hide': $.rmClass(doc, 'top'); $.rmClass(doc, 'fixed'); $.rmClass(doc, 'bottom'); - $.addClass(doc, 'hide'); + return $.addClass(doc, 'hide'); } - Conf['Boards Navigation'] = this.textContent; - return $.set('Boards Navigation', this.textContent); }, setBarVisibility: function(hide) { Header.headerToggler.firstElementChild.checked = hide; diff --git a/src/features.coffee b/src/features.coffee index 27820107d..a393718ab 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -77,8 +77,7 @@ Header = id: 'custom-board-list' Header.setBarPosition.call textContent: "#{Conf['Boards Navigation']}" - $.sync 'Boards Navigation', -> - Header.setBarPosition.call textContent: "#{Conf['Boards Navigation']}" + $.sync 'Boards Navigation', Header.changeBarPosition Header.setBarVisibility Conf['Header auto-hide'] $.sync 'Header auto-hide', Header.setBarVisibility @@ -151,7 +150,13 @@ Header = setBarPosition: -> $.event 'CloseMenu' - switch @textContent + Header.changeBarPosition @textContent + + Conf['Boards Navigation'] = @textContent + $.set 'Boards Navigation', @textContent + + changeBarPosition: (setting) -> + switch setting when 'sticky top' $.addClass doc, 'top' $.addClass doc, 'fixed' @@ -173,9 +178,6 @@ Header = $.rmClass doc, 'bottom' $.addClass doc, 'hide' - Conf['Boards Navigation'] = @textContent - $.set 'Boards Navigation', @textContent - setBarVisibility: (hide) -> Header.headerToggler.firstElementChild.checked = hide (if hide then $.addClass else $.rmClass) Header.nav, 'autohide' diff --git a/src/settings.coffee b/src/settings.coffee index dd6026de5..9fa665835 100644 --- a/src/settings.coffee +++ b/src/settings.coffee @@ -188,13 +188,6 @@ Settings = $.delete ['hiddenThreads', 'hiddenPosts'] $.after $('input[name="Stubs"]', section).parentNode.parentNode, div - div = $.el 'div', - innerHTML: ": Unhide the navigation bar." - unhide = $ 'button', div - $.on unhide, 'click', -> - Header.setBarPosition.call textContent: "sticky top" - $.after $('input[name="Check for Updates"]', section).parentNode.parentNode, div - export: (now, data) -> unless typeof now is 'number' now = Date.now()