|
@@ -4,7 +4,7 @@
|
|
class Utils {
|
|
class Utils {
|
|
constructor(parent) {
|
|
constructor(parent) {
|
|
this.parent = parent;
|
|
this.parent = parent;
|
|
-
|
|
|
|
|
|
+
|
|
this.multipleSize = [1280, 1024, 'Mobile'];
|
|
this.multipleSize = [1280, 1024, 'Mobile'];
|
|
}
|
|
}
|
|
|
|
|
|
@@ -14,7 +14,8 @@ class Utils {
|
|
markDirty() {
|
|
markDirty() {
|
|
if (this.parent.monacoCreator.BlockEditorChange) return;
|
|
if (this.parent.monacoCreator.BlockEditorChange) return;
|
|
|
|
|
|
- this.setToMultipleID("safemodeToggle", "addClass", "checked");!
|
|
|
|
|
|
+ this.setToMultipleID("safemodeToggle", "addClass", "checked");
|
|
|
|
+ !
|
|
this.setToMultipleID('safemodeToggle', 'innerHTML', 'Safe mode <i class="fa fa-check-square" aria-hidden="true"></i>');
|
|
this.setToMultipleID('safemodeToggle', 'innerHTML', 'Safe mode <i class="fa fa-check-square" aria-hidden="true"></i>');
|
|
};
|
|
};
|
|
|
|
|
|
@@ -38,7 +39,7 @@ class Utils {
|
|
}
|
|
}
|
|
|
|
|
|
// Not an error with proper location
|
|
// Not an error with proper location
|
|
- return null;
|
|
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -71,8 +72,8 @@ class Utils {
|
|
const jsEditor = this.parent.monacoCreator.jsEditor;
|
|
const jsEditor = this.parent.monacoCreator.jsEditor;
|
|
if (gotoLocation) {
|
|
if (gotoLocation) {
|
|
gotoLocation.addEventListener('click', function () {
|
|
gotoLocation.addEventListener('click', function () {
|
|
- const position = {
|
|
|
|
- lineNumber: Number(locationError.lineNumber),
|
|
|
|
|
|
+ const position = {
|
|
|
|
+ lineNumber: Number(locationError.lineNumber),
|
|
column: Number(locationError.columnNumber)
|
|
column: Number(locationError.columnNumber)
|
|
};
|
|
};
|
|
|
|
|
|
@@ -89,24 +90,21 @@ class Utils {
|
|
this.multipleSize.forEach(function (size) {
|
|
this.multipleSize.forEach(function (size) {
|
|
if (thingToDo == "innerHTML") {
|
|
if (thingToDo == "innerHTML") {
|
|
document.getElementById(id + size).innerHTML = param
|
|
document.getElementById(id + size).innerHTML = param
|
|
- }
|
|
|
|
- else if (thingToDo == "click") {
|
|
|
|
|
|
+ } else if (thingToDo == "click") {
|
|
if (param.length > 1) {
|
|
if (param.length > 1) {
|
|
for (var i = 0; i < param.length; i++) {
|
|
for (var i = 0; i < param.length; i++) {
|
|
document.getElementById(id + size).addEventListener("click", param[i]);
|
|
document.getElementById(id + size).addEventListener("click", param[i]);
|
|
}
|
|
}
|
|
- }
|
|
|
|
- else
|
|
|
|
|
|
+ } else
|
|
document.getElementById(id + size).addEventListener("click", param);
|
|
document.getElementById(id + size).addEventListener("click", param);
|
|
- }
|
|
|
|
- else if (thingToDo == "addClass") {
|
|
|
|
|
|
+ } else if (thingToDo == "addClass") {
|
|
document.getElementById(id + size).classList.add(param);
|
|
document.getElementById(id + size).classList.add(param);
|
|
- }
|
|
|
|
- else if (thingToDo == "removeClass") {
|
|
|
|
|
|
+ } else if (thingToDo == "removeClass") {
|
|
document.getElementById(id + size).classList.remove(param);
|
|
document.getElementById(id + size).classList.remove(param);
|
|
- }
|
|
|
|
- else if (thingToDo == "display") {
|
|
|
|
|
|
+ } else if (thingToDo == "display") {
|
|
document.getElementById(id + size).style.display = param;
|
|
document.getElementById(id + size).style.display = param;
|
|
|
|
+ } else if (thingToDo === "title") {
|
|
|
|
+ document.getElementById(id + size).setAttribute("title", param);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
};
|
|
@@ -115,8 +113,8 @@ class Utils {
|
|
* Function to get the current screen size
|
|
* Function to get the current screen size
|
|
*/
|
|
*/
|
|
getCurrentSize() {
|
|
getCurrentSize() {
|
|
- for(var i = 0; i < this.multipleSize.length; i++) {
|
|
|
|
- if(document.getElementById("menuButton" + this.multipleSize[i]).offsetHeight > 0) return this.multipleSize[i];
|
|
|
|
|
|
+ for (var i = 0; i < this.multipleSize.length; i++) {
|
|
|
|
+ if (document.getElementById("menuButton" + this.multipleSize[i]).offsetHeight > 0) return this.multipleSize[i];
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -134,9 +132,9 @@ class Utils {
|
|
lastCallAt = currentTime
|
|
lastCallAt = currentTime
|
|
|
|
|
|
if (isCold && options.leading) {
|
|
if (isCold && options.leading) {
|
|
- return options.accumulate
|
|
|
|
- ? Promise.resolve(fn.call(this, [args])).then(result => result[0])
|
|
|
|
- : Promise.resolve(fn.call(this, ...args))
|
|
|
|
|
|
+ return options.accumulate ?
|
|
|
|
+ Promise.resolve(fn.call(this, [args])).then(result => result[0]) :
|
|
|
|
+ Promise.resolve(fn.call(this, ...args))
|
|
}
|
|
}
|
|
|
|
|
|
if (deferred) {
|
|
if (deferred) {
|
|
@@ -159,7 +157,7 @@ class Utils {
|
|
function getWait(wait) {
|
|
function getWait(wait) {
|
|
return (typeof wait === 'function') ? wait() : wait
|
|
return (typeof wait === 'function') ? wait() : wait
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
function defer() {
|
|
function defer() {
|
|
const deferred = {}
|
|
const deferred = {}
|
|
deferred.promise = new Promise((resolve, reject) => {
|
|
deferred.promise = new Promise((resolve, reject) => {
|
|
@@ -174,14 +172,14 @@ class Utils {
|
|
clearTimeout(timer)
|
|
clearTimeout(timer)
|
|
|
|
|
|
Promise.resolve(
|
|
Promise.resolve(
|
|
- options.accumulate
|
|
|
|
- ? fn.call(this, pendingArgs)
|
|
|
|
- : fn.apply(this, pendingArgs[pendingArgs.length - 1])
|
|
|
|
- )
|
|
|
|
|
|
+ options.accumulate ?
|
|
|
|
+ fn.call(this, pendingArgs) :
|
|
|
|
+ fn.apply(this, pendingArgs[pendingArgs.length - 1])
|
|
|
|
+ )
|
|
.then(thisDeferred.resolve, thisDeferred.reject)
|
|
.then(thisDeferred.resolve, thisDeferred.reject)
|
|
|
|
|
|
pendingArgs = []
|
|
pendingArgs = []
|
|
deferred = null
|
|
deferred = null
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|