(line, text, checkClass, lineClass, append, tick)
| 32 | |
| 33 | |
| 34 | function 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)) |
no test coverage detected