diff --git a/editor/jpicker/jpicker.css b/editor/jpicker/css/jPicker-1.0.9.css old mode 100644 new mode 100755 similarity index 94% rename from editor/jpicker/jpicker.css rename to editor/jpicker/css/jPicker-1.0.9.css index fa32eff8..398d3b7f --- a/editor/jpicker/jpicker.css +++ b/editor/jpicker/css/jPicker-1.0.9.css @@ -1,220 +1,228 @@ -/*[compact]*/ -.jPicker_Picker { - display: inline-block; - height: 24px; /* change this value if using a different sized color picker icon */ - position: relative; /* make this element an absolute positioning container */ - text-align: left; /* make the zero width children position to the left of container */ - width: 25px; /* change this value if using a different sized color picker icon */ -} -.jPicker_Color { - display: block; - height: 100%; - left: 0px; - position: absolute; - top: 0px; - width: 100%; -} -.jPicker_Icon { - background-repeat: no-repeat; - cursor: pointer; - display: block; - height: 100%; - left: 0px; - position: absolute; - top: 0px; - width: 100%; -} -.jPicker_Container { - display: none; - z-index: 10; /* make sure container draws above color picker icon in Firefox/Safari/Chrome/Opera/etc. - - IE calculates z-index so this won't work - we will hide all color picker icons placed after the selected one in code when shown in IE */ -} -.jPicker_table { - background-color: #efefef; - border: 1px outset #666; - font-family: Arial, Helvetica, Sans-Serif; - font-size: 12px; - height: 330px; - margin: 0px; - padding: 5px; - width: 550px; -} -.jPicker_table td { - margin: 0px; - padding: 0px; - vertical-align: top; -} -.jPicker_MoveBar { - background-color: #dddddd; - border: 1px outset #aaa; - cursor: move; - height: 12px; -} -.jPicker_ColorMap { - border: 2px inset #eee; - cursor: crosshair; - height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ - margin: 12px 5px 0px 5px; - overflow: hidden; /* hide the overdraw of the Color Map icon when at edge of viewing box */ - padding: 0px; - position: relative; /* make this element an absolute positioning container */ - width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ -} -div[class="jPicker_ColorMap"] { - height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ - width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ -} -.jPicker_ColorMap_l1, .jPicker_ColorMap_l2, .jPicker_ColorMap_l3, .jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3, .jPicker_ColorBar_l4, .jPicker_ColorBar_l5, .jPicker_AlphaBar_l1, .jPicker_AlphaBar_l2 { - background-repeat: no-repeat; - display: block; - height: 100%; - left: 0px; - position: absolute; - top: 0px; - width: 100%; -} -.jPicker_ColorMap_l1 { - background-color: #000000; - background-image: none; -} -.jPicker_ColorMap_l2 { - background-color: transparent; -} -.jPicker_ColorMap_l3 { - background-repeat: repeat; -} -.jPicker_ColorMap_Arrow { - display: block; - position: absolute; -} -.jPicker_ColorBar { - border: 2px inset #eee; - cursor: n-resize; - height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ - margin: 12px 10px 0px 5px; - padding: 0px; - position: relative; - width: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */ -} -div[class="jPicker_ColorBar"] { - height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ - width: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ -} -.jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3 { - background-color: transparent; - background-image: none; - background-repeat: repeat-x; -} -.jPicker_ColorBar_l4 { - background-color: transparent; - background-repeat: repeat-x; -} -.jPicker_ColorBar_l5 { - background-color: transparent; - background-repeat: repeat; -} -.jPicker_ColorBar_Arrow { - display: block; - left: -10px; /* (arrow width / 2) - (element width / 2) - position arrows' center in elements' center */ - position: absolute; -} -.jPicker_AlphaBar { - border: 2px inset #eee; - cursor: e-resize; - display: none; - height: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */ - margin: 10px 5px 4px 5px; - padding: 0px; - position: relative; - width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ -} -div[class="jPicker_AlphaBar"] { - height: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ - width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ -} -.jPicker_AlphaBar_Arrow { - display: block; - top: -10px; /* (arrow height / 2) - (element height / 2) - position arrows' center in elements' center */ - position: absolute; -} -.jPicker_EnableAlpha { - text-align: left; -} -.jPicker_Preview { - font-size: x-small; - text-align: center; -} -.jPicker_Preview div { - border: 2px inset #eee; - height: 62px; - margin: 0px auto; - padding: 0px; - width: 62px; -} -.jPicker_Preview div span { - border: 1px solid #000; - display: block; - height: 30px; - margin: 0px auto; - padding: 0px; - width: 60px; -} -.jPicker_Preview div span.jPicker_Active { - border-bottom-width: 0px; -} -.jPicker_Preview div span.jPicker_Current { - border-top-width: 0px; - cursor: pointer; -} -.jPicker_OkCancel { - text-align: center; - width: 120px; -} -.jPicker_OkCancel input { - width: 100px; -} -.jPicker_OkCancel input.jPicker_Ok { - margin: 12px 0px 5px 0px; -} -.jPicker_Spacer { - height: 10px; -} -.jPicker_HueText, .jPicker_SaturationText, .jPicker_BrightnessText, .jPicker_RedText, .jPicker_GreenText, .jPicker_BlueText, .jPicker_AlphaText { - background-color: #fff; - border: 1px inset #aaa; - margin: 0px 0px 0px 5px; - width: 30px; -} -.jPicker_EnterHex { - text-align: right; -} -.jPicker_HexText { - background-color: #fff; - border: 1px inset #aaa; - margin: 0px 19px 0px 5px; - width: 50px; -} -td.jPicker_OpacityCol { - padding-top: 12px; - text-indent: -8px; -} -td.jPicker_OpacityCol * { - display: none; -} -td.jPicker_HexCol { - text-align: left; -} -.jPicker_Grid { - text-align: center; -} -.jPicker_QuickColor { - border: 1px inset #aaa; - cursor: pointer; - display: block; - float: left; - height: 12px; - line-height: 12px; - margin: 2px 3px 1px 3px; - padding: 0px; - width: 12px; -} +/*[compact]*/ +.jPicker_Picker { + display: inline-block; + height: 24px; /* change this value if using a different sized color picker icon */ + position: relative; /* make this element an absolute positioning container */ + text-align: left; /* make the zero width children position to the left of container */ + width: 25px; /* change this value if using a different sized color picker icon */ +} +.jPicker_Color { + display: block; + height: 100%; + left: 0px; + position: absolute; + top: 0px; + width: 100%; +} +.jPicker_Icon { + background-repeat: no-repeat; + cursor: pointer; + display: block; + height: 100%; + left: 0px; + position: absolute; + top: 0px; + width: 100%; +} +.jPicker_Container { + display: none; + z-index: 10; /* make sure container draws above color picker icon in Firefox/Safari/Chrome/Opera/etc. - + IE calculates z-index so this won't work - we will hide all color picker icons placed after the selected one in code when shown in IE */ +} +.jPicker_table { + background-color: #efefef; + border: 1px outset #666; + font-family: Arial, Helvetica, Sans-Serif; + font-size: 12px; + height: 330px; + margin: 0px; + padding: 5px; + width: 550px; +} +.jPicker_table td { + margin: 0px; + padding: 0px; + vertical-align: top; +} +.jPicker_MoveBar { + background-color: #dddddd; + border: 1px outset #aaa; + cursor: move; + height: 12px; +} +.jPicker_Title { + font-size: 11px !important; + font-weight: bold; + margin: -2px 0px 0px 0px; + padding: 0px; + text-align: center; + width: 100%; +} +.jPicker_ColorMap { + border: 2px inset #eee; + cursor: crosshair; + height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ + margin: 0px 5px 0px 5px; + overflow: hidden; /* hide the overdraw of the Color Map icon when at edge of viewing box */ + padding: 0px; + position: relative; /* make this element an absolute positioning container */ + width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ +} +div[class="jPicker_ColorMap"] { + height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ + width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ +} +.jPicker_ColorMap_l1, .jPicker_ColorMap_l2, .jPicker_ColorMap_l3, .jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3, .jPicker_ColorBar_l4, .jPicker_ColorBar_l5, .jPicker_AlphaBar_l1, .jPicker_AlphaBar_l2 { + background-repeat: no-repeat; + display: block; + height: 100%; + left: 0px; + position: absolute; + top: 0px; + width: 100%; +} +.jPicker_ColorMap_l1 { + background-color: #000000; + background-image: none; +} +.jPicker_ColorMap_l2 { + background-color: transparent; +} +.jPicker_ColorMap_l3 { + background-repeat: repeat; +} +.jPicker_ColorMap_Arrow { + display: block; + position: absolute; +} +.jPicker_ColorBar { + border: 2px inset #eee; + cursor: n-resize; + height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ + margin: 12px 10px 0px 5px; + padding: 0px; + position: relative; + width: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */ +} +div[class="jPicker_ColorBar"] { + height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ + width: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ +} +.jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3 { + background-color: transparent; + background-image: none; + background-repeat: repeat-x; +} +.jPicker_ColorBar_l4 { + background-color: transparent; + background-repeat: repeat-x; +} +.jPicker_ColorBar_l5 { + background-color: transparent; + background-repeat: repeat; +} +.jPicker_ColorBar_Arrow { + display: block; + left: -10px; /* (arrow width / 2) - (element width / 2) - position arrows' center in elements' center */ + position: absolute; +} +.jPicker_AlphaBar { + border: 2px inset #eee; + cursor: e-resize; + display: none; + height: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */ + margin: 10px 5px 4px 5px; + padding: 0px; + position: relative; + width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */ +} +div[class="jPicker_AlphaBar"] { + height: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ + width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */ +} +.jPicker_AlphaBar_Arrow { + display: block; + top: -10px; /* (arrow height / 2) - (element height / 2) - position arrows' center in elements' center */ + position: absolute; +} +.jPicker_EnableAlpha { + text-align: left; +} +.jPicker_Preview { + font-size: x-small; + text-align: center; +} +.jPicker_Preview div { + border: 2px inset #eee; + height: 62px; + margin: 0px auto; + padding: 0px; + width: 62px; +} +.jPicker_Preview div span { + border: 1px solid #000; + display: block; + height: 30px; + margin: 0px auto; + padding: 0px; + width: 60px; +} +.jPicker_Preview div span.jPicker_Active { + border-bottom-width: 0px; +} +.jPicker_Preview div span.jPicker_Current { + border-top-width: 0px; + cursor: pointer; +} +.jPicker_OkCancel { + text-align: center; + width: 120px; +} +.jPicker_OkCancel input { + width: 100px; +} +.jPicker_OkCancel input.jPicker_Ok { + margin: 12px 0px 5px 0px; +} +.jPicker_Spacer { + height: 10px; +} +.jPicker_HueText, .jPicker_SaturationText, .jPicker_BrightnessText, .jPicker_RedText, .jPicker_GreenText, .jPicker_BlueText, .jPicker_AlphaText { + background-color: #fff; + border: 1px inset #aaa; + margin: 0px 0px 0px 5px; + width: 30px; +} +.jPicker_EnterHex { + text-align: right; +} +.jPicker_HexText { + background-color: #fff; + border: 1px inset #aaa; + margin: 0px 19px 0px 5px; + width: 50px; +} +td.jPicker_OpacityCol { + padding-top: 12px; + text-indent: -8px; +} +td.jPicker_OpacityCol * { + display: none; +} +td.jPicker_HexCol { + text-align: left; +} +.jPicker_Grid { + text-align: center; +} +.jPicker_QuickColor { + border: 1px inset #aaa; + cursor: pointer; + display: block; + float: left; + height: 12px; + line-height: 12px; + margin: 2px 3px 1px 3px; + padding: 0px; + width: 12px; +} \ No newline at end of file diff --git a/editor/jpicker/jpicker-1.0.9.js b/editor/jpicker/jpicker-1.0.9.js new file mode 100755 index 00000000..7d00ec4a --- /dev/null +++ b/editor/jpicker/jpicker-1.0.9.js @@ -0,0 +1,1675 @@ +/* + * jPicker 1.0.9 + * + * jQuery Plugin for Photoshop style color picker + * + * Copyright (c) 2009 Christopher T. Tillman + * Digital Magic Productions, Inc. (http://www.digitalmagicpro.com/) + * MIT style license, FREE to use, alter, copy, sell, and especially ENHANCE + * + * Painstakingly ported from John Dyers' excellent work on his own color picker based on the Prototype framework. + * + * John Dyers' website: (http://johndyer.name) + * Color Picker page: (http://johndyer.name/post/2007/09/PhotoShop-like-JavaScript-Color-Picker.aspx) + * + * Change Log + * ______________ + * 1.0.9 + * Added optional title variable for each jPicker window. + * + * 1.0.8 + * Moved all images into a few sprites - now using backgroundPosition to change color maps and bars instead of changing the image - this should be faster to download and run. + * + * 1.0.7 + * RENAMED CSS FILE TO INCLUDE VERSION NUMBER!!! YOU MUST USE THIS VERSIONED CSS FILE!!! There will be no need to do your own CSS version number increments from now on. + * Added opacity feedback to color preview boxes. + * Removed reliance on "id" value of containing object. Subobjects are now found by class and container instead of id's. This drastically reduces injected code. + * Removed (jQuery).jPicker.getListElementById(id) function since "id" is no longer incorporated or required. + * + * 1.0.6 + * Corrected picker bugs introduced with 1.0.5. + * Removed alpha slider bar until activated - default behavior for alpha is now OFF. + * Corrected Color constructor bug not allowing values of 0 for initial value (it was evaluating false and missing the init code - Thanks Pavol). + * Removed title tags (tooltips) from color maps and bars - They get in the way in some browsers (e.g. IE - dragging marker does NOT prevent or hide the tooltip). + * THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!! + * + * 1.0.5 + * Added opacity support to picker and color/callback methods. New property "a" (alpha - range from 0-100) in all color objects now - defaults to 100% opaque. (Thank you Pavol) + * Added title attributes to input elements - gives short tooltip directions on what button or field does. + * Commit callback used to fire on control initialization (twice actually) - This has been corrected, it does not fire on initialization. + * THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!! + * + * 1.0.4 + * Added ability for smaller picker icon with expandable window on any DOM element (not just input). + * "draggable" property renamed to "expandable" and its scope increased to create small picker icon or large static picker. + * + * 1.0.3 + * Added cancelCallback function for registering an external function when user clicks cancel button. (Thank you Jeff and Pavol) + * + * 1.0.2 + * Random bug fixes - speed concerns. + * + * 1.0.1 + * Corrected closure based memeory leak - there may be others? + * + * 1.0.0 + * First Release. + * + */ +(function($, version) +{ + var Slider = // encapsulate slider functionality for the ColorMap and ColorBar - could be useful to use a jQuery UI draggable for this with certain extensions + function(bar, options) + { + var $this = this, // private properties, methods, and events - keep these variables and classes invisible to outside code + arrow = $('img', bar), // the arrow image image to drag + barMouseDown = // bind the mousedown to the bar not the arrow for quick snapping to the clicked location + function(e) + { + setValuesFromMousePosition(e); + // Bind mousemove and mouseup event to the document so it responds when dragged of of the bar - we will unbind these when on mouseup to save processing + $(document).bind('mousemove', docMouseMove).bind('mouseup', docMouseUp); + e.stopPropagation(); + e.preventDefault(); // don't try to select anything or drag the image to the desktop + return false; + }, + docMouseMove = // set the values as the mouse moves + function(e) + { + setValuesFromMousePosition(e); + e.stopPropagation(); + e.preventDefault(); + return false; + }, + docMouseUp = // unbind the document events - they aren't needed when not dragging + function(e) + { + $(document).unbind('mouseup', docMouseUp).unbind('mousemove', docMouseMove); + e.stopPropagation(); + e.preventDefault(); + return false; + }, + setValuesFromMousePosition = // calculate mouse position and set value within the current range + function(e) + { + var offset = bar.offset(), // lets not calculate this more than once + x = e.pageX - offset.left - parseInt(bar.css('border-left-width')), + y = e.pageY - offset.top - parseInt(bar.css('border-top-width')), + barW = bar.w, // local copies for YUI compressor + barH = bar.h, + newX, + newY; + // keep the arrow within the bounds of the bar + if (x < 0) x = 0; + else if (x > barW) x = barW; + if (y < 0) y = 0; + else if (y > barH) y = barH; + // we will use Math.floor for ALL conversion to pixel lengths - parseInt takes a string as input so it boxes the number into a string THEN converts it + // number.toFixed(0) spends time processing rounding which when dealing with imprecise pixels is unnecessary + newX = Math.floor(x / barW * $this.mxX); + newY = Math.floor(y / barH * $this.mxY); + $this.x = newX; + $this.y = newY; + // if x or y have no range, set it to 1D dragging + if ($this.mxX == $this.mnX) x = 0; + if ($this.mxY == $this.mnY) y = 0; + // set the arrow position + $this.setArrowPosition(x, y); + // check if this.valuesChanged is a function and execute it if it is + $.isFunction($this.valuesChanged) && $this.valuesChanged($this); + }; + $.extend(true, $this, // public properties, methods, and event - these we need to access from other controls + { + settings: options, // we'll set map and arrow dimensions and image sources + x: 0, // this is the calculated x value based on the x range and mouse position + y: 0, // this is the calculated y value based on the y range and mouse position + mnX: 0, // set the min x value + mxX: 0, // set the max x value + mnY: 100, // set the min y value + mxY: 100, // set the max y value + valuesChanged: $.isFunction(arguments[2]) && arguments[2] || null, // pass this argument or assign the variable to register for callbacks + setPositioningVariables: + function(e) + { + var map = $this.settings.map; // local copy for YUI compressor + bar.w = map && map.width || bar.width(); + bar.h = map && map.height || bar.height(); + $this.MinX = 0; + $this.MinY = 0; + $this.MaxX = bar.w; + $this.MaxY = bar.h; + }, + setArrowPositionFromValues: + function(e) + { + $this.setPositioningVariables(); + var arrowOffsetX = 0, + arrowOffsetY = 0, + // local copies for YUI compressor + mnX = $this.mnX, + mxX = $this.mxX, + mnY = $this.mnY, + mxY = $this.mxY, + x = $this.x, + y = $this.y; + if (mnX != mxX) // range is greater than zero + { + // constrain to bounds + if (x == mnX) arrowOffsetX = 0; + else if (x == mxX) arrowOffsetX = bar.w; + else // set arrow x position + { + if (mnX < 1) mxX += Math.abs(mnX) + 1; + if (x < 1) x += 1; + arrowOffsetX = x / mxX * bar.w; + if (parseInt(arrowOffsetX) == (mxX - 1)) arrowOffsetX = mxX; + else arrowOffsetX = parseInt(arrowOffsetX); + if (mnX < 1) arrowOffsetX -= Math.abs(mnX) - 1; + } + } + if (mnY != mxY) // range is greater than zero + { + // constrain to bounds + if (y == mnY) arrowOffsetY = 0; + else if (y == mxY) arrowOffsetY = bar.h; + else // set arrow y position + { + if (mnY < 1) mxY += Math.abs(mnY) + 1; + if (y < 1) y += 1; + arrowOffsetY = y / mxY * bar.h; + if (parseInt(arrowOffsetY) == (mxY - 1)) arrowOffsetY = mxY; + else arrowOffsetY = parseInt(arrowOffsetY); + if (mnY < 1) arrowOffsetY -= Math.abs(mnY) - 1; + } + } + // set the arrow position based on these offsets + $this.setArrowPosition(arrowOffsetX, arrowOffsetY); + }, + setArrowPosition: + function(offsetX, offsetY) + { + var barW = bar.w, // local copies for YUI compressor + barH = bar.h, + arrowW = arrow.w, + arrowH = arrow.h; + // constrain arrow to bar x + if (offsetX < 0) offsetX = 0; + else if (offsetX > barW) offsetX = barW; + // constrain arrow to bar y + if (offsetY < 0) offsetY = 0; + else if (offsetY > barH) offsetY = barH; + // if arrow width is greater than bar width, center arrow and prevent horizontal dragging + if (arrowW > barW) offsetX = (barW >> 1) - (arrowW >> 1); // number >> 1 - superfast bitwise divide by two and truncate (move bits over one bit discarding lowest) + else offsetX -= arrowW >> 1; + // if arrow height is greater than bar height, center arrow and prevent vertical dragging + if (arrowH > barH) offsetY = (barH >> 1) - (arrowH >> 1); + else offsetY -= arrowH >> 1; + // set the elements offsets + arrow.css({ left: offsetX + 'px', top: offsetY + 'px' }); + }, + destroy: + function() + { + // unbind all possible events and null objects + $(document).unbind('mouseup', docMouseUp).unbind('mousemove', docMouseMove); + bar.unbind('mousedown', barMouseDown); + bar = null; + arrow = null; + $this.valuesChanged = null; + } + }); + // initialize this control + arrow.src = $this.settings.arrow && $this.settings.arrow.image; + arrow.w = $this.settings.arrow && $this.settings.arrow.width || arrow.width(); + arrow.h = $this.settings.arrow && $this.settings.arrow.height || arrow.height(); + $this.setPositioningVariables(); + // bind mousedown event + bar.bind('mousedown', barMouseDown); + $this.setArrowPositionFromValues(); + // first callback to set initial values + $.isFunction($this.valuesChanged) && $this.valuesChanged($this); + }, + ColorValuePicker = // controls for all the input elements for the typing in color values + function(picker) + { + var $this = this, // private properties and methods + hsvKeyUp = // hue, saturation, or brightness input box key up - validate value and set color + function(e) + { + if (e.target.value == '') return; + validateHsv(e); + $this.setValuesFromHsv(); + $.isFunction($this.valuesChanged) && $this.valuesChanged($this); + }, + rgbKeyUp = // red, green, or blue input box key up - validate and set color + function(e) + { + if (e.target.value == '') return; + validateRgb(e); + $this.setValuesFromRgb(); + $.isFunction($this.valuesChanged) && $this.valuesChanged($this); + }, + alphaKeyUp = // alpha input box blur - validate and set color + function(e) + { + if (e.target.value == '') return; + validateAlpha(e); + color.a = e.target.value; + $.isFunction($this.valuesChanged) && $this.valuesChanged($this); + }, + hsvBlur = // hue, saturation, or brightness input box blur - reset to original if value empty + function(e) + { + if (e.target.value == '') $this.setValuesFromRgb(); + }, + rgbBlur = // red, green, or blue input box blur - reset to original value if empty + function(e) + { + if (e.target.value == '') $this.setValuesFromHsv(); + }, + alphaBlur = // alpha input box blur - reset to 100 if empty + function(e) + { + if (e.target.value == '') fields.alpha.val(100); + }, + hexKeyUp = // hex input box key up - validate and set color + function(e) + { + if (e.target.value == '') return; + validateHex(e); + $this.setValuesFromHex(); + $.isFunction($this.valuesChanged) && $this.valuesChanged($this); + }, + hexBlur = // hex input box blur - reset to original value if empty + function(e) + { + if (e.target.value == '') $this.setValuesFromHsv(); + }, + validateRgb = // validate rgb values + function(e) + { + if (!validateKey(e)) return e; + fields.red.val(setValueInRange(fields.red.val(), 0, 255)); + fields.green.val(setValueInRange(fields.green.val(), 0, 255)); + fields.blue.val(setValueInRange(fields.blue.val(), 0, 255)); + }, + validateAlpha = // validate alpha value + function(e) + { + if (!validateKey(e)) return e; + fields.alpha.val(setValueInRange(fields.alpha.val(), 0, 100)); + }, + validateHsv = // validate hsv values + function(e) + { + if (!validateKey(e)) return e; + fields.hue.val(setValueInRange(fields.hue.val(), 0, 360)); + fields.saturation.val(setValueInRange(fields.saturation.val(), 0, 100)); + fields.value.val(setValueInRange(fields.value.val(), 0, 100)); + }, + validateHex = // validate hex value + function(e) + { + if (!validateKey(e)) return e; + fields.hex.val(fields.hex.val().replace(/[^a-fA-F0-9]/g, '0').toLowerCase().substring(0, 6)); + }, + validateKey = // validate key + function(e) + { + switch(e.keyCode) + { + case 9: + case 16: + case 29: + case 37: + case 38: + case 40: + return false; + case 'c'.charCodeAt(): + case 'v'.charCodeAt(): + if (e.ctrlKey) return false; + } + return true; + }, + setValueInRange = // constrain value within range + function(value, min, max) + { + if (value == '' || isNaN(value)) return min; + value = parseInt(value); + if (value > max) return max; + if (value < min) return min; + return value; + }; + $.extend(true, $this, // public properties and methods + { + color: new Color(), + fields: + { + hue: $('.jPicker_HueText', picker), + saturation: $('.jPicker_SaturationText', picker), + value: $('.jPicker_BrightnessText', picker), + red: $('.jPicker_RedText', picker), + green: $('.jPicker_GreenText', picker), + blue: $('.jPicker_BlueText', picker), + hex: $('.jPicker_HexText', picker), + alpha: $('.jPicker_AlphaText', picker) + }, + valuesChanged: $.isFunction(arguments[1]) && arguments[1] || null, + bindedHexKeyUp: // binded input element key up + function(e) + { + hexKeyUp(e); + }, + setValuesFromRgb: // set values when rgb changes + function() + { + color.fromRgb(fields.red.val(), fields.green.val(), fields.blue.val()); + fields.hex.val(color.hex); + fields.hue.val(color.h); + fields.saturation.val(color.s); + fields.value.val(color.v); + }, + setValuesFromHsv: // set values when hsv changes + function() + { + color.fromHsv(fields.hue.val(), fields.saturation.val(), fields.value.val()); + fields.hex.val(color.hex); + fields.red.val(color.r); + fields.green.val(color.g); + fields.blue.val(color.b); + }, + setValuesFromHex: // set values when hex changes + function() + { + color.fromHex(fields.hex.val()); + fields.red.val(color.r); + fields.green.val(color.g); + fields.blue.val(color.b); + fields.hue.val(color.h); + fields.saturation.val(color.s); + fields.value.val(color.v); + }, + setAlphaFromValue: // set alpha value when bar changes + function() + { + color.a=fields.alpha.val(); + }, + destroy: + function() + { + // unbind all events and null objects + fields.hue.add(fields.saturation).add(fields.value).unbind('keyup', events.hsvKeyUp).unbind('blur', hsvBlur); + fields.red.add(fields.green).add(fields.blue).unbind('keyup', events.rgbKeyUp).unbind('blur', rgbBlur); + fields.alpha.unbind('keyup', alphaKeyUp).unbind('blur', alphaBlur); + fields.hex.unbind('keyup', hexKeyUp); + fields = null; + color = null; + $this.valuesChanged = null; + } + }); + var fields = $this.fields, color = $this.color; // local copies for YUI compressor + fields.hue.add(fields.saturation).add(fields.value).bind('keyup', hsvKeyUp).bind('blur', hsvBlur); + fields.red.add(fields.green).add(fields.blue).bind('keyup', rgbKeyUp).bind('blur', rgbBlur); + fields.alpha.bind('keyup', alphaKeyUp).bind('blur', alphaBlur); + fields.hex.bind('keyup', hexKeyUp).bind('blur', hexBlur); + if (fields.hex.val() != '') + { + color.fromHex(fields.hex.val()); + $this.setValuesFromHex(); + } + }; + $.jPicker = + { + List: [], // array holding references to each active instance of the control + Color: // color object - we will be able to assign by any color space type or retrieve any color space info + // we want this public so we can optionally assign new color objects to initial values using inputs other than a string hex value (also supported) + function(init) + { + var $this = this; + $.extend(true, $this, // public properties and methods + { + r: 0, // Red + g: 0, // Green + b: 0, // Blue + h: 0, // Hue + s: 0, // Saturation + v: 0, // Brightness + a: 100, // Alpha + hex: '', // Hex + fromRgb: + function(r, g, b) + { + var $this = this; + $this.r = r; + $this.g = g; + $this.b = b; + var newHsv = ColorMethods.rgbToHsv($this); + $this.h = newHsv.h; + $this.s = newHsv.s; + $this.v = newHsv.v; + $this.hex = ColorMethods.rgbToHex($this); + }, + fromHsv: + function(h, s, v) + { + var $this = this; + $this.h = h; + $this.s = s; + $this.v = v; + var newRgb = ColorMethods.hsvToRgb($this); + $this.r = newRgb.r; + $this.g = newRgb.g; + $this.b = newRgb.b; + $this.hex = ColorMethods.rgbToHex(newRgb); + }, + fromHex: + function(hex) + { + var $this = this; + $this.hex = hex; + var newRgb = ColorMethods.hexToRgb(hex); + $this.r = newRgb.r; + $this.g = newRgb.g; + $this.b = newRgb.b; + var newHsv = ColorMethods.rgbToHsv(newRgb); + $this.h = newHsv.h; + $this.s = newHsv.s; + $this.v = newHsv.v; + $this.hex = ColorMethods.rgbToHex(newRgb); + } + }); + if (init) + { + if (init.hex) $this.fromHex(init.hex); + else if (!isNaN(init.r)) $this.fromRgb(init.r, init.g, init.b); + else if (!isNaN(init.h)) $this.fromHsv(init.h, init.s, init.v); + if (!isNaN(init.a)) $this.a = init.a; + } + }, + ColorMethods: // color conversion methods - make public to give use to external scripts + { + hexToRgb: + function(hex) + { + hex = this.validateHex(hex); + var r = '00', g = '00', b = '00'; + if (hex.length == 6) + { + r = hex.substring(0, 2); + g = hex.substring(2, 4); + b = hex.substring(4, 6); + } + else + { + if (hex.length > 4) + { + r = hex.substring(4, hex.length); + hex = hex.substring(0, 4); + } + if (hex.length > 2) + { + g = hex.substring(2, hex.length); + hex = hex.substring(0, 2); + } + if (hex.length > 0) b = hex.substring(0, hex.length); + } + return { r: this.hexToInt(r), g: this.hexToInt(g), b: this.hexToInt(b) }; + }, + validateHex: + function(hex) + { + hex = hex.toLowerCase().replace(/[^a-f0-9]/g, '0'); + if (hex.length > 6) hex = hex.substring(0, 6); + return hex; + }, + rgbToHex: + function(rgb) + { + return this.intToHex(rgb.r) + this.intToHex(rgb.g) + this.intToHex(rgb.b); + }, + intToHex: + function(dec) + { + var result = parseInt(dec).toString(16); + if (result.length == 1) result = ('0' + result); + return result.toLowerCase(); + }, + hexToInt: + function(hex) + { + return parseInt(hex, 16); + }, + rgbToHsv: + function(rgb) + { + var r = rgb.r / 255, g = rgb.g / 255, b = rgb.b / 255, hsv = { h: 0, s: 0, v: 0 }, min = 0, max = 0, delta; + if (r >= g && r >= b) + { + max = r; + min = g > b ? b : g; + } + else if (g >= b && g >= r) + { + max = g; + min = r > b ? b : r; + } + else + { + max = b; + min = g > r ? r : g; + } + hsv.v = max; + hsv.s = max ? (max - min) / max : 0; + if (!hsv.s) hsv.h = 0; + else + { + delta = max - min; + if (r == max) hsv.h = (g - b) / delta; + else if (g == max) hsv.h = 2 + (b - r) / delta; + else hsv.h = 4 + (r - g) / delta; + hsv.h = parseInt(hsv.h * 60); + if (hsv.h < 0) hsv.h += 360; + } + hsv.s = parseInt(hsv.s * 100); + hsv.v = parseInt(hsv.v * 100); + return hsv; + }, + hsvToRgb: + function(hsv) + { + var rgb = { r: 0, g: 0, b: 0 }, h = hsv.h, s = hsv.s, v = hsv.v; + if (s == 0) + { + if (v == 0) rgb.r = rgb.g = rgb.b = 0; + else rgb.r = rgb.g = rgb.b = parseInt(v * 255 / 100); + } + else + { + if (h == 360) h = 0; + h /= 60; + s = s / 100; + v = v / 100; + var i = parseInt(h), + f = h - i, + p = v * (1 - s), + q = v * (1 - (s * f)), + t = v * (1 - (s * (1 - f))); + switch (i) + { + case 0: + rgb.r = v; + rgb.g = t; + rgb.b = p; + break; + case 1: + rgb.r = q; + rgb.g = v; + rgb.b = p; + break; + case 2: + rgb.r = p; + rgb.g = v; + rgb.b = t; + break; + case 3: + rgb.r = p; + rgb.g = q; + rgb.b = v; + break; + case 4: + rgb.r = t; + rgb.g = p; + rgb.b = v; + break; + case 5: + rgb.r = v; + rgb.g = p; + rgb.b = q; + break; + } + rgb.r = parseInt(rgb.r * 255); + rgb.g = parseInt(rgb.g * 255); + rgb.b = parseInt(rgb.b * 255); + } + return rgb; + } + } + }; + var Color = $.jPicker.Color, List = $.jPicker.List, ColorMethods = $.jPicker.ColorMethods; // local copies for YUI compressor + $.fn.jPicker = + function(options) + { + var $arguments = arguments; + return this.each( + function() + { + var $this = $(this), $settings = $.extend(true, {}, $.fn.jPicker.defaults, options); // local copies for YUI compressor + if ($this.get(0).nodeName.toLowerCase() == 'input') // Add color picker icon if binding to an input element and bind the events to the input + { + $.extend(true, $settings, + { + window: + { + bindToInput: true, + expandable: true, + input: $this + } + }); + if (ColorMethods.validateHex($this.val())) + { + $settings.color.active = new Color({ hex: $this.val(), a: $settings.color.active.a }); + $settings.color.current = new Color({ hex: $this.val(), a: $settings.color.active.a }); + } + } + if ($settings.window.expandable) + $this.after('   '); + else $settings.window.liveUpdate = false; // Basic control binding for inline use - You will need to override the liveCallback or commitCallback function to retrieve results + var isLessThanIE7 = parseFloat(navigator.appVersion.split('MSIE')[1]) < 7 && document.body.filters, // needed to run the AlphaImageLoader function for IE6 + colorMapL1 = null, // different layers of colorMap and colorBar + colorMapL2 = null, + colorMapL3 = null, + colorBarL1 = null, + colorBarL2 = null, + colorBarL3 = null, + colorBarL4 = null, + colorBarL5 = null, + enableAlpha = null, + alphaCheckbox = null, + alphaBarDiv = null, + alphaBarL1 = null, + alphaBarL2 = null, + container = null, + hue = null, // radio buttons + saturation = null, + value = null, + red = null, + green = null, + blue = null, + colorMap = null, // color maps + colorBar = null, + alphaBar = null, + colorPicker = null, + elementStartX = null, // Used to record the starting css positions for dragging the control + elementStartY = null, + pageStartX = null, // Used to record the mousedown coordinates for dragging the control + pageStartY = null, + activeColor = null, // color boxes above the radio buttons + currentColor = null, + currentActiveBG = null, + okButton = null, + cancelButton = null, + grid = null, // preset colors grid + colorBox = null, // colorBox for popup button + colorIcon = null, // colorIcon popup icon + moveBar = null, // drag bar + setColorMode = // set color mode and update visuals for the new color mode + function(colorMode) + { + color.active = colorPicker.color; + var active = color.active, // local copies for YUI compressor + clientPath = images.clientPath, + resetImage = + function(img) + { + setAlpha(img, 100); + img.css({ backgroundColor: '', backgroundPosition: '0px 0px', filter: '' }); + }; + resetImage(colorMapL1); // reset images + resetImage(colorMapL2); + resetImage(colorBarL1); + resetImage(colorBarL2); + resetImage(colorBarL3); + resetImage(colorBarL4); + hue.add(saturation).add(value).add(red).add(green).add(blue).removeAttr('checked'); + switch (colorMode) + { + case 'h': + hue.attr('checked', true); + colorMapL1.css({ backgroundColor: '#' + active.hex }); + colorMapL2.css({ backgroundColor: 'transparent' }); + setImgLoc(colorMapL2, -256); + setAlpha(colorMapL2, 100); + setImgLoc(colorBarL4, -256); + colorMap.mxX = 100; + colorMap.mxY = 100; + colorBar.mxY = 360; + break; + case 's': + saturation.attr('checked', true); + setImgLoc(colorMapL1, -512); + setImgLoc(colorMapL2, -768); + setAlpha(colorMapL2, 0); + setBG(colorBarL3, active.hex); + setImgLoc(colorBarL4, -512); + colorMap.mxX = 360; + colorMap.mxY = 100; + colorBar.mxY = 100; + break; + case 'v': + value.attr('checked', true); + setBG(colorMapL1, '000'); + setImgLoc(colorMapL2, -1024); + colorBarL3.css({ backgroundColor: '#' + active.hex }); + setImgLoc(colorBarL4, -768); + colorMap.mxX = 360; + colorMap.mxY = 100; + colorBar.mxY = 100; + break; + case 'r': + red.attr('checked', true); + setImgLoc(colorMapL2, -1536); + setImgLoc(colorMapL1, -1280); + setImgLoc(colorBarL4, -1024); + setImgLoc(colorBarL3, -1280); + setImgLoc(colorBarL2, -1536); + setImgLoc(colorBarL1, -1792); + break; + case 'g': + green.attr('checked', true); + setImgLoc(colorMapL2, -2048); + setImgLoc(colorMapL1, -1792); + setImgLoc(colorBarL4, -2048); + setImgLoc(colorBarL3, -2304); + setImgLoc(colorBarL2, -2560); + setImgLoc(colorBarL1, -2816); + break; + case 'b': + blue.attr('checked', true); + setImgLoc(colorMapL2, -2560); + setImgLoc(colorMapL1, -2304); + setImgLoc(colorBarL4, -3072); + setImgLoc(colorBarL3, -3328); + setImgLoc(colorBarL2, -3584); + setImgLoc(colorBarL1, -3840); + break; + default: + throw ('Invalid Mode'); + break; + } + switch (colorMode) + { + case 'h': + case 's': + case 'v': + colorMap.mnX = 1; + colorMap.mnY = 1; + colorBar.mnY = 1; + break; + case 'r': + case 'g': + case 'b': + colorMap.mnX = 0; + colorMap.mnY = 0; + colorBar.mnY = 0; + colorMap.mxX = 255; + colorMap.mxY = 255; + colorBar.mxY = 255; + break; + } + color.mode = colorMode; + positionMapAndBarArrows(); + updateMapVisuals(); + updateBarVisuals(); + if (window.expandable && window.liveUpdate) + { + colorBox.css({ backgroundColor: '#' + active.hex }); + if (window.bindToInput) + window.input.val(active.hex).css( + { + backgroundColor: '#' + active.hex, + color: active.v > 75 ? '#000000' : '#ffffff' + }); + } + $.isFunction($this.liveCallback) && $this.liveCallback(active); + }, + textValuesChanged = // Update color when user changes text values + function() + { + positionMapAndBarArrows(); + updateVisuals(); + color.active = colorPicker.color; + var active = color.active; // local copy for YUI compressor + if (window.expandable && window.liveUpdate) + { + colorBox.css({ backgroundColor: '#' + active.hex }); + if (window.bindToInput) + window.input.val(colorPicker.fields.hex.val()).css( + { + backgroundColor: '#' + active.hex, + color: active.v > 75 ? '#000000' : '#ffffff' + }); + } + $.isFunction($this.liveCallback) && $this.liveCallback(active); + }, + mapValueChanged = // user has dragged the ColorMap pointer + function() + { + if (!colorPicker || !colorMap || !colorBar || !alphaBar) return; + color.active = colorPicker.color; + var fields = colorPicker.fields, // local copies for YUI compressor + active = color.active; + switch (color.mode) + { + case 'h': + fields.saturation.val(colorMap.x); + fields.value.val(100 - colorMap.y); + break; + case 's': + fields.hue.val(colorMap.x); + fields.value.val(100 - colorMap.y); + break; + case 'v': + fields.hue.val(colorMap.x); + fields.saturation.val(100 - colorMap.y); + break; + case 'r': + fields.blue.val(colorMap.x); + fields.green.val(255 - colorMap.y); + break; + case 'g': + fields.blue.val(colorMap.x); + fields.red.val(255 - colorMap.y); + break; + case 'b': + fields.red.val(colorMap.x); + fields.green.val(255 - colorMap.y); + break; + } + switch (color.mode) + { + case 'h': + case 's': + case 'v': + colorPicker.setValuesFromHsv(); + break; + case 'r': + case 'g': + case 'b': + colorPicker.setValuesFromRgb(); + break; + } + updateVisuals(); + if (window.expandable && window.liveUpdate) + { + colorBox.css({ backgroundColor: '#' + active.hex }); + if (window.bindToInput) + window.input.val(active.hex).css( + { + backgroundColor: '#' + active.hex, + color: active.v > 75 ? '#000000' : '#ffffff' + }); + } + $.isFunction($this.liveCallback) && $this.liveCallback(active); + }, + colorBarValueChanged = // user has dragged the ColorBar slider + function() + { + if (!colorPicker || !colorMap || !colorBar || !alphaBar) return; + color.active = colorPicker.color; + var fields = colorPicker.fields, // local copies for YUI compressor + active = color.active; + switch (color.mode) + { + case 'h': + fields.hue.val(360 - colorBar.y); + break; + case 's': + fields.saturation.val(100 - colorBar.y); + break; + case 'v': + fields.value.val(100 - colorBar.y); + break; + case 'r': + fields.red.val(255 - colorBar.y); + break; + case 'g': + fields.green.val(255 - colorBar.y); + break; + case 'b': + fields.blue.val(255 - colorBar.y); + break; + } + switch (color.mode) + { + case 'h': + case 's': + case 'v': + colorPicker.setValuesFromHsv(); + break; + case 'r': + case 'g': + case 'b': + colorPicker.setValuesFromRgb(); + break; + } + updateVisuals(); + if (window.expandable && window.liveUpdate) + { + colorBox.css({ backgroundColor: '#' + active.hex }); + if (window.bindToInput) + window.input.val(active.hex).css( + { + backgroundColor: '#' + active.hex, + color: active.v > 75 ? '#000000' : '#ffffff' + }); + } + $.isFunction($this.liveCallback) && $this.liveCallback(active); + }, + alphaBarValueChanged = + function() + { + if (!colorPicker || !colorMap || !colorBar || !alphaBar) return; + color.active = colorPicker.color; + var fields = colorPicker.fields, // local copies for YUI compressor + active = color.active; + fields.alpha.val(alphaBar.x); + colorPicker.setAlphaFromValue(); + updateVisuals(); + $.isFunction($this.liveCallback) && $this.liveCallback(color.active); + }, + positionMapAndBarArrows = // position map and bar arrows to match current color + function() + { + color.active = colorPicker.color; + var sliderValue = 0, + active = color.active; // local copy for YUI compressor + switch ($this.settings.color.mode) + { + case 'h': + sliderValue = 360 - active.h; + break; + case 's': + sliderValue = 100 - active.s; + break; + case 'v': + sliderValue = 100 - active.v; + break; + case 'r': + sliderValue = 255 - active.r; + break; + case 'g': + sliderValue = 255 - active.g; + break; + case 'b': + sliderValue = 255 - active.b; + break; + } + colorBar.y = sliderValue; + alphaBar.x = active.a; + colorBar.setArrowPositionFromValues(); + alphaBar.setArrowPositionFromValues(); + var mapX = 0, mapY = 0; + switch ($this.settings.color.mode) + { + case 'h': + mapX = active.s; + mapY = 100 - active.v; + break; + case 's': + mapX = active.h; + mapY = 100 - active.v; + break; + case 'v': + mapX = active.h; + mapY = 100 - active.s; + break; + case 'r': + mapX = active.b; + mapY = 256 - active.g; + break; + case 'g': + mapX = active.b; + mapY = 256 - active.r; + break; + case 'b': + mapX = active.r; + mapY = 256 - active.g; + break; + } + colorMap.x = mapX; + colorMap.y = mapY; + colorMap.setArrowPositionFromValues(); + }, + updateVisuals = + function() + { + updatePreview(); + updateMapVisuals(); + updateBarVisuals(); + updateAlphaVisuals(); + }, + updatePreview = + function() + { + try + { + activeColor.css({ backgroundColor: '#' + colorPicker.color.hex }); + setAlpha(activeColor, colorPicker.color.a); + } + catch (e) { } + }, + updateMapVisuals = + function() + { + if (!color || !colorPicker) return; + color.active = colorPicker.color; + var active = color.active; // local copy for YUI compressor + switch (color.mode) + { + case 'h': + setBG(colorMapL1, new Color({ h: active.h, s: 100, v: 100 }).hex); + break; + case 's': + setAlpha(colorMapL2, 100 - active.s); + break; + case 'v': + setAlpha(colorMapL2, active.v); + break; + case 'r': + setAlpha(colorMapL2, active.r / 256 * 100); + break; + case 'g': + setAlpha(colorMapL2, active.g / 256 * 100); + break; + case 'b': + setAlpha(colorMapL2, active.b / 256 * 100); + break; + } + setAlpha(colorMapL3, 100 - active.a); + }, + updateBarVisuals = + function() + { + if (!color || !colorPicker) return; + color.active = colorPicker.color; + var active = color.active, // local copy for YUI compressor + mode = color.mode, + fields = colorPicker.fields; + switch (mode) + { + case 'h': + break; + case 's': + var saturatedColor = new Color({ h: active.h, s: 100, v: active.v }); + setBG(colorBarL3, saturatedColor.hex); + break; + case 'v': + var valueColor = new Color({ h: active.h, s: active.s, v: 100 }); + setBG(colorBarL3, valueColor.hex); + break; + case 'r': + case 'g': + case 'b': + var hValue = 0, vValue = 0; + if (mode == 'r') + { + hValue = fields.blue.val(); + vValue = fields.green.val(); + } + else if (mode == 'g') + { + hValue = fields.blue.val(); + vValue = fields.red.val(); + } + else if (mode == 'b') + { + hValue = fields.red.val(); + vValue = fields.green.val(); + } + var horzPer = hValue / 256 * 100, vertPer = vValue / 256 * 100, horzPerRev = (256 - hValue) / 256 * 100, vertPerRev = (256 - vValue) / 256 * 100; + setAlpha(colorBarL4, vertPer > horzPerRev ? horzPerRev : vertPer); + setAlpha(colorBarL3, vertPer > horzPer ? horzPer : vertPer); + setAlpha(colorBarL2, vertPerRev > horzPer ? horzPer : vertPerRev); + setAlpha(colorBarL1, vertPerRev > horzPerRev ? horzPerRev : vertPerRev); + break; + } + setAlpha(colorBarL5, 100 - active.a); + }, + updateAlphaVisuals = + function() + { + setBG(alphaBarL1, colorPicker.color.hex); + }, + setBG = + function(el, c) + { + try + { + el.css({ backgroundColor: '#' + c }); + } + catch (e) { } + }, + setImg = + function(img, src) + { + if (src.indexOf('png') && this.isLessThanIE7) + { + img.attr('pngSrc', src); + img.css({ backgroundImage: 'none', filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\')' }); + } + else img.css({ backgroundImage: 'url(' + src + ')' }); + }, + setImgLoc = + function(img, y) + { + img.css({ backgroundPosition: '0px ' + y + 'px' }); + }, + setAlpha = + function(obj, alpha) + { + if (alpha < 100) + { + if (this.isLessThanIE7) + { + var src = obj.attr('pngSrc'); + if (src != null && src.indexOf('map-hue') == -1) + obj.css({ filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\') progid:DXImageTransform.Microsoft.Alpha(opacity=' + alpha + ')' }); + } + else obj.css({ opacity: alpha / 100 }); + } + else if (alpha == 100) // IE7 still will not combine 8-bit PNG translucency AND element opacity without drawing errors + // Even opacity:1.0 (or filter:Alpha(opacity=100)) causes issues, so remove it if opaque + { + if (this.isLessThanIE7) + { + var src = obj.attr('pngSrc'); + if (src != null && src.indexOf('map-hue') == -1) obj.css({ filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\')' }); + } + else obj.css({ opacity: '' }); + } + }, + revertColor = // revert color to original color when opened + function() + { + colorPicker.fields.hex.val(color.current.hex); + colorPicker.fields.alpha.val(color.current.a); + colorPicker.setValuesFromHex(); + colorPicker.setAlphaFromValue(); + $.isFunction(colorPicker.valuesChanged) && colorPicker.valuesChanged(colorPicker); + }, + radioClicked = + function(e) + { + setColorMode(e.target.value); + }, + currentClicked = + function() + { + revertColor(); + }, + cancelClicked = + function() + { + revertColor(); + window.expandable && $this.hide(); + $.isFunction($this.cancelCallback) && $this.cancelCallback(); + }, + commitColor = // commit the color changes + function() + { + var active = color.active; // local copies for YUI compressor + color.current = new Color({ hex: active.hex }); + color.current.a = active.a; + currentColor.css({ backgroundColor: '#' + active.hex }); + setAlpha(currentColor, colorPicker.color.a); + if (window.expandable) + { + colorBox.css({ backgroundColor: '#' + active.hex }); + if (window.bindToInput) + window.input.val(active.hex).css( + { + backgroundColor: '#' + active.hex, + color: active.v > 75 ? '#000000' : '#ffffff' + }); + } + $.isFunction($this.commitCallback) && $this.commitCallback(active); + }, + okClicked = + function() + { + commitColor(); + window.expandable && $this.hide(); + }, + colorIconClicked = + function() + { + $this.show(); + }, + moveBarMouseDown = + function(e) + { + var element = window.element, // local copies for YUI compressor + page = window.page; + elementStartX = parseInt(container.css('left')); + elementStartY = parseInt(container.css('top')); + pageStartX = e.pageX; + pageStartY = e.pageY; + // bind events to document to move window - we will unbind these on mouseup + $(document).bind('mousemove', documentMouseMove).bind('mouseup', documentMouseUp); + e.stopPropagation(); + e.preventDefault(); // prevent attempted dragging of the column + return false; + }, + documentMouseMove = + function(e) + { + container.css({ left: elementStartX - (pageStartX - e.pageX) + 'px', top: elementStartY - (pageStartY - e.pageY) + 'px' }); + e.stopPropagation(); + e.preventDefault(); + return false; + }, + documentMouseUp = + function(e) + { + $(document).unbind('mousemove', documentMouseMove).unbind('mouseup', documentMouseUp); + e.stopPropagation(); + e.preventDefault(); + return false; + }, + bindedHexKeyUp = + function(e) + { + colorPicker.fields.hex.val($this.settings.window.input.val()); + colorPicker.bindedHexKeyUp(e); + }, + quickPickClicked = + function(e) + { + colorPicker.fields.hex.val(color.quickList[e.data.i].hex); + colorPicker.fields.alpha.val(color.quickList[e.data.i].a); + colorPicker.setValuesFromHex(); + colorPicker.setAlphaFromValue(); + $.isFunction(colorPicker.valuesChanged) && colorPicker.valuesChanged(colorPicker); + }; + $.extend(true, $this, // public properties, methods, and callbacks + { + id: $this.attr('id'), + settings: $settings, + color: null, + icon: null, + commitCallback: $.isFunction($arguments[1]) && $arguments[1] || null, // commitCallback function can be overridden to return the selected color to a method you specify when the user clicks "OK" + liveCallback: $.isFunction($arguments[2]) && $arguments[2] || null, // liveCallback function can be overridden to return the selected color to a method you specify in live mode (continuous update) + cancelCallback: $.isFunction($arguments[3]) && $arguments[3] || null, // cancelCallback function can be overridden to a method you specify when the user clicks "Cancel" + show: + function() + { + if (document.all) // In IE, due to calculated z-index values, we need to hide all color picker icons that appear later in the source code than this one + { + var foundthis = false; + for (i = 0; i < List.length; i++) + { + if (foundthis) List[i].color.add(List[i].icon).css({ display: 'none' }); + if (List[i].id == $this.id) foundthis = true; + } + } + color.current = new Color({ hex: color.active.hex, a: color.active.a }); + currentColor.css({ backgroundColor: '#' + color.active.hex }); + setAlpha(currentColor, color.active.a); + container.css({ display: 'block' }); + colorMap.setPositioningVariables(); + colorBar.setPositioningVariables(); + positionMapAndBarArrows(); + }, + hide: + function() + { + if (document.all) // In IE, show the previously hidden color picker icons again + { + var foundthis = false; + for (i = 0; i < List.length; i++) + { + if (foundthis) List[i].color.add(List[i].icon).css({ display: 'block' }); + if (List[i].id == $this.id) foundthis = true; + } + } + container.css({ display: 'none' }); + }, + destroy: // destroys this control entirely, removing all events and objects, and removing itself from the List + function() + { + if (window.expandable) colorIcon = $('.jPicker_Icon', container).unbind('click', colorIconClicked); + if (window.bindToInput) window.input.unbind('keyup', bindedHexKeyUp).unbind('change', bindedHexKeyUp); + hue.add(saturation).add(value).add(red).add(green).add(blue).unbind('click', radioClicked); + currentColor.unbind('click', currentClicked); + cancelButton.unbind('click', cancelClicked); + okButton.unbind('click', okClicked); + if (window.expandable) moveBar.unbind('mousedown', moveBarMouseDown); + $('.jPicker_QuickColor', container).unbind('click', quickPickClicked); + hue = null; + saturation = null; + value = null; + red = null; + green = null; + blue = null; + colorMapL1 = null; + colorMapL2 = null; + colorMapL3 = null; + colorBarL1 = null; + colorBarL2 = null; + colorBarL3 = null; + colorBarL4 = null; + colorBarL5 = null; + enableAlpha = null; + alphaCheckbox = null; + alphaBarDiv = null; + alphaBarL1 = null; + alphaBarL2 = null; + currentActiveBG = null; + activeColor = null; + currentColor = null; + okButton = null; + cancelButton = null; + grid = null; + $this.color = null; + $this.icon = null; + colorMap.destroy(); + colorMap = null; + colorBar.destroy(); + colorBar = null; + alphaBar.destroy(); + alphaBar = null; + colorPicker.destroy(); + colorPicker = null; + $this.commitCallback = null; + $this.cancelCallback = null; + $this.liveCallback = null; + container.html(''); + for (i = 0; i < List.length; i++) if (List[i].id == $this.id) List.splice(i, 1); + } + }); + var images = $this.settings.images, // local copies for YUI compressor + window = $this.settings.window, + color = $this.settings.color; + container = window.expandable ? $('.jPicker_Container', $this.next()) : $this; + if (window.expandable) + container.css( // positions must be set and display set to absolute before source code injection or IE will size the container to fit the window + { + left: window.position.x == 'left' ? '-526px' : window.position.x == 'center' ? '-259px' : window.position.x == 'right' ? '0px' : window.position.x == 'screenCenter' ? + (($(document).width() >> 1) - 259) - $this.next().offset().left + 'px' : window.position.x, + position: 'absolute', + top: window.position.y == 'top' ? '-340px' : window.position.y == 'center' ? '-153px' : window.position.y == 'bottom' ? '25px' : window.position.y + }); + // if default colors are hex strings, change them to color objects + if ((typeof (color.active)).toString().toLowerCase() == 'string') color.active = new Color({ hex: color.active.substring(1) }); + // inject html source code - we are using a single table for this control - I know tables are considered bad, but it takes care of equal height columns and + // this control really is tabular data, so I believe it is the right move + if (!color.alphaSupport) color.active.a = 100; + container.html('' + (window.expandable ? '' : '') + '
 

' + (window.title || 'Drag Markers To Pick A Color') + '

   
     
new
  
current

 
°
%
%
 
  
% 
'); + // initialize the objects to the source code just injected + hue = $('.jPicker_HueRadio', container); + saturation = $('.jPicker_SaturationRadio', container); + value = $('.jPicker_BrightnessRadio', container); + red = $('.jPicker_RedRadio', container); + green = $('.jPicker_GreenRadio', container); + blue = $('.jPicker_BlueRadio', container); + colorMapL1 = $('.jPicker_ColorMap_l1', container); + colorMapL2 = $('.jPicker_ColorMap_l2', container); + colorMapL3 = $('.jPicker_ColorMap_l3', container); + colorBarL1 = $('.jPicker_ColorBar_l1', container); + colorBarL2 = $('.jPicker_ColorBar_l2', container); + colorBarL3 = $('.jPicker_ColorBar_l3', container); + colorBarL4 = $('.jPicker_ColorBar_l4', container); + colorBarL5 = $('.jPicker_ColorBar_l5', container); + alphaBarL1 = $('.jPicker_AlphaBar_l1', container); + alphaBarL2 = $('.jPicker_AlphaBar_l2', container); + enableAlpha = $('.jPicker_EnableAlpha', container); + alphaCheckbox = $('.jPicker_AlphaCheckbox', container); + alphaBarDiv = $('.jPicker_AlphaBar', container); + currentActiveBG = $('.jPicker_NewCurrent', container); + activeColor = $('.jPicker_Active', container).css({ backgroundColor: '#' + color.active.hex }); + currentColor = $('.jPicker_Current', container).css({ backgroundColor: '#' + color.active.hex }); + okButton = $('.jPicker_Ok', container); + cancelButton = $('.jPicker_Cancel', container); + grid = $('.jPicker_Grid', container); + $this.color = $('.Picker_Color'); + $this.icon = $('.jPicker_Icon'); + // create color pickers and maps + colorPicker = new ColorValuePicker(container, textValuesChanged); + colorMap = new Slider($('.jPicker_ColorMap', container), + { + map: + { + width: images.colorMap.width, + height: images.colorMap.height + }, + arrow: + { + image: images.clientPath + images.colorMap.arrow.file, + width: images.colorMap.arrow.width, + height: images.colorMap.arrow.height + } + }, + mapValueChanged); + colorBar = new Slider($('.jPicker_ColorBar', container), + { + map: + { + width: images.colorBar.width, + height: images.colorBar.height + }, + arrow: + { + image: images.clientPath + images.colorBar.arrow.file, + width: images.colorBar.arrow.width, + height: images.colorBar.arrow.height + } + }, + colorBarValueChanged); + alphaBar = new Slider($('.jPicker_AlphaBar', container), + { + map: + { + width: images.alphaBar.width, + height: images.alphaBar.height + }, + arrow: + { + image: images.clientPath + images.alphaBar.arrow.file, + width: images.alphaBar.arrow.width, + height: images.alphaBar.arrow.height + } + }, + alphaBarValueChanged); + alphaBar.mnX = 0; + alphaBar.mxX = 100; + setImg(colorMapL1, images.clientPath + 'Maps.png'); + setImg(colorMapL2, images.clientPath + 'Maps.png'); + setImg(colorMapL3, images.clientPath + 'map-opacity.png'); + setImg(colorBarL1, images.clientPath + 'Bars.png'); + setImg(colorBarL2, images.clientPath + 'Bars.png'); + setImg(colorBarL3, images.clientPath + 'Bars.png'); + setImg(colorBarL4, images.clientPath + 'Bars.png'); + setImg(colorBarL5, images.clientPath + 'bar-opacity.png'); + setImg(alphaBarL2, images.clientPath + 'Maps.png'); + setImgLoc(alphaBarL2, -2816); + setImg(currentActiveBG, images.clientPath + 'preview-opacity.png'); + currentActiveBG.css({ backgroundPosition: '1px 1px' }); + if (color.alphaSupport) + { + enableAlpha.hide(); + alphaBarDiv.show(); + $('td.jPicker_OpacityCol *', container).show(); + } + else + alphaCheckbox.bind('click', + function() + { + enableAlpha.hide(); + alphaBarDiv.show(); + $('td.jPicker_OpacityCol *', container).show(); + }); + // bind to input + if (window.expandable) + { + colorBox = $('.jPicker_Color', $this.next()).css({ backgroundColor: '#' + color.active.hex }); + colorIcon = $('.jPicker_Icon', $this.next()).css( + { + backgroundImage: 'url(' + images.clientPath + images.picker.file + ')' + }).bind('click', colorIconClicked); + if (window.bindToInput) window.input.bind('keyup', bindedHexKeyUp).bind('change', bindedHexKeyUp); + } + hue.add(saturation).add(value).add(red).add(green).add(blue).bind('click', radioClicked); + currentColor.bind('click', currentClicked); + cancelButton.bind('click', cancelClicked); + okButton.bind('click', okClicked); + if (window.expandable) moveBar = $('.jPicker_MoveBar', container).bind('mousedown', moveBarMouseDown); + // initialize quick list + if (color.quickList && color.quickList.length > 0) + { + grid.html(''); + for (i = 0; i < color.quickList.length; i++) + { + /* if default colors are hex strings, change them to color objects */ + if ((typeof (color.quickList[i])).toString().toLowerCase() == 'string') color.quickList[i] = new Color({ hex: color.quickList[i].substring(1) }); + grid.append(' '); + $('.jPicker_QuickColor', container).eq(i).css({ backgroundColor: '#' + color.quickList[i].hex }).bind('click', { i: i }, quickPickClicked); + } + } + setColorMode(color.mode); + colorPicker.fields.hex.val(colorBar.hex); + colorPicker.setValuesFromHex(); + colorPicker.setAlphaFromValue(); + positionMapAndBarArrows(); + updateVisuals(); + if (!window.expandable) $this.show(); + List.push($this); + }); + }; + $.fn.jPicker.defaults = /* jPicker defaults - you can change anything in this section (such as the clientPath to your images) without fear of breaking the program */ + { + window: + { + title: null, /* any title for the jPicker window itself - displays "Drag Markers To Pick A Color" if left null */ + position: + { + x: 'screenCenter', /* acceptable values "left", "center", "right", "screenCenter", or relative px value */ + y: 'top' /* acceptable values "top", "bottom", "center", or relative px value */ + }, + expandable: false, /* default to large static picker - set to true to make an expandable picker (small icon with popup) - set automatically when binded to input element */ + liveUpdate: true /* set false if you want the user to have to click "OK" before the binded input box updates values */ + }, + color: + { + mode: 'h', /* acceptabled values "h" (hue), "s" (saturation), "v" (brightness), "r" (red), "g" (green), "b" (blue) */ + active: new Color({ hex: 'ffc000' }), /* acceptable values are any declared $.jPicker.Color object or string HEX value (e.g. #ffc000) INCLUDING the "#" prefix */ + alphaSupport: false, /* change to true to enable alpha editing support (without this, alpha will always be 100) */ + quickList: /* the quick pick color list */ + [ + new Color({ h: 360, s: 33, v: 100 }), /* acceptable values are any declared $.jPicker.Color object or string HEX value (e.g. #ffc000) INCLUDING the "#" prefix */ + new Color({ h: 360, s: 66, v: 100 }), + new Color({ h: 360, s: 100, v: 100 }), + new Color({ h: 360, s: 100, v: 75 }), + new Color({ h: 360, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 100 }), + new Color({ h: 30, s: 33, v: 100 }), + new Color({ h: 30, s: 66, v: 100 }), + new Color({ h: 30, s: 100, v: 100 }), + new Color({ h: 30, s: 100, v: 75 }), + new Color({ h: 30, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 90 }), + new Color({ h: 60, s: 33, v: 100 }), + new Color({ h: 60, s: 66, v: 100 }), + new Color({ h: 60, s: 100, v: 100 }), + new Color({ h: 60, s: 100, v: 75 }), + new Color({ h: 60, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 80 }), + new Color({ h: 90, s: 33, v: 100 }), + new Color({ h: 90, s: 66, v: 100 }), + new Color({ h: 90, s: 100, v: 100 }), + new Color({ h: 90, s: 100, v: 75 }), + new Color({ h: 90, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 70 }), + new Color({ h: 120, s: 33, v: 100 }), + new Color({ h: 120, s: 66, v: 100 }), + new Color({ h: 120, s: 100, v: 100 }), + new Color({ h: 120, s: 100, v: 75 }), + new Color({ h: 120, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 60 }), + new Color({ h: 150, s: 33, v: 100 }), + new Color({ h: 150, s: 66, v: 100 }), + new Color({ h: 150, s: 100, v: 100 }), + new Color({ h: 150, s: 100, v: 75 }), + new Color({ h: 150, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 50 }), + new Color({ h: 180, s: 33, v: 100 }), + new Color({ h: 180, s: 66, v: 100 }), + new Color({ h: 180, s: 100, v: 100 }), + new Color({ h: 180, s: 100, v: 75 }), + new Color({ h: 180, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 40 }), + new Color({ h: 210, s: 33, v: 100 }), + new Color({ h: 210, s: 66, v: 100 }), + new Color({ h: 210, s: 100, v: 100 }), + new Color({ h: 210, s: 100, v: 75 }), + new Color({ h: 210, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 30 }), + new Color({ h: 240, s: 33, v: 100 }), + new Color({ h: 240, s: 66, v: 100 }), + new Color({ h: 240, s: 100, v: 100 }), + new Color({ h: 240, s: 100, v: 75 }), + new Color({ h: 240, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 20 }), + new Color({ h: 270, s: 33, v: 100 }), + new Color({ h: 270, s: 66, v: 100 }), + new Color({ h: 270, s: 100, v: 100 }), + new Color({ h: 270, s: 100, v: 75 }), + new Color({ h: 270, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 10 }), + new Color({ h: 300, s: 33, v: 100 }), + new Color({ h: 300, s: 66, v: 100 }), + new Color({ h: 300, s: 100, v: 100 }), + new Color({ h: 300, s: 100, v: 75 }), + new Color({ h: 300, s: 100, v: 50 }), + new Color({ h: 180, s: 0, v: 0 }), + new Color({ h: 330, s: 33, v: 100 }), + new Color({ h: 330, s: 66, v: 100 }), + new Color({ h: 330, s: 100, v: 100 }), + new Color({ h: 330, s: 100, v: 75 }), + new Color({ h: 330, s: 100, v: 50 }) + ] + }, + images: + { + clientPath: '/jPicker/images/', /* Path to image files */ + colorMap: + { + width: 256, + height: 256, + arrow: + { + file: 'mappoint.gif', /* ColorMap arrow icon */ + width: 15, + height: 15 + } + }, + colorBar: + { + width: 20, + height: 256, + arrow: + { + file: 'rangearrows.gif', /* ColorBar arrow icon */ + width: 40, + height: 9 + } + }, + alphaBar: + { + width: 256, + height: 20, + arrow: + { + file: 'rangearrows2.gif', /* AlphaBar arrow icon */ + width: 9, + height: 40 + } + }, + picker: + { + file: 'picker.gif', /* Color Picker icon */ + width: 25, + height: 24 + } + } + }; +})(jQuery, '1.0.9'); diff --git a/editor/jpicker/jpicker.js b/editor/jpicker/jpicker-1.0.9.min.js old mode 100644 new mode 100755 similarity index 63% rename from editor/jpicker/jpicker.js rename to editor/jpicker/jpicker-1.0.9.min.js index 2b8e847b..2627c1d1 --- a/editor/jpicker/jpicker.js +++ b/editor/jpicker/jpicker-1.0.9.min.js @@ -1 +1 @@ -(function(e,a){var d=function(n,k){var p=this,o=e("img",n),l=function(q){h(q);e(document).bind("mousemove",m).bind("mouseup",j);q.stopPropagation();q.preventDefault();return false;},m=function(q){h(q);q.stopPropagation();q.preventDefault();return false;},j=function(q){e(document).unbind("mouseup",j).unbind("mousemove",m);q.stopPropagation();q.preventDefault();return false;},h=function(u){var w=n.offset(),q=u.pageX-w.left-parseInt(n.css("border-left-width")),z=u.pageY-w.top-parseInt(n.css("border-top-width")),t=n.w,r=n.h,v,s;if(q<0){q=0;}else{if(q>t){q=t;}}if(z<0){z=0;}else{if(z>r){z=r;}}v=Math.floor(q/t*p.mxX);s=Math.floor(z/r*p.mxY);p.x=v;p.y=s;if(p.mxX==p.mnX){q=0;}if(p.mxY==p.mnY){z=0;}p.setArrowPosition(q,z);e.isFunction(p.valuesChanged)&&p.valuesChanged(p);};e.extend(true,p,{settings:k,x:0,y:0,mnX:0,mxX:0,mnY:100,mxY:100,valuesChanged:e.isFunction(arguments[2])&&arguments[2]||null,setPositioningVariables:function(r){var q=p.settings.map;n.w=q&&q.width||n.width();n.h=q&&q.height||n.height();p.MinX=0;p.MinY=0;p.MaxX=n.w;p.MaxY=n.h;},setArrowPositionFromValues:function(t){p.setPositioningVariables();var w=0,v=0,u=p.mnX,r=p.mxX,s=p.mnY,q=p.mxY,A=p.x,z=p.y;if(u!=r){if(A==u){w=0;}else{if(A==r){w=n.w;}else{if(u<1){r+=Math.abs(u)+1;}if(A<1){A+=1;}w=A/r*n.w;if(parseInt(w)==(r-1)){w=r;}else{w=parseInt(w);}if(u<1){w-=Math.abs(u)-1;}}}}if(s!=q){if(z==s){v=0;}else{if(z==q){v=n.h;}else{if(s<1){q+=Math.abs(s)+1;}if(z<1){z+=1;}v=z/q*n.h;if(parseInt(v)==(q-1)){v=q;}else{v=parseInt(v);}if(s<1){v-=Math.abs(s)-1;}}}}p.setArrowPosition(w,v);},setArrowPosition:function(q,v){var u=n.w,s=n.h,t=o.w,r=o.h;if(q<0){q=0;}else{if(q>u){q=u;}}if(v<0){v=0;}else{if(v>s){v=s;}}if(t>u){q=(u>>1)-(t>>1);}else{q-=t>>1;}if(r>s){v=(s>>1)-(r>>1);}else{v-=r>>1;}o.css({left:q+"px",top:v+"px"});},destroy:function(){e(document).unbind("mouseup",j).unbind("mousemove",m);n.unbind("mousedown",l);n=null;o=null;p.valuesChanged=null;}});o.src=p.settings.arrow&&p.settings.arrow.image;o.w=p.settings.arrow&&p.settings.arrow.width||o.width();o.h=p.settings.arrow&&p.settings.arrow.height||o.height();p.setPositioningVariables();n.bind("mousedown",l);p.setArrowPositionFromValues();e.isFunction(p.valuesChanged)&&p.valuesChanged(p);},b=function(n){var m=this,y=function(A){if(A.target.value==""){return;}t(A);m.setValuesFromHsv();e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},s=function(A){if(A.target.value==""){return;}q(A);m.setValuesFromRgb();e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},r=function(A){if(A.target.value==""){return;}l(A);w.a=A.target.value;e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},v=function(A){if(A.target.value==""){m.setValuesFromRgb();}},k=function(A){if(A.target.value==""){m.setValuesFromHsv();}},o=function(A){if(A.target.value==""){u.alpha.val(100);}},z=function(A){if(A.target.value==""){return;}x(A);m.setValuesFromHex();e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},j=function(A){if(A.target.value==""){m.setValuesFromHsv();}},q=function(A){if(!p(A)){return A;}u.red.val(h(u.red.val(),0,255));u.green.val(h(u.green.val(),0,255));u.blue.val(h(u.blue.val(),0,255));},l=function(A){if(!p(A)){return A;}u.alpha.val(h(u.alpha.val(),0,100));},t=function(A){if(!p(A)){return A;}u.hue.val(h(u.hue.val(),0,360));u.saturation.val(h(u.saturation.val(),0,100));u.value.val(h(u.value.val(),0,100));},x=function(A){if(!p(A)){return A;}u.hex.val(u.hex.val().replace(/[^a-fA-F0-9]/g,"0").toLowerCase().substring(0,6));},p=function(A){switch(A.keyCode){case 9:case 16:case 29:case 37:case 38:case 40:return false;case"c".charCodeAt():case"v".charCodeAt():if(A.ctrlKey){return false;}}return true;},h=function(C,B,A){if(C==""||isNaN(C)){return B;}C=parseInt(C);if(C>A){return A;}if(C4){k=l.substring(4,l.length);l=l.substring(0,4);}if(l.length>2){j=l.substring(2,l.length);l=l.substring(0,2);}if(l.length>0){h=l.substring(0,l.length);}}return{r:this.hexToInt(k),g:this.hexToInt(j),b:this.hexToInt(h)};},validateHex:function(h){h=h.toLowerCase().replace(/[^a-f0-9]/g,"0");if(h.length>6){h=h.substring(0,6);}return h;},rgbToHex:function(h){return this.intToHex(h.r)+this.intToHex(h.g)+this.intToHex(h.b);},intToHex:function(j){var h=parseInt(j).toString(16);if(h.length==1){h=("0"+h);}return h.toLowerCase();},hexToInt:function(h){return parseInt(h,16);},rgbToHsv:function(l){var o=l.r/255,n=l.g/255,j=l.b/255,k={h:0,s:0,v:0},m=0,h=0,p;if(o>=n&&o>=j){h=o;m=n>j?j:n;}else{if(n>=j&&n>=o){h=n;m=o>j?j:o;}else{h=j;m=n>o?o:n;}}k.v=h;k.s=h?(h-m)/h:0;if(!k.s){k.h=0;}else{p=h-m;if(o==h){k.h=(n-j)/p;}else{if(n==h){k.h=2+(j-o)/p;}else{k.h=4+(o-n)/p;}}k.h=parseInt(k.h*60);if(k.h<0){k.h+=360;}}k.s=parseInt(k.s*100);k.v=parseInt(k.v*100);return k;},hsvToRgb:function(n){var r={r:0,g:0,b:0},m=n.h,x=n.s,u=n.v;if(x==0){if(u==0){r.r=r.g=r.b=0;}else{r.r=r.g=r.b=parseInt(u*255/100);}}else{if(m==360){m=0;}m/=60;x=x/100;u=u/100;var l=parseInt(m),o=m-l,k=u*(1-x),j=u*(1-(x*o)),w=u*(1-(x*(1-o)));switch(l){case 0:r.r=u;r.g=w;r.b=k;break;case 1:r.r=j;r.g=u;r.b=k;break;case 2:r.r=k;r.g=u;r.b=w;break;case 3:r.r=k;r.g=j;r.b=u;break;case 4:r.r=w;r.g=k;r.b=u;break;case 5:r.r=u;r.g=k;r.b=j;break;}r.r=parseInt(r.r*255);r.g=parseInt(r.g*255);r.b=parseInt(r.b*255);}return r;}}};var f=e.jPicker.Color,c=e.jPicker.List,g=e.jPicker.ColorMethods;e.fn.jPicker=function(j){var h=arguments;return this.each(function(){var w=e(this),y=e.extend(true,{},e.fn.jPicker.defaults,j);if(w.get(0).nodeName.toLowerCase()=="input"){e.extend(true,y,{window:{bindToInput:true,expandable:true,input:w}});if(g.validateHex(w.val())){y.color.active=new f({hex:w.val(),a:y.color.active.a});y.color.current=new f({hex:w.val(),a:y.color.active.a});}}if(y.window.expandable){w.after('   ');}else{y.window.liveUpdate=false;}var W=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,ax=null,aw=null,av=null,U=null,T=null,S=null,R=null,Q=null,aC=null,V=null,au=null,J=null,I=null,X=null,ac=null,az=null,ak=null,am=null,ao=null,K=null,G=null,aa=null,L=null,ay=null,P=null,O=null,at=null,aq=null,A=null,l=null,M=null,ap=null,ad=null,ai=null,n=null,C=null,u=null,an=function(aE){N.active=ay.color;var aF=N.active,aG=p.clientPath,aD=function(aH){ae(aH,100);aH.css({backgroundColor:"",backgroundPosition:"0px 0px",filter:""});};aD(ax);aD(aw);aD(U);aD(T);aD(S);aD(R);ac.add(az).add(ak).add(am).add(ao).add(K).removeAttr("checked");switch(aE){case"h":ac.attr("checked",true);ax.css({backgroundColor:"#"+aF.hex});aw.css({backgroundColor:"transparent"});x(aw,-256);ae(aw,100);x(R,-256);G.mxX=100;G.mxY=100;aa.mxY=360;break;case"s":az.attr("checked",true);x(ax,-512);x(aw,-768);ae(aw,0);z(S,aF.hex);x(R,-512);G.mxX=360;G.mxY=100;aa.mxY=100;break;case"v":ak.attr("checked",true);z(ax,"000");x(aw,-1024);S.css({backgroundColor:"#"+aF.hex});x(R,-768);G.mxX=360;G.mxY=100;aa.mxY=100;break;case"r":am.attr("checked",true);x(aw,-1536);x(ax,-1280);x(R,-1024);x(S,-1280);x(T,-1536);x(U,-1792);break;case"g":ao.attr("checked",true);x(aw,-2048);x(ax,-1792);x(R,-2048);x(S,-2304);x(T,-2560);x(U,-2816);break;case"b":K.attr("checked",true);x(aw,-2560);x(ax,-2304);x(R,-3072);x(S,-3328);x(T,-3584);x(U,-3840);break;default:throw ("Invalid Mode");break;}switch(aE){case"h":case"s":case"v":G.mnX=1;G.mnY=1;aa.mnY=1;break;case"r":case"g":case"b":G.mnX=0;G.mnY=0;aa.mnY=0;G.mxX=255;G.mxY=255;aa.mxY=255;break;}N.mode=aE;v();ar();ab();if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aF.hex});if(aj.bindToInput){aj.input.val(aF.hex).css({backgroundColor:"#"+aF.hex,color:aF.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aF);},m=function(){v();ah();N.active=ay.color;var aD=N.active;if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aD.hex});if(aj.bindToInput){aj.input.val(ay.fields.hex.val()).css({backgroundColor:"#"+aD.hex,color:aD.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aD);},B=function(){if(!ay||!G||!aa||!L){return;}N.active=ay.color;var aD=ay.fields,aE=N.active;switch(N.mode){case"h":aD.saturation.val(G.x);aD.value.val(100-G.y);break;case"s":aD.hue.val(G.x);aD.value.val(100-G.y);break;case"v":aD.hue.val(G.x);aD.saturation.val(100-G.y);break;case"r":aD.blue.val(G.x);aD.green.val(255-G.y);break;case"g":aD.blue.val(G.x);aD.red.val(255-G.y);break;case"b":aD.red.val(G.x);aD.green.val(255-G.y);break;}switch(N.mode){case"h":case"s":case"v":ay.setValuesFromHsv();break;case"r":case"g":case"b":ay.setValuesFromRgb();break;}ah();if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aE.hex});if(aj.bindToInput){aj.input.val(aE.hex).css({backgroundColor:"#"+aE.hex,color:aE.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aE);},al=function(){if(!ay||!G||!aa||!L){return;}N.active=ay.color;var aD=ay.fields,aE=N.active;switch(N.mode){case"h":aD.hue.val(360-aa.y);break;case"s":aD.saturation.val(100-aa.y);break;case"v":aD.value.val(100-aa.y);break;case"r":aD.red.val(255-aa.y);break;case"g":aD.green.val(255-aa.y);break;case"b":aD.blue.val(255-aa.y);break;}switch(N.mode){case"h":case"s":case"v":ay.setValuesFromHsv();break;case"r":case"g":case"b":ay.setValuesFromRgb();break;}ah();if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aE.hex});if(aj.bindToInput){aj.input.val(aE.hex).css({backgroundColor:"#"+aE.hex,color:aE.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aE);},s=function(){if(!ay||!G||!aa||!L){return;}N.active=ay.color;var aD=ay.fields,aE=N.active;aD.alpha.val(L.x);ay.setAlphaFromValue();ah();e.isFunction(w.liveCallback)&&w.liveCallback(N.active);},v=function(){N.active=ay.color;var aG=0,aF=N.active;switch(w.settings.color.mode){case"h":aG=360-aF.h;break;case"s":aG=100-aF.s;break;case"v":aG=100-aF.v;break;case"r":aG=255-aF.r;break;case"g":aG=255-aF.g;break;case"b":aG=255-aF.b;break;}aa.y=aG;L.x=aF.a;aa.setArrowPositionFromValues();L.setArrowPositionFromValues();var aE=0,aD=0;switch(w.settings.color.mode){case"h":aE=aF.s;aD=100-aF.v;break;case"s":aE=aF.h;aD=100-aF.v;break;case"v":aE=aF.h;aD=100-aF.s;break;case"r":aE=aF.b;aD=256-aF.g;break;case"g":aE=aF.b;aD=256-aF.r;break;case"b":aE=aF.r;aD=256-aF.g;break;}G.x=aE;G.y=aD;G.setArrowPositionFromValues();},ah=function(){aB();ar();ab();aA();},aB=function(){try{A.css({backgroundColor:"#"+ay.color.hex});ae(A,ay.color.a);}catch(aD){}},ar=function(){if(!N||!ay){return;}N.active=ay.color;var aD=N.active;switch(N.mode){case"h":z(ax,new f({h:aD.h,s:100,v:100}).hex);break;case"s":ae(aw,100-aD.s);break;case"v":ae(aw,aD.v);break;case"r":ae(aw,aD.r/256*100);break;case"g":ae(aw,aD.g/256*100);break;case"b":ae(aw,aD.b/256*100);break;}ae(av,100-aD.a);},ab=function(){if(!N||!ay){return;}N.active=ay.color;var aH=N.active,aK=N.mode,aM=ay.fields;switch(aK){case"h":break;case"s":var aI=new f({h:aH.h,s:100,v:aH.v});z(S,aI.hex);break;case"v":var aL=new f({h:aH.h,s:aH.s,v:100});z(S,aL.hex);break;case"r":case"g":case"b":var aJ=0,aN=0;if(aK=="r"){aJ=aM.blue.val();aN=aM.green.val();}else{if(aK=="g"){aJ=aM.blue.val();aN=aM.red.val();}else{if(aK=="b"){aJ=aM.red.val();aN=aM.green.val();}}}var aD=aJ/256*100,aG=aN/256*100,aF=(256-aJ)/256*100,aE=(256-aN)/256*100;ae(R,aG>aF?aF:aG);ae(S,aG>aD?aD:aG);ae(T,aE>aD?aD:aE);ae(U,aE>aF?aF:aE);break;}ae(Q,100-aH.a);},aA=function(){z(J,ay.color.hex);},z=function(aD,aF){try{aD.css({backgroundColor:"#"+aF});}catch(aE){}},t=function(aD,aE){if(aE.indexOf("png")&&this.isLessThanIE7){aD.attr("pngSrc",aE);aD.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aE+"')"});}else{aD.css({backgroundImage:"url("+aE+")"});}},x=function(aD,aE){aD.css({backgroundPosition:"0px "+aE+"px"});},ae=function(aE,aD){if(aD<100){if(this.isLessThanIE7){var aF=aE.attr("pngSrc");if(aF!=null&&aF.indexOf("map-hue")==-1){aE.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aF+"') progid:DXImageTransform.Microsoft.Alpha(opacity="+aD+")"});}}else{aE.css({opacity:aD/100});}}else{if(aD==100){if(this.isLessThanIE7){var aF=aE.attr("pngSrc");if(aF!=null&&aF.indexOf("map-hue")==-1){aE.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aF+"')"});}}else{aE.css({opacity:""});}}}},E=function(){ay.fields.hex.val(N.current.hex);ay.fields.alpha.val(N.current.a);ay.setValuesFromHex();ay.setAlphaFromValue();e.isFunction(ay.valuesChanged)&&ay.valuesChanged(ay);},D=function(aD){an(aD.target.value);},af=function(){E();},r=function(){E();aj.expandable&&w.hide();e.isFunction(w.cancelCallback)&&w.cancelCallback();},Z=function(){var aD=N.active;N.current=new f({hex:aD.hex});N.current.a=aD.a;l.css({backgroundColor:"#"+aD.hex});ae(l,ay.color.a);if(aj.expandable){n.css({backgroundColor:"#"+aD.hex});if(aj.bindToInput){aj.input.val(aD.hex).css({backgroundColor:"#"+aD.hex,color:aD.v>75?"#000000":"#ffffff"});}}e.isFunction(w.commitCallback)&&w.commitCallback(aD);},o=function(){Z();aj.expandable&&w.hide();},ag=function(){w.show();},Y=function(aF){var aD=aj.element,aE=aj.page;P=parseInt(X.css("left"));O=parseInt(X.css("top"));at=aF.pageX;aq=aF.pageY;e(document).bind("mousemove",k).bind("mouseup",q);aF.stopPropagation();aF.preventDefault();return false;},k=function(aD){X.css({left:P-(at-aD.pageX)+"px",top:O-(aq-aD.pageY)+"px"});aD.stopPropagation();aD.preventDefault();return false;},q=function(aD){e(document).unbind("mousemove",k).unbind("mouseup",q);aD.stopPropagation();aD.preventDefault();return false;},F=function(aD){ay.fields.hex.val(w.settings.window.input.val());ay.bindedHexKeyUp(aD);},H=function(aD){ay.fields.hex.val(N.quickList[aD.data.i].hex);ay.fields.alpha.val(N.quickList[aD.data.i].a);ay.setValuesFromHex();ay.setAlphaFromValue();e.isFunction(ay.valuesChanged)&&ay.valuesChanged(ay);};e.extend(true,w,{id:w.attr("id"),settings:y,color:null,icon:null,commitCallback:e.isFunction(h[1])&&h[1]||null,liveCallback:e.isFunction(h[2])&&h[2]||null,cancelCallback:e.isFunction(h[3])&&h[3]||null,show:function(){if(document.all){var aD=false;for(i=0;i>1)-259)-w.next().offset().left+"px":aj.position.x,position:"absolute",top:aj.position.y=="top"?"-340px":aj.position.y=="center"?"-153px":aj.position.y=="bottom"?"25px":aj.position.y});}if((typeof(N.active)).toString().toLowerCase()=="string"){N.active=new f({hex:N.active.substring(1)});}if(!N.alphaSupport){N.active.a=100;}X.html(''+(aj.expandable?'':"")+'
   
     
new
  
current

 
°
%
%
 
  
% 
');ac=e(".jPicker_HueRadio",X);az=e(".jPicker_SaturationRadio",X);ak=e(".jPicker_BrightnessRadio",X);am=e(".jPicker_RedRadio",X);ao=e(".jPicker_GreenRadio",X);K=e(".jPicker_BlueRadio",X);ax=e(".jPicker_ColorMap_l1",X);aw=e(".jPicker_ColorMap_l2",X);av=e(".jPicker_ColorMap_l3",X);U=e(".jPicker_ColorBar_l1",X);T=e(".jPicker_ColorBar_l2",X);S=e(".jPicker_ColorBar_l3",X);R=e(".jPicker_ColorBar_l4",X);Q=e(".jPicker_ColorBar_l5",X);J=e(".jPicker_AlphaBar_l1",X);I=e(".jPicker_AlphaBar_l2",X);aC=e(".jPicker_EnableAlpha",X);V=e(".jPicker_AlphaCheckbox",X);au=e(".jPicker_AlphaBar",X);M=e(".jPicker_NewCurrent",X);A=e(".jPicker_Active",X).css({backgroundColor:"#"+N.active.hex});l=e(".jPicker_Current",X).css({backgroundColor:"#"+N.active.hex});ap=e(".jPicker_Ok",X);ad=e(".jPicker_Cancel",X);ai=e(".jPicker_Grid",X);w.color=e(".Picker_Color");w.icon=e(".jPicker_Icon");ay=new b(X,m);G=new d(e(".jPicker_ColorMap",X),{map:{width:p.colorMap.width,height:p.colorMap.height},arrow:{image:p.clientPath+p.colorMap.arrow.file,width:p.colorMap.arrow.width,height:p.colorMap.arrow.height}},B);aa=new d(e(".jPicker_ColorBar",X),{map:{width:p.colorBar.width,height:p.colorBar.height},arrow:{image:p.clientPath+p.colorBar.arrow.file,width:p.colorBar.arrow.width,height:p.colorBar.arrow.height}},al);L=new d(e(".jPicker_AlphaBar",X),{map:{width:p.alphaBar.width,height:p.alphaBar.height},arrow:{image:p.clientPath+p.alphaBar.arrow.file,width:p.alphaBar.arrow.width,height:p.alphaBar.arrow.height}},s);L.mnX=0;L.mxX=100;t(ax,p.clientPath+"Maps.png");t(aw,p.clientPath+"Maps.png");t(av,p.clientPath+"map-opacity.png");t(U,p.clientPath+"Bars.png");t(T,p.clientPath+"Bars.png");t(S,p.clientPath+"Bars.png");t(R,p.clientPath+"Bars.png");t(Q,p.clientPath+"map-opacity.png");t(I,p.clientPath+"Maps.png");x(I,-2816);t(M,p.clientPath+"map-opacity.png");if(N.alphaSupport){aC.hide();au.show();e("td.jPicker_OpacityCol *",X).show();}else{V.bind("click",function(){aC.hide();au.show();e("td.jPicker_OpacityCol *",X).show();});}if(aj.expandable){n=e(".jPicker_Color",w.next()).css({backgroundColor:"#"+N.active.hex});C=e(".jPicker_Icon",w.next()).css({backgroundImage:"url("+p.clientPath+p.picker.file+")"}).bind("click",ag);if(aj.bindToInput){aj.input.bind("keyup",F).bind("change",F);}}ac.add(az).add(ak).add(am).add(ao).add(K).bind("click",D);l.bind("click",af);ad.bind("click",r);ap.bind("click",o);if(aj.expandable){u=e(".jPicker_MoveBar",X).bind("mousedown",Y);}if(N.quickList&&N.quickList.length>0){ai.html("");for(i=0;i ');e(".jPicker_QuickColor",X).eq(i).css({backgroundColor:"#"+N.quickList[i].hex}).bind("click",{i:i},H);}}an(N.mode);ay.fields.hex.val(aa.hex);ay.setValuesFromHex();ay.setAlphaFromValue();v();ah();if(!aj.expandable){w.show();}c.push(w);});};e.fn.jPicker.defaults={window:{position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true},color:{mode:"h",active:new f({hex:"ffc000"}),alphaSupport:false,quickList:[new f({h:360,s:33,v:100}),new f({h:360,s:66,v:100}),new f({h:360,s:100,v:100}),new f({h:360,s:100,v:75}),new f({h:360,s:100,v:50}),new f({h:180,s:0,v:100}),new f({h:30,s:33,v:100}),new f({h:30,s:66,v:100}),new f({h:30,s:100,v:100}),new f({h:30,s:100,v:75}),new f({h:30,s:100,v:50}),new f({h:180,s:0,v:90}),new f({h:60,s:33,v:100}),new f({h:60,s:66,v:100}),new f({h:60,s:100,v:100}),new f({h:60,s:100,v:75}),new f({h:60,s:100,v:50}),new f({h:180,s:0,v:80}),new f({h:90,s:33,v:100}),new f({h:90,s:66,v:100}),new f({h:90,s:100,v:100}),new f({h:90,s:100,v:75}),new f({h:90,s:100,v:50}),new f({h:180,s:0,v:70}),new f({h:120,s:33,v:100}),new f({h:120,s:66,v:100}),new f({h:120,s:100,v:100}),new f({h:120,s:100,v:75}),new f({h:120,s:100,v:50}),new f({h:180,s:0,v:60}),new f({h:150,s:33,v:100}),new f({h:150,s:66,v:100}),new f({h:150,s:100,v:100}),new f({h:150,s:100,v:75}),new f({h:150,s:100,v:50}),new f({h:180,s:0,v:50}),new f({h:180,s:33,v:100}),new f({h:180,s:66,v:100}),new f({h:180,s:100,v:100}),new f({h:180,s:100,v:75}),new f({h:180,s:100,v:50}),new f({h:180,s:0,v:40}),new f({h:210,s:33,v:100}),new f({h:210,s:66,v:100}),new f({h:210,s:100,v:100}),new f({h:210,s:100,v:75}),new f({h:210,s:100,v:50}),new f({h:180,s:0,v:30}),new f({h:240,s:33,v:100}),new f({h:240,s:66,v:100}),new f({h:240,s:100,v:100}),new f({h:240,s:100,v:75}),new f({h:240,s:100,v:50}),new f({h:180,s:0,v:20}),new f({h:270,s:33,v:100}),new f({h:270,s:66,v:100}),new f({h:270,s:100,v:100}),new f({h:270,s:100,v:75}),new f({h:270,s:100,v:50}),new f({h:180,s:0,v:10}),new f({h:300,s:33,v:100}),new f({h:300,s:66,v:100}),new f({h:300,s:100,v:100}),new f({h:300,s:100,v:75}),new f({h:300,s:100,v:50}),new f({h:180,s:0,v:0}),new f({h:330,s:33,v:100}),new f({h:330,s:66,v:100}),new f({h:330,s:100,v:100}),new f({h:330,s:100,v:75}),new f({h:330,s:100,v:50})]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:40,height:9}},alphaBar:{width:256,height:20,arrow:{file:"rangearrows2.gif",width:9,height:40}},picker:{file:"picker.gif",width:25,height:24}}};})(jQuery,"1.0.8"); \ No newline at end of file +(function(e,a){var d=function(n,k){var p=this,o=e("img",n),l=function(q){h(q);e(document).bind("mousemove",m).bind("mouseup",j);q.stopPropagation();q.preventDefault();return false;},m=function(q){h(q);q.stopPropagation();q.preventDefault();return false;},j=function(q){e(document).unbind("mouseup",j).unbind("mousemove",m);q.stopPropagation();q.preventDefault();return false;},h=function(u){var w=n.offset(),q=u.pageX-w.left-parseInt(n.css("border-left-width")),z=u.pageY-w.top-parseInt(n.css("border-top-width")),t=n.w,r=n.h,v,s;if(q<0){q=0;}else{if(q>t){q=t;}}if(z<0){z=0;}else{if(z>r){z=r;}}v=Math.floor(q/t*p.mxX);s=Math.floor(z/r*p.mxY);p.x=v;p.y=s;if(p.mxX==p.mnX){q=0;}if(p.mxY==p.mnY){z=0;}p.setArrowPosition(q,z);e.isFunction(p.valuesChanged)&&p.valuesChanged(p);};e.extend(true,p,{settings:k,x:0,y:0,mnX:0,mxX:0,mnY:100,mxY:100,valuesChanged:e.isFunction(arguments[2])&&arguments[2]||null,setPositioningVariables:function(r){var q=p.settings.map;n.w=q&&q.width||n.width();n.h=q&&q.height||n.height();p.MinX=0;p.MinY=0;p.MaxX=n.w;p.MaxY=n.h;},setArrowPositionFromValues:function(t){p.setPositioningVariables();var w=0,v=0,u=p.mnX,r=p.mxX,s=p.mnY,q=p.mxY,A=p.x,z=p.y;if(u!=r){if(A==u){w=0;}else{if(A==r){w=n.w;}else{if(u<1){r+=Math.abs(u)+1;}if(A<1){A+=1;}w=A/r*n.w;if(parseInt(w)==(r-1)){w=r;}else{w=parseInt(w);}if(u<1){w-=Math.abs(u)-1;}}}}if(s!=q){if(z==s){v=0;}else{if(z==q){v=n.h;}else{if(s<1){q+=Math.abs(s)+1;}if(z<1){z+=1;}v=z/q*n.h;if(parseInt(v)==(q-1)){v=q;}else{v=parseInt(v);}if(s<1){v-=Math.abs(s)-1;}}}}p.setArrowPosition(w,v);},setArrowPosition:function(q,v){var u=n.w,s=n.h,t=o.w,r=o.h;if(q<0){q=0;}else{if(q>u){q=u;}}if(v<0){v=0;}else{if(v>s){v=s;}}if(t>u){q=(u>>1)-(t>>1);}else{q-=t>>1;}if(r>s){v=(s>>1)-(r>>1);}else{v-=r>>1;}o.css({left:q+"px",top:v+"px"});},destroy:function(){e(document).unbind("mouseup",j).unbind("mousemove",m);n.unbind("mousedown",l);n=null;o=null;p.valuesChanged=null;}});o.src=p.settings.arrow&&p.settings.arrow.image;o.w=p.settings.arrow&&p.settings.arrow.width||o.width();o.h=p.settings.arrow&&p.settings.arrow.height||o.height();p.setPositioningVariables();n.bind("mousedown",l);p.setArrowPositionFromValues();e.isFunction(p.valuesChanged)&&p.valuesChanged(p);},b=function(n){var m=this,y=function(A){if(A.target.value==""){return;}t(A);m.setValuesFromHsv();e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},s=function(A){if(A.target.value==""){return;}q(A);m.setValuesFromRgb();e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},r=function(A){if(A.target.value==""){return;}l(A);w.a=A.target.value;e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},v=function(A){if(A.target.value==""){m.setValuesFromRgb();}},k=function(A){if(A.target.value==""){m.setValuesFromHsv();}},o=function(A){if(A.target.value==""){u.alpha.val(100);}},z=function(A){if(A.target.value==""){return;}x(A);m.setValuesFromHex();e.isFunction(m.valuesChanged)&&m.valuesChanged(m);},j=function(A){if(A.target.value==""){m.setValuesFromHsv();}},q=function(A){if(!p(A)){return A;}u.red.val(h(u.red.val(),0,255));u.green.val(h(u.green.val(),0,255));u.blue.val(h(u.blue.val(),0,255));},l=function(A){if(!p(A)){return A;}u.alpha.val(h(u.alpha.val(),0,100));},t=function(A){if(!p(A)){return A;}u.hue.val(h(u.hue.val(),0,360));u.saturation.val(h(u.saturation.val(),0,100));u.value.val(h(u.value.val(),0,100));},x=function(A){if(!p(A)){return A;}u.hex.val(u.hex.val().replace(/[^a-fA-F0-9]/g,"0").toLowerCase().substring(0,6));},p=function(A){switch(A.keyCode){case 9:case 16:case 29:case 37:case 38:case 40:return false;case"c".charCodeAt():case"v".charCodeAt():if(A.ctrlKey){return false;}}return true;},h=function(C,B,A){if(C==""||isNaN(C)){return B;}C=parseInt(C);if(C>A){return A;}if(C4){k=l.substring(4,l.length);l=l.substring(0,4);}if(l.length>2){j=l.substring(2,l.length);l=l.substring(0,2);}if(l.length>0){h=l.substring(0,l.length);}}return{r:this.hexToInt(k),g:this.hexToInt(j),b:this.hexToInt(h)};},validateHex:function(h){h=h.toLowerCase().replace(/[^a-f0-9]/g,"0");if(h.length>6){h=h.substring(0,6);}return h;},rgbToHex:function(h){return this.intToHex(h.r)+this.intToHex(h.g)+this.intToHex(h.b);},intToHex:function(j){var h=parseInt(j).toString(16);if(h.length==1){h=("0"+h);}return h.toLowerCase();},hexToInt:function(h){return parseInt(h,16);},rgbToHsv:function(l){var o=l.r/255,n=l.g/255,j=l.b/255,k={h:0,s:0,v:0},m=0,h=0,p;if(o>=n&&o>=j){h=o;m=n>j?j:n;}else{if(n>=j&&n>=o){h=n;m=o>j?j:o;}else{h=j;m=n>o?o:n;}}k.v=h;k.s=h?(h-m)/h:0;if(!k.s){k.h=0;}else{p=h-m;if(o==h){k.h=(n-j)/p;}else{if(n==h){k.h=2+(j-o)/p;}else{k.h=4+(o-n)/p;}}k.h=parseInt(k.h*60);if(k.h<0){k.h+=360;}}k.s=parseInt(k.s*100);k.v=parseInt(k.v*100);return k;},hsvToRgb:function(n){var r={r:0,g:0,b:0},m=n.h,x=n.s,u=n.v;if(x==0){if(u==0){r.r=r.g=r.b=0;}else{r.r=r.g=r.b=parseInt(u*255/100);}}else{if(m==360){m=0;}m/=60;x=x/100;u=u/100;var l=parseInt(m),o=m-l,k=u*(1-x),j=u*(1-(x*o)),w=u*(1-(x*(1-o)));switch(l){case 0:r.r=u;r.g=w;r.b=k;break;case 1:r.r=j;r.g=u;r.b=k;break;case 2:r.r=k;r.g=u;r.b=w;break;case 3:r.r=k;r.g=j;r.b=u;break;case 4:r.r=w;r.g=k;r.b=u;break;case 5:r.r=u;r.g=k;r.b=j;break;}r.r=parseInt(r.r*255);r.g=parseInt(r.g*255);r.b=parseInt(r.b*255);}return r;}}};var f=e.jPicker.Color,c=e.jPicker.List,g=e.jPicker.ColorMethods;e.fn.jPicker=function(j){var h=arguments;return this.each(function(){var w=e(this),y=e.extend(true,{},e.fn.jPicker.defaults,j);if(w.get(0).nodeName.toLowerCase()=="input"){e.extend(true,y,{window:{bindToInput:true,expandable:true,input:w}});if(g.validateHex(w.val())){y.color.active=new f({hex:w.val(),a:y.color.active.a});y.color.current=new f({hex:w.val(),a:y.color.active.a});}}if(y.window.expandable){w.after('   ');}else{y.window.liveUpdate=false;}var W=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,ax=null,aw=null,av=null,U=null,T=null,S=null,R=null,Q=null,aC=null,V=null,au=null,J=null,I=null,X=null,ac=null,az=null,ak=null,am=null,ao=null,K=null,G=null,aa=null,L=null,ay=null,P=null,O=null,at=null,aq=null,A=null,l=null,M=null,ap=null,ad=null,ai=null,n=null,C=null,u=null,an=function(aE){N.active=ay.color;var aF=N.active,aG=p.clientPath,aD=function(aH){ae(aH,100);aH.css({backgroundColor:"",backgroundPosition:"0px 0px",filter:""});};aD(ax);aD(aw);aD(U);aD(T);aD(S);aD(R);ac.add(az).add(ak).add(am).add(ao).add(K).removeAttr("checked");switch(aE){case"h":ac.attr("checked",true);ax.css({backgroundColor:"#"+aF.hex});aw.css({backgroundColor:"transparent"});x(aw,-256);ae(aw,100);x(R,-256);G.mxX=100;G.mxY=100;aa.mxY=360;break;case"s":az.attr("checked",true);x(ax,-512);x(aw,-768);ae(aw,0);z(S,aF.hex);x(R,-512);G.mxX=360;G.mxY=100;aa.mxY=100;break;case"v":ak.attr("checked",true);z(ax,"000");x(aw,-1024);S.css({backgroundColor:"#"+aF.hex});x(R,-768);G.mxX=360;G.mxY=100;aa.mxY=100;break;case"r":am.attr("checked",true);x(aw,-1536);x(ax,-1280);x(R,-1024);x(S,-1280);x(T,-1536);x(U,-1792);break;case"g":ao.attr("checked",true);x(aw,-2048);x(ax,-1792);x(R,-2048);x(S,-2304);x(T,-2560);x(U,-2816);break;case"b":K.attr("checked",true);x(aw,-2560);x(ax,-2304);x(R,-3072);x(S,-3328);x(T,-3584);x(U,-3840);break;default:throw ("Invalid Mode");break;}switch(aE){case"h":case"s":case"v":G.mnX=1;G.mnY=1;aa.mnY=1;break;case"r":case"g":case"b":G.mnX=0;G.mnY=0;aa.mnY=0;G.mxX=255;G.mxY=255;aa.mxY=255;break;}N.mode=aE;v();ar();ab();if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aF.hex});if(aj.bindToInput){aj.input.val(aF.hex).css({backgroundColor:"#"+aF.hex,color:aF.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aF);},m=function(){v();ah();N.active=ay.color;var aD=N.active;if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aD.hex});if(aj.bindToInput){aj.input.val(ay.fields.hex.val()).css({backgroundColor:"#"+aD.hex,color:aD.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aD);},B=function(){if(!ay||!G||!aa||!L){return;}N.active=ay.color;var aD=ay.fields,aE=N.active;switch(N.mode){case"h":aD.saturation.val(G.x);aD.value.val(100-G.y);break;case"s":aD.hue.val(G.x);aD.value.val(100-G.y);break;case"v":aD.hue.val(G.x);aD.saturation.val(100-G.y);break;case"r":aD.blue.val(G.x);aD.green.val(255-G.y);break;case"g":aD.blue.val(G.x);aD.red.val(255-G.y);break;case"b":aD.red.val(G.x);aD.green.val(255-G.y);break;}switch(N.mode){case"h":case"s":case"v":ay.setValuesFromHsv();break;case"r":case"g":case"b":ay.setValuesFromRgb();break;}ah();if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aE.hex});if(aj.bindToInput){aj.input.val(aE.hex).css({backgroundColor:"#"+aE.hex,color:aE.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aE);},al=function(){if(!ay||!G||!aa||!L){return;}N.active=ay.color;var aD=ay.fields,aE=N.active;switch(N.mode){case"h":aD.hue.val(360-aa.y);break;case"s":aD.saturation.val(100-aa.y);break;case"v":aD.value.val(100-aa.y);break;case"r":aD.red.val(255-aa.y);break;case"g":aD.green.val(255-aa.y);break;case"b":aD.blue.val(255-aa.y);break;}switch(N.mode){case"h":case"s":case"v":ay.setValuesFromHsv();break;case"r":case"g":case"b":ay.setValuesFromRgb();break;}ah();if(aj.expandable&&aj.liveUpdate){n.css({backgroundColor:"#"+aE.hex});if(aj.bindToInput){aj.input.val(aE.hex).css({backgroundColor:"#"+aE.hex,color:aE.v>75?"#000000":"#ffffff"});}}e.isFunction(w.liveCallback)&&w.liveCallback(aE);},s=function(){if(!ay||!G||!aa||!L){return;}N.active=ay.color;var aD=ay.fields,aE=N.active;aD.alpha.val(L.x);ay.setAlphaFromValue();ah();e.isFunction(w.liveCallback)&&w.liveCallback(N.active);},v=function(){N.active=ay.color;var aG=0,aF=N.active;switch(w.settings.color.mode){case"h":aG=360-aF.h;break;case"s":aG=100-aF.s;break;case"v":aG=100-aF.v;break;case"r":aG=255-aF.r;break;case"g":aG=255-aF.g;break;case"b":aG=255-aF.b;break;}aa.y=aG;L.x=aF.a;aa.setArrowPositionFromValues();L.setArrowPositionFromValues();var aE=0,aD=0;switch(w.settings.color.mode){case"h":aE=aF.s;aD=100-aF.v;break;case"s":aE=aF.h;aD=100-aF.v;break;case"v":aE=aF.h;aD=100-aF.s;break;case"r":aE=aF.b;aD=256-aF.g;break;case"g":aE=aF.b;aD=256-aF.r;break;case"b":aE=aF.r;aD=256-aF.g;break;}G.x=aE;G.y=aD;G.setArrowPositionFromValues();},ah=function(){aB();ar();ab();aA();},aB=function(){try{A.css({backgroundColor:"#"+ay.color.hex});ae(A,ay.color.a);}catch(aD){}},ar=function(){if(!N||!ay){return;}N.active=ay.color;var aD=N.active;switch(N.mode){case"h":z(ax,new f({h:aD.h,s:100,v:100}).hex);break;case"s":ae(aw,100-aD.s);break;case"v":ae(aw,aD.v);break;case"r":ae(aw,aD.r/256*100);break;case"g":ae(aw,aD.g/256*100);break;case"b":ae(aw,aD.b/256*100);break;}ae(av,100-aD.a);},ab=function(){if(!N||!ay){return;}N.active=ay.color;var aH=N.active,aK=N.mode,aM=ay.fields;switch(aK){case"h":break;case"s":var aI=new f({h:aH.h,s:100,v:aH.v});z(S,aI.hex);break;case"v":var aL=new f({h:aH.h,s:aH.s,v:100});z(S,aL.hex);break;case"r":case"g":case"b":var aJ=0,aN=0;if(aK=="r"){aJ=aM.blue.val();aN=aM.green.val();}else{if(aK=="g"){aJ=aM.blue.val();aN=aM.red.val();}else{if(aK=="b"){aJ=aM.red.val();aN=aM.green.val();}}}var aD=aJ/256*100,aG=aN/256*100,aF=(256-aJ)/256*100,aE=(256-aN)/256*100;ae(R,aG>aF?aF:aG);ae(S,aG>aD?aD:aG);ae(T,aE>aD?aD:aE);ae(U,aE>aF?aF:aE);break;}ae(Q,100-aH.a);},aA=function(){z(J,ay.color.hex);},z=function(aD,aF){try{aD.css({backgroundColor:"#"+aF});}catch(aE){}},t=function(aD,aE){if(aE.indexOf("png")&&this.isLessThanIE7){aD.attr("pngSrc",aE);aD.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aE+"')"});}else{aD.css({backgroundImage:"url("+aE+")"});}},x=function(aD,aE){aD.css({backgroundPosition:"0px "+aE+"px"});},ae=function(aE,aD){if(aD<100){if(this.isLessThanIE7){var aF=aE.attr("pngSrc");if(aF!=null&&aF.indexOf("map-hue")==-1){aE.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aF+"') progid:DXImageTransform.Microsoft.Alpha(opacity="+aD+")"});}}else{aE.css({opacity:aD/100});}}else{if(aD==100){if(this.isLessThanIE7){var aF=aE.attr("pngSrc");if(aF!=null&&aF.indexOf("map-hue")==-1){aE.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+aF+"')"});}}else{aE.css({opacity:""});}}}},E=function(){ay.fields.hex.val(N.current.hex);ay.fields.alpha.val(N.current.a);ay.setValuesFromHex();ay.setAlphaFromValue();e.isFunction(ay.valuesChanged)&&ay.valuesChanged(ay);},D=function(aD){an(aD.target.value);},af=function(){E();},r=function(){E();aj.expandable&&w.hide();e.isFunction(w.cancelCallback)&&w.cancelCallback();},Z=function(){var aD=N.active;N.current=new f({hex:aD.hex});N.current.a=aD.a;l.css({backgroundColor:"#"+aD.hex});ae(l,ay.color.a);if(aj.expandable){n.css({backgroundColor:"#"+aD.hex});if(aj.bindToInput){aj.input.val(aD.hex).css({backgroundColor:"#"+aD.hex,color:aD.v>75?"#000000":"#ffffff"});}}e.isFunction(w.commitCallback)&&w.commitCallback(aD);},o=function(){Z();aj.expandable&&w.hide();},ag=function(){w.show();},Y=function(aF){var aD=aj.element,aE=aj.page;P=parseInt(X.css("left"));O=parseInt(X.css("top"));at=aF.pageX;aq=aF.pageY;e(document).bind("mousemove",k).bind("mouseup",q);aF.stopPropagation();aF.preventDefault();return false;},k=function(aD){X.css({left:P-(at-aD.pageX)+"px",top:O-(aq-aD.pageY)+"px"});aD.stopPropagation();aD.preventDefault();return false;},q=function(aD){e(document).unbind("mousemove",k).unbind("mouseup",q);aD.stopPropagation();aD.preventDefault();return false;},F=function(aD){ay.fields.hex.val(w.settings.window.input.val());ay.bindedHexKeyUp(aD);},H=function(aD){ay.fields.hex.val(N.quickList[aD.data.i].hex);ay.fields.alpha.val(N.quickList[aD.data.i].a);ay.setValuesFromHex();ay.setAlphaFromValue();e.isFunction(ay.valuesChanged)&&ay.valuesChanged(ay);};e.extend(true,w,{id:w.attr("id"),settings:y,color:null,icon:null,commitCallback:e.isFunction(h[1])&&h[1]||null,liveCallback:e.isFunction(h[2])&&h[2]||null,cancelCallback:e.isFunction(h[3])&&h[3]||null,show:function(){if(document.all){var aD=false;for(i=0;i>1)-259)-w.next().offset().left+"px":aj.position.x,position:"absolute",top:aj.position.y=="top"?"-340px":aj.position.y=="center"?"-153px":aj.position.y=="bottom"?"25px":aj.position.y});}if((typeof(N.active)).toString().toLowerCase()=="string"){N.active=new f({hex:N.active.substring(1)});}if(!N.alphaSupport){N.active.a=100;}X.html(''+(aj.expandable?'':"")+'
 

'+(aj.title||"Drag Markers To Pick A Color")+'

   
     
new
  
current

 
°
%
%
 
  
% 
');ac=e(".jPicker_HueRadio",X);az=e(".jPicker_SaturationRadio",X);ak=e(".jPicker_BrightnessRadio",X);am=e(".jPicker_RedRadio",X);ao=e(".jPicker_GreenRadio",X);K=e(".jPicker_BlueRadio",X);ax=e(".jPicker_ColorMap_l1",X);aw=e(".jPicker_ColorMap_l2",X);av=e(".jPicker_ColorMap_l3",X);U=e(".jPicker_ColorBar_l1",X);T=e(".jPicker_ColorBar_l2",X);S=e(".jPicker_ColorBar_l3",X);R=e(".jPicker_ColorBar_l4",X);Q=e(".jPicker_ColorBar_l5",X);J=e(".jPicker_AlphaBar_l1",X);I=e(".jPicker_AlphaBar_l2",X);aC=e(".jPicker_EnableAlpha",X);V=e(".jPicker_AlphaCheckbox",X);au=e(".jPicker_AlphaBar",X);M=e(".jPicker_NewCurrent",X);A=e(".jPicker_Active",X).css({backgroundColor:"#"+N.active.hex});l=e(".jPicker_Current",X).css({backgroundColor:"#"+N.active.hex});ap=e(".jPicker_Ok",X);ad=e(".jPicker_Cancel",X);ai=e(".jPicker_Grid",X);w.color=e(".Picker_Color");w.icon=e(".jPicker_Icon");ay=new b(X,m);G=new d(e(".jPicker_ColorMap",X),{map:{width:p.colorMap.width,height:p.colorMap.height},arrow:{image:p.clientPath+p.colorMap.arrow.file,width:p.colorMap.arrow.width,height:p.colorMap.arrow.height}},B);aa=new d(e(".jPicker_ColorBar",X),{map:{width:p.colorBar.width,height:p.colorBar.height},arrow:{image:p.clientPath+p.colorBar.arrow.file,width:p.colorBar.arrow.width,height:p.colorBar.arrow.height}},al);L=new d(e(".jPicker_AlphaBar",X),{map:{width:p.alphaBar.width,height:p.alphaBar.height},arrow:{image:p.clientPath+p.alphaBar.arrow.file,width:p.alphaBar.arrow.width,height:p.alphaBar.arrow.height}},s);L.mnX=0;L.mxX=100;t(ax,p.clientPath+"Maps.png");t(aw,p.clientPath+"Maps.png");t(av,p.clientPath+"map-opacity.png");t(U,p.clientPath+"Bars.png");t(T,p.clientPath+"Bars.png");t(S,p.clientPath+"Bars.png");t(R,p.clientPath+"Bars.png");t(Q,p.clientPath+"bar-opacity.png");t(I,p.clientPath+"Maps.png");x(I,-2816);t(M,p.clientPath+"preview-opacity.png");M.css({backgroundPosition:"1px 1px"});if(N.alphaSupport){aC.hide();au.show();e("td.jPicker_OpacityCol *",X).show();}else{V.bind("click",function(){aC.hide();au.show();e("td.jPicker_OpacityCol *",X).show();});}if(aj.expandable){n=e(".jPicker_Color",w.next()).css({backgroundColor:"#"+N.active.hex});C=e(".jPicker_Icon",w.next()).css({backgroundImage:"url("+p.clientPath+p.picker.file+")"}).bind("click",ag);if(aj.bindToInput){aj.input.bind("keyup",F).bind("change",F);}}ac.add(az).add(ak).add(am).add(ao).add(K).bind("click",D);l.bind("click",af);ad.bind("click",r);ap.bind("click",o);if(aj.expandable){u=e(".jPicker_MoveBar",X).bind("mousedown",Y);}if(N.quickList&&N.quickList.length>0){ai.html("");for(i=0;i ');e(".jPicker_QuickColor",X).eq(i).css({backgroundColor:"#"+N.quickList[i].hex}).bind("click",{i:i},H);}}an(N.mode);ay.fields.hex.val(aa.hex);ay.setValuesFromHex();ay.setAlphaFromValue();v();ah();if(!aj.expandable){w.show();}c.push(w);});};e.fn.jPicker.defaults={window:{title:null,position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true},color:{mode:"h",active:new f({hex:"ffc000"}),alphaSupport:false,quickList:[new f({h:360,s:33,v:100}),new f({h:360,s:66,v:100}),new f({h:360,s:100,v:100}),new f({h:360,s:100,v:75}),new f({h:360,s:100,v:50}),new f({h:180,s:0,v:100}),new f({h:30,s:33,v:100}),new f({h:30,s:66,v:100}),new f({h:30,s:100,v:100}),new f({h:30,s:100,v:75}),new f({h:30,s:100,v:50}),new f({h:180,s:0,v:90}),new f({h:60,s:33,v:100}),new f({h:60,s:66,v:100}),new f({h:60,s:100,v:100}),new f({h:60,s:100,v:75}),new f({h:60,s:100,v:50}),new f({h:180,s:0,v:80}),new f({h:90,s:33,v:100}),new f({h:90,s:66,v:100}),new f({h:90,s:100,v:100}),new f({h:90,s:100,v:75}),new f({h:90,s:100,v:50}),new f({h:180,s:0,v:70}),new f({h:120,s:33,v:100}),new f({h:120,s:66,v:100}),new f({h:120,s:100,v:100}),new f({h:120,s:100,v:75}),new f({h:120,s:100,v:50}),new f({h:180,s:0,v:60}),new f({h:150,s:33,v:100}),new f({h:150,s:66,v:100}),new f({h:150,s:100,v:100}),new f({h:150,s:100,v:75}),new f({h:150,s:100,v:50}),new f({h:180,s:0,v:50}),new f({h:180,s:33,v:100}),new f({h:180,s:66,v:100}),new f({h:180,s:100,v:100}),new f({h:180,s:100,v:75}),new f({h:180,s:100,v:50}),new f({h:180,s:0,v:40}),new f({h:210,s:33,v:100}),new f({h:210,s:66,v:100}),new f({h:210,s:100,v:100}),new f({h:210,s:100,v:75}),new f({h:210,s:100,v:50}),new f({h:180,s:0,v:30}),new f({h:240,s:33,v:100}),new f({h:240,s:66,v:100}),new f({h:240,s:100,v:100}),new f({h:240,s:100,v:75}),new f({h:240,s:100,v:50}),new f({h:180,s:0,v:20}),new f({h:270,s:33,v:100}),new f({h:270,s:66,v:100}),new f({h:270,s:100,v:100}),new f({h:270,s:100,v:75}),new f({h:270,s:100,v:50}),new f({h:180,s:0,v:10}),new f({h:300,s:33,v:100}),new f({h:300,s:66,v:100}),new f({h:300,s:100,v:100}),new f({h:300,s:100,v:75}),new f({h:300,s:100,v:50}),new f({h:180,s:0,v:0}),new f({h:330,s:33,v:100}),new f({h:330,s:66,v:100}),new f({h:330,s:100,v:100}),new f({h:330,s:100,v:75}),new f({h:330,s:100,v:50})]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:40,height:9}},alphaBar:{width:256,height:20,arrow:{file:"rangearrows2.gif",width:9,height:40}},picker:{file:"picker.gif",width:25,height:24}}};})(jQuery,"1.0.9"); \ No newline at end of file diff --git a/editor/svg-editor.html b/editor/svg-editor.html index 68d21708..befd51d4 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -2,14 +2,14 @@ - + - + diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index bf234c81..04ac8615 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -11,8 +11,10 @@ var svgWhiteList = { "defs": [], "ellipse": ["cx", "cy", "fill", "fill-opacity", "id", "stroke", "rx", "ry", "stroke-opacity", "stroke-width", "stroke-dasharray"], "line": ["fill", "fill-opacity", "id", "stroke", "stroke-opacity", "stroke-width", "stroke-dasharray", "x1", "x2", "y1", "y2"], + "linearGradient": ["id", "x1", "x2", "y1", "y2"], "path": ["d", "fill", "fill-opacity", "id", "stroke", "stroke-opacity", "stroke-width", "stroke-dasharray"], "rect": ["fill", "fill-opacity", "height", "id", "stroke", "stroke-opacity", "stroke-width", "stroke-dasharray", "width", "x", "y"], + "stop": ["id", "stop-color", "stop-opacity"], "svg": ["id", "height", "width", "xmlns"], "text": ["font-family", "font-size", "font-style", "font-weight", "id", "x", "y"], };