Changeset 874 for trunk


Ignore:
Timestamp:
08/06/07 16:00:51 (12 years ago)
Author:
ray
Message:
  • added new hook 'onBeforeUnload' for firePluginEvent()
  • Equation plugin: preserve formula on reload in Mozilla
  • Equation plugin: updated ASCIIMathML.js
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/XinhaCore.js

    r873 r874  
    23262326    function() 
    23272327    { 
     2328      editor.firePluginEvent('onBeforeUnload'); 
    23282329      textarea.value = editor.outwardHtml(editor.getHTML()); 
    23292330      if (!Xinha.is_ie) 
  • trunk/plugins/Equation/ASCIIMathML.js

    r873 r874  
    1010This is a convenient and inexpensive solution for authoring MathML. 
    1111 
    12 Version 1.4.7 Aug 7, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen 
     12Version 1.4.7 Dec 15, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen 
    1313Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js 
    1414For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt 
    1515If you use it on a webpage, please send the URL to jipsen@chapman.edu 
    1616 
    17  This program is free software; you can redistribute it and/or modify 
    18  it under the terms of the GNU Lesser General Public License as published by 
    19  the Free Software Foundation; either version 2.1 of the License, or (at 
    20  your option) any later version. 
    21  
    22  This program is distributed in the hope that it will be useful,  
    23  but WITHOUT ANY WARRANTY; without even the implied warranty of 
    24  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
    25  Lesser General Public License (at http://www.gnu.org/licenses/lgpl.html)  
    26  for more details. 
    27   
    28  NOTE: I have changed the license from GPL to LGPL according to a permission  
    29  from the author (see http://xinha.gogo.co.nz/punbb/viewtopic.php?pid=4150#p4150) 
    30  Raimund Meyer 11-29-2006 
     17This program is free software; you can redistribute it and/or modify 
     18it under the terms of the GNU General Public License as published by 
     19the Free Software Foundation; either version 2 of the License, or (at 
     20your option) any later version. 
     21 
     22This program is distributed in the hope that it will be useful,  
     23but WITHOUT ANY WARRANTY; without even the implied warranty of 
     24MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
     25General Public License (at http://www.gnu.org/copyleft/gpl.html)  
     26for more details. 
    3127*/ 
    3228 
    3329var checkForMathML = true;   // check if browser can display MathML 
    3430var notifyIfNoMathML = true; // put note at top of page if no MathML capability 
    35  
     31var alertIfNoMathML = false;  // show alert box if no MathML capability 
    3632if ( typeof mathcolor == "undefined" ) 
    3733{ 
     
    194190{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST}, 
    195191{input:">-",  tag:"mo", output:"\u227B", tex:"succ", ttype:CONST}, 
     192{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST}, 
     193{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST}, 
    196194{input:"in",  tag:"mo", output:"\u2208", tex:null, ttype:CONST}, 
    197195{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST}, 
     
    449447    tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi"); 
    450448  } 
    451   if (st=="-" && AMpreviousSymbol==INFIX) 
     449  if (st=="-" && AMpreviousSymbol==INFIX) { 
     450    AMcurrentSymbol = INFIX;  //trick "/" into recognizing "-" on second parse 
    452451    return {input:st, tag:tagst, output:st, ttype:UNARY, func:true}; 
     452  } 
    453453  return {input:st, tag:tagst, output:st, ttype:CONST}; 
    454454} 
     
    540540      if (typeof symbol.func == "boolean" && symbol.func) { // functions hack 
    541541        st = str.charAt(0); 
    542         if (st=="^" || st=="_" || st=="/" || st=="|") { 
     542        if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") { 
    543543          return [AMcreateMmlNode(symbol.tag, 
    544544                    document.createTextNode(symbol.output)),str]; 
     
    617617    if (result[0].lastChild!=null) 
    618618      st = result[0].lastChild.firstChild.nodeValue; 
    619 //alert(result[0].lastChild+"***"+st); 
    620619    if (st == "|") { // its an absolute value subterm 
    621620      node = AMcreateMmlNode("mo",document.createTextNode(symbol.output)); 
     
    778777  node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false)[0]); 
    779778  node = AMcreateMmlNode("math",node); 
    780   if (showasciiformulaonhover) node.setAttribute("title",str); 
     779  if (showasciiformulaonhover)                      //fixed by djhsu so newline 
     780    node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko 
    781781  if (mathfontfamily != "" && (isIE || mathfontfamily != "serif")) { 
    782782    var fnode = AMcreateElementXHTML("font"); 
     
    839839          checkForMathML = false; 
    840840          var nd = AMisMathMLavailable(); 
    841           AMnoMathML = nd != null 
     841          AMnoMathML = nd != null; 
    842842          if (AMnoMathML && notifyIfNoMathML)  
    843             AMbody.insertBefore(nd,AMbody.childNodes[0]); 
     843            if (alertIfNoMathML) 
     844              alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\n\ 
     845                or Firefox/Mozilla/Netscape"); 
     846            else AMbody.insertBefore(nd,AMbody.childNodes[0]); 
    844847        } 
    845848        if (!AMnoMathML) { 
  • trunk/plugins/Equation/equation.js

    r873 r874  
    5656                                } 
    5757                        ); 
    58         this.onBeforeSubmit = function () {debugger;self.unParse();self.reParse = true}; 
     58        this.onBeforeSubmit = this.onBeforeUnload = function () {self.unParse();self.reParse = true}; 
    5959        } 
    6060         
     
    7474Equation._pluginInfo = { 
    7575        name          : "ASCIIMathML Formula Editor", 
    76         version       : "2.0", 
     76        version       : "2.1 (2007-08-06)", 
    7777        developer     : "Raimund Meyer", 
    7878        developer_url : "http://rheinaufCMS.de", 
     
    9595        if (!Xinha.is_ie && this.reParse) AMprocessNode(this.editor._doc.body, false); 
    9696}; 
     97 
    9798 
    9899Equation.prototype.onModeChange = function( args ) 
  • trunk/plugins/Equation/popups/dialog.html

    r859 r874  
    3838   window.resizeTo(500, 300); 
    3939var showasciiformulaonhover = false; 
    40 Xinha = window.opener.Xinha; 
     40if (typeof Xinha == "undefined") 
     41        Xinha = window.opener.Xinha; 
    4142 
    4243function i18n(str) { 
Note: See TracChangeset for help on using the changeset viewer.