Ticket #9238: trac_9238_nice_IE_warnings.patch

File trac_9238_nice_IE_warnings.patch, 7.9 KB (added by gutow, 10 years ago)

Nice warnings for IE

  • sagenb/data/sage/js/jmol_lib.js

    # HG changeset patch
    # User Jonathan H. Gutow <gutow@uwosh.edu
    # Date 1301596734 18000
    # Node ID 21bb9d54abe03d0760a29762af110046a656b797
    # Parent  b99b8a67742b1ec0139e1166005730eb25da4911
    Trac 9238 - nice warnings for IE
    
    diff -r b99b8a67742b -r 21bb9d54abe0 sagenb/data/sage/js/jmol_lib.js
    a b  
    66        not have to extract any Jmol.js funtions and turn them into strings anymore. Also
    77        code cleanup and changes to accommodate vocabulary changes in the file created by
    88        SAGE.
     9version 1.1.6 4/2/11 - updates to asynchronous load to avoid memory problems with
     10    worksheets that have lots of applets in them.  Added warnings and special code
     11    for particular browser/OS combinations.  Problem systems FF/MacOS (intermittent),
     12    Safari/MacOS (memory leak? workaround included), IE8/WinXP (many features just
     13    do nothing, IE9/Win7 not tested yet).
    914       
    1015        This version limits the number of Jmol applets that may simultaneously be live
    11         on a page.  The default is 5.  This may be set by calling setMaxLiveJmol.
     16        on a page.  The default is 4.  This may be set by calling setMaxLiveJmol.
    1217
    13         This version places the applet in a div within a table.  The applet is resized to specific
    14         sizes other approaches seem to run amok of the updates from the server.  The default
    15         sizes are miniature (100 x 100 px), small (250 x 250 px), medium (400 x 400 px)
    16         and large (600 x 600 px) choices.   User may choose a random size by using the
    17         "open in separate window" option.
    1818        NOTE THIS VERSION IGNORES THE SIZE AS SPECIFIED BY THE SAGE NOTEBOOK CODE.
    1919
    20         This version also allows turning on and off surfaces and meshes.  Color of
    21         the surfaces and meshes may also be controlled.  Developed with Jmol version 11.9.
     20    This version also allows turning on and off surfaces and meshes.  Color of
     21    the surfaces and meshes may also be controlled.  Developed with Jmol version 11.9.
    2222        Recommend using Jmol version 12.0.35 or greater.
    2323
    24         Things to do:
    25         at present it is using the script saved in the JmolStatus structure to avoid problems
    26         with the scrolling div added to the applet tab.
    27         fix in new window to cleanly use script in JmolStatus structure
    28         make settings save with worksheet.
    29 
    3024REQUIRES:
    3125Jmol.js
    3226        path must be specified in the <head> of the page: use jmolInitialize(path), where
     
    9690    }
    9791    if (_jmol.os =="win"){
    9892        if (_jmol.browser=="msie"){
    99             alert("You are using Internet Explorer.  No advance 3-D viewing functions work.  FireFox or Chrome browswers are recommended.");
     93            alert("Many of the advanced 3-D viewing functions DO NOT work in Internet Explorer.  Until this is fixed please use FireFox or Chrome browsers which do work.");
    10094        }
    10195    }
    10296}
    10397
     98function toggling_button(element){//uses the jqueryui to toggle the element onoff.
     99    //necessary because IE doesn't interpret the standard form correctly in a button element.  THIS DIDN'T HELP!
     100    $('#'+element).toggle();
     101}
     102
    104103function jmol_pulldown(theform) {
    105104    /*
    106105    This is called when the user selects a menu item.  This just
     
    361360    Id = 'Jmol'+n;
    362361    tableId = 'Jmol_Table_'+Id;
    363362    tableStr = '<table id="'+tableId+'" border="1"><tr><td id="'+tableId+'_cell_0_0">';
    364         if (controlStr!='') {
    365             tableStr+='<div id=\'Adv_but_'+Id+'\'><button onClick="javascript:void($(\'#'+tableId+'_cell_0_1\').toggle())">Toggle Advanced Controls</button></div>';
    366             }   
     363        if (controlStr!='') {
     364            if(_jmol.browser=="msie"){//nothing until figure out how to get working...
     365                //tableStr+='<div id=\'Adv_but_'+Id+'\'><a onClick="$(\'#'+tableId+'_cell_0_1\').toggle()">Toggle Advanced Controls</a></div>';
     366            }else{
     367                tableStr+='<div id=\'Adv_but_'+Id+'\'><button onClick="javascript:void(toggling_button(\''+tableId+'_cell_0_1\'))">Toggle Advanced Controls</button></div>';
     368            }
     369        }
    367370    tableStr +='<div id = '+Id+'>';
    368371    tableStr += 'Loading Jmol 3-D viewer...</div>'; 
    369372            tableStr+='</td>';
    370373    if (controlStr!=''){
    371             tempCntrlStr ='<button onClick="javascript:void(sleepJmol('+n+',jmolStatus))">'+sleepMessage+'</button>';
    372         tempCntrlStr += '<button onClick="javascript:void(jmol_help())">Help for Jmol 3-D viewer</button>'+controlStr;
    373         tableStr += '<td id="'+tableId+'_cell_0_1" style="display:none;">'+tempCntrlStr+'</td>';
    374             }
     374        var tempCntrlStr='';
     375        if(_jmol.browser=="msie"){
     376            tempCntrlStr +='<a href="javascript:sleepJmol('+n+',jmolStatus);">'+sleepMessage+'</a><br/>';
     377            tempCntrlStr += '<a href="javascript:jmol_help();">Help for Jmol 3-D viewer</a>'+controlStr;
     378        }else{
     379            tempCntrlStr +='<button onClick="sleepJmol('+n+',jmolStatus)">'+sleepMessage+'</button>';
     380            tempCntrlStr += '<button onClick="jmol_help()">Help for Jmol 3-D viewer</button>'+controlStr;
     381        }
     382        if (_jmol.browser=="msie"){
     383            tableStr += '<td id="'+tableId+'_cell_0_1">'+tempCntrlStr+'</td>';
     384        }else{
     385            tableStr += '<td id="'+tableId+'_cell_0_1" style="display:none;">'+tempCntrlStr+'</td>';
     386        }
     387    }
    375388    tableStr += '</tr>';
    376389    if (captionStr !=''){
    377390            tableStr +='<tr><td>'+captionStr+'</td></tr>';
     
    784797        //alert("Have got the picture and updated the state before sleeping #"+n);
    785798        //Different browsers pass different versions of null and undefined.
    786799        if(jmolStatus.pictureStrs[n]=="null"||jmolStatus.pictureStrs[n]==""||jmolStatus.pictureStrs[n]==undefined||jmolStatus.pictureStrs[n]==null||jmolStatus.pictureStrs[n]=="undefined"){//don't have a picture put up text instead
    787             get_element("Jmol"+n).innerHTML = 'Sleeping...<br/>Static plot unavailable. <br/>  <button onClick="javascript:void(wakeJmol('+n+',jmolStatus))">Make Interactive</button> to get live plot.';
    788                 }else{
     800            if(_jmol.browser=="msie"){
     801                get_element("Jmol"+n).innerHTML = 'Sleeping...<br/>Static plot unavailable. <br/>  <a href="javascript:wakeJmol('+n+',jmolStatus);">Make Interactive</a> to get live plot.';
     802
     803            }else{
     804                get_element("Jmol"+n).innerHTML = 'Sleeping...<br/>Static plot unavailable. <br/>  <button onClick="javascript:void(wakeJmol('+n+',jmolStatus))">Make Interactive</button> to get live plot.';
     805                }
     806            }else{
    789807                var imageID = 'Jmol_Image'+n;
    790808                //The below does not work with Safari, doesn't show alternate text when no image data.
    791809                var imageStr = '<image id='+imageID+' alt="If no plot appears here click Wake Up" src="data:image/jpeg;base64, ' + jmolStatus.pictureStrs[n] + '">';
    792                 get_element("Jmol"+n).innerHTML = 'Sleeping...<button onClick="javascript:void(wakeJmol('+n+',jmolStatus))">Make Interactive</button><br/>'+imageStr;
    793            }
     810            if(_jmol.browser=="msie"){
     811                get_element("Jmol"+n).innerHTML = 'Sleeping...<a href="javascript:wakeJmol('+n+',jmolStatus);">Make Interactive</a><br/>'+imageStr;
     812            }else{
     813                get_element("Jmol"+n).innerHTML = 'Sleeping...<button onClick="javascript:void(wakeJmol('+n+',jmolStatus))">Make Interactive</button><br/>'+imageStr;
     814                }
     815                }
    794816        jmolStatus.jmolArray[n]=1; //we've turned it off
     817        if(_jmol.browser!="msie"){
    795818        //make sure the controls that only work with live Jmol are hidden
    796         var cellID = 'Jmol_Table_Jmol'+n+'_cell_0_1';
    797         get_element(cellID).setAttribute("style","display: none;");
    798         var togname = '#Adv_but_Jmol'+n;
    799         $(togname).toggle();       
     819            var cellID = 'Jmol_Table_Jmol'+n+'_cell_0_1';
     820            get_element(cellID).setAttribute("style","display: none;");
     821            var togname = '#Adv_but_Jmol'+n;
     822            $(togname).toggle();
     823        }
    800824            jmol_numLiveUpdate();
    801825       }
    802826    }