From 21815537955892a7fd4d48d88afd1034f7489580 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Thu, 2 Jan 2014 01:51:23 -0700 Subject: [PATCH] Reading over this, I'm probably going rewrite this all anyways. It's just a giant mess. Unsorted, very flat, very unorganized. Everything is just kinda strewn about with no regards to structure. This is my code and I have no one to blame but myself. --- builds/appchan-x.user.js | 61 +++++++++++++++++++------------------ builds/crx/script.js | 61 +++++++++++++++++++------------------ src/General/Settings.coffee | 4 +-- src/Theming/JSColor.coffee | 2 +- src/Theming/Mascots.coffee | 2 +- src/Theming/Style.coffee | 49 ++++++++++++++--------------- src/Theming/Themes.coffee | 10 +++--- 7 files changed, 96 insertions(+), 93 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 796ccd388..bf9586f63 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -12406,7 +12406,7 @@ valueElement.previousSibling.value = value; editTheme[valueElement.previousSibling.name] = value; setTimeout(function() { - return Style.themeCSS.textContent = Style.theme(editTheme); + return Style.sheets.theme.textContent = Style.theme(editTheme); }); } if (!(flags & leaveStyle) && styleElement) { @@ -12675,7 +12675,7 @@ el.src = mascot.image; $.off(img = this.el.firstElementChild, 'error', MascotTools.error); $.replace(img, el); - return Style.mascot.textContent = "#mascot img {\nheight: " + (mascot.height && isNaN(parseFloat(mascot.height)) ? mascot.height : mascot.height ? parseInt(mascot.height, 10) + 'px' : 'auto') + ";\nwidth: " + (mascot.width && isNaN(parseFloat(mascot.width)) ? mascot.width : mascot.width ? parseInt(mascot.width, 10) + 'px' : 'auto') + ";\n}\n#mascot {\nmargin: " + (mascot.vOffset || 0) + "px " + (mascot.hOffset || 0) + "px;\n}\n.sidebar-large #mascot {\nleft: " + (mascot.center ? 25 : 0) + "px;\nright: " + (mascot.center ? 25 : 0) + "px;\n}\n.mascot-position-above-post-form.post-form-style-fixed #mascot {\ntransform: translateY(-" + (QR.nodes ? QR.nodes.el.getBoundingClientRect().height : 0) + "px);\n}"; + return Style.sheets.mascots.textContent = "#mascot img {\nheight: " + (mascot.height && isNaN(parseFloat(mascot.height)) ? mascot.height : mascot.height ? parseInt(mascot.height, 10) + 'px' : 'auto') + ";\nwidth: " + (mascot.width && isNaN(parseFloat(mascot.width)) ? mascot.width : mascot.width ? parseInt(mascot.width, 10) + 'px' : 'auto') + ";\n}\n#mascot {\nmargin: " + (mascot.vOffset || 0) + "px " + (mascot.hOffset || 0) + "px;\n}\n.sidebar-large #mascot {\nleft: " + (mascot.center ? 25 : 0) + "px;\nright: " + (mascot.center ? 25 : 0) + "px;\n}\n.mascot-position-above-post-form.post-form-style-fixed #mascot {\ntransform: translateY(-" + (QR.nodes ? QR.nodes.el.getBoundingClientRect().height : 0) + "px);\n}"; }, error: function() { var ctx, el, @@ -13109,14 +13109,15 @@ }; Style = { + sheets: {}, init: function() { var i, item, items, theme; - theme = Themes[Conf['theme']] || Themes['Yotsuba B']; Style.svgs = {}; - items = [['layoutCSS', Style.layout, 'layout'], ['themeCSS', Style.theme(theme), 'theme'], ['emojiCSS', Emoji.css(), 'emoji'], ['dynamicCSS', Style.dynamic(), 'dynamic'], ['paddingSheet', "", 'padding'], ['mascot', "", 'mascotSheet']]; + theme = Themes[Conf['theme']] || Themes['Yotsuba B']; + items = [['layout', Style.layout], ['theme', Style.theme(theme)], ['emoji', Emoji.css()], ['dynamic', Style.dynamic()], ['padding', ""], ['mascots', ""]]; i = 0; while (item = items[i++]) { - Style[item[0]] = $.addStyle(item[1], item[2]); + Style.sheets[item[0]] = $.addStyle(item[1], item[0]); } $.addStyle(JSColor.css(), 'jsColor'); $.asap((function() { @@ -13129,7 +13130,7 @@ return $.ready(this.readyInit); }, asapInit: function() { - var cat, hyphenated, name, setting, title, _ref; + var cat, hyphenated, name, pages, setting, title, _ref; $.addClass(doc, 'gecko'); $.addClass(doc, 'fourchan-x'); $.addClass(doc, 'appchan-x'); @@ -13147,28 +13148,28 @@ } } if (g.VIEW === 'index') { + pages = function(name, text) { + var action, el, elA; + el = $(".pagelist > ." + name); + elA = $.el('a', { + textContent: text + }); + if ((action = el.firstElementChild).nodeName === 'FORM') { + elA.href = 'javascript:;'; + $.on(elA, 'click', function() { + return action.firstElementChild.click(); + }); + } + return $.add(el, elA); + }; return $.asap((function() { return $('.mPagelist'); }), function() { - Style.pages('prev', '<'); - return Style.pages('next', '>'); + pages('prev', '<'); + return pages('next', '>'); }); } }, - pages: function(name, text) { - var action, el, elA; - el = $(".pagelist > ." + name); - elA = $.el('a', { - textContent: text - }); - if ((action = el.firstElementChild).nodeName === 'FORM') { - elA.href = 'javascript:;'; - $.on(elA, 'click', function() { - return action.firstElementChild.click(); - }); - } - return $.add(el, elA); - }, readyInit: function() { var exLink; Style.padding(); @@ -13315,7 +13316,7 @@ var navHeight, pageHeight, _ref; navHeight = Header.bar.offsetHeight; pageHeight = (_ref = $('.pagelist', d.body)) != null ? _ref.offsetHeight : void 0; - return Style.paddingSheet.textContent = ("body { padding-bottom: 15px; padding-top: 15px; } .fourchan-ss-navigation.fixed.top-header:not(.autohide) body::before { top: " + navHeight + "px; } .fourchan-ss-navigation.fixed.bottom-header:not(.autohide) body::before { bottom: " + navHeight + "px; } .top-header:not(.autohide) body { padding-top: " + (navHeight + 1) + "px; } .bottom-header:not(.autohide) body { padding-bottom: " + (navHeight + 1) + "px; } ") + (pageHeight ? ".fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { top: " + pageHeight + "px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { bottom: " + pageHeight + "px; } .index.pagination-sticky-top body, .index.pagination-top body { padding-top: " + (pageHeight + 1) + "px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { padding-bottom: " + (pageHeight + 1) + "px; }" : ''); + return Style.sheets.padding.textContent = ("body { padding-bottom: 15px; padding-top: 15px; } .fourchan-ss-navigation.fixed.top-header:not(.autohide) body::before { top: " + navHeight + "px; } .fourchan-ss-navigation.fixed.bottom-header:not(.autohide) body::before { bottom: " + navHeight + "px; } .top-header:not(.autohide) body { padding-top: " + (navHeight + 1) + "px; } .bottom-header:not(.autohide) body { padding-bottom: " + (navHeight + 1) + "px; } ") + (pageHeight ? ".fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { top: " + pageHeight + "px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { bottom: " + pageHeight + "px; } .index.pagination-sticky-top body, .index.pagination-top body { padding-top: " + (pageHeight + 1) + "px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { padding-bottom: " + (pageHeight + 1) + "px; }" : ''); }, color: function(hex) { this.hex = "#" + hex; @@ -13451,7 +13452,7 @@ }); $.on($('textarea', div), 'blur', function() { editTheme["Custom CSS"] = this.value; - return Style.themeCSS.textContent = Style.theme(editTheme); + return Style.sheets.theme.textContent = Style.theme(editTheme); }); $.add(themeContent, div); $.on($('#save > a', ThemeTools.dialog), 'click', function() { @@ -13459,7 +13460,7 @@ }); $.on($('#close > a', ThemeTools.dialog), 'click', ThemeTools.close); $.add(d.body, ThemeTools.dialog); - return Style.themeCSS.textContent = Style.theme(editTheme); + return Style.sheets.theme.textContent = Style.theme(editTheme); }, apply: function() { var depth, i, len, toggle1, toggle2; @@ -13493,7 +13494,7 @@ this.nextSibling.color.importColor(); } editTheme[this.name] = this.value; - return Style.themeCSS.textContent = Style.theme(editTheme); + return Style.sheets.theme.textContent = Style.theme(editTheme); }, uploadImage: function(evt, el) { var file, reader; @@ -13504,7 +13505,7 @@ val = "url(\"" + evt.target.result + "\")"; el.previousSibling.value = val; editTheme["Background Image"] = val; - return Style.themeCSS.textContent = Style.theme(editTheme); + return Style.sheets.theme.textContent = Style.theme(editTheme); }; return reader.readAsDataURL(file); }, @@ -13649,7 +13650,7 @@ }, close: function() { Conf['editMode'] = false; - Style.themeCSS.textContent = Style.theme(Themes[Conf['theme']]); + Style.sheets.theme.textContent = Style.theme(Themes[Conf['theme']]); $.rm($.id('themeConf')); return Settings.open('Themes'); } @@ -16126,7 +16127,7 @@ }, value: function() { $.cb.value.call(this); - return Style.dynamicCSS.textContent = Style.dynamic(); + return Style.sheets.dynamicCSS.textContent = Style.dynamic(); }, select: function() { var hyphenated, option, _i, _len, _ref; @@ -16252,7 +16253,7 @@ } Conf['theme'] = this.id; $.addClass(this, 'selectedtheme'); - return Style.themeCSS.textContent = Style.theme(Themes[this.id]); + return Style.sheets.theme.textContent = Style.theme(Themes[this.id]); }, edit: function(e) { e.preventDefault(); diff --git a/builds/crx/script.js b/builds/crx/script.js index 2e3401223..564a4a1b7 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -12411,7 +12411,7 @@ valueElement.previousSibling.value = value; editTheme[valueElement.previousSibling.name] = value; setTimeout(function() { - return Style.themeCSS.textContent = Style.theme(editTheme); + return Style.sheets.theme.textContent = Style.theme(editTheme); }); } if (!(flags & leaveStyle) && styleElement) { @@ -12680,7 +12680,7 @@ el.src = mascot.image; $.off(img = this.el.firstElementChild, 'error', MascotTools.error); $.replace(img, el); - return Style.mascot.textContent = "#mascot img {\nheight: " + (mascot.height && isNaN(parseFloat(mascot.height)) ? mascot.height : mascot.height ? parseInt(mascot.height, 10) + 'px' : 'auto') + ";\nwidth: " + (mascot.width && isNaN(parseFloat(mascot.width)) ? mascot.width : mascot.width ? parseInt(mascot.width, 10) + 'px' : 'auto') + ";\n}\n#mascot {\nmargin: " + (mascot.vOffset || 0) + "px " + (mascot.hOffset || 0) + "px;\n}\n.sidebar-large #mascot {\nleft: " + (mascot.center ? 25 : 0) + "px;\nright: " + (mascot.center ? 25 : 0) + "px;\n}\n.mascot-position-above-post-form.post-form-style-fixed #mascot {\n-webkit-transform: translateY(-" + (QR.nodes ? QR.nodes.el.getBoundingClientRect().height : 0) + "px);\n}"; + return Style.sheets.mascots.textContent = "#mascot img {\nheight: " + (mascot.height && isNaN(parseFloat(mascot.height)) ? mascot.height : mascot.height ? parseInt(mascot.height, 10) + 'px' : 'auto') + ";\nwidth: " + (mascot.width && isNaN(parseFloat(mascot.width)) ? mascot.width : mascot.width ? parseInt(mascot.width, 10) + 'px' : 'auto') + ";\n}\n#mascot {\nmargin: " + (mascot.vOffset || 0) + "px " + (mascot.hOffset || 0) + "px;\n}\n.sidebar-large #mascot {\nleft: " + (mascot.center ? 25 : 0) + "px;\nright: " + (mascot.center ? 25 : 0) + "px;\n}\n.mascot-position-above-post-form.post-form-style-fixed #mascot {\n-webkit-transform: translateY(-" + (QR.nodes ? QR.nodes.el.getBoundingClientRect().height : 0) + "px);\n}"; }, error: function() { var ctx, el, @@ -13114,18 +13114,19 @@ }; Style = { + sheets: {}, init: function() { var i, item, items, theme; - theme = Themes[Conf['theme']] || Themes['Yotsuba B']; Style.svgs = { el: $.el('div', { id: 'svg_filters' }) }; - items = [['layoutCSS', Style.layout, 'layout'], ['themeCSS', Style.theme(theme), 'theme'], ['emojiCSS', Emoji.css(), 'emoji'], ['dynamicCSS', Style.dynamic(), 'dynamic'], ['paddingSheet', "", 'padding'], ['mascot', "", 'mascotSheet']]; + theme = Themes[Conf['theme']] || Themes['Yotsuba B']; + items = [['layout', Style.layout], ['theme', Style.theme(theme)], ['emoji', Emoji.css()], ['dynamic', Style.dynamic()], ['padding', ""], ['mascots', ""]]; i = 0; while (item = items[i++]) { - Style[item[0]] = $.addStyle(item[1], item[2]); + Style.sheets[item[0]] = $.addStyle(item[1], item[0]); } $.addStyle(JSColor.css(), 'jsColor'); $.asap((function() { @@ -13138,7 +13139,7 @@ return $.ready(this.readyInit); }, asapInit: function() { - var cat, hyphenated, name, setting, title, _ref; + var cat, hyphenated, name, pages, setting, title, _ref; $.addClass(doc, 'blink'); $.addClass(doc, 'fourchan-x'); $.addClass(doc, 'appchan-x'); @@ -13157,28 +13158,28 @@ } } if (g.VIEW === 'index') { + pages = function(name, text) { + var action, el, elA; + el = $(".pagelist > ." + name); + elA = $.el('a', { + textContent: text + }); + if ((action = el.firstElementChild).nodeName === 'FORM') { + elA.href = 'javascript:;'; + $.on(elA, 'click', function() { + return action.firstElementChild.click(); + }); + } + return $.add(el, elA); + }; return $.asap((function() { return $('.mPagelist'); }), function() { - Style.pages('prev', '<'); - return Style.pages('next', '>'); + pages('prev', '<'); + return pages('next', '>'); }); } }, - pages: function(name, text) { - var action, el, elA; - el = $(".pagelist > ." + name); - elA = $.el('a', { - textContent: text - }); - if ((action = el.firstElementChild).nodeName === 'FORM') { - elA.href = 'javascript:;'; - $.on(elA, 'click', function() { - return action.firstElementChild.click(); - }); - } - return $.add(el, elA); - }, readyInit: function() { var exLink; Style.padding(); @@ -13326,7 +13327,7 @@ var navHeight, pageHeight, _ref; navHeight = Header.bar.offsetHeight; pageHeight = (_ref = $('.pagelist', d.body)) != null ? _ref.offsetHeight : void 0; - return Style.paddingSheet.textContent = ("body { padding-bottom: 15px; padding-top: 15px; } .fourchan-ss-navigation.fixed.top-header:not(.autohide) body::before { top: " + navHeight + "px; } .fourchan-ss-navigation.fixed.bottom-header:not(.autohide) body::before { bottom: " + navHeight + "px; } .top-header:not(.autohide) body { padding-top: " + (navHeight + 1) + "px; } .bottom-header:not(.autohide) body { padding-bottom: " + (navHeight + 1) + "px; } ") + (pageHeight ? ".fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { top: " + pageHeight + "px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { bottom: " + pageHeight + "px; } .index.pagination-sticky-top body, .index.pagination-top body { padding-top: " + (pageHeight + 1) + "px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { padding-bottom: " + (pageHeight + 1) + "px; }" : ''); + return Style.sheets.padding.textContent = ("body { padding-bottom: 15px; padding-top: 15px; } .fourchan-ss-navigation.fixed.top-header:not(.autohide) body::before { top: " + navHeight + "px; } .fourchan-ss-navigation.fixed.bottom-header:not(.autohide) body::before { bottom: " + navHeight + "px; } .top-header:not(.autohide) body { padding-top: " + (navHeight + 1) + "px; } .bottom-header:not(.autohide) body { padding-bottom: " + (navHeight + 1) + "px; } ") + (pageHeight ? ".fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { top: " + pageHeight + "px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { bottom: " + pageHeight + "px; } .index.pagination-sticky-top body, .index.pagination-top body { padding-top: " + (pageHeight + 1) + "px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { padding-bottom: " + (pageHeight + 1) + "px; }" : ''); }, color: function(hex) { this.hex = "#" + hex; @@ -13462,7 +13463,7 @@ }); $.on($('textarea', div), 'blur', function() { editTheme["Custom CSS"] = this.value; - return Style.themeCSS.textContent = Style.theme(editTheme); + return Style.sheets.theme.textContent = Style.theme(editTheme); }); $.add(themeContent, div); $.on($('#save > a', ThemeTools.dialog), 'click', function() { @@ -13470,7 +13471,7 @@ }); $.on($('#close > a', ThemeTools.dialog), 'click', ThemeTools.close); $.add(d.body, ThemeTools.dialog); - return Style.themeCSS.textContent = Style.theme(editTheme); + return Style.sheets.theme.textContent = Style.theme(editTheme); }, apply: function() { var depth, i, len, toggle1, toggle2; @@ -13504,7 +13505,7 @@ this.nextSibling.color.importColor(); } editTheme[this.name] = this.value; - return Style.themeCSS.textContent = Style.theme(editTheme); + return Style.sheets.theme.textContent = Style.theme(editTheme); }, uploadImage: function(evt, el) { var file, reader; @@ -13515,7 +13516,7 @@ val = "url(\"" + evt.target.result + "\")"; el.previousSibling.value = val; editTheme["Background Image"] = val; - return Style.themeCSS.textContent = Style.theme(editTheme); + return Style.sheets.theme.textContent = Style.theme(editTheme); }; return reader.readAsDataURL(file); }, @@ -13660,7 +13661,7 @@ }, close: function() { Conf['editMode'] = false; - Style.themeCSS.textContent = Style.theme(Themes[Conf['theme']]); + Style.sheets.theme.textContent = Style.theme(Themes[Conf['theme']]); $.rm($.id('themeConf')); return Settings.open('Themes'); } @@ -16135,7 +16136,7 @@ }, value: function() { $.cb.value.call(this); - return Style.dynamicCSS.textContent = Style.dynamic(); + return Style.sheets.dynamicCSS.textContent = Style.dynamic(); }, select: function() { var hyphenated, option, _i, _len, _ref; @@ -16258,7 +16259,7 @@ } Conf['theme'] = this.id; $.addClass(this, 'selectedtheme'); - return Style.themeCSS.textContent = Style.theme(Themes[this.id]); + return Style.sheets.theme.textContent = Style.theme(Themes[this.id]); }, edit: function(e) { e.preventDefault(); diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 7ecd8b466..dbe7796e1 100755 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -783,7 +783,7 @@ Settings = value: -> $.cb.value.call @ - Style.dynamicCSS.textContent = Style.dynamic() + Style.sheets.dynamicCSS.textContent = Style.dynamic() select: -> $.cb.value.call @ @@ -888,7 +888,7 @@ Settings = $.set "theme", @id Conf['theme'] = @id $.addClass @, 'selectedtheme' - Style.themeCSS.textContent = Style.theme Themes[@id] + Style.sheets.theme.textContent = Style.theme Themes[@id] edit: (e) -> e.preventDefault() diff --git a/src/Theming/JSColor.coffee b/src/Theming/JSColor.coffee index 4c3aa692d..87d0a4cb0 100644 --- a/src/Theming/JSColor.coffee +++ b/src/Theming/JSColor.coffee @@ -59,7 +59,7 @@ JSColor = valueElement.previousSibling.value = value editTheme[valueElement.previousSibling.name] = value - setTimeout -> Style.themeCSS.textContent = Style.theme editTheme + setTimeout -> Style.sheets.theme.textContent = Style.theme editTheme if not (flags & leaveStyle) and styleElement styleElement.style.backgroundColor = '#' + @toString() diff --git a/src/Theming/Mascots.coffee b/src/Theming/Mascots.coffee index 1d6a0d8ba..6b0cc0648 100644 --- a/src/Theming/Mascots.coffee +++ b/src/Theming/Mascots.coffee @@ -41,7 +41,7 @@ MascotTools = $.replace img, el - Style.mascot.textContent = """<%= grunt.file.read('src/General/css/mascot.css') %>""" + Style.sheets.mascots.textContent = """<%= grunt.file.read('src/General/css/mascot.css') %>""" error: -> @src = MascotTools.imageError if MascotTools.imageError diff --git a/src/Theming/Style.coffee b/src/Theming/Style.coffee index 527c7b82a..8db201791 100644 --- a/src/Theming/Style.coffee +++ b/src/Theming/Style.coffee @@ -1,6 +1,6 @@ Style = + sheets: {} init: -> - theme = Themes[Conf['theme']] or Themes['Yotsuba B'] Style.svgs = { <% if (type === 'crx') { %> el: $.el 'div', @@ -8,18 +8,19 @@ Style = <% } %> } + theme = Themes[Conf['theme']] or Themes['Yotsuba B'] items = [ - ['layoutCSS', Style.layout, 'layout'] - ['themeCSS', Style.theme(theme), 'theme'] - ['emojiCSS', Emoji.css(), 'emoji'] - ['dynamicCSS', Style.dynamic(), 'dynamic'] - ['paddingSheet', "", 'padding'] - ['mascot', "", 'mascotSheet'] + ['layout', Style.layout] + ['theme', Style.theme theme] + ['emoji', Emoji.css()] + ['dynamic', Style.dynamic()] + ['padding', ""] + ['mascots', ""] ] i = 0 while item = items[i++] - Style[item[0]] = $.addStyle item[1], item[2] + Style.sheets[item[0]] = $.addStyle item[1], item[0] # Non-customizable $.addStyle JSColor.css(), 'jsColor' @@ -29,7 +30,7 @@ Style = $.asap (-> d.body), @asapInit $.on window, "resize", Style.padding $.ready @readyInit - + asapInit: -> <% if (type === 'crx') { %> $.addClass doc, 'blink' @@ -51,21 +52,21 @@ Style = $.addClass doc, hyphenated if g.VIEW is 'index' + pages = (name, text) -> + el = $ ".pagelist > .#{name}" + elA = $.el 'a', + textContent: text + + if (action = el.firstElementChild).nodeName is 'FORM' + elA.href = 'javascript:;' + $.on elA, 'click', -> + action.firstElementChild.click() + + $.add el, elA + $.asap (-> $ '.mPagelist'), -> - Style.pages 'prev', '<' - Style.pages 'next', '>' - - pages: (name, text) -> - el = $ ".pagelist > .#{name}" - elA = $.el 'a', - textContent: text - - if (action = el.firstElementChild).nodeName is 'FORM' - elA.href = 'javascript:;' - $.on elA, 'click', -> - action.firstElementChild.click() - - $.add el, elA + pages 'prev', '<' + pages 'next', '>' readyInit: -> Style.padding() @@ -201,7 +202,7 @@ Style = padding: -> navHeight = Header.bar.offsetHeight pageHeight = ($ '.pagelist', d.body)?.offsetHeight - Style.paddingSheet.textContent = """<%= grunt.file.read('src/General/css/padding.nav.css').replace(/\s+/g, ' ').trim() %> """ + + Style.sheets.padding.textContent = """<%= grunt.file.read('src/General/css/padding.nav.css').replace(/\s+/g, ' ').trim() %> """ + if pageHeight """<%= grunt.file.read('src/General/css/padding.pages.css').replace(/\s+/g, ' ').trim() %>""" else '' diff --git a/src/Theming/Themes.coffee b/src/Theming/Themes.coffee index f7b67f34f..224a3a8ab 100644 --- a/src/Theming/Themes.coffee +++ b/src/Theming/Themes.coffee @@ -159,7 +159,7 @@ ThemeTools = $.on $('textarea', div), 'blur', -> editTheme["Custom CSS"] = @value - Style.themeCSS.textContent = Style.theme editTheme + Style.sheets.theme.textContent = Style.theme editTheme $.add themeContent, div @@ -169,7 +169,7 @@ ThemeTools = $.on $('#close > a', ThemeTools.dialog), 'click', ThemeTools.close $.add d.body, ThemeTools.dialog - Style.themeCSS.textContent = Style.theme editTheme + Style.sheets.theme.textContent = Style.theme editTheme apply: -> depth = 0 @@ -194,7 +194,7 @@ ThemeTools = @nextSibling.color.importColor() editTheme[@name] = @value - Style.themeCSS.textContent = Style.theme editTheme + Style.sheets.theme.textContent = Style.theme editTheme uploadImage: (evt, el) -> file = evt.target.files[0] @@ -205,7 +205,7 @@ ThemeTools = el.previousSibling.value = val editTheme["Background Image"] = val - Style.themeCSS.textContent = Style.theme editTheme + Style.sheets.theme.textContent = Style.theme editTheme reader.readAsDataURL file @@ -347,6 +347,6 @@ ThemeTools = close: -> Conf['editMode'] = false - Style.themeCSS.textContent = Style.theme Themes[Conf['theme']] + Style.sheets.theme.textContent = Style.theme Themes[Conf['theme']] $.rm $.id 'themeConf' Settings.open 'Themes' \ No newline at end of file