increase compatibility of javascript migration code

* replace const with var
* replace forEach with a for of loop
* use === instead of ==
This commit is contained in:
Sebastian Sdorra
2019-06-12 10:51:57 +02:00
parent 24d91a4764
commit c159d209d6
2 changed files with 7 additions and 7 deletions

View File

@@ -48,12 +48,12 @@
{{$script}}
<script>
setInterval(function () {
const request = new XMLHttpRequest();
var request = new XMLHttpRequest();
request.open('GET', '{{ contextPath }}/api/v2/', true);
request.onload = function () {
if (this.readyState == 4 && this.status == 200 && this.response.toString().indexOf("_links") > 0) {
if (this.readyState === 4 && this.status === 200 && this.response.toString().indexOf("_links") > 0) {
location.href = '{{ contextPath }}';
}
};

View File

@@ -90,12 +90,12 @@
{{$script}}
<script>
document.addEventListener("DOMContentLoaded", function() {
const changeAllSelector = document.getElementById('changeAll');
var changeAllSelector = document.getElementById('changeAll');
changeAllSelector.onchange = function () {
const strategySelects = document.getElementsByClassName('strategy-select');
console.log("selects:", strategySelects);
console.log("setting to:", changeAllSelector.value);
Array.prototype.forEach.call(strategySelects, s => s.value = changeAllSelector.value);
var strategySelects = document.getElementsByClassName('strategy-select');
for (var strategySelect of strategySelects) {
strategySelect.value = changeAllSelector.value;
}
};
});
</script>