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