Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js |
— | — | @@ -671,6 +671,7 @@ |
672 | 672 | 'height' : this.smil.embedPlayer.getHeight() |
673 | 673 | }; |
674 | 674 | } |
| 675 | + |
675 | 676 | // Fit the image per the provided targetWidth closure |
676 | 677 | /*mw.log( 'getDominateAspectTransform:: naspect:' + |
677 | 678 | ( natrualSize.width / natrualSize.height ) + |
Index: branches/MwEmbedStandAlone/modules/Sequencer/loader.js |
— | — | @@ -30,6 +30,9 @@ |
31 | 31 | "mw.SequencerActionsView" : "actions/mw.SequencerActionsView.js", |
32 | 32 | "mw.SequencerActionsEdit" : "actions/mw.SequencerActionsEdit.js", |
33 | 33 | |
| 34 | + "$j.fn.jPicker" : "tools/jPicker/jpicker-1.1.5.js", |
| 35 | + "mw.style.jPicker" : "tools/jPicker/css/jPicker-1.1.5.css", |
| 36 | + |
34 | 37 | "mw.SequencerRender" : "mw.SequencerRender.js", |
35 | 38 | |
36 | 39 | "mw.FirefoggRender" : "mw.FirefoggRender.js", |
— | — | @@ -73,6 +76,8 @@ |
74 | 77 | 'mw.SequencerTimeline', |
75 | 78 | 'mw.SequencerKeyBindings', |
76 | 79 | 'mw.SequencerTools', |
| 80 | + "$j.fn.jPicker", |
| 81 | + "mw.style.jPicker", |
77 | 82 | |
78 | 83 | 'mw.SequencerMenu', |
79 | 84 | 'mw.SequencerActionsSequence', |
Index: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php |
— | — | @@ -55,6 +55,28 @@ |
56 | 56 | 'mwe-sequencer-tools-transitions-transIn' => 'Transition in', |
57 | 57 | 'mwe-sequencer-tools-transitions-transOut' => 'Transition out', |
58 | 58 | 'mwe-sequencer-tools-transitions-color' => 'Color', |
| 59 | + 'mwe-sequencer-color-picker-currentColor' => 'Click To Revert To Original Color', |
| 60 | + 'mwe-sequencer-color-picker-commit' => 'Commit To This Color Selection', |
| 61 | + 'mwe-sequencer-color-picker-cancel-desc' => 'Cancel And Revert To Original Color', |
| 62 | + 'mwe-sequencer-color-picker-hue-desc' => 'Set To "Hue" Color Mode', |
| 63 | + 'mwe-sequencer-color-picker-hue-textbox' => 'Enter A "Hue" Value (0-360°)', |
| 64 | + 'mwe-sequencer-color-picker-saturation-desc' => 'Set To "Saturation" Color Mode', |
| 65 | + 'mwe-sequencer-color-picker-saturation-textbox' => 'Enter A "Saturation" Value (0-100%)', |
| 66 | + 'mwe-sequencer-color-picker-value-desc' => 'Set To "Value" Color Mode', |
| 67 | + 'mwe-sequencer-color-picker-value-textbox' => 'Enter A "Value" Value (0-100%)', |
| 68 | + 'mwe-sequencer-color-picker-red-desc'=> 'Set To "Red" Color Mode', |
| 69 | + 'mwe-sequencer-color-picker-red-textbox' => 'Enter A "Red" Value (0-255)', |
| 70 | + 'mwe-sequencer-color-picker-green-desc'=> 'Set To "Green" Color Mode', |
| 71 | + 'mwe-sequencer-color-picker-green-textbox' => 'Enter A “Green” Value (0-255)', |
| 72 | + 'mwe-sequencer-color-picker-blue-desc'=> 'Set To "Blue" Color Mode', |
| 73 | + 'mwe-sequencer-color-picker-red-textbox' => 'Enter A "Blue" Value (0-255)', |
| 74 | + 'mwe-sequencer-color-picker-alpha-textbox' => 'Set To “Alpha” Color Mode', |
| 75 | + 'mwe-sequencer-color-picker-alpha-textbox' => 'Enter A "Alpha" Value (0-100)', |
| 76 | + 'mwe-sequencer-color-picker-title' => 'Drag Markers To Pick A Color', |
| 77 | + 'mwe-sequencer-color-picker-current' => 'current', |
| 78 | + 'mwe-sequencer-color-picker-new-color' => 'New Color - Press "OK" To Commit', |
| 79 | + 'mwe-sequencer-color-picker-hex-desc' => 'Enter A "Hex" Color Value (#000000-#ffffff)', |
| 80 | + 'mwe-sequencer-color-picker-hex-textbox' => 'Enter A "Alpha" Value (#00-#ff)', |
59 | 81 | |
60 | 82 | 'mwe-sequencer-clip-cancel-edit' => 'Cancel clip edit', |
61 | 83 | 'mwe-sequencer-preview' => 'Preview', |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/jpicker-1.1.5.js |
— | — | @@ -0,0 +1,1985 @@ |
| 2 | +/* |
| 3 | + * jPicker 1.1.5 |
| 4 | + * |
| 5 | + * jQuery Plugin for Photoshop style color picker |
| 6 | + * |
| 7 | + * Copyright (c) 2010 Christopher T. Tillman |
| 8 | + * Digital Magic Productions, Inc. (http://www.digitalmagicpro.com/) |
| 9 | + * MIT style license, FREE to use, alter, copy, sell, and especially ENHANCE |
| 10 | + * |
| 11 | + * Painstakingly ported from John Dyers' excellent work on his own color picker based on the Prototype framework. |
| 12 | + * |
| 13 | + * John Dyers' website: (http://johndyer.name) |
| 14 | + * Color Picker page: (http://johndyer.name/post/2007/09/PhotoShop-like-JavaScript-Color-Picker.aspx) |
| 15 | + * |
| 16 | + */ |
| 17 | +(function($, version) |
| 18 | +{ |
| 19 | + Math.precision = function(value, precision) |
| 20 | + { |
| 21 | + if (precision === undefined) precision = 0; |
| 22 | + return Math.round(value * Math.pow(10, precision)) / Math.pow(10, precision); |
| 23 | + }; |
| 24 | + var Slider = // encapsulate slider functionality for the ColorMap and ColorBar - could be useful to use a jQuery UI draggable for this with certain extensions |
| 25 | + function(bar, options) |
| 26 | + { |
| 27 | + var $this = this, // private properties, methods, and events - keep these variables and classes invisible to outside code |
| 28 | + arrow = bar.find('img:first'), // the arrow image to drag |
| 29 | + minX = 0, |
| 30 | + maxX = 100, |
| 31 | + rangeX = 100, |
| 32 | + minY = 0, |
| 33 | + maxY = 100, |
| 34 | + rangeY = 100, |
| 35 | + x = 0, |
| 36 | + y = 0, |
| 37 | + offset, |
| 38 | + timeout, |
| 39 | + changeEvents = new Array(), |
| 40 | + fireChangeEvents = |
| 41 | + function(context) |
| 42 | + { |
| 43 | + for (var i = 0; i < changeEvents.length; i++) changeEvents[i].call($this, $this, context); |
| 44 | + }, |
| 45 | + mouseDown = // bind the mousedown to the bar not the arrow for quick snapping to the clicked location |
| 46 | + function(e) |
| 47 | + { |
| 48 | + var off = bar.offset(); |
| 49 | + offset = { l: off.left | 0, t: off.top | 0 }; |
| 50 | + clearTimeout(timeout); |
| 51 | + timeout = setTimeout( // using setTimeout for visual updates - once the style is updated the browser will re-render internally allowing the next Javascript to run |
| 52 | + function() |
| 53 | + { |
| 54 | + setValuesFromMousePosition.call($this, e); |
| 55 | + }, 0); |
| 56 | + // 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 |
| 57 | + $(document).bind('mousemove', mouseMove).bind('mouseup', mouseUp); |
| 58 | + e.preventDefault(); // don't try to select anything or drag the image to the desktop |
| 59 | + }, |
| 60 | + mouseMove = // set the values as the mouse moves |
| 61 | + function(e) |
| 62 | + { |
| 63 | + clearTimeout(timeout); |
| 64 | + timeout = setTimeout( |
| 65 | + function() |
| 66 | + { |
| 67 | + setValuesFromMousePosition.call($this, e); |
| 68 | + }, 0); |
| 69 | + e.stopPropagation(); |
| 70 | + e.preventDefault(); |
| 71 | + return false; |
| 72 | + }, |
| 73 | + mouseUp = // unbind the document events - they aren't needed when not dragging |
| 74 | + function(e) |
| 75 | + { |
| 76 | + $(document).unbind('mouseup', mouseUp).unbind('mousemove', mouseMove); |
| 77 | + e.stopPropagation(); |
| 78 | + e.preventDefault(); |
| 79 | + return false; |
| 80 | + }, |
| 81 | + setValuesFromMousePosition = // calculate mouse position and set value within the current range |
| 82 | + function(e) |
| 83 | + { |
| 84 | + var locX = e.pageX - offset.l, |
| 85 | + locY = e.pageY - offset.t, |
| 86 | + barW = bar.w, // local copies for YUI compressor |
| 87 | + barH = bar.h; |
| 88 | + // keep the arrow within the bounds of the bar |
| 89 | + if (locX < 0) locX = 0; |
| 90 | + else if (locX > barW) locX = barW; |
| 91 | + if (locY < 0) locY = 0; |
| 92 | + else if (locY > barH) locY = barH; |
| 93 | + val.call($this, 'xy', { x: ((locX / barW) * rangeX) + minX, y: ((locY / barH) * rangeY) + minY }); |
| 94 | + }, |
| 95 | + draw = |
| 96 | + function() |
| 97 | + { |
| 98 | + var arrowOffsetX = 0, |
| 99 | + arrowOffsetY = 0, |
| 100 | + barW = bar.w, |
| 101 | + barH = bar.h, |
| 102 | + arrowW = arrow.w, |
| 103 | + arrowH = arrow.h; |
| 104 | + setTimeout( |
| 105 | + function() |
| 106 | + { |
| 107 | + if (rangeX > 0) // range is greater than zero |
| 108 | + { |
| 109 | + // constrain to bounds |
| 110 | + if (x == maxX) arrowOffsetX = barW; |
| 111 | + else arrowOffsetX = ((x / rangeX) * barW) | 0; |
| 112 | + } |
| 113 | + if (rangeY > 0) // range is greater than zero |
| 114 | + { |
| 115 | + // constrain to bounds |
| 116 | + if (y == maxY) arrowOffsetY = barH; |
| 117 | + else arrowOffsetY = ((y / rangeY) * barH) | 0; |
| 118 | + } |
| 119 | + // if arrow width is greater than bar width, center arrow and prevent horizontal dragging |
| 120 | + if (arrowW >= barW) arrowOffsetX = (barW >> 1) - (arrowW >> 1); // number >> 1 - superfast bitwise divide by two and truncate (move bits over one bit discarding lowest) |
| 121 | + else arrowOffsetX -= arrowW >> 1; |
| 122 | + // if arrow height is greater than bar height, center arrow and prevent vertical dragging |
| 123 | + if (arrowH >= barH) arrowOffsetY = (barH >> 1) - (arrowH >> 1); |
| 124 | + else arrowOffsetY -= arrowH >> 1; |
| 125 | + // set the arrow position based on these offsets |
| 126 | + arrow.css({ left: arrowOffsetX + 'px', top: arrowOffsetY + 'px' }); |
| 127 | + }, 0); |
| 128 | + }, |
| 129 | + val = |
| 130 | + function(name, value, context) |
| 131 | + { |
| 132 | + var set = value !== undefined; |
| 133 | + if (!set) |
| 134 | + { |
| 135 | + if (name === undefined || name == null) name = 'xy'; |
| 136 | + switch (name.toLowerCase()) |
| 137 | + { |
| 138 | + case 'x': return x; |
| 139 | + case 'y': return y; |
| 140 | + case 'xy': |
| 141 | + default: return { x: x, y: y }; |
| 142 | + } |
| 143 | + } |
| 144 | + if (context != null && context == $this) return; |
| 145 | + var changed = false, |
| 146 | + newX, |
| 147 | + newY; |
| 148 | + if (name == null) name = 'xy'; |
| 149 | + switch (name.toLowerCase()) |
| 150 | + { |
| 151 | + case 'x': |
| 152 | + newX = value && (value.x && value.x | 0 || value | 0) || 0; |
| 153 | + break; |
| 154 | + case 'y': |
| 155 | + newY = value && (value.y && value.y | 0 || value | 0) || 0; |
| 156 | + break; |
| 157 | + case 'xy': |
| 158 | + default: |
| 159 | + newX = value && value.x && value.x | 0 || 0; |
| 160 | + newY = value && value.y && value.y | 0 || 0; |
| 161 | + break; |
| 162 | + } |
| 163 | + if (newX != null) |
| 164 | + { |
| 165 | + if (newX < minX) newX = minX; |
| 166 | + else if (newX > maxX) newX = maxX; |
| 167 | + if (x != newX) |
| 168 | + { |
| 169 | + x = newX; |
| 170 | + changed = true; |
| 171 | + } |
| 172 | + } |
| 173 | + if (newY != null) |
| 174 | + { |
| 175 | + if (newY < minY) newY = minY; |
| 176 | + else if (newY > maxY) newY = maxY; |
| 177 | + if (y != newY) |
| 178 | + { |
| 179 | + y = newY; |
| 180 | + changed = true; |
| 181 | + } |
| 182 | + } |
| 183 | + changed && fireChangeEvents.call($this, context || $this); |
| 184 | + }, |
| 185 | + range = |
| 186 | + function (name, value) |
| 187 | + { |
| 188 | + var set = value !== undefined; |
| 189 | + if (!set) |
| 190 | + { |
| 191 | + if (name === undefined || name == null) name = 'all'; |
| 192 | + switch (name.toLowerCase()) |
| 193 | + { |
| 194 | + case 'minx': return minX; |
| 195 | + case 'maxx': return maxX; |
| 196 | + case 'rangex': return { minX: minX, maxX: maxX, rangeX: rangeX }; |
| 197 | + case 'miny': return minY; |
| 198 | + case 'maxy': return maxY; |
| 199 | + case 'rangey': return { minY: minY, maxY: maxY, rangeY: rangeY }; |
| 200 | + case 'all': |
| 201 | + default: return { minX: minX, maxX: maxX, rangeX: rangeX, minY: minY, maxY: maxY, rangeY: rangeY }; |
| 202 | + } |
| 203 | + } |
| 204 | + var changed = false, |
| 205 | + newMinX, |
| 206 | + newMaxX, |
| 207 | + newMinY, |
| 208 | + newMaxY; |
| 209 | + if (name == null) name = 'all'; |
| 210 | + switch (name.toLowerCase()) |
| 211 | + { |
| 212 | + case 'minx': |
| 213 | + newMinX = value && (value.minX && value.minX | 0 || value | 0) || 0; |
| 214 | + break; |
| 215 | + case 'maxx': |
| 216 | + newMaxX = value && (value.maxX && value.maxX | 0 || value | 0) || 0; |
| 217 | + break; |
| 218 | + case 'rangex': |
| 219 | + newMinX = value && value.minX && value.minX | 0 || 0; |
| 220 | + newMaxX = value && value.maxX && value.maxX | 0 || 0; |
| 221 | + break; |
| 222 | + case 'miny': |
| 223 | + newMinY = value && (value.minY && value.minY | 0 || value | 0) || 0; |
| 224 | + break; |
| 225 | + case 'maxy': |
| 226 | + newMaxY = value && (value.maxY && value.maxY | 0 || value | 0) || 0; |
| 227 | + break; |
| 228 | + case 'rangey': |
| 229 | + newMinY = value && value.minY && value.minY | 0 || 0; |
| 230 | + newMaxY = value && value.maxY && value.maxY | 0 || 0; |
| 231 | + break; |
| 232 | + case 'all': |
| 233 | + default: |
| 234 | + newMinX = value && value.minX && value.minX | 0 || 0; |
| 235 | + newMaxX = value && value.maxX && value.maxX | 0 || 0; |
| 236 | + newMinY = value && value.minY && value.minY | 0 || 0; |
| 237 | + newMaxY = value && value.maxY && value.maxY | 0 || 0; |
| 238 | + break; |
| 239 | + } |
| 240 | + if (newMinX != null && minX != newMinX) |
| 241 | + { |
| 242 | + minX = newMinX; |
| 243 | + rangeX = maxX - minX; |
| 244 | + } |
| 245 | + if (newMaxX != null && maxX != newMaxX) |
| 246 | + { |
| 247 | + maxX = newMaxX; |
| 248 | + rangeX = maxX - minX; |
| 249 | + } |
| 250 | + if (newMinY != null && minY != newMinY) |
| 251 | + { |
| 252 | + minY = newMinY; |
| 253 | + rangeY = maxY - minY; |
| 254 | + } |
| 255 | + if (newMaxY != null && maxY != newMaxY) |
| 256 | + { |
| 257 | + maxY = newMaxY; |
| 258 | + rangeY = maxY - minY; |
| 259 | + } |
| 260 | + }, |
| 261 | + bind = |
| 262 | + function (callback) |
| 263 | + { |
| 264 | + if ($.isFunction(callback)) changeEvents.push(callback); |
| 265 | + }, |
| 266 | + unbind = |
| 267 | + function (callback) |
| 268 | + { |
| 269 | + if (!$.isFunction(callback)) return; |
| 270 | + var i; |
| 271 | + while ((i = $.inArray(callback, changeEvents)) != -1) changeEvents.splice(i, 1); |
| 272 | + }, |
| 273 | + destroy = |
| 274 | + function() |
| 275 | + { |
| 276 | + // unbind all possible events and null objects |
| 277 | + $(document).unbind('mouseup', mouseUp).unbind('mousemove', mouseMove); |
| 278 | + bar.unbind('mousedown', mouseDown); |
| 279 | + bar = null; |
| 280 | + arrow = null; |
| 281 | + changeEvents = null; |
| 282 | + }; |
| 283 | + $.extend(true, $this, // public properties, methods, and event bindings - these we need to access from other controls |
| 284 | + { |
| 285 | + val: val, |
| 286 | + range: range, |
| 287 | + bind: bind, |
| 288 | + unbind: unbind, |
| 289 | + destroy: destroy |
| 290 | + }); |
| 291 | + // initialize this control |
| 292 | + arrow.src = options.arrow && options.arrow.image; |
| 293 | + arrow.w = options.arrow && options.arrow.width || arrow.width(); |
| 294 | + arrow.h = options.arrow && options.arrow.height || arrow.height(); |
| 295 | + bar.w = options.map && options.map.width || bar.width(); |
| 296 | + bar.h = options.map && options.map.height || bar.height(); |
| 297 | + // bind mousedown event |
| 298 | + bar.bind('mousedown', mouseDown); |
| 299 | + bind.call($this, draw); |
| 300 | + }, |
| 301 | + ColorValuePicker = // controls for all the input elements for the typing in color values |
| 302 | + function(picker, color, bindedHex, alphaPrecision) |
| 303 | + { |
| 304 | + var $this = this, // private properties and methods |
| 305 | + inputs = picker.find('td.Text input'), |
| 306 | + red = inputs.eq(3), |
| 307 | + green = inputs.eq(4), |
| 308 | + blue = inputs.eq(5), |
| 309 | + alpha = inputs.length > 7 ? inputs.eq(6) : null, |
| 310 | + hue = inputs.eq(0), |
| 311 | + saturation = inputs.eq(1), |
| 312 | + value = inputs.eq(2), |
| 313 | + hex = inputs.eq(inputs.length > 7 ? 7 : 6), |
| 314 | + ahex = inputs.length > 7 ? inputs.eq(8) : null, |
| 315 | + keyUp = // hue, saturation, or value input box key up - validate value and set color |
| 316 | + function(e) |
| 317 | + { |
| 318 | + if (e.target.value == '' && e.target != hex.get(0) && (bindedHex != null && e.target != bindedHex.get(0) || bindedHex == null)) return; |
| 319 | + if (!validateKey(e)) return e; |
| 320 | + switch (e.target) |
| 321 | + { |
| 322 | + case red.get(0): |
| 323 | + red.val(setValueInRange.call($this, red.val(), 0, 255)); |
| 324 | + color.val('r', red.val(), e.target); |
| 325 | + break; |
| 326 | + case green.get(0): |
| 327 | + green.val(setValueInRange.call($this, green.val(), 0, 255)); |
| 328 | + color.val('g', green.val(), e.target); |
| 329 | + break; |
| 330 | + case blue.get(0): |
| 331 | + blue.val(setValueInRange.call($this, blue.val(), 0, 255)); |
| 332 | + color.val('b', blue.val(), e.target); |
| 333 | + break; |
| 334 | + case alpha && alpha.get(0): |
| 335 | + alpha.val(setValueInRange.call($this, alpha.val(), 0, 100)); |
| 336 | + color.val('a', Math.precision((alpha.val() * 255) / 100, alphaPrecision), e.target); |
| 337 | + break; |
| 338 | + case hue.get(0): |
| 339 | + hue.val(setValueInRange.call($this, hue.val(), 0, 360)); |
| 340 | + color.val('h', hue.val(), e.target); |
| 341 | + break; |
| 342 | + case saturation.get(0): |
| 343 | + saturation.val(setValueInRange.call($this, saturation.val(), 0, 100)); |
| 344 | + color.val('s', saturation.val(), e.target); |
| 345 | + break; |
| 346 | + case value.get(0): |
| 347 | + value.val(setValueInRange.call($this, value.val(), 0, 100)); |
| 348 | + color.val('v', value.val(), e.target); |
| 349 | + break; |
| 350 | + case hex.get(0): |
| 351 | + hex.val(hex.val().replace(/[^a-fA-F0-9]/g, '').toLowerCase().substring(0, 6)); |
| 352 | + bindedHex && bindedHex.val(hex.val()); |
| 353 | + color.val('hex', hex.val() != '' ? hex.val() : null, e.target); |
| 354 | + break; |
| 355 | + case bindedHex && bindedHex.get(0): |
| 356 | + bindedHex.val(bindedHex.val().replace(/[^a-fA-F0-9]/g, '').toLowerCase().substring(0, 6)); |
| 357 | + hex.val(bindedHex.val()); |
| 358 | + color.val('hex', bindedHex.val() != '' ? bindedHex.val() : null, e.target); |
| 359 | + break; |
| 360 | + case ahex && ahex.get(0): |
| 361 | + ahex.val(ahex.val().replace(/[^a-fA-F0-9]/g, '').toLowerCase().substring(0, 2)); |
| 362 | + color.val('a', ahex.val() != null ? parseInt(ahex.val(), 16) : null, e.target); |
| 363 | + break; |
| 364 | + } |
| 365 | + }, |
| 366 | + blur = // hue, saturation, or value input box blur - reset to original if value empty |
| 367 | + function(e) |
| 368 | + { |
| 369 | + if (color.val() != null) |
| 370 | + { |
| 371 | + switch (e.target) |
| 372 | + { |
| 373 | + case red.get(0): red.val(color.val('r')); break; |
| 374 | + case green.get(0): green.val(color.val('g')); break; |
| 375 | + case blue.get(0): blue.val(color.val('b')); break; |
| 376 | + case alpha && alpha.get(0): alpha.val(Math.precision((color.val('a') * 100) / 255, alphaPrecision)); break; |
| 377 | + case hue.get(0): hue.val(color.val('h')); break; |
| 378 | + case saturation.get(0): saturation.val(color.val('s')); break; |
| 379 | + case value.get(0): value.val(color.val('v')); break; |
| 380 | + case hex.get(0): |
| 381 | + case bindedHex && bindedHex.get(0): |
| 382 | + hex.val(color.val('hex')); |
| 383 | + bindedHex && bindedHex.val(color.val('hex')); |
| 384 | + break; |
| 385 | + case ahex && ahex.get(0): ahex.val(color.val('ahex').substring(6)); break; |
| 386 | + } |
| 387 | + } |
| 388 | + }, |
| 389 | + validateKey = // validate key |
| 390 | + function(e) |
| 391 | + { |
| 392 | + switch(e.keyCode) |
| 393 | + { |
| 394 | + case 9: |
| 395 | + case 16: |
| 396 | + case 29: |
| 397 | + case 37: |
| 398 | + case 38: |
| 399 | + case 40: |
| 400 | + return false; |
| 401 | + case 'c'.charCodeAt(): |
| 402 | + case 'v'.charCodeAt(): |
| 403 | + if (e.ctrlKey) return false; |
| 404 | + } |
| 405 | + return true; |
| 406 | + }, |
| 407 | + setValueInRange = // constrain value within range |
| 408 | + function(value, min, max) |
| 409 | + { |
| 410 | + if (value == '' || isNaN(value)) return min; |
| 411 | + if (value > max) return max; |
| 412 | + if (value < min) return min; |
| 413 | + return value; |
| 414 | + }, |
| 415 | + colorChanged = |
| 416 | + function(ui, context) |
| 417 | + { |
| 418 | + var all = ui.val('all'); |
| 419 | + if (context != red.get(0)) red.val(all != null ? all.r : ''); |
| 420 | + if (context != green.get(0)) green.val(all != null ? all.g : ''); |
| 421 | + if (context != blue.get(0)) blue.val(all != null ? all.b : ''); |
| 422 | + if (alpha && context != alpha.get(0)) alpha.val(all != null ? Math.precision((all.a * 100) / 255, alphaPrecision) : ''); |
| 423 | + if (context != hue.get(0)) hue.val(all != null ? all.h : ''); |
| 424 | + if (context != saturation.get(0)) saturation.val(all != null ? all.s : ''); |
| 425 | + if (context != value.get(0)) value.val(all != null ? all.v : ''); |
| 426 | + if (context != hex.get(0) && (bindedHex && context != bindedHex.get(0) || !bindedHex)) hex.val(all != null ? all.hex : ''); |
| 427 | + if (bindedHex && context != bindedHex.get(0) && context != hex.get(0)) bindedHex.val(all != null ? all.hex : ''); |
| 428 | + if (ahex && context != ahex.get(0)) ahex.val(all != null ? all.ahex.substring(6) : ''); |
| 429 | + }, |
| 430 | + destroy = |
| 431 | + function() |
| 432 | + { |
| 433 | + // unbind all events and null objects |
| 434 | + red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).add(hex).add(bindedHex).add(ahex).unbind('keyup', keyUp).unbind('blur', blur); |
| 435 | + color.unbind(colorChanged); |
| 436 | + red = null; |
| 437 | + green = null; |
| 438 | + blue = null; |
| 439 | + alpha = null; |
| 440 | + hue = null; |
| 441 | + saturation = null; |
| 442 | + value = null; |
| 443 | + hex = null; |
| 444 | + ahex = null; |
| 445 | + }; |
| 446 | + $.extend(true, $this, // public properties and methods |
| 447 | + { |
| 448 | + destroy: destroy |
| 449 | + }); |
| 450 | + red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).add(hex).add(bindedHex).add(ahex).bind('keyup', keyUp).bind('blur', blur); |
| 451 | + color.bind(colorChanged); |
| 452 | + }; |
| 453 | + $.jPicker = |
| 454 | + { |
| 455 | + List: [], // array holding references to each active instance of the control |
| 456 | + Color: // color object - we will be able to assign by any color space type or retrieve any color space info |
| 457 | + // 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) |
| 458 | + function(init) |
| 459 | + { |
| 460 | + var $this = this, |
| 461 | + r, |
| 462 | + g, |
| 463 | + b, |
| 464 | + a, |
| 465 | + h, |
| 466 | + s, |
| 467 | + v, |
| 468 | + changeEvents = new Array(), |
| 469 | + fireChangeEvents = |
| 470 | + function(context) |
| 471 | + { |
| 472 | + for (var i = 0; i < changeEvents.length; i++) changeEvents[i].call($this, $this, context); |
| 473 | + }, |
| 474 | + val = |
| 475 | + function(name, value, context) |
| 476 | + { |
| 477 | + var set = value !== undefined; |
| 478 | + if (!set) |
| 479 | + { |
| 480 | + if (name === undefined || name == null || name == '') name = 'all'; |
| 481 | + if (r == null) return null; |
| 482 | + switch (name.toLowerCase()) |
| 483 | + { |
| 484 | + case 'ahex': return ColorMethods.rgbaToHex({ r: r, g: g, b: b, a: a }); |
| 485 | + case 'hex': return val('ahex').substring(0, 6); |
| 486 | + case 'all': return { r: r, g: g, b: b, a: a, h: h, s: s, v: v, hex: val.call($this, 'hex'), ahex: val.call($this, 'ahex') }; |
| 487 | + default: |
| 488 | + var ret={}; |
| 489 | + for (var i = 0; i < name.length; i++) |
| 490 | + { |
| 491 | + switch (name.charAt(i)) |
| 492 | + { |
| 493 | + case 'r': |
| 494 | + if (name.length == 1) ret = r; |
| 495 | + else ret.r = r; |
| 496 | + break; |
| 497 | + case 'g': |
| 498 | + if (name.length == 1) ret = g; |
| 499 | + else ret.g = g; |
| 500 | + break; |
| 501 | + case 'b': |
| 502 | + if (name.length == 1) ret = b; |
| 503 | + else ret.b = b; |
| 504 | + break; |
| 505 | + case 'a': |
| 506 | + if (name.length == 1) ret = a; |
| 507 | + else ret.a = a; |
| 508 | + break; |
| 509 | + case 'h': |
| 510 | + if (name.length == 1) ret = h; |
| 511 | + else ret.h = h; |
| 512 | + break; |
| 513 | + case 's': |
| 514 | + if (name.length == 1) ret = s; |
| 515 | + else ret.s = s; |
| 516 | + break; |
| 517 | + case 'v': |
| 518 | + if (name.length == 1) ret = v; |
| 519 | + else ret.v = v; |
| 520 | + break; |
| 521 | + } |
| 522 | + } |
| 523 | + return ret == {} ? val.call($this, 'all') : ret; |
| 524 | + break; |
| 525 | + } |
| 526 | + } |
| 527 | + if (context != null && context == $this) return; |
| 528 | + var changed = false; |
| 529 | + if (name == null) name = ''; |
| 530 | + if (value == null) |
| 531 | + { |
| 532 | + if (r != null) |
| 533 | + { |
| 534 | + r = null; |
| 535 | + changed = true; |
| 536 | + } |
| 537 | + if (g != null) |
| 538 | + { |
| 539 | + g = null; |
| 540 | + changed = true; |
| 541 | + } |
| 542 | + if (b != null) |
| 543 | + { |
| 544 | + b = null; |
| 545 | + changed = true; |
| 546 | + } |
| 547 | + if (a != null) |
| 548 | + { |
| 549 | + a = null; |
| 550 | + changed = true; |
| 551 | + } |
| 552 | + if (h != null) |
| 553 | + { |
| 554 | + h = null; |
| 555 | + changed = true; |
| 556 | + } |
| 557 | + if (s != null) |
| 558 | + { |
| 559 | + s = null; |
| 560 | + changed = true; |
| 561 | + } |
| 562 | + if (v != null) |
| 563 | + { |
| 564 | + v = null; |
| 565 | + changed = true; |
| 566 | + } |
| 567 | + changed && fireChangeEvents.call($this, context || $this); |
| 568 | + return; |
| 569 | + } |
| 570 | + switch (name.toLowerCase()) |
| 571 | + { |
| 572 | + case 'ahex': |
| 573 | + case 'hex': |
| 574 | + var ret = ColorMethods.hexToRgba(value && (value.ahex || value.hex) || value || '00000000'); |
| 575 | + val.call($this, 'rgba', { r: ret.r, g: ret.g, b: ret.b, a: name == 'ahex' ? ret.a : a != null ? a : 255 }, context); |
| 576 | + break; |
| 577 | + default: |
| 578 | + if (value && (value.ahex != null || value.hex != null)) |
| 579 | + { |
| 580 | + val.call($this, 'ahex', value.ahex || value.hex || '00000000', context); |
| 581 | + return; |
| 582 | + } |
| 583 | + var newV = {}, rgb = false, hsv = false; |
| 584 | + if (value.r !== undefined && !name.indexOf('r') == -1) name += 'r'; |
| 585 | + if (value.g !== undefined && !name.indexOf('g') == -1) name += 'g'; |
| 586 | + if (value.b !== undefined && !name.indexOf('b') == -1) name += 'b'; |
| 587 | + if (value.a !== undefined && !name.indexOf('a') == -1) name += 'a'; |
| 588 | + if (value.h !== undefined && !name.indexOf('h') == -1) name += 'h'; |
| 589 | + if (value.s !== undefined && !name.indexOf('s') == -1) name += 's'; |
| 590 | + if (value.v !== undefined && !name.indexOf('v') == -1) name += 'v'; |
| 591 | + for (var i = 0; i < name.length; i++) |
| 592 | + { |
| 593 | + switch (name.charAt(i)) |
| 594 | + { |
| 595 | + case 'r': |
| 596 | + if (hsv) continue; |
| 597 | + rgb = true; |
| 598 | + newV.r = value && value.r && value.r | 0 || value && value | 0 || 0; |
| 599 | + if (newV.r < 0) newV.r = 0; |
| 600 | + else if (newV.r > 255) newV.r = 255; |
| 601 | + if (r != newV.r) |
| 602 | + { |
| 603 | + r = newV.r; |
| 604 | + changed = true; |
| 605 | + } |
| 606 | + break; |
| 607 | + case 'g': |
| 608 | + if (hsv) continue; |
| 609 | + rgb = true; |
| 610 | + newV.g = value && value.g && value.g | 0 || value && value | 0 || 0; |
| 611 | + if (newV.g < 0) newV.g = 0; |
| 612 | + else if (newV.g > 255) newV.g = 255; |
| 613 | + if (g != newV.g) |
| 614 | + { |
| 615 | + g = newV.g; |
| 616 | + changed = true; |
| 617 | + } |
| 618 | + break; |
| 619 | + case 'b': |
| 620 | + if (hsv) continue; |
| 621 | + rgb = true; |
| 622 | + newV.b = value && value.b && value.b | 0 || value && value | 0 || 0; |
| 623 | + if (newV.b < 0) newV.b = 0; |
| 624 | + else if (newV.b > 255) newV.b = 255; |
| 625 | + if (b != newV.b) |
| 626 | + { |
| 627 | + b = newV.b; |
| 628 | + changed = true; |
| 629 | + } |
| 630 | + break; |
| 631 | + case 'a': |
| 632 | + newV.a = value && value.a != null ? value.a | 0 : value != null ? value | 0 : 255; |
| 633 | + if (newV.a < 0) newV.a = 0; |
| 634 | + else if (newV.a > 255) newV.a = 255; |
| 635 | + if (a != newV.a) |
| 636 | + { |
| 637 | + a = newV.a; |
| 638 | + changed = true; |
| 639 | + } |
| 640 | + break; |
| 641 | + case 'h': |
| 642 | + if (rgb) continue; |
| 643 | + hsv = true; |
| 644 | + newV.h = value && value.h && value.h | 0 || value && value | 0 || 0; |
| 645 | + if (newV.h < 0) newV.h = 0; |
| 646 | + else if (newV.h > 360) newV.h = 360; |
| 647 | + if (h != newV.h) |
| 648 | + { |
| 649 | + h = newV.h; |
| 650 | + changed = true; |
| 651 | + } |
| 652 | + break; |
| 653 | + case 's': |
| 654 | + if (rgb) continue; |
| 655 | + hsv = true; |
| 656 | + newV.s = value && value.s != null ? value.s | 0 : value != null ? value | 0 : 100; |
| 657 | + if (newV.s < 0) newV.s = 0; |
| 658 | + else if (newV.s > 100) newV.s = 100; |
| 659 | + if (s != newV.s) |
| 660 | + { |
| 661 | + s = newV.s; |
| 662 | + changed = true; |
| 663 | + } |
| 664 | + break; |
| 665 | + case 'v': |
| 666 | + if (rgb) continue; |
| 667 | + hsv = true; |
| 668 | + newV.v = value && value.v != null ? value.v | 0 : value != null ? value | 0 : 100; |
| 669 | + if (newV.v < 0) newV.v = 0; |
| 670 | + else if (newV.v > 100) newV.v = 100; |
| 671 | + if (v != newV.v) |
| 672 | + { |
| 673 | + v = newV.v; |
| 674 | + changed = true; |
| 675 | + } |
| 676 | + break; |
| 677 | + } |
| 678 | + } |
| 679 | + if (changed) |
| 680 | + { |
| 681 | + if (rgb) |
| 682 | + { |
| 683 | + r = r || 0; |
| 684 | + g = g || 0; |
| 685 | + b = b || 0; |
| 686 | + var ret = ColorMethods.rgbToHsv({ r: r, g: g, b: b }); |
| 687 | + h = ret.h; |
| 688 | + s = ret.s; |
| 689 | + v = ret.v; |
| 690 | + } |
| 691 | + else if (hsv) |
| 692 | + { |
| 693 | + h = h || 0; |
| 694 | + s = s != null ? s : 100; |
| 695 | + v = v != null ? v : 100; |
| 696 | + var ret = ColorMethods.hsvToRgb({ h: h, s: s, v: v }); |
| 697 | + r = ret.r; |
| 698 | + g = ret.g; |
| 699 | + b = ret.b; |
| 700 | + } |
| 701 | + a = a != null ? a : 255; |
| 702 | + fireChangeEvents.call($this, context || $this); |
| 703 | + } |
| 704 | + break; |
| 705 | + } |
| 706 | + }, |
| 707 | + bind = |
| 708 | + function(callback) |
| 709 | + { |
| 710 | + if ($.isFunction(callback)) changeEvents.push(callback); |
| 711 | + }, |
| 712 | + unbind = |
| 713 | + function(callback) |
| 714 | + { |
| 715 | + if (!$.isFunction(callback)) return; |
| 716 | + var i; |
| 717 | + while ((i = $.inArray(callback, changeEvents)) != -1) changeEvents.splice(i, 1); |
| 718 | + }, |
| 719 | + destroy = |
| 720 | + function() |
| 721 | + { |
| 722 | + changeEvents = null; |
| 723 | + } |
| 724 | + $.extend(true, $this, // public properties and methods |
| 725 | + { |
| 726 | + val: val, |
| 727 | + bind: bind, |
| 728 | + unbind: unbind, |
| 729 | + destroy: destroy |
| 730 | + }); |
| 731 | + if (init) |
| 732 | + { |
| 733 | + if (init.ahex != null) val('ahex', init); |
| 734 | + else if (init.hex != null) val((init.a != null ? 'a' : '') + 'hex', init.a != null ? { ahex: init.hex + ColorMethods.intToHex(init.a) } : init); |
| 735 | + else if (init.r != null && init.g != null && init.b != null) val('rgb' + (init.a != null ? 'a' : ''), init); |
| 736 | + else if (init.h != null && init.s != null && init.v != null) val('hsv' + (init.a != null ? 'a' : ''), init); |
| 737 | + } |
| 738 | + }, |
| 739 | + ColorMethods: // color conversion methods - make public to give use to external scripts |
| 740 | + { |
| 741 | + hexToRgba: |
| 742 | + function(hex) |
| 743 | + { |
| 744 | + hex = this.validateHex(hex); |
| 745 | + if (hex == '') return { r: null, g: null, b: null, a: null }; |
| 746 | + var r = '00', g = '00', b = '00', a = '255'; |
| 747 | + if (hex.length == 6) hex += 'ff'; |
| 748 | + if (hex.length > 6) |
| 749 | + { |
| 750 | + r = hex.substring(0, 2); |
| 751 | + g = hex.substring(2, 4); |
| 752 | + b = hex.substring(4, 6); |
| 753 | + a = hex.substring(6, hex.length); |
| 754 | + } |
| 755 | + else |
| 756 | + { |
| 757 | + if (hex.length > 4) |
| 758 | + { |
| 759 | + r = hex.substring(4, hex.length); |
| 760 | + hex = hex.substring(0, 4); |
| 761 | + } |
| 762 | + if (hex.length > 2) |
| 763 | + { |
| 764 | + g = hex.substring(2, hex.length); |
| 765 | + hex = hex.substring(0, 2); |
| 766 | + } |
| 767 | + if (hex.length > 0) b = hex.substring(0, hex.length); |
| 768 | + } |
| 769 | + return { r: this.hexToInt(r), g: this.hexToInt(g), b: this.hexToInt(b), a: this.hexToInt(a) }; |
| 770 | + }, |
| 771 | + validateHex: |
| 772 | + function(hex) |
| 773 | + { |
| 774 | + hex = hex.toLowerCase().replace(/[^a-f0-9]/g, ''); |
| 775 | + if (hex.length > 8) hex = hex.substring(0, 8); |
| 776 | + return hex; |
| 777 | + }, |
| 778 | + rgbaToHex: |
| 779 | + function(rgba) |
| 780 | + { |
| 781 | + return this.intToHex(rgba.r) + this.intToHex(rgba.g) + this.intToHex(rgba.b) + this.intToHex(rgba.a); |
| 782 | + }, |
| 783 | + intToHex: |
| 784 | + function(dec) |
| 785 | + { |
| 786 | + var result = (dec | 0).toString(16); |
| 787 | + if (result.length == 1) result = ('0' + result); |
| 788 | + return result.toLowerCase(); |
| 789 | + }, |
| 790 | + hexToInt: |
| 791 | + function(hex) |
| 792 | + { |
| 793 | + return parseInt(hex, 16); |
| 794 | + }, |
| 795 | + rgbToHsv: |
| 796 | + function(rgb) |
| 797 | + { |
| 798 | + 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; |
| 799 | + if (r >= g && r >= b) |
| 800 | + { |
| 801 | + max = r; |
| 802 | + min = g > b ? b : g; |
| 803 | + } |
| 804 | + else if (g >= b && g >= r) |
| 805 | + { |
| 806 | + max = g; |
| 807 | + min = r > b ? b : r; |
| 808 | + } |
| 809 | + else |
| 810 | + { |
| 811 | + max = b; |
| 812 | + min = g > r ? r : g; |
| 813 | + } |
| 814 | + hsv.v = max; |
| 815 | + hsv.s = max ? (max - min) / max : 0; |
| 816 | + if (!hsv.s) hsv.h = 0; |
| 817 | + else |
| 818 | + { |
| 819 | + delta = max - min; |
| 820 | + if (r == max) hsv.h = (g - b) / delta; |
| 821 | + else if (g == max) hsv.h = 2 + (b - r) / delta; |
| 822 | + else hsv.h = 4 + (r - g) / delta; |
| 823 | + hsv.h = parseInt(hsv.h * 60); |
| 824 | + if (hsv.h < 0) hsv.h += 360; |
| 825 | + } |
| 826 | + hsv.s = (hsv.s * 100) | 0; |
| 827 | + hsv.v = (hsv.v * 100) | 0; |
| 828 | + return hsv; |
| 829 | + }, |
| 830 | + hsvToRgb: |
| 831 | + function(hsv) |
| 832 | + { |
| 833 | + var rgb = { r: 0, g: 0, b: 0, a: 100 }, h = hsv.h, s = hsv.s, v = hsv.v; |
| 834 | + if (s == 0) |
| 835 | + { |
| 836 | + if (v == 0) rgb.r = rgb.g = rgb.b = 0; |
| 837 | + else rgb.r = rgb.g = rgb.b = (v * 255 / 100) | 0; |
| 838 | + } |
| 839 | + else |
| 840 | + { |
| 841 | + if (h == 360) h = 0; |
| 842 | + h /= 60; |
| 843 | + s = s / 100; |
| 844 | + v = v / 100; |
| 845 | + var i = h | 0, |
| 846 | + f = h - i, |
| 847 | + p = v * (1 - s), |
| 848 | + q = v * (1 - (s * f)), |
| 849 | + t = v * (1 - (s * (1 - f))); |
| 850 | + switch (i) |
| 851 | + { |
| 852 | + case 0: |
| 853 | + rgb.r = v; |
| 854 | + rgb.g = t; |
| 855 | + rgb.b = p; |
| 856 | + break; |
| 857 | + case 1: |
| 858 | + rgb.r = q; |
| 859 | + rgb.g = v; |
| 860 | + rgb.b = p; |
| 861 | + break; |
| 862 | + case 2: |
| 863 | + rgb.r = p; |
| 864 | + rgb.g = v; |
| 865 | + rgb.b = t; |
| 866 | + break; |
| 867 | + case 3: |
| 868 | + rgb.r = p; |
| 869 | + rgb.g = q; |
| 870 | + rgb.b = v; |
| 871 | + break; |
| 872 | + case 4: |
| 873 | + rgb.r = t; |
| 874 | + rgb.g = p; |
| 875 | + rgb.b = v; |
| 876 | + break; |
| 877 | + case 5: |
| 878 | + rgb.r = v; |
| 879 | + rgb.g = p; |
| 880 | + rgb.b = q; |
| 881 | + break; |
| 882 | + } |
| 883 | + rgb.r = (rgb.r * 255) | 0; |
| 884 | + rgb.g = (rgb.g * 255) | 0; |
| 885 | + rgb.b = (rgb.b * 255) | 0; |
| 886 | + } |
| 887 | + return rgb; |
| 888 | + } |
| 889 | + } |
| 890 | + }; |
| 891 | + var Color = $.jPicker.Color, List = $.jPicker.List, ColorMethods = $.jPicker.ColorMethods; // local copies for YUI compressor |
| 892 | + $.fn.jPicker = |
| 893 | + function(options) |
| 894 | + { |
| 895 | + var $arguments = arguments; |
| 896 | + return this.each( |
| 897 | + function() |
| 898 | + { |
| 899 | + var $this = this, settings = $.extend(true, {}, $.fn.jPicker.defaults, options); // local copies for YUI compressor |
| 900 | + if ($($this).get(0).nodeName.toLowerCase() == 'input') // Add color picker icon if binding to an input element and bind the events to the input |
| 901 | + { |
| 902 | + $.extend(true, settings, |
| 903 | + { |
| 904 | + window: |
| 905 | + { |
| 906 | + bindToInput: true, |
| 907 | + expandable: true, |
| 908 | + input: $($this) |
| 909 | + } |
| 910 | + });
|
| 911 | + if($($this).val()=='')
|
| 912 | + {
|
| 913 | + settings.color.active = new Color({ hex: null });
|
| 914 | + settings.color.current = new Color({ hex: null });
|
| 915 | + }
|
| 916 | + else if (ColorMethods.validateHex($($this).val()))
|
| 917 | + {
|
| 918 | + settings.color.active = new Color({ hex: $($this).val(), a: settings.color.active.val('a') });
|
| 919 | + settings.color.current = new Color({ hex: $($this).val(), a: settings.color.active.val('a') });
|
| 920 | + } |
| 921 | + } |
| 922 | + if (settings.window.expandable) |
| 923 | + $($this).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>'); |
| 924 | + else settings.window.liveUpdate = false; // Basic control binding for inline use - You will need to override the liveCallback or commitCallback function to retrieve results |
| 925 | + var isLessThanIE7 = parseFloat(navigator.appVersion.split('MSIE')[1]) < 7 && document.body.filters, // needed to run the AlphaImageLoader function for IE6 |
| 926 | + container = null, |
| 927 | + colorMapDiv = null, |
| 928 | + colorBarDiv = null, |
| 929 | + colorMapL1 = null, // different layers of colorMap and colorBar |
| 930 | + colorMapL2 = null, |
| 931 | + colorMapL3 = null, |
| 932 | + colorBarL1 = null, |
| 933 | + colorBarL2 = null, |
| 934 | + colorBarL3 = null, |
| 935 | + colorBarL4 = null, |
| 936 | + colorBarL5 = null, |
| 937 | + colorBarL6 = null, |
| 938 | + colorMap = null, // color maps |
| 939 | + colorBar = null, |
| 940 | + colorPicker = null, |
| 941 | + elementStartX = null, // Used to record the starting css positions for dragging the control |
| 942 | + elementStartY = null, |
| 943 | + pageStartX = null, // Used to record the mousedown coordinates for dragging the control |
| 944 | + pageStartY = null, |
| 945 | + activePreview = null, // color boxes above the radio buttons |
| 946 | + currentPreview = null, |
| 947 | + okButton = null, |
| 948 | + cancelButton = null, |
| 949 | + grid = null, // preset colors grid |
| 950 | + iconColor = null, // iconColor for popup icon |
| 951 | + iconAlpha = null, // iconAlpha for popup icon |
| 952 | + iconImage = null, // iconImage popup icon |
| 953 | + moveBar = null, // drag bar |
| 954 | + setColorMode = // set color mode and update visuals for the new color mode |
| 955 | + function(colorMode) |
| 956 | + { |
| 957 | + var active = color.active, // local copies for YUI compressor |
| 958 | + clientPath = images.clientPath, |
| 959 | + hex = active.val('hex'), |
| 960 | + rgbMap, |
| 961 | + rgbBar; |
| 962 | + settings.color.mode = colorMode; |
| 963 | + switch (colorMode) |
| 964 | + { |
| 965 | + case 'h': |
| 966 | + setTimeout( |
| 967 | + function() |
| 968 | + { |
| 969 | + setBG.call($this, colorMapDiv, 'transparent'); |
| 970 | + setImgLoc.call($this, colorMapL1, 0); |
| 971 | + setAlpha.call($this, colorMapL1, 100); |
| 972 | + setImgLoc.call($this, colorMapL2, 260); |
| 973 | + setAlpha.call($this, colorMapL2, 100); |
| 974 | + setBG.call($this, colorBarDiv, 'transparent'); |
| 975 | + setImgLoc.call($this, colorBarL1, 0); |
| 976 | + setAlpha.call($this, colorBarL1, 100); |
| 977 | + setImgLoc.call($this, colorBarL2, 260); |
| 978 | + setAlpha.call($this, colorBarL2, 100); |
| 979 | + setImgLoc.call($this, colorBarL3, 260); |
| 980 | + setAlpha.call($this, colorBarL3, 100); |
| 981 | + setImgLoc.call($this, colorBarL4, 260); |
| 982 | + setAlpha.call($this, colorBarL4, 100); |
| 983 | + setImgLoc.call($this, colorBarL6, 260); |
| 984 | + setAlpha.call($this, colorBarL6, 100); |
| 985 | + }, 0); |
| 986 | + colorMap.range('all', { minX: 0, maxX: 100, minY: 0, maxY: 100 }); |
| 987 | + colorBar.range('rangeY', { minY: 0, maxY: 360 }); |
| 988 | + if (active.val('ahex') == null) break; |
| 989 | + colorMap.val('xy', { x: active.val('s'), y: 100 - active.val('v') }, colorMap); |
| 990 | + colorBar.val('y', 360 - active.val('h'), colorBar); |
| 991 | + break; |
| 992 | + case 's': |
| 993 | + setTimeout( |
| 994 | + function() |
| 995 | + { |
| 996 | + setBG.call($this, colorMapDiv, 'transparent'); |
| 997 | + setImgLoc.call($this, colorMapL1, -260); |
| 998 | + setImgLoc.call($this, colorMapL2, -520); |
| 999 | + setImgLoc.call($this, colorBarL1, -260); |
| 1000 | + setImgLoc.call($this, colorBarL2, -520); |
| 1001 | + setImgLoc.call($this, colorBarL6, 260); |
| 1002 | + setAlpha.call($this, colorBarL6, 100); |
| 1003 | + }, 0); |
| 1004 | + colorMap.range('all', { minX: 0, maxX: 360, minY: 0, maxY: 100 }); |
| 1005 | + colorBar.range('rangeY', { minY: 0, maxY: 100 }); |
| 1006 | + if (active.val('ahex') == null) break; |
| 1007 | + colorMap.val('xy', { x: active.val('h'), y: 100 - active.val('v') }, colorMap); |
| 1008 | + colorBar.val('y', 100 - active.val('s'), colorBar); |
| 1009 | + break; |
| 1010 | + case 'v': |
| 1011 | + setTimeout( |
| 1012 | + function() |
| 1013 | + { |
| 1014 | + setBG.call($this, colorMapDiv, '000000'); |
| 1015 | + setImgLoc.call($this, colorMapL1, -780); |
| 1016 | + setImgLoc.call($this, colorMapL2, 260); |
| 1017 | + setBG.call($this, colorBarDiv, hex); |
| 1018 | + setImgLoc.call($this, colorBarL1, -520); |
| 1019 | + setImgLoc.call($this, colorBarL2, 260); |
| 1020 | + setAlpha.call($this, colorBarL2, 100); |
| 1021 | + setImgLoc.call($this, colorBarL6, 260); |
| 1022 | + setAlpha.call($this, colorBarL6, 100); |
| 1023 | + }, 0); |
| 1024 | + colorMap.range('all', { minX: 0, maxX: 360, minY: 0, maxY: 100 }); |
| 1025 | + colorBar.range('rangeY', { minY: 0, maxY: 100 }); |
| 1026 | + if (active.val('ahex') == null) break; |
| 1027 | + colorMap.val('xy', { x: active.val('h'), y: 100 - active.val('s') }, colorMap); |
| 1028 | + colorBar.val('y', 100 - active.val('v'), colorBar); |
| 1029 | + break; |
| 1030 | + case 'r': |
| 1031 | + rgbMap = -1040; |
| 1032 | + rgbBar = -780; |
| 1033 | + colorMap.range('all', { minX: 0, maxX: 255, minY: 0, maxY: 255 }); |
| 1034 | + colorBar.range('rangeY', { minY: 0, maxY: 255 }); |
| 1035 | + if (active.val('ahex') == null) break; |
| 1036 | + colorMap.val('xy', { x: active.val('b'), y: 255 - active.val('g') }, colorMap); |
| 1037 | + colorBar.val('y', 255 - active.val('r'), colorBar); |
| 1038 | + break; |
| 1039 | + case 'g': |
| 1040 | + rgbMap = -1560; |
| 1041 | + rgbBar = -1820; |
| 1042 | + colorMap.range('all', { minX: 0, maxX: 255, minY: 0, maxY: 255 }); |
| 1043 | + colorBar.range('rangeY', { minY: 0, maxY: 255 }); |
| 1044 | + if (active.val('ahex') == null) break; |
| 1045 | + colorMap.val('xy', { x: active.val('b'), y: 255 - active.val('r') }, colorMap); |
| 1046 | + colorBar.val('y', 255 - active.val('g'), colorBar); |
| 1047 | + break; |
| 1048 | + case 'b': |
| 1049 | + rgbMap = -2080; |
| 1050 | + rgbBar = -2860; |
| 1051 | + colorMap.range('all', { minX: 0, maxX: 255, minY: 0, maxY: 255 }); |
| 1052 | + colorBar.range('rangeY', { minY: 0, maxY: 255 }); |
| 1053 | + if (active.val('ahex') == null) break; |
| 1054 | + colorMap.val('xy', { x: active.val('r'), y: 255 - active.val('g') }, colorMap); |
| 1055 | + colorBar.val('y', 255 - active.val('b'), colorBar); |
| 1056 | + break; |
| 1057 | + case 'a': |
| 1058 | + setTimeout( |
| 1059 | + function() |
| 1060 | + { |
| 1061 | + setBG.call($this, colorMapDiv, 'transparent'); |
| 1062 | + setImgLoc.call($this, colorMapL1, -260); |
| 1063 | + setImgLoc.call($this, colorMapL2, -520); |
| 1064 | + setImgLoc.call($this, colorBarL1, 260); |
| 1065 | + setImgLoc.call($this, colorBarL2, 260); |
| 1066 | + setAlpha.call($this, colorBarL2, 100); |
| 1067 | + setImgLoc.call($this, colorBarL6, 0); |
| 1068 | + setAlpha.call($this, colorBarL6, 100); |
| 1069 | + }, 0); |
| 1070 | + colorMap.range('all', { minX: 0, maxX: 360, minY: 0, maxY: 100 }); |
| 1071 | + colorBar.range('rangeY', { minY: 0, maxY: 255 }); |
| 1072 | + if (active.val('ahex') == null) break; |
| 1073 | + colorMap.val('xy', { x: active.val('h'), y: 100 - active.val('v') }, colorMap); |
| 1074 | + colorBar.val('y', 255 - active.val('a'), colorBar); |
| 1075 | + break; |
| 1076 | + default: |
| 1077 | + throw ('Invalid Mode'); |
| 1078 | + break; |
| 1079 | + } |
| 1080 | + switch (colorMode) |
| 1081 | + { |
| 1082 | + case 'h': |
| 1083 | + break; |
| 1084 | + case 's': |
| 1085 | + case 'v': |
| 1086 | + case 'a': |
| 1087 | + setTimeout( |
| 1088 | + function() |
| 1089 | + { |
| 1090 | + setAlpha.call($this, colorMapL1, 100); |
| 1091 | + setAlpha.call($this, colorBarL1, 100); |
| 1092 | + setImgLoc.call($this, colorBarL3, 260); |
| 1093 | + setAlpha.call($this, colorBarL3, 100); |
| 1094 | + setImgLoc.call($this, colorBarL4, 260); |
| 1095 | + setAlpha.call($this, colorBarL4, 100); |
| 1096 | + }, 0); |
| 1097 | + break; |
| 1098 | + case 'r': |
| 1099 | + case 'g': |
| 1100 | + case 'b': |
| 1101 | + setTimeout( |
| 1102 | + function() |
| 1103 | + { |
| 1104 | + setBG.call($this, colorMapDiv, 'transparent'); |
| 1105 | + setBG.call($this, colorBarDiv, 'transparent'); |
| 1106 | + setAlpha.call($this, colorBarL1, 100); |
| 1107 | + setAlpha.call($this, colorMapL1, 100); |
| 1108 | + setImgLoc.call($this, colorMapL1, rgbMap); |
| 1109 | + setImgLoc.call($this, colorMapL2, rgbMap - 260); |
| 1110 | + setImgLoc.call($this, colorBarL1, rgbBar - 780); |
| 1111 | + setImgLoc.call($this, colorBarL2, rgbBar - 520); |
| 1112 | + setImgLoc.call($this, colorBarL3, rgbBar); |
| 1113 | + setImgLoc.call($this, colorBarL4, rgbBar - 260); |
| 1114 | + setImgLoc.call($this, colorBarL6, 260); |
| 1115 | + setAlpha.call($this, colorBarL6, 100); |
| 1116 | + }, 0); |
| 1117 | + break; |
| 1118 | + } |
| 1119 | + if (active.val('ahex') == null) return; |
| 1120 | + activeColorChanged.call($this, active); |
| 1121 | + }, |
| 1122 | + activeColorChanged = // Update color when user changes text values |
| 1123 | + function(ui, context) |
| 1124 | + { |
| 1125 | + if (context == null || (context != colorBar && context != colorMap)) positionMapAndBarArrows.call($this, ui, context); |
| 1126 | + setTimeout( |
| 1127 | + function() |
| 1128 | + { |
| 1129 | + updatePreview.call($this, ui); |
| 1130 | + updateMapVisuals.call($this, ui); |
| 1131 | + updateBarVisuals.call($this, ui); |
| 1132 | + }, 0); |
| 1133 | + }, |
| 1134 | + mapValueChanged = // user has dragged the ColorMap pointer |
| 1135 | + function(ui, context) |
| 1136 | + { |
| 1137 | + var active = color.active; |
| 1138 | + if (context != colorMap && active.val() == null) return; |
| 1139 | + var xy = ui.val('all'); |
| 1140 | + switch (settings.color.mode) |
| 1141 | + { |
| 1142 | + case 'h': |
| 1143 | + active.val('sv', { s: xy.x, v: 100 - xy.y }, context); |
| 1144 | + break; |
| 1145 | + case 's': |
| 1146 | + case 'a': |
| 1147 | + active.val('hv', { h: xy.x, v: 100 - xy.y }, context); |
| 1148 | + break; |
| 1149 | + case 'v': |
| 1150 | + active.val('hs', { h: xy.x, s: 100 - xy.y }, context); |
| 1151 | + break; |
| 1152 | + case 'r': |
| 1153 | + active.val('gb', { g: 255 - xy.y, b: xy.x }, context); |
| 1154 | + break; |
| 1155 | + case 'g': |
| 1156 | + active.val('rb', { r: 255 - xy.y, b: xy.x }, context); |
| 1157 | + break; |
| 1158 | + case 'b': |
| 1159 | + active.val('rg', { r: xy.x, g: 255 - xy.y }, context); |
| 1160 | + break; |
| 1161 | + } |
| 1162 | + }, |
| 1163 | + colorBarValueChanged = // user has dragged the ColorBar slider |
| 1164 | + function(ui, context) |
| 1165 | + { |
| 1166 | + var active = color.active; |
| 1167 | + if (context != colorBar && active.val() == null) return; |
| 1168 | + switch (settings.color.mode) |
| 1169 | + { |
| 1170 | + case 'h': |
| 1171 | + active.val('h', { h: 360 - ui.val('y') }, context); |
| 1172 | + break; |
| 1173 | + case 's': |
| 1174 | + active.val('s', { s: 100 - ui.val('y') }, context); |
| 1175 | + break; |
| 1176 | + case 'v': |
| 1177 | + active.val('v', { v: 100 - ui.val('y') }, context); |
| 1178 | + break; |
| 1179 | + case 'r': |
| 1180 | + active.val('r', { r: 255 - ui.val('y') }, context); |
| 1181 | + break; |
| 1182 | + case 'g': |
| 1183 | + active.val('g', { g: 255 - ui.val('y') }, context); |
| 1184 | + break; |
| 1185 | + case 'b': |
| 1186 | + active.val('b', { b: 255 - ui.val('y') }, context); |
| 1187 | + break; |
| 1188 | + case 'a': |
| 1189 | + active.val('a', 255 - ui.val('y'), context); |
| 1190 | + break; |
| 1191 | + } |
| 1192 | + }, |
| 1193 | + positionMapAndBarArrows = // position map and bar arrows to match current color |
| 1194 | + function(ui, context) |
| 1195 | + { |
| 1196 | + if (context != colorMap) |
| 1197 | + { |
| 1198 | + switch (settings.color.mode) |
| 1199 | + { |
| 1200 | + case 'h': |
| 1201 | + var sv = ui.val('sv'); |
| 1202 | + colorMap.val('xy', { x: sv != null ? sv.s : 100, y: 100 - (sv != null ? sv.v : 100) }, context); |
| 1203 | + break; |
| 1204 | + case 's': |
| 1205 | + case 'a': |
| 1206 | + var hv = ui.val('hv'); |
| 1207 | + colorMap.val('xy', { x: hv && hv.h || 0, y: 100 - (hv != null ? hv.v : 100) }, context); |
| 1208 | + break; |
| 1209 | + case 'v': |
| 1210 | + var hs = ui.val('hs'); |
| 1211 | + colorMap.val('xy', { x: hs && hs.h || 0, y: 100 - (hs != null ? hs.s : 100) }, context); |
| 1212 | + break; |
| 1213 | + case 'r': |
| 1214 | + var bg = ui.val('bg'); |
| 1215 | + colorMap.val('xy', { x: bg && bg.b || 0, y: 255 - (bg && bg.g || 0) }, context); |
| 1216 | + break; |
| 1217 | + case 'g': |
| 1218 | + var br = ui.val('br'); |
| 1219 | + colorMap.val('xy', { x: br && br.b || 0, y: 255 - (br && br.r || 0) }, context); |
| 1220 | + break; |
| 1221 | + case 'b': |
| 1222 | + var rg = ui.val('rg'); |
| 1223 | + colorMap.val('xy', { x: rg && rg.r || 0, y: 255 - (rg && rg.g || 0) }, context); |
| 1224 | + break; |
| 1225 | + } |
| 1226 | + } |
| 1227 | + if (context != colorBar) |
| 1228 | + { |
| 1229 | + switch (settings.color.mode) |
| 1230 | + { |
| 1231 | + case 'h': |
| 1232 | + colorBar.val('y', 360 - (ui.val('h') || 0), context); |
| 1233 | + break; |
| 1234 | + case 's': |
| 1235 | + var s = ui.val('s'); |
| 1236 | + colorBar.val('y', 100 - (s != null ? s : 100), context); |
| 1237 | + break; |
| 1238 | + case 'v': |
| 1239 | + var v = ui.val('v'); |
| 1240 | + colorBar.val('y', 100 - (v != null ? v : 100), context); |
| 1241 | + break; |
| 1242 | + case 'r': |
| 1243 | + colorBar.val('y', 255 - (ui.val('r') || 0), context); |
| 1244 | + break; |
| 1245 | + case 'g': |
| 1246 | + colorBar.val('y', 255 - (ui.val('g') || 0), context); |
| 1247 | + break; |
| 1248 | + case 'b': |
| 1249 | + colorBar.val('y', 255 - (ui.val('b') || 0), context); |
| 1250 | + break; |
| 1251 | + case 'a': |
| 1252 | + var a = ui.val('a'); |
| 1253 | + colorBar.val('y', 255 - (a != null ? a : 255), context); |
| 1254 | + break; |
| 1255 | + } |
| 1256 | + } |
| 1257 | + }, |
| 1258 | + updatePreview = |
| 1259 | + function(ui) |
| 1260 | + { |
| 1261 | + try |
| 1262 | + { |
| 1263 | + var all = ui.val('all'); |
| 1264 | + activePreview.css({ backgroundColor: all && '#' + all.hex || 'transparent' }); |
| 1265 | + setAlpha.call($this, activePreview, all && Math.precision((all.a * 100) / 255, 4) || 0); |
| 1266 | + } |
| 1267 | + catch (e) { } |
| 1268 | + }, |
| 1269 | + updateMapVisuals = |
| 1270 | + function(ui) |
| 1271 | + { |
| 1272 | + switch (settings.color.mode) |
| 1273 | + { |
| 1274 | + case 'h': |
| 1275 | + setBG.call($this, colorMapDiv, new Color({ h: ui.val('h') || 0, s: 100, v: 100 }).val('hex')); |
| 1276 | + break; |
| 1277 | + case 's': |
| 1278 | + case 'a': |
| 1279 | + var s = ui.val('s'); |
| 1280 | + setAlpha.call($this, colorMapL2, 100 - (s != null ? s : 100)); |
| 1281 | + break; |
| 1282 | + case 'v': |
| 1283 | + var v = ui.val('v'); |
| 1284 | + setAlpha.call($this, colorMapL1, v != null ? v : 100); |
| 1285 | + break; |
| 1286 | + case 'r': |
| 1287 | + setAlpha.call($this, colorMapL2, Math.precision((ui.val('r') || 0) / 255 * 100, 4)); |
| 1288 | + break; |
| 1289 | + case 'g': |
| 1290 | + setAlpha.call($this, colorMapL2, Math.precision((ui.val('g') || 0) / 255 * 100, 4)); |
| 1291 | + break; |
| 1292 | + case 'b': |
| 1293 | + setAlpha.call($this, colorMapL2, Math.precision((ui.val('b') || 0) / 255 * 100)); |
| 1294 | + break; |
| 1295 | + } |
| 1296 | + var a = ui.val('a'); |
| 1297 | + setAlpha.call($this, colorMapL3, Math.precision(((255 - (a || 0)) * 100) / 255, 4)); |
| 1298 | + }, |
| 1299 | + updateBarVisuals = |
| 1300 | + function(ui) |
| 1301 | + { |
| 1302 | + switch (settings.color.mode) |
| 1303 | + { |
| 1304 | + case 'h': |
| 1305 | + var a = ui.val('a'); |
| 1306 | + setAlpha.call($this, colorBarL5, Math.precision(((255 - (a || 0)) * 100) / 255, 4)); |
| 1307 | + break; |
| 1308 | + case 's': |
| 1309 | + var hva = ui.val('hva'), |
| 1310 | + saturatedColor = new Color({ h: hva && hva.h || 0, s: 100, v: hva != null ? hva.v : 100 }); |
| 1311 | + setBG.call($this, colorBarDiv, saturatedColor.val('hex')); |
| 1312 | + setAlpha.call($this, colorBarL2, 100 - (hva != null ? hva.v : 100)); |
| 1313 | + setAlpha.call($this, colorBarL5, Math.precision(((255 - (hva && hva.a || 0)) * 100) / 255, 4)); |
| 1314 | + break; |
| 1315 | + case 'v': |
| 1316 | + var hsa = ui.val('hsa'), |
| 1317 | + valueColor = new Color({ h: hsa && hsa.h || 0, s: hsa != null ? hsa.s : 100, v: 100 }); |
| 1318 | + setBG.call($this, colorBarDiv, valueColor.val('hex')); |
| 1319 | + setAlpha.call($this, colorBarL5, Math.precision(((255 - (hsa && hsa.a || 0)) * 100) / 255, 4)); |
| 1320 | + break; |
| 1321 | + case 'r': |
| 1322 | + case 'g': |
| 1323 | + case 'b': |
| 1324 | + var hValue = 0, vValue = 0, rgba = ui.val('rgba'); |
| 1325 | + if (settings.color.mode == 'r') |
| 1326 | + { |
| 1327 | + hValue = rgba && rgba.b || 0; |
| 1328 | + vValue = rgba && rgba.g || 0; |
| 1329 | + } |
| 1330 | + else if (settings.color.mode == 'g') |
| 1331 | + { |
| 1332 | + hValue = rgba && rgba.b || 0; |
| 1333 | + vValue = rgba && rgba.r || 0; |
| 1334 | + } |
| 1335 | + else if (settings.color.mode == 'b') |
| 1336 | + { |
| 1337 | + hValue = rgba && rgba.r || 0; |
| 1338 | + vValue = rgba && rgba.g || 0; |
| 1339 | + } |
| 1340 | + var middle = vValue > hValue ? hValue : vValue; |
| 1341 | + setAlpha.call($this, colorBarL2, hValue > vValue ? Math.precision(((hValue - vValue) / (255 - vValue)) * 100, 4) : 0); |
| 1342 | + setAlpha.call($this, colorBarL3, vValue > hValue ? Math.precision(((vValue - hValue) / (255 - hValue)) * 100, 4) : 0); |
| 1343 | + setAlpha.call($this, colorBarL4, Math.precision((middle / 255) * 100, 4)); |
| 1344 | + setAlpha.call($this, colorBarL5, Math.precision(((255 - (rgba && rgba.a || 0)) * 100) / 255, 4)); |
| 1345 | + break; |
| 1346 | + case 'a': |
| 1347 | + var a = ui.val('a'); |
| 1348 | + setBG.call($this, colorBarDiv, ui.val('hex') || '000000'); |
| 1349 | + setAlpha.call($this, colorBarL5, a != null ? 0 : 100); |
| 1350 | + setAlpha.call($this, colorBarL6, a != null ? 100 : 0); |
| 1351 | + break; |
| 1352 | + } |
| 1353 | + }, |
| 1354 | + setBG = |
| 1355 | + function(el, c) |
| 1356 | + { |
| 1357 | + el.css({ backgroundColor: c && c.length == 6 && '#' + c || 'transparent' }); |
| 1358 | + }, |
| 1359 | + setImg = |
| 1360 | + function(img, src) |
| 1361 | + { |
| 1362 | + if (isLessThanIE7 && (src.indexOf('AlphaBar.png') != -1 || src.indexOf('Bars.png') != -1 || src.indexOf('Maps.png') != -1)) |
| 1363 | + { |
| 1364 | + img.attr('pngSrc', src); |
| 1365 | + img.css({ backgroundImage: 'none', filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\', sizingMethod=\'scale\')' }); |
| 1366 | + } |
| 1367 | + else img.css({ backgroundImage: 'url(' + src + ')' }); |
| 1368 | + }, |
| 1369 | + setImgLoc = |
| 1370 | + function(img, y) |
| 1371 | + { |
| 1372 | + img.css({ top: y + 'px' }); |
| 1373 | + }, |
| 1374 | + setAlpha = |
| 1375 | + function(obj, alpha) |
| 1376 | + { |
| 1377 | + obj.css({ visibility: alpha > 0 ? 'visible' : 'hidden' }); |
| 1378 | + if (alpha > 0 && alpha < 100) |
| 1379 | + { |
| 1380 | + if (isLessThanIE7) |
| 1381 | + { |
| 1382 | + var src = obj.attr('pngSrc'); |
| 1383 | + if (src != null && (src.indexOf('AlphaBar.png') != -1 || src.indexOf('Bars.png') != -1 || src.indexOf('Maps.png') != -1)) |
| 1384 | + obj.css({ filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\', sizingMethod=\'scale\') progid:DXImageTransform.Microsoft.Alpha(opacity=' + alpha + ')' }); |
| 1385 | + else obj.css({ opacity: Math.precision(alpha / 100, 4) }); |
| 1386 | + } |
| 1387 | + else obj.css({ opacity: Math.precision(alpha / 100, 4) }); |
| 1388 | + } |
| 1389 | + else if (alpha == 0 || alpha == 100) |
| 1390 | + { |
| 1391 | + if (isLessThanIE7) |
| 1392 | + { |
| 1393 | + var src = obj.attr('pngSrc'); |
| 1394 | + if (src != null && (src.indexOf('AlphaBar.png') != -1 || src.indexOf('Bars.png') != -1 || src.indexOf('Maps.png') != -1)) |
| 1395 | + obj.css({ filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + src + '\', sizingMethod=\'scale\')' }); |
| 1396 | + else obj.css({ opacity: '' }); |
| 1397 | + } |
| 1398 | + else obj.css({ opacity: '' }); |
| 1399 | + } |
| 1400 | + }, |
| 1401 | + revertColor = // revert color to original color when opened |
| 1402 | + function() |
| 1403 | + { |
| 1404 | + color.active.val('ahex', color.current.val('ahex')); |
| 1405 | + }, |
| 1406 | + commitColor = // commit the color changes |
| 1407 | + function() |
| 1408 | + { |
| 1409 | + color.current.val('ahex', color.active.val('ahex')); |
| 1410 | + }, |
| 1411 | + radioClicked = |
| 1412 | + function(e) |
| 1413 | + { |
| 1414 | + $(this).parents('tbody:first').find('input:radio[value!="'+e.target.value+'"]').removeAttr('checked'); |
| 1415 | + setColorMode.call($this, e.target.value); |
| 1416 | + }, |
| 1417 | + currentClicked = |
| 1418 | + function() |
| 1419 | + { |
| 1420 | + revertColor.call($this); |
| 1421 | + }, |
| 1422 | + cancelClicked = |
| 1423 | + function() |
| 1424 | + { |
| 1425 | + revertColor.call($this); |
| 1426 | + settings.window.expandable && hide.call($this); |
| 1427 | + $.isFunction(cancelCallback) && cancelCallback.call($this, color.active, cancelButton); |
| 1428 | + }, |
| 1429 | + okClicked = |
| 1430 | + function() |
| 1431 | + { |
| 1432 | + commitColor.call($this); |
| 1433 | + settings.window.expandable && hide.call($this); |
| 1434 | + $.isFunction(commitCallback) && commitCallback.call($this, color.active, okButton); |
| 1435 | + }, |
| 1436 | + iconImageClicked = |
| 1437 | + function() |
| 1438 | + { |
| 1439 | + show.call($this); |
| 1440 | + }, |
| 1441 | + currentColorChanged = |
| 1442 | + function(ui, context) |
| 1443 | + { |
| 1444 | + var hex = ui.val('hex'); |
| 1445 | + currentPreview.css({ backgroundColor: hex && '#' + hex || 'transparent' }); |
| 1446 | + setAlpha.call($this, currentPreview, Math.precision(((ui.val('a') || 0) * 100) / 255, 4)); |
| 1447 | + }, |
| 1448 | + expandableColorChanged = |
| 1449 | + function(ui, context) |
| 1450 | + { |
| 1451 | + var hex = ui.val('hex'); |
| 1452 | + var va = ui.val('va'); |
| 1453 | + iconColor.css({ backgroundColor: hex && '#' + hex || 'transparent' }); |
| 1454 | + setAlpha.call($this, iconAlpha, Math.precision(((255 - (va && va.a || 0)) * 100) / 255, 4)); |
| 1455 | + if (settings.window.bindToInput&&settings.window.updateInputColor) |
| 1456 | + settings.window.input.css( |
| 1457 | + { |
| 1458 | + backgroundColor: hex && '#' + hex || 'transparent', |
| 1459 | + color: va == null || va.v > 75 ? '#000000' : '#ffffff' |
| 1460 | + }); |
| 1461 | + }, |
| 1462 | + moveBarMouseDown = |
| 1463 | + function(e) |
| 1464 | + { |
| 1465 | + var element = settings.window.element, // local copies for YUI compressor |
| 1466 | + page = settings.window.page; |
| 1467 | + elementStartX = parseInt(container.css('left')); |
| 1468 | + elementStartY = parseInt(container.css('top')); |
| 1469 | + pageStartX = e.pageX; |
| 1470 | + pageStartY = e.pageY; |
| 1471 | + // bind events to document to move window - we will unbind these on mouseup |
| 1472 | + $(document).bind('mousemove', documentMouseMove).bind('mouseup', documentMouseUp); |
| 1473 | + e.preventDefault(); // prevent attempted dragging of the column |
| 1474 | + }, |
| 1475 | + documentMouseMove = |
| 1476 | + function(e) |
| 1477 | + { |
| 1478 | + container.css({ left: elementStartX - (pageStartX - e.pageX) + 'px', top: elementStartY - (pageStartY - e.pageY) + 'px' }); |
| 1479 | + if (settings.window.expandable && !$.support.boxModel) container.prev().css({ left: container.css("left"), top: container.css("top") }); |
| 1480 | + e.stopPropagation(); |
| 1481 | + e.preventDefault(); |
| 1482 | + return false; |
| 1483 | + }, |
| 1484 | + documentMouseUp = |
| 1485 | + function(e) |
| 1486 | + { |
| 1487 | + $(document).unbind('mousemove', documentMouseMove).unbind('mouseup', documentMouseUp); |
| 1488 | + e.stopPropagation(); |
| 1489 | + e.preventDefault(); |
| 1490 | + return false; |
| 1491 | + }, |
| 1492 | + quickPickClicked = |
| 1493 | + function(e) |
| 1494 | + { |
| 1495 | + e.preventDefault(); |
| 1496 | + e.stopPropagation(); |
| 1497 | + color.active.val('ahex', $(this).attr('title') || null, e.target); |
| 1498 | + return false; |
| 1499 | + }, |
| 1500 | + commitCallback = $.isFunction($arguments[1]) && $arguments[1] || null, |
| 1501 | + liveCallback = $.isFunction($arguments[2]) && $arguments[2] || null, |
| 1502 | + cancelCallback = $.isFunction($arguments[3]) && $arguments[3] || null, |
| 1503 | + show = |
| 1504 | + function() |
| 1505 | + { |
| 1506 | + color.current.val('ahex', color.active.val('ahex')); |
| 1507 | + var attachIFrame = function() |
| 1508 | + { |
| 1509 | + if (!settings.window.expandable || $.support.boxModel) return; |
| 1510 | + var table = container.find('table:first'); |
| 1511 | + container.before('<iframe/>'); |
| 1512 | + container.prev().css({ width: table.width(), height: container.height(), opacity: 0, position: 'absolute', left: container.css("left"), top: container.css("top") }); |
| 1513 | + }; |
| 1514 | + if (settings.window.expandable) |
| 1515 | + { |
| 1516 | + $(document.body).children('div.jPicker.Container').css({zIndex:10}); |
| 1517 | + container.css({zIndex:20}); |
| 1518 | + } |
| 1519 | + switch (settings.window.effects.type) |
| 1520 | + { |
| 1521 | + case 'fade': |
| 1522 | + container.fadeIn(settings.window.effects.speed.show, attachIFrame); |
| 1523 | + break; |
| 1524 | + case 'slide': |
| 1525 | + container.slideDown(settings.window.effects.speed.show, attachIFrame); |
| 1526 | + break; |
| 1527 | + case 'show': |
| 1528 | + default: |
| 1529 | + container.show(settings.window.effects.speed.show, attachIFrame); |
| 1530 | + break; |
| 1531 | + } |
| 1532 | + }, |
| 1533 | + hide = |
| 1534 | + function() |
| 1535 | + { |
| 1536 | + var removeIFrame = function() |
| 1537 | + { |
| 1538 | + if (settings.window.expandable) container.css({ zIndex: 10 }); |
| 1539 | + if (!settings.window.expandable || $.support.boxModel) return; |
| 1540 | + container.prev().remove(); |
| 1541 | + }; |
| 1542 | + switch (settings.window.effects.type) |
| 1543 | + { |
| 1544 | + case 'fade': |
| 1545 | + container.fadeOut(settings.window.effects.speed.hide, removeIFrame); |
| 1546 | + break; |
| 1547 | + case 'slide': |
| 1548 | + container.slideUp(settings.window.effects.speed.hide, removeIFrame); |
| 1549 | + break; |
| 1550 | + case 'show': |
| 1551 | + default: |
| 1552 | + container.hide(settings.window.effects.speed.hide, removeIFrame); |
| 1553 | + break; |
| 1554 | + } |
| 1555 | + }, |
| 1556 | + initialize = |
| 1557 | + function() |
| 1558 | + { |
| 1559 | + var win = settings.window,
|
| 1560 | + popup = win.expandable ? $($this).next().find('.Container:first') : null;
|
| 1561 | + container = win.expandable ? $('<div/>') : $($this);
|
| 1562 | + container.addClass('jPicker Container');
|
| 1563 | + if (win.expandable) container.hide();
|
| 1564 | + container.get(0).onselectstart=function(){return false;}; |
| 1565 | + // 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 |
| 1566 | + // this control really is tabular data, so I believe it is the right move |
| 1567 | + var all = color.active.val('all'); |
| 1568 | + if (win.alphaPrecision < 0) win.alphaPrecision = 0; |
| 1569 | + else if (win.alphaPrecision > 2) win.alphaPrecision = 2; |
| 1570 | + var controlHtml='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>' + (win.expandable ? '<tr><td class="Move" colspan="5"> </td></tr>' : '') + '<tr><td rowspan="9"><h2 class="Title">' + (win.title || localization.text.title) + '</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="' + images.clientPath + images.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="' + images.clientPath + images.colorBar.arrow.file + '" class="Arrow"/></div></td><td colspan="2" class="Preview">' + localization.text.newColor + '<div><span class="Active" title="' + localization.tooltips.colors.newColor + '"> </span><span class="Current" title="' + localization.tooltips.colors.currentColor + '"> </span></div>' + localization.text.currentColor + '</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="' + localization.text.ok + '" title="' + localization.tooltips.buttons.ok + '"/><input type="button" class="Cancel" value="' + localization.text.cancel + '" title="' + localization.tooltips.buttons.cancel + '"/><hr/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="' + localization.tooltips.hue.radio + '"><input type="radio" value="h"' + (settings.color.mode == 'h' ? ' checked="checked"' : '') + '/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.h : '') + '" title="' + localization.tooltips.hue.textbox + '"/> °</td></tr><tr class="Saturation"><td class="Radio"><label title="' + localization.tooltips.saturation.radio + '"><input type="radio" value="s"' + (settings.color.mode == 's' ? ' checked="checked"' : '') + '/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.s : '') + '" title="' + localization.tooltips.saturation.textbox + '"/> %</td></tr><tr class="Value"><td class="Radio"><label title="' + localization.tooltips.value.radio + '"><input type="radio" value="v"' + (settings.color.mode == 'v' ? ' checked="checked"' : '') + '/>V:</label><br/><br/></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.v : '') + '" title="' + localization.tooltips.value.textbox + '"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="' + localization.tooltips.red.radio + '"><input type="radio" value="r"' + (settings.color.mode == 'r' ? ' checked="checked"' : '') + '/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.r : '') + '" title="' + localization.tooltips.red.textbox + '"/></td></tr><tr class="Green"><td class="Radio"><label title="' + localization.tooltips.green.radio + '"><input type="radio" value="g"' + (settings.color.mode == 'g' ? ' checked="checked"' : '') + '/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.g : '') + '" title="' + localization.tooltips.green.textbox + '"/></td></tr><tr class="Blue"><td class="Radio"><label title="' + localization.tooltips.blue.radio + '"><input type="radio" value="b"' + (settings.color.mode == 'b' ? ' checked="checked"' : '') + '/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="' + (all != null ? all.b : '') + '" title="' + localization.tooltips.blue.textbox + '"/></td></tr><tr class="Alpha"><td class="Radio">' + (win.alphaSupport ? '<label title="' + localization.tooltips.alpha.radio + '"><input type="radio" value="a"' + (settings.color.mode == 'a' ? ' checked="checked"' : '') + '/>A:</label>' : ' ') + '</td><td class="Text">' + (win.alphaSupport ? '<input type="text" maxlength="' + (3 + win.alphaPrecision) + '" value="' + (all != null ? Math.precision((all.a * 100) / 255, win.alphaPrecision) : '') + '" title="' + localization.tooltips.alpha.textbox + '"/> %' : ' ') + '</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="' + localization.tooltips.hex.textbox + '">#:<input type="text" maxlength="6" class="Hex" value="' + (all != null ? all.hex : '') + '"/></label>' + (win.alphaSupport ? '<input type="text" maxlength="2" class="AHex" value="' + (all != null ? all.ahex.substring(6) : '') + '" title="' + localization.tooltips.hex.alpha + '"/></td>' : ' ') + '</tr></tbody></table>'; |
| 1571 | + if (win.expandable) |
| 1572 | + { |
| 1573 | + container.html(controlHtml); |
| 1574 | + if($(document.body).children('div.jPicker.Container').length==0)$(document.body).prepend(container); |
| 1575 | + else $(document.body).children('div.jPicker.Container:last').after(container); |
| 1576 | + container.mousedown( |
| 1577 | + function() |
| 1578 | + { |
| 1579 | + $(document.body).children('div.jPicker.Container').css({zIndex:10}); |
| 1580 | + container.css({zIndex:20}); |
| 1581 | + }); |
| 1582 | + 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 |
| 1583 | + { |
| 1584 | + left: |
| 1585 | + win.position.x == 'left' ? (popup.offset().left - 530 - (win.position.y == 'center' ? 25 : 0)) + 'px' : |
| 1586 | + win.position.x == 'center' ? (popup.offset().left - 260) + 'px' : |
| 1587 | + win.position.x == 'right' ? (popup.offset().left - 10 + (win.position.y == 'center' ? 25 : 0)) + 'px' : |
| 1588 | + win.position.x == 'screenCenter' ? (($(document).width() >> 1) - 260) + 'px' : (popup.offset().left + parseInt(win.position.x)) + 'px', |
| 1589 | + position: 'absolute', |
| 1590 | + top: win.position.y == 'top' ? (popup.offset().top - 312) + 'px' : |
| 1591 | + win.position.y == 'center' ? (popup.offset().top - 156) + 'px' : |
| 1592 | + win.position.y == 'bottom' ? (popup.offset().top + 25) + 'px' : (popup.offset().top + parseInt(win.position.y)) + 'px' |
| 1593 | + }); |
| 1594 | + } |
| 1595 | + else |
| 1596 | + { |
| 1597 | + container = $($this); |
| 1598 | + container.html(controlHtml); |
| 1599 | + } |
| 1600 | + // initialize the objects to the source code just injected |
| 1601 | + var tbody = container.find('tbody:first'); |
| 1602 | + colorMapDiv = tbody.find('div.Map:first'); |
| 1603 | + colorBarDiv = tbody.find('div.Bar:first'); |
| 1604 | + var MapMaps = colorMapDiv.find('span'), |
| 1605 | + BarMaps = colorBarDiv.find('span'); |
| 1606 | + colorMapL1 = MapMaps.filter('.Map1:first'); |
| 1607 | + colorMapL2 = MapMaps.filter('.Map2:first'); |
| 1608 | + colorMapL3 = MapMaps.filter('.Map3:first'); |
| 1609 | + colorBarL1 = BarMaps.filter('.Map1:first'); |
| 1610 | + colorBarL2 = BarMaps.filter('.Map2:first'); |
| 1611 | + colorBarL3 = BarMaps.filter('.Map3:first'); |
| 1612 | + colorBarL4 = BarMaps.filter('.Map4:first'); |
| 1613 | + colorBarL5 = BarMaps.filter('.Map5:first'); |
| 1614 | + colorBarL6 = BarMaps.filter('.Map6:first'); |
| 1615 | + // create color pickers and maps |
| 1616 | + colorMap = new Slider(colorMapDiv, |
| 1617 | + { |
| 1618 | + map: |
| 1619 | + { |
| 1620 | + width: images.colorMap.width, |
| 1621 | + height: images.colorMap.height |
| 1622 | + }, |
| 1623 | + arrow: |
| 1624 | + { |
| 1625 | + image: images.clientPath + images.colorMap.arrow.file, |
| 1626 | + width: images.colorMap.arrow.width, |
| 1627 | + height: images.colorMap.arrow.height |
| 1628 | + } |
| 1629 | + }); |
| 1630 | + colorMap.bind(mapValueChanged); |
| 1631 | + colorBar = new Slider(colorBarDiv, |
| 1632 | + { |
| 1633 | + map: |
| 1634 | + { |
| 1635 | + width: images.colorBar.width, |
| 1636 | + height: images.colorBar.height |
| 1637 | + }, |
| 1638 | + arrow: |
| 1639 | + { |
| 1640 | + image: images.clientPath + images.colorBar.arrow.file, |
| 1641 | + width: images.colorBar.arrow.width, |
| 1642 | + height: images.colorBar.arrow.height |
| 1643 | + } |
| 1644 | + }); |
| 1645 | + colorBar.bind(colorBarValueChanged); |
| 1646 | + colorPicker = new ColorValuePicker(tbody, color.active, win.expandable && win.bindToInput ? win.input : null, win.alphaPrecision); |
| 1647 | + var hex = all != null ? all.hex : null, |
| 1648 | + preview = tbody.find('.Preview'), |
| 1649 | + button = tbody.find('.Button'); |
| 1650 | + activePreview = preview.find('.Active:first').css({ backgroundColor: hex && '#' + hex || 'transparent' }); |
| 1651 | + currentPreview = preview.find('.Current:first').css({ backgroundColor: hex && '#' + hex || 'transparent' }).bind('click', currentClicked); |
| 1652 | + setAlpha.call($this, currentPreview, Math.precision(color.current.val('a') * 100) / 255, 4); |
| 1653 | + okButton = button.find('.Ok:first').bind('click', okClicked); |
| 1654 | + cancelButton = button.find('.Cancel:first').bind('click', cancelClicked); |
| 1655 | + grid = button.find('.Grid:first'); |
| 1656 | + setTimeout( |
| 1657 | + function() |
| 1658 | + { |
| 1659 | + setImg.call($this, colorMapL1, images.clientPath + 'Maps.png'); |
| 1660 | + setImg.call($this, colorMapL2, images.clientPath + 'Maps.png'); |
| 1661 | + setImg.call($this, colorMapL3, images.clientPath + 'map-opacity.png'); |
| 1662 | + setImg.call($this, colorBarL1, images.clientPath + 'Bars.png'); |
| 1663 | + setImg.call($this, colorBarL2, images.clientPath + 'Bars.png'); |
| 1664 | + setImg.call($this, colorBarL3, images.clientPath + 'Bars.png'); |
| 1665 | + setImg.call($this, colorBarL4, images.clientPath + 'Bars.png'); |
| 1666 | + setImg.call($this, colorBarL5, images.clientPath + 'bar-opacity.png'); |
| 1667 | + setImg.call($this, colorBarL6, images.clientPath + 'AlphaBar.png'); |
| 1668 | + setImg.call($this, preview.find('div:first'), images.clientPath + 'preview-opacity.png'); |
| 1669 | + }, 0); |
| 1670 | + tbody.find('td.Radio input').bind('click', radioClicked); |
| 1671 | + // initialize quick list |
| 1672 | + if (color.quickList && color.quickList.length > 0) |
| 1673 | + { |
| 1674 | + var html = ''; |
| 1675 | + for (i = 0; i < color.quickList.length; i++) |
| 1676 | + { |
| 1677 | + /* if default colors are hex strings, change them to color objects */ |
| 1678 | + if ((typeof (color.quickList[i])).toString().toLowerCase() == 'string') color.quickList[i] = new Color({ hex: color.quickList[i] }); |
| 1679 | + var alpha = color.quickList[i].val('a'); |
| 1680 | + var ahex = color.quickList[i].val('ahex'); |
| 1681 | + if (!win.alphaSupport && ahex) ahex = ahex.substring(0, 6) + 'ff'; |
| 1682 | + var quickHex = color.quickList[i].val('hex'); |
| 1683 | + html+='<span class="QuickColor"' + (ahex && ' title="#' + ahex + '"' || '') + ' style="background-color:' + (quickHex && '#' + quickHex || '') + ';' + (quickHex ? '' : 'background-image:url(' + images.clientPath + 'NoColor.png)') + (win.alphaSupport && alpha && alpha < 255 ? ';opacity:' + Math.precision(alpha / 255, 4) + ';filter:Alpha(opacity=' + Math.precision(alpha / 2.55, 4) + ')' : '') + '"> </span>'; |
| 1684 | + } |
| 1685 | + setImg.call($this, grid, images.clientPath + 'bar-opacity.png'); |
| 1686 | + grid.html(html); |
| 1687 | + grid.find('.QuickColor').click(quickPickClicked); |
| 1688 | + } |
| 1689 | + setColorMode.call($this, settings.color.mode); |
| 1690 | + color.active.bind(activeColorChanged); |
| 1691 | + $.isFunction(liveCallback) && color.active.bind(liveCallback); |
| 1692 | + color.current.bind(currentColorChanged); |
| 1693 | + // bind to input |
| 1694 | + if (win.expandable) |
| 1695 | + { |
| 1696 | + $this.icon = popup.parents('.Icon:first'); |
| 1697 | + iconColor = $this.icon.find('.Color:first').css({ backgroundColor: hex && '#' + hex || 'transparent' }); |
| 1698 | + iconAlpha = $this.icon.find('.Alpha:first'); |
| 1699 | + setImg.call($this, iconAlpha, images.clientPath + 'bar-opacity.png'); |
| 1700 | + setAlpha.call($this, iconAlpha, Math.precision(((255 - (all != null ? all.a : 0)) * 100) / 255, 4)); |
| 1701 | + iconImage = $this.icon.find('.Image:first').css( |
| 1702 | + { |
| 1703 | + backgroundImage: 'url(' + images.clientPath + images.picker.file + ')' |
| 1704 | + }).bind('click', iconImageClicked); |
| 1705 | + if (win.bindToInput&&win.updateInputColor) |
| 1706 | + win.input.css( |
| 1707 | + { |
| 1708 | + backgroundColor: hex && '#' + hex || 'transparent', |
| 1709 | + color: all == null || all.v > 75 ? '#000000' : '#ffffff' |
| 1710 | + }); |
| 1711 | + moveBar = tbody.find('.Move:first').bind('mousedown', moveBarMouseDown); |
| 1712 | + color.active.bind(expandableColorChanged); |
| 1713 | + } |
| 1714 | + else show.call($this); |
| 1715 | + }, |
| 1716 | + destroy = |
| 1717 | + function() |
| 1718 | + { |
| 1719 | + container.find('td.Radio input').unbind('click', radioClicked); |
| 1720 | + currentPreview.unbind('click', currentClicked); |
| 1721 | + cancelButton.unbind('click', cancelClicked); |
| 1722 | + okButton.unbind('click', okClicked); |
| 1723 | + if (settings.window.expandable) |
| 1724 | + { |
| 1725 | + iconImage.unbind('click', iconImageClicked); |
| 1726 | + moveBar.unbind('mousedown', moveBarMouseDown); |
| 1727 | + $this.icon = null; |
| 1728 | + } |
| 1729 | + container.find('.QuickColor').unbind('click', quickPickClicked); |
| 1730 | + colorMapDiv = null; |
| 1731 | + colorBarDiv = null; |
| 1732 | + colorMapL1 = null; |
| 1733 | + colorMapL2 = null; |
| 1734 | + colorMapL3 = null; |
| 1735 | + colorBarL1 = null; |
| 1736 | + colorBarL2 = null; |
| 1737 | + colorBarL3 = null; |
| 1738 | + colorBarL4 = null; |
| 1739 | + colorBarL5 = null; |
| 1740 | + colorBarL6 = null; |
| 1741 | + colorMap.destroy(); |
| 1742 | + colorMap = null; |
| 1743 | + colorBar.destroy(); |
| 1744 | + colorBar = null; |
| 1745 | + colorPicker.destroy(); |
| 1746 | + colorPicker = null; |
| 1747 | + activePreview = null; |
| 1748 | + currentPreview = null; |
| 1749 | + okButton = null; |
| 1750 | + cancelButton = null; |
| 1751 | + grid = null; |
| 1752 | + commitCallback = null; |
| 1753 | + cancelCallback = null; |
| 1754 | + liveCallback = null; |
| 1755 | + container.html(''); |
| 1756 | + for (i = 0; i < List.length; i++) if (List[i] == $this) List.splice(i, 1); |
| 1757 | + }, |
| 1758 | + images = settings.images, // local copies for YUI compressor |
| 1759 | + localization = settings.localization, |
| 1760 | + color = |
| 1761 | + { |
| 1762 | + active: (typeof(settings.color.active)).toString().toLowerCase() == 'string' ? new Color({ ahex: !settings.window.alphaSupport && settings.color.active ? settings.color.active.substring(0, 6) + 'ff' : settings.color.active }) : new Color({ ahex: !settings.window.alphaSupport && settings.color.active.val('ahex') ? settings.color.active.val('ahex').substring(0, 6) + 'ff' : settings.color.active.val('ahex') }), |
| 1763 | + current: (typeof(settings.color.active)).toString().toLowerCase() == 'string' ? new Color({ ahex: !settings.window.alphaSupport && settings.color.active ? settings.color.active.substring(0, 6) + 'ff' : settings.color.active }) : new Color({ ahex: !settings.window.alphaSupport && settings.color.active.val('ahex') ? settings.color.active.val('ahex').substring(0, 6) + 'ff' : settings.color.active.val('ahex') }), |
| 1764 | + quickList: settings.color.quickList |
| 1765 | + }; |
| 1766 | + $.extend(true, $this, // public properties, methods, and callbacks |
| 1767 | + { |
| 1768 | + commitCallback: commitCallback, // commitCallback function can be overridden to return the selected color to a method you specify when the user clicks "OK" |
| 1769 | + liveCallback: liveCallback, // liveCallback function can be overridden to return the selected color to a method you specify in live mode (continuous update) |
| 1770 | + cancelCallback: cancelCallback, // cancelCallback function can be overridden to a method you specify when the user clicks "Cancel" |
| 1771 | + color: color, |
| 1772 | + show: show, |
| 1773 | + hide: hide, |
| 1774 | + destroy: destroy // destroys this control entirely, removing all events and objects, and removing itself from the List |
| 1775 | + }); |
| 1776 | + List.push($this); |
| 1777 | + setTimeout( |
| 1778 | + function() |
| 1779 | + { |
| 1780 | + initialize.call($this); |
| 1781 | + }, 0); |
| 1782 | + }); |
| 1783 | + }; |
| 1784 | + $.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 */ |
| 1785 | + { |
| 1786 | + window: |
| 1787 | + { |
| 1788 | + title: null, /* any title for the jPicker window itself - displays "Drag Markers To Pick A Color" if left null */ |
| 1789 | + effects: |
| 1790 | + { |
| 1791 | + type: 'slide', /* effect used to show/hide an expandable picker. Acceptable values "slide", "show", "fade" */ |
| 1792 | + speed: |
| 1793 | + { |
| 1794 | + show: 'slow', /* duration of "show" effect. Acceptable values are "fast", "slow", or time in ms */ |
| 1795 | + hide: 'fast' /* duration of "hide" effect. Acceptable values are "fast", "slow", or time in ms */ |
| 1796 | + } |
| 1797 | + }, |
| 1798 | + position: |
| 1799 | + { |
| 1800 | + x: 'screenCenter', /* acceptable values "left", "center", "right", "screenCenter", or relative px value */ |
| 1801 | + y: 'top' /* acceptable values "top", "bottom", "center", or relative px value */ |
| 1802 | + }, |
| 1803 | + 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 */ |
| 1804 | + liveUpdate: true, /* set false if you want the user to have to click "OK" before the binded input box updates values */ |
| 1805 | + alphaSupport: false, /* set to true to enable alpha picking */ |
| 1806 | + alphaPrecision: 0, /* set decimal precision for alpha percentage display - hex codes do not map directly to percentage integers - range 0-2 */ |
| 1807 | + updateInputColor: true /* set to false to prevent binded input colors from changing */ |
| 1808 | + }, |
| 1809 | + color: |
| 1810 | + { |
| 1811 | + mode: 'h', /* acceptabled values "h" (hue), "s" (saturation), "v" (value), "r" (red), "g" (green), "b" (blue), "a" (alpha) */ |
| 1812 | + active: new Color({ ahex: '#ffcc00ff' }), /* acceptable values are any declared $.jPicker.Color object or string HEX value (e.g. #ffc000) WITH OR WITHOUT the "#" prefix */ |
| 1813 | + quickList: /* the quick pick color list */ |
| 1814 | + [ |
| 1815 | + new Color({ h: 360, s: 33, v: 100 }), /* acceptable values are any declared $.jPicker.Color object or string HEX value (e.g. #ffc000) WITH OR WITHOUT the "#" prefix */ |
| 1816 | + new Color({ h: 360, s: 66, v: 100 }), |
| 1817 | + new Color({ h: 360, s: 100, v: 100 }), |
| 1818 | + new Color({ h: 360, s: 100, v: 75 }), |
| 1819 | + new Color({ h: 360, s: 100, v: 50 }), |
| 1820 | + new Color({ h: 180, s: 0, v: 100 }), |
| 1821 | + new Color({ h: 30, s: 33, v: 100 }), |
| 1822 | + new Color({ h: 30, s: 66, v: 100 }), |
| 1823 | + new Color({ h: 30, s: 100, v: 100 }), |
| 1824 | + new Color({ h: 30, s: 100, v: 75 }), |
| 1825 | + new Color({ h: 30, s: 100, v: 50 }), |
| 1826 | + new Color({ h: 180, s: 0, v: 90 }), |
| 1827 | + new Color({ h: 60, s: 33, v: 100 }), |
| 1828 | + new Color({ h: 60, s: 66, v: 100 }), |
| 1829 | + new Color({ h: 60, s: 100, v: 100 }), |
| 1830 | + new Color({ h: 60, s: 100, v: 75 }), |
| 1831 | + new Color({ h: 60, s: 100, v: 50 }), |
| 1832 | + new Color({ h: 180, s: 0, v: 80 }), |
| 1833 | + new Color({ h: 90, s: 33, v: 100 }), |
| 1834 | + new Color({ h: 90, s: 66, v: 100 }), |
| 1835 | + new Color({ h: 90, s: 100, v: 100 }), |
| 1836 | + new Color({ h: 90, s: 100, v: 75 }), |
| 1837 | + new Color({ h: 90, s: 100, v: 50 }), |
| 1838 | + new Color({ h: 180, s: 0, v: 70 }), |
| 1839 | + new Color({ h: 120, s: 33, v: 100 }), |
| 1840 | + new Color({ h: 120, s: 66, v: 100 }), |
| 1841 | + new Color({ h: 120, s: 100, v: 100 }), |
| 1842 | + new Color({ h: 120, s: 100, v: 75 }), |
| 1843 | + new Color({ h: 120, s: 100, v: 50 }), |
| 1844 | + new Color({ h: 180, s: 0, v: 60 }), |
| 1845 | + new Color({ h: 150, s: 33, v: 100 }), |
| 1846 | + new Color({ h: 150, s: 66, v: 100 }), |
| 1847 | + new Color({ h: 150, s: 100, v: 100 }), |
| 1848 | + new Color({ h: 150, s: 100, v: 75 }), |
| 1849 | + new Color({ h: 150, s: 100, v: 50 }), |
| 1850 | + new Color({ h: 180, s: 0, v: 50 }), |
| 1851 | + new Color({ h: 180, s: 33, v: 100 }), |
| 1852 | + new Color({ h: 180, s: 66, v: 100 }), |
| 1853 | + new Color({ h: 180, s: 100, v: 100 }), |
| 1854 | + new Color({ h: 180, s: 100, v: 75 }), |
| 1855 | + new Color({ h: 180, s: 100, v: 50 }), |
| 1856 | + new Color({ h: 180, s: 0, v: 40 }), |
| 1857 | + new Color({ h: 210, s: 33, v: 100 }), |
| 1858 | + new Color({ h: 210, s: 66, v: 100 }), |
| 1859 | + new Color({ h: 210, s: 100, v: 100 }), |
| 1860 | + new Color({ h: 210, s: 100, v: 75 }), |
| 1861 | + new Color({ h: 210, s: 100, v: 50 }), |
| 1862 | + new Color({ h: 180, s: 0, v: 30 }), |
| 1863 | + new Color({ h: 240, s: 33, v: 100 }), |
| 1864 | + new Color({ h: 240, s: 66, v: 100 }), |
| 1865 | + new Color({ h: 240, s: 100, v: 100 }), |
| 1866 | + new Color({ h: 240, s: 100, v: 75 }), |
| 1867 | + new Color({ h: 240, s: 100, v: 50 }), |
| 1868 | + new Color({ h: 180, s: 0, v: 20 }), |
| 1869 | + new Color({ h: 270, s: 33, v: 100 }), |
| 1870 | + new Color({ h: 270, s: 66, v: 100 }), |
| 1871 | + new Color({ h: 270, s: 100, v: 100 }), |
| 1872 | + new Color({ h: 270, s: 100, v: 75 }), |
| 1873 | + new Color({ h: 270, s: 100, v: 50 }), |
| 1874 | + new Color({ h: 180, s: 0, v: 10 }), |
| 1875 | + new Color({ h: 300, s: 33, v: 100 }), |
| 1876 | + new Color({ h: 300, s: 66, v: 100 }), |
| 1877 | + new Color({ h: 300, s: 100, v: 100 }), |
| 1878 | + new Color({ h: 300, s: 100, v: 75 }), |
| 1879 | + new Color({ h: 300, s: 100, v: 50 }), |
| 1880 | + new Color({ h: 180, s: 0, v: 0 }), |
| 1881 | + new Color({ h: 330, s: 33, v: 100 }), |
| 1882 | + new Color({ h: 330, s: 66, v: 100 }), |
| 1883 | + new Color({ h: 330, s: 100, v: 100 }), |
| 1884 | + new Color({ h: 330, s: 100, v: 75 }), |
| 1885 | + new Color({ h: 330, s: 100, v: 50 }), |
| 1886 | + new Color() |
| 1887 | + ] |
| 1888 | + }, |
| 1889 | + images: |
| 1890 | + { |
| 1891 | + clientPath: '/jPicker/images/', /* Path to image files */ |
| 1892 | + colorMap: |
| 1893 | + { |
| 1894 | + width: 256, |
| 1895 | + height: 256, |
| 1896 | + arrow: |
| 1897 | + { |
| 1898 | + file: 'mappoint.gif', /* ColorMap arrow icon */ |
| 1899 | + width: 15, |
| 1900 | + height: 15 |
| 1901 | + } |
| 1902 | + }, |
| 1903 | + colorBar: |
| 1904 | + { |
| 1905 | + width: 20, |
| 1906 | + height: 256, |
| 1907 | + arrow: |
| 1908 | + { |
| 1909 | + file: 'rangearrows.gif', /* ColorBar arrow icon */ |
| 1910 | + width: 20, |
| 1911 | + height: 7 |
| 1912 | + } |
| 1913 | + }, |
| 1914 | + picker: |
| 1915 | + { |
| 1916 | + file: 'picker.gif', /* Color Picker icon */ |
| 1917 | + width: 25, |
| 1918 | + height: 24 |
| 1919 | + } |
| 1920 | + }, |
| 1921 | + localization: /* alter these to change the text presented by the picker (e.g. different language) */ |
| 1922 | + { |
| 1923 | + text: |
| 1924 | + { |
| 1925 | + title: 'Drag Markers To Pick A Color', |
| 1926 | + newColor: 'new', |
| 1927 | + currentColor: 'current', |
| 1928 | + ok: 'OK', |
| 1929 | + cancel: 'Cancel' |
| 1930 | + }, |
| 1931 | + tooltips: |
| 1932 | + { |
| 1933 | + colors: |
| 1934 | + { |
| 1935 | + newColor: 'New Color - Press “OK” To Commit', |
| 1936 | + currentColor: 'Click To Revert To Original Color' |
| 1937 | + }, |
| 1938 | + buttons: |
| 1939 | + { |
| 1940 | + ok: 'Commit To This Color Selection', |
| 1941 | + cancel: 'Cancel And Revert To Original Color' |
| 1942 | + }, |
| 1943 | + hue: |
| 1944 | + { |
| 1945 | + radio: 'Set To “Hue” Color Mode', |
| 1946 | + textbox: 'Enter A “Hue” Value (0-360°)' |
| 1947 | + }, |
| 1948 | + saturation: |
| 1949 | + { |
| 1950 | + radio: 'Set To “Saturation” Color Mode', |
| 1951 | + textbox: 'Enter A “Saturation” Value (0-100%)' |
| 1952 | + }, |
| 1953 | + value: |
| 1954 | + { |
| 1955 | + radio: 'Set To “Value” Color Mode', |
| 1956 | + textbox: 'Enter A “Value” Value (0-100%)' |
| 1957 | + }, |
| 1958 | + red: |
| 1959 | + { |
| 1960 | + radio: 'Set To “Red” Color Mode', |
| 1961 | + textbox: 'Enter A “Red” Value (0-255)' |
| 1962 | + }, |
| 1963 | + green: |
| 1964 | + { |
| 1965 | + radio: 'Set To “Green” Color Mode', |
| 1966 | + textbox: 'Enter A “Green” Value (0-255)' |
| 1967 | + }, |
| 1968 | + blue: |
| 1969 | + { |
| 1970 | + radio: 'Set To “Blue” Color Mode', |
| 1971 | + textbox: 'Enter A “Blue” Value (0-255)' |
| 1972 | + }, |
| 1973 | + alpha: |
| 1974 | + { |
| 1975 | + radio: 'Set To “Alpha” Color Mode', |
| 1976 | + textbox: 'Enter A “Alpha” Value (0-100)' |
| 1977 | + }, |
| 1978 | + hex: |
| 1979 | + { |
| 1980 | + textbox: 'Enter A “Hex” Color Value (#000000-#ffffff)', |
| 1981 | + alpha: 'Enter A “Alpha” Value (#00-#ff)' |
| 1982 | + } |
| 1983 | + } |
| 1984 | + } |
| 1985 | + }; |
| 1986 | +})(jQuery, '1.1.5'); |
\ No newline at end of file |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/jpicker-1.1.5.js |
___________________________________________________________________ |
Added: svn:executable |
1 | 1987 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/ChangeLog.txt |
— | — | @@ -0,0 +1,116 @@ |
| 2 | +Change Log |
| 3 | +______________ |
| 4 | +1.1.5 |
| 5 | + Corrected Color object constructor to allow setting of the "alpha" value as per the documentation which previously didn't work. |
| 6 | + Added support for translucency for quickList colors with checkered background - Only available if "alphaSupport" is enabled. |
| 7 | + Restricted default color to "alpha" of 255 if "alphaSupport" is disabled - It will now assign an explicit alpha of 255 when disabled. |
| 8 | + >Added new setting variable "alphaPrecision" which indicates the number of decimal points to allow in the alpha percentage display - Now defaults to 0. |
| 9 | + |
| 10 | +1.1.4 |
| 11 | + 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. |
| 12 | + "alpha" percentage display will now show up to 1 decimal point for more accurate representation of "alpha" value. |
| 13 | + 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. |
| 14 | + 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. |
| 15 | + Transparent/invisible caret on NULL color is now corrected - uses the same caret color as a white color. |
| 16 | + Setting a binded input value of "" or no value attribute will now create a NULL color on initialization instead of the settings default color. |
| 17 | + 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. |
| 18 | + |
| 19 | +1.1.3 |
| 20 | + 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. |
| 21 | + 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). |
| 22 | + 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. |
| 23 | + 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. |
| 24 | + Added a updateInputColor option (default true) to allow for a binded input field that does not automatically update its background/text color. |
| 25 | + |
| 26 | +1.1.2 |
| 27 | + 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. |
| 28 | + 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. |
| 29 | + 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. |
| 30 | + 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. |
| 31 | + 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. |
| 32 | + 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". |
| 33 | + Added "effects" section of window settings to allow different show/hide effects and durations. |
| 34 | + 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). |
| 35 | + |
| 36 | +1.1.1 |
| 37 | + Correct IE exception caused by attempting to set "#transparent" to CSS background-color. |
| 38 | + |
| 39 | +1.1.0 |
| 40 | + Reworked nearly the entire plugin including the internal and external event model, bindings, DOM searches, classes, and overall presentation. |
| 41 | + The Color object now supports a changed event that you can bind to (or just bind to the picker events still included). |
| 42 | + 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. |
| 43 | + alphaSupport re-implemented by request - default behavior is off. |
| 44 | + Hex code now only 6 characters again. |
| 45 | + 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. |
| 46 | + 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. |
| 47 | + Better rendering for all IE versions in Quirks mode. |
| 48 | + |
| 49 | +1.0.13 |
| 50 | + 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. |
| 51 | + 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. |
| 52 | + 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. |
| 53 | + New colorBar picker image that does not draw outside of the element since the elements now hide overdraw. |
| 54 | + 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. |
| 55 | + 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. |
| 56 | + |
| 57 | +1.0.12 |
| 58 | + Added minified CSS file. |
| 59 | + Added IE7/8 Quirks Mode support. |
| 60 | + Added configurable string constants for all text and tooltips. You can now change the default values for different languages. |
| 61 | + Privatized the RGBA values in the Color object for better NULL handling. YOU MUST USE THE NEW GET FUNCTIONS TO ACCESS THE COLOR PROPERTIES. |
| 62 | + Better NULL color handling and an additional "No Color Selected" quick pick color. |
| 63 | + More consistent behavior across multiple versions of browsers. |
| 64 | + Added alpha response to the binded color picker icon. |
| 65 | + Removed "alphaSupport" variable. It is now always supported. |
| 66 | + |
| 67 | +1.0.11b |
| 68 | + 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. |
| 69 | + Can now create new Color object WITH OR WITHOUT the '#' prefix. |
| 70 | + |
| 71 | +1.0.11 |
| 72 | + 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. |
| 73 | + cancelCallback now returns the original color for use in programming responses. |
| 74 | + |
| 75 | +1.0.10 |
| 76 | + Corrected table layout and tweaked display for more consisent presentation. Nice catch from Jonathan Pasquier. |
| 77 | + |
| 78 | +1.0.9 |
| 79 | + Added optional title variable for each jPicker window. |
| 80 | + |
| 81 | +1.0.8 |
| 82 | + 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. |
| 83 | + |
| 84 | +1.0.7 |
| 85 | + 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. |
| 86 | + Added opacity feedback to color preview boxes. |
| 87 | + 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. |
| 88 | + Removed (jQuery).jPicker.getListElementById(id) function since "id" is no longer incorporated or required. |
| 89 | + |
| 90 | +1.0.6 |
| 91 | + Corrected picker bugs introduced with 1.0.5. |
| 92 | + Removed alpha slider bar until activated - default behavior for alpha is now OFF. |
| 93 | + Corrected Color constructor bug not allowing values of 0 for initial value (it was evaluating false and missing the init code - Thanks Pavol). |
| 94 | + 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). |
| 95 | + THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!! |
| 96 | + |
| 97 | +1.0.5 |
| 98 | + 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) |
| 99 | + Added title attributes to input elements - gives short tooltip directions on what button or field does. |
| 100 | + Commit callback used to fire on control initialization (twice actually) - This has been corrected, it does not fire on initialization. |
| 101 | + THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!! |
| 102 | + |
| 103 | +1.0.4 |
| 104 | + Added ability for smaller picker icon with expandable window on any DOM element (not just input). |
| 105 | + "draggable" property renamed to "expandable" and its scope increased to create small picker icon or large static picker. |
| 106 | + |
| 107 | +1.0.3 |
| 108 | + Added cancelCallback function for registering an external function when user clicks cancel button. (Thank you Jeff and Pavol) |
| 109 | + |
| 110 | +1.0.2 |
| 111 | + Random bug fixes - speed concerns. |
| 112 | + |
| 113 | +1.0.1 |
| 114 | + Corrected closure based memeory leak - there may be others? |
| 115 | + |
| 116 | +1.0.0 |
| 117 | + First Release. |
\ No newline at end of file |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/ChangeLog.txt |
___________________________________________________________________ |
Added: svn:executable |
1 | 118 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/picker.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/picker.gif |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 119 | + application/octet-stream |
Added: svn:executable |
3 | 120 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/Maps.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/Maps.png |
___________________________________________________________________ |
Added: svn:mime-type |
4 | 121 | + application/octet-stream |
Added: svn:executable |
5 | 122 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/Thumbs.db |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/Thumbs.db |
___________________________________________________________________ |
Added: svn:mime-type |
6 | 123 | + application/octet-stream |
Added: svn:executable |
7 | 124 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/map-opacity.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/map-opacity.png |
___________________________________________________________________ |
Added: svn:mime-type |
8 | 125 | + application/octet-stream |
Added: svn:executable |
9 | 126 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/Bars.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/Bars.png |
___________________________________________________________________ |
Added: svn:mime-type |
10 | 127 | + application/octet-stream |
Added: svn:executable |
11 | 128 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/preview-opacity.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/preview-opacity.png |
___________________________________________________________________ |
Added: svn:mime-type |
12 | 129 | + application/octet-stream |
Added: svn:executable |
13 | 130 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/mappoint.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/mappoint.gif |
___________________________________________________________________ |
Added: svn:mime-type |
14 | 131 | + application/octet-stream |
Added: svn:executable |
15 | 132 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/AlphaBar.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/AlphaBar.png |
___________________________________________________________________ |
Added: svn:mime-type |
16 | 133 | + application/octet-stream |
Added: svn:executable |
17 | 134 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/bar-opacity.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/bar-opacity.png |
___________________________________________________________________ |
Added: svn:mime-type |
18 | 135 | + application/octet-stream |
Added: svn:executable |
19 | 136 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/NoColor.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/NoColor.png |
___________________________________________________________________ |
Added: svn:mime-type |
20 | 137 | + application/octet-stream |
Added: svn:executable |
21 | 138 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/rangearrows.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/images/rangearrows.gif |
___________________________________________________________________ |
Added: svn:mime-type |
22 | 139 | + application/octet-stream |
Added: svn:executable |
23 | 140 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/css/jPicker-1.1.5.min.css |
— | — | @@ -0,0 +1 @@ |
| 2 | +.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{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: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 5px 0 5px;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;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 .Button{text-align:center;width:115px}.jPicker .Button input{width:100px}.jPicker .Button .Ok{margin:12px 0 5px 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} |
\ No newline at end of file |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/css/jPicker-1.1.5.min.css |
___________________________________________________________________ |
Added: svn:executable |
1 | 3 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/css/jPicker-1.1.5.css |
— | — | @@ -0,0 +1,222 @@ |
| 2 | +.jPicker .Icon {
|
| 3 | + display: inline-block;
|
| 4 | + height: 24px; /* change this value if using a different sized color picker icon */
|
| 5 | + position: relative; /* make this element an absolute positioning container */
|
| 6 | + text-align: left; /* make the zero width children position to the left of container */
|
| 7 | + width: 25px; /* change this value if using a different sized color picker icon */
|
| 8 | +}
|
| 9 | +.jPicker .Icon span.Color, .jPicker .Icon span.Alpha {
|
| 10 | + background-position: 2px 2px;
|
| 11 | + display: block;
|
| 12 | + height: 100%;
|
| 13 | + left: 0px;
|
| 14 | + position: absolute;
|
| 15 | + top: 0px;
|
| 16 | + width: 100%;
|
| 17 | +}
|
| 18 | +.jPicker .Icon span.Image {
|
| 19 | + background-repeat: no-repeat;
|
| 20 | + cursor: pointer;
|
| 21 | + display: block;
|
| 22 | + height: 100%;
|
| 23 | + left: 0px;
|
| 24 | + position: absolute;
|
| 25 | + top: 0px;
|
| 26 | + width: 100%;
|
| 27 | +}
|
| 28 | +.jPicker.Container {
|
| 29 | + z-index: 10;
|
| 30 | +}
|
| 31 | +table.jPicker {
|
| 32 | + background-color: #efefef;
|
| 33 | + border: 1px outset #666;
|
| 34 | + font-family: Arial, Helvetica, Sans-Serif;
|
| 35 | + font-size: 12px !important;
|
| 36 | + margin: 0px;
|
| 37 | + padding: 5px;
|
| 38 | + width: 545px;
|
| 39 | + z-index: 20;
|
| 40 | +}
|
| 41 | +.jPicker .Move {
|
| 42 | + background-color: #dddddd;
|
| 43 | + border-color: #fff #666 #666 #fff;
|
| 44 | + border-style: solid;
|
| 45 | + border-width: 1px;
|
| 46 | + cursor: move;
|
| 47 | + height: 12px;
|
| 48 | + padding: 0px;
|
| 49 | +}
|
| 50 | +.jPicker .Title {
|
| 51 | + font-size: 11px !important;
|
| 52 | + font-weight: bold;
|
| 53 | + margin: -2px 0px 0px 0px;
|
| 54 | + padding: 0px;
|
| 55 | + text-align: center;
|
| 56 | + width: 100%;
|
| 57 | +}
|
| 58 | +.jPicker div.Map {
|
| 59 | + border-bottom: 2px solid #fff;
|
| 60 | + border-left: 2px solid #9a9a9a;
|
| 61 | + border-right: 2px solid #fff;
|
| 62 | + border-top: 2px solid #9a9a9a;
|
| 63 | + cursor: crosshair;
|
| 64 | + height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */
|
| 65 | + margin: 0px 5px 0px 5px;
|
| 66 | + overflow: hidden; /* hide the overdraw of the Color Map icon when at edge of viewing box */
|
| 67 | + padding: 0px;
|
| 68 | + position: relative; /* make this element an absolute positioning container */
|
| 69 | + width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */
|
| 70 | +}
|
| 71 | +.jPicker div[class="Map"] {
|
| 72 | + height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
|
| 73 | + width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
|
| 74 | +}
|
| 75 | +.jPicker div.Bar {
|
| 76 | + border-bottom: 2px solid #fff;
|
| 77 | + border-left: 2px solid #9a9a9a;
|
| 78 | + border-right: 2px solid #fff;
|
| 79 | + border-top: 2px solid #9a9a9a;
|
| 80 | + cursor: n-resize;
|
| 81 | + height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */
|
| 82 | + margin: 12px 10px 0px 5px;
|
| 83 | + overflow: hidden;
|
| 84 | + padding: 0px;
|
| 85 | + position: relative;
|
| 86 | + width: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */
|
| 87 | +}
|
| 88 | +.jPicker div[class="Bar"] {
|
| 89 | + height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
|
| 90 | + width: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
|
| 91 | +}
|
| 92 | +.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 {
|
| 93 | + background-color: transparent;
|
| 94 | + background-image: none;
|
| 95 | + display: block;
|
| 96 | + left: 0px;
|
| 97 | + position: absolute;
|
| 98 | + top: 0px;
|
| 99 | +}
|
| 100 | +.jPicker .Map .Map1, .jPicker .Map .Map2, .jPicker .Map .Map3 {
|
| 101 | + height: 2596px;
|
| 102 | + width: 256px; /* must specify pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar
|
| 103 | + would not be drawn if its overflow is set to hidden. */
|
| 104 | +}
|
| 105 | +.jPicker .Bar .Map1, .jPicker .Bar .Map2, .jPicker .Bar .Map3, .jPicker .Bar .Map4 {
|
| 106 | + height: 3896px;
|
| 107 | + width: 20px; /* must specify pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar
|
| 108 | + would not be drawn if its overflow is set to hidden. */
|
| 109 | +}
|
| 110 | +.jPicker .Bar .Map5, .jPicker .Bar .Map6 {
|
| 111 | + height: 256px;
|
| 112 | + width: 20px; /* must specify pixel width. IE7/8 Quirks mode ignores opacity for an absolutely positioned item in a relative container with "overflow: visible". The marker in the colorBar
|
| 113 | + would not be drawn if its overflow is set to hidden. */
|
| 114 | +}
|
| 115 | +.jPicker .Map .Map1, .jPicker .Map .Map2, .jPicker .Bar .Map6 {
|
| 116 | + background-repeat: no-repeat;
|
| 117 | +}
|
| 118 | +.jPicker .Map .Map3, .jPicker .Bar .Map5 {
|
| 119 | + background-repeat: repeat;
|
| 120 | +}
|
| 121 | +.jPicker .Bar .Map1, .jPicker .Bar .Map2, .jPicker .Bar .Map3, .jPicker .Bar .Map4 {
|
| 122 | + background-repeat: repeat-x;
|
| 123 | +}
|
| 124 | +.jPicker .Map .Arrow {
|
| 125 | + display: block;
|
| 126 | + position: absolute;
|
| 127 | +}
|
| 128 | +.jPicker .Bar .Arrow {
|
| 129 | + display: block;
|
| 130 | + left: 0px; /* (arrow width / 2) - (element width / 2) - position arrows' center in elements' center */
|
| 131 | + position: absolute;
|
| 132 | +}
|
| 133 | +.jPicker .Preview {
|
| 134 | + font-size: 9px;
|
| 135 | + text-align: center;
|
| 136 | +}
|
| 137 | +.jPicker .Preview div {
|
| 138 | + border: 2px inset #eee;
|
| 139 | + height: 62px;
|
| 140 | + margin: 0px auto;
|
| 141 | + padding: 0px;
|
| 142 | + width: 62px;
|
| 143 | +}
|
| 144 | +.jPicker .Preview div span {
|
| 145 | + border: 1px solid #000;
|
| 146 | + display: block;
|
| 147 | + height: 30px;
|
| 148 | + margin: 0px auto;
|
| 149 | + padding: 0px;
|
| 150 | + width: 60px;
|
| 151 | +}
|
| 152 | +.jPicker .Preview .Active {
|
| 153 | + border-bottom-width: 0px;
|
| 154 | +}
|
| 155 | +.jPicker .Preview .Current {
|
| 156 | + border-top-width: 0px;
|
| 157 | + cursor: pointer;
|
| 158 | +}
|
| 159 | +.jPicker .Button {
|
| 160 | + text-align: center;
|
| 161 | + width: 115px;
|
| 162 | +}
|
| 163 | +.jPicker .Button input {
|
| 164 | + width: 100px;
|
| 165 | +}
|
| 166 | +.jPicker .Button .Ok {
|
| 167 | + margin: 12px 0px 5px 0px;
|
| 168 | +}
|
| 169 | +
|
| 170 | +.jPicker td.Radio {
|
| 171 | + margin: 0px;
|
| 172 | + padding: 0px;
|
| 173 | + width: 31px;
|
| 174 | +}
|
| 175 | +.jPicker td.Radio input {
|
| 176 | + margin: 0px 5px 0px 0px;
|
| 177 | + padding: 0px;
|
| 178 | +}
|
| 179 | +.jPicker td.Text {
|
| 180 | + font-size: 12px !important;
|
| 181 | + height: 22px;
|
| 182 | + margin: 0px;
|
| 183 | + padding: 0px;
|
| 184 | + text-align: left;
|
| 185 | + width: 70px;
|
| 186 | +}
|
| 187 | +.jPicker tr.Hex td.Text {
|
| 188 | + width: 100px;
|
| 189 | +}
|
| 190 | +.jPicker td.Text input {
|
| 191 | + background-color: #fff;
|
| 192 | + border: 1px inset #aaa;
|
| 193 | + height: 19px;
|
| 194 | + margin: 0px 0px 0px 5px;
|
| 195 | + text-align: left;
|
| 196 | + width: 30px;
|
| 197 | +}
|
| 198 | +.jPicker td[class="Text"] input {
|
| 199 | + height: 15px;
|
| 200 | +}
|
| 201 | +.jPicker tr.Hex td.Text input.Hex {
|
| 202 | + width: 50px;
|
| 203 | +}
|
| 204 | +.jPicker tr.Hex td.Text input.AHex {
|
| 205 | + width: 20px;
|
| 206 | +}
|
| 207 | +.jPicker .Grid {
|
| 208 | + text-align: center;
|
| 209 | + width: 114px;
|
| 210 | +}
|
| 211 | +.jPicker .Grid span.QuickColor {
|
| 212 | + border: 1px inset #aaa;
|
| 213 | + cursor: pointer;
|
| 214 | + display: inline-block;
|
| 215 | + height: 15px;
|
| 216 | + line-height: 15px;
|
| 217 | + margin: 0px;
|
| 218 | + padding: 0px;
|
| 219 | + width: 19px;
|
| 220 | +}
|
| 221 | +.jPicker .Grid span[class="QuickColor"] {
|
| 222 | + width: 17px;
|
| 223 | +} |
\ No newline at end of file |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/css/jPicker-1.1.5.css |
___________________________________________________________________ |
Added: svn:executable |
1 | 224 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/ReadMe.txt |
— | — | @@ -0,0 +1,45 @@ |
| 2 | +jPicker 1.1.5 |
| 3 | + |
| 4 | +jQuery Plugin for Photoshop style color picker |
| 5 | + |
| 6 | +Copyright (c) 2010 Christopher T. Tillman |
| 7 | +Digital Magic Productions, Inc. (http://www.digitalmagicpro.com/) |
| 8 | +MIT style license, FREE to use, alter, copy, sell, and especially ENHANCE |
| 9 | + |
| 10 | +Painstakingly ported from John Dyers' excellent work on his own color picker based on the Prototype framework. |
| 11 | + |
| 12 | +John Dyers' website: (http://johndyer.name) |
| 13 | +Color Picker page: (http://johndyer.name/post/2007/09/PhotoShop-like-JavaScript-Color-Picker.aspx) |
| 14 | + |
| 15 | + |
| 16 | + jPicker is a fast, lightweight jQuery plugin for including an advanced color picker in your web projects.
|
| 17 | +It has been painstakenly ported from John Dyers' awesome work on his picker using the Prototype framework.
|
| 18 | +
|
| 19 | + jPicker supports all current browsers and has been extensively tested in Chrome, Firefox, IE5.5+, Safari,
|
| 20 | +and Opera.
|
| 21 | +
|
| 22 | + If you are updating a current version, you MUST always use the CSS and image files from the download as
|
| 23 | +there may have been changes.
|
| 24 | +
|
| 25 | + If you are moving from a V1.0.* version, you MUST read the docs below to implement some changes to the
|
| 26 | +Color object returned by the callback functions.
|
| 27 | + |
| 28 | + |
| 29 | +Known Issues |
| 30 | +______________ |
| 31 | +Attaching multiple jPicker objects on a single page will slow performance. |
| 32 | + jPicker creates a new instance of the picker for every element. Performance will suffer when binding dozens of instances. |
| 33 | + |
| 34 | + |
| 35 | +Coming Soon |
| 36 | +______________ |
| 37 | + |
| 38 | + Will consider supporting jQuery ThemeRoller CSS API for theming the UI if demand exists. |
| 39 | + |
| 40 | +Planned For Future Release |
| 41 | +______________ |
| 42 | + |
| 43 | + Move the jPicker object to a single instance that all selection instances point to. |
| 44 | + - This will result in much faster operation and initialization for pages with multiple pickers. |
| 45 | + |
| 46 | + Add activateCallback option for calling a callback function when the jPicker is activated or its binding is switched to a different picker element. |
\ No newline at end of file |
Property changes on: branches/MwEmbedStandAlone/modules/Sequencer/tools/jPicker/ReadMe.txt |
___________________________________________________________________ |
Added: svn:executable |
1 | 47 | + * |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerPlayer.js |
— | — | @@ -95,9 +95,9 @@ |
96 | 96 | if( this.sequencer.options.videoAspect ){ |
97 | 97 | var aspect = this.sequencer.options.videoAspect.split( ':' ); |
98 | 98 | var apectRatio = ( aspect[1] / aspect[0] ); |
99 | | - size.height = parseInt( size.width * ( aspect[1] / aspect[0] ) ); |
| 99 | + size.height = parseInt( size.width * ( aspect[1] / aspect[0] ) )- 50; |
100 | 100 | } else { |
101 | | - size.height = $playerContainer.width(); |
| 101 | + size.height = $playerContainer.height() ; |
102 | 102 | } |
103 | 103 | // Check if we exceeded the max height |
104 | 104 | if( size.height > $playerContainer.height() ){ |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js |
— | — | @@ -36,18 +36,17 @@ |
37 | 37 | 'editWidgets' : ['panzoom'], |
38 | 38 | 'editableAttributes' : [ 'panZoom' ], |
39 | 39 | 'contentTypes': [ 'img'], // xxx todo add video support |
40 | | - 'animate' : 'true' |
| 40 | + 'supportsKeyFrames' : 'true' |
41 | 41 | }, |
42 | 42 | 'templateedit' : { |
43 | 43 | 'editWidgets' : ['editTemplate'], |
44 | 44 | 'editableAttributes' : [ 'apititlekey' ], |
45 | 45 | 'contentTypes' : ['mwtemplate'] |
46 | | - } |
47 | | - /*, |
| 46 | + }, |
48 | 47 | 'transitions' : { |
49 | 48 | 'editWidgets' : ['editTransitions'], |
50 | 49 | 'contentTypes': ['video', 'img', 'mwtemplate' ] |
51 | | - }*/ |
| 50 | + } |
52 | 51 | }, |
53 | 52 | editableAttributes:{ |
54 | 53 | 'clipBegin':{ |
— | — | @@ -280,7 +279,8 @@ |
281 | 280 | 'value' : 'fadeToColor', |
282 | 281 | 'editType' : 'hidden' |
283 | 282 | } |
284 | | - }, |
| 283 | + } |
| 284 | + /*, |
285 | 285 | 'crossfade' : { |
286 | 286 | 'extends': 'fade', |
287 | 287 | 'selectable' : ['transIn', 'transOut'], |
— | — | @@ -288,7 +288,7 @@ |
289 | 289 | 'value' : 'crossfade', |
290 | 290 | 'editType' : 'hidden' |
291 | 291 | } |
292 | | - } |
| 292 | + }*/ |
293 | 293 | }, |
294 | 294 | buildAttributeSet: function( transitionType ){ |
295 | 295 | var attributes = {}; |
— | — | @@ -383,21 +383,95 @@ |
384 | 384 | }) |
385 | 385 | ) |
386 | 386 | } else if ( transitionAttribute.editType == 'color' ){ |
387 | | - $inputBox = _this.getInputBox({ |
388 | | - 'title' : gM('mwe-sequencer-tools-transitions-color'), |
389 | | - 'inputSize' : 8, |
390 | | - 'initialValue' : initialValue, |
391 | | - 'change': function(){ |
392 | | - var cat = $j(this).val(); |
393 | | - debugger; |
394 | | - } |
395 | | - }) |
396 | | - // xxx add the color picker: |
397 | | - $editTransitionsSet.append( $inputBox ); |
| 387 | + // Add the color picker: |
| 388 | + $editTransitionsSet.append( |
| 389 | + _this.getInputBox({ |
| 390 | + 'title' : gM('mwe-sequencer-tools-transitions-color'), |
| 391 | + 'inputSize' : 8, |
| 392 | + 'initialValue' : initialValue |
| 393 | + }) |
| 394 | + .addClass("jColorPicker") |
| 395 | + ); |
398 | 396 | } |
399 | 397 | }) |
400 | 398 | return $editTransitionsSet; |
401 | 399 | }, |
| 400 | + /** |
| 401 | + * Could move to a more central location if we use the color picker other places |
| 402 | + */ |
| 403 | + colorPickerConfig: { |
| 404 | + 'window' : { |
| 405 | + 'expandable': true, |
| 406 | + 'effects' : { |
| 407 | + 'type' : 'fade' |
| 408 | + } |
| 409 | + }, |
| 410 | + 'images' : { |
| 411 | + 'clientPath' : mw.getMwEmbedPath() + 'modules/Sequencer/tools/jPicker/images/' |
| 412 | + }, |
| 413 | + 'localization' : { |
| 414 | + 'text' : { |
| 415 | + 'title' : gM('mwe-sequencer-color-picker-title'), |
| 416 | + 'newColor' : gM('mwe-sequencer-menu-sequence-new'), |
| 417 | + 'currentColor' : gM('mwe-sequencer-color-picker-current'), |
| 418 | + 'ok' : gM('mwe-ok'), |
| 419 | + 'cancel': gM('mwe-cancel') |
| 420 | + }, |
| 421 | + 'tooltips':{ |
| 422 | + 'colors': |
| 423 | + { |
| 424 | + 'newColor': gM('mwe-sequencer-color-picker-new-color'), |
| 425 | + 'currentColor': gM('mwe-sequencer-color-picker-currentColor') |
| 426 | + }, |
| 427 | + 'buttons': |
| 428 | + { |
| 429 | + ok: gM('mwe-sequencer-color-picker-commit' ), |
| 430 | + cancel: gM('mwe-sequencer-color-picker-cancel-desc') |
| 431 | + }, |
| 432 | + 'hue': |
| 433 | + { |
| 434 | + radio: gM('mwe-sequencer-color-picker-hue-desc'), |
| 435 | + textbox: gM('mwe-sequencer-color-picker-hue-textbox') |
| 436 | + }, |
| 437 | + 'saturation': |
| 438 | + { |
| 439 | + radio: gM('mwe-sequencer-color-picker-saturation-desc'), |
| 440 | + textbox: gM('mwe-sequencer-color-picker-saturation-textbox') |
| 441 | + }, |
| 442 | + 'value': |
| 443 | + { |
| 444 | + radio: gM('mwe-sequencer-color-picker-value-desc'), |
| 445 | + textbox: gM('mwe-sequencer-color-picker-value-textbox') |
| 446 | + }, |
| 447 | + 'red': |
| 448 | + { |
| 449 | + radio: gM('mwe-sequencer-color-picker-red-desc'), |
| 450 | + textbox: gM('mwe-sequencer-color-picker-red-textbox') |
| 451 | + }, |
| 452 | + 'green': |
| 453 | + { |
| 454 | + radio: gM('mwe-sequencer-color-picker-green-desc'), |
| 455 | + textbox: gM('mwe-sequencer-color-picker-green-textbox') |
| 456 | + }, |
| 457 | + 'blue': |
| 458 | + { |
| 459 | + radio: gM('mwe-sequencer-color-picker-blue-desc'), |
| 460 | + textbox: gM('mwe-sequencer-color-picker-blue-textbox') |
| 461 | + }, |
| 462 | + 'alpha': |
| 463 | + { |
| 464 | + radio: gM('mwe-sequencer-color-picker-alpha-desc'), |
| 465 | + textbox: gM('mwe-sequencer-color-picker-alpha-textbox') |
| 466 | + }, |
| 467 | + 'hex': |
| 468 | + { |
| 469 | + textbox: gM('mwe-sequencer-color-picker-hex-desc'), |
| 470 | + alpha: gM('mwe-sequencer-color-picker-hex-textbox') |
| 471 | + } |
| 472 | + } |
| 473 | + |
| 474 | + } |
| 475 | + }, |
402 | 476 | |
403 | 477 | 'onChange': function( _this, smilElement ){ |
404 | 478 | // Update the sequence duration : |
— | — | @@ -448,7 +522,7 @@ |
449 | 523 | _editTransitions.getBindedTranstionEdit( |
450 | 524 | _this, smilElement, transitionType |
451 | 525 | ) |
452 | | - ) |
| 526 | + ) |
453 | 527 | // Update the smil attribute: |
454 | 528 | $j( smilElement ).attr( |
455 | 529 | transitionDirection, |
— | — | @@ -480,6 +554,13 @@ |
481 | 555 | }); |
482 | 556 | // add the transition widget to the target |
483 | 557 | $j( target ).append( $transitionWidget ); |
| 558 | + |
| 559 | + $j( target ).find('.jColorPicker input').jPicker( |
| 560 | + _editTransitions.colorPickerConfig |
| 561 | + ); |
| 562 | + // adjust the position of the color button: |
| 563 | + $j( target ).find('.jColorPicker .Icon').css('top', '-5px'); |
| 564 | + |
484 | 565 | } |
485 | 566 | }, |
486 | 567 | 'editTemplate':{ |
— | — | @@ -930,9 +1011,13 @@ |
931 | 1012 | |
932 | 1013 | $toolsContainer = $j('<div />') |
933 | 1014 | .addClass( 'editToolsContainer' ) |
934 | | - .css( { |
935 | | - 'height': '80%', |
936 | | - 'overflow': 'auto' |
| 1015 | + .css( { |
| 1016 | + 'overflow': 'auto', |
| 1017 | + 'position':'absolute', |
| 1018 | + 'top' : '0px', |
| 1019 | + 'left': '0px', |
| 1020 | + 'right': '0px', |
| 1021 | + 'bottom': '37px' |
937 | 1022 | }) |
938 | 1023 | .append( |
939 | 1024 | $j('<ul />') |
— | — | @@ -1025,6 +1110,15 @@ |
1026 | 1111 | selected : toolTabIndex |
1027 | 1112 | }); |
1028 | 1113 | |
| 1114 | + var $editActions = $j('<div />') |
| 1115 | + .css({ |
| 1116 | + 'position' : 'absolute', |
| 1117 | + 'bottom' : '0px', |
| 1118 | + 'height' : '37px', |
| 1119 | + 'left' : '0px', |
| 1120 | + 'right' : '0px', |
| 1121 | + 'overflow' : 'auto' |
| 1122 | + }); |
1029 | 1123 | // Build out global edit Actions buttons after the container |
1030 | 1124 | for( var editActionId in this.editActions ){ |
1031 | 1125 | // Check if the edit action has a conditional display: |
— | — | @@ -1034,11 +1128,12 @@ |
1035 | 1129 | displayEidtAction = this.editActions[ editActionId ].displayCheck( _this, smilElement ); |
1036 | 1130 | } |
1037 | 1131 | if( displayEidtAction ){ |
1038 | | - $toolsContainer.after( |
| 1132 | + $editActions.append( |
1039 | 1133 | this.getEditAction( smilElement, editActionId ) |
1040 | 1134 | ) |
1041 | 1135 | } |
1042 | 1136 | } |
| 1137 | + $j( this.sequencer.getEditToolTarget() ).append( $editActions ) |
1043 | 1138 | }, |
1044 | 1139 | getCurrentsmilElement: function(){ |
1045 | 1140 | return this.currentsmilElement; |