Use jscolor contrast values
This commit is contained in:
parent
03f65438fd
commit
6d0154fb4d
@ -26,7 +26,6 @@ define([
|
|||||||
|
|
||||||
|
|
||||||
'/kanban/jkanban.js',
|
'/kanban/jkanban.js',
|
||||||
'/common/jscolor.js',
|
|
||||||
'css!/kanban/jkanban.css',
|
'css!/kanban/jkanban.css',
|
||||||
'less!/kanban/app-kanban.less'
|
'less!/kanban/app-kanban.less'
|
||||||
], function (
|
], function (
|
||||||
@ -66,9 +65,6 @@ define([
|
|||||||
// use cursor channel to tell others what you are editing
|
// use cursor channel to tell others what you are editing
|
||||||
// add outline + warning inside the modal?
|
// add outline + warning inside the modal?
|
||||||
|
|
||||||
// XXX
|
|
||||||
// Fix contrast on migrated card (squad kanban green cards)
|
|
||||||
|
|
||||||
var setValueAndCursor = function (input, val, _cursor) {
|
var setValueAndCursor = function (input, val, _cursor) {
|
||||||
if (!input) { return; }
|
if (!input) { return; }
|
||||||
var $input = $(input);
|
var $input = $(input);
|
||||||
@ -586,54 +582,6 @@ define([
|
|||||||
framework.localChange();
|
framework.localChange();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
colorClick: function (el, type) {
|
|
||||||
if (framework.isReadOnly() || framework.isLocked()) { return; }
|
|
||||||
verbose("on color click");
|
|
||||||
var boardJSON;
|
|
||||||
var board;
|
|
||||||
if (type === "board") {
|
|
||||||
verbose("board color click");
|
|
||||||
board = $(el.parentNode).attr("data-id");
|
|
||||||
boardJSON = kanban.getBoardJSON(board);
|
|
||||||
} else {
|
|
||||||
verbose("item color click");
|
|
||||||
board = $(el.parentNode.parentNode).attr("data-id");
|
|
||||||
var pos = kanban.findElementPosition(el);
|
|
||||||
boardJSON = kanban.getBoardJSON(board).item[pos];
|
|
||||||
}
|
|
||||||
var onchange = function (colorL) {
|
|
||||||
var elL = el;
|
|
||||||
var typeL = type;
|
|
||||||
var boardJSONL;
|
|
||||||
var boardL;
|
|
||||||
if (typeL === "board") {
|
|
||||||
verbose("board color change");
|
|
||||||
boardL = $(elL.parentNode).attr("data-id");
|
|
||||||
boardJSONL = kanban.getBoardJSON(boardL);
|
|
||||||
} else {
|
|
||||||
verbose("item color change");
|
|
||||||
boardL = $(elL.parentNode.parentNode).attr("data-id");
|
|
||||||
var pos = kanban.findElementPosition(elL);
|
|
||||||
boardJSONL = kanban.getBoardJSON(boardL).item[pos];
|
|
||||||
}
|
|
||||||
var currentColor = boardJSONL.color;
|
|
||||||
verbose("Current color " + currentColor);
|
|
||||||
if (currentColor !== colorL.toString()) {
|
|
||||||
$(elL).removeClass("kanban-header-" + currentColor);
|
|
||||||
boardJSONL.color = colorL.toString();
|
|
||||||
kanban.onChange();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var jscolorL;
|
|
||||||
el._jscLinkedInstance = undefined;
|
|
||||||
jscolorL = new window.jscolor(el,{showOnClick: false, onFineChange: onchange, valueElement:undefined});
|
|
||||||
jscolorL.show();
|
|
||||||
var currentColor = boardJSON.color;
|
|
||||||
if (currentColor === undefined) {
|
|
||||||
currentColor = '';
|
|
||||||
}
|
|
||||||
jscolorL.fromString(currentColor);
|
|
||||||
},
|
|
||||||
addItemClick: function (el) {
|
addItemClick: function (el) {
|
||||||
if (framework.isReadOnly() || framework.isLocked()) { return; }
|
if (framework.isReadOnly() || framework.isLocked()) { return; }
|
||||||
if (kanban.inEditMode) {
|
if (kanban.inEditMode) {
|
||||||
|
|||||||
@ -69,8 +69,6 @@
|
|||||||
dropBoard: function (el, target, source, sibling) {},
|
dropBoard: function (el, target, source, sibling) {},
|
||||||
click: function (el) {},
|
click: function (el) {},
|
||||||
boardTitleclick: function (el, boardId) {},
|
boardTitleclick: function (el, boardId) {},
|
||||||
buttonClick: function (el, boardId) {},
|
|
||||||
colorClick: function (el, type) {},
|
|
||||||
addItemClick: function (el, boardId) {},
|
addItemClick: function (el, boardId) {},
|
||||||
renderMd: function (md) {},
|
renderMd: function (md) {},
|
||||||
refresh: function () {},
|
refresh: function () {},
|
||||||
@ -85,6 +83,7 @@
|
|||||||
// set initial boards
|
// set initial boards
|
||||||
__setBoard();
|
__setBoard();
|
||||||
|
|
||||||
|
// Scroll on drag
|
||||||
var $el = $(self.element)
|
var $el = $(self.element)
|
||||||
var $inner = $el.find('.kanban-container');
|
var $inner = $el.find('.kanban-container');
|
||||||
var leftRegion = $el.position().left + 10;
|
var leftRegion = $el.position().left + 10;
|
||||||
@ -99,6 +98,7 @@
|
|||||||
$el.scrollLeft(distance + $el.scrollLeft()) ;
|
$el.scrollLeft(distance + $el.scrollLeft()) ;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//set drag with dragula
|
//set drag with dragula
|
||||||
if (window.innerWidth > self.options.responsive) {
|
if (window.innerWidth > self.options.responsive) {
|
||||||
|
|
||||||
@ -333,7 +333,7 @@
|
|||||||
var r = parseInt(hex.slice(0,2), 16);
|
var r = parseInt(hex.slice(0,2), 16);
|
||||||
var g = parseInt(hex.slice(2,4), 16);
|
var g = parseInt(hex.slice(2,4), 16);
|
||||||
var b = parseInt(hex.slice(4,6), 16);
|
var b = parseInt(hex.slice(4,6), 16);
|
||||||
if ((r*0.299 + g*0.587 + b*0.114) > 186) {
|
if ((r*0.213 + g*0.715 + b*0.072) > 255/2) {
|
||||||
return '#000000';
|
return '#000000';
|
||||||
}
|
}
|
||||||
return '#FFFFFF';
|
return '#FFFFFF';
|
||||||
@ -394,7 +394,6 @@
|
|||||||
nodeItem.dragendfn = element.dragend;
|
nodeItem.dragendfn = element.dragend;
|
||||||
nodeItem.dropfn = element.drop;
|
nodeItem.dropfn = element.drop;
|
||||||
__onclickHandler(nodeItemText);
|
__onclickHandler(nodeItemText);
|
||||||
//__onColorClickHandler(nodeItem, "item");
|
|
||||||
return nodeItem;
|
return nodeItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -601,11 +600,6 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
// board button on click function
|
|
||||||
this.onButtonClick = function (el) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.renderMd = function (md) {
|
this.renderMd = function (md) {
|
||||||
return self.options.renderMd(md);
|
return self.options.renderMd(md);
|
||||||
}
|
}
|
||||||
@ -687,17 +681,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function __onColorClickHandler(nodeItem, type) {
|
|
||||||
nodeItem.addEventListener('click', function (e) {
|
|
||||||
if (Array.prototype.slice.call(nodeItem.classList).indexOf('is-moving') !== -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
e.preventDefault;
|
|
||||||
e.stopPropagation();
|
|
||||||
self.options.colorClick(this, type);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function __onAddItemClickHandler(nodeItem, clickfn) {
|
function __onAddItemClickHandler(nodeItem, clickfn) {
|
||||||
nodeItem.addEventListener('click', function (e) {
|
nodeItem.addEventListener('click', function (e) {
|
||||||
e.preventDefault;
|
e.preventDefault;
|
||||||
@ -708,16 +691,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function __onButtonClickHandler(nodeItem, boardId) {
|
|
||||||
nodeItem.addEventListener('click', function (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault;
|
|
||||||
self.options.buttonClick(this, boardId, e);
|
|
||||||
// if(typeof(this.clickfn) === 'function')
|
|
||||||
// this.clickfn(this);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function __findBoardJSON(id) {
|
function __findBoardJSON(id) {
|
||||||
return (self.options.boards.data || {})[id];
|
return (self.options.boards.data || {})[id];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user