From 646d40f7eb6099010166088bb6058ba4adfff002 Mon Sep 17 00:00:00 2001 From: Skriv <skrivelese@gmail.com> Date: Fri, 31 May 2019 18:44:14 +0200 Subject: [PATCH] delete obsolete textInput.js --- src/js/textInput.js | 56 --------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 src/js/textInput.js diff --git a/src/js/textInput.js b/src/js/textInput.js deleted file mode 100644 index f7f24d6c434..00000000000 --- a/src/js/textInput.js +++ /dev/null @@ -1,56 +0,0 @@ -Macro.add("textinput", { - // Signifies that the macro is a container macro. - tags: null, - - handler: function() { - if (this.args.length < 2) { - const errors = []; - if (this.args.length === 0) { - errors.push("variable name"); - } - if (this.args.length < 2) { - errors.push("default value"); - } - return this.error(`no ${errors.join(" or ")} specified`); - } - - // Ensure that the variable name argument is a string. - if (typeof this.args[0] !== "string") { - return this.error("variable name argument is not a string"); - } - - const varName = this.args[0].trim(); - - // Try to ensure that we receive the variable's name (incl. sigil), not its value. - if (varName[0] !== "$" && varName[0] !== "_") { - return this.error(`variable name '${varName}' is missing its sigil ($ or _)`); - } - - const that = this; - const defaultValue = this.args[1]; - const el = document.createElement("textarea"); - - // Setup and append the textarea element to the output buffer. - jQuery(el) - .attr({ - rows: 4, - // cols: 68, // instead of setting "cols" we set the `min-width` in CSS - tabindex: 0 // for accessibility - }) - .addClass("macro-textarea") // "hijack" the .macro-textarea class - .on("input", function() { - Wikifier.setValue(varName, this.value); - if (that.payload[0].contents !== "") { - Wikifier.wikifyEval(that.payload[0].contents.trim()); - } - }) - .appendTo(this.output); - - // Set the story variable and textarea element to the default value. - Wikifier.setValue(varName, defaultValue); - - // Ideally, we should be setting `.defaultValue` here, but IE doesn't support it, - // so we have to use `.textContent`, which is equivalent. - el.textContent = defaultValue; - } -}); -- GitLab