mirror of
https://github.com/PitPik/colorPicker.git
synced 2025-08-14 20:52:47 -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,
|
||||
values = [' S XS XXS', ' S XS', ' S', ''],
|
||||
sizes = _options.sizes, // from getUISizes();
|
||||
value = isSize ? values[size] :
|
||||
y < sizes.XXS[1] + 25 ? values[0] :
|
||||
x < sizes.XS[0] + 25? values[1] :
|
||||
x < sizes.S[0] + 25 || y < sizes.S[1] + 25 ? values[2] : values[3],
|
||||
currentSize = isSize ? size :
|
||||
y < sizes.XXS[1] + 25 ? 0 :
|
||||
x < sizes.XS[0] + 25? 1 :
|
||||
x < sizes.S[0] + 25 || y < sizes.S[1] + 25 ? 2 : 3,
|
||||
value = values[currentSize],
|
||||
isXXS = false,
|
||||
mode,
|
||||
tmp = '';
|
||||
@ -878,6 +879,7 @@
|
||||
|
||||
_nodes.colorPicker.className = _nodes.colorPicker.className.replace(/\s+(?:S|XS|XXS)/g, '') + value;
|
||||
_options.scale = isXXS ? 4 : /S/.test(value) ? 2 : 1;
|
||||
_options.currentSize = currentSize;
|
||||
|
||||
_cashedVars.resizer = value;
|
||||
|
||||
|
@ -33,8 +33,10 @@
|
||||
}
|
||||
},
|
||||
actionCallback = function(event, action) {
|
||||
if (action === 'toMemery') { // create cookie string out of memory colors
|
||||
var memos = colorPickers.current.nodes.memos,
|
||||
var colorPicker = colorPickers.current;
|
||||
|
||||
if (action === 'toMemery') {
|
||||
var memos = colorPicker.nodes.memos,
|
||||
$memo,
|
||||
backgroundColor = '',
|
||||
opacity = 0,
|
||||
@ -51,8 +53,13 @@
|
||||
);
|
||||
}
|
||||
cookieTXT = '\'' + cookieTXT.join('\',\'') + '\'';
|
||||
// console.log(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) {
|
||||
@ -64,13 +71,13 @@
|
||||
animationSpeed: 200,
|
||||
draggable: true,
|
||||
margin: {left: -1, top: 2},
|
||||
memoryColors: $.docCookies('colorPickerMemos'),
|
||||
// displayCallback: displayCallback,
|
||||
/* --- regular colorPicker options from this point --- */
|
||||
color: elm.value, // this has to go to focus as well!!!
|
||||
initStyle: 'display: none',
|
||||
mode: 'hsv-h',
|
||||
size: 1,
|
||||
mode: $.docCookies('colorPickerMode') || 'hsv-h',
|
||||
memoryColors: $.docCookies('colorPickerMemos'),
|
||||
size: $.docCookies('colorPickerSize') || 1,
|
||||
renderCallback: renderCallback,
|
||||
actionCallback: actionCallback
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user