|
|
|
@ -50,21 +50,7 @@ var loadJquery = function()
|
|
|
|
|
$('.clockpicker').clockpicker();
|
|
|
|
|
|
|
|
|
|
// Set the proper text color for background-volatile elements
|
|
|
|
|
$('.background-volatile').each(function() {
|
|
|
|
|
$this = $(this);
|
|
|
|
|
var background = $this.css('background-color');
|
|
|
|
|
|
|
|
|
|
if (background !== 'rgba(0, 0, 0, 0)'
|
|
|
|
|
&& background !== 'transparent') {
|
|
|
|
|
var grayCount = calculateGrayCount(background);
|
|
|
|
|
|
|
|
|
|
if (grayCount > 186) {
|
|
|
|
|
$this.css('color', '#000');
|
|
|
|
|
} else {
|
|
|
|
|
$this.css('color', '#fff');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
refreshBackgroundVolatileItems();
|
|
|
|
|
|
|
|
|
|
// Initialize colorpicker
|
|
|
|
|
$('.colorpicker-trigger').colorpicker({
|
|
|
|
@ -101,6 +87,24 @@ var loadJquery = function()
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function refreshBackgroundVolatileItems() {
|
|
|
|
|
$('.background-volatile').each(function() {
|
|
|
|
|
$this = $(this);
|
|
|
|
|
var background = $this.css('background-color');
|
|
|
|
|
|
|
|
|
|
if (background !== 'rgba(0, 0, 0, 0)'
|
|
|
|
|
&& background !== 'transparent') {
|
|
|
|
|
var grayCount = calculateGrayCount(background);
|
|
|
|
|
|
|
|
|
|
if (grayCount > 186) {
|
|
|
|
|
$this.css('color', '#000');
|
|
|
|
|
} else {
|
|
|
|
|
$this.css('color', '#fff');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function calculateGrayCount(background) {
|
|
|
|
|
var parts = background.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
|
|
|
|
var red = parts[1];
|
|
|
|
|