removed mods directory from the ATutor codebase
[atutor.git] / mods / photo_album / fluid / component-templates / js / jquery.ui-1.0 / ui.mouse.js
diff --git a/mods/photo_album/fluid/component-templates/js/jquery.ui-1.0/ui.mouse.js b/mods/photo_album/fluid/component-templates/js/jquery.ui-1.0/ui.mouse.js
deleted file mode 100644 (file)
index 3525fe4..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-(function($) {\r
-       \r
-       //If the UI scope is not availalable, add it\r
-       $.ui = $.ui || {};\r
-       \r
-       //Add methods that are vital for all mouse interaction stuff (plugin registering)\r
-       $.extend($.ui, {\r
-               plugin: {\r
-                       add: function(w, c, o, p) {\r
-                               var a = $.ui[w].prototype; if(!a.plugins[c]) a.plugins[c] = [];\r
-                               a.plugins[c].push([o,p]);\r
-                       },\r
-                       call: function(instance, name, arguments) {\r
-                               var c = instance.plugins[name]; if(!c) return;\r
-                               var o = instance.interaction ? instance.interaction.options : instance.options;\r
-                               var e = instance.interaction ? instance.interaction.element : instance.element;\r
-                               \r
-                               for (var i = 0; i < c.length; i++) {\r
-                                       if (o[c[i][0]]) c[i][1].apply(e, arguments);\r
-                               }       \r
-                       }       \r
-               }\r
-       });\r
-       \r
-       $.fn.mouseInteractionDestroy = function() {\r
-               this.each(function() {\r
-                       if($.data(this, "ui-mouse")) $.data(this, "ui-mouse").destroy();        \r
-               });\r
-       }\r
-       \r
-       $.ui.mouseInteraction = function(el,o) {\r
-       \r
-               if(!o) var o = {};\r
-               this.element = el;\r
-               $.data(this.element, "ui-mouse", this);\r
-               \r
-               this.options = {};\r
-               $.extend(this.options, o);\r
-               $.extend(this.options, {\r
-                       handle : o.handle ? ($(o.handle, el)[0] ? $(o.handle, el) : $(el)) : $(el),\r
-                       helper: o.helper || 'original',\r
-                       preventionDistance: o.preventionDistance || 0,\r
-                       dragPrevention: o.dragPrevention ? o.dragPrevention.toLowerCase().split(',') : ['input','textarea','button','select','option'],\r
-                       cursorAt: { top: ((o.cursorAt && o.cursorAt.top) ? o.cursorAt.top : 0), left: ((o.cursorAt && o.cursorAt.left) ? o.cursorAt.left : 0), bottom: ((o.cursorAt && o.cursorAt.bottom) ? o.cursorAt.bottom : 0), right: ((o.cursorAt && o.cursorAt.right) ? o.cursorAt.right : 0) },\r
-                       cursorAtIgnore: (!o.cursorAt) ? true : false, //Internal property\r
-                       appendTo: o.appendTo || 'parent'                        \r
-               })\r
-               o = this.options; //Just Lazyness\r
-               \r
-               if(!this.options.nonDestructive && (o.helper == 'clone' || o.helper == 'original')) {\r
-\r
-                       // Let's save the margins for better reference\r
-                       o.margins = {\r
-                               top: parseInt($(el).css('marginTop')) || 0,\r
-                               left: parseInt($(el).css('marginLeft')) || 0,\r
-                               bottom: parseInt($(el).css('marginBottom')) || 0,\r
-                               right: parseInt($(el).css('marginRight')) || 0\r
-                       };\r
-\r
-                       // We have to add margins to our cursorAt\r
-                       if(o.cursorAt.top != 0) o.cursorAt.top = o.margins.top;\r
-                       if(o.cursorAt.left != 0) o.cursorAt.left += o.margins.left;\r
-                       if(o.cursorAt.bottom != 0) o.cursorAt.bottom += o.margins.bottom;\r
-                       if(o.cursorAt.right != 0) o.cursorAt.right += o.margins.right;\r
-                       \r
-                       \r
-                       if(o.helper == 'original')\r
-                               o.wasPositioned = $(el).css('position');\r
-                       \r
-               } else {\r
-                       o.margins = { top: 0, left: 0, right: 0, bottom: 0 };\r
-               }\r
-               \r
-               var self = this;\r
-               this.mousedownfunc = function(e) { // Bind the mousedown event\r
-                       return self.click.apply(self, [e]);     \r
-               }\r
-               o.handle.bind('mousedown', this.mousedownfunc);\r
-               \r
-               //Prevent selection of text when starting the drag in IE\r
-               if($.browser.msie) $(this.element).attr('unselectable', 'on');\r
-               \r
-       }\r
-       \r
-       $.extend($.ui.mouseInteraction.prototype, {\r
-               plugins: {},\r
-               currentTarget: null,\r
-               lastTarget: null,\r
-               timer: null,\r
-               slowMode: false,\r
-               init: false,\r
-               destroy: function() {\r
-                       this.options.handle.unbind('mousedown', this.mousedownfunc);\r
-               },\r
-               trigger: function(e) {\r
-                       return this.click.apply(this, arguments);\r
-               },\r
-               click: function(e) {\r
-\r
-                       var o = this.options;\r
-                       \r
-                       window.focus();\r
-                       if(e.which != 1) return true; //only left click starts dragging\r
-               \r
-                       // Prevent execution on defined elements\r
-                       var targetName = (e.target) ? e.target.nodeName.toLowerCase() : e.srcElement.nodeName.toLowerCase();\r
-                       for(var i=0;i<o.dragPrevention.length;i++) {\r
-                               if(targetName == o.dragPrevention[i]) return true;\r
-                       }\r
-\r
-                       //Prevent execution on condition\r
-                       if(o.startCondition && !o.startCondition.apply(this, [e])) return true;\r
-\r
-                       var self = this;\r
-                       this.mouseup = function(e) { return self.stop.apply(self, [e]); }\r
-                       this.mousemove = function(e) { return self.drag.apply(self, [e]); }\r
-\r
-                       var initFunc = function() { //This function get's called at bottom or after timeout\r
-                               $(document).bind('mouseup', self.mouseup);\r
-                               $(document).bind('mousemove', self.mousemove);\r
-                               self.opos = [e.pageX,e.pageY]; // Get the original mouse position\r
-                       }\r
-                       \r
-                       if(o.preventionTimeout) { //use prevention timeout\r
-                               if(this.timer) clearInterval(this.timer);\r
-                               this.timer = setTimeout(function() { initFunc(); }, o.preventionTimeout);\r
-                               return false;\r
-                       }\r
-               \r
-                       initFunc();\r
-                       return false;\r
-                       \r
-               },\r
-               start: function(e) {\r
-                       \r
-                       var o = this.options; var a = this.element;\r
-                       o.co = $(a).offset(); //get the current offset\r
-                               \r
-                       this.helper = typeof o.helper == 'function' ? $(o.helper.apply(a, [e,this]))[0] : (o.helper == 'clone' ? $(a).clone()[0] : a);\r
-\r
-                       if(o.appendTo == 'parent') { // Let's see if we have a positioned parent\r
-                               var cp = a.parentNode;\r
-                               while (cp) {\r
-                                       if(cp.style && ($(cp).css('position') == 'relative' || $(cp).css('position') == 'absolute')) {\r
-                                               o.pp = cp;\r
-                                               o.po = $(cp).offset();\r
-                                               o.ppOverflow = !!($(o.pp).css('overflow') == 'auto' || $(o.pp).css('overflow') == 'scroll'); //TODO!\r
-                                               break;  \r
-                                       }\r
-                                       cp = cp.parentNode ? cp.parentNode : null;\r
-                               };\r
-                               \r
-                               if(!o.pp) o.po = { top: 0, left: 0 };\r
-                       }\r
-                       \r
-                       this.pos = [this.opos[0],this.opos[1]]; //Use the relative position\r
-                       this.rpos = [this.pos[0],this.pos[1]]; //Save the absolute position\r
-                       \r
-                       if(o.cursorAtIgnore) { // If we want to pick the element where we clicked, we borrow cursorAt and add margins\r
-                               o.cursorAt.left = this.pos[0] - o.co.left + o.margins.left;\r
-                               o.cursorAt.top = this.pos[1] - o.co.top + o.margins.top;\r
-                       }\r
-\r
-\r
-\r
-                       if(o.pp) { // If we have a positioned parent, we pick the draggable relative to it\r
-                               this.pos[0] -= o.po.left;\r
-                               this.pos[1] -= o.po.top;\r
-                       }\r
-                       \r
-                       this.slowMode = (o.cursorAt && (o.cursorAt.top-o.margins.top > 0 || o.cursorAt.bottom-o.margins.bottom > 0) && (o.cursorAt.left-o.margins.left > 0 || o.cursorAt.right-o.margins.right > 0)) ? true : false; //If cursorAt is within the helper, set slowMode to true\r
-                       \r
-                       if(!o.nonDestructive) $(this.helper).css('position', 'absolute');\r
-                       if(o.helper != 'original') $(this.helper).appendTo((o.appendTo == 'parent' ? a.parentNode : o.appendTo)).show();\r
-\r
-                       // Remap right/bottom properties for cursorAt to left/top\r
-                       if(o.cursorAt.right && !o.cursorAt.left) o.cursorAt.left = this.helper.offsetWidth+o.margins.right+o.margins.left - o.cursorAt.right;\r
-                       if(o.cursorAt.bottom && !o.cursorAt.top) o.cursorAt.top = this.helper.offsetHeight+o.margins.top+o.margins.bottom - o.cursorAt.bottom;\r
-               \r
-                       this.init = true;       \r
-\r
-                       if(o._start) o._start.apply(a, [this.helper, this.pos, o.cursorAt, this, e]); // Trigger the start callback\r
-                       this.helperSize = { width: outerWidth(this.helper), height: outerHeight(this.helper) }; //Set helper size property\r
-                       return false;\r
-                                               \r
-               },\r
-               stop: function(e) {                     \r
-                       \r
-                       var o = this.options; var a = this.element; var self = this;\r
-\r
-                       $(document).unbind('mouseup', self.mouseup);\r
-                       $(document).unbind('mousemove', self.mousemove);\r
-\r
-                       if(this.init == false) return this.opos = this.pos = null;\r
-                       if(o._beforeStop) o._beforeStop.apply(a, [this.helper, this.pos, o.cursorAt, this, e]);\r
-\r
-                       if(this.helper != a && !o.beQuietAtEnd) { // Remove helper, if it's not the original node\r
-                               $(this.helper).remove(); this.helper = null;\r
-                       }\r
-                       \r
-                       if(!o.beQuietAtEnd) {\r
-                               //if(o.wasPositioned)   $(a).css('position', o.wasPositioned);\r
-                               if(o._stop) o._stop.apply(a, [this.helper, this.pos, o.cursorAt, this, e]);\r
-                       }\r
-\r
-                       this.init = false;\r
-                       this.opos = this.pos = null;\r
-                       return false;\r
-                       \r
-               },\r
-               drag: function(e) {\r
-\r
-                       if (!this.opos || ($.browser.msie && !e.button)) return this.stop.apply(this, [e]); // check for IE mouseup when moving into the document again\r
-                       var o = this.options;\r
-                       \r
-                       this.pos = [e.pageX,e.pageY]; //relative mouse position\r
-                       if(this.rpos && this.rpos[0] == this.pos[0] && this.rpos[1] == this.pos[1]) return false;\r
-                       this.rpos = [this.pos[0],this.pos[1]]; //absolute mouse position\r
-                       \r
-                       if(o.pp) { //If we have a positioned parent, use a relative position\r
-                               this.pos[0] -= o.po.left;\r
-                               this.pos[1] -= o.po.top;        \r
-                       }\r
-                       \r
-                       if( (Math.abs(this.rpos[0]-this.opos[0]) > o.preventionDistance || Math.abs(this.rpos[1]-this.opos[1]) > o.preventionDistance) && this.init == false) //If position is more than x pixels from original position, start dragging\r
-                               this.start.apply(this,[e]);                     \r
-                       else {\r
-                               if(this.init == false) return false;\r
-                       }\r
-               \r
-                       if(o._drag) o._drag.apply(this.element, [this.helper, this.pos, o.cursorAt, this, e]);\r
-                       return false;\r
-                       \r
-               }\r
-       });\r
-\r
-       var num = function(el, prop) {\r
-               return parseInt($.css(el.jquery?el[0]:el,prop))||0;\r
-       };\r
-       function outerWidth(el) {\r
-               var $el = $(el), ow = $el.width();\r
-               for (var i = 0, props = ['borderLeftWidth', 'paddingLeft', 'paddingRight', 'borderRightWidth']; i < props.length; i++)\r
-                       ow += num($el, props[i]);\r
-               return ow;\r
-       }\r
-       function outerHeight(el) {\r
-               var $el = $(el), oh = $el.width();\r
-               for (var i = 0, props = ['borderTopWidth', 'paddingTop', 'paddingBottom', 'borderBottomWidth']; i < props.length; i++)\r
-                       oh += num($el, props[i]);\r
-               return oh;\r
-       }\r
-\r
- })($);\r