issue 1418, changed a plugin for color picker
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10294 201d5d3c-b55e-5fd7-737f-ddc643e51545
121
common/js/plugins/ui.colorpicker/ChangeLog.txt
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
Change Log
|
||||
______________
|
||||
1.1.6
|
||||
Corrected bug preventing selections inside input values in some browsers - the onselectstart function no longer captures on input boxes.
|
||||
Added support for up/down arrow adjustments of the currently focused input box making the picker more keyboard friendly.
|
||||
Added ticks around the backgroundImage assignments to correct for paths with whitespace.
|
||||
|
||||
1.1.5
|
||||
Corrected Color object constructor to allow setting of the "alpha" value as per the documentation which previously didn't work.
|
||||
Added support for translucency for quickList colors with checkered background - Only available if "alphaSupport" is enabled.
|
||||
Restricted default color to "alpha" of 255 if "alphaSupport" is disabled - It will now assign an explicit alpha of 255 when disabled.
|
||||
Added new setting variable "alphaPrecision" which indicates the number of decimal points to allow in the alpha percentage display - Now defaults to 0.
|
||||
|
||||
1.1.4
|
||||
Changed "alpha" range from 0-100 to 0-255 to correct truncating and rounding errors caused by attempting to get an integer percentage that matches a hex value.
|
||||
"alpha" percentage display will now show up to 1 decimal point for more accurate representation of "alpha" value.
|
||||
Color object now accepts "alpha" values in a range of 0-255 and also returns the same when getting the "alpha" value. You will need to run ((alpha * 100) / 255) to retrieve a percentage value.
|
||||
Reworked the table layout and labels to remove the need for the label to reference the radio input box. This reduces injected code and removes the need to generate unique ids on the radio buttons.
|
||||
Transparent/invisible caret on NULL color is now corrected - uses the same caret color as a white color.
|
||||
Setting a binded input value of "" or no value attribute will now create a NULL color on initialization instead of the settings default color.
|
||||
Added a dynamic, invisible "iframe" behind a dialog picker in all browsers that fail jQuery.support.boxModel (currently IE <= 7 Quirks Mode). This prevents "select" box from showing through the picker.
|
||||
|
||||
1.1.3
|
||||
Now adding popup color pickers to document.body instead of inline with the popup control. This corrects issues with the picker not showing beyond a relative container scope.
|
||||
No longer need to hide popup icon in Internet Explorer for picker elements lower in the DOM than the currently active one since the picker itself is attached to document.body (it is always higher in the DOM now).
|
||||
Popup pickers are now bring-to-front selectable. Clicking on the picker will bring it above all other pickers on the page instead of having to drag one out from underneath another.
|
||||
Corrected jPicker.List/setTimeout bug which allowed an instance to bind to the List in an order other than the order the initialization function was called.
|
||||
Added a updateInputColor option (default true) to allow for a binded input field that does not automatically update its background/text color.
|
||||
|
||||
1.1.2
|
||||
Reworked the find methods and contexts for element searches. Now using ":first" instead of ".eq(0)" to take advantage of early out searches. Much faster initialization of the picker, on the order of 6 times.
|
||||
Now using setTimeout for calling visual updates. Dramatically improved marker dragging in all browsers. Reduces blocking as re-rendering is internal to the browser and independent of the other javascript still in progress.
|
||||
Marker updates can now cancel a previous valueChanged event when a new mouseMove event comes in. IE8 marker dragging is still slower, much over 5 times faster than it was.
|
||||
Reworked entire quickPick list creation. It now adds up source code and does a single "html" method instead of multiple "append" methods. This is a large part of the speed increase on initialization.
|
||||
The vast majority of all running scripts on both initialization and dragging is now occupied altering the style rules and finding elements (init only) instead of jPicker code.
|
||||
All methods previously called with global context now use the "call" method for using the context of the class running the method. "this" in a callback is now the DOM node (jQuery style) and jPicker instead of "window".
|
||||
Added "effects" section of window settings to allow different show/hide effects and durations.
|
||||
Removed change log and read me from the full source code to separate files (ChangeLog.txt and ReadMe.txt) and an HTML demonstration/documentation page (Example.txt).
|
||||
|
||||
1.1.1
|
||||
Correct IE exception caused by attempting to set "#transparent" to CSS background-color.
|
||||
|
||||
1.1.0
|
||||
Reworked nearly the entire plugin including the internal and external event model, bindings, DOM searches, classes, and overall presentation.
|
||||
The Color object now supports a changed event that you can bind to (or just bind to the picker events still included).
|
||||
Event order has been reversed, instead of a change event on the map/bar/text fields updating the display, they now update the Color object which then fires the events that update the display.
|
||||
alphaSupport re-implemented by request - default behavior is off.
|
||||
Hex code now only 6 characters again.
|
||||
Color object can now have its value changed from code, using the "val" method, and it will fire all events necessary to update the display.
|
||||
Removed all "get_*" methods from the color object, instead opting for a single "val" method for getting and setting, more in line with familiar jQuery methods.
|
||||
Better rendering for all IE versions in Quirks mode.
|
||||
|
||||
1.0.13
|
||||
Updated transparency algorithm for red/green/blue color modes. The algorithm from John Dyers' color picker was close but incorrect. Bar colors are now pixel perfect with the new algorithm.
|
||||
Changed from using "background-position" on the color maps to an element of full height using the "top" attribute for image-map location using "overflow: hidden" to hide overdraw.
|
||||
IE7/8 ignores opacity on elements taller than 4096px. Image maps therefore no longer include a blank first map so the Bar is just under 4096. Blank is now accomplished by setting the "top" setting to below the map display.
|
||||
New colorBar picker image that does not draw outside of the element since the elements now hide overdraw.
|
||||
Added IE5.5/6 support for the picker. This is why it now uses maps of full height and the "top" attribute for map locations.
|
||||
Moved the images in the maps to 4 pixels apart from each other. IE7/8 change the first pixel of the bottom-border of 2px to partially transparent showing a portion of a different color map without this.
|
||||
|
||||
1.0.12
|
||||
Added minified CSS file.
|
||||
Added IE7/8 Quirks Mode support.
|
||||
Added configurable string constants for all text and tooltips. You can now change the default values for different languages.
|
||||
Privatized the RGBA values in the Color object for better NULL handling. YOU MUST USE THE NEW GET FUNCTIONS TO ACCESS THE COLOR PROPERTIES.
|
||||
Better NULL color handling and an additional "No Color Selected" quick pick color.
|
||||
More consistent behavior across multiple versions of browsers.
|
||||
Added alpha response to the binded color picker icon.
|
||||
Removed "alphaSupport" variable. It is now always supported.
|
||||
|
||||
1.0.11b
|
||||
Corrected NULL behavior in IE. jQuery was getting an exception when attempting to assign a backgroundColor style of '#'. Now assigns 'transparent' if color is NULL.
|
||||
Can now create new Color object WITH OR WITHOUT the '#' prefix.
|
||||
|
||||
1.0.11
|
||||
Added ability for NULL colors (delete the hex value). Color will be returned as color.hex == ''. Can set the default color to an empty hex string as well.
|
||||
cancelCallback now returns the original color for use in programming responses.
|
||||
|
||||
1.0.10
|
||||
Corrected table layout and tweaked display for more consisent presentation. Nice catch from Jonathan Pasquier.
|
||||
|
||||
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.
|
||||
47
common/js/plugins/ui.colorpicker/ReadMe.txt
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
jPicker 1.1.6
|
||||
|
||||
jQuery Plugin for Photoshop style color picker
|
||||
|
||||
Copyright (c) 2010 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)
|
||||
|
||||
|
||||
jPicker is a fast, lightweight jQuery plugin for including an advanced color picker in your web projects.
|
||||
It has been painstakenly ported from John Dyers' awesome work on his picker using the Prototype framework.
|
||||
|
||||
jPicker supports all current browsers and has been extensively tested in Chrome, Firefox, IE5.5+, Safari,
|
||||
and Opera.
|
||||
|
||||
If you are updating a current version, you MUST always use the CSS and image files from the download as
|
||||
there may have been changes.
|
||||
|
||||
If you are moving from a V1.0.* version, you MUST read the docs below to implement some changes to the
|
||||
Color object returned by the callback functions.
|
||||
|
||||
|
||||
Known Issues
|
||||
______________
|
||||
Attaching multiple jPicker objects on a single page will slow performance.
|
||||
jPicker creates a new instance of the picker for every element. Performance will suffer when binding dozens of instances.
|
||||
|
||||
|
||||
Coming Soon
|
||||
______________
|
||||
|
||||
Will consider supporting jQuery ThemeRoller CSS API for theming the UI if demand exists.
|
||||
|
||||
Planned For Future Release
|
||||
______________
|
||||
|
||||
Move the jPicker object to a single instance that all selection instances point to.
|
||||
- This will result in much faster operation and initialization for pages with multiple pickers.
|
||||
|
||||
Add activateCallback option for calling a callback function when the jPicker is activated or its binding is switched to a different picker element.
|
||||
|
||||
Add multiple window modes for picker operation, include modal, popup, windowed, and exclusive.
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
<public:component>
|
||||
<public:attach event="onpropertychange" onevent="iePNGFix(0)" />
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
// IE5.5+ PNG Alpha Fix v1.0
|
||||
// (c) 2004-2008 Angus Turnbull http://www.twinhelix.com
|
||||
|
||||
// This is licensed under the GNU LGPL, version 2.1 or later.
|
||||
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/
|
||||
|
||||
|
||||
// This must be a path to a blank image, relative to the HTML document(s).
|
||||
// In production use I suggest '/images/blank.gif' or similar. That's all!
|
||||
if (typeof blankImg == 'undefined') var blankImg = 'blank.gif';
|
||||
|
||||
|
||||
|
||||
function filt(s, b)
|
||||
{
|
||||
var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
|
||||
var sM = (currentStyle.backgroundRepeat == 'no-repeat') ? 'crop' : 'scale';
|
||||
s = (s || '').replace(/\(/g, '%28').replace(/\)/g, '%29');
|
||||
|
||||
if (s && !(/IMG|INPUT/.test(nodeName) && !b) &&
|
||||
currentStyle.width == 'auto' && currentStyle.height == 'auto')
|
||||
{
|
||||
style.width = offsetWidth + 'px';
|
||||
style.height = clientHeight + 'px';
|
||||
if (currentStyle.display == 'inline') style.display = 'inline-block';
|
||||
}
|
||||
|
||||
if (filters[f])
|
||||
{
|
||||
filters[f].enabled = s ? true : false;
|
||||
if (s) with (filters[f]) { src = s }
|
||||
}
|
||||
else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="' + sM + '")';
|
||||
}
|
||||
|
||||
function iePNGFix(init)
|
||||
{
|
||||
if (!/MSIE (5\.5|6)/.test(navigator.userAgent) || typeof filters == 'unknown') return;
|
||||
var evt = init ? { propertyName: 'src,background' } : event;
|
||||
var isSrc = /src/.test(evt.propertyName);
|
||||
var isBg = /background/.test(evt.propertyName);
|
||||
var isClass = !init &&
|
||||
((this.className != this._png_class) && (this.className || this._png_class));
|
||||
if (!(isSrc || isBg || isClass)) return;
|
||||
this._png_class = this.className;
|
||||
var blank = blankImg.match(/([^\/]+)$/)[1];
|
||||
|
||||
// Required for Whatever:hover support - erase any set BG if className changes.
|
||||
if (isClass && ((style.backgroundImage.indexOf('url(') == -1) ||
|
||||
(style.backgroundImage.indexOf(blank) > -1)))
|
||||
{
|
||||
setTimeout(function() { this.style.backgroundImage = '' }, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSrc && this.src && /IMG|INPUT/.test(nodeName))
|
||||
{
|
||||
if ((/\.png/i).test(src))
|
||||
{
|
||||
filt(src, 1);
|
||||
src = blankImg;
|
||||
}
|
||||
else if (src.indexOf(blank) == -1) filt();
|
||||
}
|
||||
|
||||
var bgSrc = currentStyle.backgroundImage || style.backgroundImage;
|
||||
if ((bgSrc + this.src).indexOf(blank) == -1)
|
||||
{
|
||||
var bgPNG = bgSrc.match(/^url[("']+(.*\.png[^\)"']*)[\)"']+[^\)]*$/i);
|
||||
|
||||
if (bgPNG)
|
||||
{
|
||||
style.backgroundImage = 'url("' + blankImg + '")';
|
||||
filt(bgPNG[1], 0);
|
||||
// Unclickable elements inside PNG backgrounds.
|
||||
var tags = ['a', 'input', 'select', 'textarea', 'iframe', 'object'],
|
||||
t = tags.length, tFix = [];
|
||||
while (t--)
|
||||
{
|
||||
var elms = all.tags(tags[t]), e = elms.length;
|
||||
while (e--) tFix.push(elms[e]);
|
||||
}
|
||||
var t = tFix.length;
|
||||
if (t && (/relative|absolute/i).test(currentStyle.position))
|
||||
alert('IEPNGFix: Children of positioned element are unclickable:\n\n<' +
|
||||
nodeName + (id && ' id=' + id) + '>');
|
||||
while (t--)
|
||||
if (!(/relative|absolute/i).test(tFix[t].currentStyle.position))
|
||||
tFix[t].style.position = 'relative';
|
||||
}
|
||||
else filt();
|
||||
}
|
||||
}
|
||||
|
||||
iePNGFix(1);
|
||||
|
||||
</script>
|
||||
</public:component>
|
||||
1
common/js/plugins/ui.colorpicker/css/jPicker-1.1.6.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
.jPicker .Icon{display:inline-block;height:24px;position:relative;text-align:left;width:25px}.jPicker .Icon span.Color,.jPicker .Icon span.Alpha{background-position:2px 2px;display:block;height:100%;left:0;position:absolute;top:0;width:100%}.jPicker .Icon span.Image{background-repeat:no-repeat;cursor:pointer;display:block;height:100%;left:0;position:absolute;top:0;width:100%}.jPicker.Container{color:#000;z-index:10}table.jPicker{background-color:#efefef;border:1px outset #666;font-family:Arial,Helvetica,Sans-Serif;font-size:12px!important;margin:0;padding:5px;width:545px;z-index:20}.jPicker .Move{background-color:#ddd;border-color:#fff #666 #666 #fff;border-style:solid;border-width:1px;cursor:move;height:12px;padding:0}.jPicker .Title{font-size:11px!important;font-weight:bold;margin:-2px 0 0 0;padding:10px 0 0 0;text-align:center;width:100%}.jPicker div.Map{border-bottom:2px solid #fff;border-left:2px solid #9a9a9a;border-right:2px solid #fff;border-top:2px solid #9a9a9a;cursor:crosshair;height:260px;margin:0 10px 10px 10px;overflow:hidden;padding:0;position:relative;width:260px}.jPicker div[class="Map"]{height:256px;width:256px}.jPicker div.Bar{border-bottom:2px solid #fff;border-left:2px solid #9a9a9a;border-right:2px solid #fff;border-top:2px solid #9a9a9a;cursor:n-resize;height:260px;margin:12px 10px 0 5px;overflow:hidden;padding:0;position:relative;width:24px}.jPicker div[class="Bar"]{height:256px;width:20px}.jPicker .Map .Map1,.jPicker .Map .Map2,.jPicker .Map .Map3,.jPicker .Bar .Map1,.jPicker .Bar .Map2,.jPicker .Bar .Map3,.jPicker .Bar .Map4,.jPicker .Bar .Map5,.jPicker .Bar .Map6{background-color:transparent;background-image:none;display:block;left:0;position:absolute;top:0}.jPicker .Map .Map1,.jPicker .Map .Map2,.jPicker .Map .Map3{height:2596px;width:256px}.jPicker .Bar .Map1,.jPicker .Bar .Map2,.jPicker .Bar .Map3,.jPicker .Bar .Map4{height:3896px;width:20px}.jPicker .Bar .Map5,.jPicker .Bar .Map6{height:256px;width:20px}.jPicker .Map .Map1,.jPicker .Map .Map2,.jPicker .Bar .Map6{background-repeat:no-repeat}.jPicker .Map .Map3,.jPicker .Bar .Map5{background-repeat:repeat}.jPicker .Bar .Map1,.jPicker .Bar .Map2,.jPicker .Bar .Map3,.jPicker .Bar .Map4{background-repeat:repeat-x}.jPicker .Map .Arrow{display:block;position:absolute}.jPicker .Bar .Arrow{display:block;left:0;position:absolute}.jPicker .Preview{font-size:9px;padding:5px 0 0 0;text-align:center}.jPicker .Preview div{border:2px inset #eee;height:62px;margin:0 auto;padding:0;width:62px}.jPicker .Preview div span{border:1px solid #000;display:block;height:30px;margin:0 auto;padding:0;width:60px}.jPicker .Preview .Active{border-bottom-width:0}.jPicker .Preview .Current{border-top-width:0;cursor:pointer}.jPicker input{font-size:13px}.jPicker .Button{text-align:center;padding:0 4px;width:115px}.jPicker .Button input{padding:2px 0;width:100px}.jPicker .Button .Ok{margin:12px 0 5px 0}.jPicker td{margin:0;padding:0}.jPicker td.Radio{margin:0;padding:0;width:31px}.jPicker td.Radio input{margin:0 5px 0 0;padding:0}.jPicker td.Text{font-size:12px!important;height:22px;margin:0;padding:0;text-align:left;width:70px}.jPicker tr.Hex td.Text{width:100px}.jPicker td.Text input{background-color:#fff;border:1px inset #aaa;height:19px;margin:0 0 0 5px;text-align:left;width:30px}.jPicker td[class="Text"] input{height:15px}.jPicker tr.Hex td.Text input.Hex{width:50px}.jPicker tr.Hex td.Text input.AHex{width:20px}.jPicker .Grid{text-align:center;width:114px}.jPicker .Grid span.QuickColor{border:1px inset #aaa;cursor:pointer;display:inline-block;height:15px;line-height:15px;margin:0;padding:0;width:19px}.jPicker .Grid span[class="QuickColor"]{width:17px}
|
||||
|
|
@ -1 +0,0 @@
|
|||
.xe_colorpicker{position:absolute;width:194px;height:183px;overflow:hidden;z-index:100}.xe_colorpicker .colorpicker{position:relative;width:192px;height:160px;background-color:white;border:1px solid silver}.xe_colorpicker .colortable{position:absolute;left :4px;top :4px;border:1px solid #909090}.xe_colorpicker .colortable .background{position:relative;width:150px;height:150px;background:url(../images/colorpicker_overlay.png) no-repeat;overflow:hidden}.xe_colorpicker .colortable .indicator{position:absolute;width:11px;height:11px;background:url(../images/colorpicker_select.gif) no-repeat}.xe_colorpicker .huebar{position:absolute;right :4px;top:4px;border:1px solid #909090}.xe_colorpicker .huebar .background{width:20px;height:150px;background:url(../images/colorpicker_huebg.png) repeat-x}.xe_colorpicker .huebar .indicator{position:absolute;width:35px;height:9px;left:-3px;background:transparent url(../images/colorpicker_indic.gif) no-repeat}.xe_colorpicker .buttons{position:absolute;width:194px;background-color:black}.xe_colorpicker .buttons button{width:33%;color:white;height:22px;border:0;background-color:transparent;padding:0;margin:0}
|
||||
BIN
common/js/plugins/ui.colorpicker/images/AlphaBar.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
common/js/plugins/ui.colorpicker/images/Bars.png
Normal file
|
After Width: | Height: | Size: 382 B |
BIN
common/js/plugins/ui.colorpicker/images/Maps.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
common/js/plugins/ui.colorpicker/images/NoColor.png
Normal file
|
After Width: | Height: | Size: 552 B |
BIN
common/js/plugins/ui.colorpicker/images/bar-opacity.png
Normal file
|
After Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 86 B |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 78 B |
BIN
common/js/plugins/ui.colorpicker/images/map-opacity.png
Normal file
|
After Width: | Height: | Size: 139 B |
BIN
common/js/plugins/ui.colorpicker/images/mappoint.gif
Normal file
|
After Width: | Height: | Size: 93 B |
BIN
common/js/plugins/ui.colorpicker/images/picker.gif
Normal file
|
After Width: | Height: | Size: 146 B |
BIN
common/js/plugins/ui.colorpicker/images/preview-opacity.png
Normal file
|
After Width: | Height: | Size: 135 B |
BIN
common/js/plugins/ui.colorpicker/images/rangearrows.gif
Normal file
|
After Width: | Height: | Size: 76 B |
BIN
common/js/plugins/ui.colorpicker/images/rangearrows2.gif
Normal file
|
After Width: | Height: | Size: 93 B |
2095
common/js/plugins/ui.colorpicker/jpicker-1.1.6.js
Normal file
71
common/js/plugins/ui.colorpicker/jpicker-1.1.6.min.js
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
(function(j){Math.precision=function(a,d){void 0===d&&(d=0);return Math.round(a*Math.pow(10,d))/Math.pow(10,d)};var W=function(a,d){var c,h,b=this,f=a.find("img:first"),m=0,p=100,n=100,l=0,s=100,q=100,t=0,e=0,C,A=[],u=function(c){for(var a=0;a<A.length;a++)A[a].call(b,b,c)},g=function(e){var d=a.offset();c=d.left|0;h=d.top|0;clearTimeout(C);C=setTimeout(function(){H.call(b,e)},0);j(document).bind("mousemove",k).bind("mouseup",B);e.preventDefault()},k=function(c){clearTimeout(C);C=setTimeout(function(){H.call(b,
|
||||
c)},0);c.stopPropagation();c.preventDefault();return!1},B=function(c){j(document).unbind("mouseup",B).unbind("mousemove",k);c.stopPropagation();c.preventDefault();return!1},H=function(e){var d=e.pageX-c,e=e.pageY-h,f=a.w,g=a.h;0>d?d=0:d>f&&(d=f);0>e?e=0:e>g&&(e=g);F.call(b,"xy",{x:d/f*n+m,y:e/g*q+l})},F=function(c,a,d){if(void 0===a){if(void 0===c||null==c)c="xy";switch(c.toLowerCase()){case "x":return t;case "y":return e;default:return{x:t,y:e}}}if(!(null!=d&&d==b)){var h=!1,f,g;null==c&&(c="xy");
|
||||
switch(c.toLowerCase()){case "x":f=a&&(a.x&&a.x|0||a|0)||0;break;case "y":g=a&&(a.y&&a.y|0||a|0)||0;break;default:f=a&&a.x&&a.x|0||0,g=a&&a.y&&a.y|0||0}null!=f&&(f<m?f=m:f>p&&(f=p),t!=f&&(t=f,h=!0));null!=g&&(g<l?g=l:g>s&&(g=s),e!=g&&(e=g,h=!0));h&&u.call(b,d||b)}},I=function(c){j.isFunction(c)&&A.push(c)};j.extend(!0,b,{val:F,range:function(c,a){if(void 0===a){if(void 0===c||null==c)c="all";switch(c.toLowerCase()){case "minx":return m;case "maxx":return p;case "rangex":return{minX:m,maxX:p,rangeX:n};
|
||||
case "miny":return l;case "maxy":return s;case "rangey":return{minY:l,maxY:s,rangeY:q};default:return{minX:m,maxX:p,rangeX:n,minY:l,maxY:s,rangeY:q}}}var d,e,h,f;null==c&&(c="all");switch(c.toLowerCase()){case "minx":d=a&&(a.minX&&a.minX|0||a|0)||0;break;case "maxx":e=a&&(a.maxX&&a.maxX|0||a|0)||0;break;case "rangex":d=a&&a.minX&&a.minX|0||0;e=a&&a.maxX&&a.maxX|0||0;break;case "miny":h=a&&(a.minY&&a.minY|0||a|0)||0;break;case "maxy":f=a&&(a.maxY&&a.maxY|0||a|0)||0;break;case "rangey":h=a&&a.minY&&
|
||||
a.minY|0||0;f=a&&a.maxY&&a.maxY|0||0;break;default:d=a&&a.minX&&a.minX|0||0,e=a&&a.maxX&&a.maxX|0||0,h=a&&a.minY&&a.minY|0||0,f=a&&a.maxY&&a.maxY|0||0}null!=d&&m!=d&&(m=d,n=p-m);null!=e&&p!=e&&(p=e,n=p-m);null!=h&&l!=h&&(l=h,q=s-l);null!=f&&s!=f&&(s=f,q=s-l)},bind:I,unbind:function(c){if(j.isFunction(c))for(var a;-1!=(a=j.inArray(c,A));)A.splice(a,1)},destroy:function(){j(document).unbind("mouseup",B).unbind("mousemove",k);a.unbind("mousedown",g);A=f=a=null}});f.src=d.arrow&&d.arrow.image;f.w=d.arrow&&
|
||||
d.arrow.width||f.width();f.h=d.arrow&&d.arrow.height||f.height();a.w=d.map&&d.map.width||a.width();a.h=d.map&&d.map.height||a.height();a.bind("mousedown",g);I.call(b,function(){var c=0,d=0,h=a.w,g=a.h,b=f.w,k=f.h;setTimeout(function(){0<n&&(c=t==p?h:t/n*h|0);0<q&&(d=e==s?g:e/q*g|0);c=b>=h?(h>>1)-(b>>1):c-(b>>1);d=k>=g?(g>>1)-(k>>1):d-(k>>1);f.css({left:c+"px",top:d+"px"})},0)})},la=function(a,d,c,h){var b=this,a=a.find("td.Text input"),f=a.eq(3),m=a.eq(4),p=a.eq(5),n=7<a.length?a.eq(6):null,l=a.eq(0),
|
||||
s=a.eq(1),q=a.eq(2),t=a.eq(7<a.length?7:6),e=7<a.length?a.eq(8):null,C=function(a){if(!(""==a.target.value&&a.target!=t.get(0)&&(null!=c&&a.target!=c.get(0)||null==c))){if(!g(a))return a;switch(a.target){case f.get(0):switch(a.keyCode){case 38:return f.val(k.call(b,(f.val()<<0)+1,0,255)),d.val("r",f.val(),a.target),!1;case 40:return f.val(k.call(b,(f.val()<<0)-1,0,255)),d.val("r",f.val(),a.target),!1}break;case m.get(0):switch(a.keyCode){case 38:return m.val(k.call(b,(m.val()<<0)+1,0,255)),d.val("g",
|
||||
m.val(),a.target),!1;case 40:return m.val(k.call(b,(m.val()<<0)-1,0,255)),d.val("g",m.val(),a.target),!1}break;case p.get(0):switch(a.keyCode){case 38:return p.val(k.call(b,(p.val()<<0)+1,0,255)),d.val("b",p.val(),a.target),!1;case 40:return p.val(k.call(b,(p.val()<<0)-1,0,255)),d.val("b",p.val(),a.target),!1}break;case n&&n.get(0):switch(a.keyCode){case 38:return n.val(k.call(b,parseFloat(n.val())+1,0,100)),d.val("a",Math.precision(255*n.val()/100,h),a.target),!1;case 40:return n.val(k.call(b,parseFloat(n.val())-
|
||||
1,0,100)),d.val("a",Math.precision(255*n.val()/100,h),a.target),!1}break;case l.get(0):switch(a.keyCode){case 38:return l.val(k.call(b,(l.val()<<0)+1,0,360)),d.val("h",l.val(),a.target),!1;case 40:return l.val(k.call(b,(l.val()<<0)-1,0,360)),d.val("h",l.val(),a.target),!1}break;case s.get(0):switch(a.keyCode){case 38:return s.val(k.call(b,(s.val()<<0)+1,0,100)),d.val("s",s.val(),a.target),!1;case 40:return s.val(k.call(b,(s.val()<<0)-1,0,100)),d.val("s",s.val(),a.target),!1}break;case q.get(0):switch(a.keyCode){case 38:return q.val(k.call(b,
|
||||
(q.val()<<0)+1,0,100)),d.val("v",q.val(),a.target),!1;case 40:return q.val(k.call(b,(q.val()<<0)-1,0,100)),d.val("v",q.val(),a.target),!1}}}},A=function(a){if(!(""==a.target.value&&a.target!=t.get(0)&&(null!=c&&a.target!=c.get(0)||null==c))){if(!g(a))return a;switch(a.target){case f.get(0):f.val(k.call(b,f.val(),0,255));d.val("r",f.val(),a.target);break;case m.get(0):m.val(k.call(b,m.val(),0,255));d.val("g",m.val(),a.target);break;case p.get(0):p.val(k.call(b,p.val(),0,255));d.val("b",p.val(),a.target);
|
||||
break;case n&&n.get(0):n.val(k.call(b,n.val(),0,100));d.val("a",Math.precision(255*n.val()/100,h),a.target);break;case l.get(0):l.val(k.call(b,l.val(),0,360));d.val("h",l.val(),a.target);break;case s.get(0):s.val(k.call(b,s.val(),0,100));d.val("s",s.val(),a.target);break;case q.get(0):q.val(k.call(b,q.val(),0,100));d.val("v",q.val(),a.target);break;case t.get(0):t.val(t.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));c&&c.val(t.val());d.val("hex",""!=t.val()?t.val():null,a.target);
|
||||
break;case c&&c.get(0):G.isHex(c.val())?(t.val(c.val()),d.val("hex",""!=c.val()?c.val():null,a.target)):d.val("hex",null,a.target);break;case e&&e.get(0):e.val(e.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2)),d.val("a",null!=e.val()?parseInt(e.val(),16):null,a.target)}}},u=function(a){if(null!=d.val())switch(a.target){case f.get(0):f.val(d.val("r"));break;case m.get(0):m.val(d.val("g"));break;case p.get(0):p.val(d.val("b"));break;case n&&n.get(0):n.val(Math.precision(100*d.val("a")/
|
||||
255,h));break;case l.get(0):l.val(d.val("h"));break;case s.get(0):s.val(d.val("s"));break;case q.get(0):q.val(d.val("v"));break;case t.get(0):case c&&c.get(0):t.val(d.val("hex"));c&&c.val("#"+d.val("hex"));break;case e&&e.get(0):e.val(d.val("ahex").substring(6))}},g=function(a){switch(a.keyCode){case 9:case 16:case 29:case 37:case 39:return!1;case "c".charCodeAt():case "v".charCodeAt():if(a.ctrlKey)return!1}return!0},k=function(a,c,d){return""==a||isNaN(a)?c:a>d?d:a<c?c:a},B=function(a,d){var b=a.val("all");
|
||||
d!=f.get(0)&&f.val(null!=b?b.r:"");d!=m.get(0)&&m.val(null!=b?b.g:"");d!=p.get(0)&&p.val(null!=b?b.b:"");n&&d!=n.get(0)&&n.val(null!=b?Math.precision(100*b.a/255,h):"");d!=l.get(0)&&l.val(null!=b?b.h:"");d!=s.get(0)&&s.val(null!=b?b.s:"");d!=q.get(0)&&q.val(null!=b?b.v:"");if(d!=t.get(0)&&(c&&d!=c.get(0)||!c))t.val(null!=b?b.hex:"");c&&d!=c.get(0)&&d!=t.get(0)&&c.val(null!=b?"#"+b.hex:"transparent");e&&d!=e.get(0)&&e.val(null!=b?b.ahex.substring(6):"")};j.extend(!0,b,{destroy:function(){f.add(m).add(p).add(n).add(l).add(s).add(q).add(t).add(c).add(e).unbind("keyup",
|
||||
A).unbind("blur",u);f.add(m).add(p).add(n).add(l).add(s).add(q).unbind("keydown",C);d.unbind(B);e=t=q=s=l=n=p=m=f=null}});f.add(m).add(p).add(n).add(l).add(s).add(q).add(t).add(c).add(e).bind("keyup",A).bind("blur",u);f.add(m).add(p).add(n).add(l).add(s).add(q).bind("keydown",C);d.bind(B)};j.jPicker={List:[],Color:function(a){var d=this,c,b,x,f,m,p,n,l=[],s=function(a){for(var c=0;c<l.length;c++)l[c].call(d,d,a)},q=function(a,e,j){if(void 0===e){if(void 0===a||null==a||""==a)a="all";if(null==c)return null;
|
||||
switch(a.toLowerCase()){case "ahex":return G.rgbaToHex({r:c,g:b,b:x,a:f});case "hex":return q("ahex").substring(0,6);case "all":return{r:c,g:b,b:x,a:f,h:m,s:p,v:n,hex:q.call(d,"hex"),ahex:q.call(d,"ahex")};default:for(var e={},l=0;l<a.length;l++)switch(a.charAt(l)){case "r":1==a.length?e=c:e.r=c;break;case "g":1==a.length?e=b:e.g=b;break;case "b":1==a.length?e=x:e.b=x;break;case "a":1==a.length?e=f:e.a=f;break;case "h":1==a.length?e=m:e.h=m;break;case "s":1==a.length?e=p:e.s=p;break;case "v":1==a.length?
|
||||
e=n:e.v=n}return e=={}?q.call(d,"all"):e}}if(!(null!=j&&j==d)){var u=!1;null==a&&(a="");if(null==e)null!=c&&(c=null,u=!0),null!=b&&(b=null,u=!0),null!=x&&(x=null,u=!0),null!=f&&(f=null,u=!0),null!=m&&(m=null,u=!0),null!=p&&(p=null,u=!0),null!=n&&(n=null,u=!0),u&&s.call(d,j||d);else switch(a.toLowerCase()){case "ahex":case "hex":e=G.hexToRgba(e&&(e.ahex||e.hex)||e||"00000000");q.call(d,"rgba",{r:e.r,g:e.g,b:e.b,a:"ahex"==a?e.a:null!=f?f:255},j);break;default:if(e&&(null!=e.ahex||null!=e.hex)){q.call(d,
|
||||
"ahex",e.ahex||e.hex||"00000000",j);break}var g,k=!1,B=!1;void 0!==e.r&&-1==!a.indexOf("r")&&(a+="r");void 0!==e.g&&-1==!a.indexOf("g")&&(a+="g");void 0!==e.b&&-1==!a.indexOf("b")&&(a+="b");void 0!==e.a&&-1==!a.indexOf("a")&&(a+="a");void 0!==e.h&&-1==!a.indexOf("h")&&(a+="h");void 0!==e.s&&-1==!a.indexOf("s")&&(a+="s");void 0!==e.v&&-1==!a.indexOf("v")&&(a+="v");for(l=0;l<a.length;l++)switch(a.charAt(l)){case "r":if(B)continue;k=!0;g=e&&e.r&&e.r|0||e&&e|0||0;0>g?g=0:255<g&&(g=255);c!=g&&(c=g,u=!0);
|
||||
break;case "g":if(B)continue;k=!0;g=e&&e.g&&e.g|0||e&&e|0||0;0>g?g=0:255<g&&(g=255);b!=g&&(b=g,u=!0);break;case "b":if(B)continue;k=!0;g=e&&e.b&&e.b|0||e&&e|0||0;0>g?g=0:255<g&&(g=255);x!=g&&(x=g,u=!0);break;case "a":g=e&&null!=e.a?e.a|0:null!=e?e|0:255;0>g?g=0:255<g&&(g=255);f!=g&&(f=g,u=!0);break;case "h":if(k)continue;B=!0;g=e&&e.h&&e.h|0||e&&e|0||0;0>g?g=0:360<g&&(g=360);m!=g&&(m=g,u=!0);break;case "s":if(k)continue;B=!0;g=e&&null!=e.s?e.s|0:null!=e?e|0:100;0>g?g=0:100<g&&(g=100);p!=g&&(p=g,u=
|
||||
!0);break;case "v":if(k)continue;B=!0;g=e&&null!=e.v?e.v|0:null!=e?e|0:100;0>g?g=0:100<g&&(g=100);n!=g&&(n=g,u=!0)}u&&(k?(c=c||0,b=b||0,x=x||0,e=G.rgbToHsv({r:c,g:b,b:x}),m=e.h,p=e.s,n=e.v):B&&(m=m||0,p=null!=p?p:100,n=null!=n?n:100,e=G.hsvToRgb({h:m,s:p,v:n}),c=e.r,b=e.g,x=e.b),f=null!=f?f:255,s.call(d,j||d))}}};j.extend(!0,d,{val:q,bind:function(a){j.isFunction(a)&&l.push(a)},unbind:function(a){if(j.isFunction(a))for(var c;-1!=(c=j.inArray(a,l));)l.splice(c,1)},destroy:function(){l=null}});a&&(null!=
|
||||
a.ahex?q("ahex",a):null!=a.hex?q((null!=a.a?"a":"")+"hex",null!=a.a?{ahex:a.hex+G.intToHex(a.a)}:a):null!=a.r&&null!=a.g&&null!=a.b?q("rgb"+(null!=a.a?"a":""),a):null!=a.h&&null!=a.s&&null!=a.v&&q("hsv"+(null!=a.a?"a":""),a))},ColorMethods:{hexToRgba:function(a){a=this.validateHex(a);if(""==a)return{r:null,g:null,b:null,a:null};var d="00",c="00",b="00",j="255";6==a.length&&(a+="ff");6<a.length?(d=a.substring(0,2),c=a.substring(2,4),b=a.substring(4,6),j=a.substring(6,a.length)):(4<a.length&&(d=a.substring(4,
|
||||
a.length),a=a.substring(0,4)),2<a.length&&(c=a.substring(2,a.length),a=a.substring(0,2)),0<a.length&&(b=a.substring(0,a.length)));return{r:this.hexToInt(d),g:this.hexToInt(c),b:this.hexToInt(b),a:this.hexToInt(j)}},isHex:function(a){return/^#[a-fA-F0-9]{6}$/g.test(a)},validateHex:function(a){a=a.toLowerCase().replace(/[^a-f0-9]/g,"");8<a.length&&(a=a.substring(0,8));return a},rgbaToHex:function(a){return this.intToHex(a.r)+this.intToHex(a.g)+this.intToHex(a.b)+this.intToHex(a.a)},intToHex:function(a){a=
|
||||
(a|0).toString(16);1==a.length&&(a="0"+a);return a.toLowerCase()},hexToInt:function(a){return parseInt(a,16)},rgbToHsv:function(a){var d=a.r/255,c=a.g/255,a=a.b/255,b={h:0,s:0,v:0},j=0,f=0;d>=c&&d>=a?(f=d,j=c>a?a:c):c>=a&&c>=d?(f=c,j=d>a?a:d):(f=a,j=c>d?d:c);b.v=f;b.s=f?(f-j)/f:0;b.s?(j=f-j,b.h=d==f?(c-a)/j:c==f?2+(a-d)/j:4+(d-c)/j,b.h=parseInt(60*b.h),0>b.h&&(b.h+=360)):b.h=0;b.s=100*b.s|0;b.v=100*b.v|0;return b},hsvToRgb:function(a){var b={r:0,g:0,b:0,a:100},c=a.h,h=a.s,a=a.v;if(0==h)b.r=0==a?b.g=
|
||||
b.b=0:b.g=b.b=255*a/100|0;else{360==c&&(c=0);var c=c/60,h=h/100,a=a/100,j=c|0,f=c-j,c=a*(1-h),m=a*(1-h*f),h=a*(1-h*(1-f));switch(j){case 0:b.r=a;b.g=h;b.b=c;break;case 1:b.r=m;b.g=a;b.b=c;break;case 2:b.r=c;b.g=a;b.b=h;break;case 3:b.r=c;b.g=m;b.b=a;break;case 4:b.r=h;b.g=c;b.b=a;break;case 5:b.r=a,b.g=c,b.b=m}b.r=255*b.r|0;b.g=255*b.g|0;b.b=255*b.b|0}return b}}};var b=j.jPicker.Color,O=j.jPicker.List,G=j.jPicker.ColorMethods;j.fn.jPicker=function(a){var d=arguments;return this.each(function(){var c=
|
||||
this,h=j.extend(!0,{},j.fn.jPicker.defaults,a);"input"==j(c).get(0).nodeName.toLowerCase()&&(j.extend(!0,h,{window:{bindToInput:!0,expandable:!0,input:j(c)}}),""==j(c).val()||"transparent"==j(c).val()?(h.color.active=new b({hex:null}),h.color.current=new b({hex:null})):G.validateHex(j(c).val())&&(h.color.active=new b({hex:j(c).val(),a:h.color.active.val("a")}),h.color.current=new b({hex:j(c).val(),a:h.color.active.val("a")})));h.window.expandable?j(c).after('<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>'):
|
||||
h.window.liveUpdate=!1;var x=7>parseFloat(navigator.appVersion.split("MSIE")[1])&&document.body.filters,f=null,m=null,p=null,n=null,l=null,s=null,q=null,t=null,e=null,C=null,A=null,u=null,g=null,k=null,B=null,H=null,F=null,I=null,V=null,L=null,J=null,M=null,N=null,K=null,X=null,P=null,Y=null,Z=null,aa=function(a){var b=w.active,d=b.val("hex"),f,j;h.color.mode=a;switch(a){case "h":setTimeout(function(){y.call(c,m,"transparent");o.call(c,n,0);r.call(c,n,100);o.call(c,l,260);r.call(c,l,100);y.call(c,
|
||||
p,"transparent");o.call(c,q,0);r.call(c,q,100);o.call(c,t,260);r.call(c,t,100);o.call(c,e,260);r.call(c,e,100);o.call(c,C,260);r.call(c,C,100);o.call(c,u,260);r.call(c,u,100)},0);g.range("all",{minX:0,maxX:100,minY:0,maxY:100});k.range("rangeY",{minY:0,maxY:360});if(null==b.val("ahex"))break;g.val("xy",{x:b.val("s"),y:100-b.val("v")},g);k.val("y",360-b.val("h"),k);break;case "s":setTimeout(function(){y.call(c,m,"transparent");o.call(c,n,-260);o.call(c,l,-520);o.call(c,q,-260);o.call(c,t,-520);o.call(c,
|
||||
u,260);r.call(c,u,100)},0);g.range("all",{minX:0,maxX:360,minY:0,maxY:100});k.range("rangeY",{minY:0,maxY:100});if(null==b.val("ahex"))break;g.val("xy",{x:b.val("h"),y:100-b.val("v")},g);k.val("y",100-b.val("s"),k);break;case "v":setTimeout(function(){y.call(c,m,"000000");o.call(c,n,-780);o.call(c,l,260);y.call(c,p,d);o.call(c,q,-520);o.call(c,t,260);r.call(c,t,100);o.call(c,u,260);r.call(c,u,100)},0);g.range("all",{minX:0,maxX:360,minY:0,maxY:100});k.range("rangeY",{minY:0,maxY:100});if(null==b.val("ahex"))break;
|
||||
g.val("xy",{x:b.val("h"),y:100-b.val("s")},g);k.val("y",100-b.val("v"),k);break;case "r":f=-1040;j=-780;g.range("all",{minX:0,maxX:255,minY:0,maxY:255});k.range("rangeY",{minY:0,maxY:255});if(null==b.val("ahex"))break;g.val("xy",{x:b.val("b"),y:255-b.val("g")},g);k.val("y",255-b.val("r"),k);break;case "g":f=-1560;j=-1820;g.range("all",{minX:0,maxX:255,minY:0,maxY:255});k.range("rangeY",{minY:0,maxY:255});if(null==b.val("ahex"))break;g.val("xy",{x:b.val("b"),y:255-b.val("r")},g);k.val("y",255-b.val("g"),
|
||||
k);break;case "b":f=-2080;j=-2860;g.range("all",{minX:0,maxX:255,minY:0,maxY:255});k.range("rangeY",{minY:0,maxY:255});if(null==b.val("ahex"))break;g.val("xy",{x:b.val("r"),y:255-b.val("g")},g);k.val("y",255-b.val("b"),k);break;case "a":setTimeout(function(){y.call(c,m,"transparent");o.call(c,n,-260);o.call(c,l,-520);o.call(c,q,260);o.call(c,t,260);r.call(c,t,100);o.call(c,u,0);r.call(c,u,100)},0);g.range("all",{minX:0,maxX:360,minY:0,maxY:100});k.range("rangeY",{minY:0,maxY:255});if(null==b.val("ahex"))break;
|
||||
g.val("xy",{x:b.val("h"),y:100-b.val("v")},g);k.val("y",255-b.val("a"),k);break;default:throw"Invalid Mode";}switch(a){case "s":case "v":case "a":setTimeout(function(){r.call(c,n,100);r.call(c,q,100);o.call(c,e,260);r.call(c,e,100);o.call(c,C,260);r.call(c,C,100)},0);break;case "r":case "g":case "b":setTimeout(function(){y.call(c,m,"transparent");y.call(c,p,"transparent");r.call(c,q,100);r.call(c,n,100);o.call(c,n,f);o.call(c,l,f-260);o.call(c,q,j-780);o.call(c,t,j-520);o.call(c,e,j);o.call(c,C,j-
|
||||
260);o.call(c,u,260);r.call(c,u,100)},0)}null!=b.val("ahex")&&$.call(c,b)},$=function(a,b){(null==b||b!=k&&b!=g)&&ma.call(c,a,b);setTimeout(function(){na.call(c,a);oa.call(c,a);pa.call(c,a)},0)},qa=function(a,c){var b=w.active;if(!(c!=g&&null==b.val())){var e=a.val("all");switch(h.color.mode){case "h":b.val("sv",{s:e.x,v:100-e.y},c);break;case "s":case "a":b.val("hv",{h:e.x,v:100-e.y},c);break;case "v":b.val("hs",{h:e.x,s:100-e.y},c);break;case "r":b.val("gb",{g:255-e.y,b:e.x},c);break;case "g":b.val("rb",
|
||||
{r:255-e.y,b:e.x},c);break;case "b":b.val("rg",{r:e.x,g:255-e.y},c)}}},ra=function(a,c){var b=w.active;if(!(c!=k&&null==b.val()))switch(h.color.mode){case "h":b.val("h",{h:360-a.val("y")},c);break;case "s":b.val("s",{s:100-a.val("y")},c);break;case "v":b.val("v",{v:100-a.val("y")},c);break;case "r":b.val("r",{r:255-a.val("y")},c);break;case "g":b.val("g",{g:255-a.val("y")},c);break;case "b":b.val("b",{b:255-a.val("y")},c);break;case "a":b.val("a",255-a.val("y"),c)}},ma=function(a,c){if(c!=g)switch(h.color.mode){case "h":var b=
|
||||
a.val("sv");g.val("xy",{x:null!=b?b.s:100,y:100-(null!=b?b.v:100)},c);break;case "s":case "a":b=a.val("hv");g.val("xy",{x:b&&b.h||0,y:100-(null!=b?b.v:100)},c);break;case "v":b=a.val("hs");g.val("xy",{x:b&&b.h||0,y:100-(null!=b?b.s:100)},c);break;case "r":b=a.val("bg");g.val("xy",{x:b&&b.b||0,y:255-(b&&b.g||0)},c);break;case "g":b=a.val("br");g.val("xy",{x:b&&b.b||0,y:255-(b&&b.r||0)},c);break;case "b":b=a.val("rg"),g.val("xy",{x:b&&b.r||0,y:255-(b&&b.g||0)},c)}if(c!=k)switch(h.color.mode){case "h":k.val("y",
|
||||
360-(a.val("h")||0),c);break;case "s":b=a.val("s");k.val("y",100-(null!=b?b:100),c);break;case "v":b=a.val("v");k.val("y",100-(null!=b?b:100),c);break;case "r":k.val("y",255-(a.val("r")||0),c);break;case "g":k.val("y",255-(a.val("g")||0),c);break;case "b":k.val("y",255-(a.val("b")||0),c);break;case "a":b=a.val("a"),k.val("y",255-(null!=b?b:255),c)}},na=function(a){try{var b=a.val("all");L.css({backgroundColor:b&&"#"+b.hex||"transparent"});r.call(c,L,b&&Math.precision(100*b.a/255,4)||0)}catch(e){}},
|
||||
oa=function(a){switch(h.color.mode){case "h":y.call(c,m,(new b({h:a.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var e=a.val("s");r.call(c,l,100-(null!=e?e:100));break;case "v":e=a.val("v");r.call(c,n,null!=e?e:100);break;case "r":r.call(c,l,Math.precision(100*((a.val("r")||0)/255),4));break;case "g":r.call(c,l,Math.precision(100*((a.val("g")||0)/255),4));break;case "b":r.call(c,l,Math.precision(100*((a.val("b")||0)/255)))}a=a.val("a");r.call(c,s,Math.precision(100*(255-(a||0))/
|
||||
255,4))},pa=function(a){switch(h.color.mode){case "h":var d=a.val("a");r.call(c,A,Math.precision(100*(255-(d||0))/255,4));break;case "s":var d=a.val("hva"),f=new b({h:d&&d.h||0,s:100,v:null!=d?d.v:100});y.call(c,p,f.val("hex"));r.call(c,t,100-(null!=d?d.v:100));r.call(c,A,Math.precision(100*(255-(d&&d.a||0))/255,4));break;case "v":d=a.val("hsa");f=new b({h:d&&d.h||0,s:null!=d?d.s:100,v:100});y.call(c,p,f.val("hex"));r.call(c,A,Math.precision(100*(255-(d&&d.a||0))/255,4));break;case "r":case "g":case "b":f=
|
||||
d=0;a=a.val("rgba");"r"==h.color.mode?(d=a&&a.b||0,f=a&&a.g||0):"g"==h.color.mode?(d=a&&a.b||0,f=a&&a.r||0):"b"==h.color.mode&&(d=a&&a.r||0,f=a&&a.g||0);var g=f>d?d:f;r.call(c,t,d>f?Math.precision(100*((d-f)/(255-f)),4):0);r.call(c,e,f>d?Math.precision(100*((f-d)/(255-d)),4):0);r.call(c,C,Math.precision(100*(g/255),4));r.call(c,A,Math.precision(100*(255-(a&&a.a||0))/255,4));break;case "a":d=a.val("a"),y.call(c,p,a.val("hex")||"000000"),r.call(c,A,null!=d?0:100),r.call(c,u,null!=d?100:0)}},y=function(a,
|
||||
b){a.css({backgroundColor:b&&6==b.length&&"#"+b||"transparent"})},E=function(a,b){x&&(-1!=b.indexOf("AlphaBar.png")||-1!=b.indexOf("Bars.png")||-1!=b.indexOf("Maps.png"))?(a.attr("pngSrc",b),a.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b+"', sizingMethod='scale')"})):a.css({backgroundImage:"url('"+b+"')"})},o=function(a,b){a.css({top:b+"px"})},r=function(a,b){a.css({visibility:0<b?"visible":"hidden"});if(0<b&&100>b)if(x){var c=a.attr("pngSrc");null!=
|
||||
c&&(-1!=c.indexOf("AlphaBar.png")||-1!=c.indexOf("Bars.png")||-1!=c.indexOf("Maps.png"))?a.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+c+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+b+")"}):a.css({opacity:Math.precision(b/100,4)})}else a.css({opacity:Math.precision(b/100,4)});else if(0==b||100==b)x?(c=a.attr("pngSrc"),null!=c&&(-1!=c.indexOf("AlphaBar.png")||-1!=c.indexOf("Bars.png")||-1!=c.indexOf("Maps.png"))?a.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
|
||||
c+"', sizingMethod='scale')"}):a.css({opacity:""})):a.css({opacity:""})},ba=function(){w.active.val("ahex",w.current.val("ahex"))},sa=function(){w.current.val("ahex",w.active.val("ahex"))},ca=function(a){j(this).parents("tbody:first").find('input:radio[value!="'+a.target.value+'"]').removeAttr("checked");aa.call(c,a.target.value)},da=function(){ba.call(c)},ea=function(){ba.call(c);h.window.expandable&&T.call(c);j.isFunction(Q)&&Q.call(c,w.active,N)},fa=function(){sa.call(c);h.window.expandable&&T.call(c);
|
||||
j.isFunction(R)&&R.call(c,w.active,M)},ga=function(){U.call(c)},ta=function(a){var b=a.val("hex");J.css({backgroundColor:b&&"#"+b||"transparent"});r.call(c,J,Math.precision(100*(a.val("a")||0)/255,4))},ua=function(a){var b=a.val("hex"),a=a.val("va");X.css({backgroundColor:b&&"#"+b||"transparent"});r.call(c,P,Math.precision(100*(255-(a&&a.a||0))/255,4));h.window.bindToInput&&h.window.updateInputColor&&h.window.input.css({backgroundColor:b&&"#"+b||"transparent",color:null==a||75<a.v?"#000000":"#ffffff"})},
|
||||
ja=function(a){H=parseInt(f.css("left"));F=parseInt(f.css("top"));I=a.pageX;V=a.pageY;j(document).bind("mousemove",ha).bind("mouseup",ia);a.preventDefault()},ha=function(a){f.css({left:H-(I-a.pageX)+"px",top:F-(V-a.pageY)+"px"});h.window.expandable&&!j.support.boxModel&&f.prev().css({left:f.css("left"),top:f.css("top")});a.stopPropagation();a.preventDefault();return!1},ia=function(a){j(document).unbind("mousemove",ha).unbind("mouseup",ia);a.stopPropagation();a.preventDefault();return!1},ka=function(a){a.preventDefault();
|
||||
a.stopPropagation();w.active.val("ahex",j(this).attr("title")||null,a.target);return!1},R=j.isFunction(d[1])&&d[1]||null,S=j.isFunction(d[2])&&d[2]||null,Q=j.isFunction(d[3])&&d[3]||null,U=function(){w.current.val("ahex",w.active.val("ahex"));var a=function(){if(h.window.expandable&&!j.support.boxModel){var a=f.find("table:first");f.before("<iframe/>");f.prev().css({width:a.width(),height:f.height(),opacity:0,position:"absolute",left:f.css("left"),top:f.css("top")})}};h.window.expandable&&(j(document.body).children("div.jPicker.Container").css({zIndex:10}),
|
||||
f.css({zIndex:20}));switch(h.window.effects.type){case "fade":f.fadeIn(h.window.effects.speed.show,a);break;case "slide":f.slideDown(h.window.effects.speed.show,a);break;default:f.show(h.window.effects.speed.show,a)}},T=function(){var a=function(){h.window.expandable&&f.css({zIndex:10});h.window.expandable&&!j.support.boxModel&&f.prev().remove()};switch(h.window.effects.type){case "fade":f.fadeOut(h.window.effects.speed.hide,a);break;case "slide":f.slideUp(h.window.effects.speed.hide,a);break;default:f.hide(h.window.effects.speed.hide,
|
||||
a)}},va=function(){var a=h.window,d=a.expandable?j(c).next().find(".Container:first"):null;f=a.expandable?j("<div/>"):j(c);f.addClass("jPicker Container");a.expandable&&f.hide();f.get(0).onselectstart=function(a){if("input"!==a.target.nodeName.toLowerCase())return!1};var o=w.active.val("all");0>a.alphaPrecision?a.alphaPrecision=0:2<a.alphaPrecision&&(a.alphaPrecision=2);var x='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(a.expandable?'<tr><td class="Move" colspan="5"> </td></tr>':
|
||||
"")+'<tr><td rowspan="9"><h2 class="Title">'+(a.title||z.text.title)+'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="'+v.clientPath+v.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><span class="Map4"> </span><span class="Map5"> </span><span class="Map6"> </span><img src="'+
|
||||
v.clientPath+v.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview">'+z.text.newColor+'<div><span class="Active" title="'+z.tooltips.colors.newColor+'"> </span><span class="Current" title="'+z.tooltips.colors.currentColor+'"> </span></div>'+z.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+z.text.ok+'" title="'+z.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+z.text.cancel+'" title="'+z.tooltips.buttons.cancel+
|
||||
'"/><hr/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="'+z.tooltips.hue.radio+'"><input type="radio" value="h"'+("h"==h.color.mode?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.h:"")+'" title="'+z.tooltips.hue.textbox+'"/> °</td></tr><tr class="Saturation"><td class="Radio"><label title="'+z.tooltips.saturation.radio+'"><input type="radio" value="s"'+("s"==h.color.mode?' checked="checked"':
|
||||
"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.s:"")+'" title="'+z.tooltips.saturation.textbox+'"/> %</td></tr><tr class="Value"><td class="Radio"><label title="'+z.tooltips.value.radio+'"><input type="radio" value="v"'+("v"==h.color.mode?' checked="checked"':"")+'/>V:</label><br/><br/></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.v:"")+'" title="'+z.tooltips.value.textbox+'"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+
|
||||
z.tooltips.red.radio+'"><input type="radio" value="r"'+("r"==h.color.mode?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.r:"")+'" title="'+z.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+z.tooltips.green.radio+'"><input type="radio" value="g"'+("g"==h.color.mode?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.g:"")+'" title="'+
|
||||
z.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+z.tooltips.blue.radio+'"><input type="radio" value="b"'+("b"==h.color.mode?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=o?o.b:"")+'" title="'+z.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(a.alphaSupport?'<label title="'+z.tooltips.alpha.radio+'"><input type="radio" value="a"'+("a"==h.color.mode?' checked="checked"':
|
||||
"")+"/>A:</label>":" ")+'</td><td class="Text">'+(a.alphaSupport?'<input type="text" maxlength="'+(3+a.alphaPrecision)+'" value="'+(null!=o?Math.precision(100*o.a/255,a.alphaPrecision):"")+'" title="'+z.tooltips.alpha.textbox+'"/> %':" ")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+z.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(null!=o?o.hex:"")+'"/></label>'+(a.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+
|
||||
(null!=o?o.ahex.substring(6):"")+'" title="'+z.tooltips.hex.alpha+'"/></td>':" ")+"</tr></tbody></table>";a.expandable?(f.html(x),0==j(document.body).children("div.jPicker.Container").length?j(document.body).prepend(f):j(document.body).children("div.jPicker.Container:last").after(f),f.mousedown(function(){j(document.body).children("div.jPicker.Container").css({zIndex:10});f.css({zIndex:20})}),f.css({left:"left"==a.position.x?d.offset().left-530-("center"==a.position.y?25:0)+"px":"center"==a.position.x?
|
||||
d.offset().left-260+"px":"right"==a.position.x?d.offset().left-10+("center"==a.position.y?25:0)+"px":"screenCenter"==a.position.x?(j(document).width()>>1)-260+"px":d.offset().left+parseInt(a.position.x)+"px",position:"absolute",top:"top"==a.position.y?d.offset().top-312+"px":"center"==a.position.y?d.offset().top-156+"px":"bottom"==a.position.y?d.offset().top+25+"px":d.offset().top+parseInt(a.position.y)+"px"})):(f=j(c),f.html(x));x=f.find("tbody:first");m=x.find("div.Map:first");p=x.find("div.Bar:first");
|
||||
var y=m.find("span"),D=p.find("span");n=y.filter(".Map1:first");l=y.filter(".Map2:first");s=y.filter(".Map3:first");q=D.filter(".Map1:first");t=D.filter(".Map2:first");e=D.filter(".Map3:first");C=D.filter(".Map4:first");A=D.filter(".Map5:first");u=D.filter(".Map6:first");g=new W(m,{map:{width:v.colorMap.width,height:v.colorMap.height},arrow:{image:v.clientPath+v.colorMap.arrow.file,width:v.colorMap.arrow.width,height:v.colorMap.arrow.height}});g.bind(qa);k=new W(p,{map:{width:v.colorBar.width,height:v.colorBar.height},
|
||||
arrow:{image:v.clientPath+v.colorBar.arrow.file,width:v.colorBar.arrow.width,height:v.colorBar.arrow.height}});k.bind(ra);B=new la(x,w.active,a.expandable&&a.bindToInput?a.input:null,a.alphaPrecision);var y=null!=o?o.hex:null,G=x.find(".Preview"),D=x.find(".Button");L=G.find(".Active:first").css({backgroundColor:y&&"#"+y||"transparent"});J=G.find(".Current:first").css({backgroundColor:y&&"#"+y||"transparent"}).bind("click",da);r.call(c,J,Math.precision(100*w.current.val("a"))/255,4);M=D.find(".Ok:first").bind("click",
|
||||
fa);N=D.find(".Cancel:first").bind("click",ea);K=D.find(".Grid:first");setTimeout(function(){E.call(c,n,v.clientPath+"Maps.png");E.call(c,l,v.clientPath+"Maps.png");E.call(c,s,v.clientPath+"map-opacity.png");E.call(c,q,v.clientPath+"Bars.png");E.call(c,t,v.clientPath+"Bars.png");E.call(c,e,v.clientPath+"Bars.png");E.call(c,C,v.clientPath+"Bars.png");E.call(c,A,v.clientPath+"bar-opacity.png");E.call(c,u,v.clientPath+"AlphaBar.png");E.call(c,G.find("div:first"),v.clientPath+"preview-opacity.png")},
|
||||
0);x.find("td.Radio input").bind("click",ca);if(w.quickList&&0<w.quickList.length){D="";for(i=0;i<w.quickList.length;i++){"string"==(typeof w.quickList[i]).toString().toLowerCase()&&(w.quickList[i]=new b({hex:w.quickList[i]}));var H=w.quickList[i].val("a"),F=w.quickList[i].val("ahex");!a.alphaSupport&&F&&(F=F.substring(0,6)+"ff");var I=w.quickList[i].val("hex"),D=D+('<span class="QuickColor"'+(F&&' title="#'+F+'"'||"")+' style="background-color:'+(I&&"#"+I||"")+";"+(I?"":"background-image:url("+v.clientPath+
|
||||
"NoColor.png)")+(a.alphaSupport&&H&&255>H?";opacity:"+Math.precision(H/255,4)+";filter:Alpha(opacity="+Math.precision(H/2.55,4)+")":"")+'"> </span>')}E.call(c,K,v.clientPath+"bar-opacity.png");K.html(D);K.find(".QuickColor").click(ka)}aa.call(c,h.color.mode);w.active.bind($);j.isFunction(S)&&w.active.bind(S);w.current.bind(ta);a.expandable?(c.icon=d.parents(".Icon:first"),X=c.icon.find(".Color:first").css({backgroundColor:y&&"#"+y||"transparent"}),P=c.icon.find(".Alpha:first"),E.call(c,P,v.clientPath+
|
||||
"bar-opacity.png"),r.call(c,P,Math.precision(100*(255-(null!=o?o.a:0))/255,4)),Y=c.icon.find(".Image:first").css({backgroundImage:"url('"+v.clientPath+v.picker.file+"')"}).bind("click",ga),a.bindToInput&&a.updateInputColor&&a.input.css({backgroundColor:y&&"#"+y||"transparent",color:null==o||75<o.v?"#000000":"#ffffff"}),Z=x.find(".Move:first").bind("mousedown",ja),w.active.bind(ua)):U.call(c)},v=h.images,z=h.localization,w={active:"string"==(typeof h.color.active).toString().toLowerCase()?new b({ahex:!h.window.alphaSupport&&
|
||||
h.color.active?h.color.active.substring(0,6)+"ff":h.color.active}):new b({ahex:!h.window.alphaSupport&&h.color.active.val("ahex")?h.color.active.val("ahex").substring(0,6)+"ff":h.color.active.val("ahex")}),current:"string"==(typeof h.color.active).toString().toLowerCase()?new b({ahex:!h.window.alphaSupport&&h.color.active?h.color.active.substring(0,6)+"ff":h.color.active}):new b({ahex:!h.window.alphaSupport&&h.color.active.val("ahex")?h.color.active.val("ahex").substring(0,6)+"ff":h.color.active.val("ahex")}),
|
||||
quickList:h.color.quickList};j.extend(!0,c,{commitCallback:R,liveCallback:S,cancelCallback:Q,color:w,show:U,hide:T,destroy:function(){f.find("td.Radio input").unbind("click",ca);J.unbind("click",da);N.unbind("click",ea);M.unbind("click",fa);h.window.expandable&&(Y.unbind("click",ga),Z.unbind("mousedown",ja),c.icon=null);f.find(".QuickColor").unbind("click",ka);u=A=C=e=t=q=s=l=n=p=m=null;g.destroy();g=null;k.destroy();k=null;B.destroy();S=Q=R=K=N=M=J=L=B=null;f.html("");for(i=0;i<O.length;i++)O[i]==
|
||||
c&&O.splice(i,1)}});O.push(c);setTimeout(function(){va.call(c)},0)})};j.fn.jPicker.defaults={window:{title:null,effects:{type:"show",speed:{show:0,hide:0}},position:{x:"screenCenter",y:"top"},expandable:!1,liveUpdate:!0,alphaSupport:!1,alphaPrecision:0,updateInputColor:!0},color:{mode:"h",active:new b({ahex:"#ffcc00ff"}),quickList:[new b({h:360,s:33,v:100}),new b({h:360,s:66,v:100}),new b({h:360,s:100,v:100}),new b({h:360,s:100,v:75}),new b({h:360,s:100,v:50}),new b({h:180,s:0,v:100}),new b({h:30,
|
||||
s:33,v:100}),new b({h:30,s:66,v:100}),new b({h:30,s:100,v:100}),new b({h:30,s:100,v:75}),new b({h:30,s:100,v:50}),new b({h:180,s:0,v:90}),new b({h:60,s:33,v:100}),new b({h:60,s:66,v:100}),new b({h:60,s:100,v:100}),new b({h:60,s:100,v:75}),new b({h:60,s:100,v:50}),new b({h:180,s:0,v:80}),new b({h:90,s:33,v:100}),new b({h:90,s:66,v:100}),new b({h:90,s:100,v:100}),new b({h:90,s:100,v:75}),new b({h:90,s:100,v:50}),new b({h:180,s:0,v:70}),new b({h:120,s:33,v:100}),new b({h:120,s:66,v:100}),new b({h:120,
|
||||
s:100,v:100}),new b({h:120,s:100,v:75}),new b({h:120,s:100,v:50}),new b({h:180,s:0,v:60}),new b({h:150,s:33,v:100}),new b({h:150,s:66,v:100}),new b({h:150,s:100,v:100}),new b({h:150,s:100,v:75}),new b({h:150,s:100,v:50}),new b({h:180,s:0,v:50}),new b({h:180,s:33,v:100}),new b({h:180,s:66,v:100}),new b({h:180,s:100,v:100}),new b({h:180,s:100,v:75}),new b({h:180,s:100,v:50}),new b({h:180,s:0,v:40}),new b({h:210,s:33,v:100}),new b({h:210,s:66,v:100}),new b({h:210,s:100,v:100}),new b({h:210,s:100,v:75}),
|
||||
new b({h:210,s:100,v:50}),new b({h:180,s:0,v:30}),new b({h:240,s:33,v:100}),new b({h:240,s:66,v:100}),new b({h:240,s:100,v:100}),new b({h:240,s:100,v:75}),new b({h:240,s:100,v:50}),new b({h:180,s:0,v:20}),new b({h:270,s:33,v:100}),new b({h:270,s:66,v:100}),new b({h:270,s:100,v:100}),new b({h:270,s:100,v:75}),new b({h:270,s:100,v:50}),new b({h:180,s:0,v:10}),new b({h:300,s:33,v:100}),new b({h:300,s:66,v:100}),new b({h:300,s:100,v:100}),new b({h:300,s:100,v:75}),new b({h:300,s:100,v:50}),new b({h:180,
|
||||
s:0,v:0}),new b({h:330,s:33,v:100}),new b({h:330,s:66,v:100}),new b({h:330,s:100,v:100}),new b({h:330,s:100,v:75}),new b({h:330,s:100,v:50}),new b]},images:{clientPath:"./common/js/plugins/ui.colorpicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:20,height:7}},picker:{file:"picker.gif",width:25,height:24}},localization:{text:{title:"Drag Markers To Pick A Color",newColor:"new",currentColor:"current",
|
||||
ok:"OK",cancel:"Cancel"},tooltips:{colors:{newColor:"New Color - Press “OK” To Commit",currentColor:"Click To Revert To Original Color"},buttons:{ok:"Commit To This Color Selection",cancel:"Cancel And Revert To Original Color"},hue:{radio:"Set To “Hue” Color Mode",textbox:"Enter A “Hue” Value (0-360°)"},saturation:{radio:"Set To “Saturation” Color Mode",textbox:"Enter A “Saturation” Value (0-100%)"},value:{radio:"Set To “Value” Color Mode",
|
||||
textbox:"Enter A “Value” Value (0-100%)"},red:{radio:"Set To “Red” Color Mode",textbox:"Enter A “Red” Value (0-255)"},green:{radio:"Set To “Green” Color Mode",textbox:"Enter A “Green” Value (0-255)"},blue:{radio:"Set To “Blue” Color Mode",textbox:"Enter A “Blue” Value (0-255)"},alpha:{radio:"Set To “Alpha” Color Mode",textbox:"Enter A “Alpha” Value (0-100)"},hex:{textbox:"Enter A “Hex” Color Value (#000000-#ffffff)",
|
||||
alpha:"Enter A “Alpha” Value (#00-#ff)"}}}}})(jQuery,"1.1.6");
|
||||
5
common/js/plugins/ui.colorpicker/minify.ini
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[option]
|
||||
use_closure_compiler=true
|
||||
|
||||
[skip]
|
||||
xe_colorpicker.js
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
css/xe_colorpicker.css
|
||||
css/jPicker-1.1.6.min.css
|
||||
jpicker-1.1.6.min.js
|
||||
xe_colorpicker.js
|
||||
|
|
|
|||
|
|
@ -3,363 +3,9 @@
|
|||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
jQuery(function($){
|
||||
var ready = false;
|
||||
var tmp = $('<span>').hide();
|
||||
// var panel = null;
|
||||
|
||||
$.fn.xe_colorpicker = function(settings){
|
||||
var selection = this;
|
||||
|
||||
if (!ready) {
|
||||
ColorPicker.init(settings);
|
||||
ready = true;
|
||||
}
|
||||
|
||||
this.each(function(){
|
||||
var col = color($(this).val());
|
||||
|
||||
$(this).val( col ).css('background-color', col );
|
||||
setTextColor( $(this) );
|
||||
}).focus(function(event){
|
||||
var t = this;
|
||||
$(this).select();
|
||||
|
||||
// show color picker
|
||||
ColorPicker.show(this);
|
||||
}).keypress(function(event){
|
||||
if (!ColorPicker.is(':visible')) return;
|
||||
|
||||
if (/^#?[0-9a-f]{6}$/i.test( event.target.value )) {
|
||||
ColorPicker.color( event.target.value );
|
||||
}
|
||||
});
|
||||
|
||||
$(document).mousedown(function(event){
|
||||
var target = event.target;
|
||||
|
||||
if (selection.index(target) > -1) return;
|
||||
if ($(target).parents().add(target).index(ColorPicker.element) > -1) return;
|
||||
if ($(target).parents().add(target).index(ColorPicker.buttons) > -1) return;
|
||||
|
||||
ColorPicker.hide();
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
var ColorPicker = {
|
||||
element : null,
|
||||
picker : null,
|
||||
colpane: null,
|
||||
buttons : null,
|
||||
_target : null,
|
||||
_backup : null,
|
||||
_hsv : null,
|
||||
_mode : 'none',
|
||||
|
||||
init : function() {
|
||||
var cp = this;
|
||||
|
||||
this.element = $('<div class="xe_colorpicker"><div class="colorpicker"><div class="colortable"><div class="background"><div class="indicator"></div></div></div><div class="huebar"><div class="background"><div class="indicator"></div></div></div></div><div class="buttons"><button type="button" class="ok">OK</button><button type="button" class="cancel">Cancel</button><button type="button" class="none">None</button></div></div>');
|
||||
|
||||
this.picker = this.element.find('> div.colorpicker');
|
||||
this.colpane = this.picker.find('div.colortable > div.background');
|
||||
this.colpoint = this.colpane.find('> .indicator');
|
||||
this.buttons = this.element.find('> div.buttons');
|
||||
this.huepane = this.element.find('div.huebar > .background');
|
||||
this.huepoint = this.huepane.find('> .indicator');
|
||||
|
||||
this._mousedown = method(this.onmousedown, this);
|
||||
this._mousemove = method(this.onmousemove, this);
|
||||
this._mouseup = method(this.onmouseup, this);
|
||||
|
||||
this.picker.find('.background').mousedown(this._mousedown);
|
||||
|
||||
this.buttons.find('button.ok').click(method(this.ok,this));
|
||||
this.buttons.find('button.cancel').click(method(this.cancel,this));
|
||||
this.buttons.find('button.none').click(method(this.none,this));
|
||||
|
||||
// only for IE6
|
||||
if ($.browser.msie && parseInt($.browser.version) < 7) {
|
||||
this.element.append( $('<iframe>').css({position:'absolute','z-index':-1,left:0,top:0,width:9999,height:9999}) );
|
||||
}
|
||||
},
|
||||
show : function(input) {
|
||||
var pos = (input=$(input)).offset(), pos_panel;
|
||||
//var par = input.get(0).offsetParent;
|
||||
var par = $("body").get(0);
|
||||
var btn = this.buttons.hide();
|
||||
var col = color(input.val());
|
||||
|
||||
this._target = input;
|
||||
this._backup = col;
|
||||
|
||||
this.color(col);
|
||||
this._target.val(col);
|
||||
|
||||
pos_panel = this.element.hide().css({'z-index':99999,left:0,top:0}).appendTo( par ).show(300,function(){btn.slideDown(150)}).offset();
|
||||
this.element.css({left:pos.left-pos_panel.left,top:pos.top-pos_panel.top+input.get(0).offsetHeight});
|
||||
},
|
||||
hide : function() {
|
||||
var e = this.element;
|
||||
|
||||
this._target = null;
|
||||
this.buttons.slideUp(100, function(){e.hide(200)});
|
||||
},
|
||||
visible : function() {
|
||||
return this.element.is(':visible');
|
||||
},
|
||||
color : function(sColor) {
|
||||
if (typeof sColor == 'string') {
|
||||
var col = color(sColor);
|
||||
var hsv = _hsv(rgb2hsv(hex2rgb(col)));
|
||||
|
||||
this.hsv(hsv.h, hsv.s, hsv.v);
|
||||
} else if (this._target) {
|
||||
return color(this._target.val());
|
||||
}
|
||||
},
|
||||
hsv : function(h, s, v) {
|
||||
var col = rgb2hex(hsv2rgb(h, s, v));
|
||||
|
||||
this._hsv = _hsv(h, s, v);
|
||||
|
||||
// background color and text color
|
||||
this._target.val(col).css('background-color', col);
|
||||
setTextColor(this._target);
|
||||
|
||||
// hue bar indicator
|
||||
if (this._hue_h) this.huepoint.css('top', limit(0, Math.round((360-this._hsv.h)/360*this._hue_h), this._hue_h-1) - 3 );
|
||||
|
||||
// color - background
|
||||
this.colpane.css('background-color', rgb2hex(hsv2rgb(h, 100, 100)) );
|
||||
|
||||
// color - indicator
|
||||
if (this._col_h && this._col_w) {
|
||||
this.colpoint.css({
|
||||
top : limit(0, Math.round((100-this._hsv.v)/100*this._col_h), this._col_h-1) - 5,
|
||||
left : limit(0, Math.round(this._hsv.s/100*this._col_w), this._col_w-1 ) - 5
|
||||
});
|
||||
}
|
||||
},
|
||||
onmousedown : function(event) {
|
||||
var cur = $(event.target);
|
||||
var par = cur.parent();
|
||||
var pos = cur.offset();
|
||||
var hue, sat, val; // hue, saturation, value
|
||||
|
||||
this._height = cur.height();
|
||||
this._width = cur.width();
|
||||
this._top = pos.top;
|
||||
this._left = pos.left;
|
||||
|
||||
this._col_w = this.colpane.width();
|
||||
this._col_h = this.colpane.width();
|
||||
this._hue_h = this.huepane.height();
|
||||
|
||||
if (par.is('.colortable')) {
|
||||
this._mode = 'color';
|
||||
hue = this._hsv.h;
|
||||
sat = ( limit(0, (event.pageX - this._left), this._width ) / this._width * 100);
|
||||
val = ( limit(0, (this._height - event.pageY + this._top), this._height ) / this._height * 100);
|
||||
} else if (par.is('.huebar')) {
|
||||
this._mode = 'hue';
|
||||
hue = limit(0, (this._height - event.pageY + this._top), this._height) / this._height * 360;
|
||||
sat = this._hsv.s;
|
||||
val = this._hsv.v;
|
||||
}
|
||||
|
||||
this.hsv( hue, sat, val );
|
||||
|
||||
$(document).bind('mousemove', this._mousemove).bind('mouseup', this._mouseup);
|
||||
},
|
||||
onmousemove : function(event) {
|
||||
var hue, sat, val; // hue, saturation, value
|
||||
|
||||
switch(this._mode) {
|
||||
case 'color':
|
||||
hue = this._hsv.h;
|
||||
sat = ( limit(0, (event.pageX - this._left), this._width ) / this._width * 100);
|
||||
val = ( limit(0, (this._height - event.pageY + this._top), this._height ) / this._height * 100);
|
||||
break;
|
||||
case 'hue':
|
||||
hue = limit(0, (this._height - event.pageY + this._top), this._height) / this._height * 360;
|
||||
sat = this._hsv.s;
|
||||
val = this._hsv.v;
|
||||
break;
|
||||
}
|
||||
|
||||
this.hsv( hue, sat, val );
|
||||
},
|
||||
onmouseup : function(event) {
|
||||
this._mode = 'none';
|
||||
$(document).unbind('mousemove', this._mousemove).unbind('mouseup', this._mouseup);
|
||||
},
|
||||
ok : function() {
|
||||
this.hide();
|
||||
},
|
||||
cancel : function() {
|
||||
this.color(this._backup);
|
||||
this.hide();
|
||||
},
|
||||
none : function() {
|
||||
this._target.attr('value','transparent').css('background','').css('color','#000000');
|
||||
this.hide();
|
||||
}
|
||||
};
|
||||
|
||||
function setTextColor(input) {
|
||||
var hex = input.css('color', '').val(), hsv, rgb;
|
||||
|
||||
if (hex == 'transparent' || hex == '') return;
|
||||
|
||||
rgb = hex2rgb(hex);
|
||||
hsv = rgb2hsv(255-rgb.r, 255-rgb.g, 255-rgb.b); // 보색을 구한 뒤
|
||||
hex = rgb2hex(hsv2rgb(0, 0, hsv.v>50?100:0)); // 보색에 해당하는 흑백으로 결정
|
||||
|
||||
input.css('color', hex);
|
||||
}
|
||||
|
||||
function method(func, thisObj) {
|
||||
return function() { return func.apply(thisObj, arguments) }
|
||||
}
|
||||
|
||||
function color(str) {
|
||||
var col = $.trim(str);
|
||||
var regHex1 = /^#[0-9a-f]{6}$/i;
|
||||
var regHex2 = /^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i; // short hex
|
||||
|
||||
if (regHex1.test(col)) return col.toUpperCase();
|
||||
if (regHex2.test(col)) return col.replace(regHex2, '#$1$1$2$2$3$3').toUpperCase();
|
||||
|
||||
try {
|
||||
col = tmp.appendTo($('<body>')).css('background-color', col).css('background-color');
|
||||
} catch(e) {
|
||||
col = 'transparent';
|
||||
} finally {
|
||||
tmp.css('background-color','').remove();
|
||||
}
|
||||
|
||||
if (/^rgb\(([0-9, ]+)\)$/i.test(col)) col = rgb2hex(RegExp.$1.split(/,\s*/));
|
||||
if (!/#[0-9a-f]{6}/i.test(col)) col = 'transparent';
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
function _rgb(rgb, _g, _b) {
|
||||
var r, g, b;
|
||||
|
||||
if (typeof arguments[2] == "number") {
|
||||
r = rgb;
|
||||
g = _g;
|
||||
b = _b;
|
||||
} else if (typeof rgb == "object") {
|
||||
if (rgb.constructor == Array) {
|
||||
r = rgb[0] || 0; g = rgb[1] || 0; b = rgb[2] || 0;
|
||||
} else {
|
||||
r = rgb.r || 0; g = rgb.g || 0; b = rgb.b || 0;
|
||||
}
|
||||
}
|
||||
|
||||
rgb = [];
|
||||
|
||||
rgb.r = rgb[0] = r = parseInt(r, 10);
|
||||
rgb.g = rgb[1] = g = parseInt(g, 10);
|
||||
rgb.b = rgb[2] = b = parseInt(b, 10);
|
||||
|
||||
return rgb;
|
||||
}
|
||||
|
||||
function _hsv(hsv, _s, _v) {
|
||||
var h, s, v;
|
||||
|
||||
if (typeof arguments[2] == "number") {
|
||||
h = hsv; s = _s; v = _v;
|
||||
} else if (typeof hsv == "object") {
|
||||
if (hsv.constructor == Array) {
|
||||
h = hsv[0] || 0; s = hsv[1] || 0; v = hsv[2] || 0;
|
||||
} else {
|
||||
h = hsv.h || 0; s = hsv.s || 0; v = hsv.v || 0;
|
||||
}
|
||||
}
|
||||
|
||||
hsv = [];
|
||||
|
||||
hsv.h = hsv[0] = h = parseInt(h, 10);
|
||||
hsv.s = hsv[1] = s = parseInt(s, 10);
|
||||
hsv.v = hsv[2] = v = parseInt(v, 10);
|
||||
|
||||
return hsv;
|
||||
}
|
||||
|
||||
function rgb2hex(rgb, _g, _b) {
|
||||
var rgb = _rgb(rgb, _g, _b);
|
||||
|
||||
for(var i=0; i < rgb.length; i++) {
|
||||
(rgb[i] = Number(rgb[i]).toString(16)).length<2?rgb[i]='0'+rgb[i]:0;
|
||||
}
|
||||
|
||||
return '#'+rgb.join('').toUpperCase();
|
||||
}
|
||||
|
||||
function hex2rgb(hex) {
|
||||
var r=0, g=0, b=0;
|
||||
|
||||
if (/^#?([0-9a-f]{1,2})([0-9a-f]{1,2})([0-9a-f]{1,2})$/i.test(hex)) {
|
||||
r = parseInt(RegExp.$1, 16);
|
||||
g = parseInt(RegExp.$2, 16);
|
||||
b = parseInt(RegExp.$3, 16);
|
||||
}
|
||||
|
||||
return _rgb(r, g, b);
|
||||
}
|
||||
|
||||
function hsv2rgb(hsv, _s, _v) {
|
||||
var r=0, g=0, b=0;
|
||||
var h=0, s=0, v=0;
|
||||
var i, f, p, q, t;
|
||||
|
||||
hsv = _hsv(hsv, _s, _v);
|
||||
|
||||
h = (hsv[0] % 360) / 60; s = hsv[1] / 100; v = hsv[2] / 100;
|
||||
|
||||
i = Math.floor(h);
|
||||
f = h-i;
|
||||
p = v*(1-s);
|
||||
q = v*(1-s*f);
|
||||
t = v*(1-s*(1-f));
|
||||
|
||||
switch (i) {
|
||||
case 0: r=v; g=t; b=p; break;
|
||||
case 1: r=q; g=v; b=p; break;
|
||||
case 2: r=p; g=v; b=t; break;
|
||||
case 3: r=p; g=q; b=v; break;
|
||||
case 4: r=t; g=p; b=v; break;
|
||||
case 5: r=v; g=p; b=q; break;
|
||||
case 6: break;
|
||||
}
|
||||
|
||||
return _rgb(Math.floor(r*255), Math.floor(g*255), Math.floor(b*255));
|
||||
}
|
||||
|
||||
function rgb2hsv(rgb, _g, _b) {
|
||||
var rgb = _rgb(rgb, _g, _b);
|
||||
var r = rgb[0], g = rgb[1], b = rgb[2];
|
||||
var h = 0, s = 0, v = Math.max(r,g,b), min = Math.min(r,g,b), delta = v - min;
|
||||
|
||||
if (s = v?delta/v:0) {
|
||||
if (r == v) h = 60 * (g - b) / delta;
|
||||
else if (g == v) h = 120 + 60 * (b - r) / delta;
|
||||
else if (b == v) h = 240 + 60 * (r - g) / delta;
|
||||
|
||||
if (h < 0) h += 360;
|
||||
}
|
||||
|
||||
return _hsv(Math.floor(h), Math.floor(s*100), Math.floor(v/255*100));
|
||||
}
|
||||
|
||||
function limit(min, val, max){
|
||||
return Math.min(Math.max(min, val), max);
|
||||
return this.jPicker(settings);
|
||||
}
|
||||
|
||||
$('input.color-indicator').xe_colorpicker();
|
||||
|
|
|
|||