Add support for Firefox 6 Mobile, and add close button for mobile devices so it is easier to close a submenu.
This commit is contained in:
parent
816d2cbcfd
commit
ec5cd41d69
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
BIN
images/CloseX-31.png
Normal file
BIN
images/CloseX-31.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
|
@ -30,7 +30,7 @@ if (!window.MathJax) {window.MathJax= {}}
|
||||||
if (!MathJax.Hub) { // skip if already loaded
|
if (!MathJax.Hub) { // skip if already loaded
|
||||||
|
|
||||||
MathJax.version = "1.1a";
|
MathJax.version = "1.1a";
|
||||||
MathJax.fileversion = "1.1.8";
|
MathJax.fileversion = "1.1.9";
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
|
||||||
|
@ -1871,10 +1871,11 @@ MathJax.Hub.Startup = {
|
||||||
},
|
},
|
||||||
Remove: function (jax) {}
|
Remove: function (jax) {}
|
||||||
},{
|
},{
|
||||||
version: "1.1",
|
version: "1.1.1",
|
||||||
directory: JAX.directory+"/output",
|
directory: JAX.directory+"/output",
|
||||||
extensionDir: JAX.extensionDir,
|
extensionDir: JAX.extensionDir,
|
||||||
fontDir: ROOT+(BASE.isPacked?"":"/..")+"/fonts"
|
fontDir: ROOT+(BASE.isPacked?"":"/..")+"/fonts",
|
||||||
|
imageDir: ROOT+(BASE.isPacked?"":"/..")+"/images"
|
||||||
});
|
});
|
||||||
|
|
||||||
/***********************************/
|
/***********************************/
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (HUB,HTML,AJAX) {
|
(function (HUB,HTML,AJAX) {
|
||||||
var VERSION = "1.1.5";
|
var VERSION = "1.1.6";
|
||||||
|
|
||||||
MathJax.Extension.MathMenu = {version: VERSION};
|
MathJax.Extension.MathMenu = {version: VERSION};
|
||||||
|
|
||||||
|
@ -182,6 +182,14 @@
|
||||||
},title);
|
},title);
|
||||||
|
|
||||||
for (var i = 0, m = this.items.length; i < m; i++) {this.items[i].Create(menu)}
|
for (var i = 0, m = this.items.length; i < m; i++) {this.items[i].Create(menu)}
|
||||||
|
if (MENU.isMobile) {
|
||||||
|
HTML.addElement(menu,"img",{
|
||||||
|
src: MathJax.Ajax.fileURL(MathJax.OutputJax.imageDir+"/CloseX-31.png"),
|
||||||
|
width: 31, height: 31,
|
||||||
|
style: {position:"absolute", top:"-15px", left:"-15px"},
|
||||||
|
ontouchstart: MENU.Close, ontouchend: this.False, menu: parent
|
||||||
|
});
|
||||||
|
}
|
||||||
this.posted = true;
|
this.posted = true;
|
||||||
|
|
||||||
menu.style.width = (menu.offsetWidth+2) + "px";
|
menu.style.width = (menu.offsetWidth+2) + "px";
|
||||||
|
@ -193,7 +201,7 @@
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
if (x + menu.offsetWidth > document.body.offsetWidth - this.margin)
|
if (x + menu.offsetWidth > document.body.offsetWidth - this.margin)
|
||||||
{x = document.body.offsetWidth - menu.offsetWidth - this.margin}
|
{x = document.body.offsetWidth - menu.offsetWidth - this.margin}
|
||||||
if (MENU.isMobile) {x -= menu.offsetWidth / 2; y -= 20}
|
if (MENU.isMobile) {x = Math.max(5,x-Math.floor(menu.offsetWidth/2)); y -= 20}
|
||||||
MENU.skipUp = true;
|
MENU.skipUp = true;
|
||||||
} else {
|
} else {
|
||||||
var side = "left", mw = parent.offsetWidth;
|
var side = "left", mw = parent.offsetWidth;
|
||||||
|
@ -229,9 +237,6 @@
|
||||||
if (this.msieBackgroundBug) {detachEvent("onresize",MENU.Resize)}
|
if (this.msieBackgroundBug) {detachEvent("onresize",MENU.Resize)}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Mouseup: function (event,menu) {
|
|
||||||
if (MENU.skipUp) {delete MENU.skipUp} else {this.Remove(event,menu)}
|
|
||||||
},
|
|
||||||
|
|
||||||
False: FALSE,
|
False: FALSE,
|
||||||
|
|
||||||
|
@ -259,6 +264,8 @@
|
||||||
|
|
||||||
div: null, // the DOM elements for the menu and submenus
|
div: null, // the DOM elements for the menu and submenus
|
||||||
|
|
||||||
|
Close: function (event)
|
||||||
|
{return MENU.Event(event,this.menu||this.parentNode,(this.menu?"Touchend":"Remove"))},
|
||||||
Remove: function (event) {return MENU.Event(event,this,"Remove")},
|
Remove: function (event) {return MENU.Event(event,this,"Remove")},
|
||||||
Mouseover: function (event) {return MENU.Event(event,this,"Mouseover")},
|
Mouseover: function (event) {return MENU.Event(event,this,"Mouseover")},
|
||||||
Mouseout: function (event) {return MENU.Event(event,this,"Mouseout")},
|
Mouseout: function (event) {return MENU.Event(event,this,"Mouseout")},
|
||||||
|
@ -266,13 +273,15 @@
|
||||||
Mouseup: function (event) {return MENU.Event(event,this,"Mouseup")},
|
Mouseup: function (event) {return MENU.Event(event,this,"Mouseup")},
|
||||||
Touchstart: function (event) {return MENU.Event(event,this,"Touchstart")},
|
Touchstart: function (event) {return MENU.Event(event,this,"Touchstart")},
|
||||||
Touchend: function (event) {return MENU.Event(event,this,"Touchend")},
|
Touchend: function (event) {return MENU.Event(event,this,"Touchend")},
|
||||||
Event: function (event,menu,type) {
|
Event: function (event,menu,type,force) {
|
||||||
|
if (MENU.isMobile && type === "Mouseover" && !force) {return FALSE(event)}
|
||||||
|
if (MENU.skipUp) {
|
||||||
|
if (type.match(/Mouseup|Touchend/)) {delete MENU.skipUp; return FALSE(event)}
|
||||||
|
if (type.match(/Touchstart/)) {delete MENU.skipUp}
|
||||||
|
}
|
||||||
if (!event) {event = window.event}
|
if (!event) {event = window.event}
|
||||||
var item = menu.menuItem;
|
var item = menu.menuItem;
|
||||||
//debug(type+" "+(item||{}).name);
|
|
||||||
//try {
|
|
||||||
if (item && item[type]) {return item[type](event,menu)}
|
if (item && item[type]) {return item[type](event,menu)}
|
||||||
//} catch (err) {debug(err.message)}
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -314,7 +323,17 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
saveCookie: function () {HTML.Cookie.Set("menu",this.cookie)},
|
saveCookie: function () {HTML.Cookie.Set("menu",this.cookie)},
|
||||||
getCookie: function () {this.cookie = HTML.Cookie.Get("menu")}
|
getCookie: function () {this.cookie = HTML.Cookie.Get("menu")},
|
||||||
|
|
||||||
|
//
|
||||||
|
// Preload images so they show up with the menu
|
||||||
|
//
|
||||||
|
getImages: function () {
|
||||||
|
if (MENU.isMobile) {
|
||||||
|
var close = new Image();
|
||||||
|
close.src = MathJax.Ajax.fileURL(MathJax.OutputJax.imageDir+"/CloseX-31.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -354,7 +373,7 @@
|
||||||
menus[m].parentNode.removeChild(menus[m]);
|
menus[m].parentNode.removeChild(menus[m]);
|
||||||
m--;
|
m--;
|
||||||
}
|
}
|
||||||
if (this.Timer) {this.Timer(event,menu)}
|
if (this.Timer && !MENU.isMobile) {this.Timer(event,menu)}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Mouseout: function (event,menu) {
|
Mouseout: function (event,menu) {
|
||||||
|
@ -368,7 +387,7 @@
|
||||||
TouchEvent: function (event,menu,type) {
|
TouchEvent: function (event,menu,type) {
|
||||||
if (this !== ITEM.lastItem) {
|
if (this !== ITEM.lastItem) {
|
||||||
if (ITEM.lastMenu) {MENU.Event(event,ITEM.lastMenu,"Mouseout")}
|
if (ITEM.lastMenu) {MENU.Event(event,ITEM.lastMenu,"Mouseout")}
|
||||||
MENU.Event(event,menu,"Mouseover");
|
MENU.Event(event,menu,"Mouseover",true);
|
||||||
ITEM.lastItem = this; ITEM.lastMenu = menu;
|
ITEM.lastItem = this; ITEM.lastMenu = menu;
|
||||||
}
|
}
|
||||||
if (this.nativeTouch) {return null}
|
if (this.nativeTouch) {return null}
|
||||||
|
@ -429,18 +448,10 @@
|
||||||
event = {clientX: event.clientX, clientY: event.clientY}; // MSIE can't pass the event below
|
event = {clientX: event.clientX, clientY: event.clientY}; // MSIE can't pass the event below
|
||||||
this.timer = setTimeout(MathJax.Callback(["Mouseup",this,event,menu]),CONFIG.delay);
|
this.timer = setTimeout(MathJax.Callback(["Mouseup",this,event,menu]),CONFIG.delay);
|
||||||
},
|
},
|
||||||
Touchstart: function (event,menu) {
|
|
||||||
this.skipUp = !this.menu.posted;
|
|
||||||
return this.SUPER(arguments).Touchstart.apply(this,arguments);
|
|
||||||
},
|
|
||||||
Touchend: function (event,menu) {
|
Touchend: function (event,menu) {
|
||||||
var result = false;
|
var forceout = this.menu.posted;
|
||||||
if (!this.skipUp) {
|
var result = this.SUPER(arguments).Touchend.apply(this,arguments);
|
||||||
var forceout = this.menu.posted;
|
if (forceout) {this.Deactivate(menu); delete ITEM.lastItem; delete ITEM.lastMenu}
|
||||||
result = this.SUPER(arguments).Touchend.apply(this,arguments);
|
|
||||||
if (forceout) {this.Deactivate(menu); delete ITEM.lastItem; delete ITEM.lastMenu}
|
|
||||||
}
|
|
||||||
delete this.skipUp;
|
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
Mouseup: function (event,menu) {
|
Mouseup: function (event,menu) {
|
||||||
|
@ -861,7 +872,7 @@
|
||||||
if (settings.zoom === "Hover" || settings.zoom == "Click") {settings.zoom = "None"}
|
if (settings.zoom === "Hover" || settings.zoom == "Click") {settings.zoom = "None"}
|
||||||
trigger.items = trigger.items.slice(0,4);
|
trigger.items = trigger.items.slice(0,4);
|
||||||
|
|
||||||
if (navigator.appVersion.match(/ Android /)) {
|
if (navigator.appVersion.match(/[ (]Android[) ]/)) {
|
||||||
MathJax.Menu.ITEM.SUBMENU.Augment({marker: "\u00BB"});
|
MathJax.Menu.ITEM.SUBMENU.Augment({marker: "\u00BB"});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -871,6 +882,7 @@
|
||||||
|
|
||||||
MathJax.Callback.Queue(
|
MathJax.Callback.Queue(
|
||||||
["Styles",AJAX,CONFIG.styles],
|
["Styles",AJAX,CONFIG.styles],
|
||||||
|
["getImages",MENU],
|
||||||
["Post",HUB.Startup.signal,"MathMenu Ready"],
|
["Post",HUB.Startup.signal,"MathMenu Ready"],
|
||||||
["loadComplete",AJAX,"[MathJax]/extensions/MathMenu.js"]
|
["loadComplete",AJAX,"[MathJax]/extensions/MathMenu.js"]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user