]> source.dussan.org Git - jquery-ui.git/commitdiff
(no commit message)
authorRichard Worth <rdworth@gmail.com>
Mon, 26 May 2008 13:53:31 +0000 (13:53 +0000)
committerRichard Worth <rdworth@gmail.com>
Mon, 26 May 2008 13:53:31 +0000 (13:53 +0000)
ui/tests/ui.testmouse.js

index 7d734693fcfddeb98c0fd51459cc1b26b35d949a..57a9b85ebdad67fe0b4268c383a590912dd8e310 100644 (file)
@@ -5,7 +5,7 @@
  * Dual licensed under the MIT (MIT-LICENSE.txt)\r
  * and GPL (GPL-LICENSE.txt) licenses.\r
  * \r
- * Revision: $Id: $\r
+ * Revision: $Id:$\r
  */\r
 ;(function($) {\r
 \r
                        }\r
                        var noneUrl = ['cursors', OS == 'other' ? 'win' : OS, 'none' + ($.browser.safari ? '.png' : '.cur')].join('/');\r
                \r
-                       var fakemouse = $('<img src="' + defaultUrl + '" />');\r
-                       var realmouse = $('<img src="' + defaultUrl + '" />');\r
+                       this.fakemouse = $('<img src="' + defaultUrl + '" />');\r
+                       this.realmouse = $('<img src="' + defaultUrl + '" />');\r
                        if ($.browser.msie && $.browser.version == 6) {\r
-                               fakemouse = $('<div style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div>');\r
-                               realmouse = $('<div><div style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div></div>');\r
+                               this.fakemouse = $('<div style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div>');\r
+                               this.realmouse = $('<div><div style="height:32;width:32;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\');" ></div></div>');\r
                        }\r
-                       var mousescreen = $('<div/>');\r
+                       this.mousescreen = $('<div/>');\r
                \r
-                       var updateCursor = function() {\r
+                       this.updateCursor = function() {\r
                                if ($.browser.msie && $.browser.version == 6) {\r
-                                       fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + cursorUrl() + '\', sizingMethod=\'scale\'');\r
+                                       self.fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + cursorUrl() + '\', sizingMethod=\'scale\'');\r
                                } else {\r
-                                       fakemouse.attr('src', cursorUrl());\r
+                                       self.fakemouse.attr('src', cursorUrl());\r
                                }\r
                        }\r
-                       var resetCursor = function() {\r
+                       this.resetCursor = function() {\r
                                if ($.browser.msie && $.browser.version == 6) {\r
-                                       fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\'');\r
+                                       self.fakemouse.css('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + defaultUrl + '\', sizingMethod=\'scale\'');\r
                                } else {\r
-                                       fakemouse.attr('src', defaultUrl);\r
+                                       self.fakemouse.attr('src', defaultUrl);\r
                                }\r
                        }\r
                        \r
                        var testStart = function() {\r
-                               self.element.bind("mouseover", updateCursor).bind("mouseout", resetCursor);\r
-                               fakemouse.appendTo('body').css({ position: 'absolute', left: self.mouseX, top: self.mouseY, zIndex: 5000 });\r
-                               realmouse.appendTo('body').css({ position: 'absolute', left: self.mouseX, top: self.mouseY, zIndex: 5000, opacity: 0.1 });\r
-                               mousescreen.appendTo('body').css({ width: '100%', height: '100%', position: 'absolute', top: 0, left: 0, zIndex: 5000 })\r
-                                       .mousemove(function(e) { realmouse.css({ left: e.pageX, top: e.pageY }); return false; })\r
+                               self.element.bind("mouseover", self.updateCursor).bind("mouseout", self.resetCursor);\r
+                               self.fakemouse.appendTo('body').css({ position: 'absolute', left: self.mouseX, top: self.mouseY, zIndex: 5000 });\r
+                               self.realmouse.appendTo('body').css({ position: 'absolute', left: self.mouseX, top: self.mouseY, zIndex: 5000, opacity: 0.1 });\r
+                               self.mousescreen.appendTo('body').css({ width: '100%', height: '100%', position: 'absolute', top: 0, left: 0, zIndex: 5000 })\r
+                                       .mousemove(function(e) { self.realmouse.css({ left: e.pageX, top: e.pageY }); return false; })\r
                                        .mousedown(function() { return false; })\r
                                        .mouseup(function() { return false; });\r
-                               mousescreen.css('cursor', 'url(' + noneUrl + '), crosshair');\r
+                               self.mousescreen.css('cursor', 'url(' + noneUrl + '), crosshair');\r
                                ($.browser.opera && mousescreen.css('cursor', 'crosshair'));\r
                        }\r
                        var testStop = function() {\r
-                               self.element.unbind("mouseover", updateCursor).unbind("mouseout", resetCursor);\r
-                               mousescreen.remove();\r
-                               self.mouseX = realmouse.css("left");\r
-                               self.mouseY = realmouse.css("top");\r
-                               realmouse.remove();\r
-                               fakemouse.remove();\r
+                               self.element.unbind("mouseover", self.updateCursor).unbind("mouseout", self.resetCursor);\r
+                               self.mousescreen.remove();\r
+                               self.mouseX = self.realmouse.css("left");\r
+                               self.mouseY = self.realmouse.css("top");\r
+                               self.realmouse.remove();\r
+                               self.fakemouse.remove();\r
                                ($.isFunction(complete) && complete.apply());\r
                        }\r
                        \r
                \r
                        this.lastX = null;\r
                \r
-                       fakemouse\r
+                       this.fakemouse\r
                                .animate({ left: this.left, top: this.top }, this.options.speed, function() {\r
                                        self.element.triggerHandler('mouseover');\r
                                        self.down(self.left, self.top);\r
                                        complete: function() {\r
                                                self.element.triggerHandler('mouseout');\r
                                                self.up(0, 0);\r
-                                               $(this).animate({ left: realmouse.css("left"), top: realmouse.css("top") }, {\r
+                                               $(this).animate({ left: self.realmouse.css("left"), top: self.realmouse.css("top") }, {\r
                                                        speed: self.options.speed,\r
                                                        complete: function() {\r
                                                                testStop();\r