Add onclick handler to make href's work in all browsers in SVG mode. Resolves issue #297.
This commit is contained in:
parent
037e5eb895
commit
b58c667f8b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,5 @@
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MathJax.OutputJax.SVG=MathJax.OutputJax({id:"SVG",version:"2.0.7",directory:MathJax.OutputJax.directory+"/SVG",extensionDir:MathJax.OutputJax.extensionDir+"/SVG",autoloadDir:MathJax.OutputJax.directory+"/SVG/autoload",fontDir:MathJax.OutputJax.directory+"/SVG/fonts",config:{scale:100,minScaleAdjust:50,font:"TeX",blacker:10,mtextFontInherit:false,undefinedFamily:"STIXGeneral,'Arial Unicode MS',serif",addMMLclasses:false,EqnChunk:(MathJax.Hub.Browser.isMobile?10:50),EqnChunkFactor:1.5,EqnChunkDelay:100,linebreaks:{automatic:false,width:"container"},styles:{".MathJax_SVG_Display":{"text-align":"center",margin:"1em 0em"},"#MathJax_SVG_Tooltip":{"background-color":"InfoBackground",color:"InfoText",border:"1px solid black","box-shadow":"2px 2px 5px #AAAAAA","-webkit-box-shadow":"2px 2px 5px #AAAAAA","-moz-box-shadow":"2px 2px 5px #AAAAAA","-khtml-box-shadow":"2px 2px 5px #AAAAAA",padding:"3px 4px"}}}});if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax.SVG.Register("jax/mml")}MathJax.OutputJax.SVG.loadComplete("config.js");
|
MathJax.OutputJax.SVG=MathJax.OutputJax({id:"SVG",version:"2.0.8",directory:MathJax.OutputJax.directory+"/SVG",extensionDir:MathJax.OutputJax.extensionDir+"/SVG",autoloadDir:MathJax.OutputJax.directory+"/SVG/autoload",fontDir:MathJax.OutputJax.directory+"/SVG/fonts",config:{scale:100,minScaleAdjust:50,font:"TeX",blacker:10,mtextFontInherit:false,undefinedFamily:"STIXGeneral,'Arial Unicode MS',serif",addMMLclasses:false,EqnChunk:(MathJax.Hub.Browser.isMobile?10:50),EqnChunkFactor:1.5,EqnChunkDelay:100,linebreaks:{automatic:false,width:"container"},styles:{".MathJax_SVG_Display":{"text-align":"center",margin:"1em 0em"},"#MathJax_SVG_Tooltip":{"background-color":"InfoBackground",color:"InfoText",border:"1px solid black","box-shadow":"2px 2px 5px #AAAAAA","-webkit-box-shadow":"2px 2px 5px #AAAAAA","-moz-box-shadow":"2px 2px 5px #AAAAAA","-khtml-box-shadow":"2px 2px 5px #AAAAAA",padding:"3px 4px"}}}});if(!MathJax.Hub.config.delayJaxRegistration){MathJax.OutputJax.SVG.Register("jax/mml")}MathJax.OutputJax.SVG.loadComplete("config.js");
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
MathJax.OutputJax.SVG = MathJax.OutputJax({
|
MathJax.OutputJax.SVG = MathJax.OutputJax({
|
||||||
id: "SVG",
|
id: "SVG",
|
||||||
version: "2.0.7",
|
version: "2.0.8",
|
||||||
directory: MathJax.OutputJax.directory + "/SVG",
|
directory: MathJax.OutputJax.directory + "/SVG",
|
||||||
extensionDir: MathJax.OutputJax.extensionDir + "/SVG",
|
extensionDir: MathJax.OutputJax.extensionDir + "/SVG",
|
||||||
autoloadDir: MathJax.OutputJax.directory + "/SVG/autoload",
|
autoloadDir: MathJax.OutputJax.directory + "/SVG/autoload",
|
||||||
|
|
|
@ -57,6 +57,10 @@
|
||||||
display: "block",
|
display: "block",
|
||||||
width: "100%"
|
width: "100%"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
".MathJax_SVG svg a > g, .MathJax_SVG_Display svg a > g": {
|
||||||
|
fill: "blue", stroke: "blue"
|
||||||
|
},
|
||||||
|
|
||||||
".MathJax_SVG_Processing": {
|
".MathJax_SVG_Processing": {
|
||||||
visibility: "hidden", position:"absolute", top:0, left:0,
|
visibility: "hidden", position:"absolute", top:0, left:0,
|
||||||
|
@ -995,8 +999,9 @@
|
||||||
if (this.href) {
|
if (this.href) {
|
||||||
var a = SVG.Element("a");
|
var a = SVG.Element("a");
|
||||||
a.setAttributeNS(XLINKNS,"href",this.href);
|
a.setAttributeNS(XLINKNS,"href",this.href);
|
||||||
|
a.onclick = this.SVGlink;
|
||||||
SVG.addElement(a,"rect",{width:svg.w, height:svg.h+svg.d, y:-svg.d,
|
SVG.addElement(a,"rect",{width:svg.w, height:svg.h+svg.d, y:-svg.d,
|
||||||
fill:"none", stroke:"none", "pointer-events":"all"});
|
fill:"none", stroke:"none", "pointer-events":"all"});
|
||||||
if (svg.type === "svg") {
|
if (svg.type === "svg") {
|
||||||
// for svg element, put <a> inside the main <g> element
|
// for svg element, put <a> inside the main <g> element
|
||||||
var g = svg.element.firstChild;
|
var g = svg.element.firstChild;
|
||||||
|
@ -1023,6 +1028,22 @@
|
||||||
if (svg.removeable) {svg.removeable = svg.element.style.cssText === ""}
|
if (svg.removeable) {svg.removeable = svg.element.style.cssText === ""}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//
|
||||||
|
// WebKit currently scrolls to the BOTTOM of an svg element if it contains the
|
||||||
|
// target of the link, so implement link by hand, to the containing span element.
|
||||||
|
//
|
||||||
|
SVGlink: function () {
|
||||||
|
var href = this.href.animVal;
|
||||||
|
if (href.charAt(0) === "#") {
|
||||||
|
var link = document.getElementById(href.substr(1));
|
||||||
|
if (link && link.nodeName === "g") {
|
||||||
|
do {link = link.parentNode} while (link && link.nodeName !== "svg");
|
||||||
|
if (link && link.parentNode && link.parentNode.scrollIntoView)
|
||||||
|
{setTimeout(function () {link.parentNode.scrollIntoView(true)},1)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.location = href;
|
||||||
|
},
|
||||||
|
|
||||||
SVGgetStyles: function () {
|
SVGgetStyles: function () {
|
||||||
if (this.style) {
|
if (this.style) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user