diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2007-06-01 09:05:45 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2007-06-01 09:05:45 +0000 |
commit | 7f8b191781017f2212ca547b8d0e1fac7990e9a4 (patch) | |
tree | fe2520049124f942677e65141ced3e40e4cd1471 /misc/farbtastic | |
parent | 21e3e4b490dc99fecaca9ddf79c4b186fc3b4f4a (diff) | |
download | brdo-7f8b191781017f2212ca547b8d0e1fac7990e9a4.tar.gz brdo-7f8b191781017f2212ca547b8d0e1fac7990e9a4.tar.bz2 |
#119441: JavaScript aggregator/compressor by m3avrck and others.
Diffstat (limited to 'misc/farbtastic')
-rw-r--r-- | misc/farbtastic/farbtastic.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/misc/farbtastic/farbtastic.js b/misc/farbtastic/farbtastic.js index f37df7d72..c89e94029 100644 --- a/misc/farbtastic/farbtastic.js +++ b/misc/farbtastic/farbtastic.js @@ -9,7 +9,7 @@ jQuery.fn.farbtastic = function (callback) { jQuery.farbtastic = function (container, callback) { var container = $(container).get(0); return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback)); -} +}; jQuery._farbtastic = function (container, callback) { // Store farbtastic object @@ -62,12 +62,12 @@ jQuery._farbtastic = function (container, callback) { } } return this; - } + }; fb.updateValue = function (event) { if (this.value && this.value != fb.color) { fb.setColor(this.value); } - } + }; /** * Change color with HTML syntax #123456 @@ -81,7 +81,7 @@ jQuery._farbtastic = function (container, callback) { fb.updateDisplay(); } return this; - } + }; /** * Change color with HSL triplet [0..1, 0..1, 0..1] @@ -92,7 +92,7 @@ jQuery._farbtastic = function (container, callback) { fb.color = fb.pack(fb.rgb); fb.updateDisplay(); return this; - } + }; ///////////////////////////////////////////////////// @@ -121,7 +121,7 @@ jQuery._farbtastic = function (container, callback) { // Look for the coordinates starting from the wheel widget. var e = reference; - var offset = { x: 0, y: 0 } + var offset = { x: 0, y: 0 }; while (e) { if (typeof e.mouseX != 'undefined') { x = e.mouseX - offset.x; @@ -149,7 +149,7 @@ jQuery._farbtastic = function (container, callback) { } // Subtract distance to middle return { x: x - fb.width / 2, y: y - fb.width / 2 }; - } + }; /** * Mousedown handler @@ -168,7 +168,7 @@ jQuery._farbtastic = function (container, callback) { // Process fb.mousemove(event); return false; - } + }; /** * Mousemove handler @@ -189,7 +189,7 @@ jQuery._farbtastic = function (container, callback) { fb.setHSL([fb.hsl[0], sat, lum]); } return false; - } + }; /** * Mouseup handler @@ -199,7 +199,7 @@ jQuery._farbtastic = function (container, callback) { $(document).unbind('mousemove', fb.mousemove); $(document).unbind('mouseup', fb.mouseup); document.dragging = false; - } + }; /** * Update the markers and styles @@ -238,7 +238,7 @@ jQuery._farbtastic = function (container, callback) { else if (typeof fb.callback == 'function') { fb.callback.call(fb, fb.color); } - } + }; /** * Get absolute position of element @@ -262,7 +262,7 @@ jQuery._farbtastic = function (container, callback) { return '#' + (r < 16 ? '0' : '') + r.toString(16) + (g < 16 ? '0' : '') + g.toString(16) + (b < 16 ? '0' : '') + b.toString(16); - } + }; fb.unpack = function (color) { if (color.length == 7) { @@ -275,7 +275,7 @@ jQuery._farbtastic = function (container, callback) { parseInt('0x' + color.substring(2, 3)) / 15, parseInt('0x' + color.substring(3, 4)) / 15]; } - } + }; fb.HSLToRGB = function (hsl) { var m1, m2, r, g, b; @@ -285,7 +285,7 @@ jQuery._farbtastic = function (container, callback) { return [this.hueToRGB(m1, m2, h+0.33333), this.hueToRGB(m1, m2, h), this.hueToRGB(m1, m2, h-0.33333)]; - } + }; fb.hueToRGB = function (m1, m2, h) { h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h); @@ -293,7 +293,7 @@ jQuery._farbtastic = function (container, callback) { if (h * 2 < 1) return m2; if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6; return m1; - } + }; fb.RGBToHSL = function (rgb) { var min, max, delta, h, s, l; @@ -314,7 +314,7 @@ jQuery._farbtastic = function (container, callback) { h /= 6; } return [h, s, l]; - } + }; // Install mousedown handler (the others are set on the document on-demand) $('*', e).mousedown(fb.mousedown); @@ -326,4 +326,4 @@ jQuery._farbtastic = function (container, callback) { if (callback) { fb.linkTo(callback); } -}
\ No newline at end of file +};
\ No newline at end of file |