Skip to content

Commit

Permalink
Merge pull request #3398 from nonumber/patch-6
Browse files Browse the repository at this point in the history
Fixed hide issue of the simple color swatch in Internet Explorer
  • Loading branch information
infograf768 committed Apr 13, 2014
2 parents b54a63d + 54043c8 commit 260312a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 42 deletions.
37 changes: 14 additions & 23 deletions media/jui/js/jquery.simplecolors.js
Expand Up @@ -8,19 +8,16 @@
* Copyright (C) 2013 Peter van Westen
*/

(function($)
{
var SimpleColorPicker = function(element, options)
{
(function($) {
var SimpleColorPicker = function(element, options) {
this.select = $(element);
this.options = $.extend({}, $.fn.simplecolors.defaults, options);

this.select.hide();

// Build the list of colors
var list = '';
$('option', this.select).each(function()
{
$('option', this.select).each(function() {
var option = $(this);
var color = option.val();
if (option.text() == '-') {
Expand Down Expand Up @@ -63,8 +60,7 @@
SimpleColorPicker.prototype = {
constructor: SimpleColorPicker,

show: function()
{
show: function() {
var panelpadding = 7; // Empirical value
var pos = this.icon.offset();
switch (this.select.attr('data-position')) {
Expand Down Expand Up @@ -98,13 +94,13 @@
this.panel.show(this.options.delay);
},

hide: function()
{
this.panel.hide(this.options.delay);
hide: function() {
if (this.panel.css('display') != 'none') {
this.panel.hide(this.options.delay);
}
},

click: function(e)
{
click: function(e) {
var target = $(e.target);
if (target.length === 1) {
if (target[0].nodeName.toLowerCase() === 'span') {
Expand Down Expand Up @@ -141,8 +137,7 @@
/**
* Prevents the mousedown event from "eating" the click event.
*/
mousedown: function(e)
{
mousedown: function(e) {
e.stopPropagation();
e.preventDefault();
},
Expand All @@ -152,10 +147,8 @@
*
* See http://stackoverflow.com/questions/1740700/get-hex-value-rather-than-rgb-value-using-$
*/
rgb2hex: function(rgb)
{
function hex(x)
{
rgb2hex: function(rgb) {
function hex(x) {
return ("0" + parseInt(x, 10).toString(16)).slice(-2);
}

Expand All @@ -173,11 +166,9 @@
/**
* Plugin definition.
*/
$.fn.simplecolors = function(option)
{
$.fn.simplecolors = function(option) {
// For HTML element passed to the plugin
return this.each(function()
{
return this.each(function() {
var $this = $(this),
data = $this.data('simplecolors'),
options = typeof option === 'object' && option;
Expand Down
25 changes: 6 additions & 19 deletions media/jui/js/jquery.simplecolors.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 260312a

Please sign in to comment.