Merge branch 'master' of git.evergreen-ils.org:Evergreen into social
[evergreen-equinox.git] / Open-ILS / xul / staff_client / server / OpenILS / symbol_overlay.js
diff --git a/Open-ILS/xul/staff_client/server/OpenILS/symbol_overlay.js b/Open-ILS/xul/staff_client/server/OpenILS/symbol_overlay.js
new file mode 100644 (file)
index 0000000..f84a702
--- /dev/null
@@ -0,0 +1,37 @@
+dump('entering symbol/clipboard.js\n');
+
+function $(id) { return document.getElementById(id); }
+
+var el = {};
+
+dojo.addOnLoad(
+    function(){
+        dojo.query('.plain').forEach(function(node,index,arr){
+            node.addEventListener("keypress", function(event) { 
+                if (event.charCode == 115 && event.ctrlKey){
+                        setNod(node);
+                        $('symbol-panel').openPopup(node, 'after_pointer' );
+                    }
+                 }, true);
+        });
+    }
+);
+
+function setNod(elm){
+    el = elm;
+}
+
+function ret(ins, e){
+    if (e.button == 0){
+        $('symbol-panel').hidePopup();
+        n = el;
+        
+        if (n.getAttribute('readonly')=='true') return;
+        
+        var v = n.value;
+        var start = n.selectionStart;
+        var end = n.selectionEnd;
+        n.value = v.substring(0, start) + ins + v.substring(end, v.length);
+        n.setSelectionRange(start + ins.length,start + ins.length);
+    }
+}