spectrum-rails 1.1.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  module Spectrum
2
2
  module Rails
3
- VERSION = "1.1.4"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- // Spectrum Colorpicker v1.1.2+
1
+ // Spectrum Colorpicker v1.2.0
2
2
  // https://github.com/bgrins/spectrum
3
3
  // Author: Brian Grinstead
4
4
  // License: MIT
@@ -49,6 +49,10 @@
49
49
  style.cssText = 'background-color:rgba(0,0,0,.5)';
50
50
  return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla');
51
51
  })(),
52
+ inputTypeColorSupport = (function() {
53
+ var colorInput = $("<input type='color' value='!' />")[0];
54
+ return colorInput.type === "color" && colorInput.value !== "!";
55
+ })(),
52
56
  replaceInput = [
53
57
  "<div class='sp-replacer'>",
54
58
  "<div class='sp-preview'><div class='sp-preview-inner'></div></div>",
@@ -192,6 +196,7 @@
192
196
  clearButton = container.find(".sp-clear"),
193
197
  chooseButton = container.find(".sp-choose"),
194
198
  isInput = boundElement.is("input"),
199
+ isInputTypeColor = isInput && inputTypeColorSupport && boundElement.attr("type") === "color",
195
200
  shouldReplace = isInput && !flat,
196
201
  replacer = (shouldReplace) ? $(replaceInput).addClass(theme).addClass(opts.className) : $([]),
197
202
  offsetElement = (shouldReplace) ? replacer : boundElement,
@@ -202,8 +207,7 @@
202
207
  currentPreferredFormat = preferredFormat,
203
208
  clickoutFiresChange = !opts.showButtons || opts.clickoutFiresChange,
204
209
  isEmpty = !initialColor,
205
- allowEmpty = opts.allowEmpty;
206
-
210
+ allowEmpty = opts.allowEmpty && !isInputTypeColor;
207
211
 
208
212
  function applyOptions() {
209
213
 
@@ -214,7 +218,7 @@
214
218
  container.toggleClass("sp-flat", flat);
215
219
  container.toggleClass("sp-input-disabled", !opts.showInput);
216
220
  container.toggleClass("sp-alpha-enabled", opts.showAlpha);
217
- container.toggleClass("sp-clear-enabled", opts.allowEmpty);
221
+ container.toggleClass("sp-clear-enabled", allowEmpty);
218
222
  container.toggleClass("sp-buttons-disabled", !opts.showButtons);
219
223
  container.toggleClass("sp-palette-disabled", !opts.showPalette);
220
224
  container.toggleClass("sp-palette-only", opts.showPaletteOnly);
@@ -1076,10 +1080,7 @@
1076
1080
  $.spectrum.palettes = { };
1077
1081
 
1078
1082
  $.fn.spectrum.processNativeColorInputs = function () {
1079
- var colorInput = $("<input type='color' value='!' />")[0];
1080
- var supportsColor = colorInput.type === "color" && colorInput.value != "!";
1081
-
1082
- if (!supportsColor) {
1083
+ if (!inputTypeColorSupport) {
1083
1084
  $("input[type=color]").spectrum({
1084
1085
  preferredFormat: "hex6"
1085
1086
  });
@@ -1,5 +1,5 @@
1
1
  /***
2
- Spectrum Colorpicker v1.1.2+
2
+ Spectrum Colorpicker v1.2.0
3
3
  https://github.com/bgrins/spectrum
4
4
  Author: Brian Grinstead
5
5
  License: MIT
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spectrum-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-26 00:00:00.000000000 Z
12
+ date: 2013-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties