Light icon works, log scroll still broken

This commit is contained in:
Matt 2016-04-13 16:59:00 -04:00
parent c4809047d5
commit 6dd6f755c9
2 changed files with 66 additions and 46 deletions

View File

@ -2485,8 +2485,8 @@ log.display = function (action, service, status, time) {
setTimeout(function () { setTimeout(function () {
$('#grid_log_table').animate({ $('#grid_log_table').animate({
scrollTop: $('#grid_log_table').prop('scrollHeight') scrollTop: $('#grid_log_table').prop('scrollHeight')
}, 0); }, 100);
}, 1); }, 100);
return obj; return obj;
}; };
@ -2506,7 +2506,14 @@ log.info = function (action, service, status, time) {
light.preview = false; light.preview = false;
light.color = [0, 0, 0]; //preview status light.color = [0, 0, 0]; //preview status
light.current = [0, 0, 0]; //last sent light.current = [0, 0, 0]; //last sent
light.icon = {};
light.init = function () { light.init = function () {
'use strict';
light.icon = document.createElement('style');
light.icon.innerHTML = 'span.mcopy-light{background-color: #000;}';
document.body.appendChild(light.icon);
$('#colors-tabs').w2tabs({ $('#colors-tabs').w2tabs({
name: 'colors', name: 'colors',
active: 'rgb', active: 'rgb',
@ -2557,25 +2564,26 @@ light.init = function () {
}, // see Colors... }, // see Colors...
});*/ });*/
var colors = jsColorPicker('#rgb', { var colors = jsColorPicker('#rgb', {
customBG: '#222', customBG: '#222',
readOnly: true, readOnly: true,
size: 3, size: 3,
// patch: false, appendTo : document.getElementById('rgb-page'),
init: function(elm, colors) { // colors is a different instance (not connected to colorPicker) // patch: false,
elm.style.backgroundColor = elm.value; init: function(elm, colors) { // colors is a different instance (not connected to colorPicker)
elm.style.color = colors.rgbaMixCustom.luminance > 0.22 ? '#222' : '#ddd'; elm.style.backgroundColor = elm.value;
}, elm.style.color = colors.rgbaMixCustom.luminance > 0.22 ? '#222' : '#ddd';
convertCallback: function(colors, type){ },
var a = colors.RND.rgb, convertCallback: function(colors, type){
rgb = [a.r, a.g, a.b]; var a = colors.RND.rgb,
light.color = rgb; rgb = [a.r, a.g, a.b];
if (light.preview) { light.color = rgb;
light.display(rgb); if (light.preview) {
light.set(rgb); light.display(rgb);
} light.set(rgb);
}
} }
}); });
light.display([0, 0, 0]); light.display([0, 0, 0]);
$('#preview').on('change', function () { $('#preview').on('change', function () {
light.preview = $(this).prop('checked'); light.preview = $(this).prop('checked');
@ -2605,15 +2613,15 @@ light.display = function (rgb) {
} }
str = 'rgb(' + rgb.join(',') + ')'; str = 'rgb(' + rgb.join(',') + ')';
$('#color').css('background-color', str); $('#color').css('background-color', str);
$('.mcopy-light').css('background-color', str); light.icon = document.styleSheets[document.styleSheets.length - 1];
light.icon.deleteRule(0);
light.icon.insertRule('span.mcopy-light{background-color: ' + str + ';}', 0)
}; };
light.color_on = false; light.color_on = false;
light.color_init = function () { light.color_init = function () {
'use strict'; 'use strict';
if (!light.color_on) { if (!light.color_on) {
$('#rgb').focus(); $('#rgb').focus();
$('.cp-app').appendTo('#rgb-page');
light.color_on = true;
} }
}; };
@ -2641,6 +2649,8 @@ nav.change = function (id) {
$('#' + id).show(); $('#' + id).show();
if (id === 'light') { if (id === 'light') {
light.color_init(); light.color_init();
} else if (id === 'controls') {
w2ui['log'].resize();
} }
}; };

View File

@ -48,8 +48,8 @@ log.display = function (action, service, status, time) {
setTimeout(function () { setTimeout(function () {
$('#grid_log_table').animate({ $('#grid_log_table').animate({
scrollTop: $('#grid_log_table').prop('scrollHeight') scrollTop: $('#grid_log_table').prop('scrollHeight')
}, 0); }, 100);
}, 1); }, 100);
return obj; return obj;
}; };
@ -69,7 +69,14 @@ log.info = function (action, service, status, time) {
light.preview = false; light.preview = false;
light.color = [0, 0, 0]; //preview status light.color = [0, 0, 0]; //preview status
light.current = [0, 0, 0]; //last sent light.current = [0, 0, 0]; //last sent
light.icon = {};
light.init = function () { light.init = function () {
'use strict';
light.icon = document.createElement('style');
light.icon.innerHTML = 'span.mcopy-light{background-color: #000;}';
document.body.appendChild(light.icon);
$('#colors-tabs').w2tabs({ $('#colors-tabs').w2tabs({
name: 'colors', name: 'colors',
active: 'rgb', active: 'rgb',
@ -120,25 +127,26 @@ light.init = function () {
}, // see Colors... }, // see Colors...
});*/ });*/
var colors = jsColorPicker('#rgb', { var colors = jsColorPicker('#rgb', {
customBG: '#222', customBG: '#222',
readOnly: true, readOnly: true,
size: 3, size: 3,
// patch: false, appendTo : document.getElementById('rgb-page'),
init: function(elm, colors) { // colors is a different instance (not connected to colorPicker) // patch: false,
elm.style.backgroundColor = elm.value; init: function(elm, colors) { // colors is a different instance (not connected to colorPicker)
elm.style.color = colors.rgbaMixCustom.luminance > 0.22 ? '#222' : '#ddd'; elm.style.backgroundColor = elm.value;
}, elm.style.color = colors.rgbaMixCustom.luminance > 0.22 ? '#222' : '#ddd';
convertCallback: function(colors, type){ },
var a = colors.RND.rgb, convertCallback: function(colors, type){
rgb = [a.r, a.g, a.b]; var a = colors.RND.rgb,
light.color = rgb; rgb = [a.r, a.g, a.b];
if (light.preview) { light.color = rgb;
light.display(rgb); if (light.preview) {
light.set(rgb); light.display(rgb);
} light.set(rgb);
}
} }
}); });
light.display([0, 0, 0]); light.display([0, 0, 0]);
$('#preview').on('change', function () { $('#preview').on('change', function () {
light.preview = $(this).prop('checked'); light.preview = $(this).prop('checked');
@ -168,15 +176,15 @@ light.display = function (rgb) {
} }
str = 'rgb(' + rgb.join(',') + ')'; str = 'rgb(' + rgb.join(',') + ')';
$('#color').css('background-color', str); $('#color').css('background-color', str);
$('.mcopy-light').css('background-color', str); light.icon = document.styleSheets[document.styleSheets.length - 1];
light.icon.deleteRule(0);
light.icon.insertRule('span.mcopy-light{background-color: ' + str + ';}', 0)
}; };
light.color_on = false; light.color_on = false;
light.color_init = function () { light.color_init = function () {
'use strict'; 'use strict';
if (!light.color_on) { if (!light.color_on) {
$('#rgb').focus(); $('#rgb').focus();
$('.cp-app').appendTo('#rgb-page');
light.color_on = true;
} }
}; };
@ -204,6 +212,8 @@ nav.change = function (id) {
$('#' + id).show(); $('#' + id).show();
if (id === 'light') { if (id === 'light') {
light.color_init(); light.color_init();
} else if (id === 'controls') {
w2ui['log'].resize();
} }
}; };