Skip to content
Snippets Groups Projects
Commit 66136f79 authored by Skriv's avatar Skriv
Browse files

_typeof to typeof + cleaning

parent 580db3d7
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ Macro.add("colorinput", { ...@@ -2,7 +2,7 @@ Macro.add("colorinput", {
handler: function() { handler: function() {
if (this.args.length < 2) { if (this.args.length < 2) {
var e = []; var e = [];
return this.args.length < 1 && e.push("variable name"), this.args.length < 2 && e.push("default value"), this.error("no " + e.join(" or ") + " specified") return this.args.length < 1 && e.push("variable name"), this.args.length < 2 && e.push("default value"), this.error("no " + e.join(" or ") + " specified");
} }
if ("string" != typeof this.args[0]) return this.error("variable name argument is not a string"); if ("string" != typeof this.args[0]) return this.error("variable name argument is not a string");
var varName = this.args[0].trim(); var varName = this.args[0].trim();
...@@ -20,7 +20,7 @@ Macro.add("colorinput", { ...@@ -20,7 +20,7 @@ Macro.add("colorinput", {
} else if (this.args.length > 2) { } else if (this.args.length > 2) {
passage = this.args[2]; passage = this.args[2];
} }
if (passage !== (void 0) && _typeof(passage) === "object") { if (passage !== (void 0) && typeof(passage) === "object") {
passage = passage.link; passage = passage.link;
} }
if (!passage) { if (!passage) {
...@@ -48,12 +48,12 @@ Macro.add("colorinput", { ...@@ -48,12 +48,12 @@ Macro.add("colorinput", {
value: value, value: value,
tabindex: 0 tabindex: 0
}).addClass("macro-" + this.name) }).addClass("macro-" + this.name)
.on("change", function() { .on("change", function() {
State.setVar(varName, this.value); State.setVar(varName, this.value);
if (this.value != value) { // If the value has actually changed, reload the page. Note != and not !== because types might be different if (this.value != value) { // If the value has actually changed, reload the page. Note != and not !== because types might be different
gotoPassage(); gotoPassage();
} }
}) })
.appendTo(this.output); .appendTo(this.output);
} }
}) });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment