1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

use jQuery DOM manipulation instead of raw JS

This commit is contained in:
Hiroyasu Nishiyama 2019-05-09 18:06:10 +09:00
parent 742bf85a89
commit 13cf2b48e1

View File

@ -400,48 +400,47 @@ RED.debug = (function() {
} }
function processDebugMessage(o) { function processDebugMessage(o) {
var msg = document.createElement("div"); var msg = $("<div/>");
var sourceNode = o._source; var sourceNode = o._source;
msg.onmouseenter = function() { msg.on("mouseenter", function() {
$(msg).addClass('debug-message-hover'); msg.addClass('debug-message-hover');
if (o._source) { if (o._source) {
config.messageMouseEnter(o._source.id); config.messageMouseEnter(o._source.id);
if (o._source._alias) { if (o._source._alias) {
config.messageMouseEnter(o._source._alias); config.messageMouseEnter(o._source._alias);
} }
} }
});
}; msg.on("mouseleave", function() {
msg.onmouseleave = function() { msg.removeClass('debug-message-hover');
$(msg).removeClass('debug-message-hover');
if (o._source) { if (o._source) {
config.messageMouseLeave(o._source.id); config.messageMouseLeave(o._source.id);
if (o._source._alias) { if (o._source._alias) {
config.messageMouseLeave(o._source._alias); config.messageMouseLeave(o._source._alias);
} }
} }
}; });
var name = sanitize(((o.name?o.name:o.id)||"").toString()); var name = sanitize(((o.name?o.name:o.id)||"").toString());
var topic = sanitize((o.topic||"").toString()); var topic = sanitize((o.topic||"").toString());
var property = sanitize(o.property?o.property:''); var property = sanitize(o.property?o.property:'');
var payload = o.msg; var payload = o.msg;
var format = sanitize((o.format||"").toString()); var format = sanitize((o.format||"").toString());
msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'')+ msg.attr("class", 'debug-message'+(o.level?(' debug-message-level-'+o.level):'')+
(sourceNode?( (sourceNode?(
" debug-message-node-"+sourceNode.id.replace(/\./g,"_")+ " debug-message-node-"+sourceNode.id.replace(/\./g,"_")+
(sourceNode.z?" debug-message-flow-"+sourceNode.z.replace(/\./g,"_"):"") (sourceNode.z?" debug-message-flow-"+sourceNode.z.replace(/\./g,"_"):"")
):""); ):""));
if (sourceNode) { if (sourceNode) {
$(msg).data('source',sourceNode.id); msg.data('source',sourceNode.id);
if (filterType === "filterCurrent" && activeWorkspace) { if (filterType === "filterCurrent" && activeWorkspace) {
if (sourceNode.z && sourceNode.z.replace(/\./g,"_") !== activeWorkspace) { if (sourceNode.z && sourceNode.z.replace(/\./g,"_") !== activeWorkspace) {
$(msg).addClass('hide'); msg.addClass('hide');
} }
} else if (filterType === 'filterSelected'){ } else if (filterType === 'filterSelected'){
if (!!filteredNodes[sourceNode.id]) { if (!!filteredNodes[sourceNode.id]) {
$(msg).addClass('hide'); msg.addClass('hide');
} }
} }
} }
@ -481,7 +480,7 @@ RED.debug = (function() {
errorLvl = 30; errorLvl = 30;
errorLvlType = 'warn'; errorLvlType = 'warn';
} }
$(msg).addClass('debug-message-level-' + errorLvl); msg.addClass('debug-message-level-' + errorLvl);
$('<span class="debug-message-topic">function : (' + errorLvlType + ')</span>').appendTo(metaRow); $('<span class="debug-message-topic">function : (' + errorLvlType + ')</span>').appendTo(metaRow);
} else { } else {
var tools = $('<span class="debug-message-tools button-group"></span>').appendTo(metaRow); var tools = $('<span class="debug-message-tools button-group"></span>').appendTo(metaRow);