Skip to content

Commit

Permalink
Merge branch 'localization' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dpvc committed Apr 29, 2013
2 parents 4f28b81 + bdb131a commit b8561b0
Show file tree
Hide file tree
Showing 47 changed files with 3,392 additions and 356 deletions.
550 changes: 520 additions & 30 deletions unpacked/MathJax.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion unpacked/config/Accessible-full.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*
* /MathJax/unpacked/config/Accessible-full.js
*
Expand All @@ -22,7 +24,7 @@ MathJax.Hub.Config({
mpMouse: true
},
errorSettings: {
message: ["[Math Error]"]
message: ["[",["MathError","Math Error],"]"]
}
});

Expand Down
4 changes: 3 additions & 1 deletion unpacked/config/Accessible.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*
* /MathJax/unpacked/config/Accessible.js
*
Expand All @@ -22,7 +24,7 @@ MathJax.Hub.Config({
mpMouse: true
},
errorSettings: {
message: ["[Math Error]"]
message: ["[",["MathError","Math Error],"]"]
}
});

Expand Down
7 changes: 6 additions & 1 deletion unpacked/config/MMLorHTML.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/config/MMLorHTML.js
Expand Down Expand Up @@ -95,7 +97,10 @@
} else {
HUB.PreProcess.disabled = true;
HUB.prepareScripts.disabled = true;
MathJax.Message.Set("Your browser does not support MathJax",null,4000);
MathJax.Message.Set(
["MathJaxNotSupported","Your browser does not support MathJax"],
null,4000
);
HUB.Startup.signal.Post("MathJax not supported");
}
});
Expand Down
3 changes: 3 additions & 0 deletions unpacked/config/default.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/config/default.js
Expand Down Expand Up @@ -235,6 +237,7 @@ MathJax.Hub.Config({
//
errorSettings: {
message: ["[Math Processing Error]"], // HTML snippet structure for message to use
messageId: "MathProcessingError", // ID of snippet for localization
style: {color: "#CC0000", "font-style":"italic"} // style for message
},

Expand Down
101 changes: 64 additions & 37 deletions unpacked/extensions/FontWarnings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */

/*************************************************************
*
* MathJax/extensions/FontWarnings.js
Expand Down Expand Up @@ -83,7 +86,10 @@
*/

(function (HUB,HTML) {
var VERSION = "2.1";
var VERSION = "2.1.2";

var STIXURL = "http://www.stixfonts.org/";
var MATHJAXURL = "https://github.com/mathjax/MathJax/tree/master/fonts/HTML-CSS/TeX/otf";

var CONFIG = HUB.CombineConfig("FontWarnings",{
//
Expand All @@ -110,31 +116,35 @@
// The messages for the various situations
//
Message: {

webFont: [
["closeBox"],
"MathJax is using web-based fonts to display the mathematics ",
"on this page. These take time to download, so the page would ",
"render faster if you installed math fonts directly in your ",
"system's font folder.",
["webFont",
"MathJax is using web-based fonts to display the mathematics "+
"on this page. These take time to download, so the page would "+
"render faster if you installed math fonts directly in your "+
"system's font folder."],
["fonts"]
],

imageFonts: [
["closeBox"],
"MathJax is using its image fonts rather than local or web-based fonts. ",
"This will render slower than usual, and the mathematics may not print ",
"at the full resolution of your printer.",
["imageFonts",
"MathJax is using its image fonts rather than local or web-based fonts. "+
"This will render slower than usual, and the mathematics may not print "+
"at the full resolution of your printer."],
["fonts"],
["webfonts"]
],

noFonts: [
["closeBox"],
"MathJax is unable to locate a font to use to display ",
"its mathematics, and image fonts are not available, so it ",
"is falling back on generic unicode characters in hopes that ",
"your browser will be able to display them. Some characters ",
"may not show up properly, or possibly not at all.",
["noFonts",
"MathJax is unable to locate a font to use to display "+
"its mathematics, and image fonts are not available, so it "+
"is falling back on generic unicode characters in hopes that "+
"your browser will be able to display them. Some characters "+
"may not show up properly, or possibly not at all."],
["fonts"],
["webfonts"]
]
Expand Down Expand Up @@ -170,32 +180,38 @@

webfonts: [
["p"],
"Most modern browsers allow for fonts to be downloaded over the web. ",
"Updating to a more recent version of your browser (or changing browsers) ",
"could improve the quality of the mathematics on this page."
["webfonts",
"Most modern browsers allow for fonts to be downloaded over the web. "+
"Updating to a more recent version of your browser (or changing "+
"browsers) could improve the quality of the mathematics on this page."
]
],

fonts: [
["p"],
"MathJax can use either the ",
["a",{href:"http://www.stixfonts.org/",target:"_blank"},"STIX fonts"],
" or the ",
["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"},["MathJax TeX fonts"]],
". Download and install either one to improve your MathJax experience."
["fonts",
"MathJax can use either the [STIX fonts](%1) or the [MathJax TeX fonts](%2). " +
"Download and install one of those fonts to improve your MathJax experience.",
STIXURL,MATHJAXURL
]
],

STIXfonts: [
["p"],
"This page is designed to use the ",
["a",{href:"http://www.stixfonts.org/",target:"_blank"},"STIX fonts"],
". Download and install those fonts to improve your MathJax experience."
],


STIXfonts: [
["p"],
["STIXPage",
"This page is designed to use the [STIX fonts](%1). " +
"Download and install those fonts to improve your MathJax experience.",
STIXURL
]
],

TeXfonts: [
["p"],
"This page is designed to use the ",
["a",{href:"http://www.mathjax.org/help-v2/fonts/",target:"_blank"},["MathJax TeX fonts"]],
". Download and install those fonts to improve your MathJax experience."
["TeXPage",
"This page is designed to use the [MathJax TeX fonts](%1). " +
"Download and install those fonts to improve your MathJax experience.",
MATHJAXURL
]
]

},
Expand Down Expand Up @@ -231,10 +247,20 @@
} else {delete CONFIG.messageStyle.filter}
CONFIG.messageStyle.maxWidth = (document.body.clientWidth-75) + "px";
var i = 0; while (i < data.length) {
if (data[i] instanceof Array && CONFIG.HTML[data[i][0]])
{data.splice.apply(data,[i,1].concat(CONFIG.HTML[data[i][0]]))} else {i++}
if (data[i] instanceof Array) {
if (data[i].length === 1 && CONFIG.HTML[data[i][0]]) {
data.splice.apply(data,[i,1].concat(CONFIG.HTML[data[i][0]]));
} else if (typeof data[i][1] === "string") {
var message = MathJax.Localization.lookupPhrase(["FontWarnings",data[i][0]],data[i][1]);
message = MathJax.Localization.processString(message,data[i].slice(2),"FontWarnings");
data.splice.apply(data,[i,1].concat(message));
i += message.length;
} else {i++}
} else {i++}
}
DATA.div = HTMLCSS.addElement(frame,"div",{id:"MathJax_FontWarning",style:CONFIG.messageStyle},data);
DATA.div = HTMLCSS.addElement(frame,"div",
{id:"MathJax_FontWarning",style:CONFIG.messageStyle},data);
MathJax.Localization.setCSS(DATA.div);
if (CONFIG.removeAfter) {
HUB.Register.StartupHook("End",function ()
{DATA.timer = setTimeout(FADEOUT,CONFIG.removeAfter)});
Expand Down Expand Up @@ -276,7 +302,8 @@
if (message.match(/- Web-Font/)) {if (localFonts) {MSG = "webFont"}}
else if (message.match(/- using image fonts/)) {MSG = "imageFonts"}
else if (message.match(/- no valid font/)) {MSG = "noFonts"}
if (MSG && CONFIG.Message[MSG]) {CREATEMESSAGE(CONFIG.Message[MSG])}
if (MSG && CONFIG.Message[MSG])
{MathJax.Localization.loadDomain("FontWarnings",[CREATEMESSAGE,CONFIG.Message[MSG]])}
}
});
}
Expand Down
154 changes: 154 additions & 0 deletions unpacked/extensions/HelpDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */

/*************************************************************
*
* MathJax/extensions/HelpDialog.js
*
* Implements the MathJax Help dialog box.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2013 Design Science, Inc.
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

(function (HUB,HTML,AJAX,OUTPUT,LOCALE) {

var HELP = MathJax.Extension.Help = {
version: "2.1"
};

var STIXURL = "http://www.stixfonts.org/";
var MENU = MathJax.Menu;

var CONFIG = HUB.CombineConfig("HelpDialog",{
closeImg: AJAX.fileURL(OUTPUT.imageDir+"/CloseX-31.png"), // image for close "X" for mobiles

styles: {
"#MathJax_Help": {
position:"fixed", left:"50%", width:"auto", "max-width": "90%", "text-align":"center",
border:"3px outset", padding:"1em 2em", "background-color":"#DDDDDD", color:"black",
cursor: "default", "font-family":"message-box", "font-size":"120%",
"font-style":"normal", "text-indent":0, "text-transform":"none",
"line-height":"normal", "letter-spacing":"normal", "word-spacing":"normal",
"word-wrap":"normal", "white-space":"wrap", "float":"none", "z-index":201,

"border-radius": "15px", // Opera 10.5 and IE9
"-webkit-border-radius": "15px", // Safari and Chrome
"-moz-border-radius": "15px", // Firefox
"-khtml-border-radius": "15px", // Konqueror

"box-shadow":"0px 10px 20px #808080", // Opera 10.5 and IE9
"-webkit-box-shadow":"0px 10px 20px #808080", // Safari 3 and Chrome
"-moz-box-shadow":"0px 10px 20px #808080", // Forefox 3.5
"-khtml-box-shadow":"0px 10px 20px #808080", // Konqueror
filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')" // IE
},

"#MathJax_HelpContent": {
overflow:"auto", "text-align":"left", "font-size":"80%",
padding:".4em .6em", border:"1px inset", margin:"1em 0px",
"max-height":"20em", "max-width":"30em", "background-color":"#EEEEEE"
}
}
});

/*
* Handle the Help Dialog box
*/
HELP.Dialog = function () {
LOCALE.loadDomain("HelpDialog",["Post",HELP]);
};

HELP.Post = function () {
this.div = MENU.Background(this);
var help = HTML.addElement(this.div,"div",{
id: "MathJax_Help"
},LOCALE._("HelpDialog",[
["b",{style:{fontSize:"120%"}},[["Help","MathJax Help"]]],
["div",{id: "MathJax_HelpContent"},[
["p",{},[["MathJax",
"*MathJax* is a JavaScript library that allows page authors to include " +
"mathematics within their web pages. As a reader, you don't need to do " +
"anything to make that happen."]]
],
["p",{},[["Browsers",
"*Browsers*: MathJax works with all modern browsers including IE6+, Firefox 3+, " +
"Chrome 0.2+, Safari 2+, Opera 9.6+ and most mobile browsers."]]
],
["p",{},[["Menu",
"*Math Menu*: MathJax adds a contextual menu to equations. Right-click or " +
"CTRL-click on any mathematics to access the menu."]]
],
["div",{style:{"margin-left":"1em"}},[
["p",{},[["ShowMath",
"*Show Math As* allows you to view the formula's source markup " +
"for copy & paste (as MathML or in its origianl format)."]]
],
["p",{},[["Settings",
"*Settings* gives you control over features of MathJax, such as the " +
"size of the mathematics, and the mechanism used to display equations."]]
],
["p",{},[["Language",
"*Language* lets you select the language used by MathJax for its menus " +
"and warning messages."]]
],
]],
["p",{},[["Zoom",
"*Math Zoom*: If you are having difficulty reading an equation, MathJax can " +
"enlarge it to help you see it better."]]
],
["p",{},[["Accessibilty",
"*Accessibility*: MathJax will automatically work with screen readers to make " +
"mathematics accessible to the visually impaired."]]
],
["p",{},[["Fonts",
"*Fonts*: MathJax will use certain math fonts if they are installed on your " +
"computer; otherwise, it will use web-based fonts. Although not required, " +
"locally installed fonts will speed up typesetting. We suggest installing " +
"the [STIX fonts](%1).",STIXURL]]
]
]],
["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],
["img", {
src: CONFIG.closeImg,
style: {width:"21px", height:"21px", position:"absolute", top:".2em", right:".2em"},
onclick: HELP.Remove
}]
]));
LOCALE.setCSS(help);
var doc = (document.documentElement||{});
var H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0;
if (MENU.prototype.msieAboutBug) {
help.style.width = "20em"; help.style.position = "absolute";
help.style.left = Math.floor((document.documentElement.scrollWidth - help.offsetWidth)/2)+"px";
help.style.top = (Math.floor((H-help.offsetHeight)/3)+document.body.scrollTop)+"px";
} else {
help.style.marginLeft = Math.floor(-help.offsetWidth/2)+"px";
help.style.top = Math.floor((H-help.offsetHeight)/3)+"px";
}
};
HELP.Remove = function (event) {
if (HELP.div) {document.body.removeChild(HELP.div); delete HELP.div}
};

MathJax.Callback.Queue(
HUB.Register.StartupHook("End Config",{}), // wait until config is complete
["Styles",AJAX,CONFIG.styles],
["Post",HUB.Startup.signal,"HelpDialig Ready"],
["loadComplete",AJAX,"[MathJax]/extensions/HelpDialog.js"]
);

})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.OutputJax,MathJax.Localization);
Loading

0 comments on commit b8561b0

Please sign in to comment.