commit 64e8419ff1e8f0ca1167350d573e1e82ef7c9b1b
parent 4c54fe224e08b5bb53e59e2af2b4c46013ddafeb
Author: zorkow <volker.sorge@gmail.com>
Date: Fri, 21 Aug 2015 12:37:26 +0100
Whitespace cleanup.
Diffstat:
2 files changed, 103 insertions(+), 103 deletions(-)
diff --git a/unpacked/extensions/MathEvents.js b/unpacked/extensions/MathEvents.js
@@ -4,20 +4,20 @@
/*************************************************************
*
* MathJax/extensions/MathEvents.js
- *
+ *
* Implements the event handlers needed by the output jax to perform
* menu, hover, and other events.
*
* ---------------------------------------------------------------------
- *
+ *
* Copyright (c) 2011-2015 The MathJax Consortium
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,12 +27,12 @@
(function (HUB,HTML,AJAX,CALLBACK,LOCALE,OUTPUT,INPUT) {
var VERSION = "2.5.0";
-
+
var EXTENSION = MathJax.Extension;
var ME = EXTENSION.MathEvents = {version: VERSION};
-
+
var SETTINGS = HUB.config.menuSettings;
-
+
var CONFIG = {
hover: 500, // time required to be considered a hover
frame: {
@@ -41,7 +41,7 @@
bcolor: "#A6D", // frame border color
hwidth: "15px", // haze width
hcolor: "#83A" // haze color
- },
+ },
button: {
x: -6, y: -3, // menu button offsets
wx: -2 // button offset for full-width equations
@@ -99,12 +99,12 @@
}
};
-
+
//
// Common event-handling code
//
var EVENT = ME.Event = {
-
+
LEFTBUTTON: 0, // the event.button value for left button
RIGHTBUTTON: 2, // the event.button value for right button
MENUKEY: "altKey", // the event value for alternate context menu
@@ -131,7 +131,7 @@
Click: function (event) {return EVENT.Handler(event,"Click",this)},
DblClick: function (event) {return EVENT.Handler(event,"DblClick",this)},
Menu: function (event) {return EVENT.Handler(event,"ContextMenu",this)},
-
+
//
// Call the output jax's event handler or the zoom handler
//
@@ -143,7 +143,7 @@
if (jax[type]) {return jax[type](event,math)}
if (EXTENSION.MathZoom) {return EXTENSION.MathZoom.HandleEvent(event,type,math)}
},
-
+
//
// Try to cancel the event in every way we can
//
@@ -156,12 +156,12 @@
}
return false;
},
-
+
//
// Keydown event handler. Should only fire on Space key.
//
// TODO: (sorge) Fit this into the Handler function.
- //
+ //
Keydown: function (event, math) {
var jax = OUTPUT[this.jaxID];
if (event.keyCode === EVENT.KEY.SPACE) {
@@ -169,7 +169,7 @@
EVENT.ContextMenu(event, this);
};
},
-
+
//
// Load the contextual menu code, if needed, and post the menu
//
@@ -192,7 +192,7 @@
}
//
- // If the menu code is loaded,
+ // If the menu code is loaded,
// Check if localization needs loading;
// If not, post the menu, and return.
// Otherwise wait for the localization to load
@@ -206,12 +206,12 @@
if (!load) {
MENU.jax = jax;
var source = MENU.menu.Find("Show Math As").submenu;
- source.items[0].name = jax.sourceMenuTitle;
- source.items[0].format = (jax.sourceMenuFormat||"MathML");
+ source.items[0].name = jax.sourceMenuTitle;
+ source.items[0].format = (jax.sourceMenuFormat||"MathML");
source.items[1].name = INPUT[jax.inputJax].sourceMenuTitle;
source.items[5].disabled = !INPUT[jax.inputJax].annotationEncoding;
- //
+ //
// Try and find each known annotation format and enable the menu
// items accordingly.
//
@@ -253,7 +253,7 @@
);
return EVENT.False(event);
},
-
+
//
// Mousedown handler for alternate means of accessing menu
//
@@ -270,26 +270,26 @@
return JAX.ContextMenu(event,math,true);
}
},
-
+
ClearSelection: function () {
if (ME.safariContextMenuBug) {setTimeout("window.getSelection().empty()",0)}
if (document.selection) {setTimeout("document.selection.empty()",0)}
},
-
+
getBBox: function (span) {
span.appendChild(ME.topImg);
var h = ME.topImg.offsetTop, d = span.offsetHeight-h, w = span.offsetWidth;
span.removeChild(ME.topImg);
return {w:w, h:h, d:d};
}
-
+
};
-
+
//
// Handle hover "discoverability"
//
var HOVER = ME.Hover = {
-
+
//
// Check if we are moving from a non-MathJax element to a MathJax one
// and either start fading in again (if it is fading out) or start the
@@ -336,7 +336,7 @@
return EVENT.False(event);
}
},
-
+
//
// Clear the old timer and start a new one
//
@@ -347,7 +347,7 @@
ClearHoverTimer: function () {
if (this.hoverTimer) {clearTimeout(this.hoverTimer); delete this.hoverTimer}
},
-
+
//
// Handle putting up the hover frame
//
@@ -458,7 +458,7 @@
jax.hover.timer = setTimeout(CALLBACK(["HoverFade",this,jax]),(delay||CONFIG.fadeDelay));
}
},
-
+
//
// Handle a click on the menu button
//
@@ -466,7 +466,7 @@
if (!event) {event = window.event}
return OUTPUT[this.jax].ContextMenu(event,this.math,true);
},
-
+
//
// Clear all hover timers
//
@@ -476,7 +476,7 @@
HOVER.ClearHoverTimer();
delete jax.hover;
},
-
+
//
// Make a measurement in pixels
//
@@ -496,9 +496,9 @@
}
};
-
+
//
- // Handle touch events.
+ // Handle touch events.
//
// Use double-tap-and-hold as a replacement for context menu event.
// Use double-tap as a replacement for double click.
@@ -507,7 +507,7 @@
last: 0, // time of last tap event
delay: 500, // delay time for double-click
-
+
//
// Check if this is a double-tap, and if so, start the timer
// for the double-tap and hold (to trigger the contextual menu)
@@ -521,9 +521,9 @@
event.preventDefault();
}
},
-
+
//
- // Check if there is a timeout pending, i.e., we have a
+ // Check if there is a timeout pending, i.e., we have a
// double-tap and were waiting to see if it is held long
// enough for the menu. Since we got the end before the
// timeout, it is a double-click, not a double-tap-and-hold.
@@ -539,7 +539,7 @@
return EVENT.Handler((event.touches[0]||event.touch),"DblClick",this);
}
},
-
+
//
// If the timeout passes without an end event, we issue
// the contextual menu event.
@@ -548,10 +548,10 @@
delete TOUCH.timeout; TOUCH.last = 0; TOUCH.up = false;
return EVENT.Handler((event.touches[0]||event.touch),"ContextMenu",math);
}
-
+
};
-
- /*
+
+ /*
* //
* // Mobile screens are small, so use larger version of arrow
* //
@@ -561,7 +561,7 @@
* CONFIG.button.x = -6;
* }
*/
-
+
//
// Set up browser-specific values
//
@@ -584,7 +584,7 @@
ME.noContextMenuBug = true; // doesn't produce contextmenu event
}
});
-
+
//
// Used in measuring zoom and hover positions
//
@@ -605,7 +605,7 @@
haze["-moz-box-shadow"] = haze["-khtml-box-shadow"] =
"0px 0px "+CONFIG.frame.hwidth+" "+CONFIG.frame.hcolor;
};
-
+
//
// Queue the events needed for startup
//
@@ -617,6 +617,6 @@
["Post",HUB.Startup.signal,"MathEvents Ready"],
["loadComplete",AJAX,"[MathJax]/extensions/MathEvents.js"]
);
-
+
})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback,
MathJax.Localization,MathJax.OutputJax,MathJax.InputJax);
diff --git a/unpacked/extensions/MathMenu.js b/unpacked/extensions/MathMenu.js
@@ -4,21 +4,21 @@
/*************************************************************
*
* MathJax/extensions/MathMenu.js
- *
+ *
* Implements a right-mouse (or CTRL-click) menu over mathematics
* elements that gives the user the ability to copy the source,
* change the math size, and zoom settings.
*
* ---------------------------------------------------------------------
- *
+ *
* Copyright (c) 2010-2015 The MathJax Consortium
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@
var VERSION = "2.5.0";
var SIGNAL = MathJax.Callback.Signal("menu"); // signal for menu events
-
+
MathJax.Extension.MathMenu = {
version: VERSION,
signal: SIGNAL
@@ -45,7 +45,7 @@
var isPC = HUB.Browser.isPC, isMSIE = HUB.Browser.isMSIE, isIE9 = ((document.documentMode||0) > 8);
var ROUND = (isPC ? null : "5px");
-
+
var CONFIG = HUB.CombineConfig("MathMenu",{
delay: 150, // the delay for submenus
@@ -72,7 +72,7 @@
left: Math.round((screen.width - 400)/2),
top: Math.round((screen.height - 300)/3)
},
-
+
styles: {
"#MathJax_About": {
position:"fixed", left:"50%", width:"auto", "text-align":"center",
@@ -143,28 +143,28 @@
padding: (isPC ? "2px 2em 4px 1.33em" : "1px 2em 3px 1.33em"),
"font-style":"italic"
},
-
+
".MathJax_MenuRule": {
"border-top": (isPC ? "1px solid #CCCCCC" : "1px solid #DDDDDD"),
margin: (isPC ? "4px 1px 0px" : "4px 3px")
},
-
+
".MathJax_MenuDisabled": {
color:"GrayText"
},
-
+
".MathJax_MenuActive": {
"background-color": (isPC ? "Highlight" : "#606872"),
color: (isPC ? "HighlightText" : "white")
},
-
+
"#MathJax_AboutClose": {
top:".2em", right:".2em"
},
".MathJax_Menu .MathJax_MenuClose": {
top:"-10px", left:"-10px"
},
-
+
".MathJax_MenuClose": {
position:"absolute",
cursor:"pointer",
@@ -184,7 +184,7 @@
"-webkit-border-radius": "18px", // Safari and Chrome
"-moz-border-radius": "18px", // Firefox
"-khtml-border-radius": "18px", // Konqueror
- "line-height":0,
+ "line-height":0,
padding:"8px 0 6px" // may need to be browser-specific
},
".MathJax_MenuClose:hover": {
@@ -197,7 +197,7 @@
}
});
-
+
var FALSE, HOVER, KEY;
HUB.Register.StartupHook("MathEvents Ready",function () {
FALSE = MathJax.Extension.MathEvents.Event.False;
@@ -247,7 +247,7 @@
Down: function(event, menu) { },
Space: function(event, menu) { }
}, {});
-
+
/*************************************************************/
/*
@@ -259,7 +259,7 @@
posted: false,
title: null,
margin: 5,
-
+
Init: function (def) {this.items = [].slice.call(arguments,0)},
With: function (def) {if (def) {HUB.Insert(this,def)}; return this},
@@ -290,7 +290,7 @@
ontouchstart: MENU.Close, ontouchend: FALSE, onmousedown: MENU.Close, onmouseup: FALSE
},[["span",{},"\u00D7"]]);
}
-
+
div.appendChild(menu);
this.posted = true;
menu.style.width = (menu.offsetWidth+2) + "px";
@@ -332,9 +332,9 @@
menu.style["KhtmlBorderRadiusTop"+side] = 0; // Konqueror
}
}
-
+
menu.style.left = x+"px"; menu.style.top = y+"px";
-
+
if (document.selection && document.selection.empty) {document.selection.empty()}
MENU.Focus(menu);
return FALSE(event);
@@ -376,7 +376,7 @@
}
return null;
},
-
+
/*
* Find the index of a menu item (so we can insert before or after it)
*/
@@ -387,7 +387,7 @@
{if (this.items[i].name[n] === name) {return i}}
return null;
},
-
+
Right: function(event, menu) {
MENU.Right(event, menu);
},
@@ -403,7 +403,7 @@
item.Activate(event, item.GetNode());
}
},{
-
+
config: CONFIG,
div: null, // the DOM elements for the menu and submenus
@@ -484,7 +484,7 @@
node: null, // The node the menu was activated on.
active: null, // The currently focused item. There can only be one!
posted: false, // Is a menu open?
-
+
GetJaxs: function() {
var nodes = document.getElementsByClassName('MathJax');
for (var i = 0, node; node = nodes[i]; i++) {
@@ -555,14 +555,14 @@
Mod: function(a, n) {
return ((a % n) + n) % n;
},
-
+
saveCookie: function () {HTML.Cookie.Set("menu",this.cookie)},
getCookie: function () {this.cookie = HTML.Cookie.Get("menu")}
});
MathJax.Menu.NAV = NAV;
-
+
/*************************************************************/
/*
* Abstract class of menu items.
@@ -572,7 +572,7 @@
name: "", // The menu item's label as [id,label] pair.
node: null, // The HTML node of the item.
menu: null, // The parent menu containing that item. HTML node.
-
+
/*
* Accessor method for node.
*/
@@ -608,7 +608,7 @@
Mouseover: function (event,menu) {
if (menu.parentNode === MENU.active.parentNode) {
- this.Deactivate(MENU.active);
+ this.Deactivate(MENU.active);
}
this.Activate(event, menu);
},
@@ -639,7 +639,7 @@
m--;
}
},
-
+
Touchstart: function (event,menu) {return this.TouchEvent(event,menu,"Mousedown")},
Touchend: function (event,menu) {return this.TouchEvent(event,menu,"Mouseup")},
TouchEvent: function (event,menu,type) {
@@ -652,7 +652,7 @@
MENU.Event(event,menu,type);
return false;
},
-
+
Remove: function (event,menu) {
menu = menu.parentNode.menuItem;
return menu.Remove(event,menu);
@@ -673,7 +673,7 @@
menu.className = menu.className.replace(/ MathJax_MenuActive/,"")},
With: function (def) {if (def) {HUB.Insert(this,def)}; return this},
-
+
isRTL: function () {return MENU.isRTL},
rtlClass: function () {return (this.isRTL() ? " RTL" : "")}
});
@@ -685,7 +685,7 @@
MENU.ENTRY = MENU.ITEM.Subclass({
role: "menuitem", // Aria role.
-
+
Attributes: function() {
var def = this.SUPER(arguments).Attributes.call(
this,
@@ -739,7 +739,7 @@
Space: function (event, menu) {
this.Mouseup(event, menu);
},
-
+
Activate: function (event, menu) {
this.Deactivate(menu);
if (!this.disabled) {
@@ -753,7 +753,7 @@
}
});
-
+
/*************************************************************/
/*
* A menu item that performs a command when selected
@@ -766,7 +766,7 @@
this.name = name; this.action = action;
this.With(def);
},
-
+
Label: function (def,menu) {return [this.Name()]},
//TODO: Focus the popup.
Mouseup: function (event,menu) {
@@ -866,7 +866,7 @@
variable: null, // the variable name
marker: (isPC ? "\u25CF" : "\u2713"), // the checkmark
role: "menuitemradio",
-
+
Init: function (name,variable,def) {
if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair
this.name = name; this.variable = variable; this.With(def);
@@ -885,7 +885,7 @@
if (item && item.variable === this.variable)
{child[i].firstChild.style.display = "none"}
}
- menu.firstChild.display = "";
+ menu.firstChild.display = "";
CONFIG.settings[this.variable] = this.value;
MENU.cookie[this.variable] = CONFIG.settings[this.variable]; MENU.saveCookie();
SIGNAL.Post(["radio button",this]);
@@ -930,7 +930,7 @@
/*************************************************************/
/*
* A menu item that is a label
- */
+ */
MENU.ITEM.LABEL = MENU.ENTRY.Subclass({
role: "menuitem", // Aria role.
@@ -959,7 +959,7 @@
return null;
}
});
-
+
/*************************************************************/
/*************************************************************/
@@ -968,7 +968,7 @@
*/
MENU.About = function () {
var HTMLCSS = OUTPUT["HTML-CSS"] || {};
- var font =
+ var font =
(HTMLCSS.imgFonts ? "image" :
(HTMLCSS.fontInUse ?
(HTMLCSS.webFonts ? "web" : "local")+" "+HTMLCSS.fontInUse :
@@ -983,7 +983,7 @@
jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);
MENU.About.GetJax(jax,MathJax.Extension,["Extension","%1 Extension v%2"],true);
jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[
- HUB.Browser + " v"+HUB.Browser.version + (format ?
+ HUB.Browser + " v"+HUB.Browser.version + (format ?
" \u2014 " + _(format.replace(/ /g,""),format) : "")
]]);
MENU.About.div = MENU.Background(MENU.About);
@@ -994,7 +994,7 @@
_(font.replace(/ /g,""),"using "+font),["br"],["br"],
["span",{style:{
display:"inline-block", "text-align":"left", "font-size":"80%",
- "max-height":"20em", overflow:"auto",
+ "max-height":"20em", overflow:"auto",
"background-color":"#E4E4E4", padding:".4em .6em", border:"1px inset"
}},jax],["br"],["br"],
["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],
@@ -1027,7 +1027,7 @@
return jax;
};
-
+
/*
* Handle the MathJax HELP menu
*/
@@ -1035,7 +1035,7 @@
AJAX.Require("[MathJax]/extensions/HelpDialog.js",
function () {MathJax.Extension.Help.Dialog()});
};
-
+
/*
* Handle showing of element's source
*/
@@ -1119,7 +1119,7 @@
},50);
}
};
-
+
/*
* Handle rescaling all the math
*/
@@ -1143,14 +1143,14 @@
"The scale should be a percentage (e.g., 120%%)"))}
}
};
-
+
/*
* Handle loading the zoom code
*/
MENU.Zoom = function () {
if (!MathJax.Extension.MathZoom) {AJAX.Require("[MathJax]/extensions/MathZoom.js")}
};
-
+
/*
* Handle changing the renderer
*/
@@ -1164,7 +1164,7 @@
switch (CONFIG.settings.renderer) {
case "NativeMML":
if (!CONFIG.settings.warnedMML) {
- if (BROWSER.isChrome && BROWSER.version.substr(0,3) !== "24.") {message = MESSAGE.MML.WebKit}
+ if (BROWSER.isChrome && BROWSER.version.substr(0,3) !== "24.") {message = MESSAGE.MML.WebKit}
else if (BROWSER.isSafari && !BROWSER.versionAtLeast("5.0")) {message = MESSAGE.MML.WebKit}
else if (BROWSER.isMSIE) {if (!BROWSER.hasMathPlayer) {message = MESSAGE.MML.MSIE}}
else {message = MESSAGE.MML[BROWSER]}
@@ -1176,7 +1176,7 @@
if (!CONFIG.settings.warnedSVG) {
if (BROWSER.isMSIE && !isIE9) {message = MESSAGE.SVG.MSIE}
}
- break;
+ break;
}
if (message) {
message = _(message[0],message[1]);
@@ -1209,7 +1209,7 @@
MSIE: ["MSIENativeMMLWarning",
"Internet Explorer requires the MathPlayer plugin " +
"in order to process MathML output."],
-
+
Opera: ["OperaNativeMMLWarning",
"Opera's support for MathML is limited, so switching to " +
"MathML output may cause some expressions to render poorly."],
@@ -1222,7 +1222,7 @@
"Your browser's native MathML does not implement all the features " +
"used by MathJax, so some expressions may not render properly."]
},
-
+
SVG: {
MSIE: ["MSIESVGWarning",
"SVG is not implemented in Internet Explorer prior to " +
@@ -1231,7 +1231,7 @@
"not display properly."]
}
};
-
+
/*
* Handle setting the HTMLCSS fonts
*/
@@ -1239,7 +1239,7 @@
var HTMLCSS = OUTPUT["HTML-CSS"]; if (!HTMLCSS) return;
document.location.reload();
};
-
+
/*
* Handle selection of locale and rerender the page
*/
@@ -1261,7 +1261,7 @@
});
}
};
-
+
/*
* Handle setting MathPlayer events
*/
@@ -1294,7 +1294,7 @@
"The MathJax contextual menu will be disabled, but you can " +
"Alt-Click on an expression to obtain the MathJax menu instead."]
};
-
+
/*************************************************************/
/*************************************************************/
@@ -1475,7 +1475,7 @@
trigger.items[0].disabled = trigger.items[1].disabled = true;
if (settings.zoom === "Hover" || settings.zoom == "Click") {settings.zoom = "None"}
trigger.items = trigger.items.slice(0,4);
-
+
if (navigator.appVersion.match(/[ (]Android[) ]/)) {
MENU.ITEM.SUBMENU.Augment({marker: "\u00BB"});
}
@@ -1485,7 +1485,7 @@
MENU.CreateLocaleMenu();
MENU.CreateAnnotationMenu();
});
-
+
MENU.showRenderer = function (show) {
MENU.cookie.showRenderer = CONFIG.showRenderer = show; MENU.saveCookie();
MENU.menu.Find("Math Settings","Math Renderer").hidden = !show;
@@ -1511,12 +1511,12 @@
MENU.cookie.showLocale = CONFIG.showLocale = show; MENU.saveCookie();
MENU.menu.Find("Language").hidden = !show;
};
-
+
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
if (!MathJax.OutputJax["HTML-CSS"].config.imageFont)
{MENU.menu.Find("Math Settings","Font Preference","TeX (image)").disabled = true}
});
-
+
/*************************************************************/
CALLBACK.Queue(