From 6d7533df49d7003714cafd2cd6e0b9718326580f Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Mon, 13 Jan 2014 18:34:35 -0700 Subject: [PATCH] Fix mascot positioning code. Style.mascot doesn't exist anymore, we moved all CSS into the style.sheets object --- builds/appchan-x.user.js | 10 +++++----- builds/crx/script.js | 10 +++++----- src/Theming/Mascots.coffee | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 6ac19652c..854e01d58 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -13016,7 +13016,7 @@ if (Conf['Click to Toggle']) { $.on(this.el, 'mousedown', MascotTools.click); } - $.on(doc, 'QRDialogCreation', MascotTools.reposition); + $.on(doc, 'QRDialogCreation', MascotTools.position); $.asap((function() { return d.body; }), function() { @@ -13045,7 +13045,7 @@ } $.off(img, 'error', MascotTools.error); $.replace(img, el); - 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}"; + return MascotTools.position(); }, error: function() { var ctx, el, @@ -13359,13 +13359,13 @@ }; return reader.readAsText(file); }, - reposition: function() { + position: function() { var mascot; - if (!Style.mascot) { + if (!Style.sheets.mascots) { return; } mascot = Mascots[Conf['mascot']]; - 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}"; } }; diff --git a/builds/crx/script.js b/builds/crx/script.js index 4c7cbd126..a97c5a849 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -13005,7 +13005,7 @@ if (Conf['Click to Toggle']) { $.on(this.el, 'mousedown', MascotTools.click); } - $.on(doc, 'QRDialogCreation', MascotTools.reposition); + $.on(doc, 'QRDialogCreation', MascotTools.position); $.asap((function() { return d.body; }), function() { @@ -13034,7 +13034,7 @@ } $.off(img, 'error', MascotTools.error); $.replace(img, el); - 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}"; + return MascotTools.position(); }, error: function() { var ctx, el, @@ -13348,13 +13348,13 @@ }; return reader.readAsText(file); }, - reposition: function() { + position: function() { var mascot; - if (!Style.mascot) { + if (!Style.sheets.mascots) { return; } mascot = Mascots[Conf['mascot']]; - 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}"; } }; diff --git a/src/Theming/Mascots.coffee b/src/Theming/Mascots.coffee index 4d41b2b65..b8d03e4ae 100644 --- a/src/Theming/Mascots.coffee +++ b/src/Theming/Mascots.coffee @@ -5,7 +5,7 @@ MascotTools = if Conf['Click to Toggle'] $.on @el, 'mousedown', MascotTools.click - $.on doc, 'QRDialogCreation', MascotTools.reposition + $.on doc, 'QRDialogCreation', MascotTools.position $.asap (-> d.body), => $.add d.body, @el @@ -42,7 +42,7 @@ MascotTools = $.off img, 'error', MascotTools.error $.replace img, el - Style.sheets.mascots.textContent = """<%= grunt.file.read('src/General/css/mascot.css') %>""" + MascotTools.position() error: -> return unless @src @@ -366,7 +366,7 @@ MascotTools = reader.readAsText file - reposition: -> - return unless Style.mascot + position: -> + return unless Style.sheets.mascots mascot = Mascots[Conf['mascot']] - Style.mascot.textContent = """<%= grunt.file.read('src/General/css/mascot.css') %>""" + Style.sheets.mascots.textContent = """<%= grunt.file.read('src/General/css/mascot.css') %>"""