diff --git a/_InstallPackages/spectrum_1.6.0.zip b/_InstallPackages/spectrum_1.6.0.zip deleted file mode 100644 index 51ca470f..00000000 Binary files a/_InstallPackages/spectrum_1.6.0.zip and /dev/null differ diff --git a/_InstallPackages/spectrum_1.7.0.zip b/_InstallPackages/spectrum_1.7.0.zip new file mode 100644 index 00000000..ad833e04 Binary files /dev/null and b/_InstallPackages/spectrum_1.7.0.zip differ diff --git a/spectrum_1.6.0/CHANGES.htm b/spectrum_1.6.0/CHANGES.htm deleted file mode 100644 index 4d0c5089..00000000 --- a/spectrum_1.6.0/CHANGES.htm +++ /dev/null @@ -1 +0,0 @@ -

You can review closed issues in the issue tracker

\ No newline at end of file diff --git a/spectrum_1.6.0/LICENSE.htm b/spectrum_1.6.0/LICENSE.htm deleted file mode 100644 index 43f088f5..00000000 --- a/spectrum_1.6.0/LICENSE.htm +++ /dev/null @@ -1 +0,0 @@ -

spectrum is licened under the MIT License.

diff --git a/spectrum_1.7.0/CHANGES.htm b/spectrum_1.7.0/CHANGES.htm new file mode 100644 index 00000000..289d15b2 --- /dev/null +++ b/spectrum_1.7.0/CHANGES.htm @@ -0,0 +1 @@ +

You can review all changes between 1.6.2 and 1.7.0

\ No newline at end of file diff --git a/spectrum_1.7.0/LICENSE.htm b/spectrum_1.7.0/LICENSE.htm new file mode 100644 index 00000000..f59e262a --- /dev/null +++ b/spectrum_1.7.0/LICENSE.htm @@ -0,0 +1 @@ +

spectrum is licened under the MIT License.

diff --git a/spectrum_1.6.0/spectrum.css b/spectrum_1.7.0/spectrum.css similarity index 99% rename from spectrum_1.6.0/spectrum.css rename to spectrum_1.7.0/spectrum.css index 28466132..1d0c883c 100644 --- a/spectrum_1.6.0/spectrum.css +++ b/spectrum_1.7.0/spectrum.css @@ -1,5 +1,5 @@ /*** -Spectrum Colorpicker v1.6.0 +Spectrum Colorpicker v1.7.0 https://github.com/bgrins/spectrum Author: Brian Grinstead License: MIT diff --git a/spectrum_1.6.0/spectrum.dnn b/spectrum_1.7.0/spectrum.dnn similarity index 94% rename from spectrum_1.6.0/spectrum.dnn rename to spectrum_1.7.0/spectrum.dnn index 0998b2b2..8fa099a2 100644 --- a/spectrum_1.6.0/spectrum.dnn +++ b/spectrum_1.7.0/spectrum.dnn @@ -1,6 +1,6 @@ - + spectrum The No Hassle JavaScript Colorpicker @@ -21,7 +21,7 @@ spectrum spectrum.js BodyBottom - https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.6.0/spectrum.min.js + https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.7.0/spectrum.min.js jQuery.fn.spectrum diff --git a/spectrum_1.6.0/spectrum.js b/spectrum_1.7.0/spectrum.js similarity index 97% rename from spectrum_1.6.0/spectrum.js rename to spectrum_1.7.0/spectrum.js index 56673298..acdf4a0b 100644 --- a/spectrum_1.6.0/spectrum.js +++ b/spectrum_1.7.0/spectrum.js @@ -1,4 +1,4 @@ -// Spectrum Colorpicker v1.6.0 +// Spectrum Colorpicker v1.7.0 // https://github.com/bgrins/spectrum // Author: Brian Grinstead // License: MIT @@ -33,7 +33,7 @@ showInput: false, allowEmpty: false, showButtons: true, - clickoutFiresChange: false, + clickoutFiresChange: true, showInitial: false, showPalette: false, showPaletteOnly: false, @@ -72,10 +72,6 @@ style.cssText = 'background-color:rgba(0,0,0,.5)'; return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla'); })(), - inputTypeColorSupport = (function() { - var colorInput = $("")[0]; - return colorInput.type === "color" && colorInput.value !== "!"; - })(), replaceInput = [ "
", "
", @@ -189,6 +185,7 @@ callbacks = opts.callbacks, resize = throttle(reflow, 10), visible = false, + isDragging = false, dragWidth = 0, dragHeight = 0, dragHelperHeight = 0, @@ -230,7 +227,7 @@ chooseButton = container.find(".sp-choose"), toggleButton = container.find(".sp-palette-toggle"), isInput = boundElement.is("input"), - isInputTypeColor = isInput && inputTypeColorSupport && boundElement.attr("type") === "color", + isInputTypeColor = isInput && boundElement.attr("type") === "color" && inputTypeColorSupport(), shouldReplace = isInput && !flat, replacer = (shouldReplace) ? $(replaceInput).addClass(theme).addClass(opts.className).addClass(opts.replacerClassName) : $([]), offsetElement = (shouldReplace) ? replacer : boundElement, @@ -360,6 +357,10 @@ e.stopPropagation(); e.preventDefault(); + if (IE && textInput.is(":focus")) { + textInput.trigger('change'); + } + if (isValid()) { updateOriginalInput(true); hide(); @@ -562,12 +563,14 @@ if (dragHeight <= 0 || dragWidth <= 0 || slideHeight <= 0) { reflow(); } + isDragging = true; container.addClass(draggingClass); shiftMovementDirection = null; boundElement.trigger('dragstart.spectrum', [ get() ]); } function dragStop() { + isDragging = false; container.removeClass(draggingClass); boundElement.trigger('dragstop.spectrum', [ get() ]); } @@ -618,6 +621,7 @@ hideAll(); visible = true; + $(doc).bind("keydown.spectrum", onkeydown); $(doc).bind("click.spectrum", clickout); $(window).bind("resize.spectrum", resize); replacer.addClass("sp-active"); @@ -633,10 +637,21 @@ boundElement.trigger('show.spectrum', [ colorOnShow ]); } + function onkeydown(e) { + // Close on ESC + if (e.keyCode === 27) { + hide(); + } + } + function clickout(e) { // Return on right click. if (e.button == 2) { return; } + // If a drag event was happening during the mouseup, don't hide + // on click. + if (isDragging) { return; } + if (clickoutFiresChange) { updateOriginalInput(true); } @@ -651,6 +666,7 @@ if (!visible || flat) { return; } visible = false; + $(doc).unbind("keydown.spectrum", onkeydown); $(doc).unbind("click.spectrum", clickout); $(window).unbind("resize.spectrum", resize); @@ -1043,9 +1059,9 @@ return stop(); } - var touches = e.originalEvent && e.originalEvent.touches; - var pageX = touches ? touches[0].pageX : e.pageX; - var pageY = touches ? touches[0].pageY : e.pageY; + var t0 = e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0]; + var pageX = t0 && t0.pageX || e.pageX; + var pageY = t0 && t0.pageY || e.pageY; var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth)); var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight)); @@ -1072,9 +1088,7 @@ $(doc).bind(duringDragEvents); $(doc.body).addClass("sp-dragging"); - if (!hasTouch) { - move(e); - } + move(e); prevent(e); } @@ -1085,7 +1099,12 @@ if (dragging) { $(doc).unbind(duringDragEvents); $(doc.body).removeClass("sp-dragging"); - onstop.apply(element, arguments); + + // Wait a tick before notifying observers to allow the click event + // to fire in Chrome. + setTimeout(function() { + onstop.apply(element, arguments); + }, 0); } dragging = false; } @@ -1106,6 +1125,10 @@ }; } + function inputTypeColorSupport() { + return $.fn.spectrum.inputTypeColorSupport(); + } + /** * Define a jQuery plugin */ @@ -1159,20 +1182,28 @@ $.fn.spectrum.loadOpts = {}; $.fn.spectrum.draggable = draggable; $.fn.spectrum.defaults = defaultOpts; + $.fn.spectrum.inputTypeColorSupport = function inputTypeColorSupport() { + if (typeof inputTypeColorSupport._cachedResult === "undefined") { + var colorInput = $("")[0]; + inputTypeColorSupport._cachedResult = colorInput.type === "color" && colorInput.value !== "!"; + } + return inputTypeColorSupport._cachedResult; + }; $.spectrum = { }; $.spectrum.localization = { }; $.spectrum.palettes = { }; $.fn.spectrum.processNativeColorInputs = function () { - if (!inputTypeColorSupport) { - $("input[type=color]").spectrum({ + var colorInputs = $("input[type=color]"); + if (colorInputs.length && !inputTypeColorSupport()) { + colorInputs.spectrum({ preferredFormat: "hex6" }); } }; - // TinyColor v1.1.1 + // TinyColor v1.1.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -1187,7 +1218,7 @@ mathMax = math.max, mathRandom = math.random; - var tinycolor = function tinycolor (color, opts) { + var tinycolor = function(color, opts) { color = (color) ? color : ''; opts = opts || { }; @@ -2277,7 +2308,6 @@ window.tinycolor = tinycolor; })(); - $(function () { if ($.fn.spectrum.load) { $.fn.spectrum.processNativeColorInputs();