Fix mascot positioning code.
Style.mascot doesn't exist anymore, we moved all CSS into the style.sheets object
This commit is contained in:
parent
1203260f21
commit
6d7533df49
@ -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}";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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}";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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') %>"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user