2
0
mirror of https://github.com/PitPik/colorPicker.git synced 2025-09-24 16:40:57 -06:00

Add namespace

Add a namespace to allow storing the colorpicker into "namespace" instead "window".
Need: create the variable CPNamespace before calling executing the script.
This commit is contained in:
Ruben Almeida 2017-01-27 00:12:36 +01:00 committed by GitHub
parent f075a98153
commit 3341878f17

View File

@ -1,4 +1,4 @@
(function ($, window) { (function ($, window, namespace) {
$.fn.extend({ $.fn.extend({
colorPicker: function(config) { colorPicker: function(config) {
var renderCallback = function(colors, mode) { var renderCallback = function(colors, mode) {
@ -65,7 +65,7 @@
}, },
createInstance = function(elm, config) { createInstance = function(elm, config) {
var initConfig = { var initConfig = {
klass: window.ColorPicker, klass: namespace.ColorPicker,
input: elm, input: elm,
patch: elm, patch: elm,
isIE8: !!document.all && !document.addEventListener, // Opera??? isIE8: !!document.all && !document.addEventListener, // Opera???
@ -163,7 +163,7 @@
}, },
that = this, that = this,
colorPickers = $.fn.colorPicker.colorPickers || [], // this is a way to prevent data binding on HTMLElements colorPickers = $.fn.colorPicker.colorPickers || [], // this is a way to prevent data binding on HTMLElements
testColors = new window.Colors({ testColors = new namespace.Colors({
customBG: (config && config.customBG) || '#FFFFFF', customBG: (config && config.customBG) || '#FFFFFF',
allMixDetails: true allMixDetails: true
}); });
@ -227,4 +227,4 @@
(options.secure ? '; secure' : ''); (options.secure ? '; secure' : '');
} }
}; };
})(jQuery, this); })(jQuery, this, CPNamespace||window);