mirror of
https://github.com/PitPik/colorPicker.git
synced 2025-08-15 05:02:44 -06:00
Added cookie store functionality for size and mode
This commit is contained in:
parent
b70d35f98a
commit
61f9438907
@ -855,10 +855,11 @@
|
|||||||
y = isSize ? size : page.Y - _targetOrigin.top + 8,
|
y = isSize ? size : page.Y - _targetOrigin.top + 8,
|
||||||
values = [' S XS XXS', ' S XS', ' S', ''],
|
values = [' S XS XXS', ' S XS', ' S', ''],
|
||||||
sizes = _options.sizes, // from getUISizes();
|
sizes = _options.sizes, // from getUISizes();
|
||||||
value = isSize ? values[size] :
|
currentSize = isSize ? size :
|
||||||
y < sizes.XXS[1] + 25 ? values[0] :
|
y < sizes.XXS[1] + 25 ? 0 :
|
||||||
x < sizes.XS[0] + 25? values[1] :
|
x < sizes.XS[0] + 25? 1 :
|
||||||
x < sizes.S[0] + 25 || y < sizes.S[1] + 25 ? values[2] : values[3],
|
x < sizes.S[0] + 25 || y < sizes.S[1] + 25 ? 2 : 3,
|
||||||
|
value = values[currentSize],
|
||||||
isXXS = false,
|
isXXS = false,
|
||||||
mode,
|
mode,
|
||||||
tmp = '';
|
tmp = '';
|
||||||
@ -878,6 +879,7 @@
|
|||||||
|
|
||||||
_nodes.colorPicker.className = _nodes.colorPicker.className.replace(/\s+(?:S|XS|XXS)/g, '') + value;
|
_nodes.colorPicker.className = _nodes.colorPicker.className.replace(/\s+(?:S|XS|XXS)/g, '') + value;
|
||||||
_options.scale = isXXS ? 4 : /S/.test(value) ? 2 : 1;
|
_options.scale = isXXS ? 4 : /S/.test(value) ? 2 : 1;
|
||||||
|
_options.currentSize = currentSize;
|
||||||
|
|
||||||
_cashedVars.resizer = value;
|
_cashedVars.resizer = value;
|
||||||
|
|
||||||
|
@ -33,8 +33,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actionCallback = function(event, action) {
|
actionCallback = function(event, action) {
|
||||||
if (action === 'toMemery') { // create cookie string out of memory colors
|
var colorPicker = colorPickers.current;
|
||||||
var memos = colorPickers.current.nodes.memos,
|
|
||||||
|
if (action === 'toMemery') {
|
||||||
|
var memos = colorPicker.nodes.memos,
|
||||||
$memo,
|
$memo,
|
||||||
backgroundColor = '',
|
backgroundColor = '',
|
||||||
opacity = 0,
|
opacity = 0,
|
||||||
@ -51,8 +53,13 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
cookieTXT = '\'' + cookieTXT.join('\',\'') + '\'';
|
cookieTXT = '\'' + cookieTXT.join('\',\'') + '\'';
|
||||||
// console.log(cookieTXT);
|
|
||||||
$.docCookies('colorPickerMemos', cookieTXT);
|
$.docCookies('colorPickerMemos', cookieTXT);
|
||||||
|
} else if (action === 'resizeApp') {
|
||||||
|
$.docCookies('colorPickerSize', colorPicker.color.options.currentSize);
|
||||||
|
} else if (action === 'modeChange') {
|
||||||
|
var mode = colorPicker.color.options.mode;
|
||||||
|
|
||||||
|
$.docCookies('colorPickerMode', mode.type + '-' + mode.z);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createInstance = function(elm, config) {
|
createInstance = function(elm, config) {
|
||||||
@ -64,13 +71,13 @@
|
|||||||
animationSpeed: 200,
|
animationSpeed: 200,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
margin: {left: -1, top: 2},
|
margin: {left: -1, top: 2},
|
||||||
memoryColors: $.docCookies('colorPickerMemos'),
|
|
||||||
// displayCallback: displayCallback,
|
// displayCallback: displayCallback,
|
||||||
/* --- regular colorPicker options from this point --- */
|
/* --- regular colorPicker options from this point --- */
|
||||||
color: elm.value, // this has to go to focus as well!!!
|
color: elm.value, // this has to go to focus as well!!!
|
||||||
initStyle: 'display: none',
|
initStyle: 'display: none',
|
||||||
mode: 'hsv-h',
|
mode: $.docCookies('colorPickerMode') || 'hsv-h',
|
||||||
size: 1,
|
memoryColors: $.docCookies('colorPickerMemos'),
|
||||||
|
size: $.docCookies('colorPickerSize') || 1,
|
||||||
renderCallback: renderCallback,
|
renderCallback: renderCallback,
|
||||||
actionCallback: actionCallback
|
actionCallback: actionCallback
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user