Merge branch 'prefer-const' of https://github.com/graingert/CyberChef into graingert-prefer-const

feature-extract-files
n1474335 2017-05-06 14:11:38 +01:00
commit 5efe9bd91d
15 changed files with 165 additions and 163 deletions

View File

@ -426,7 +426,7 @@ const Code = {
* @returns {string} * @returns {string}
*/ */
_replaceVariableNames(input, replacer) { _replaceVariableNames(input, replacer) {
let tokenRegex = /\\"|"(?:\\"|[^"])*"|(\b[a-z0-9\-_]+\b)/ig; const tokenRegex = /\\"|"(?:\\"|[^"])*"|(\b[a-z0-9\-_]+\b)/ig;
return input.replace(tokenRegex, (...args) => { return input.replace(tokenRegex, (...args) => {
let match = args[0], let match = args[0],
@ -450,7 +450,7 @@ const Code = {
* *
*/ */
runToSnakeCase(input, args) { runToSnakeCase(input, args) {
let smart = args[0]; const smart = args[0];
if (smart) { if (smart) {
return Code._replaceVariableNames(input, snakeCase); return Code._replaceVariableNames(input, snakeCase);
@ -469,7 +469,7 @@ const Code = {
* *
*/ */
runToCamelCase(input, args) { runToCamelCase(input, args) {
let smart = args[0]; const smart = args[0];
if (smart) { if (smart) {
return Code._replaceVariableNames(input, camelCase); return Code._replaceVariableNames(input, camelCase);
@ -488,7 +488,7 @@ const Code = {
* *
*/ */
runToKebabCase(input, args) { runToKebabCase(input, args) {
let smart = args[0]; const smart = args[0];
if (smart) { if (smart) {
return Code._replaceVariableNames(input, kebabCase); return Code._replaceVariableNames(input, kebabCase);

View File

@ -471,7 +471,7 @@ const StrUtils = {
number = args[1]; number = args[1];
delimiter = Utils.charRep[delimiter]; delimiter = Utils.charRep[delimiter];
let splitInput = input.split(delimiter); const splitInput = input.split(delimiter);
return splitInput return splitInput
.filter((line, lineIndex) => { .filter((line, lineIndex) => {
@ -499,7 +499,7 @@ const StrUtils = {
number = args[1]; number = args[1];
delimiter = Utils.charRep[delimiter]; delimiter = Utils.charRep[delimiter];
let splitInput = input.split(delimiter); const splitInput = input.split(delimiter);
return splitInput return splitInput
.filter((line, lineIndex) => { .filter((line, lineIndex) => {

View File

@ -23,14 +23,14 @@ const ControlsWaiter = function(app, manager) {
* without wrapping or overflowing. * without wrapping or overflowing.
*/ */
ControlsWaiter.prototype.adjustWidth = function() { ControlsWaiter.prototype.adjustWidth = function() {
let controls = document.getElementById("controls"), const controls = document.getElementById("controls");
step = document.getElementById("step"), const step = document.getElementById("step");
clrBreaks = document.getElementById("clr-breaks"), const clrBreaks = document.getElementById("clr-breaks");
saveImg = document.querySelector("#save img"), const saveImg = document.querySelector("#save img");
loadImg = document.querySelector("#load img"), const loadImg = document.querySelector("#load img");
stepImg = document.querySelector("#step img"), const stepImg = document.querySelector("#step img");
clrRecipImg = document.querySelector("#clr-recipe img"), const clrRecipImg = document.querySelector("#clr-recipe img");
clrBreaksImg = document.querySelector("#clr-breaks img"); const clrBreaksImg = document.querySelector("#clr-breaks img");
if (controls.clientWidth < 470) { if (controls.clientWidth < 470) {
step.childNodes[1].nodeValue = " Step"; step.childNodes[1].nodeValue = " Step";
@ -100,8 +100,8 @@ ControlsWaiter.prototype.stepClick = function() {
* Handler for changes made to the Auto Bake checkbox. * Handler for changes made to the Auto Bake checkbox.
*/ */
ControlsWaiter.prototype.autoBakeChange = function() { ControlsWaiter.prototype.autoBakeChange = function() {
let autoBakeLabel = document.getElementById("auto-bake-label"), const autoBakeLabel = document.getElementById("auto-bake-label");
autoBakeCheckbox = document.getElementById("auto-bake"); const autoBakeCheckbox = document.getElementById("auto-bake");
this.app.autoBake_ = autoBakeCheckbox.checked; this.app.autoBake_ = autoBakeCheckbox.checked;
@ -145,10 +145,10 @@ ControlsWaiter.prototype.clearBreaksClick = function() {
ControlsWaiter.prototype.initialiseSaveLink = function(recipeConfig) { ControlsWaiter.prototype.initialiseSaveLink = function(recipeConfig) {
recipeConfig = recipeConfig || this.app.getRecipeConfig(); recipeConfig = recipeConfig || this.app.getRecipeConfig();
let includeRecipe = document.getElementById("save-link-recipe-checkbox").checked, const includeRecipe = document.getElementById("save-link-recipe-checkbox").checked;
includeInput = document.getElementById("save-link-input-checkbox").checked, const includeInput = document.getElementById("save-link-input-checkbox").checked;
saveLinkEl = document.getElementById("save-link"), const saveLinkEl = document.getElementById("save-link");
saveLink = this.generateStateUrl(includeRecipe, includeInput, recipeConfig); const saveLink = this.generateStateUrl(includeRecipe, includeInput, recipeConfig);
saveLinkEl.innerHTML = Utils.truncate(saveLink, 120); saveLinkEl.innerHTML = Utils.truncate(saveLink, 120);
saveLinkEl.setAttribute("href", saveLink); saveLinkEl.setAttribute("href", saveLink);
@ -167,23 +167,27 @@ ControlsWaiter.prototype.initialiseSaveLink = function(recipeConfig) {
ControlsWaiter.prototype.generateStateUrl = function(includeRecipe, includeInput, recipeConfig, baseURL) { ControlsWaiter.prototype.generateStateUrl = function(includeRecipe, includeInput, recipeConfig, baseURL) {
recipeConfig = recipeConfig || this.app.getRecipeConfig(); recipeConfig = recipeConfig || this.app.getRecipeConfig();
let link = baseURL || window.location.protocol + "//" + const link = baseURL || window.location.protocol + "//" +
window.location.host + window.location.host +
window.location.pathname, window.location.pathname;
recipeStr = JSON.stringify(recipeConfig), const recipeStr = JSON.stringify(recipeConfig);
inputStr = Utils.toBase64(this.app.getInput(), "A-Za-z0-9+/"); // B64 alphabet with no padding const inputStr = Utils.toBase64(this.app.getInput(), "A-Za-z0-9+/"); // B64 alphabet with no padding
includeRecipe = includeRecipe && (recipeConfig.length > 0); const myIncludeRecipe = includeRecipe && (recipeConfig.length > 0);
includeInput = includeInput && (inputStr.length > 0) && (inputStr.length < 8000); const myIncludeInput = includeInput && (inputStr.length > 0) && (inputStr.length < 8000);
if (includeRecipe) { const params = [
link += "?recipe=" + encodeURIComponent(recipeStr); myIncludeRecipe ? ["recipe", recipeStr] : undefined,
} myIncludeInput ? ["input", inputStr] : undefined,
];
if (includeRecipe && includeInput) { const query = params
link += "&input=" + encodeURIComponent(inputStr); .filter(v => v)
} else if (includeInput) { .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
link += "?input=" + encodeURIComponent(inputStr); .join("&");
if (query) {
return `${link}?${query}`;
} }
return link; return link;
@ -205,8 +209,8 @@ ControlsWaiter.prototype.saveTextChange = function() {
* Handler for the 'Save' command. Pops up the save dialog box. * Handler for the 'Save' command. Pops up the save dialog box.
*/ */
ControlsWaiter.prototype.saveClick = function() { ControlsWaiter.prototype.saveClick = function() {
let recipeConfig = this.app.getRecipeConfig(), const recipeConfig = this.app.getRecipeConfig();
recipeStr = JSON.stringify(recipeConfig).replace(/},{/g, "},\n{"); const recipeStr = JSON.stringify(recipeConfig).replace(/},{/g, "},\n{");
document.getElementById("save-text").value = recipeStr; document.getElementById("save-text").value = recipeStr;
@ -244,8 +248,8 @@ ControlsWaiter.prototype.loadClick = function() {
* Saves the recipe specified in the save textarea to local storage. * Saves the recipe specified in the save textarea to local storage.
*/ */
ControlsWaiter.prototype.saveButtonClick = function() { ControlsWaiter.prototype.saveButtonClick = function() {
let recipeName = Utils.escapeHtml(document.getElementById("save-name").value); const recipeName = Utils.escapeHtml(document.getElementById("save-name").value);
let recipeStr = document.getElementById("save-text").value; const recipeStr = document.getElementById("save-text").value;
if (!recipeName) { if (!recipeName) {
this.app.alert("Please enter a recipe name", "danger", 2000); this.app.alert("Please enter a recipe name", "danger", 2000);
@ -303,13 +307,11 @@ ControlsWaiter.prototype.populateLoadRecipesList = function() {
* Removes the currently selected recipe from local storage. * Removes the currently selected recipe from local storage.
*/ */
ControlsWaiter.prototype.loadDeleteClick = function() { ControlsWaiter.prototype.loadDeleteClick = function() {
let id = parseInt(document.getElementById("load-name").value, 10), const id = parseInt(document.getElementById("load-name").value, 10);
savedRecipes = localStorage.savedRecipes ? const rawSavedRecipes = localStorage.savedRecipes ?
JSON.parse(localStorage.savedRecipes) : []; JSON.parse(localStorage.savedRecipes) : [];
savedRecipes = savedRecipes.filter(function(r) { const savedRecipes = rawSavedRecipes.filter(r => r.id !== id);
return r.id !== id;
});
localStorage.savedRecipes = JSON.stringify(savedRecipes); localStorage.savedRecipes = JSON.stringify(savedRecipes);
this.populateLoadRecipesList(); this.populateLoadRecipesList();
@ -320,14 +322,12 @@ ControlsWaiter.prototype.loadDeleteClick = function() {
* Displays the selected recipe in the load text box. * Displays the selected recipe in the load text box.
*/ */
ControlsWaiter.prototype.loadNameChange = function(e) { ControlsWaiter.prototype.loadNameChange = function(e) {
let el = e.target, const el = e.target;
savedRecipes = localStorage.savedRecipes ? const savedRecipes = localStorage.savedRecipes ?
JSON.parse(localStorage.savedRecipes) : [], JSON.parse(localStorage.savedRecipes) : [];
id = parseInt(el.value, 10); const id = parseInt(el.value, 10);
const recipe = savedRecipes.filter(function(r) { const recipe = savedRecipes.find(r => r.id === id);
return r.id === id;
})[0];
document.getElementById("load-text").value = recipe.recipe; document.getElementById("load-text").value = recipe.recipe;
}; };
@ -352,8 +352,8 @@ ControlsWaiter.prototype.loadButtonClick = function() {
* Populates the bug report information box with useful technical info. * Populates the bug report information box with useful technical info.
*/ */
ControlsWaiter.prototype.supportButtonClick = function() { ControlsWaiter.prototype.supportButtonClick = function() {
let reportBugInfo = document.getElementById("report-bug-info"), const reportBugInfo = document.getElementById("report-bug-info");
saveLink = this.generateStateUrl(true, true, null, "https://gchq.github.io/CyberChef/"); const saveLink = this.generateStateUrl(true, true, null, "https://gchq.github.io/CyberChef/");
reportBugInfo.innerHTML = "* CyberChef compile time: " + COMPILE_TIME + "\n" + reportBugInfo.innerHTML = "* CyberChef compile time: " + COMPILE_TIME + "\n" +
"* User-Agent: \n" + navigator.userAgent + "\n" + "* User-Agent: \n" + navigator.userAgent + "\n" +

View File

@ -158,13 +158,12 @@ HTMLIngredient.prototype.toHtml = function() {
* @param {event} e * @param {event} e
*/ */
HTMLIngredient.prototype.toggleDisableArgs = function(e) { HTMLIngredient.prototype.toggleDisableArgs = function(e) {
let el = e.target, const el = e.target;
op = el.parentNode.parentNode, const op = el.parentNode.parentNode;
args = op.querySelectorAll(".arg-group"), const args = op.querySelectorAll(".arg-group");
els;
for (let i = 0; i < this.disableArgs.length; i++) { for (let i = 0; i < this.disableArgs.length; i++) {
els = args[this.disableArgs[i]].querySelectorAll("input, select, button"); const els = args[this.disableArgs[i]].querySelectorAll("input, select, button");
for (let j = 0; j < els.length; j++) { for (let j = 0; j < els.length; j++) {
if (els[j].getAttribute("disabled")) { if (els[j].getAttribute("disabled")) {
@ -186,9 +185,9 @@ HTMLIngredient.prototype.toggleDisableArgs = function(e) {
* @param {event} e * @param {event} e
*/ */
HTMLIngredient.prototype.populateOptionChange = function(e) { HTMLIngredient.prototype.populateOptionChange = function(e) {
let el = e.target, const el = e.target;
op = el.parentNode.parentNode, const op = el.parentNode.parentNode;
target = op.querySelectorAll(".arg-group")[this.target].querySelector("input, select, textarea"); const target = op.querySelectorAll(".arg-group")[this.target].querySelector("input, select, textarea");
target.value = el.childNodes[el.selectedIndex].getAttribute("populate-value"); target.value = el.childNodes[el.selectedIndex].getAttribute("populate-value");

View File

@ -64,8 +64,8 @@ HighlighterWaiter.prototype._isSelectionBackwards = function() {
* @returns {number} * @returns {number}
*/ */
HighlighterWaiter.prototype._getOutputHtmlOffset = function(node, offset) { HighlighterWaiter.prototype._getOutputHtmlOffset = function(node, offset) {
let sel = window.getSelection(), const sel = window.getSelection();
range = document.createRange(); const range = document.createRange();
range.selectNodeContents(document.getElementById("output-html")); range.selectNodeContents(document.getElementById("output-html"));
range.setEnd(node, offset); range.setEnd(node, offset);
@ -85,8 +85,8 @@ HighlighterWaiter.prototype._getOutputHtmlOffset = function(node, offset) {
* @returns {number} pos.end * @returns {number} pos.end
*/ */
HighlighterWaiter.prototype._getOutputHtmlSelectionOffsets = function() { HighlighterWaiter.prototype._getOutputHtmlSelectionOffsets = function() {
let sel = window.getSelection(), const sel = window.getSelection();
range, let range,
start = 0, start = 0,
end = 0, end = 0,
backwards = false; backwards = false;
@ -151,9 +151,9 @@ HighlighterWaiter.prototype.inputMousedown = function(e) {
this.mouseTarget = HighlighterWaiter.INPUT; this.mouseTarget = HighlighterWaiter.INPUT;
this.removeHighlights(); this.removeHighlights();
let el = e.target, const el = e.target;
start = el.selectionStart, const start = el.selectionStart;
end = el.selectionEnd; const end = el.selectionEnd;
if (start !== 0 || end !== 0) { if (start !== 0 || end !== 0) {
document.getElementById("input-selection-info").innerHTML = this.selectionInfo(start, end); document.getElementById("input-selection-info").innerHTML = this.selectionInfo(start, end);
@ -173,9 +173,9 @@ HighlighterWaiter.prototype.outputMousedown = function(e) {
this.mouseTarget = HighlighterWaiter.OUTPUT; this.mouseTarget = HighlighterWaiter.OUTPUT;
this.removeHighlights(); this.removeHighlights();
let el = e.target, const el = e.target;
start = el.selectionStart, const start = el.selectionStart;
end = el.selectionEnd; const end = el.selectionEnd;
if (start !== 0 || end !== 0) { if (start !== 0 || end !== 0) {
document.getElementById("output-selection-info").innerHTML = this.selectionInfo(start, end); document.getElementById("output-selection-info").innerHTML = this.selectionInfo(start, end);
@ -244,9 +244,9 @@ HighlighterWaiter.prototype.inputMousemove = function(e) {
this.mouseTarget !== HighlighterWaiter.INPUT) this.mouseTarget !== HighlighterWaiter.INPUT)
return; return;
let el = e.target, const el = e.target;
start = el.selectionStart, const start = el.selectionStart;
end = el.selectionEnd; const end = el.selectionEnd;
if (start !== 0 || end !== 0) { if (start !== 0 || end !== 0) {
document.getElementById("input-selection-info").innerHTML = this.selectionInfo(start, end); document.getElementById("input-selection-info").innerHTML = this.selectionInfo(start, end);
@ -268,9 +268,9 @@ HighlighterWaiter.prototype.outputMousemove = function(e) {
this.mouseTarget !== HighlighterWaiter.OUTPUT) this.mouseTarget !== HighlighterWaiter.OUTPUT)
return; return;
let el = e.target, const el = e.target;
start = el.selectionStart, const start = el.selectionStart;
end = el.selectionEnd; const end = el.selectionEnd;
if (start !== 0 || end !== 0) { if (start !== 0 || end !== 0) {
document.getElementById("output-selection-info").innerHTML = this.selectionInfo(start, end); document.getElementById("output-selection-info").innerHTML = this.selectionInfo(start, end);
@ -308,11 +308,11 @@ HighlighterWaiter.prototype.outputHtmlMousemove = function(e) {
* @returns {string} * @returns {string}
*/ */
HighlighterWaiter.prototype.selectionInfo = function(start, end) { HighlighterWaiter.prototype.selectionInfo = function(start, end) {
let width = end.toString().length; const len = end.toString().length;
width = width < 2 ? 2 : width; const width = len < 2 ? 2 : len;
let startStr = Utils.pad(start.toString(), width, " ").replace(/ /g, "&nbsp;"), const startStr = Utils.pad(start.toString(), width, " ").replace(/ /g, "&nbsp;");
endStr = Utils.pad(end.toString(), width, " ").replace(/ /g, "&nbsp;"), const endStr = Utils.pad(end.toString(), width, " ").replace(/ /g, "&nbsp;");
lenStr = Utils.pad((end-start).toString(), width, " ").replace(/ /g, "&nbsp;"); const lenStr = Utils.pad((end-start).toString(), width, " ").replace(/ /g, "&nbsp;");
return "start: " + startStr + "<br>end: " + endStr + "<br>length: " + lenStr; return "start: " + startStr + "<br>end: " + endStr + "<br>length: " + lenStr;
}; };
@ -339,8 +339,8 @@ HighlighterWaiter.prototype.removeHighlights = function() {
* @returns {Object[]} highlights[].args * @returns {Object[]} highlights[].args
*/ */
HighlighterWaiter.prototype.generateHighlightList = function() { HighlighterWaiter.prototype.generateHighlightList = function() {
let recipeConfig = this.app.getRecipeConfig(), const recipeConfig = this.app.getRecipeConfig();
highlights = []; const highlights = [];
for (let i = 0; i < recipeConfig.length; i++) { for (let i = 0; i < recipeConfig.length; i++) {
if (recipeConfig[i].disabled) continue; if (recipeConfig[i].disabled) continue;
@ -452,11 +452,11 @@ HighlighterWaiter.prototype.highlight = function(textarea, highlighter, pos) {
// be displayed by the HTML textarea and will mess up highlighting offsets. // be displayed by the HTML textarea and will mess up highlighting offsets.
if (!this.app.dishStr || this.app.dishStr.indexOf("\r") >= 0) return false; if (!this.app.dishStr || this.app.dishStr.indexOf("\r") >= 0) return false;
let startPlaceholder = "[startHighlight]", const startPlaceholder = "[startHighlight]";
startPlaceholderRegex = /\[startHighlight\]/g, const startPlaceholderRegex = /\[startHighlight\]/g;
endPlaceholder = "[endHighlight]", const endPlaceholder = "[endHighlight]";
endPlaceholderRegex = /\[endHighlight\]/g, const endPlaceholderRegex = /\[endHighlight\]/g;
text = textarea.value; let text = textarea.value;
// Put placeholders in position // Put placeholders in position
// If there's only one value, select that // If there's only one value, select that

View File

@ -92,8 +92,8 @@ InputWaiter.prototype.inputChange = function(e) {
this.app.progress = 0; this.app.progress = 0;
// Update the input metadata info // Update the input metadata info
let inputText = this.get(), const inputText = this.get();
lines = inputText.count("\n") + 1; const lines = inputText.count("\n") + 1;
this.setInputInfo(inputText.length, lines); this.setInputInfo(inputText.length, lines);
@ -149,13 +149,13 @@ InputWaiter.prototype.inputDrop = function(e) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
let el = e.target, const el = e.target;
file = e.dataTransfer.files[0], const file = e.dataTransfer.files[0];
text = e.dataTransfer.getData("Text"), const text = e.dataTransfer.getData("Text");
reader = new FileReader(), const reader = new FileReader();
inputCharcode = "", let inputCharcode = "";
offset = 0, let offset = 0;
CHUNK_SIZE = 20480; // 20KB const CHUNK_SIZE = 20480; // 20KB
const setInput = function() { const setInput = function() {
if (inputCharcode.length > 100000 && this.app.autoBake_) { if (inputCharcode.length > 100000 && this.app.autoBake_) {

View File

@ -261,15 +261,16 @@ Manager.prototype.addDynamicListener = function(selector, eventType, callback, s
* @param {Event} e - The event to be handled * @param {Event} e - The event to be handled
*/ */
Manager.prototype.dynamicListenerHandler = function(e) { Manager.prototype.dynamicListenerHandler = function(e) {
let handlers = this.dynamicHandlers[e.type], const { type, target } = e;
matches = e.target.matches || const handlers = this.dynamicHandlers[type];
e.target.webkitMatchesSelector || const matches = target.matches ||
e.target.mozMatchesSelector || target.webkitMatchesSelector ||
e.target.msMatchesSelector || target.mozMatchesSelector ||
e.target.oMatchesSelector; target.msMatchesSelector ||
target.oMatchesSelector;
for (let i = 0; i < handlers.length; i++) { for (let i = 0; i < handlers.length; i++) {
if (matches && e.target[matches.name](handlers[i].selector)) { if (matches && matches.call(target, handlers[i].selector)) {
handlers[i].callback(e); handlers[i].callback(e);
} }
} }

View File

@ -68,9 +68,9 @@ OperationsWaiter.prototype.searchOperations = function(e) {
ops[selected-1].classList.add("selected-op"); ops[selected-1].classList.add("selected-op");
} }
} else { } else {
let searchResultsEl = document.getElementById("search-results"), const searchResultsEl = document.getElementById("search-results");
el = e.target, const el = e.target;
str = el.value; const str = el.value;
while (searchResultsEl.firstChild) { while (searchResultsEl.firstChild) {
try { try {
@ -81,12 +81,10 @@ OperationsWaiter.prototype.searchOperations = function(e) {
$("#categories .in").collapse("hide"); $("#categories .in").collapse("hide");
if (str) { if (str) {
let matchedOps = this.filterOperations(str, true), const matchedOps = this.filterOperations(str, true);
matchedOpsHtml = ""; const matchedOpsHtml = matchedOps
.map(v => v.toStubHtml())
for (let i = 0; i < matchedOps.length; i++) { .join("");
matchedOpsHtml += matchedOps[i].toStubHtml();
}
searchResultsEl.innerHTML = matchedOpsHtml; searchResultsEl.innerHTML = matchedOpsHtml;
searchResultsEl.dispatchEvent(this.manager.oplistcreate); searchResultsEl.dispatchEvent(this.manager.oplistcreate);
@ -103,16 +101,16 @@ OperationsWaiter.prototype.searchOperations = function(e) {
* name and description * name and description
* @returns {string[]} * @returns {string[]}
*/ */
OperationsWaiter.prototype.filterOperations = function(searchStr, highlight) { OperationsWaiter.prototype.filterOperations = function(inStr, highlight) {
let matchedOps = [], const matchedOps = [];
matchedDescs = []; const matchedDescs = [];
searchStr = searchStr.toLowerCase(); const searchStr = inStr.toLowerCase();
for (const opName in this.app.operations) { for (const opName in this.app.operations) {
let op = this.app.operations[opName], const op = this.app.operations[opName];
namePos = opName.toLowerCase().indexOf(searchStr), const namePos = opName.toLowerCase().indexOf(searchStr);
descPos = op.description.toLowerCase().indexOf(searchStr); const descPos = op.description.toLowerCase().indexOf(searchStr);
if (namePos >= 0 || descPos >= 0) { if (namePos >= 0 || descPos >= 0) {
const operation = new HTMLOperation(opName, this.app.operations[opName], this.app, this.manager); const operation = new HTMLOperation(opName, this.app.operations[opName], this.app, this.manager);
@ -236,12 +234,8 @@ OperationsWaiter.prototype.editFavouritesClick = function(e) {
* Saves the selected favourites and reloads them. * Saves the selected favourites and reloads them.
*/ */
OperationsWaiter.prototype.saveFavouritesClick = function() { OperationsWaiter.prototype.saveFavouritesClick = function() {
let favouritesList = [], const favs = document.querySelectorAll("#edit-favourites-list li");
favs = document.querySelectorAll("#edit-favourites-list li"); const favouritesList = Array.from(favs, e => e.textContent);
for (let i = 0; i < favs.length; i++) {
favouritesList.push(favs[i].textContent);
}
this.app.saveFavourites(favouritesList); this.app.saveFavourites(favouritesList);
this.app.loadFavourites(); this.app.loadFavourites();
@ -281,8 +275,8 @@ OperationsWaiter.prototype.opIconMouseover = function(e) {
* @param {event} e * @param {event} e
*/ */
OperationsWaiter.prototype.opIconMouseleave = function(e) { OperationsWaiter.prototype.opIconMouseleave = function(e) {
let opEl = e.target.parentNode, const opEl = e.target.parentNode;
toEl = e.toElement || e.relatedElement; const toEl = e.toElement || e.relatedElement;
if (e.target.getAttribute("data-toggle") === "popover" && toEl === opEl) { if (e.target.getAttribute("data-toggle") === "popover" && toEl === opEl) {
$(opEl).popover("show"); $(opEl).popover("show");

View File

@ -75,8 +75,8 @@ OptionsWaiter.prototype.resetOptionsClick = function() {
* @param {boolean} state * @param {boolean} state
*/ */
OptionsWaiter.prototype.switchChange = function(e, state) { OptionsWaiter.prototype.switchChange = function(e, state) {
let el = e.target, const el = e.target;
option = el.getAttribute("option"); const option = el.getAttribute("option");
this.app.options[option] = state; this.app.options[option] = state;
localStorage.setItem("options", JSON.stringify(this.app.options)); localStorage.setItem("options", JSON.stringify(this.app.options));
@ -90,8 +90,8 @@ OptionsWaiter.prototype.switchChange = function(e, state) {
* @param {event} e * @param {event} e
*/ */
OptionsWaiter.prototype.numberChange = function(e) { OptionsWaiter.prototype.numberChange = function(e) {
let el = e.target, const el = e.target;
option = el.getAttribute("option"); const option = el.getAttribute("option");
this.app.options[option] = parseInt(el.value, 10); this.app.options[option] = parseInt(el.value, 10);
localStorage.setItem("options", JSON.stringify(this.app.options)); localStorage.setItem("options", JSON.stringify(this.app.options));
@ -105,8 +105,8 @@ OptionsWaiter.prototype.numberChange = function(e) {
* @param {event} e * @param {event} e
*/ */
OptionsWaiter.prototype.selectChange = function(e) { OptionsWaiter.prototype.selectChange = function(e) {
let el = e.target, const el = e.target;
option = el.getAttribute("option"); const option = el.getAttribute("option");
this.app.options[option] = el.value; this.app.options[option] = el.value;
localStorage.setItem("options", JSON.stringify(this.app.options)); localStorage.setItem("options", JSON.stringify(this.app.options));

View File

@ -36,10 +36,10 @@ OutputWaiter.prototype.get = function() {
* @param {number} duration - The length of time (ms) it took to generate the output * @param {number} duration - The length of time (ms) it took to generate the output
*/ */
OutputWaiter.prototype.set = function(dataStr, type, duration) { OutputWaiter.prototype.set = function(dataStr, type, duration) {
let outputText = document.getElementById("output-text"), const outputText = document.getElementById("output-text");
outputHtml = document.getElementById("output-html"), const outputHtml = document.getElementById("output-html");
outputHighlighter = document.getElementById("output-highlighter"), const outputHighlighter = document.getElementById("output-highlighter");
inputHighlighter = document.getElementById("input-highlighter"); const inputHighlighter = document.getElementById("input-highlighter");
if (type === "html") { if (type === "html") {
outputText.style.display = "none"; outputText.style.display = "none";
@ -103,11 +103,11 @@ OutputWaiter.prototype.setOutputInfo = function(length, lines, duration) {
* without wrapping or overflowing. * without wrapping or overflowing.
*/ */
OutputWaiter.prototype.adjustWidth = function() { OutputWaiter.prototype.adjustWidth = function() {
let output = document.getElementById("output"), const output = document.getElementById("output");
saveToFile = document.getElementById("save-to-file"), const saveToFile = document.getElementById("save-to-file");
switchIO = document.getElementById("switch"), const switchIO = document.getElementById("switch");
undoSwitch = document.getElementById("undo-switch"), const undoSwitch = document.getElementById("undo-switch");
maximiseOutput = document.getElementById("maximise-output"); const maximiseOutput = document.getElementById("maximise-output");
if (output.clientWidth < 680) { if (output.clientWidth < 680) {
saveToFile.childNodes[1].nodeValue = ""; saveToFile.childNodes[1].nodeValue = "";
@ -129,8 +129,8 @@ OutputWaiter.prototype.adjustWidth = function() {
* Saves the current output to a file, downloaded as a URL octet stream. * Saves the current output to a file, downloaded as a URL octet stream.
*/ */
OutputWaiter.prototype.saveClick = function() { OutputWaiter.prototype.saveClick = function() {
let data = Utils.toBase64(this.app.dishStr), const data = Utils.toBase64(this.app.dishStr);
filename = window.prompt("Please enter a filename:", "download.dat"); const filename = window.prompt("Please enter a filename:", "download.dat");
if (filename) { if (filename) {
const el = document.createElement("a"); const el = document.createElement("a");

View File

@ -60,8 +60,8 @@ RecipeWaiter.prototype.initialiseOperationDragNDrop = function() {
}.bind(this)); }.bind(this));
Sortable.utils.on(recList, "touchend", function(e) { Sortable.utils.on(recList, "touchend", function(e) {
let loc = e.changedTouches[0], const loc = e.changedTouches[0];
target = document.elementFromPoint(loc.clientX, loc.clientY); const target = document.elementFromPoint(loc.clientX, loc.clientY);
this.removeIntent = !recList.contains(target); this.removeIntent = !recList.contains(target);
}.bind(this)); }.bind(this));
@ -276,8 +276,9 @@ RecipeWaiter.prototype.operationChildDblclick = function(e) {
* @returns {recipeConfig} * @returns {recipeConfig}
*/ */
RecipeWaiter.prototype.getConfig = function() { RecipeWaiter.prototype.getConfig = function() {
let config = [], ingredients, ingList, disabled, bp, item, const config = [];
operations = document.querySelectorAll("#rec-list li.operation"); let ingredients, ingList, disabled, bp, item;
const operations = document.querySelectorAll("#rec-list li.operation");
for (let i = 0; i < operations.length; i++) { for (let i = 0; i < operations.length; i++) {
ingredients = []; ingredients = [];
@ -402,8 +403,8 @@ RecipeWaiter.prototype.clearRecipe = function() {
* @param {event} e * @param {event} e
*/ */
RecipeWaiter.prototype.dropdownToggleClick = function(e) { RecipeWaiter.prototype.dropdownToggleClick = function(e) {
let el = e.target, const el = e.target;
button = el.parentNode.parentNode.previousSibling; const button = el.parentNode.parentNode.previousSibling;
button.innerHTML = el.textContent + " <span class='caret'></span>"; button.innerHTML = el.textContent + " <span class='caret'></span>";
this.ingChange(); this.ingChange();

View File

@ -1,3 +1,8 @@
import spiderImages from "./spiderImages.json";
const { spider16, spider32, spider64 } = spiderImages;
/** /**
* Waiter to handle seasonal events and easter eggs. * Waiter to handle seasonal events and easter eggs.
* *
@ -38,9 +43,6 @@ SeasonalWaiter.prototype.load = function() {
* #spiderchef * #spiderchef
*/ */
SeasonalWaiter.prototype.insertSpiderIcons = function() { SeasonalWaiter.prototype.insertSpiderIcons = function() {
let spider16 = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0oKJgYGBobWtXamqqoYTn2I4CI+LTzM2NTulpKbu+vPHz2dV5RWlluZmi3j5+KqFJSSEzpw8uQPdAEYYIzo5Kfjrl28rWFlZzjAzMYuEBQao3Lh+g+HGvbsMzExMDN++fWf4/PXLBzY2tqYNK1f2+4eHM2xcuRLigsT09Igf3384MTExbf767etBI319jU8fPsi+//jx/72HDxh5uLkZ7ty7y/Dz1687Avz8n2UUFR3Z2NjOySoqfmdhYGBg+PbtuwI7O8e5H79+8X379t357PnzYo+ePP7y6cuXc9++f69nYGRsvf/w4XdtLS2R799/bBUWFHr57sP7Jbs3b/ZkzswvUP3165fZ7z9//r988WIVAyPDr8tXr576+u3bpb9//7YwMjKeV1dV41NWVGoVEhDgPH761DJREeHaz1+/lqlpafUx6+jrRfz4+fPy+w8fTu/fsf3uw7t3L39+//4cv7DwGQYGhpdPbt9m4BcRFlNWVJC4fuvWASszs4C379792Ldt2xZBUdEdDP5hYSqQGIjDGa965uYKCalpZQwMDAxhMTG9DAwMDLaurhIkJY7A8IgGBgYGBgd3Dz2yUpeFo6O4rasrA9T24ZRxAAMTwMpgEJwLAAAAAElFTkSuQmCC",
spider32 = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACYVBMVEUAAAAcJSU2Pz85QkM9RUWEhIWMjI2MkJEcJSU2Pz85QkM9RUWWlpc9RUVXXl4cJSU2Pz85QkM8REU9RUVRWFh6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qPwIOIMwDhzX6mQUFIQAgo+9MzcrWrML3mj6+YIKiFCZyhL87RqVQKrEskF+P1BUvfLCAkfRwoPUtq6l5o5+lZb5SolJo6oT8avTCl+c9OTmat6pKW8mLkvBpGzlvsiGuQr4ZEEwA1EQgoR/gNtxIxKBluz+OtMJiF31jHxqXBiAqAUj4WRxpADFM0DCFlv1khvX7Wol4vF4AIldVVxdZqlrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII=";
// Favicon // Favicon
document.querySelector("link[rel=icon]").setAttribute("href", "data:image/png;base64," + spider16); document.querySelector("link[rel=icon]").setAttribute("href", "data:image/png;base64," + spider16);

View File

@ -0,0 +1,5 @@
{
"spider16": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB3UlEQVQ4y2NgGJaAmYGBgVnf0oKJgYGBobWtXamqqoYTn2I4CI+LTzM2NTulpKbu+vPHz2dV5RWlluZmi3j5+KqFJSSEzpw8uQPdAEYYIzo5Kfjrl28rWFlZzjAzMYuEBQao3Lh+g+HGvbsMzExMDN++fWf4/PXLBzY2tqYNK1f2+4eHM2xcuRLigsT09Igf3384MTExbf767etBI319jU8fPsi+//jx/72HDxh5uLkZ7ty7y/Dz1687Avz8n2UUFR3Z2NjOySoqfmdhYGBg+PbtuwI7O8e5H79+8X379t357PnzYo+ePP7y6cuXc9++f69nYGRsvf/w4XdtLS2R799/bBUWFHr57sP7Jbs3b/ZkzswvUP3165fZ7z9//r988WIVAyPDr8tXr576+u3bpb9//7YwMjKeV1dV41NWVGoVEhDgPH761DJREeHaz1+/lqlpafUx6+jrRf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qAUmufb1X3cfRXoluhjZWiwkOnSUcUS6ZD8LUmmhks6b5j1ezkAkAKZBe5QvPPcNBnoCawMwT66Qxk0R2xwwRAui2iSDGuaPDcubzo3EJq8wcx/9Vmk3QryH42QBQCFF0UagIiJtjX6DskIXTLEucJSHIIIMuO0BOcjn3A3ybU/lu5RCUBc5qA0Ih0Q2EWiCPRk7VfMNhjLW1zETic1tLYZDMKyuSsdfh5l6bwho5+0il4kyA0VohlNcF5FP8DlWo/VB16HYB2hJ0pzgIe2mcXxP2IOumPRY17U0tll8KIkZNb+sppafOxYkQPSaYfchyYoL9GMqWYpTLRIq1QUcT4O3aPQgqVqPwIOIMwDhzX6mQUFIQAgo+9MzcrWrML3mj6+YIKiFCZyhL87RqVQKrEskF+P1BUvfLCAkfRwoPUtq6l5o5+lZb5SolJo6oT8avTCl+c9OTmat6pKW8mLkvBpGzlvsiGuQr4ZEEwA1EQgoR/gNtxIxKBluz+OtMJiF31jHxqXBiAqAUj4WRxpADFM0DCFlv1khvX7Wol4vF4AIldVVxdZqlrIfiCYQPHDy6bAGv7nKYRVY6JewExZVAP+ey5Rv+Ba97aaUHMW5NauLmMZFkegBb/EP14d6NoS9QLWFSzWBmuZza8CQmSpXsAqmGtVy14VALWuuYWWy+W3OteXa4jwceQX6+BKG6J1/8+2VCNkm2222WabbbbZZpttttlmm22rt38DCdA0vq3bcAkAAAAASUVORK5CYII="
}

View File

@ -38,7 +38,7 @@ import Chef from "../src/core/Chef.js";
TestRegister.prototype.runTests = function() { TestRegister.prototype.runTests = function() {
return Promise.all( return Promise.all(
this.tests.map(function(test, i) { this.tests.map(function(test, i) {
let chef = new Chef(); const chef = new Chef();
return chef.bake( return chef.bake(
test.input, test.input,
@ -48,7 +48,7 @@ import Chef from "../src/core/Chef.js";
false false
) )
.then(function(result) { .then(function(result) {
let ret = { const ret = {
test: test, test: test,
status: null, status: null,
output: null, output: null,

View File

@ -19,8 +19,8 @@ import "./tests/operations/FlowControl.js";
import "./tests/operations/MorseCode.js"; import "./tests/operations/MorseCode.js";
import "./tests/operations/StrUtils.js"; import "./tests/operations/StrUtils.js";
let allTestsPassing = true, let allTestsPassing = true;
testStatusCounts = { const testStatusCounts = {
total: 0, total: 0,
}; };
@ -32,7 +32,7 @@ let allTestsPassing = true,
* @returns {string} * @returns {string}
*/ */
function statusToIcon(status) { function statusToIcon(status) {
let icons = { const icons = {
erroring: "🔥", erroring: "🔥",
failing: "❌", failing: "❌",
passing: "✔️️", passing: "✔️️",
@ -48,7 +48,7 @@ function statusToIcon(status) {
*/ */
function handleTestResult(testResult) { function handleTestResult(testResult) {
allTestsPassing = allTestsPassing && testResult.status === "passing"; allTestsPassing = allTestsPassing && testResult.status === "passing";
let newCount = (testStatusCounts[testResult.status] || 0) + 1; const newCount = (testStatusCounts[testResult.status] || 0) + 1;
testStatusCounts[testResult.status] = newCount; testStatusCounts[testResult.status] = newCount;
testStatusCounts.total += 1; testStatusCounts.total += 1;
@ -83,8 +83,8 @@ TestRegister.runTests()
console.log("\n"); console.log("\n");
for (let testStatus in testStatusCounts) { for (const testStatus in testStatusCounts) {
let count = testStatusCounts[testStatus]; const count = testStatusCounts[testStatus];
if (count > 0) { if (count > 0) {
console.log(testStatus.toUpperCase(), count); console.log(testStatus.toUpperCase(), count);
} }