commit 0e4b3f05e265461bd39f8416c0399ccc2de2afa9
parent 1c938cc48ea7ac3666426bf5c1221bc57fb97afd
Author: Davide P. Cervone <dpvc@union.edu>
Date: Thu, 3 Dec 2015 08:11:39 -0500
Make scaling basd on a list rather than hard-coded if-then statements. Issue #1324
Diffstat:
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/unpacked/extensions/MathMenu.js b/unpacked/extensions/MathMenu.js
@@ -1213,20 +1213,23 @@
* Handle rescaling all the math
*/
MENU.Scale = function () {
- var HTMLCSS = OUTPUT["HTML-CSS"], nMML = OUTPUT.NativeMML,
- SVG = OUTPUT.SVG, CHTML = OUTPUT.CommonHTML;
- var SCALE = (CHTML||HTMLCSS||nMML||SVG||{config:{scale:100}}).config.scale;
+ var JAX = ["CommonHTML","HTML-CSS","SVG","NativeMML","PreviewHTML"], m = JAX.length,
+ SCALE = 100, i, jax;
+ for (i = 0; i < m; i++) {
+ jax = OUTPUT[JAX[i]];
+ if (jax) {SCALE = jax.config.scale; break}
+ }
var scale = prompt(_("ScaleMath","Scale all mathematics (compared to surrounding text) by"),SCALE+"%");
if (scale) {
if (scale.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)) {
scale = parseFloat(scale);
if (scale) {
if (scale !== SCALE) {
- if (HTMLCSS) {HTMLCSS.config.scale = scale}
- if (CHTML) {CHTML.config.scale = scale}
- if (nMML) {nMML.config.scale = scale}
- if (SVG) {SVG.config.scale = scale}
- MENU.cookie.scale = scale;
+ for (i = 0; i < m; i++) {
+ jax = OUTPUT[JAX[i]];
+ if (jax) jax.config.scale = scale;
+ }
+ MENU.cookie.scale = HUB.config.scale = scale;
MENU.saveCookie();
HUB.Queue(["Rerender",HUB]);
}