Skip to content

Commit 47c7791

Browse files
committed
Replace Prototype.js with native JavaScript
1 parent d502b84 commit 47c7791

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/main/resources/hudson/plugins/build_timeout/nestedHelp.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@
2323
*/
2424
Behaviour.register({".build-timeout-nested-help": function(e) {
2525
// ensure Behavior is applied only once.
26-
$(e).removeClassName("build-timeout-nested-help");
27-
new Ajax.Request(e.getAttribute("helpURL"), {
28-
method : 'get',
29-
onSuccess : function(x) {
30-
e.innerHTML = x.responseText;
31-
var myselfName = e.getAttribute("myselfName");
32-
var pluginName = x.getResponseHeader("X-Plugin-Short-Name");
33-
if (myselfName != pluginName) {
34-
var from = x.getResponseHeader("X-Plugin-From");
35-
if (from) {
36-
e.innerHTML += "<div class='from-plugin'>"+from+"</div>";
26+
e.classList.remove("build-timeout-nested-help");
27+
fetch(e.getAttribute("helpURL")).then((rsp) => {
28+
if (rsp.ok) {
29+
rsp.text().then((responseText) => {
30+
e.innerHTML = responseText;
31+
var myselfName = e.getAttribute("myselfName");
32+
var pluginName = rsp.headers.get("X-Plugin-Short-Name");
33+
if (myselfName != pluginName) {
34+
var from = rsp.headers.get("X-Plugin-From");
35+
if (from) {
36+
e.innerHTML += "<div class='from-plugin'>"+from+"</div>";
37+
}
3738
}
38-
}
39-
layoutUpdateCallback.call();
40-
},
41-
onFailure : function(x) {
42-
e.innerHTML = "<b>ERROR</b>: Failed to load help file: " + x.statusText;
39+
layoutUpdateCallback.call();
40+
});
41+
} else {
42+
e.innerHTML = "<b>ERROR</b>: Failed to load help file: " + rsp.statusText;
4343
}
4444
});
4545
}});
@@ -48,6 +48,6 @@ Behaviour.register({".build-timeout-nested-help": function(e) {
4848
* Allows run Behavior when help is loaded.
4949
*/
5050
layoutUpdateCallback.add(function() {
51-
$$(".build-timeout-nested-help").each(function(e){Behaviour.applySubtree(e, true)});
51+
document.querySelectorAll(".build-timeout-nested-help").forEach(function(e){Behaviour.applySubtree(e, true)});
5252
});
5353

0 commit comments

Comments
 (0)