Fix mascot positioning code.

Style.mascot doesn't exist anymore, we moved all CSS into
the style.sheets object
This commit is contained in:
Zixaphir 2014-01-13 18:34:35 -07:00
parent 1203260f21
commit 6d7533df49
3 changed files with 15 additions and 15 deletions

View File

@ -13016,7 +13016,7 @@
if (Conf['Click to Toggle']) { if (Conf['Click to Toggle']) {
$.on(this.el, 'mousedown', MascotTools.click); $.on(this.el, 'mousedown', MascotTools.click);
} }
$.on(doc, 'QRDialogCreation', MascotTools.reposition); $.on(doc, 'QRDialogCreation', MascotTools.position);
$.asap((function() { $.asap((function() {
return d.body; return d.body;
}), function() { }), function() {
@ -13045,7 +13045,7 @@
} }
$.off(img, 'error', MascotTools.error); $.off(img, 'error', MascotTools.error);
$.replace(img, el); $.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() { error: function() {
var ctx, el, var ctx, el,
@ -13359,13 +13359,13 @@
}; };
return reader.readAsText(file); return reader.readAsText(file);
}, },
reposition: function() { position: function() {
var mascot; var mascot;
if (!Style.mascot) { if (!Style.sheets.mascots) {
return; return;
} }
mascot = Mascots[Conf['mascot']]; 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}";
} }
}; };

View File

@ -13005,7 +13005,7 @@
if (Conf['Click to Toggle']) { if (Conf['Click to Toggle']) {
$.on(this.el, 'mousedown', MascotTools.click); $.on(this.el, 'mousedown', MascotTools.click);
} }
$.on(doc, 'QRDialogCreation', MascotTools.reposition); $.on(doc, 'QRDialogCreation', MascotTools.position);
$.asap((function() { $.asap((function() {
return d.body; return d.body;
}), function() { }), function() {
@ -13034,7 +13034,7 @@
} }
$.off(img, 'error', MascotTools.error); $.off(img, 'error', MascotTools.error);
$.replace(img, el); $.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() { error: function() {
var ctx, el, var ctx, el,
@ -13348,13 +13348,13 @@
}; };
return reader.readAsText(file); return reader.readAsText(file);
}, },
reposition: function() { position: function() {
var mascot; var mascot;
if (!Style.mascot) { if (!Style.sheets.mascots) {
return; return;
} }
mascot = Mascots[Conf['mascot']]; 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}";
} }
}; };

View File

@ -5,7 +5,7 @@ MascotTools =
if Conf['Click to Toggle'] if Conf['Click to Toggle']
$.on @el, 'mousedown', MascotTools.click $.on @el, 'mousedown', MascotTools.click
$.on doc, 'QRDialogCreation', MascotTools.reposition $.on doc, 'QRDialogCreation', MascotTools.position
$.asap (-> d.body), => $.asap (-> d.body), =>
$.add d.body, @el $.add d.body, @el
@ -42,7 +42,7 @@ MascotTools =
$.off img, 'error', MascotTools.error $.off img, 'error', MascotTools.error
$.replace img, el $.replace img, el
Style.sheets.mascots.textContent = """<%= grunt.file.read('src/General/css/mascot.css') %>""" MascotTools.position()
error: -> error: ->
return unless @src return unless @src
@ -366,7 +366,7 @@ MascotTools =
reader.readAsText file reader.readAsText file
reposition: -> position: ->
return unless Style.mascot return unless Style.sheets.mascots
mascot = Mascots[Conf['mascot']] 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') %>"""