From 5af3407edacb988ccfab28044e2f9a479ce2f7f9 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Wed, 21 Aug 2013 11:40:06 -0700 Subject: [PATCH] Fix Style.padding --- builds/appchan-x.user.js | 12 ++++++------ builds/crx/script.js | 12 ++++++------ src/General/css/padding.nav.css | 8 ++++---- src/General/css/padding.pages.css | 8 ++++---- src/Theming/Style.coffee | 6 +++--- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 24e65df67..d0d9f7026 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -12519,13 +12519,13 @@ } }, padding: function() { - var css; + var css, navHeight, pageHeight, _ref; - Style.padding.nav = Header.bar; - Style.padding.pages = $('.pagelist', d.body); - css = "body { padding-bottom: 1px; } .fourchan-ss-navigation.fixed.top:not(.autohide) body::before { top: " + Style.padding.nav.offsetHeight + "px; } .fourchan-ss-navigation.fixed.bottom:not(.autohide) body::before { bottom: " + Style.padding.nav.offsetHeight + "px; } .top:not(.autohide) body { padding-top: " + (Style.padding.nav.offsetHeight + 1) + "px; } .bottom:not(.autohide) body { padding-bottom: " + (Style.padding.nav.offsetHeight + 1) + "px;\" }"; - if (Style.padding.pages) { - css += ".fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { top: " + Style.padding.pages.offsetHeight + "px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { bottom: " + Style.padding.pages.offsetHeight + "px; } .index.pagination-sticky-top body, .index.pagination-top body { padding-top: " + (Style.padding.pages.offsetHeight + 1) + "px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { padding-bottom: " + (Style.padding.pages.offsetHeight + 1) + "px; }"; + navHeight = Header.bar.offsetHeight; + pageHeight = (_ref = $('.pagelist', d.body)) != null ? _ref.offsetHeight : void 0; + css = "body { padding-bottom: 1px; } .fourchan-ss-navigation.fixed.top:not(.autohide) body::before { top: " + navHeight + "px; } .fourchan-ss-navigation.fixed.bottom:not(.autohide) body::before { bottom: " + navHeight + "px; } .top:not(.autohide) body { padding-top: " + (navHeight + 1) + "px; } .bottom:not(.autohide) body { padding-bottom: " + (navHeight + 1) + "px; }"; + if (pageHeight) { + css += ".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.paddingSheet.textContent = css; }, diff --git a/builds/crx/script.js b/builds/crx/script.js index 1c39355fc..4f9052406 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -12512,13 +12512,13 @@ } }, padding: function() { - var css; + var css, navHeight, pageHeight, _ref; - Style.padding.nav = Header.bar; - Style.padding.pages = $('.pagelist', d.body); - css = "body { padding-bottom: 1px; } .fourchan-ss-navigation.fixed.top:not(.autohide) body::before { top: " + Style.padding.nav.offsetHeight + "px; } .fourchan-ss-navigation.fixed.bottom:not(.autohide) body::before { bottom: " + Style.padding.nav.offsetHeight + "px; } .top:not(.autohide) body { padding-top: " + (Style.padding.nav.offsetHeight + 1) + "px; } .bottom:not(.autohide) body { padding-bottom: " + (Style.padding.nav.offsetHeight + 1) + "px;\" }"; - if (Style.padding.pages) { - css += ".fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { top: " + Style.padding.pages.offsetHeight + "px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { bottom: " + Style.padding.pages.offsetHeight + "px; } .index.pagination-sticky-top body, .index.pagination-top body { padding-top: " + (Style.padding.pages.offsetHeight + 1) + "px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { padding-bottom: " + (Style.padding.pages.offsetHeight + 1) + "px; }"; + navHeight = Header.bar.offsetHeight; + pageHeight = (_ref = $('.pagelist', d.body)) != null ? _ref.offsetHeight : void 0; + css = "body { padding-bottom: 1px; } .fourchan-ss-navigation.fixed.top:not(.autohide) body::before { top: " + navHeight + "px; } .fourchan-ss-navigation.fixed.bottom:not(.autohide) body::before { bottom: " + navHeight + "px; } .top:not(.autohide) body { padding-top: " + (navHeight + 1) + "px; } .bottom:not(.autohide) body { padding-bottom: " + (navHeight + 1) + "px; }"; + if (pageHeight) { + css += ".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.paddingSheet.textContent = css; }, diff --git a/src/General/css/padding.nav.css b/src/General/css/padding.nav.css index 62a857371..7987ace56 100644 --- a/src/General/css/padding.nav.css +++ b/src/General/css/padding.nav.css @@ -2,14 +2,14 @@ body { padding-bottom: 1px; } .fourchan-ss-navigation.fixed.top:not(.autohide) body::before { - top: #{Style.padding.nav.offsetHeight}px; + top: #{navHeight}px; } .fourchan-ss-navigation.fixed.bottom:not(.autohide) body::before { - bottom: #{Style.padding.nav.offsetHeight}px; + bottom: #{navHeight}px; } .top:not(.autohide) body { - padding-top: #{Style.padding.nav.offsetHeight + 1}px; + padding-top: #{navHeight + 1}px; } .bottom:not(.autohide) body { - padding-bottom: #{Style.padding.nav.offsetHeight + 1}px;" + padding-bottom: #{navHeight + 1}px; } \ No newline at end of file diff --git a/src/General/css/padding.pages.css b/src/General/css/padding.pages.css index c348b224b..c5bf389ec 100644 --- a/src/General/css/padding.pages.css +++ b/src/General/css/padding.pages.css @@ -1,16 +1,16 @@ .fourchan-ss-navigation.index.pagination-sticky-top body::before, .fourchan-ss-navigation.index.pagination-top body::before { - top: #{Style.padding.pages.offsetHeight}px; + top: #{pageHeight}px; } .fourchan-ss-navigation.index.pagination-sticky-bottom body::before, .fourchan-ss-navigation.index.pagination-bottom body::before { - bottom: #{Style.padding.pages.offsetHeight}px; + bottom: #{pageHeight}px; } .index.pagination-sticky-top body, .index.pagination-top body { - padding-top: #{Style.padding.pages.offsetHeight + 1}px; + padding-top: #{pageHeight + 1}px; } .index.pagination-sticky-bottom body, .index.pagination-bottom body { - padding-bottom: #{Style.padding.pages.offsetHeight + 1}px; + padding-bottom: #{pageHeight + 1}px; } \ No newline at end of file diff --git a/src/Theming/Style.coffee b/src/Theming/Style.coffee index 7ebfaaf00..eea22fcfb 100644 --- a/src/Theming/Style.coffee +++ b/src/Theming/Style.coffee @@ -191,11 +191,11 @@ Style = Header.addShortcut el, true padding: -> - Style.padding.nav = Header.bar - Style.padding.pages = $ '.pagelist', d.body + navHeight = Header.bar.offsetHeight + pageHeight = ($ '.pagelist', d.body)?.offsetHeight css = """<%= grunt.file.read('src/General/css/padding.nav.css').replace(/\s+/g, ' ').trim() %>""" - if Style.padding.pages + if pageHeight css += """<%= grunt.file.read('src/General/css/padding.pages.css').replace(/\s+/g, ' ').trim() %>""" Style.paddingSheet.textContent = css