]> source.dussan.org Git - jquery-ui.git/commitdiff
Internal methods: fixes #3195, #3196, #3200, #3201, #3209
authorChi Cheng <cloudream@gmail.com>
Sun, 17 Aug 2008 02:15:55 +0000 (02:15 +0000)
committerChi Cheng <cloudream@gmail.com>
Sun, 17 Aug 2008 02:15:55 +0000 (02:15 +0000)
ui/ui.autocomplete.js
ui/ui.colorpicker.js
ui/ui.draggable.js
ui/ui.droppable.js
ui/ui.sortable.js

index 8476c5c1de95c3647001ce23dc47836a30dd812a..d93c5d7a8bd8be4c110e08d1f2e33a0eb6955ef7 100644 (file)
@@ -14,7 +14,7 @@
 
 $.widget("ui.autocomplete", {
        
-       init: function() {
+       _init: function() {
 
                $.extend(this.options, {
                        delay: this.options.url ? $.Autocompleter.defaults.delay : 10,
index 6cc797369c222e6a169968ab666b61adf6ad45ae..45e1d3ec4ba38f1443e7c64e3a3eb062802faa9b 100644 (file)
 \r
 $.widget("ui.colorpicker", {\r
        \r
-       init: function() {\r
+       _init: function() {\r
                \r
                this.charMin = 65;\r
                var o = this.options, self = this,\r
                tpl = '<div class="ui-colorpicker clearfix"><div class="ui-colorpicker-color"><div><div></div></div></div><div class="ui-colorpicker-hue"><div></div></div><div class="ui-colorpicker-new-color"></div><div class="ui-colorpicker-current-color"></div><div class="ui-colorpicker-hex"><label for="ui-colorpicker-hex" title="hex">#</label><input type="text" maxlength="6" size="6" /></div><div class="ui-colorpicker-rgb-r ui-colorpicker-field"><label for="ui-colorpicker-rgb-r">R</label><input type="text" maxlength="3" size="3" /><span></span></div><div class="ui-colorpicker-rgb-g ui-colorpicker-field"><label for="ui-colorpicker-rgb-g">G</label><input type="text" maxlength="3" size="3" /><span></span></div><div class="ui-colorpicker-rgb-b ui-colorpicker-field"><label for="ui-colorpicker-rgb-b">B</label><input type="text" maxlength="3" size="3" /><span></span></div><div class="ui-colorpicker-hsb-h ui-colorpicker-field"><label for="ui-colorpicker-hsb-h">H</label><input type="text" maxlength="3" size="3" /><span></span></div><div class="ui-colorpicker-hsb-s ui-colorpicker-field"><label for="ui-colorpicker-hsb-s">S</label><input type="text" maxlength="3" size="3" /><span></span></div><div class="ui-colorpicker-hsb-b ui-colorpicker-field"><label for="ui-colorpicker-hsb-b">B</label><input type="text" maxlength="3" size="3" /><span></span></div><button class="ui-colorpicker-submit ui-default-state" name="submit" type="submit">Done</button></div>';\r
 \r
                if (typeof o.color == 'string') {\r
-                       this.color = this.HexToHSB(o.color);\r
+                       this.color = this._HexToHSB(o.color);\r
                } else if (o.color.r != undefined && o.color.g != undefined && o.color.b != undefined) {\r
-                       this.color = this.RGBToHSB(o.color);\r
+                       this.color = this._RGBToHSB(o.color);\r
                } else if (o.color.h != undefined && o.color.s != undefined && o.color.b != undefined) {\r
-                       this.color = this.fixHSB(o.color);\r
+                       this.color = this._fixHSB(o.color);\r
                } else {\r
                        return this;\r
                }\r
@@ -40,33 +40,33 @@ $.widget("ui.colorpicker", {
                }\r
                                \r
                this.fields = this.picker.find('input')\r
-                                               .bind('keydown', function(e) { return self.keyDown.call(self, e); })\r
-                                               .bind('change', function(e) { return self.change.call(self, e); })\r
-                                               .bind('blur', function(e) { return self.blur.call(self, e); })\r
-                                               .bind('focus', function(e) { return self.focus.call(self, e); });\r
+                                               .bind('keydown', function(e) { return self._keyDown.call(self, e); })\r
+                                               .bind('change', function(e) { return self._change.call(self, e); })\r
+                                               .bind('blur', function(e) { return self._blur.call(self, e); })\r
+                                               .bind('focus', function(e) { return self._focus.call(self, e); });\r
                \r
-               this.picker.find('span').bind('mousedown', function(e) { return self.downIncrement.call(self, e); });\r
+               this.picker.find('span').bind('mousedown', function(e) { return self._downIncrement.call(self, e); });\r
                \r
-               this.selector = this.picker.find('div.ui-colorpicker-color').bind('mousedown', function(e) { return self.downSelector.call(self, e); });\r
+               this.selector = this.picker.find('div.ui-colorpicker-color').bind('mousedown', function(e) { return self._downSelector.call(self, e); });\r
                this.selectorIndic = this.selector.find('div div');\r
                this.hue = this.picker.find('div.ui-colorpicker-hue div');\r
-               this.picker.find('div.ui-colorpicker-hue').bind('mousedown', function(e) { return self.downHue.call(self, e); });\r
+               this.picker.find('div.ui-colorpicker-hue').bind('mousedown', function(e) { return self._downHue.call(self, e); });\r
                                \r
                this.newColor = this.picker.find('div.ui-colorpicker-new-color');\r
                this.currentColor = this.picker.find('div.ui-colorpicker-current-color');\r
                \r
                this.picker.find('div.ui-colorpicker-submit')\r
-                       .bind('mouseenter', function(e) { return self.enterSubmit.call(self, e); })\r
-                       .bind('mouseleave', function(e) { return self.leaveSubmit.call(self, e); })\r
-                       .bind('click', function(e) { return self.clickSubmit.call(self, e); });\r
+                       .bind('mouseenter', function(e) { return self._enterSubmit.call(self, e); })\r
+                       .bind('mouseleave', function(e) { return self._leaveSubmit.call(self, e); })\r
+                       .bind('click', function(e) { return self._clickSubmit.call(self, e); });\r
                        \r
-               this.fillRGBFields(this.color);\r
-               this.fillHSBFields(this.color);\r
-               this.fillHexFields(this.color);\r
-               this.setHue(this.color);\r
-               this.setSelector(this.color);\r
-               this.setCurrentColor(this.color);\r
-               this.setNewColor(this.color);\r
+               this._fillRGBFields(this.color);\r
+               this._fillHSBFields(this.color);\r
+               this._fillHexFields(this.color);\r
+               this._setHue(this.color);\r
+               this._setSelector(this.color);\r
+               this._setCurrentColor(this.color);\r
+               this._setNewColor(this.color);\r
                \r
                if (o.flat) {\r
                        this.picker.css({\r
@@ -74,7 +74,7 @@ $.widget("ui.colorpicker", {
                                display: 'block'\r
                        });\r
                } else {\r
-                       $(this.element).bind(o.eventName+".colorpicker", function(e) { return self.show.call(self, e); });\r
+                       $(this.element).bind(o.eventName+".colorpicker", function(e) { return self._show.call(self, e); });\r
                }\r
 \r
        },\r
@@ -86,96 +86,96 @@ $.widget("ui.colorpicker", {
                \r
        },\r
        \r
-       fillRGBFields: function(hsb) {\r
-               var rgb = this.HSBToRGB(hsb);\r
+       _fillRGBFields: function(hsb) {\r
+               var rgb = this._HSBToRGB(hsb);\r
                this.fields\r
                        .eq(1).val(rgb.r).end()\r
                        .eq(2).val(rgb.g).end()\r
                        .eq(3).val(rgb.b).end();\r
        },\r
-       fillHSBFields: function(hsb) {\r
+       _fillHSBFields: function(hsb) {\r
                this.fields\r
                        .eq(4).val(hsb.h).end()\r
                        .eq(5).val(hsb.s).end()\r
                        .eq(6).val(hsb.b).end();\r
        },\r
-       fillHexFields: function (hsb) {\r
+       _fillHexFields: function (hsb) {\r
                this.fields\r
-                       .eq(0).val(this.HSBToHex(hsb)).end();\r
+                       .eq(0).val(this._HSBToHex(hsb)).end();\r
        },\r
-       setSelector: function(hsb) {\r
-               this.selector.css('backgroundColor', '#' + this.HSBToHex({h: hsb.h, s: 100, b: 100}));\r
+       _setSelector: function(hsb) {\r
+               this.selector.css('backgroundColor', '#' + this._HSBToHex({h: hsb.h, s: 100, b: 100}));\r
                this.selectorIndic.css({\r
                        left: parseInt(150 * hsb.s/100, 10),\r
                        top: parseInt(150 * (100-hsb.b)/100, 10)\r
                });\r
        },\r
-       setHue: function(hsb) {\r
+       _setHue: function(hsb) {\r
                this.hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));\r
        },\r
-       setCurrentColor: function(hsb) {\r
-               this.currentColor.css('backgroundColor', '#' + this.HSBToHex(hsb));\r
+       _setCurrentColor: function(hsb) {\r
+               this.currentColor.css('backgroundColor', '#' + this._HSBToHex(hsb));\r
        },\r
-       setNewColor: function(hsb) {\r
-               this.newColor.css('backgroundColor', '#' + this.HSBToHex(hsb));\r
+       _setNewColor: function(hsb) {\r
+               this.newColor.css('backgroundColor', '#' + this._HSBToHex(hsb));\r
        },\r
-       keyDown: function(e) {\r
+       _keyDown: function(e) {\r
                var pressedKey = e.charCode || e.keyCode || -1;\r
                if ((pressedKey >= this.charMin && pressedKey <= 90) || pressedKey == 32) {\r
                        return false;\r
                }\r
        },\r
-       change: function(e, target) {\r
+       _change: function(e, target) {\r
                \r
                var col;\r
                target = target || e.target;\r
                if (target.parentNode.className.indexOf('-hex') > 0) {\r
-                       this.color = col = this.HexToHSB(this.value);\r
-                       this.fillRGBFields(col.color);\r
-                       this.fillHSBFields(col);\r
+                       this.color = col = this._HexToHSB(this.value);\r
+                       this._fillRGBFields(col.color);\r
+                       this._fillHSBFields(col);\r
                } else if (target.parentNode.className.indexOf('-hsb') > 0) {\r
-                       this.color = col = this.fixHSB({\r
+                       this.color = col = this._fixHSB({\r
                                h: parseInt(this.fields.eq(4).val(), 10),\r
                                s: parseInt(this.fields.eq(5).val(), 10),\r
                                b: parseInt(this.fields.eq(6).val(), 10)\r
                        });\r
-                       this.fillRGBFields(col);\r
-                       this.fillHexFields(col);\r
+                       this._fillRGBFields(col);\r
+                       this._fillHexFields(col);\r
                } else {\r
-                       this.color = col = this.RGBToHSB(this.fixRGB({\r
+                       this.color = col = this._RGBToHSB(this._fixRGB({\r
                                r: parseInt(this.fields.eq(1).val(), 10),\r
                                g: parseInt(this.fields.eq(2).val(), 10),\r
                                b: parseInt(this.fields.eq(3).val(), 10)\r
                        }));\r
-                       this.fillHexFields(col);\r
-                       this.fillHSBFields(col);\r
+                       this._fillHexFields(col);\r
+                       this._fillHSBFields(col);\r
                }\r
-               this.setSelector(col);\r
-               this.setHue(col);\r
-               this.setNewColor(col);\r
+               this._setSelector(col);\r
+               this._setHue(col);\r
+               this._setNewColor(col);\r
                \r
-               this.trigger('change', e, { options: this.options, hsb: col, hex: this.HSBToHex(col), rgb: this.HSBToRGB(col) });\r
+               this._trigger('change', e, { options: this.options, hsb: col, hex: this._HSBToHex(col), rgb: this._HSBToRGB(col) });\r
        },\r
-       blur: function(e) {\r
+       _blur: function(e) {\r
                \r
                var col = this.color;\r
-               this.fillRGBFields(col);\r
-               this.fillHSBFields(col);\r
-               this.fillHexFields(col);\r
-               this.setHue(col);\r
-               this.setSelector(col);\r
-               this.setNewColor(col);\r
+               this._fillRGBFields(col);\r
+               this._fillHSBFields(col);\r
+               this._fillHexFields(col);\r
+               this._setHue(col);\r
+               this._setSelector(col);\r
+               this._setNewColor(col);\r
                this.fields.parent().removeClass('ui-colorpicker-focus');\r
                \r
        },\r
-       focus: function(e) {\r
+       _focus: function(e) {\r
                \r
                this.charMin = e.target.parentNode.className.indexOf('-hex') > 0 ? 70 : 65;\r
                this.fields.parent().removeClass('ui-colorpicker-focus');\r
                $(e.target.parentNode).addClass('ui-colorpicker-focus');\r
                \r
        },\r
-       downIncrement: function(e) {\r
+       _downIncrement: function(e) {\r
                \r
                var field = $(e.target).parent().find('input').focus(), self = this;\r
                this.currentIncrement = {\r
@@ -185,44 +185,44 @@ $.widget("ui.colorpicker", {
                        field: field,\r
                        val: parseInt(field.val(), 10)\r
                };\r
-               $(document).bind('mouseup.cpSlider', function(e) { return self.upIncrement.call(self, e); });\r
-               $(document).bind('mousemove.cpSlider', function(e) { return self.moveIncrement.call(self, e); });\r
+               $(document).bind('mouseup.cpSlider', function(e) { return self._upIncrement.call(self, e); });\r
+               $(document).bind('mousemove.cpSlider', function(e) { return self._moveIncrement.call(self, e); });\r
                return false;\r
                \r
        },\r
-       moveIncrement: function(e) {\r
+       _moveIncrement: function(e) {\r
                this.currentIncrement.field.val(Math.max(0, Math.min(this.currentIncrement.max, parseInt(this.currentIncrement.val + e.pageY - this.currentIncrement.y, 10))));\r
-               this.change.apply(this, [e, this.currentIncrement.field.get(0)]);\r
+               this._change.apply(this, [e, this.currentIncrement.field.get(0)]);\r
                return false;\r
        },\r
-       upIncrement: function(e) {\r
+       _upIncrement: function(e) {\r
                this.currentIncrement.el.removeClass('ui-colorpicker-slider').find('input').focus();\r
-               this.change.apply(this, [e, this.currentIncrement.field.get(0)]);\r
+               this._change.apply(this, [e, this.currentIncrement.field.get(0)]);\r
                $(document).unbind('mouseup.cpSlider');\r
                $(document).unbind('mousemove.cpSlider');\r
                return false;\r
        },\r
-       downHue: function(e) {\r
+       _downHue: function(e) {\r
                \r
                this.currentHue = {\r
                        y: this.picker.find('div.ui-colorpicker-hue').offset().top\r
                };\r
                \r
-               this.change.apply(this, [e, this\r
+               this._change.apply(this, [e, this\r
                                .fields\r
                                .eq(4)\r
                                .val(parseInt(360*(150 - Math.max(0,Math.min(150,(e.pageY - this.currentHue.y))))/150, 10))\r
                                .get(0)]);\r
 \r
                var self = this;\r
-               $(document).bind('mouseup.cpSlider', function(e) { return self.upHue.call(self, e); });\r
-               $(document).bind('mousemove.cpSlider', function(e) { return self.moveHue.call(self, e); });\r
+               $(document).bind('mouseup.cpSlider', function(e) { return self._upHue.call(self, e); });\r
+               $(document).bind('mousemove.cpSlider', function(e) { return self._moveHue.call(self, e); });\r
                return false;\r
                \r
        },\r
-       moveHue: function(e) {\r
+       _moveHue: function(e) {\r
                \r
-               this.change.apply(this, [e, this\r
+               this._change.apply(this, [e, this\r
                                .fields\r
                                .eq(4)\r
                                .val(parseInt(360*(150 - Math.max(0,Math.min(150,(e.pageY - this.currentHue.y))))/150, 10))\r
@@ -231,19 +231,19 @@ $.widget("ui.colorpicker", {
                return false;\r
                \r
        },\r
-       upHue: function(e) {\r
+       _upHue: function(e) {\r
                $(document).unbind('mouseup.cpSlider');\r
                $(document).unbind('mousemove.cpSlider');\r
                return false;\r
        },\r
-       downSelector: function(e) {\r
+       _downSelector: function(e) {\r
                \r
                var self = this;\r
                this.currentSelector = {\r
                        pos: this.picker.find('div.ui-colorpicker-color').offset()\r
                };\r
                                \r
-               this.change.apply(this, [e, this\r
+               this._change.apply(this, [e, this\r
                                .fields\r
                                .eq(6)\r
                                .val(parseInt(100*(150 - Math.max(0,Math.min(150,(e.pageY - this.currentSelector.pos.top))))/150, 10))\r
@@ -252,14 +252,14 @@ $.widget("ui.colorpicker", {
                                .val(parseInt(100*(Math.max(0,Math.min(150,(e.pageX - this.currentSelector.pos.left))))/150, 10))\r
                                .get(0)\r
                ]);\r
-               $(document).bind('mouseup.cpSlider', function(e) { return self.upSelector.call(self, e); });\r
-               $(document).bind('mousemove.cpSlider', function(e) { return self.moveSelector.call(self, e); });\r
+               $(document).bind('mouseup.cpSlider', function(e) { return self._upSelector.call(self, e); });\r
+               $(document).bind('mousemove.cpSlider', function(e) { return self._moveSelector.call(self, e); });\r
                return false;\r
                \r
        },\r
-       moveSelector: function(e) {\r
+       _moveSelector: function(e) {\r
                \r
-               this.change.apply(this, [e, this\r
+               this._change.apply(this, [e, this\r
                                .fields\r
                                .eq(6)\r
                                .val(parseInt(100*(150 - Math.max(0,Math.min(150,(e.pageY - this.currentSelector.pos.top))))/150, 10))\r
@@ -271,33 +271,33 @@ $.widget("ui.colorpicker", {
                return false;\r
                \r
        },\r
-       upSelector: function(e) {\r
+       _upSelector: function(e) {\r
                $(document).unbind('mouseup.cpSlider');\r
                $(document).unbind('mousemove.cpSlider');\r
                return false;\r
        },\r
-       enterSubmit: function(e) {\r
+       _enterSubmit: function(e) {\r
                this.picker.find('div.ui-colorpicker-submit').addClass('ui-colorpicker-focus');\r
        },\r
-       leaveSubmit: function(e) {\r
+       _leaveSubmit: function(e) {\r
                this.picker.find('div.ui-colorpicker-submit').removeClass('ui-colorpicker-focus');\r
        },\r
-       clickSubmit: function(e) {\r
+       _clickSubmit: function(e) {\r
                \r
                var col = this.color;\r
                this.origColor = col;\r
-               this.setCurrentColor(col);\r
+               this._setCurrentColor(col);\r
                \r
-               this.trigger("submit", e, { options: this.options, hsb: col, hex: this.HSBToHex(col), rgb: this.HSBToRGB(col) });\r
+               this._trigger("submit", e, { options: this.options, hsb: col, hex: this._HSBToHex(col), rgb: this._HSBToRGB(col) });\r
                return false;\r
                \r
        },\r
-       show: function(e) {\r
+       _show: function(e) {\r
                \r
-               this.trigger("beforeShow", e, { options: this.options, hsb: this.color, hex: this.HSBToHex(this.color), rgb: this.HSBToRGB(this.color) });\r
+               this._trigger("beforeShow", e, { options: this.options, hsb: this.color, hex: this._HSBToHex(this.color), rgb: this._HSBToRGB(this.color) });\r
                \r
                var pos = this.element.offset();\r
-               var viewPort = this.getScroll();\r
+               var viewPort = this._getScroll();\r
                var top = pos.top + this.element[0].offsetHeight;\r
                var left = pos.left;\r
                if (top + 176 > viewPort.t + Math.min(viewPort.h,viewPort.ih)) {\r
@@ -307,26 +307,26 @@ $.widget("ui.colorpicker", {
                        left -= 356;\r
                }\r
                this.picker.css({left: left + 'px', top: top + 'px'});\r
-               if (this.trigger("show", e, { options: this.options, hsb: this.color, hex: this.HSBToHex(this.color), rgb: this.HSBToRGB(this.color) }) != false) {\r
+               if (this._trigger("show", e, { options: this.options, hsb: this.color, hex: this._HSBToHex(this.color), rgb: this._HSBToRGB(this.color) }) != false) {\r
                        this.picker.show();\r
                }\r
                \r
                var self = this;\r
-               $(document).bind('mousedown.colorpicker', function(e) { return self.hide.call(self, e); });\r
+               $(document).bind('mousedown.colorpicker', function(e) { return self._hide.call(self, e); });\r
                return false;\r
                \r
        },\r
-       hide: function(e) {\r
+       _hide: function(e) {\r
                \r
-               if (!this.isChildOf(this.picker[0], e.target, this.picker[0])) {\r
-                       if (this.trigger("hide", e, { options: this.options, hsb: this.color, hex: this.HSBToHex(this.color), rgb: this.HSBToRGB(this.color) }) != false) {\r
+               if (!this._isChildOf(this.picker[0], e.target, this.picker[0])) {\r
+                       if (this._trigger("hide", e, { options: this.options, hsb: this.color, hex: this._HSBToHex(this.color), rgb: this._HSBToRGB(this.color) }) != false) {\r
                                this.picker.hide();\r
                        }\r
                        $(document).unbind('mousedown.colorpicker');\r
                }\r
                \r
        },\r
-       isChildOf: function(parentEl, el, container) {\r
+       _isChildOf: function(parentEl, el, container) {\r
                if (parentEl == el) {\r
                        return true;\r
                }\r
@@ -344,7 +344,7 @@ $.widget("ui.colorpicker", {
                }\r
                return false;\r
        },\r
-       getScroll: function() {\r
+       _getScroll: function() {\r
                var t,l,w,h,iw,ih;\r
                if (document.documentElement) {\r
                        t = document.documentElement.scrollTop;\r
@@ -361,28 +361,28 @@ $.widget("ui.colorpicker", {
                ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;\r
                return { t: t, l: l, w: w, h: h, iw: iw, ih: ih };\r
        },\r
-       fixHSB: function(hsb) {\r
+       _fixHSB: function(hsb) {\r
                return {\r
                        h: Math.min(360, Math.max(0, hsb.h)),\r
                        s: Math.min(100, Math.max(0, hsb.s)),\r
                        b: Math.min(100, Math.max(0, hsb.b))\r
                };\r
        }, \r
-       fixRGB: function(rgb) {\r
+       _fixRGB: function(rgb) {\r
                return {\r
                        r: Math.min(255, Math.max(0, rgb.r)),\r
                        g: Math.min(255, Math.max(0, rgb.g)),\r
                        b: Math.min(255, Math.max(0, rgb.b))\r
                };\r
        }, \r
-       HexToRGB: function (hex) {\r
+       _HexToRGB: function (hex) {\r
                var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);\r
                return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};\r
        },\r
-       HexToHSB: function(hex) {\r
-               return this.RGBToHSB(this.HexToRGB(hex));\r
+       _HexToHSB: function(hex) {\r
+               return this._RGBToHSB(this._HexToRGB(hex));\r
        },\r
-       RGBToHSB: function(rgb) {\r
+       _RGBToHSB: function(rgb) {\r
                var hsb = {};\r
                hsb.b = Math.max(Math.max(rgb.r,rgb.g),rgb.b);\r
                hsb.s = (hsb.b <= 0) ? 0 : Math.round(100*(hsb.b - Math.min(Math.min(rgb.r,rgb.g),rgb.b))/hsb.b);\r
@@ -398,7 +398,7 @@ $.widget("ui.colorpicker", {
                hsb.h = Math.round(hsb.h);\r
                return hsb;\r
        },\r
-       HSBToRGB: function(hsb) {\r
+       _HSBToRGB: function(hsb) {\r
                var rgb = {};\r
                var h = Math.round(hsb.h);\r
                var s = Math.round(hsb.s*255/100);\r
@@ -420,7 +420,7 @@ $.widget("ui.colorpicker", {
                }\r
                return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};\r
        },\r
-       RGBToHex: function(rgb) {\r
+       _RGBToHex: function(rgb) {\r
                var hex = [\r
                        rgb.r.toString(16),\r
                        rgb.g.toString(16),\r
@@ -433,29 +433,29 @@ $.widget("ui.colorpicker", {
                });\r
                return hex.join('');\r
        },\r
-       HSBToHex: function(hsb) {\r
-               return this.RGBToHex(this.HSBToRGB(hsb));\r
+       _HSBToHex: function(hsb) {\r
+               return this._RGBToHex(this._HSBToRGB(hsb));\r
        },\r
        setColor: function(col) {\r
                if (typeof col == 'string') {\r
-                       col = this.HexToHSB(col);\r
+                       col = this._HexToHSB(col);\r
                } else if (col.r != undefined && col.g != undefined && col.b != undefined) {\r
-                       col = this.RGBToHSB(col);\r
+                       col = this._RGBToHSB(col);\r
                } else if (col.h != undefined && col.s != undefined && col.b != undefined) {\r
-                       col = this.fixHSB(col);\r
+                       col = this._fixHSB(col);\r
                } else {\r
                        return this;\r
                }\r
 \r
                this.color = col;\r
                this.origColor = col;\r
-               this.fillRGBFields(col);\r
-               this.fillHSBFields(col);\r
-               this.fillHexFields(col);\r
-               this.setHue(col);\r
-               this.setSelector(col);\r
-               this.setCurrentColor(col);\r
-               this.setNewColor(col);\r
+               this._fillRGBFields(col);\r
+               this._fillHSBFields(col);\r
+               this._fillHexFields(col);\r
+               this._setHue(col);\r
+               this._setSelector(col);\r
+               this._setCurrentColor(col);\r
+               this._setNewColor(col);\r
 \r
        }\r
        \r
index 8c9059b08cc9f4ffbfa171172898269ec3db9404..905a170914292ae8630595348a84762344e673f3 100644 (file)
@@ -13,7 +13,7 @@
 (function($) {
 
 $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
-       init: function() {
+       _init: function() {
                
                if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
                        this.element[0].style.position = 'relative';
@@ -90,7 +90,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
                        left: p.left - (parseInt(this.helper.css("left"),10) || 0) + (this.scrollLeftParent[0].scrollLeft || 0)
                } : { top: 0, left: 0 };
                
-               this.originalPosition = this.generatePosition(e);                                                                                               //Generate the original position
+               this.originalPosition = this._generatePosition(e);                                                                                              //Generate the original position
                this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size
                
                if(o.cursorAt) {
@@ -129,7 +129,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
                }
                
                //Call plugins and callbacks
-               this.propagate("start", e);
+               this._propagate("start", e);
                
                this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
                if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
@@ -138,7 +138,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
                this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
                return true;
        },
-       convertPositionTo: function(d, pos) {
+       _convertPositionTo: function(d, pos) {
 
                if(!pos) pos = this.position;
                var mod = d == "absolute" ? 1 : -1;
@@ -162,7 +162,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
                        )
                };
        },
-       generatePosition: function(e) {
+       _generatePosition: function(e) {
 
                var o = this.options;
                var position = {
@@ -210,11 +210,11 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
        mouseDrag: function(e) {
        
                //Compute the helpers position
-               this.position = this.generatePosition(e);
-               this.positionAbs = this.convertPositionTo("absolute");
+               this.position = this._generatePosition(e);
+               this.positionAbs = this._convertPositionTo("absolute");
                
                //Call plugins and callbacks and use the resulting position if something is returned            
-               this.position = this.propagate("drag", e) || this.position;
+               this.position = this._propagate("drag", e) || this.position;
        
                if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
                if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
@@ -232,17 +232,17 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
                if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true) {
                        var self = this;
                        $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10) || 500, function() {
-                               self.propagate("stop", e);
-                               self.clear();
+                               self._propagate("stop", e);
+                               self._clear();
                        });
                } else {
-                       this.propagate("stop", e);
-                       this.clear();
+                       this._propagate("stop", e);
+                       this._clear();
                }
                
                return false;
        },
-       clear: function() {
+       _clear: function() {
                this.helper.removeClass("ui-draggable-dragging");
                if(this.options.helper != 'original' && !this.cancelHelperRemoval) this.helper.remove();
                //if($.ui.ddmanager) $.ui.ddmanager.current = null;
@@ -260,9 +260,9 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
                        options: this.options                   
                };
        },
-       propagate: function(n,e) {
+       _propagate: function(n,e) {
                $.ui.plugin.call(this, n, [e, this.uiHash()]);
-               if(n == "drag") this.positionAbs = this.convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
+               if(n == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
                return this.element.triggerHandler(n == "drag" ? n : "drag"+n, [e, this.uiHash()], this.options[n]);
        },
        destroy: function() {
@@ -435,10 +435,10 @@ $.ui.plugin.add("draggable", "snap", {
                                var bs = Math.abs(b - y1) <= d;
                                var ls = Math.abs(l - x2) <= d;
                                var rs = Math.abs(r - x1) <= d;
-                               if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
-                               if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b, left: 0 }).top;
-                               if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
-                               if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r }).left;
+                               if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
+                               if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
+                               if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
+                               if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
                        }
                        
                        var first = (ts || bs || ls || rs);
@@ -448,10 +448,10 @@ $.ui.plugin.add("draggable", "snap", {
                                var bs = Math.abs(b - y2) <= d;
                                var ls = Math.abs(l - x1) <= d;
                                var rs = Math.abs(r - x2) <= d;
-                               if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t, left: 0 }).top;
-                               if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
-                               if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l }).left;
-                               if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
+                               if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
+                               if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
+                               if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
+                               if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
                        }
                        
                        if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
@@ -476,7 +476,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
                                        shouldRevert: sortable.options.revert
                                });
                                sortable.refreshItems();        //Do a one-time refresh at start to refresh the containerCache  
-                               sortable.propagate("activate", e, inst);
+                               sortable._propagate("activate", e, inst);
                        }
                });
 
@@ -499,7 +499,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
 
                                this.instance.options.helper = this.instance.options._helper;
                        } else {
-                               this.instance.propagate("deactivate", e, inst);
+                               this.instance._propagate("deactivate", e, inst);
                        }
 
                });
@@ -543,7 +543,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
                                        this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
                                        this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
                                        
-                                       inst.propagate("toSortable", e);
+                                       inst._propagate("toSortable", e);
                                
                                }
                                
@@ -565,7 +565,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
                                        this.instance.currentItem.remove();
                                        if(this.instance.placeholder) this.instance.placeholder.remove();
                                        
-                                       inst.propagate("fromSortable", e);
+                                       inst._propagate("fromSortable", e);
                                }
                                
                        };
index c792e8e63e87e5efc35d0ae8b5ec9edaa89c8dcd..97a78abcee4dfda966a6dd080b195aa386f4ffd3 100644 (file)
@@ -14,7 +14,7 @@
 (function($) {
 
 $.widget("ui.droppable", {
-       init: function() {
+       _init: function() {
                
                var o = this.options, accept = o.accept;
                this.isover = 0; this.isout = 1;
@@ -55,7 +55,7 @@ $.widget("ui.droppable", {
                        .removeData("droppable")
                        .unbind(".droppable");
        },
-       over: function(e) {
+       _over: function(e) {
                
                var draggable = $.ui.ddmanager.current;
                if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
@@ -66,7 +66,7 @@ $.widget("ui.droppable", {
                }
                
        },
-       out: function(e) {
+       _out: function(e) {
                
                var draggable = $.ui.ddmanager.current;
                if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
@@ -77,7 +77,7 @@ $.widget("ui.droppable", {
                }
                
        },
-       drop: function(e,custom) {
+       _drop: function(e,custom) {
                
                var draggable = custom || $.ui.ddmanager.current;
                if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
@@ -100,14 +100,14 @@ $.widget("ui.droppable", {
                return false;
                
        },
-       activate: function(e) {
+       _activate: function(e) {
                
                var draggable = $.ui.ddmanager.current;
                $.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]);
                if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate);
                
        },
-       deactivate: function(e) {
+       _deactivate: function(e) {
                
                var draggable = $.ui.ddmanager.current;
                $.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]);
@@ -188,7 +188,7 @@ $.ui.ddmanager = {
                        m[i].offset = m[i].element.offset();
                        m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
                        
-                       if(type == "dragstart" || type == "sortactivate") m[i].activate.call(m[i], e);                                                                          //Activate the droppable if used directly from draggables
+                       if(type == "dragstart" || type == "sortactivate") m[i]._activate.call(m[i], e);                                                                                 //Activate the droppable if used directly from draggables
                        
                }
                
@@ -200,11 +200,11 @@ $.ui.ddmanager = {
                        
                        if(!this.options) return;
                        if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
-                               dropped = this.drop.call(this, e);
+                               dropped = this._drop.call(this, e);
                        
                        if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
                                this.isout = 1; this.isover = 0;
-                               this.deactivate.call(this, e);
+                               this._deactivate.call(this, e);
                        }
                        
                });
@@ -239,17 +239,17 @@ $.ui.ddmanager = {
                        if (parentInstance && c == 'isover') {
                                parentInstance['isover'] = 0;
                                parentInstance['isout'] = 1;
-                               parentInstance.out.call(parentInstance, e);
+                               parentInstance._out.call(parentInstance, e);
                        }
                        
                        this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
-                       this[c == "isover" ? "over" : "out"].call(this, e);
+                       this[c == "isover" ? "_over" : "_out"].call(this, e);
                        
                        // we just moved out of a greedy child
                        if (parentInstance && c == 'isout') {
                                parentInstance['isout'] = 0;
                                parentInstance['isover'] = 1;
-                               parentInstance.over.call(parentInstance, e);
+                               parentInstance._over.call(parentInstance, e);
                        }
                });
                
index 6cade43717aa44fc7b89361b1e18f3e5e0b13501..d11a3a55d854f11815fca657e04cabe48219ec7e 100644 (file)
@@ -25,7 +25,7 @@ function contains(a, b) {
 };
 
 $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
-       init: function() {
+       _init: function() {
 
                var o = this.options;
                this.containerCache = {};
@@ -58,7 +58,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                };              
        },
        
-       propagate: function(n,e,inst, noPropagation) {
+       _propagate: function(n,e,inst, noPropagation) {
                $.ui.plugin.call(this, n, [e, this.ui(inst)]);
                if(!noPropagation) this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);
        },
@@ -339,20 +339,20 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                                                
                                                this.currentContainer = this.containers[i];
                                                itemWithLeastDistance ? this.options.sortIndicator.call(this, e, itemWithLeastDistance, null, true) : this.options.sortIndicator.call(this, e, null, this.containers[i].element, true);
-                                               this.propagate("change", e); //Call plugins and callbacks
-                                               this.containers[i].propagate("change", e, this); //Call plugins and callbacks
+                                               this._propagate("change", e); //Call plugins and callbacks
+                                               this.containers[i]._propagate("change", e, this); //Call plugins and callbacks
                                                
                                                //Update the placeholder
                                                this.options.placeholder.update(this.currentContainer, this.placeholder);
 
                                        }
                                        
-                                       this.containers[i].propagate("over", e, this);
+                                       this.containers[i]._propagate("over", e, this);
                                        this.containers[i].containerCache.over = 1;
                                }
                        } else {
                                if(this.containers[i].containerCache.over) {
-                                       this.containers[i].propagate("out", e, this);
+                                       this.containers[i]._propagate("out", e, this);
                                        this.containers[i].containerCache.over = 0;
                                }
                        }
@@ -435,7 +435,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                        left: po.left + this.offsetParentBorders.left
                };
        
-               this.updateOriginalPosition = this.originalPosition = this.generatePosition(e);                         //Generate the original position
+               this.updateOriginalPosition = this.originalPosition = this._generatePosition(e);                                //Generate the original position
                this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };  //Cache the former DOM position
                
                //If o.placeholder is used, create a new element at the given position with the class
@@ -451,7 +451,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                this.createPlaceholder();
 
                //Call plugins and callbacks
-               this.propagate("start", e);
+               this._propagate("start", e);
                if(!this._preserveHelperProportions) this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
                
                if(o.cursorAt) {
@@ -490,7 +490,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                
                //Post 'activate' events to possible containers
                if(!noActivation) {
-                        for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i].propagate("activate", e, this); }
+                        for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._propagate("activate", e, this); }
                }
                
                //Prepare possible droppables
@@ -505,7 +505,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
 
        },
        
-       convertPositionTo: function(d, pos) {
+       _convertPositionTo: function(d, pos) {
                if(!pos) pos = this.position;
                var mod = d == "absolute" ? 1 : -1;
                return {
@@ -524,7 +524,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                };
        },
        
-       generatePosition: function(e) {
+       _generatePosition: function(e) {
                
                var o = this.options;
                var position = {
@@ -569,14 +569,14 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
        mouseDrag: function(e) {
 
                //Compute the helpers position
-               this.position = this.generatePosition(e);
-               this.positionAbs = this.convertPositionTo("absolute");
+               this.position = this._generatePosition(e);
+               this.positionAbs = this._convertPositionTo("absolute");
 
                //Call the internal plugins
                $.ui.plugin.call(this, "sort", [e, this.ui()]);
                
                //Regenerate the absolute position used for position checks
-               this.positionAbs = this.convertPositionTo("absolute");
+               this.positionAbs = this._convertPositionTo("absolute");
                
                //Set the helper's position
                this.helper[0].style.left = this.position.left+'px';
@@ -593,11 +593,11 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                                && (this.options.type == 'semi-dynamic' ? !contains(this.element[0], this.items[i].item[0]) : true)
                        ) {
                                
-                               this.updateOriginalPosition = this.generatePosition(e);
+                               this.updateOriginalPosition = this._generatePosition(e);
                                
                                this.direction = intersection == 1 ? "down" : "up";
                                this.options.sortIndicator.call(this, e, this.items[i]);
-                               this.propagate("change", e); //Call plugins and callbacks
+                               this._propagate("change", e); //Call plugins and callbacks
                                break;
                        }
                }
@@ -647,17 +647,17 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                                left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
                                top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
                        }, parseInt(this.options.revert, 10) || 500, function() {
-                               self.clear(e);
+                               self._clear(e);
                        });
                } else {
-                       this.clear(e, noPropagation);
+                       this._clear(e, noPropagation);
                }
 
                return false;
                
        },
        
-       clear: function(e, noPropagation) {
+       _clear: function(e, noPropagation) {
 
                //We first have to update the dom position of the actual currentItem
                if(!this._noFinalSort) this.placeholder.before(this.currentItem);
@@ -668,38 +668,38 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                else
                        this.currentItem.show();
 
-               if(this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) this.propagate("update", e, null, noPropagation); //Trigger update callback if the DOM position has changed
+               if(this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) this._propagate("update", e, null, noPropagation); //Trigger update callback if the DOM position has changed
                if(!contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
-                       this.propagate("remove", e, null, noPropagation);
+                       this._propagate("remove", e, null, noPropagation);
                        for (var i = this.containers.length - 1; i >= 0; i--){
                                if(contains(this.containers[i].element[0], this.currentItem[0])) {
-                                       this.containers[i].propagate("update", e, this, noPropagation);
-                                       this.containers[i].propagate("receive", e, this, noPropagation);
+                                       this.containers[i]._propagate("update", e, this, noPropagation);
+                                       this.containers[i]._propagate("receive", e, this, noPropagation);
                                }
                        };
                };
                
                //Post events to containers
                for (var i = this.containers.length - 1; i >= 0; i--){
-                       this.containers[i].propagate("deactivate", e, this, noPropagation);
+                       this.containers[i]._propagate("deactivate", e, this, noPropagation);
                        if(this.containers[i].containerCache.over) {
-                               this.containers[i].propagate("out", e, this);
+                               this.containers[i]._propagate("out", e, this);
                                this.containers[i].containerCache.over = 0;
                        }
                }
                
                this.dragging = false;
                if(this.cancelHelperRemoval) {
-                       this.propagate("beforeStop", e, null, noPropagation);
-                       this.propagate("stop", e, null, noPropagation);
+                       this._propagate("beforeStop", e, null, noPropagation);
+                       this._propagate("stop", e, null, noPropagation);
                        return false;
                }
                
-               this.propagate("beforeStop", e, null, noPropagation);
+               this._propagate("beforeStop", e, null, noPropagation);
                
                this.placeholder.remove();
                if(this.options.helper != "original") this.helper.remove(); this.helper = null;
-               this.propagate("stop", e, null, noPropagation);
+               this._propagate("stop", e, null, noPropagation);
                
                return true;