MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / appendRemoteOutputToLine

Function appendRemoteOutputToLine

lib/web/output.js:34–205  ·  view source on GitHub ↗
(line, text, checkClass, lineClass, append, tick)

Source from the content-addressed store, hash-verified

32
33
34function appendRemoteOutputToLine(line, text, checkClass, lineClass, append, tick) {
35
36 text = text.trim()
37
38 // console.log(" will safe render json? ||"+text.startsWith("<json>")+"||")
39 if (text.startsWith("<json>"))
40 {
41 text = safeRenderJSON(text)
42 append = false
43 }
44
45 // console.log("hello")
46 lh = cm.getLineHandle(line);
47 if (!lh) {
48 return;
49 }
50
51 w = cm.lineInfo(lh).widgets;
52 found = null;
53
54 if (w)
55 for (var i = 0; i < w.length; i++) {
56 var ele = $(w[i].node);
57 if (ele.hasClass(checkClass) || ele.hasClass(lineClass)) {
58 // if (!append) {
59 // w[i].clear();
60 // i--;
61 // } else {
62 // append = false;
63 found = w[i];
64 // }
65 }
66 }
67
68 var bm;
69
70 if (found != null) {
71 d = found.node;
72 d.lastOutputAt = new Date().valueOf();
73 d.tick = tick
74
75 var D = $(d)
76 D.removeClass(checkClass);
77 D.removeClass(lineClass);
78 D.addClass(lineClass);
79
80 if (!append) {
81 D.find(".outputline").remove();
82 }
83 else {
84 // console.log(" children length is " + $(d).children().length)
85 // console.log(" appending ? ")
86 if (D.children().length > 32) {
87 D.find(".outputline").remove();
88 D.append("<div class='outputline'>[...]</div>");
89 }
90 }
91 D.append($("<div class='outputline'></div>").append(text))

Callers 8

output.jsFile · 0.85
executeBracketFunction · 0.85
executeBracketLimitedFunction · 0.85
ImportFunction · 0.85
Run_AllFunction · 0.85
Run_BeginFunction · 0.85
Run_EndFunction · 0.85
Run_Selection_variantFunction · 0.85

Calls 15

safeRenderJSONFunction · 0.85
updateAllBracketsFunction · 0.85
valueOfMethod · 0.80
childrenMethod · 0.80
animateMethod · 0.80
clickMethod · 0.80
hoverMethod · 0.80
$Function · 0.70
removeMethod · 0.45
findMethod · 0.45
appendMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected