Tidying codebase
This commit is contained in:
parent
5efe9bd91d
commit
6abd10f9e2
@ -237,7 +237,10 @@ module.exports = function (grunt) {
|
|||||||
compileTime: compileTime
|
compileTime: compileTime
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
watch: true
|
watch: true,
|
||||||
|
stats: {
|
||||||
|
warningsFilter: /source-map/
|
||||||
|
}
|
||||||
},
|
},
|
||||||
webProd: {
|
webProd: {
|
||||||
target: "web",
|
target: "web",
|
||||||
|
@ -168,17 +168,17 @@ ControlsWaiter.prototype.generateStateUrl = function(includeRecipe, includeInput
|
|||||||
recipeConfig = recipeConfig || this.app.getRecipeConfig();
|
recipeConfig = recipeConfig || this.app.getRecipeConfig();
|
||||||
|
|
||||||
const link = baseURL || window.location.protocol + "//" +
|
const link = baseURL || window.location.protocol + "//" +
|
||||||
window.location.host +
|
window.location.host +
|
||||||
window.location.pathname;
|
window.location.pathname;
|
||||||
const recipeStr = JSON.stringify(recipeConfig);
|
const recipeStr = JSON.stringify(recipeConfig);
|
||||||
const 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
|
||||||
|
|
||||||
const myIncludeRecipe = includeRecipe && (recipeConfig.length > 0);
|
includeRecipe = includeRecipe && (recipeConfig.length > 0);
|
||||||
const myIncludeInput = includeInput && (inputStr.length > 0) && (inputStr.length < 8000);
|
includeInput = includeInput && (inputStr.length > 0) && (inputStr.length < 8000);
|
||||||
|
|
||||||
const params = [
|
const params = [
|
||||||
myIncludeRecipe ? ["recipe", recipeStr] : undefined,
|
includeRecipe ? ["recipe", recipeStr] : undefined,
|
||||||
myIncludeInput ? ["input", inputStr] : undefined,
|
includeInput ? ["input", inputStr] : undefined,
|
||||||
];
|
];
|
||||||
|
|
||||||
const query = params
|
const query = params
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
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.
|
||||||
*
|
*
|
||||||
@ -24,66 +19,12 @@ const SeasonalWaiter = function(app, manager) {
|
|||||||
* Loads all relevant items depending on the current date.
|
* Loads all relevant items depending on the current date.
|
||||||
*/
|
*/
|
||||||
SeasonalWaiter.prototype.load = function() {
|
SeasonalWaiter.prototype.load = function() {
|
||||||
//var now = new Date();
|
|
||||||
|
|
||||||
// SpiderChef
|
|
||||||
// if (now.getMonth() === 3 && now.getDate() === 1) { // Apr 1
|
|
||||||
// this.insertSpiderIcons();
|
|
||||||
// this.insertSpiderText();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Konami code
|
// Konami code
|
||||||
this.kkeys = [];
|
this.kkeys = [];
|
||||||
window.addEventListener("keydown", this.konamiCodeListener.bind(this));
|
window.addEventListener("keydown", this.konamiCodeListener.bind(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replaces chef icons with spider icons.
|
|
||||||
* #spiderchef
|
|
||||||
*/
|
|
||||||
SeasonalWaiter.prototype.insertSpiderIcons = function() {
|
|
||||||
|
|
||||||
// Favicon
|
|
||||||
document.querySelector("link[rel=icon]").setAttribute("href", "data:image/png;base64," + spider16);
|
|
||||||
|
|
||||||
// Bake button
|
|
||||||
document.querySelector("#bake img").setAttribute("src", "data:image/png;base64," + spider32);
|
|
||||||
|
|
||||||
// About box
|
|
||||||
document.querySelector(".about-img-left").setAttribute("src", "data:image/png;base64," + spider64);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replaces all instances of the word "cyber" with "spider".
|
|
||||||
* #spiderchef
|
|
||||||
*/
|
|
||||||
SeasonalWaiter.prototype.insertSpiderText = function() {
|
|
||||||
// Title
|
|
||||||
document.title = document.title.replace(/Cyber/g, "Spider");
|
|
||||||
|
|
||||||
// Body
|
|
||||||
SeasonalWaiter.treeWalk(document.body, function(node) {
|
|
||||||
// process only text nodes
|
|
||||||
if (node.nodeType === 3) {
|
|
||||||
node.nodeValue = node.nodeValue.replace(/Cyber/g, "Spider");
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
// Bake button
|
|
||||||
SeasonalWaiter.treeWalk(document.getElementById("bake-group"), function(node) {
|
|
||||||
// process only text nodes
|
|
||||||
if (node.nodeType === 3) {
|
|
||||||
node.nodeValue = node.nodeValue.replace(/Bake/g, "Spin");
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
// Recipe title
|
|
||||||
document.querySelector("#recipe .title").innerHTML = "Web";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen for the Konami code sequence of keys. Turn the page upside down if they are all heard in
|
* Listen for the Konami code sequence of keys. Turn the page upside down if they are all heard in
|
||||||
* sequence.
|
* sequence.
|
||||||
@ -104,53 +45,4 @@ SeasonalWaiter.prototype.konamiCodeListener = function(e) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Walks through the entire DOM starting at the specified element and operates on each node.
|
|
||||||
*
|
|
||||||
* @static
|
|
||||||
* @param {element} parent - The DOM node to start from
|
|
||||||
* @param {Function} fn - The callback function to operate on each node
|
|
||||||
* @param {booleam} allNodes - Whether to operate on every node or not
|
|
||||||
*/
|
|
||||||
SeasonalWaiter.treeWalk = (function() {
|
|
||||||
// Create closure for constants
|
|
||||||
const skipTags = {
|
|
||||||
"SCRIPT": true, "IFRAME": true, "OBJECT": true,
|
|
||||||
"EMBED": true, "STYLE": true, "LINK": true, "META": true
|
|
||||||
};
|
|
||||||
|
|
||||||
return function(parent, fn, allNodes) {
|
|
||||||
let node = parent.firstChild;
|
|
||||||
|
|
||||||
while (node && node !== parent) {
|
|
||||||
if (allNodes || node.nodeType === 1) {
|
|
||||||
if (fn(node) === false) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If it's an element &&
|
|
||||||
// has children &&
|
|
||||||
// has a tagname && is not in the skipTags list
|
|
||||||
// then, we can enumerate children
|
|
||||||
if (node.nodeType === 1 &&
|
|
||||||
node.firstChild &&
|
|
||||||
!(node.tagName && skipTags[node.tagName])) {
|
|
||||||
node = node.firstChild;
|
|
||||||
} else if (node.nextSibling) {
|
|
||||||
node = node.nextSibling;
|
|
||||||
} else {
|
|
||||||
// No child and no nextsibling
|
|
||||||
// Find parent that has a nextSibling
|
|
||||||
while ((node = node.parentNode) !== parent) {
|
|
||||||
if (node.nextSibling) {
|
|
||||||
node = node.nextSibling;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
export default SeasonalWaiter;
|
export default SeasonalWaiter;
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"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//7YwMjKeV1dV41NWVGo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