From e44a7e37b6c7b5961adaffc62b9042b8d442938e Mon Sep 17 00:00:00 2001 From: mensonge Date: Thu, 13 Nov 2008 09:49:11 +0000 Subject: New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f --- includes/js/dojo/dnd/common.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 includes/js/dojo/dnd/common.js (limited to 'includes/js/dojo/dnd/common.js') diff --git a/includes/js/dojo/dnd/common.js b/includes/js/dojo/dnd/common.js new file mode 100644 index 0000000..79e7679 --- /dev/null +++ b/includes/js/dojo/dnd/common.js @@ -0,0 +1,35 @@ +if(!dojo._hasResource["dojo.dnd.common"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojo.dnd.common"] = true; +dojo.provide("dojo.dnd.common"); + +dojo.dnd._copyKey = navigator.appVersion.indexOf("Macintosh") < 0 ? "ctrlKey" : "metaKey"; + +dojo.dnd.getCopyKeyState = function(e) { + // summary: abstracts away the difference between selection on Mac and PC, + // and returns the state of the "copy" key to be pressed. + // e: Event: mouse event + return e[dojo.dnd._copyKey]; // Boolean +}; + +dojo.dnd._uniqueId = 0; +dojo.dnd.getUniqueId = function(){ + // summary: returns a unique string for use with any DOM element + var id; + do{ + id = dojo._scopeName + "Unique" + (++dojo.dnd._uniqueId); + }while(dojo.byId(id)); + return id; +}; + +dojo.dnd._empty = {}; + +dojo.dnd.isFormElement = function(/*Event*/ e){ + // summary: returns true, if user clicked on a form element + var t = e.target; + if(t.nodeType == 3 /*TEXT_NODE*/){ + t = t.parentNode; + } + return " button textarea input select option ".indexOf(" " + t.tagName.toLowerCase() + " ") >= 0; // Boolean +}; + +} -- cgit v1.2.3