Merge pull request #535 from Aktanusa/master (JSColor update)
Update dev with JSColor
This commit is contained in:
@@ -3318,13 +3318,12 @@ CM.Disp.CreatePrefOption = function(config) {
|
|||||||
var innerDiv = document.createElement('div');
|
var innerDiv = document.createElement('div');
|
||||||
innerDiv.className = 'listing';
|
innerDiv.className = 'listing';
|
||||||
var input = document.createElement('input');
|
var input = document.createElement('input');
|
||||||
input.id = CM.ConfigPrefix + 'Color' + CM.Disp.colors[i];
|
input.id = CM.Disp.colors[i];
|
||||||
input.className = 'option';
|
|
||||||
input.style.width = '65px';
|
input.style.width = '65px';
|
||||||
input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]);
|
input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]);
|
||||||
innerDiv.appendChild(input);
|
innerDiv.appendChild(input);
|
||||||
eval('var change = function() {CM.Options.Colors[\'' + CM.Disp.colors[i] + '\'] = l(CM.ConfigPrefix + \'Color\' + \'' + CM.Disp.colors[i] + '\').value; CM.Disp.UpdateColors(); CM.Config.SaveConfig();}');
|
let change = function() {CM.Options.Colors[this.targetElement.id] = this.toHEXString(); CM.Disp.UpdateColors(); CM.Config.SaveConfig();};
|
||||||
var jscolorpicker = new jscolor.color(input, {hash: true, caps: false, pickerZIndex: 1000000, pickerPosition: 'right', onImmediateChange: change});
|
let picker = new JSColor(input, {hash: true, position: "right", onInput: change})
|
||||||
var label = document.createElement('label');
|
var label = document.createElement('label');
|
||||||
label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]];
|
label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]];
|
||||||
innerDiv.appendChild(label);
|
innerDiv.appendChild(label);
|
||||||
@@ -5641,11 +5640,13 @@ CM.Footer.AddJscolor = function() {
|
|||||||
CM.Footer.Jscolor.type = 'text/javascript';
|
CM.Footer.Jscolor.type = 'text/javascript';
|
||||||
CM.Footer.Jscolor.setAttribute('src', 'https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js');
|
CM.Footer.Jscolor.setAttribute('src', 'https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js');
|
||||||
document.head.appendChild(CM.Footer.Jscolor);
|
document.head.appendChild(CM.Footer.Jscolor);
|
||||||
|
jscolor.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions starts the initizialization and register CookieMonster
|
* This functions starts the initizialization and register CookieMonster
|
||||||
* It is called as the last function in this script's execution
|
* It is called as the last function in this script's execution
|
||||||
|
* TODO: Make this async await
|
||||||
*/
|
*/
|
||||||
if (!CM.isRunning) {
|
if (!CM.isRunning) {
|
||||||
CM.Footer.AddJscolor();
|
CM.Footer.AddJscolor();
|
||||||
|
|||||||
3969
jscolor/jscolor.js
3969
jscolor/jscolor.js
File diff suppressed because it is too large
Load Diff
@@ -2106,13 +2106,12 @@ CM.Disp.CreatePrefOption = function(config) {
|
|||||||
var innerDiv = document.createElement('div');
|
var innerDiv = document.createElement('div');
|
||||||
innerDiv.className = 'listing';
|
innerDiv.className = 'listing';
|
||||||
var input = document.createElement('input');
|
var input = document.createElement('input');
|
||||||
input.id = CM.ConfigPrefix + 'Color' + CM.Disp.colors[i];
|
input.id = CM.Disp.colors[i];
|
||||||
input.className = 'option';
|
|
||||||
input.style.width = '65px';
|
input.style.width = '65px';
|
||||||
input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]);
|
input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]);
|
||||||
innerDiv.appendChild(input);
|
innerDiv.appendChild(input);
|
||||||
eval('var change = function() {CM.Options.Colors[\'' + CM.Disp.colors[i] + '\'] = l(CM.ConfigPrefix + \'Color\' + \'' + CM.Disp.colors[i] + '\').value; CM.Disp.UpdateColors(); CM.Config.SaveConfig();}');
|
let change = function() {CM.Options.Colors[this.targetElement.id] = this.toHEXString(); CM.Disp.UpdateColors(); CM.Config.SaveConfig();};
|
||||||
var jscolorpicker = new jscolor.color(input, {hash: true, caps: false, pickerZIndex: 1000000, pickerPosition: 'right', onImmediateChange: change});
|
let picker = new JSColor(input, {hash: true, position: "right", onInput: change})
|
||||||
var label = document.createElement('label');
|
var label = document.createElement('label');
|
||||||
label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]];
|
label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]];
|
||||||
innerDiv.appendChild(label);
|
innerDiv.appendChild(label);
|
||||||
|
|||||||
@@ -56,11 +56,13 @@ CM.Footer.AddJscolor = function() {
|
|||||||
CM.Footer.Jscolor.type = 'text/javascript';
|
CM.Footer.Jscolor.type = 'text/javascript';
|
||||||
CM.Footer.Jscolor.setAttribute('src', 'https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js');
|
CM.Footer.Jscolor.setAttribute('src', 'https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js');
|
||||||
document.head.appendChild(CM.Footer.Jscolor);
|
document.head.appendChild(CM.Footer.Jscolor);
|
||||||
|
jscolor.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions starts the initizialization and register CookieMonster
|
* This functions starts the initizialization and register CookieMonster
|
||||||
* It is called as the last function in this script's execution
|
* It is called as the last function in this script's execution
|
||||||
|
* TODO: Make this async await
|
||||||
*/
|
*/
|
||||||
if (!CM.isRunning) {
|
if (!CM.isRunning) {
|
||||||
CM.Footer.AddJscolor();
|
CM.Footer.AddJscolor();
|
||||||
|
|||||||
Reference in New Issue
Block a user