Add menu signals for post/unpost and activation of menu items
This commit is contained in:
parent
6aec9ae573
commit
51c0a95f46
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
|
@ -26,7 +26,12 @@
|
|||
(function (HUB,HTML,AJAX,CALLBACK,OUTPUT) {
|
||||
var VERSION = "1.1.9";
|
||||
|
||||
MathJax.Extension.MathMenu = {version: VERSION};
|
||||
var SIGNAL = MathJax.Callback.Signal("menu") // signal for menu events
|
||||
|
||||
MathJax.Extension.MathMenu = {
|
||||
version: VERSION,
|
||||
signal: SIGNAL
|
||||
};
|
||||
|
||||
var isPC = HUB.Browser.isPC, isMSIE = HUB.Browser.isMSIE;
|
||||
var ROUND = (isPC ? null : "5px");
|
||||
|
@ -172,6 +177,7 @@
|
|||
div = MENU.Background(this);
|
||||
delete ITEM.lastItem; delete ITEM.lastMenu;
|
||||
delete MENU.skipUp;
|
||||
SIGNAL.Post(["post",MENU.jax]);
|
||||
}
|
||||
var menu = HTML.addElement(div,"div",{
|
||||
onmouseup: MENU.Mouseup, ondblclick: FALSE,
|
||||
|
@ -227,6 +233,7 @@
|
|||
* Remove the menu from the screen
|
||||
*/
|
||||
Remove: function (event,menu) {
|
||||
SIGNAL.Post(["unpost",MENU.jax]);
|
||||
var div = document.getElementById("MathJax_MenuFrame");
|
||||
if (div) {
|
||||
div.parentNode.removeChild(div);
|
||||
|
@ -419,7 +426,11 @@
|
|||
|
||||
Label: function (def,menu) {return [this.name]},
|
||||
Mouseup: function (event,menu) {
|
||||
if (!this.disabled) {this.Remove(event,menu); this.action.call(this,event);}
|
||||
if (!this.disabled) {
|
||||
this.Remove(event,menu);
|
||||
SIGNAL.Post(["command",this]);
|
||||
this.action.call(this,event);
|
||||
}
|
||||
return FALSE(event);
|
||||
}
|
||||
});
|
||||
|
@ -501,6 +512,7 @@
|
|||
menu.firstChild.display = "";
|
||||
CONFIG.settings[this.variable] = this.value;
|
||||
MENU.cookie[this.variable] = CONFIG.settings[this.variable]; MENU.saveCookie();
|
||||
SIGNAL.Post(["radio button",this]);
|
||||
if (this.action) {this.action.call(MENU)}
|
||||
}
|
||||
this.Remove(event,menu);
|
||||
|
@ -529,6 +541,7 @@
|
|||
menu.firstChild.display = (CONFIG.settings[this.variable] ? "none" : "");
|
||||
CONFIG.settings[this.variable] = !CONFIG.settings[this.variable];
|
||||
MENU.cookie[this.variable] = CONFIG.settings[this.variable]; MENU.saveCookie();
|
||||
SIGNAL.Post(["checkbox",this]);
|
||||
if (this.action) {this.action.call(MENU)}
|
||||
}
|
||||
this.Remove(event,menu);
|
||||
|
|
Loading…
Reference in New Issue
Block a user