commit 9cad8078801b179d11477fbdae5cb7de92df5b62
parent 531d5ee662ed66a31c02d187c59255951ffc5116
Author: Davide P. Cervone <dpvc@union.edu>
Date: Fri, 3 May 2013 14:55:48 -0400
More timing issues with the language menu... make sure the menu gets the initial languages, even if CreateLanguageMenu is called too soon.
Diffstat:
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/unpacked/extensions/MathMenu.js b/unpacked/extensions/MathMenu.js
@@ -962,6 +962,34 @@
/*************************************************************/
+ //
+ // Creates the locale menu from the list of locales in MathJax.Localization.strings
+ //
+ MENU.CreateLocaleMenu = function () {
+ if (!MENU.menu) return;
+ var menu = MENU.menu.Find("Language").menu, items = menu.items;
+ //
+ // Get the names of the languages and sort them
+ //
+ var locales = [], LOCALE = MathJax.Localization.strings;
+ for (var id in LOCALE) {if (LOCALE.hasOwnProperty(id)) {locales.push(id)}}
+ locales = locales.sort(); menu.items = [];
+ //
+ // Add a menu item for each
+ //
+ for (var i = 0, m = locales.length; i < m; i++) {
+ var title = LOCALE[locales[i]].menuTitle;
+ if (title) {title += " ("+locales[i]+")"} else {title = locales[i]}
+ menu.items.push(ITEM.RADIO([locales[i],title],"locale",{action:MENU.Locale}));
+ }
+ //
+ // Add the rule and "Load from URL" items
+ //
+ menu.items.push(items[items.length-2],items[items.length-1]);
+ };
+
+ /*************************************************************/
+
HUB.Register.StartupHook("End Config",function () {
/*
@@ -1065,35 +1093,9 @@
})();
}
+ MENU.CreateLocaleMenu();
});
- //
- // Creates the locale menu from the list of locales in MathJax.Localization.strings
- //
- MENU.CreateLocaleMenu = function () {
- if (!MENU.menu) return;
- var menu = MENU.menu.Find("Language").menu, items = menu.items;
- //
- // Get the names of the languages and sort them
- //
- var locales = [], LOCALE = MathJax.Localization.strings;
- for (var id in LOCALE) {if (LOCALE.hasOwnProperty(id)) {locales.push(id)}}
- locales = locales.sort(); menu.items = [];
- //
- // Add a menu item for each
- //
- for (var i = 0, m = locales.length; i < m; i++) {
- var title = LOCALE[locales[i]].menuTitle;
- if (title) {title += " ("+locales[i]+")"} else {title = locales[i]}
- menu.items.push(ITEM.RADIO([locales[i],title],"locale",{action:MENU.Locale}));
- }
- //
- // Add the rule and "Load from URL" items
- //
- menu.items.push(items[items.length-2],items[items.length-1]);
- };
- MENU.CreateLocaleMenu();
-
MENU.showRenderer = function (show) {
MENU.cookie.showRenderer = CONFIG.showRenderer = show; MENU.saveCookie();
MENU.menu.Find("Math Settings","Math Renderer").hidden = !show;