diff options
Diffstat (limited to 'includes/js/dijit/_base/typematic.js')
-rw-r--r-- | includes/js/dijit/_base/typematic.js | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/includes/js/dijit/_base/typematic.js b/includes/js/dijit/_base/typematic.js deleted file mode 100644 index 9500839..0000000 --- a/includes/js/dijit/_base/typematic.js +++ /dev/null @@ -1,139 +0,0 @@ -if(!dojo._hasResource["dijit._base.typematic"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dijit._base.typematic"] = true; -dojo.provide("dijit._base.typematic"); - -dijit.typematic = { - // summary: - // These functions are used to repetitively call a user specified callback - // method when a specific key or mouse click over a specific DOM node is - // held down for a specific amount of time. - // Only 1 such event is allowed to occur on the browser page at 1 time. - - _fireEventAndReload: function(){ - this._timer = null; - this._callback(++this._count, this._node, this._evt); - this._currentTimeout = (this._currentTimeout < 0) ? this._initialDelay : ((this._subsequentDelay > 1) ? this._subsequentDelay : Math.round(this._currentTimeout * this._subsequentDelay)); - this._timer = setTimeout(dojo.hitch(this, "_fireEventAndReload"), this._currentTimeout); - }, - - trigger: function(/*Event*/ evt, /* Object */ _this, /*DOMNode*/ node, /* Function */ callback, /* Object */ obj, /* Number */ subsequentDelay, /* Number */ initialDelay){ - // summary: - // Start a timed, repeating callback sequence. - // If already started, the function call is ignored. - // This method is not normally called by the user but can be - // when the normal listener code is insufficient. - // Parameters: - // evt: key or mouse event object to pass to the user callback - // _this: pointer to the user's widget space. - // node: the DOM node object to pass the the callback function - // callback: function to call until the sequence is stopped called with 3 parameters: - // count: integer representing number of repeated calls (0..n) with -1 indicating the iteration has stopped - // node: the DOM node object passed in - // evt: key or mouse event object - // obj: user space object used to uniquely identify each typematic sequence - // subsequentDelay: if > 1, the number of milliseconds until the 3->n events occur - // or else the fractional time multiplier for the next event's delay, default=0.9 - // initialDelay: the number of milliseconds until the 2nd event occurs, default=500ms - if(obj != this._obj){ - this.stop(); - this._initialDelay = initialDelay || 500; - this._subsequentDelay = subsequentDelay || 0.90; - this._obj = obj; - this._evt = evt; - this._node = node; - this._currentTimeout = -1; - this._count = -1; - this._callback = dojo.hitch(_this, callback); - this._fireEventAndReload(); - } - }, - - stop: function(){ - // summary: - // Stop an ongoing timed, repeating callback sequence. - if(this._timer){ - clearTimeout(this._timer); - this._timer = null; - } - if(this._obj){ - this._callback(-1, this._node, this._evt); - this._obj = null; - } - }, - - addKeyListener: function(/*DOMNode*/ node, /*Object*/ keyObject, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay){ - // summary: Start listening for a specific typematic key. - // keyObject: an object defining the key to listen for. - // key: (mandatory) the keyCode (number) or character (string) to listen for. - // ctrlKey: desired ctrl key state to initiate the calback sequence: - // pressed (true) - // released (false) - // either (unspecified) - // altKey: same as ctrlKey but for the alt key - // shiftKey: same as ctrlKey but for the shift key - // See the trigger method for other parameters. - // Returns an array of dojo.connect handles - return [ - dojo.connect(node, "onkeypress", this, function(evt){ - if(evt.keyCode == keyObject.keyCode && (!keyObject.charCode || keyObject.charCode == evt.charCode) && - (keyObject.ctrlKey === undefined || keyObject.ctrlKey == evt.ctrlKey) && - (keyObject.altKey === undefined || keyObject.altKey == evt.ctrlKey) && - (keyObject.shiftKey === undefined || keyObject.shiftKey == evt.ctrlKey)){ - dojo.stopEvent(evt); - dijit.typematic.trigger(keyObject, _this, node, callback, keyObject, subsequentDelay, initialDelay); - }else if(dijit.typematic._obj == keyObject){ - dijit.typematic.stop(); - } - }), - dojo.connect(node, "onkeyup", this, function(evt){ - if(dijit.typematic._obj == keyObject){ - dijit.typematic.stop(); - } - }) - ]; - }, - - addMouseListener: function(/*DOMNode*/ node, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay){ - // summary: Start listening for a typematic mouse click. - // See the trigger method for other parameters. - // Returns an array of dojo.connect handles - var dc = dojo.connect; - return [ - dc(node, "mousedown", this, function(evt){ - dojo.stopEvent(evt); - dijit.typematic.trigger(evt, _this, node, callback, node, subsequentDelay, initialDelay); - }), - dc(node, "mouseup", this, function(evt){ - dojo.stopEvent(evt); - dijit.typematic.stop(); - }), - dc(node, "mouseout", this, function(evt){ - dojo.stopEvent(evt); - dijit.typematic.stop(); - }), - dc(node, "mousemove", this, function(evt){ - dojo.stopEvent(evt); - }), - dc(node, "dblclick", this, function(evt){ - dojo.stopEvent(evt); - if(dojo.isIE){ - dijit.typematic.trigger(evt, _this, node, callback, node, subsequentDelay, initialDelay); - setTimeout(dojo.hitch(this, dijit.typematic.stop), 50); - } - }) - ]; - }, - - addListener: function(/*Node*/ mouseNode, /*Node*/ keyNode, /*Object*/ keyObject, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay){ - // summary: Start listening for a specific typematic key and mouseclick. - // This is a thin wrapper to addKeyListener and addMouseListener. - // mouseNode: the DOM node object to listen on for mouse events. - // keyNode: the DOM node object to listen on for key events. - // See the addMouseListener and addKeyListener methods for other parameters. - // Returns an array of dojo.connect handles - return this.addKeyListener(keyNode, keyObject, _this, callback, subsequentDelay, initialDelay).concat( - this.addMouseListener(mouseNode, _this, callback, subsequentDelay, initialDelay)); - } -}; - -} |