Modernize utility scripts
Change-Id: I7f673519d91fbebf1ba00f4821c896fda839c93b
diff --git a/dev/js/src/util.js b/dev/js/src/util.js
index 5eab4b3..8e40c12 100644
--- a/dev/js/src/util.js
+++ b/dev/js/src/util.js
@@ -27,7 +27,7 @@
// Add toggleClass method similar to jquery
HTMLElement.prototype.toggleClass = function (c1, c2) {
- var cl = this.classList;
+ const cl = this.classList;
if (cl.contains(c1)) {
cl.add(c2);
cl.remove(c1);
@@ -78,7 +78,7 @@
* https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript#8084248
*/
function randomID (len) {
- let arr = new Uint8Array((len || 40) / 2)
+ const arr = new Uint8Array((len || 40) / 2)
window.crypto.getRandomValues(arr)
return Array.from(arr, _dec2hex).join('')
};
@@ -96,7 +96,7 @@
// Add new stylesheet object lazily to document
KorAP.newStyleSheet = function () {
if (KorAP._sheet === undefined) {
- var sElem = document.createElement('style');
+ const sElem = document.createElement('style');
document.head.appendChild(sElem);
KorAP._sheet = sElem.sheet;
};
@@ -106,7 +106,8 @@
// Default log message
KorAP.log = KorAP.log || function (type, msg, src) {
- if (src) msg += ' from ' + src;
+ if (src)
+ msg += ' from ' + src;
console.log(type + ": " + msg);
};