[sagenb] 84/157: Restore Jmol/JSmol popup menu and legacy add cell behavior

felix salfelder felix-guest at moszumanska.debian.org
Mon Dec 22 16:51:54 UTC 2014


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository sagenb.

commit f9760a8635a63511731e340046711b1a7288de1c
Author: gutow <gutow at uwosh.edu>
Date:   Thu Apr 17 18:40:13 2014 -0500

    Restore Jmol/JSmol popup menu and legacy add cell behavior
    
    Javascript changes to restore legacy add cell behavior and avoid
    collisions between popup dialogs and Jmol/JSmol popup menu. Also updated
    menu to allow access to the Jmol/JSmol save file functions.
---
 sagenb/data/sage/css/main.css                      |  4 ++++
 sagenb/data/sage/html/notebook/base.html           | 16 +++++++++-------
 sagenb/data/sage/html/notebook/cell.html           | 10 +++++++++-
 sagenb/data/sage/html/notebook/worksheet_page.html | 11 +++++++++--
 sagenb/data/sage/js/jmol_lib.js                    | 11 +++++------
 sass/src/main.scss                                 |  8 +++++++-
 6 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/sagenb/data/sage/css/main.css b/sagenb/data/sage/css/main.css
index 58bb16d..d25c0da 100644
--- a/sagenb/data/sage/css/main.css
+++ b/sagenb/data/sage/css/main.css
@@ -483,6 +483,10 @@ a.file_link { text-decoration: underline; }
 
 /* line 968, ../../../../sass/src/main.scss */
 div.insert_new_cell { height: 16px; display: block; margin: 3px; }
+div.insert_new_cell:hover{background-color:cyan;}
+div.legacy_insert_new_cell {height:13px; display:inline-block; width:95%;}
+div.legacy_insert_new_cell:hover{background-color:cyan;}
+
 /* line 974 */
 div.wksht-icon_button {display:inline-block;}
 
diff --git a/sagenb/data/sage/html/notebook/base.html b/sagenb/data/sage/html/notebook/base.html
index 7926f31..42aa366 100644
--- a/sagenb/data/sage/html/notebook/base.html
+++ b/sagenb/data/sage/html/notebook/base.html
@@ -13,18 +13,13 @@ INPUT:
 
 
 {% block javascript %}
-<!-- Jmol - embedded 3D graphics **needs to be before jquery plugin loads, maybe?**-->
-<script type="text/javascript" src="/jsmol/JSmol.min.js"></script>
-<script type="text/javascript" src="/jsmol/js/Jmol2.js"></script>
-<!-- This must stay in head -->
-<script>//jmolInitialize("/java/jmol");
-//jmolSetCallback("menuFile","/java/jmol/appletweb/SageMenu.mnu");
-</script>
+
 <!-- trying to work around JSmol collisions with jquery--->
 <script type="text/javascript" src="/javascript/jquery/jquery-1.11.0.min.js"></script>
 <!-- jQuery UI - interacts, widgets, drag-drop, etc. -->
 <link rel="stylesheet" href="/javascript/jqueryui/css/sage/jquery-ui-1.10.4.custom.css" />
 <script type="text/javascript" src="/javascript/jqueryui/js/jquery-ui-1.10.4.custom.min.js"></script>
+
 <!-- jQuery plugins - color pickers, shift-click, AJAX forms, IE fixes, notifications -->
 <link rel="stylesheet" href="/javascript/jquery/plugins/farbtastic/farbtastic.css" type="text/css" />
 <script type="text/javascript" src="/javascript/jquery/plugins/farbtastic/farbtastic.min.js"></script>
@@ -48,6 +43,13 @@ INPUT:
 <script type="text/javascript" src="/javascript/mathjax/MathJax.js?config=TeX-AMS_HTML-full,../../dynamic/mathjax_sage.js"></script>
 {% endif %}
 
+<!-- Jmol - embedded 3D graphics **needs to be before jquery plugin loads, maybe?**-->
+<script type="text/javascript" src="/jsmol/JSmol.min.nojq.js"></script>
+<script type="text/javascript" src="/jsmol/js/Jmol2.js"></script>
+<!-- This must stay in head -->
+<script>//jmolInitialize("/java/jmol");
+//jmolSetCallback("menuFile","/java/jmol/appletweb/SageMenu.mnu");
+</script>
 
 <!-- Sage3d - accelerated 3D graphics -->
 <script type="text/javascript" src="/javascript/sage3d/sage3d.js"></script>
diff --git a/sagenb/data/sage/html/notebook/cell.html b/sagenb/data/sage/html/notebook/cell.html
index 5433b2d..6105e64 100644
--- a/sagenb/data/sage/html/notebook/cell.html
+++ b/sagenb/data/sage/html/notebook/cell.html
@@ -36,15 +36,23 @@ INPUT:
               <div class="ui-icon ui-icon-comment wksht-icon_button" 
                 id="insert_new_text_cell_before{{ cell.id() }}"
                  title="{{ gettext('Click to insert new rich-text cell.') }}"></div>
+              <div class="legacy_insert_new_cell" id="legacy_new_cell_before{{ cell.id() }}"></div>
             </div>
             <script type="text/javascript">
+                {% if not cell.worksheet().docbrowser() %}
                 $("#insert_new_compute_cell_before{{ cell.id() }}").bind("click",function (e) {
                     insert_new_cell_before({{ '%r'|format(cell.id()) }});
                 });
-                {% if not cell.worksheet().docbrowser() %}
                 $("#insert_new_text_cell_before{{ cell.id() }}").bind("click",function (e) {
                    insert_new_text_cell_before({{ '%r'|format(cell.id()) }});
                 });
+                $("#legacy_new_cell_before{{ cell.id() }}").bind("click",function (e) {
+                   if (e.shiftKey){
+                      insert_new_text_cell_before({{ '%r'|format(cell.id()) }});
+                   } else {
+                      insert_new_cell_before({{ '%r'|format(cell.id()) }});
+                   }
+                });
                 {% endif %}
             </script>
         {% endif %}
diff --git a/sagenb/data/sage/html/notebook/worksheet_page.html b/sagenb/data/sage/html/notebook/worksheet_page.html
index db72b59..fc93e4c 100644
--- a/sagenb/data/sage/html/notebook/worksheet_page.html
+++ b/sagenb/data/sage/html/notebook/worksheet_page.html
@@ -20,6 +20,7 @@ INPUT:
         <div class="ui-icon ui-icon-comment wksht-icon_button" 
             id="insert_new_last_text_cell"
             title="{{ gettext('Click to insert new rich-text cell.') }}"></div>
+        <div class="legacy_insert_new_cell" id="legacy_new_last_cell"></div>
     </div>  
     <script type="text/javascript">
         state_number = {{ worksheet.state_number() }};
@@ -36,15 +37,21 @@ INPUT:
                 rename_worksheet();
             }
          });
-
+        {% if not worksheet.docbrowser() %}
         $("#insert_new_last_compute_cell").bind("click", function (e) {
             insert_new_cell_after(cell_id_list[cell_id_list.length - 1]);
         });
     
-        {% if not worksheet.docbrowser() %}
         $("#insert_new_last_text_cell").bind("click", function (e) {
             insert_new_text_cell_after(cell_id_list[cell_id_list.length - 1]);
         });
+        $("#legacy_new_last_cell").bind("click",function (e) {
+            if (e.shiftKey){
+                insert_new_text_cell_after(cell_id_list[cell_id_list.length - 1]);
+            } else {
+                insert_new_cell_after(cell_id_list[cell_id_list.length - 1]);
+            }
+         });
         {% endif %}
     </script>
 </div>
diff --git a/sagenb/data/sage/js/jmol_lib.js b/sagenb/data/sage/js/jmol_lib.js
index 050a270..081b9ae 100644
--- a/sagenb/data/sage/js/jmol_lib.js
+++ b/sagenb/data/sage/js/jmol_lib.js
@@ -4,9 +4,6 @@
   Jonathan Gutow <gutow at uwosh.edu> February 2014 
 */
 
-//This probably needs to be in header of pages that might use jmol
-//Jmol.setDocument(document);  //will try in jmol_applet code.
-
 var jmolApplet; //our generic viewer.
 
 var live_3D_state = false;
@@ -33,7 +30,8 @@ var jmolInfo = { //default values
     //disableJ2SLoadMonitor: true,
     disableInitialConsole: true,
     readyFunction:'',//jmol_isReady,
-    script: ""
+    script: "",
+    menuFile: "/java/jmol/appletweb/SageMenu.mnu" //special sagemenu
 }
 
 jmol_isReady = function(jmolApplet) {
@@ -106,6 +104,7 @@ function jmol_applet(size, image, url, cell_num, functionnames) { //makes a new
     //jmolStatus.cntrls[appletID]=cntrlPanels;
 //Now we wait for the server by calling a function that waits if the div is not yet written.
 //    launchNewJmol(size,scriptStr,appletID);
+    Jmol.script("load menu "+jmolStatus.jmolInfo[appletID].menuFile);
     return jmolDivStr;//for historical compatibility
     }
 
@@ -121,7 +120,7 @@ function jmolActivator(){
         img = $(parentdiv).children("#sage_jmol_img"+cell_num).html();
         script = $(parentdiv).children("#sage_jmol_script"+cell_num).html();
         tmpdiv = jmol_applet(size, img, script, cell_num);
-        $(parentdiv).children("#sage_jmol_status"+cell_num).html() = "Activated";
+        $(parentdiv).children("#sage_jmol_status"+cell_num).html("Activated");
     }
 }
 
@@ -129,7 +128,7 @@ function live_3D_check(s) {
     /*
     Send a message back to the server either turn live_3D on of off.
     INPUT:
-        s -- boolean; whether the pretty print box is checked.
+        s -- boolean; whether the live 3D box is checked.
     */
     live_3D_state =s;
     //alert ('live_3D_state:'+live_3D_state);
diff --git a/sass/src/main.scss b/sass/src/main.scss
index a86814b..a7380fa 100644
--- a/sass/src/main.scss
+++ b/sass/src/main.scss
@@ -970,7 +970,13 @@ div {
     display: block;
     margin: 3px;
   &.wksht-icon_button {
-    display:inline-block;}}
+    display:inline-block;}
+    &:hover {background-color:cyan;}
+  &.legacy_insert_new_cell{
+    height: 13px;
+    width: 95%;
+    display: inline-block;
+    &:hover{background-color:cyan;}}
 
 a {
   &.worksheetname {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git



More information about the debian-science-commits mailing list