";
- }
- document.getElementsByClassName("maskOption")[0].classList.add("maskOptionSelected");
- selectedMask = document.getElementsByClassName("maskOption")[0].id.replace("maskName", "");
- document.getElementById("selectedFramePreview").innerHTML = "Selected: " + frameList[selectedFrame].displayName + " frame with a " + selectedMask + " mask";
- }
-}
-function maskOptionClicked(event) {
- //Determines which mask was selected, and stores that value under 'selectedMask'
- var clickedElement = event.target;
- if (clickedElement.nodeName == "IMG") {
- clickedElement = event.target.parentElement;
- }
- var maskOptionList = document.getElementsByClassName("maskOption");
- for (var i = 0; i < maskOptionList.length; i++) {
- maskOptionList[i].classList.remove("maskOptionSelected");
- }
- clickedElement.classList.add("maskOptionSelected");
- selectedMask = clickedElement.id.replace("maskName", "");
- document.getElementById("selectedFramePreview").innerHTML = "Selected: " + frameList[selectedFrame].displayName + " frame with a " + selectedMask + " mask";
-}
-function addFrameToCardMaster(right = "") {
- //Takes the stored selectedFrame and selectedMask to add the frame w/ mask to the card master!
- if (selectedFrame > -1 && selectedMask != "") {
- //In order to both keep input values and insert new frames before old ones, they must be added like so:
- cardMaster.insertBefore(frameList[selectedFrame].cardMasterElement(selectedMask + right), cardMaster.children[newFrameInsertionLocation]);
- cardMasterUpdated();
- }
-}
-function deleteCardMasterElement(event) {
- event.target.parentElement.parentElement.removeChild(event.target.parentElement);
- cardMasterUpdated();
-}
-function addNewFrameOption(imageSource) {
- var availableMasks = "";
- for (var i = 2; i < maskNameList.length; i++) {
- availableMasks += maskNameList[i] + "-0-0-" + cardWidth + "-" + cardHeight + ";";
- }
- availableMasks = availableMasks.substring(0, availableMasks.length - 1);
- frameList[frameList.length] = new frameImage("Custom", imageSource, availableMasks, "Eternal;Custom ");
- frameList[frameList.length - 1].image.customVar = frameList.length - 1;
- frameList[frameList.length - 1].image.onload = function() {
- frameList[this.customVar].framePickerElement();
- }
-}
-
-
-/* Card Master Cool Stuff! */
-function cardMasterUpdated() {
-// console.log("The card master is updating!");
- frameFinalContext.clearRect(0, 0, cardWidth, cardHeight);
- for (var i = cardMaster.children.length - 1; i >= 0; i--) {
- var targetChild = cardMaster.children[i];
- if (parseInt(targetChild.id.replace("frameIndex", "")) == -1) {
- //The card art placeholder is manually set to -1 and cannot be removed :)
- frameFinalContext.drawImage(cardArt, version.artX + getValue("inputCardArtX"), version.artY + getValue("inputCardArtY"), cardArt.width * getValue("inputCardArtZoom") / 100, cardArt.height * getValue("inputCardArtZoom") / 100);
- } else if (parseInt(targetChild.id.replace("frameIndex", "")) == -2) {
- if (i == 0) {
- newFrameInsertionLocation = 1;
- } else {
- newFrameInsertionLocation = 0;
- }
- frameFinalContext.drawImage(watermarkCanvas, 0, 0, cardWidth, cardHeight)
- frameFinalContext.drawImage(textCanvas, 0, 0, cardWidth, cardHeight);
- } else {
- var frameToDraw = frameList[parseInt(targetChild.id.replace("frameIndex", ""))];
- var opacityToDraw = targetChild.children[1].children[1].value / 100;
- var maskName = targetChild.innerHTML.slice(targetChild.innerHTML.indexOf("(") + 1, targetChild.innerHTML.indexOf(")"));
- var sectionMask = "none"
- if (maskName.includes(" - ")) {
- sectionMask = maskName.split(" - ")[1];
- maskName = maskName.split(" - ")[0];
- }
- var maskIndex = frameToDraw.maskOptionList.indexOf(maskName);
- var maskImageIndex = maskNameList.indexOf(maskName)
- //Clears the temporary mask canvas, draws the mask, draws the image over it, then copies it to the final frame canvas
- frameMaskContext.globalCompositeOperation = "source-over";
- frameMaskContext.clearRect(0, 0, cardWidth, cardHeight);
- frameMaskContext.drawImage(maskList[maskImageIndex], 0, 0, cardWidth, cardHeight);
- frameMaskContext.globalCompositeOperation = "source-in";
- if (sectionMask != "none") {
- frameMaskContext.drawImage(maskList[maskNameList.indexOf(sectionMask)], 0, 0, cardWidth, cardHeight);
- }
- frameMaskContext.drawImage(frameToDraw.image, frameToDraw.xList[maskIndex], frameToDraw.yList[maskIndex], frameToDraw.widthList[maskIndex], frameToDraw.heightList[maskIndex]);
- if (targetChild.children[1].children[2].checked == true) {
- frameFinalContext.globalCompositeOperation = "destination-out";
- }
- frameFinalContext.globalAlpha = opacityToDraw;
- frameFinalContext.drawImage(frameMaskCanvas, 0, 0, cardWidth, cardHeight);
- frameFinalContext.globalAlpha = 1;
- if (targetChild.children[1].children[2].checked == true) {
- frameFinalContext.globalCompositeOperation = "destination-over";
- frameFinalContext.drawImage(cardArt, version.artX + getValue("inputCardArtX"), version.artY + getValue("inputCardArtY"), cardArt.width * getValue("inputCardArtZoom") / 100, cardArt.height * getValue("inputCardArtZoom") / 100);
- }
- frameFinalContext.globalCompositeOperation = "source-over";
- }
- }
- updateBottomInfoCanvas();
-}
-
-
-/* Overall card stuff */
-function cardImageUpdated() {
- //Clear the canvases
- cardFinalContext.fillStyle = "black";
- cardFinalContext.fillRect(0, 0, cardWidth, cardHeight);
- displayContext.clearRect(0, 0, cardWidth, cardHeight);
- //Draw the art, frame, text, bottom info, mana cost, watermark, and set symbol
- // cardFinalContext.drawImage(cardArt, version.artX + getValue("inputCardArtX"), version.artY + getValue("inputCardArtY"), cardArt.width * getValue("inputCardArtZoom") / 100, cardArt.height * getValue("inputCardArtZoom") / 100)
- cardFinalContext.drawImage(frameFinalCanvas, 0, 0, cardWidth, cardHeight);
- if (version.currentVersion == "planeswalker") {
- cardFinalContext.drawImage(planeswalkerCanvas, 0, 0, cardWidth, cardHeight);
- }
- cardFinalContext.drawImage(bottomInfoCanvas, 0, 0, cardWidth, cardHeight);
-// cardFinalContext.drawImage(textCanvas, 0, 0, cardWidth, cardHeight);
- cardFinalContext.drawImage(setSymbolCanvas, 0, 0, cardWidth, cardHeight)
- cardFinalContext.drawManaCost(document.getElementById("inputManaCost").value, version.manaCostX, version.manaCostY, version.manaCostDiameter, version.manaCostDistance, version.manaCostDirection, version.manaCostVersion)
- //Clear the corners
- cardFinalContext.globalCompositeOperation = "destination-out"
- cardFinalContext.drawImage(maskList[1], 0, 0, cardWidth, cardHeight)
- cardFinalContext.globalCompositeOperation = "source-over"
- //Copy it to the visible canvas
- displayContext.drawImage(cardFinalCanvas, 0, 0, cardWidth, cardHeight);
-}
-
-
-/* Loading/manipulating card versions */
-function changeVersionTo(versionToChangeTo) {
- loadScript("data/versions/" + versionToChangeTo + ".js");
-}
-function finishChangingVersion(targetCSV = false) {
- for (var i = 0; i < version.masksToAdd.length; i++) {
- if (!maskNameList.includes(version.masksToAdd[i])) {
- maskNameList[maskNameList.length] = version.masksToAdd[i];
- maskList[maskList.length] = new Image();
- maskList[maskList.length - 1].crossOrigin = "anonymous";
- maskList[maskList.length - 1].src = "data/images/masks/" + version.masksToAdd[i].replace(/ /g, "") + ".png";
- }
- }
- document.getElementById("inputWhichTextTabs").innerHTML = ""
- for (var i = 0; i < version.textList.length; i ++) {
- document.getElementById("inputWhichTextTabs").innerHTML += "
" + version.textList[i][0] + "
"
- if (i == 0) {
- document.getElementsByClassName("textTabButton")[0].classList.add("activeTextTab")
- }
- }
- console.log("version changed, time to load the image csv")
- if (targetCSV != false) {
- loadImageCSV(targetCSV);
- }
-}
-
-
-/* Text functions! */
-function textTabFunction(event, target) {
- var textTabButtons = document.getElementsByClassName("textTabButton")
- for (var i = 0; i < textTabButtons.length; i++) {
- textTabButtons[i].classList.remove("activeTextTab")
- }
- event.target.classList.add("activeTextTab")
- for (var i = 0; i < version.textList.length; i ++) {
- if (version.textList[i][0] == target.replace("option", "")) {
- whichTextIndex = i
- document.getElementById("inputText").value = version.textList[whichTextIndex][1]
- }
-
- }
-}
-function updateText() {
- version.textList[whichTextIndex][1] = document.getElementById("inputText").value
- clearTimeout(updateTextDelay)
- updateTextDelay = setTimeout(rewriteText, 250);
-}
-function rewriteText() {
- textContext.clearRect(0, 0, cardWidth, cardHeight)
- for (var i = 0; i < version.textList.length; i ++) {
- if (version.textList[i][10]) {
- if (version.textList[i][10] != "ignore") {
- window[version.textList[i][10]]();
- }
- } else {
- textContext.writeText(version.textList[i][1], version.textList[i][2], version.textList[i][3], version.textList[i][4], version.textList[i][5], version.textList[i][6], version.textList[i][7], version.textList[i][8], version.textList[i][9]);
- }
- }
- cardMasterUpdated()
-}
-
-
-/* functions for all the little parts of the card */
-function updateBottomInfoCanvas() {
- window[version.bottomInfoFunction]()
-}
-
-
-/* Misc/general convenient little functions */
-function scale(input) {
- return input * cardWidth / 744;
-}
-function getValue(elementId) {
- return parseFloat(document.getElementById(elementId).value)
-}
-function beforeAfter(targetString, beforeString, afterString) {
- if (targetString.includes(beforeString) && targetString.includes(afterString)) {
- return targetString.split(beforeString)[1].split(afterString)[0];
- } else {
- return "";
- }
-}
-
-
-/* Functions that make stuff */
-function newCanvas(newCanvasName, padding = 0) {
- window[newCanvasName + "Canvas"] = document.createElement("canvas");
- window[newCanvasName + "Canvas"].width = cardWidth + padding * 2;
- window[newCanvasName + "Canvas"].height = cardHeight + padding * 2;
- window[newCanvasName + "Context"] = window[newCanvasName + "Canvas"].getContext("2d");
-}
-
-
-/* Functions that manage the website */
-function toggleTabs(event, targetTab, tabSubject) {
- var tabList = document.getElementsByClassName(tabSubject);
- for (var i = 0; i < tabList.length; i++) {
- tabList[i].classList.remove("tabVisible");
- tabList[i].classList.remove("tabOptionSelected");
- }
- document.getElementById(targetTab).classList.add("tabVisible");
- event.target.classList.add("tabOptionSelected");
-}
-function loadScript(scriptPath){
- var script = document.createElement("script");
- script.setAttribute("type","text/javascript");
- script.setAttribute("src", scriptPath);
- if (typeof script != "undefined") {
- document.getElementsByTagName("head")[0].appendChild(script);
- }
-}
-
-
-
-
-/*
- Directly taken (with small edits) from previous version.
- sort these!!!
-*/
-
-
-
-
-
-//figures out the placing of the set symbol
-function updateSetSymbol() {
- setSymbolContext.clearRect(0, 0, cardWidth, cardHeight)
- var setSymbolWidth, setSymbolHeight, setSymbolX, setSymbolY
- if (version.setSymbolWidth / version.setSymbolHeight < setSymbol.width / setSymbol.height) {
- //wider
- setSymbolWidth = version.setSymbolWidth
- setSymbolHeight = version.setSymbolWidth / setSymbol.width * setSymbol.height
- setSymbolX = version.setSymbolRight - setSymbolWidth
- setSymbolY = version.setSymbolVertical - setSymbolHeight / 2
- } else {
- //taller
- setSymbolHeight = version.setSymbolHeight
- setSymbolWidth = version.setSymbolHeight / setSymbol.height * setSymbol.width
- setSymbolX = version.setSymbolRight - setSymbolWidth
- setSymbolY = version.setSymbolVertical - setSymbolHeight / 2
- }
- if (version.currentVersion == "future") {
- //Also center the set symbol horizontally
- setSymbolX = version.setSymbolRight - setSymbolWidth / 2;
- }
- setSymbolContext.drawImage(setSymbol, setSymbolX, setSymbolY, setSymbolWidth, setSymbolHeight)
- cardImageUpdated()
-}
-function updateWatermark() {
- if (document.getElementById("inputWatermarkPrimary").value != "none") {
- watermarkContext.clearRect(0, 0, cardWidth, cardHeight)
- var watermarkX, watermarkY, watermarkWidth, watermarkHeight
- if (version.watermarkWidth / version.watermarkHeight < watermark.width / watermark.height) {
- //wider
- watermarkWidth = version.watermarkWidth
- watermarkHeight = version.watermarkWidth / watermark.width * watermark.height
- watermarkX = cardWidth / 2 - watermarkWidth / 2
- watermarkY = version.watermarkY - watermarkHeight / 2
- } else {
- //taller
- watermarkHeight = version.watermarkHeight
- watermarkWidth = version.watermarkHeight / watermark.height * watermark.width
- watermarkX = cardWidth / 2 - watermarkWidth / 2
- watermarkY = version.watermarkY - watermarkHeight / 2
- }
- watermarkContext.drawImage(watermark, watermarkX, watermarkY, watermarkWidth, watermarkHeight)
- watermarkContext.globalCompositeOperation = "source-in"
- if (document.getElementById("inputWatermarkPrimary").value != "default") {
- watermarkContext.fillStyle = document.getElementById("inputWatermarkPrimary").value
- watermarkContext.fillRect(0, 0, cardWidth, cardHeight)
- }
- if (document.getElementById("inputWatermarkSecondary").value != "none") {
- watermarkContext.globalCompositeOperation = "source-atop"
- tempContext.clearRect(0, 0, cardWidth, cardHeight)
- tempContext.drawImage(maskList[0], 0, 0, cardWidth, cardHeight)
- tempContext.globalCompositeOperation = "source-in"
- if (document.getElementById("inputWatermarkSecondary").value == "default") {
- tempContext.drawImage(watermark, watermarkX, watermarkY, watermarkWidth, watermarkHeight)
- } else {
- tempContext.fillStyle = document.getElementById("inputWatermarkSecondary").value
- tempContext.fillRect(0, 0, cardWidth, cardHeight)
- }
- tempContext.globalCompositeOperation = "source-over"
- watermarkContext.drawImage(tempCanvas, 0, 0, cardWidth, cardHeight)
- }
- watermarkContext.globalCompositeOperation = "source-over"
- } else {
- watermarkContext.clearRect(0, 0, cardWidth, cardHeight)
- }
- cardMasterUpdated();
-}
-
-//Custom text function! This acts on any codes and makes things look nice :)
-CanvasRenderingContext2D.prototype.writeText = function(text = "", textX = 0, textY = 0, textWidth = cardWidth, textHeight = cardHeight, textFont = "belerenbsc", inputTextSize = 38, textColor="black", other="", completionFunction) {
- paragraphContext.clearRect(0, 0, cardWidth, cardHeight)
- var textSize = inputTextSize
- lineContext.font = textSize + "px " + textFont
- lineContext.fillStyle = textColor
- var otherParameters = other.split(",")
- var outline, shadow = 0, oneLine = false, outlineWidth = 2, textAlign = "left", verticalAlign = true, lineSpace = 1, userHorizontalShift = 0
- for (var i = 0; i < otherParameters.length; i ++) {
- eval(otherParameters[i])
- }
- lineContext.strokeStyle = outline
- lineContext.lineWidth = outlineWidth
- var currentLineX = textCanvasesPadding + userHorizontalShift
- var currentLineY = textY + (textSize * 0.45) //+ textCanvasesPadding
- var uniqueSplitter = "9dn57gwbt4sh"
- var splitString = text.replace(/\n/g, "{line}").replace(/ /g, uniqueSplitter + " " + uniqueSplitter).replace(/{/g, uniqueSplitter + "{").replace(/}/g, "}" + uniqueSplitter).split(uniqueSplitter)
- splitString[splitString.length] = " "
- var lastWordAdded = ""
- for (var i = 0; i < splitString.length; i++) {
- if (splitString[i] != "") {
- var wordToWrite = splitString[i]
- var finishLine = false
- if (splitString[i].includes("{") && splitString[i].includes("}")) {
- //It may be a code
- wordToWrite = ""
- possibleCodeLower = splitString[i].toLowerCase().replace("{", "").replace("}", "")
- if (possibleCodeLower == "line" && !oneLine) {
- finishLine = true
- currentLineY += textSize * 0.35
- } else if (possibleCodeLower == "linenospace" && ! oneLine) {
- finishLine = true
- } else if (possibleCodeLower == "bar" || possibleCodeLower == "flavor") {
- finishLine = true
- var barWidth = manaSymbolImageList[63].width
- var barHeight = manaSymbolImageList[63].height
- lineContext.drawImage(manaSymbolImageList[63], textX + textWidth / 2 - barWidth / 2, currentLineY + textSize * 0.6, barWidth, barHeight)
- currentLineY += textSize * 0.8
- if (possibleCodeLower == "flavor") {
- lineContext.font = "italic " + (textSize - 3) + "px " + textFont
- }
- } else if (possibleCodeLower.includes("fontsize")) {
- textSize += parseInt(possibleCodeLower.slice(8, possibleCodeLower.length))
- lineContext.font = textSize + "px " + textFont
- } else if (possibleCodeLower == "i") {
- lineContext.font = "italic " + textSize + "px " + textFont
- } else if (possibleCodeLower == "/i") {
- lineContext.font = textSize + "px " + textFont
- } else if (possibleCodeLower == "center") {
- textAlign = "center"
- } else if (possibleCodeLower == "right") {
- textAlign = "right"
- } else if (possibleCodeLower == "left") {
- textAlign = "left"
- } else if (possibleCodeLower.includes("up")) {
- currentLineY -= (parseInt(possibleCodeLower.slice(2, possibleCodeLower.length)))
- } else if (possibleCodeLower.includes("down")) {
- currentLineY += (parseInt(possibleCodeLower.slice(4, possibleCodeLower.length)))
- } else if (possibleCodeLower.includes("left")) {
- userHorizontalShift -= (parseInt(possibleCodeLower.slice(4, possibleCodeLower.length)));
- currentLineX -= (parseInt(possibleCodeLower.slice(4, possibleCodeLower.length)));
- } else if (possibleCodeLower.includes("right")) {
- userHorizontalShift += (parseInt(possibleCodeLower.slice(5, possibleCodeLower.length)));
- currentLineX += (parseInt(possibleCodeLower.slice(5, possibleCodeLower.length)));
- } else if (possibleCodeLower == "artistbrush") {
- var artistBrushWidth = textSize * 1.2
- lineContext.drawImage(manaSymbolImageList[62], currentLineX, currentLineY - artistBrushWidth * 0.58, artistBrushWidth, artistBrushWidth * 13 / 21)
- currentLineX += artistBrushWidth * 1.1
- } else if (possibleCodeLower == "oldartistbrush") {
- var artistBrushWidth = textSize * 2.4
- if (lineContext.fillStyle == "#ffffff" || lineContext.fillStyle == "white") {
- lineContext.drawImage(manaSymbolImageList[64], currentLineX, currentLineY - artistBrushWidth * 13 / 63, artistBrushWidth, artistBrushWidth * 13 / 63);
- } else {
- lineContext.drawImage(manaSymbolImageList[65], currentLineX, currentLineY - artistBrushWidth * 13 / 63, artistBrushWidth, artistBrushWidth * 13 / 63);
- }
- currentLineX += artistBrushWidth * 1.1
- } else if (possibleCodeLower.includes("fontcolor")) {
- lineContext.fillStyle = possibleCodeLower.slice(9, possibleCodeLower.length)
- } else if (possibleCodeLower.includes("font")) {
- textFont = possibleCodeLower.slice(5, possibleCodeLower.length)
- lineContext.font = textSize + "px " + textFont
- } else if (possibleCodeLower.includes("outline:")) {
- outline = true;
- lineContext.strokeStyle = possibleCodeLower.replace("outline:", "").split(",")[0];
- lineContext.lineWidth = parseInt(possibleCodeLower.replace("outline:", "").split(",")[1]);
- } else if (possibleCodeLower.includes("shadow")) {
- shadow = parseInt(possibleCodeLower.replace("shadow", ""));
- } else if (manaSymbolCodeList.includes(possibleCodeLower.split("/").join(""))) {
- //THIS HAS TO BE THE LAST ONE
- var manaSymbolDiameter = textSize * 0.77
- lineContext.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf(possibleCodeLower.split("/").join(""))], currentLineX, currentLineY - manaSymbolDiameter * 0.95, manaSymbolDiameter, manaSymbolDiameter)
- currentLineX += manaSymbolDiameter * 1.02
- } else {
- wordToWrite = splitString[i]
- }
- }
- if (wordToWrite != "" || finishLine == true) {
- //We're left with a word. Write it.
- var currentWordWidth = lineContext.measureText(wordToWrite).width
- if (i == splitString.length - 1) {
- //forces the last artificially added space to be too wide, making sure the last line is drawn in.
- currentWordWidth = textWidth + 1
- }
- if (currentLineX - textCanvasesPadding + currentWordWidth > textWidth || finishLine) {
- //Finish the line
- if (oneLine && i != splitString.length - 1 && inputTextSize > 1) {
- lineContext.clearRect(0, 0, cardWidth + 2 * textCanvasesPadding, cardHeight + 2 * textCanvasesPadding)
- this.writeText(text, textX, textY, textWidth, textHeight, textFont, inputTextSize - 1, textColor, other)
- return
- }
- var alignAdjust = 0
- if (textAlign == "center" || textAlign == "right") {
- if (lastWordAdded == " ") {
- currentLineX -= textContext.measureText(" ").width
- }
- if (textAlign == "center") {
- alignAdjust = textWidth / 2 - (currentLineX - textCanvasesPadding) / 2 + textX
- } else if (textAlign == "right") {
- alignAdjust = textWidth + textX - currentLineX + textCanvasesPadding
- }
- } else {
- alignAdjust += textX
- }
- paragraphContext.drawImage(lineCanvas, 0 + alignAdjust - textCanvasesPadding, 0, cardWidth + 2 * textCanvasesPadding, cardHeight + 2 * textCanvasesPadding)
- lineContext.clearRect(0, 0, cardWidth + 2 * textCanvasesPadding, cardHeight + 2 * textCanvasesPadding)
- currentLineY += textSize * lineSpace
- currentLineX = textCanvasesPadding + userHorizontalShift
- if (wordToWrite == " ") {
- currentWordWidth = 0
- }
- }
- //Whether or not the current line is finished, write to it.
- if (shadow > 0) {
- lineContext.fillStyle = "black";
- lineContext.fillText(wordToWrite, currentLineX + shadow, currentLineY + shadow);
- lineContext.fillStyle = textColor;
- }
- if (outline != undefined) {
- lineContext.strokeText(wordToWrite, currentLineX, currentLineY)
- }
- lineContext.fillText(wordToWrite, currentLineX, currentLineY)
- currentLineX += currentWordWidth
- lastWordAdded = wordToWrite
- }
- }
- }
- verticalAdjust = 0
- if (verticalAlign) {
- verticalAdjust = (textHeight + textY - currentLineY + textSize) / 2
- }
- this.drawImage(paragraphCanvas, 0, 0 + verticalAdjust, cardWidth, cardHeight)
- if (text != "") {
-// console.log(text)
- }
- if (completionFunction) {
- window[completionFunction]();
- }
- return "done"
-}
-//Loads up all the mana symbol images
-function loadManaSymbolImages() {
- for (var i = 0; i < manaSymbolCodeList.length; i++) {
- manaSymbolImageList[i] = new Image()
- manaSymbolImageList[i].crossOrigin = "anonymous";
- manaSymbolImageList[i].src = "data/images/manaSymbols/" + i + ".png"
- }
-}
-//Draws a mana cost
-CanvasRenderingContext2D.prototype.drawManaCost = function(text, symbolsX, symbolsY, diameter = 50, distance = -50, direction = "horizontal", version = "m15") {
- var splitManaCost = text.toLowerCase().replace(/{/g, " ").replace(/}/g, " ").split("/").join("").split(" ")
- if (version == "future") {
- splitManaCost.reverse();
- }
- var currentSymbolIndex = 0
- var currentX = symbolsX
- var currentY = symbolsY
- var realManaCostIndex = 0;
- for (var i = splitManaCost.length - 1; i >= 0; i --) {
- if (manaSymbolCodeList.includes(splitManaCost[i])) {
-// console.log(realManaCostIndex, splitManaCost[i])
- if (Array.isArray(direction) && realManaCostIndex < direction.length) {
- currentX = direction[realManaCostIndex][0]
- currentY = direction[realManaCostIndex][1]
- }
- if (version == "m15") {
- this.fillStyle = "black"
- this.beginPath()
- this.arc(currentX + diameter / 2.13, currentY + diameter / 1.7, diameter / 2, 0, 2 * Math.PI, false)
- this.fill()
- this.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf(splitManaCost[i])], currentX, currentY, diameter, diameter)
- } else if (version == "justTheSymbol") {
- this.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf(splitManaCost[i])], currentX, currentY, diameter, diameter)
- } else if (version == "seventh") {
- this.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf(splitManaCost[i])], currentX, currentY, diameter, diameter)
- } else if (version == "future") {
- if (realManaCostIndex < direction.length) {
- if (window.version.futureManaSymbolNameList.includes(splitManaCost[i]) && window.version.futureManaSymbolImageList[window.version.futureManaSymbolNameList.indexOf(splitManaCost[i])]) {
- this.drawImage(window.version.futureManaSymbolImageList[window.version.futureManaSymbolNameList.indexOf(splitManaCost[i])], currentX, currentY, diameter, diameter)
- } else {
- this.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf(splitManaCost[i])], currentX, currentY, diameter, diameter)
- }
- }
- }
- if (direction == "horizontal") {
- currentX += distance
- } else if (direction == "vertical") {
- currentY += distance
- }
- realManaCostIndex += 1;
- }
- }
-}
-
-//Removes all the white pixels in an image
-var whiteThreshold = 250
-function whiteToTransparent(targetImage, source = targetImage.src) {
- //Create image, size canvas, draw image
- var imgTempTarget = new Image()
- imgTempTarget.crossOrigin = "anonymous"
- imgTempTarget.src = source
- imgTempTarget.onload = function() {
- if (imgTempTarget.width > 0 && imgTempTarget.height > 0) {
- transparentCanvas.width = imgTempTarget.width
- transparentCanvas.height = imgTempTarget.height
- transparentContext.drawImage(imgTempTarget, 0, 0)
- //declare variables
- var width = transparentCanvas.width
- var height = transparentCanvas.height
- var imageData = transparentContext.getImageData(0, 0, transparentCanvas.width, transparentCanvas.height)
- var x, y, index
- //Go through every pixel and
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- index = (y * width + x) * 4
- if (imageData.data[index] >= whiteThreshold && imageData.data[index + 1] >= whiteThreshold && imageData.data[index + 2] >= whiteThreshold) {
- imageData.data[index + 3] = 0
- }
- }
- }
- transparentContext.clearRect(0, 0, width, height)
- transparentContext.putImageData(imageData, 0, 0)
- targetImage.src = transparentCanvas.toDataURL()
- autocrop(targetImage)
- }
- }
-}
-//Removes all the whitespace in an image
-function autocrop(targetImage, source = targetImage.src) {
- //Create image, size canvas, draw image
- var imgTempTarget = new Image()
- imgTempTarget.crossOrigin = "anonymous"
- imgTempTarget.src = source
- imgTempTarget.onload = function() {
- if (imgTempTarget.width > 0 && imgTempTarget.height > 0) {
- cropCanvas.width = imgTempTarget.width
- cropCanvas.height = imgTempTarget.height
- cropContext.drawImage(imgTempTarget, 0, 0)
- //declare variables
- var width = cropCanvas.width
- var height = cropCanvas.height
- var pix = {x:[], y:[]}
- var imageData = cropContext.getImageData(0, 0, cropCanvas.width, cropCanvas.height)
- var x, y, index
- if (imageData.data.length > 4) {
- //Go through every pixel and
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- //(y * width + x) * 4 + 3 calculates the index at which the alpha value of the pixel at x, y is given
- index = (y * width + x) * 4 + 3
- if (imageData.data[index] > 0) {
- //pix is the image object that stores two arrays of x and y coordinates. These stored coordinates are all the visible pixels
- pix.x.push(x)
- pix.y.push(y)
- }
- }
- }
- //sorts the arrays numerically
- pix.x.sort(function(a,b){return a-b});
- pix.y.sort(function(a,b){return a-b});
- var n = pix.x.length - 1;
- //Finds the difference between the leftmost and rightmost visible pixels, and the topmost and bottommost pixels, cuts out a section of the canvas
- width = pix.x[n] - pix.x[0];
- height = pix.y[n] - pix.y[0];
- var cropped = cropContext.getImageData(pix.x[0], pix.y[0], width + 1, height + 1);
- //Resizes the canvas and draws cropped image
- cropCanvas.width = width + 1;
- cropCanvas.height = height + 1;
- cropContext.putImageData(cropped, 0, 0);
- //Saves the newly cropped image to the given image
- setTimeout(function() {targetImage.src = cropCanvas.toDataURL();}, 100)
- }
- }
- }
-}
-//The next several functions are all about loading images!
-function uploadImage(event, destination) {
- var input = event.target;
- var reader = new FileReader();
- reader.onload = function() {
- var dataURL = reader.result;
- destination.src = dataURL;
- if (destination == setSymbol) {
- autocrop(setSymbol)
- }
- }
- reader.readAsDataURL(input.files[0]);
-}
-function retrieveLocalURL(event) {
- var input = event.target;
- var reader = new FileReader();
- reader.onload = function() {
- addNewFrameOption(reader.result)
- // return reader.result;
- }
- reader.readAsDataURL(input.files[0]);
-}
-var savedArtList = [], cardArtUrlList = [], cardArtArtistList = []
-function inputCardArtName(cardArtNameInput) {
- var xhttp = new XMLHttpRequest()
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- savedArtList = this.responseText.split('"art_crop":"')
- savedArtList.splice(0, 1)
- document.getElementById("inputCardArtNameNumber").max = savedArtList.length
- document.getElementById("inputCardArtNameNumber").value = 1
- for (i = 0; i < savedArtList.length; i ++) {
- cardArtUrlList[i] = savedArtList[i].split('","border_crop":')[0]
- }
- for (i = 0; i < savedArtList.length; i ++) {
- cardArtArtistList[i] = savedArtList[i].slice(savedArtList[i].indexOf('"artist":"') + 10, savedArtList[i].indexOf('","artist_id'));
- // cardArtArtistList[i] = cardArtArtistList[i].slice(0, cardArtArtistList[i].indexOf('","artist_id'))
- }
- inputCardArtNameNumber(1)
- } else if (this.readyState == 4 && this.status == 404) {
- alert("Sorry, but we can't seem to find any art for '" + cardArtNameInput + "'")
- }
- }
- xhttp.open("GET", "https://api.scryfall.com/cards/search?order=released&unique=art&q=name%3D" + cardArtNameInput.replace(/ /g, "_"), true)
- xhttp.send()
-}
-function inputCardArtNameNumber(cardArtNameNumberInput) {
- cardArt.src = cardArtUrlList[cardArtNameNumberInput - 1]
- document.getElementById("inputInfoArtist").value = cardArtArtistList[cardArtNameNumberInput - 1]
- updateBottomInfoCanvas()
-}
-//Downloads the image!
-function downloadCardImage(linkElement) {
- if (document.getElementById("inputInfoArtist").value.replace(/ /g, "") != "") {
- linkElement.download = version.textList[0][1].toLowerCase().replace(/ /g, "_") + ".png"
- if (linkElement.download == ".png") {
- linkElement.download = "card.png"
- }
- } else {
- event.preventDefault()
- alert("You must properly credit an artist before downloading")
- }
- var cardImageData = cardFinalCanvas.toDataURL()
- if (cardImageData == undefined) {
- alert("Sorry, it seems that you cannot download your card. Please try using a different browser/device.")
- }
- linkElement.href = cardImageData
-}
-
-
-
-
-// function setCookie(cookieName, cookieValue, cookieTime = (5 * 365 * 24 * 60 * 60 * 1000)) { //years*days*hours*minutes*seconds*milliseconds
-// var tempDate = new Date();
-// tempDate.setTime(tempDate.getTime() + cookieTime);
-// var expires = "expires=" + tempDate.toUTCString();
-// document.cookie = cookieName + "=" + cookieValue + ";" + expires + ";path=/";
-// }
-// function getCookie(cookieName) {
-// var name = cookieName + "=";
-// var cookieArray = document.cookie.split(";");
-// for(var i = 0; i < cookieArray.length; i++) {
-// var tempCookie = cookieArray[i];
-// while (tempCookie.charAt(0) == " ") {
-// tempCookie = tempCookie.substring(1);
-// }
-// if (tempCookie.indexOf(name) == 0) {
-// return tempCookie.substring(name.length, tempCookie.length);
-// }
-// }
-// return "";
-// }
-// function checkCookies() {
-// if (getCookie("tooltipsToggled") == "false") {
-// toggleTooltips(false)
-// document.getElementById("tooltipToggler").checked = false
-// }
-// if (getCookie("advancedBorders") == "true") {
-// document.getElementById("checkboxAdvanced").checked = true
-// hideShowFrameTypes()
-// }
-// }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-function textCodeTutorial() {
- var textCodeTutorialString = `line-skips to the next line
- _linenospace-skips to the next line, but doesn't add spacing
- _bar-skips to the next line, and adds the flavor text bar
- _flavor-skips to the next line, adds the flavor text bar, and italicizes the following text
- _i-italicizes the following text
- _/i-removes italics from the following text
- _fontsize#-changes the font size to # pixels
- _fontcolor#-changes the color to #. Can use color names, or hex codes
- _left-justifies text to the left
- _center-justifies text to the center
- _right-justifies text to the right
- _up#-moves the following text # pixels up
- _down#-moves the following text # pixels down
- _left#-moves the following text # pixels left
- _right#-moves the following text # pixels right
- _SYMBOL-creates a mana symbol, where SYMBOL can be: w, u, b, r, g, 1, 2, 3, etc...
- _outline:*,#-outlines the following text with # thickness and * color
- _shadow#-creates a text shadow # pixels left and # pixels right`
- var textCodeTutorialArray = textCodeTutorialString.split("_")
- for (var i = 0; i < textCodeTutorialArray.length; i ++) {
- document.getElementById("textCodeTutorial").innerHTML += "
{" + textCodeTutorialArray[i].split("-")[0] + "}
" + textCodeTutorialArray[i].split("-")[1] + "
"
- }
-}
-
-// //textCodeTutorial()
-textCodeTutorial()
-loadSampleImages()
-
-
-
-
-function filterFramePicker(classToShow) {
- var framePickerList = document.getElementsByClassName("frameOption")
- for (var i = 0; i < framePickerList.length; i++) {
- if (!framePickerList[i].classList.contains("hidden") && !framePickerList[i].classList.contains(classToShow) && !framePickerList[i].classList.contains("frameClassEternal")) {
- framePickerList[i].classList.add("hidden")
- } else if (framePickerList[i].classList.contains(classToShow) && framePickerList[i].classList.contains("hidden")) {
- framePickerList[i].classList.remove("hidden")
- }
- }
-}
-
-
-function loadSampleImages() {
- var availableSamples = 12;
- var samplesToLoad = [0,0,0];
- for (var i = 1; i <= samplesToLoad.length; i ++) {
- var sampleImage = new Image()
- sampleImage.customVarIndex = i;
- var randomIndex = 0;
- sampleImage.onload = function() {
- document.getElementById(("sample" + this.customVarIndex)).src = this.src;
- }
- while(samplesToLoad[i - 1] == 0) {
- randomIndex = Math.floor(Math.random() * (availableSamples)) + 1;
- if (!samplesToLoad.includes(randomIndex)) {
- samplesToLoad[i - 1] = randomIndex;
- }
- }
- sampleImage.src = "data/site/images/samples/" + randomIndex + ".png";
- }
- //Donate card stuff!
- var cardWishlist = [["Riku of Two Reflections", "https://img.scryfall.com/cards/large/front/7/1/716d0b3b-bac9-4fb8-882e-bd6171864043.jpg?1562916032"], ["Klothys, God of Destiny", "https://img.scryfall.com/cards/large/front/4/d/4d747889-04db-4e7a-ad4c-7549514b5112.jpg?1577968427"], ["Ramunap Excavator", "https://img.scryfall.com/cards/large/front/9/0/90a54d18-8403-441d-a115-ee462fabdabb.jpg?1562806928"], ["Birds of Paradise", "https://img.scryfall.com/cards/large/front/f/e/feefe9f0-24a6-461c-9ef1-86c5a6f33b83.jpg?1576382980"], ["Xantcha, Sleeper Agent", "https://img.scryfall.com/cards/large/front/8/9/89b03b9a-7e20-47cb-bc64-23513acea855.jpg?1566340797"],["Adobe Photoshop... Wait, that's not a card! Regardless, I would love to see what frames I could add if I had photoshop","https://i0.wp.com/www.keysbundle.com/wp-content/uploads/2019/09/768px-Adobe_Photoshop_CC_icon.svg.png?fit=768%2C749&ssl=1"]];
- var randomWishlistCard = cardWishlist[Math.floor(Math.random() * cardWishlist.length)];
- document.getElementById("wishlistCardName").innerHTML = randomWishlistCard[0];
- var wishlistCardImage = new Image();
- wishlistCardImage.onload = function() {
- document.getElementById("wishlistCardImage").src = this.src;
- }
- wishlistCardImage.src = randomWishlistCard[1];
-}
-
-
-
-function toggleFrameOptionVisibility() {
- var frameOptionList = document.getElementsByClassName("frameOption")
- if (document.getElementById("inputCheckboxHideFrames").checked) {
- for (var i = 0; i < frameOptionList.length; i ++) {
- frameOptionList[i].classList.remove("visibilityOverride");
- }
- } else {
- for (var i = 0; i < frameOptionList.length; i ++) {
- frameOptionList[i].classList.add("visibilityOverride");
- }
- }
-}
-
-//inputCardNameNumberTextImport
-var savedImportResponse = ""
-function inputCardNameTextImport(cardName) {
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- savedImportResponse = this.responseText.split('{"object":"card"');
- inputCardNameNumberTextImport(1);
- document.getElementById("inputCardNameNumberTextImport").max = savedImportResponse.length - 1;
- document.getElementById("inputCardNameNumberTextImport").value = 1;
- } else if (this.readyState == 4 && this.status == 404) {
- savedImportResponse = ""
- alert("Sorry, but we can't seem to find any card named '" + cardName + "'");
- }
- }
- xhttp.open("GET", "https://api.scryfall.com/cards/search?order=released&q=name%3D" + cardName.replace(/ /g, "+"), true);
- xhttp.send();
-}
-function inputCardNameNumberTextImport(index) {
- var importCardTextResponse = savedImportResponse[index]//.split('{"object":"related_card"')[0]
- importText(beforeAfter(importCardTextResponse, '"name":"', '",'), "Title");
- importText(beforeAfter(importCardTextResponse, '"type_line":"', '",'), "Type");
- importText(beforeAfter(importCardTextResponse, '"oracle_text":"', '",').replace(/\\n/g, "\n").replace(/ \\"/g, ' \u201C').replace(/\\"/g, '\u201D').replace(/\(/g, "{i}(").replace(/\)/g, "){/i}"), "Rules Text");
- if (importCardTextResponse.includes('"power":"')) {
- importText(beforeAfter(importCardTextResponse, '"power":"', '",') + "/" + beforeAfter(importCardTextResponse, '"toughness":"', '",'), "Power Toughness");
- } else {
- importText("", "Power Toughness");
- }
- if (importCardTextResponse.includes('"loyalty":"') && version.currentVersion == "planeswalker") {
- importText(beforeAfter(importCardTextResponse, '"loyalty":"', '",'), "Loyalty");
- var abilityList = beforeAfter(importCardTextResponse, '"oracle_text":"', '",').replace(/ \\"/g, ' \u201C').replace(/\\"/g, '\u201D').split(/\\n/g);
- for (var i = 0; i < abilityList.length; i++) {
- var stringVersion = ""
- switch(i) {
- case 3:
- stringVersion = "Fourth"
- break;
- case 2:
- stringVersion = "Third"
- break;
- case 1:
- stringVersion = "Second"
- break;
- default:
- stringVersion = "First"
- }
- if (abilityList[i].slice(0, 4).includes(":")) {
- importText(abilityList[i].split(/: (.+)?/)[1], stringVersion + " Ability");
- document.getElementById("inputPlaneswalker" + (i + 1) + "Icon").value = abilityList[i].split(/: (.+)?/)[0];
- } else {
- importText("{left24}" + abilityList[i], stringVersion + " Ability");
- document.getElementById("inputPlaneswalker" + (i + 1) + "Icon").value = "";
- }
- if (document.getElementById("inputPlaneswalker" + (i + 1)).value < 1) {
- document.getElementById("inputPlaneswalker" + (i + 1)).value = 1;
- }
- }
- }
- document.getElementById("inputManaCost").value = beforeAfter(importCardTextResponse, '"mana_cost":"', '",');
- document.getElementById("inputCardArtName").value = beforeAfter(importCardTextResponse, '"name":"', '",');
- document.getElementById("inputSetCode").value = beforeAfter(importCardTextResponse, '"set":"', '",');
- document.getElementById("inputSetRarity").value = beforeAfter(importCardTextResponse, '"rarity":"', '",')[0];
- autocrop(setSymbol, "https://cors-anywhere.herokuapp.com/http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=" + document.getElementById("inputSetCode").value + "&size=large&rarity=" + document.getElementById("inputSetRarity").value);
- inputCardArtName(beforeAfter(importCardTextResponse, '"name":"', '",'));
-}
-function importText(text, target) {
- for (var i = 0; i < version.textList.length; i++) {
- if (version.textList[i][0] == target) {
- if (i == whichTextIndex) {
- document.getElementById("inputText").value = text;
- } else {
- version.textList[i][1] = text;
- }
- updateText();
- }
- }
-}
-
-
-
-
-var inputsToRemoveAutocorrect = document.querySelectorAll("input");
-
-inputsToRemoveAutocorrect.forEach(input => {
- input.setAttribute("autocomplete", "off")
- input.setAttribute("autocorrect", "off")
- input.setAttribute("autocapitalize", "off")
- input.setAttribute("spellcheck", false)
-})
-
-
-
-
diff --git a/OLDdata/scripts/setCodeList.js b/OLDdata/scripts/setCodeList.js
deleted file mode 100644
index 25f6075c..00000000
--- a/OLDdata/scripts/setCodeList.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-This is a list of set codes.
-It has all been typed manually, so there are possibly errors, but let's hope not!
-Duplicates found and removed: ORI, W17, CED
-Sets not found: Astral, Deckmasters, Duels of the Planeswalkers
-The codes have been resourced from the following:
-https://en.wikipedia.org/wiki/List_of_Magic:_The_Gathering_sets
-and
-https://magic.wizards.com/en/products/card-set-archive
-Last updated: 9-8-19
-Last set added: C19
-*/
-//Common through Rare
-var setCodeListPreMythic = ['1E', '2E', '2U', '3E', '4E', '5E', '6E', '7E', '8ED', '9ED', '10E', 'AN',
-'AQ', 'LE', 'DK', 'FE', 'HM', 'IA', 'AL', 'MI', 'VI', 'WL', 'TE', 'ST', 'EX', 'UZ', 'GU', 'AP', 'OD',
-'TOR', 'JUD', 'ONS', 'LGN', 'SCG', 'MRD', 'DST', '5DN', 'CHK', 'BOK', 'SOK', 'RAV', 'GPT', 'DIS', 'CSP',
-'TSP', 'PLC', 'FUT', 'LRW', 'MOR', 'SHM', 'EVE', 'PO', 'P2', 'PK', 'P3', 'P4', 'CH', 'BR', 'BD', 'EVG',
-'UG', 'UNH', 'MED', 'ME2', 'ME3', 'ME4', 'HOP']
-//Common through Mythic
-var setCodeListPostMythic = ['M10', 'M11', 'M12', 'M13', 'M14', 'M15', 'ORI', 'M19', 'ALA', 'CON',
-'ARB', 'ZEN', 'WWK', 'ROE', 'SOM', 'MBS', 'NPH', 'ISD', 'DKA', 'AVR', 'RTR', 'GTC', 'DGM', 'THS', 'BNG',
-'JOU', 'KTK', 'FRF', 'DTK', 'BFZ', 'OGW', 'SOI', 'EMN', 'KLD', 'AER', 'AKH', 'HOU', 'XLN', 'RIX', 'DOM',
-'GRN', 'RNA', 'MH1', 'GS1', 'MD1', 'DD2', 'DDC', 'DDD', 'DDE', 'DDF', 'DDG', 'DDH', 'DDI', 'DDJ', 'DDK',
-'DDL', 'DDM', 'DDN', 'DDP', 'DDQ', 'DDR', 'DDS', 'DDT', 'DDU', 'SS1', 'H09', 'PD2', 'PD3', 'MMA', 'MM2',
-'EMA', 'MM3', 'IMA', 'A25', 'UMA', 'PC2', 'PCA', 'ARC', 'E01', 'CMD', 'CM1', 'C13', 'C14', 'C15',
-'C16', 'CMA', 'C17', 'CM2', 'C18', 'CNS', 'CN2', 'E02', 'BBD', 'UST', 'VMA', 'TPR', 'W16', 'W17',
-'GK1_IZZET', 'GK1_SELESN', 'GK1_BOROS', 'GK1_GOLGAR', 'GK2_RAKDOS', 'GK2_AZORIU', 'GK2_SIMIC',
-'GK2_GRUUL', 'GK2_ORZHOV', 'WAR', 'M20', 'C19']
-//Only Rare
-var setCodeListRareOnly = ['DRB']
-//Only Mythic
-var setCodeListMythicOnly = ['V09', 'V10', 'V11', 'V12', 'V13', 'V14', 'V15', 'V16', 'V17', 'EXP', 'MPS_GRN']
-//Only Special
-var setCodeListSpecialOnly = ['MPS_KLD', 'MPS_AKH']
-//Only Rare / Mythic
-var setCodeListRareMythicOnly = ['SS2']
-
-// randomSet(false)
-function randomSet(updateHTML = true) {
- var totalSetCount = setCodeListPreMythic.length + setCodeListPostMythic.length + setCodeListRareOnly.length + setCodeListMythicOnly.length + setCodeListSpecialOnly.length + setCodeListRareMythicOnly.length
- var setIndex = Math.floor(Math.random() * (totalSetCount - 1))
- var possibleRarities, rarity, set
- if (setIndex < setCodeListPreMythic.length) {
- set = setCodeListPreMythic[setIndex]
- possibleRarities = ["C", "U", "R"]
- } else {
- setIndex -= setCodeListPreMythic.length
- if (setIndex < setCodeListPostMythic.length) {
- set = setCodeListPostMythic[setIndex]
- possibleRarities = ["C", "U", "R", "M"]
- } else {
- setIndex -= setCodeListPostMythic.length
- if (setIndex < setCodeListRareOnly.length) {
- set = setCodeListRareOnly[setIndex]
- possibleRarities = ["R"]
- } else {
- setIndex -= setCodeListRareOnly.length
- if (setIndex < setCodeListMythicOnly.length) {
- set = setCodeListMythicOnly[setIndex]
- possibleRarities = ["M"]
- } else {
- setIndex -= setCodeListMythicOnly.length
- if (setIndex < setCodeListSpecialOnly.length) {
- set = setCodeListSpecialOnly[setIndex]
- possibleRarities = ["S"]
- } else {
- setIndex -= setCodeListSpecialOnly.length
- if (setIndex < setCodeListRareMythicOnly.length) {
- set = setCodeListRareMythicOnly[setIndex]
- possibleRarities = ["M", "R"]
- } else {
- return
- }
- }
- }
- }
- }
- }
- var findingRarity = true
- while (findingRarity) {
- switch(Math.floor(Math.random() * 5)) {
- case 4:
- rarity = "S"
- break
- case 3:
- rarity = "M"
- break
- case 2:
- rarity = "R"
- break
- case 1:
- rarity = "U"
- break
- default:
- rarity = "C"
- }
- if (possibleRarities.includes(rarity)) {
- findingRarity = false
- }
- }
- if (updateHTML) {
- document.getElementById("inputSetCode").value = set
- document.getElementById("inputSetRarity").value = rarity
- }
- setSymbol.src = "https://cors-anywhere.herokuapp.com/http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=" + set + "&size=large&rarity=" + rarity
-}
diff --git a/OLDdata/scripts/sortable.js b/OLDdata/scripts/sortable.js
deleted file mode 100644
index 192a3659..00000000
--- a/OLDdata/scripts/sortable.js
+++ /dev/null
@@ -1,3695 +0,0 @@
-/**!
- * Sortable 1.10.1
- * @author RubaXa
- * @author owenm
- * @license MIT
- */
-function _typeof(obj) {
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
- _typeof = function (obj) {
- return typeof obj;
- };
- } else {
- _typeof = function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- };
- }
-
- return _typeof(obj);
-}
-
-function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
-
- return obj;
-}
-
-function _extends() {
- _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
-
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
-
- return target;
- };
-
- return _extends.apply(this, arguments);
-}
-
-function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- var ownKeys = Object.keys(source);
-
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
-
- ownKeys.forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- }
-
- return target;
-}
-
-function _objectWithoutPropertiesLoose(source, excluded) {
- if (source == null) return {};
- var target = {};
- var sourceKeys = Object.keys(source);
- var key, i;
-
- for (i = 0; i < sourceKeys.length; i++) {
- key = sourceKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- target[key] = source[key];
- }
-
- return target;
-}
-
-function _objectWithoutProperties(source, excluded) {
- if (source == null) return {};
-
- var target = _objectWithoutPropertiesLoose(source, excluded);
-
- var key, i;
-
- if (Object.getOwnPropertySymbols) {
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
-
- for (i = 0; i < sourceSymbolKeys.length; i++) {
- key = sourceSymbolKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
- target[key] = source[key];
- }
- }
-
- return target;
-}
-
-function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
-}
-
-function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
-
- return arr2;
- }
-}
-
-function _iterableToArray(iter) {
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
-}
-
-function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance");
-}
-
-var version = "1.10.1";
-
-function userAgent(pattern) {
- if (typeof window !== 'undefined' && window.navigator) {
- return !!
- /*@__PURE__*/
- navigator.userAgent.match(pattern);
- }
-}
-
-var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
-var Edge = userAgent(/Edge/i);
-var FireFox = userAgent(/firefox/i);
-var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
-var IOS = userAgent(/iP(ad|od|hone)/i);
-var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
-
-var captureMode = {
- capture: false,
- passive: false
-};
-
-function on(el, event, fn) {
- el.addEventListener(event, fn, !IE11OrLess && captureMode);
-}
-
-function off(el, event, fn) {
- el.removeEventListener(event, fn, !IE11OrLess && captureMode);
-}
-
-function matches(
-/**HTMLElement*/
-el,
-/**String*/
-selector) {
- if (!selector) return;
- selector[0] === '>' && (selector = selector.substring(1));
-
- if (el) {
- try {
- if (el.matches) {
- return el.matches(selector);
- } else if (el.msMatchesSelector) {
- return el.msMatchesSelector(selector);
- } else if (el.webkitMatchesSelector) {
- return el.webkitMatchesSelector(selector);
- }
- } catch (_) {
- return false;
- }
- }
-
- return false;
-}
-
-function getParentOrHost(el) {
- return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
-}
-
-function closest(
-/**HTMLElement*/
-el,
-/**String*/
-selector,
-/**HTMLElement*/
-ctx, includeCTX) {
- if (el) {
- ctx = ctx || document;
-
- do {
- if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
- return el;
- }
-
- if (el === ctx) break;
- /* jshint boss:true */
- } while (el = getParentOrHost(el));
- }
-
- return null;
-}
-
-var R_SPACE = /\s+/g;
-
-function toggleClass(el, name, state) {
- if (el && name) {
- if (el.classList) {
- el.classList[state ? 'add' : 'remove'](name);
- } else {
- var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
- el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
- }
- }
-}
-
-function css(el, prop, val) {
- var style = el && el.style;
-
- if (style) {
- if (val === void 0) {
- if (document.defaultView && document.defaultView.getComputedStyle) {
- val = document.defaultView.getComputedStyle(el, '');
- } else if (el.currentStyle) {
- val = el.currentStyle;
- }
-
- return prop === void 0 ? val : val[prop];
- } else {
- if (!(prop in style) && prop.indexOf('webkit') === -1) {
- prop = '-webkit-' + prop;
- }
-
- style[prop] = val + (typeof val === 'string' ? '' : 'px');
- }
- }
-}
-
-function matrix(el, selfOnly) {
- var appliedTransforms = '';
-
- if (typeof el === 'string') {
- appliedTransforms = el;
- } else {
- do {
- var transform = css(el, 'transform');
-
- if (transform && transform !== 'none') {
- appliedTransforms = transform + ' ' + appliedTransforms;
- }
- /* jshint boss:true */
-
- } while (!selfOnly && (el = el.parentNode));
- }
-
- var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix;
- /*jshint -W056 */
-
- return matrixFn && new matrixFn(appliedTransforms);
-}
-
-function find(ctx, tagName, iterator) {
- if (ctx) {
- var list = ctx.getElementsByTagName(tagName),
- i = 0,
- n = list.length;
-
- if (iterator) {
- for (; i < n; i++) {
- iterator(list[i], i);
- }
- }
-
- return list;
- }
-
- return [];
-}
-
-function getWindowScrollingElement() {
- if (IE11OrLess) {
- return document.documentElement;
- } else {
- return document.scrollingElement;
- }
-}
-/**
- * Returns the "bounding client rect" of given element
- * @param {HTMLElement} el The element whose boundingClientRect is wanted
- * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
- * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
- * @param {[Boolean]} undoScale Whether the container's scale() should be undone
- * @param {[HTMLElement]} container The parent the element will be placed in
- * @return {Object} The boundingClientRect of el, with specified adjustments
- */
-
-
-function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
- if (!el.getBoundingClientRect && el !== window) return;
- var elRect, top, left, bottom, right, height, width;
-
- if (el !== window && el !== getWindowScrollingElement()) {
- elRect = el.getBoundingClientRect();
- top = elRect.top;
- left = elRect.left;
- bottom = elRect.bottom;
- right = elRect.right;
- height = elRect.height;
- width = elRect.width;
- } else {
- top = 0;
- left = 0;
- bottom = window.innerHeight;
- right = window.innerWidth;
- height = window.innerHeight;
- width = window.innerWidth;
- }
-
- if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
- // Adjust for translate()
- container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
- // Not needed on <= IE11
-
- if (!IE11OrLess) {
- do {
- if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
- var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container
-
- top -= containerRect.top + parseInt(css(container, 'border-top-width'));
- left -= containerRect.left + parseInt(css(container, 'border-left-width'));
- bottom = top + elRect.height;
- right = left + elRect.width;
- break;
- }
- /* jshint boss:true */
-
- } while (container = container.parentNode);
- }
- }
-
- if (undoScale && el !== window) {
- // Adjust for scale()
- var elMatrix = matrix(container || el),
- scaleX = elMatrix && elMatrix.a,
- scaleY = elMatrix && elMatrix.d;
-
- if (elMatrix) {
- top /= scaleY;
- left /= scaleX;
- width /= scaleX;
- height /= scaleY;
- bottom = top + height;
- right = left + width;
- }
- }
-
- return {
- top: top,
- left: left,
- bottom: bottom,
- right: right,
- width: width,
- height: height
- };
-}
-/**
- * Checks if a side of an element is scrolled past a side of its parents
- * @param {HTMLElement} el The element who's side being scrolled out of view is in question
- * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
- * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
- * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
- */
-
-
-function isScrolledPast(el, elSide, parentSide) {
- var parent = getParentAutoScrollElement(el, true),
- elSideVal = getRect(el)[elSide];
- /* jshint boss:true */
-
- while (parent) {
- var parentSideVal = getRect(parent)[parentSide],
- visible = void 0;
-
- if (parentSide === 'top' || parentSide === 'left') {
- visible = elSideVal >= parentSideVal;
- } else {
- visible = elSideVal <= parentSideVal;
- }
-
- if (!visible) return parent;
- if (parent === getWindowScrollingElement()) break;
- parent = getParentAutoScrollElement(parent, false);
- }
-
- return false;
-}
-/**
- * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
- * and non-draggable elements
- * @param {HTMLElement} el The parent element
- * @param {Number} childNum The index of the child
- * @param {Object} options Parent Sortable's options
- * @return {HTMLElement} The child at index childNum, or null if not found
- */
-
-
-function getChild(el, childNum, options) {
- var currentChild = 0,
- i = 0,
- children = el.children;
-
- while (i < children.length) {
- if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && children[i] !== Sortable.dragged && closest(children[i], options.draggable, el, false)) {
- if (currentChild === childNum) {
- return children[i];
- }
-
- currentChild++;
- }
-
- i++;
- }
-
- return null;
-}
-/**
- * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
- * @param {HTMLElement} el Parent element
- * @param {selector} selector Any other elements that should be ignored
- * @return {HTMLElement} The last child, ignoring ghostEl
- */
-
-
-function lastChild(el, selector) {
- var last = el.lastElementChild;
-
- while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
- last = last.previousElementSibling;
- }
-
- return last || null;
-}
-/**
- * Returns the index of an element within its parent for a selected set of
- * elements
- * @param {HTMLElement} el
- * @param {selector} selector
- * @return {number}
- */
-
-
-function index(el, selector) {
- var index = 0;
-
- if (!el || !el.parentNode) {
- return -1;
- }
- /* jshint boss:true */
-
-
- while (el = el.previousElementSibling) {
- if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
- index++;
- }
- }
-
- return index;
-}
-/**
- * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
- * The value is returned in real pixels.
- * @param {HTMLElement} el
- * @return {Array} Offsets in the format of [left, top]
- */
-
-
-function getRelativeScrollOffset(el) {
- var offsetLeft = 0,
- offsetTop = 0,
- winScroller = getWindowScrollingElement();
-
- if (el) {
- do {
- var elMatrix = matrix(el),
- scaleX = elMatrix.a,
- scaleY = elMatrix.d;
- offsetLeft += el.scrollLeft * scaleX;
- offsetTop += el.scrollTop * scaleY;
- } while (el !== winScroller && (el = el.parentNode));
- }
-
- return [offsetLeft, offsetTop];
-}
-/**
- * Returns the index of the object within the given array
- * @param {Array} arr Array that may or may not hold the object
- * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
- * @return {Number} The index of the object in the array, or -1
- */
-
-
-function indexOfObject(arr, obj) {
- for (var i in arr) {
- if (!arr.hasOwnProperty(i)) continue;
-
- for (var key in obj) {
- if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
- }
- }
-
- return -1;
-}
-
-function getParentAutoScrollElement(el, includeSelf) {
- // skip to window
- if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
- var elem = el;
- var gotSelf = false;
-
- do {
- // we don't need to get elem css if it isn't even overflowing in the first place (performance)
- if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
- var elemCSS = css(elem);
-
- if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
- if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
- if (gotSelf || includeSelf) return elem;
- gotSelf = true;
- }
- }
- /* jshint boss:true */
-
- } while (elem = elem.parentNode);
-
- return getWindowScrollingElement();
-}
-
-function extend(dst, src) {
- if (dst && src) {
- for (var key in src) {
- if (src.hasOwnProperty(key)) {
- dst[key] = src[key];
- }
- }
- }
-
- return dst;
-}
-
-function isRectEqual(rect1, rect2) {
- return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
-}
-
-var _throttleTimeout;
-
-function throttle(callback, ms) {
- return function () {
- if (!_throttleTimeout) {
- var args = arguments,
- _this = this;
-
- if (args.length === 1) {
- callback.call(_this, args[0]);
- } else {
- callback.apply(_this, args);
- }
-
- _throttleTimeout = setTimeout(function () {
- _throttleTimeout = void 0;
- }, ms);
- }
- };
-}
-
-function cancelThrottle() {
- clearTimeout(_throttleTimeout);
- _throttleTimeout = void 0;
-}
-
-function scrollBy(el, x, y) {
- el.scrollLeft += x;
- el.scrollTop += y;
-}
-
-function clone(el) {
- var Polymer = window.Polymer;
- var $ = window.jQuery || window.Zepto;
-
- if (Polymer && Polymer.dom) {
- return Polymer.dom(el).cloneNode(true);
- } else if ($) {
- return $(el).clone(true)[0];
- } else {
- return el.cloneNode(true);
- }
-}
-
-function setRect(el, rect) {
- css(el, 'position', 'absolute');
- css(el, 'top', rect.top);
- css(el, 'left', rect.left);
- css(el, 'width', rect.width);
- css(el, 'height', rect.height);
-}
-
-function unsetRect(el) {
- css(el, 'position', '');
- css(el, 'top', '');
- css(el, 'left', '');
- css(el, 'width', '');
- css(el, 'height', '');
-}
-
-var expando = 'Sortable' + new Date().getTime();
-
-function AnimationStateManager() {
- var animationStates = [],
- animationCallbackId;
- return {
- captureAnimationState: function captureAnimationState() {
- animationStates = [];
- if (!this.options.animation) return;
- var children = [].slice.call(this.el.children);
- children.forEach(function (child) {
- if (css(child, 'display') === 'none' || child === Sortable.ghost) return;
- animationStates.push({
- target: child,
- rect: getRect(child)
- });
-
- var fromRect = _objectSpread({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation
-
-
- if (child.thisAnimationDuration) {
- var childMatrix = matrix(child, true);
-
- if (childMatrix) {
- fromRect.top -= childMatrix.f;
- fromRect.left -= childMatrix.e;
- }
- }
-
- child.fromRect = fromRect;
- });
- },
- addAnimationState: function addAnimationState(state) {
- animationStates.push(state);
- },
- removeAnimationState: function removeAnimationState(target) {
- animationStates.splice(indexOfObject(animationStates, {
- target: target
- }), 1);
- },
- animateAll: function animateAll(callback) {
- var _this = this;
-
- if (!this.options.animation) {
- clearTimeout(animationCallbackId);
- if (typeof callback === 'function') callback();
- return;
- }
-
- var animating = false,
- animationTime = 0;
- animationStates.forEach(function (state) {
- var time = 0,
- target = state.target,
- fromRect = target.fromRect,
- toRect = getRect(target),
- prevFromRect = target.prevFromRect,
- prevToRect = target.prevToRect,
- animatingRect = state.rect,
- targetMatrix = matrix(target, true);
-
- if (targetMatrix) {
- // Compensate for current animation
- toRect.top -= targetMatrix.f;
- toRect.left -= targetMatrix.e;
- }
-
- target.toRect = toRect;
-
- if (target.thisAnimationDuration) {
- // Could also check if animatingRect is between fromRect and toRect
- if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect
- (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
- // If returning to same place as started from animation and on same axis
- time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
- }
- } // if fromRect != toRect: animate
-
-
- if (!isRectEqual(toRect, fromRect)) {
- target.prevFromRect = fromRect;
- target.prevToRect = toRect;
-
- if (!time) {
- time = _this.options.animation;
- }
-
- _this.animate(target, animatingRect, toRect, time);
- }
-
- if (time) {
- animating = true;
- animationTime = Math.max(animationTime, time);
- clearTimeout(target.animationResetTimer);
- target.animationResetTimer = setTimeout(function () {
- target.animationTime = 0;
- target.prevFromRect = null;
- target.fromRect = null;
- target.prevToRect = null;
- target.thisAnimationDuration = null;
- }, time);
- target.thisAnimationDuration = time;
- }
- });
- clearTimeout(animationCallbackId);
-
- if (!animating) {
- if (typeof callback === 'function') callback();
- } else {
- animationCallbackId = setTimeout(function () {
- if (typeof callback === 'function') callback();
- }, animationTime);
- }
-
- animationStates = [];
- },
- animate: function animate(target, currentRect, toRect, duration) {
- if (duration) {
- css(target, 'transition', '');
- css(target, 'transform', '');
- var elMatrix = matrix(this.el),
- scaleX = elMatrix && elMatrix.a,
- scaleY = elMatrix && elMatrix.d,
- translateX = (currentRect.left - toRect.left) / (scaleX || 1),
- translateY = (currentRect.top - toRect.top) / (scaleY || 1);
- target.animatingX = !!translateX;
- target.animatingY = !!translateY;
- css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
- repaint(target); // repaint
-
- css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
- css(target, 'transform', 'translate3d(0,0,0)');
- typeof target.animated === 'number' && clearTimeout(target.animated);
- target.animated = setTimeout(function () {
- css(target, 'transition', '');
- css(target, 'transform', '');
- target.animated = false;
- target.animatingX = false;
- target.animatingY = false;
- }, duration);
- }
- }
- };
-}
-
-function repaint(target) {
- return target.offsetWidth;
-}
-
-function calculateRealTime(animatingRect, fromRect, toRect, options) {
- return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
-}
-
-var plugins = [];
-var defaults = {
- initializeByDefault: true
-};
-var PluginManager = {
- mount: function mount(plugin) {
- // Set default static properties
- for (var option in defaults) {
- if (defaults.hasOwnProperty(option) && !(option in plugin)) {
- plugin[option] = defaults[option];
- }
- }
-
- plugins.push(plugin);
- },
- pluginEvent: function pluginEvent(eventName, sortable, evt) {
- var _this = this;
-
- this.eventCanceled = false;
-
- evt.cancel = function () {
- _this.eventCanceled = true;
- };
-
- var eventNameGlobal = eventName + 'Global';
- plugins.forEach(function (plugin) {
- if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable
-
- if (sortable[plugin.pluginName][eventNameGlobal]) {
- sortable[plugin.pluginName][eventNameGlobal](_objectSpread({
- sortable: sortable
- }, evt));
- } // Only fire plugin event if plugin is enabled in this sortable,
- // and plugin has event defined
-
-
- if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
- sortable[plugin.pluginName][eventName](_objectSpread({
- sortable: sortable
- }, evt));
- }
- });
- },
- initializePlugins: function initializePlugins(sortable, el, defaults, options) {
- plugins.forEach(function (plugin) {
- var pluginName = plugin.pluginName;
- if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
- var initialized = new plugin(sortable, el, sortable.options);
- initialized.sortable = sortable;
- initialized.options = sortable.options;
- sortable[pluginName] = initialized; // Add default options from plugin
-
- _extends(defaults, initialized.defaults);
- });
-
- for (var option in sortable.options) {
- if (!sortable.options.hasOwnProperty(option)) continue;
- var modified = this.modifyOption(sortable, option, sortable.options[option]);
-
- if (typeof modified !== 'undefined') {
- sortable.options[option] = modified;
- }
- }
- },
- getEventProperties: function getEventProperties(name, sortable) {
- var eventProperties = {};
- plugins.forEach(function (plugin) {
- if (typeof plugin.eventProperties !== 'function') return;
-
- _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
- });
- return eventProperties;
- },
- modifyOption: function modifyOption(sortable, name, value) {
- var modifiedValue;
- plugins.forEach(function (plugin) {
- // Plugin must exist on the Sortable
- if (!sortable[plugin.pluginName]) return; // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
-
- if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
- modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
- }
- });
- return modifiedValue;
- }
-};
-
-function dispatchEvent(_ref) {
- var sortable = _ref.sortable,
- rootEl = _ref.rootEl,
- name = _ref.name,
- targetEl = _ref.targetEl,
- cloneEl = _ref.cloneEl,
- toEl = _ref.toEl,
- fromEl = _ref.fromEl,
- oldIndex = _ref.oldIndex,
- newIndex = _ref.newIndex,
- oldDraggableIndex = _ref.oldDraggableIndex,
- newDraggableIndex = _ref.newDraggableIndex,
- originalEvent = _ref.originalEvent,
- putSortable = _ref.putSortable,
- extraEventProperties = _ref.extraEventProperties;
- sortable = sortable || rootEl && rootEl[expando];
- if (!sortable) return;
- var evt,
- options = sortable.options,
- onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature
-
- if (window.CustomEvent && !IE11OrLess && !Edge) {
- evt = new CustomEvent(name, {
- bubbles: true,
- cancelable: true
- });
- } else {
- evt = document.createEvent('Event');
- evt.initEvent(name, true, true);
- }
-
- evt.to = toEl || rootEl;
- evt.from = fromEl || rootEl;
- evt.item = targetEl || rootEl;
- evt.clone = cloneEl;
- evt.oldIndex = oldIndex;
- evt.newIndex = newIndex;
- evt.oldDraggableIndex = oldDraggableIndex;
- evt.newDraggableIndex = newDraggableIndex;
- evt.originalEvent = originalEvent;
- evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
-
- var allEventProperties = _objectSpread({}, extraEventProperties, PluginManager.getEventProperties(name, sortable));
-
- for (var option in allEventProperties) {
- evt[option] = allEventProperties[option];
- }
-
- if (rootEl) {
- rootEl.dispatchEvent(evt);
- }
-
- if (options[onName]) {
- options[onName].call(sortable, evt);
- }
-}
-
-var pluginEvent = function pluginEvent(eventName, sortable) {
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
- originalEvent = _ref.evt,
- data = _objectWithoutProperties(_ref, ["evt"]);
-
- PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread({
- dragEl: dragEl,
- parentEl: parentEl,
- ghostEl: ghostEl,
- rootEl: rootEl,
- nextEl: nextEl,
- lastDownEl: lastDownEl,
- cloneEl: cloneEl,
- cloneHidden: cloneHidden,
- dragStarted: moved,
- putSortable: putSortable,
- activeSortable: Sortable.active,
- originalEvent: originalEvent,
- oldIndex: oldIndex,
- oldDraggableIndex: oldDraggableIndex,
- newIndex: newIndex,
- newDraggableIndex: newDraggableIndex,
- hideGhostForTarget: _hideGhostForTarget,
- unhideGhostForTarget: _unhideGhostForTarget,
- cloneNowHidden: function cloneNowHidden() {
- cloneHidden = true;
- },
- cloneNowShown: function cloneNowShown() {
- cloneHidden = false;
- },
- dispatchSortableEvent: function dispatchSortableEvent(name) {
- _dispatchEvent({
- sortable: sortable,
- name: name,
- originalEvent: originalEvent
- });
- }
- }, data));
-};
-
-function _dispatchEvent(info) {
- dispatchEvent(_objectSpread({
- putSortable: putSortable,
- cloneEl: cloneEl,
- targetEl: dragEl,
- rootEl: rootEl,
- oldIndex: oldIndex,
- oldDraggableIndex: oldDraggableIndex,
- newIndex: newIndex,
- newDraggableIndex: newDraggableIndex
- }, info));
-}
-
-var dragEl,
- parentEl,
- ghostEl,
- rootEl,
- nextEl,
- lastDownEl,
- cloneEl,
- cloneHidden,
- oldIndex,
- newIndex,
- oldDraggableIndex,
- newDraggableIndex,
- activeGroup,
- putSortable,
- awaitingDragStarted = false,
- ignoreNextClick = false,
- sortables = [],
- tapEvt,
- touchEvt,
- lastDx,
- lastDy,
- tapDistanceLeft,
- tapDistanceTop,
- moved,
- lastTarget,
- lastDirection,
- pastFirstInvertThresh = false,
- isCircumstantialInvert = false,
- targetMoveDistance,
- // For positioning ghost absolutely
-ghostRelativeParent,
- ghostRelativeParentInitialScroll = [],
- // (left, top)
-_silent = false,
- savedInputChecked = [];
-/** @const */
-
-var documentExists = typeof document !== 'undefined',
- PositionGhostAbsolutely = IOS,
- CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
- // This will not pass for IE9, because IE9 DnD only works on anchors
-supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
- supportCssPointerEvents = function () {
- if (!documentExists) return; // false when <= IE11
-
- if (IE11OrLess) {
- return false;
- }
-
- var el = document.createElement('x');
- el.style.cssText = 'pointer-events:auto';
- return el.style.pointerEvents === 'auto';
-}(),
- _detectDirection = function _detectDirection(el, options) {
- var elCSS = css(el),
- elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
- child1 = getChild(el, 0, options),
- child2 = getChild(el, 1, options),
- firstChildCSS = child1 && css(child1),
- secondChildCSS = child2 && css(child2),
- firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
- secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
-
- if (elCSS.display === 'flex') {
- return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
- }
-
- if (elCSS.display === 'grid') {
- return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
- }
-
- if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
- var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
- return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
- }
-
- return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
-},
- _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
- var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
- dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
- dragElOppLength = vertical ? dragRect.width : dragRect.height,
- targetS1Opp = vertical ? targetRect.left : targetRect.top,
- targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
- targetOppLength = vertical ? targetRect.width : targetRect.height;
- return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
-},
-
-/**
- * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
- * @param {Number} x X position
- * @param {Number} y Y position
- * @return {HTMLElement} Element of the first found nearest Sortable
- */
-_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
- var ret;
- sortables.some(function (sortable) {
- if (lastChild(sortable)) return;
- var rect = getRect(sortable),
- threshold = sortable[expando].options.emptyInsertThreshold,
- insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
- insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
-
- if (threshold && insideHorizontally && insideVertically) {
- return ret = sortable;
- }
- });
- return ret;
-},
- _prepareGroup = function _prepareGroup(options) {
- function toFn(value, pull) {
- return function (to, from, dragEl, evt) {
- var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
-
- if (value == null && (pull || sameGroup)) {
- // Default pull value
- // Default pull and put value if same group
- return true;
- } else if (value == null || value === false) {
- return false;
- } else if (pull && value === 'clone') {
- return value;
- } else if (typeof value === 'function') {
- return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
- } else {
- var otherGroup = (pull ? to : from).options.group.name;
- return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
- }
- };
- }
-
- var group = {};
- var originalGroup = options.group;
-
- if (!originalGroup || _typeof(originalGroup) != 'object') {
- originalGroup = {
- name: originalGroup
- };
- }
-
- group.name = originalGroup.name;
- group.checkPull = toFn(originalGroup.pull, true);
- group.checkPut = toFn(originalGroup.put);
- group.revertClone = originalGroup.revertClone;
- options.group = group;
-},
- _hideGhostForTarget = function _hideGhostForTarget() {
- if (!supportCssPointerEvents && ghostEl) {
- css(ghostEl, 'display', 'none');
- }
-},
- _unhideGhostForTarget = function _unhideGhostForTarget() {
- if (!supportCssPointerEvents && ghostEl) {
- css(ghostEl, 'display', '');
- }
-}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
-
-
-if (documentExists) {
- document.addEventListener('click', function (evt) {
- if (ignoreNextClick) {
- evt.preventDefault();
- evt.stopPropagation && evt.stopPropagation();
- evt.stopImmediatePropagation && evt.stopImmediatePropagation();
- ignoreNextClick = false;
- return false;
- }
- }, true);
-}
-
-var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
- if (dragEl) {
- evt = evt.touches ? evt.touches[0] : evt;
-
- var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
-
- if (nearest) {
- // Create imitation event
- var event = {};
-
- for (var i in evt) {
- if (evt.hasOwnProperty(i)) {
- event[i] = evt[i];
- }
- }
-
- event.target = event.rootEl = nearest;
- event.preventDefault = void 0;
- event.stopPropagation = void 0;
-
- nearest[expando]._onDragOver(event);
- }
- }
-};
-
-var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
- if (dragEl) {
- dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
- }
-};
-/**
- * @class Sortable
- * @param {HTMLElement} el
- * @param {Object} [options]
- */
-
-
-function Sortable(el, options) {
- if (!(el && el.nodeType && el.nodeType === 1)) {
- throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
- }
-
- this.el = el; // root element
-
- this.options = options = _extends({}, options); // Export instance
-
- el[expando] = this;
- var defaults = {
- group: null,
- sort: true,
- disabled: false,
- store: null,
- handle: null,
- draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',
- swapThreshold: 1,
- // percentage; 0 <= x <= 1
- invertSwap: false,
- // invert always
- invertedSwapThreshold: null,
- // will be set to same as swapThreshold if default
- removeCloneOnHide: true,
- direction: function direction() {
- return _detectDirection(el, this.options);
- },
- ghostClass: 'sortable-ghost',
- chosenClass: 'sortable-chosen',
- dragClass: 'sortable-drag',
- ignore: 'a, img',
- filter: null,
- preventOnFilter: true,
- animation: 0,
- easing: null,
- setData: function setData(dataTransfer, dragEl) {
- dataTransfer.setData('Text', dragEl.textContent);
- },
- dropBubble: false,
- dragoverBubble: false,
- dataIdAttr: 'data-id',
- delay: 0,
- delayOnTouchOnly: false,
- touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
- forceFallback: false,
- fallbackClass: 'sortable-fallback',
- fallbackOnBody: false,
- fallbackTolerance: 0,
- fallbackOffset: {
- x: 0,
- y: 0
- },
- supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window,
- emptyInsertThreshold: 5
- };
- PluginManager.initializePlugins(this, el, defaults); // Set default options
-
- for (var name in defaults) {
- !(name in options) && (options[name] = defaults[name]);
- }
-
- _prepareGroup(options); // Bind all private methods
-
-
- for (var fn in this) {
- if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
- this[fn] = this[fn].bind(this);
- }
- } // Setup drag mode
-
-
- this.nativeDraggable = options.forceFallback ? false : supportDraggable;
-
- if (this.nativeDraggable) {
- // Touch start threshold cannot be greater than the native dragstart threshold
- this.options.touchStartThreshold = 1;
- } // Bind events
-
-
- if (options.supportPointer) {
- on(el, 'pointerdown', this._onTapStart);
- } else {
- on(el, 'mousedown', this._onTapStart);
- on(el, 'touchstart', this._onTapStart);
- }
-
- if (this.nativeDraggable) {
- on(el, 'dragover', this);
- on(el, 'dragenter', this);
- }
-
- sortables.push(this.el); // Restore sorting
-
- options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager
-
- _extends(this, AnimationStateManager());
-}
-
-Sortable.prototype =
-/** @lends Sortable.prototype */
-{
- constructor: Sortable,
- _isOutsideThisEl: function _isOutsideThisEl(target) {
- if (!this.el.contains(target) && target !== this.el) {
- lastTarget = null;
- }
- },
- _getDirection: function _getDirection(evt, target) {
- return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
- },
- _onTapStart: function _onTapStart(
- /** Event|TouchEvent */
- evt) {
- if (!evt.cancelable) return;
-
- var _this = this,
- el = this.el,
- options = this.options,
- preventOnFilter = options.preventOnFilter,
- type = evt.type,
- touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
- target = (touch || evt).target,
- originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
- filter = options.filter;
-
- _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
-
-
- if (dragEl) {
- return;
- }
-
- if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
- return; // only left button and enabled
- } // cancel dnd if original target is content editable
-
-
- if (originalTarget.isContentEditable) {
- return;
- }
-
- target = closest(target, options.draggable, el, false);
-
- if (target && target.animated) {
- return;
- }
-
- if (lastDownEl === target) {
- // Ignoring duplicate `down`
- return;
- } // Get the index of the dragged element within its parent
-
-
- oldIndex = index(target);
- oldDraggableIndex = index(target, options.draggable); // Check filter
-
- if (typeof filter === 'function') {
- if (filter.call(this, evt, target, this)) {
- _dispatchEvent({
- sortable: _this,
- rootEl: originalTarget,
- name: 'filter',
- targetEl: target,
- toEl: el,
- fromEl: el
- });
-
- pluginEvent('filter', _this, {
- evt: evt
- });
- preventOnFilter && evt.cancelable && evt.preventDefault();
- return; // cancel dnd
- }
- } else if (filter) {
- filter = filter.split(',').some(function (criteria) {
- criteria = closest(originalTarget, criteria.trim(), el, false);
-
- if (criteria) {
- _dispatchEvent({
- sortable: _this,
- rootEl: criteria,
- name: 'filter',
- targetEl: target,
- fromEl: el,
- toEl: el
- });
-
- pluginEvent('filter', _this, {
- evt: evt
- });
- return true;
- }
- });
-
- if (filter) {
- preventOnFilter && evt.cancelable && evt.preventDefault();
- return; // cancel dnd
- }
- }
-
- if (options.handle && !closest(originalTarget, options.handle, el, false)) {
- return;
- } // Prepare `dragstart`
-
-
- this._prepareDragStart(evt, touch, target);
- },
- _prepareDragStart: function _prepareDragStart(
- /** Event */
- evt,
- /** Touch */
- touch,
- /** HTMLElement */
- target) {
- var _this = this,
- el = _this.el,
- options = _this.options,
- ownerDocument = el.ownerDocument,
- dragStartFn;
-
- if (target && !dragEl && target.parentNode === el) {
- var dragRect = getRect(target);
- rootEl = el;
- dragEl = target;
- parentEl = dragEl.parentNode;
- nextEl = dragEl.nextSibling;
- lastDownEl = target;
- activeGroup = options.group;
- Sortable.dragged = dragEl;
- tapEvt = {
- target: dragEl,
- clientX: (touch || evt).clientX,
- clientY: (touch || evt).clientY
- };
- tapDistanceLeft = tapEvt.clientX - dragRect.left;
- tapDistanceTop = tapEvt.clientY - dragRect.top;
- this._lastX = (touch || evt).clientX;
- this._lastY = (touch || evt).clientY;
- dragEl.style['will-change'] = 'all';
-
- dragStartFn = function dragStartFn() {
- pluginEvent('delayEnded', _this, {
- evt: evt
- });
-
- if (Sortable.eventCanceled) {
- _this._onDrop();
-
- return;
- } // Delayed drag has been triggered
- // we can re-enable the events: touchmove/mousemove
-
-
- _this._disableDelayedDragEvents();
-
- if (!FireFox && _this.nativeDraggable) {
- dragEl.draggable = true;
- } // Bind the events: dragstart/dragend
-
-
- _this._triggerDragStart(evt, touch); // Drag start event
-
-
- _dispatchEvent({
- sortable: _this,
- name: 'choose',
- originalEvent: evt
- }); // Chosen item
-
-
- toggleClass(dragEl, options.chosenClass, true);
- }; // Disable "draggable"
-
-
- options.ignore.split(',').forEach(function (criteria) {
- find(dragEl, criteria.trim(), _disableDraggable);
- });
- on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
- on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
- on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
- on(ownerDocument, 'mouseup', _this._onDrop);
- on(ownerDocument, 'touchend', _this._onDrop);
- on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)
-
- if (FireFox && this.nativeDraggable) {
- this.options.touchStartThreshold = 4;
- dragEl.draggable = true;
- }
-
- pluginEvent('delayStart', this, {
- evt: evt
- }); // Delay is impossible for native DnD in Edge or IE
-
- if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
- if (Sortable.eventCanceled) {
- this._onDrop();
-
- return;
- } // If the user moves the pointer or let go the click or touch
- // before the delay has been reached:
- // disable the delayed drag
-
-
- on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
- on(ownerDocument, 'touchend', _this._disableDelayedDrag);
- on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
- on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
- on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
- options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
- _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
- } else {
- dragStartFn();
- }
- }
- },
- _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
- /** TouchEvent|PointerEvent **/
- e) {
- var touch = e.touches ? e.touches[0] : e;
-
- if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
- this._disableDelayedDrag();
- }
- },
- _disableDelayedDrag: function _disableDelayedDrag() {
- dragEl && _disableDraggable(dragEl);
- clearTimeout(this._dragStartTimer);
-
- this._disableDelayedDragEvents();
- },
- _disableDelayedDragEvents: function _disableDelayedDragEvents() {
- var ownerDocument = this.el.ownerDocument;
- off(ownerDocument, 'mouseup', this._disableDelayedDrag);
- off(ownerDocument, 'touchend', this._disableDelayedDrag);
- off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
- off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
- off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
- off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
- },
- _triggerDragStart: function _triggerDragStart(
- /** Event */
- evt,
- /** Touch */
- touch) {
- touch = touch || evt.pointerType == 'touch' && evt;
-
- if (!this.nativeDraggable || touch) {
- if (this.options.supportPointer) {
- on(document, 'pointermove', this._onTouchMove);
- } else if (touch) {
- on(document, 'touchmove', this._onTouchMove);
- } else {
- on(document, 'mousemove', this._onTouchMove);
- }
- } else {
- on(dragEl, 'dragend', this);
- on(rootEl, 'dragstart', this._onDragStart);
- }
-
- try {
- if (document.selection) {
- // Timeout neccessary for IE9
- _nextTick(function () {
- document.selection.empty();
- });
- } else {
- window.getSelection().removeAllRanges();
- }
- } catch (err) {}
- },
- _dragStarted: function _dragStarted(fallback, evt) {
-
- awaitingDragStarted = false;
-
- if (rootEl && dragEl) {
- pluginEvent('dragStarted', this, {
- evt: evt
- });
-
- if (this.nativeDraggable) {
- on(document, 'dragover', _checkOutsideTargetEl);
- }
-
- var options = this.options; // Apply effect
-
- !fallback && toggleClass(dragEl, options.dragClass, false);
- toggleClass(dragEl, options.ghostClass, true);
- Sortable.active = this;
- fallback && this._appendGhost(); // Drag start event
-
- _dispatchEvent({
- sortable: this,
- name: 'start',
- originalEvent: evt
- });
- } else {
- this._nulling();
- }
- },
- _emulateDragOver: function _emulateDragOver() {
- if (touchEvt) {
- this._lastX = touchEvt.clientX;
- this._lastY = touchEvt.clientY;
-
- _hideGhostForTarget();
-
- var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
- var parent = target;
-
- while (target && target.shadowRoot) {
- target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
- if (target === parent) break;
- parent = target;
- }
-
- dragEl.parentNode[expando]._isOutsideThisEl(target);
-
- if (parent) {
- do {
- if (parent[expando]) {
- var inserted = void 0;
- inserted = parent[expando]._onDragOver({
- clientX: touchEvt.clientX,
- clientY: touchEvt.clientY,
- target: target,
- rootEl: parent
- });
-
- if (inserted && !this.options.dragoverBubble) {
- break;
- }
- }
-
- target = parent; // store last element
- }
- /* jshint boss:true */
- while (parent = parent.parentNode);
- }
-
- _unhideGhostForTarget();
- }
- },
- _onTouchMove: function _onTouchMove(
- /**TouchEvent*/
- evt) {
- if (tapEvt) {
- var options = this.options,
- fallbackTolerance = options.fallbackTolerance,
- fallbackOffset = options.fallbackOffset,
- touch = evt.touches ? evt.touches[0] : evt,
- ghostMatrix = ghostEl && matrix(ghostEl),
- scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
- scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
- relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
- dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
- dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging
-
- if (!Sortable.active && !awaitingDragStarted) {
- if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
- return;
- }
-
- this._onDragStart(evt, true);
- }
-
- if (ghostEl) {
- if (ghostMatrix) {
- ghostMatrix.e += dx - (lastDx || 0);
- ghostMatrix.f += dy - (lastDy || 0);
- } else {
- ghostMatrix = {
- a: 1,
- b: 0,
- c: 0,
- d: 1,
- e: dx,
- f: dy
- };
- }
-
- var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
- css(ghostEl, 'webkitTransform', cssMatrix);
- css(ghostEl, 'mozTransform', cssMatrix);
- css(ghostEl, 'msTransform', cssMatrix);
- css(ghostEl, 'transform', cssMatrix);
- lastDx = dx;
- lastDy = dy;
- touchEvt = touch;
- }
-
- evt.cancelable && evt.preventDefault();
- }
- },
- _appendGhost: function _appendGhost() {
- // Bug if using scale(): https://stackoverflow.com/questions/2637058
- // Not being adjusted for
- if (!ghostEl) {
- var container = this.options.fallbackOnBody ? document.body : rootEl,
- rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
- options = this.options; // Position absolutely
-
- if (PositionGhostAbsolutely) {
- // Get relatively positioned parent
- ghostRelativeParent = container;
-
- while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
- ghostRelativeParent = ghostRelativeParent.parentNode;
- }
-
- if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
- if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
- rect.top += ghostRelativeParent.scrollTop;
- rect.left += ghostRelativeParent.scrollLeft;
- } else {
- ghostRelativeParent = getWindowScrollingElement();
- }
-
- ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
- }
-
- ghostEl = dragEl.cloneNode(true);
- toggleClass(ghostEl, options.ghostClass, false);
- toggleClass(ghostEl, options.fallbackClass, true);
- toggleClass(ghostEl, options.dragClass, true);
- css(ghostEl, 'transition', '');
- css(ghostEl, 'transform', '');
- css(ghostEl, 'box-sizing', 'border-box');
- css(ghostEl, 'margin', 0);
- css(ghostEl, 'top', rect.top);
- css(ghostEl, 'left', rect.left);
- css(ghostEl, 'width', rect.width);
- css(ghostEl, 'height', rect.height);
- css(ghostEl, 'opacity', '0.8');
- css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');
- css(ghostEl, 'zIndex', '100000');
- css(ghostEl, 'pointerEvents', 'none');
- Sortable.ghost = ghostEl;
- container.appendChild(ghostEl); // Set transform-origin
-
- css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
- }
- },
- _onDragStart: function _onDragStart(
- /**Event*/
- evt,
- /**boolean*/
- fallback) {
- var _this = this;
-
- var dataTransfer = evt.dataTransfer;
- var options = _this.options;
- pluginEvent('dragStart', this, {
- evt: evt
- });
-
- if (Sortable.eventCanceled) {
- this._onDrop();
-
- return;
- }
-
- pluginEvent('setupClone', this);
-
- if (!Sortable.eventCanceled) {
- cloneEl = clone(dragEl);
- cloneEl.draggable = false;
- cloneEl.style['will-change'] = '';
-
- this._hideClone();
-
- toggleClass(cloneEl, this.options.chosenClass, false);
- Sortable.clone = cloneEl;
- } // #1143: IFrame support workaround
-
-
- _this.cloneId = _nextTick(function () {
- pluginEvent('clone', _this);
- if (Sortable.eventCanceled) return;
-
- if (!_this.options.removeCloneOnHide) {
- rootEl.insertBefore(cloneEl, dragEl);
- }
-
- _this._hideClone();
-
- _dispatchEvent({
- sortable: _this,
- name: 'clone'
- });
- });
- !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events
-
- if (fallback) {
- ignoreNextClick = true;
- _this._loopId = setInterval(_this._emulateDragOver, 50);
- } else {
- // Undo what was set in _prepareDragStart before drag started
- off(document, 'mouseup', _this._onDrop);
- off(document, 'touchend', _this._onDrop);
- off(document, 'touchcancel', _this._onDrop);
-
- if (dataTransfer) {
- dataTransfer.effectAllowed = 'move';
- options.setData && options.setData.call(_this, dataTransfer, dragEl);
- }
-
- on(document, 'drop', _this); // #1276 fix:
-
- css(dragEl, 'transform', 'translateZ(0)');
- }
-
- awaitingDragStarted = true;
- _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
- on(document, 'selectstart', _this);
- moved = true;
-
- if (Safari) {
- css(document.body, 'user-select', 'none');
- }
- },
- // Returns true - if no further action is needed (either inserted or another condition)
- _onDragOver: function _onDragOver(
- /**Event*/
- evt) {
- var el = this.el,
- target = evt.target,
- dragRect,
- targetRect,
- revert,
- options = this.options,
- group = options.group,
- activeSortable = Sortable.active,
- isOwner = activeGroup === group,
- canSort = options.sort,
- fromSortable = putSortable || activeSortable,
- vertical,
- _this = this,
- completedFired = false;
-
- if (_silent) return;
-
- function dragOverEvent(name, extra) {
- pluginEvent(name, _this, _objectSpread({
- evt: evt,
- isOwner: isOwner,
- axis: vertical ? 'vertical' : 'horizontal',
- revert: revert,
- dragRect: dragRect,
- targetRect: targetRect,
- canSort: canSort,
- fromSortable: fromSortable,
- target: target,
- completed: completed,
- onMove: function onMove(target, after) {
- return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);
- },
- changed: changed
- }, extra));
- } // Capture animation state
-
-
- function capture() {
- dragOverEvent('dragOverAnimationCapture');
-
- _this.captureAnimationState();
-
- if (_this !== fromSortable) {
- fromSortable.captureAnimationState();
- }
- } // Return invocation when dragEl is inserted (or completed)
-
-
- function completed(insertion) {
- dragOverEvent('dragOverCompleted', {
- insertion: insertion
- });
-
- if (insertion) {
- // Clones must be hidden before folding animation to capture dragRectAbsolute properly
- if (isOwner) {
- activeSortable._hideClone();
- } else {
- activeSortable._showClone(_this);
- }
-
- if (_this !== fromSortable) {
- // Set ghost class to new sortable's ghost class
- toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
- toggleClass(dragEl, options.ghostClass, true);
- }
-
- if (putSortable !== _this && _this !== Sortable.active) {
- putSortable = _this;
- } else if (_this === Sortable.active && putSortable) {
- putSortable = null;
- } // Animation
-
-
- if (fromSortable === _this) {
- _this._ignoreWhileAnimating = target;
- }
-
- _this.animateAll(function () {
- dragOverEvent('dragOverAnimationComplete');
- _this._ignoreWhileAnimating = null;
- });
-
- if (_this !== fromSortable) {
- fromSortable.animateAll();
- fromSortable._ignoreWhileAnimating = null;
- }
- } // Null lastTarget if it is not inside a previously swapped element
-
-
- if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
- lastTarget = null;
- } // no bubbling and not fallback
-
-
- if (!options.dragoverBubble && !evt.rootEl && target !== document) {
- dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted
-
-
- !insertion && nearestEmptyInsertDetectEvent(evt);
- }
-
- !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
- return completedFired = true;
- } // Call when dragEl has been inserted
-
-
- function changed() {
- newIndex = index(dragEl);
- newDraggableIndex = index(dragEl, options.draggable);
-
- _dispatchEvent({
- sortable: _this,
- name: 'change',
- toEl: el,
- newIndex: newIndex,
- newDraggableIndex: newDraggableIndex,
- originalEvent: evt
- });
- }
-
- if (evt.preventDefault !== void 0) {
- evt.cancelable && evt.preventDefault();
- }
-
- target = closest(target, options.draggable, el, true);
- dragOverEvent('dragOver');
- if (Sortable.eventCanceled) return completedFired;
-
- if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
- return completed(false);
- }
-
- ignoreNextClick = false;
-
- if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
- : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
- vertical = this._getDirection(evt, target) === 'vertical';
- dragRect = getRect(dragEl);
- dragOverEvent('dragOverValid');
- if (Sortable.eventCanceled) return completedFired;
-
- if (revert) {
- parentEl = rootEl; // actualization
-
- capture();
-
- this._hideClone();
-
- dragOverEvent('revert');
-
- if (!Sortable.eventCanceled) {
- if (nextEl) {
- rootEl.insertBefore(dragEl, nextEl);
- } else {
- rootEl.appendChild(dragEl);
- }
- }
-
- return completed(true);
- }
-
- var elLastChild = lastChild(el, options.draggable);
-
- if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
- // If already at end of list: Do not insert
- if (elLastChild === dragEl) {
- return completed(false);
- } // assign target only if condition is true
-
-
- if (elLastChild && el === evt.target) {
- target = elLastChild;
- }
-
- if (target) {
- targetRect = getRect(target);
- }
-
- if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
- capture();
- el.appendChild(dragEl);
- parentEl = el; // actualization
-
- changed();
- return completed(true);
- }
- } else if (target.parentNode === el) {
- targetRect = getRect(target);
- var direction = 0,
- targetBeforeFirstSwap,
- differentLevel = dragEl.parentNode !== el,
- differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
- side1 = vertical ? 'top' : 'left',
- scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
- scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
-
- if (lastTarget !== target) {
- targetBeforeFirstSwap = targetRect[side1];
- pastFirstInvertThresh = false;
- isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
- }
-
- direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
- var sibling;
-
- if (direction !== 0) {
- // Check if target is beside dragEl in respective direction (ignoring hidden elements)
- var dragIndex = index(dragEl);
-
- do {
- dragIndex -= direction;
- sibling = parentEl.children[dragIndex];
- } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
- } // If dragEl is already beside target: Do not insert
-
-
- if (direction === 0 || sibling === target) {
- return completed(false);
- }
-
- lastTarget = target;
- lastDirection = direction;
- var nextSibling = target.nextElementSibling,
- after = false;
- after = direction === 1;
-
- var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
-
- if (moveVector !== false) {
- if (moveVector === 1 || moveVector === -1) {
- after = moveVector === 1;
- }
-
- _silent = true;
- setTimeout(_unsilent, 30);
- capture();
-
- if (after && !nextSibling) {
- el.appendChild(dragEl);
- } else {
- target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
- } // Undo chrome's scroll adjustment (has no effect on other browsers)
-
-
- if (scrolledPastTop) {
- scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
- }
-
- parentEl = dragEl.parentNode; // actualization
- // must be done before animation
-
- if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
- targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
- }
-
- changed();
- return completed(true);
- }
- }
-
- if (el.contains(dragEl)) {
- return completed(false);
- }
- }
-
- return false;
- },
- _ignoreWhileAnimating: null,
- _offMoveEvents: function _offMoveEvents() {
- off(document, 'mousemove', this._onTouchMove);
- off(document, 'touchmove', this._onTouchMove);
- off(document, 'pointermove', this._onTouchMove);
- off(document, 'dragover', nearestEmptyInsertDetectEvent);
- off(document, 'mousemove', nearestEmptyInsertDetectEvent);
- off(document, 'touchmove', nearestEmptyInsertDetectEvent);
- },
- _offUpEvents: function _offUpEvents() {
- var ownerDocument = this.el.ownerDocument;
- off(ownerDocument, 'mouseup', this._onDrop);
- off(ownerDocument, 'touchend', this._onDrop);
- off(ownerDocument, 'pointerup', this._onDrop);
- off(ownerDocument, 'touchcancel', this._onDrop);
- off(document, 'selectstart', this);
- },
- _onDrop: function _onDrop(
- /**Event*/
- evt) {
- var el = this.el,
- options = this.options; // Get the index of the dragged element within its parent
-
- newIndex = index(dragEl);
- newDraggableIndex = index(dragEl, options.draggable);
- pluginEvent('drop', this, {
- evt: evt
- });
- parentEl = dragEl && dragEl.parentNode; // Get again after plugin event
-
- newIndex = index(dragEl);
- newDraggableIndex = index(dragEl, options.draggable);
-
- if (Sortable.eventCanceled) {
- this._nulling();
-
- return;
- }
-
- awaitingDragStarted = false;
- isCircumstantialInvert = false;
- pastFirstInvertThresh = false;
- clearInterval(this._loopId);
- clearTimeout(this._dragStartTimer);
-
- _cancelNextTick(this.cloneId);
-
- _cancelNextTick(this._dragStartId); // Unbind events
-
-
- if (this.nativeDraggable) {
- off(document, 'drop', this);
- off(el, 'dragstart', this._onDragStart);
- }
-
- this._offMoveEvents();
-
- this._offUpEvents();
-
- if (Safari) {
- css(document.body, 'user-select', '');
- }
-
- if (evt) {
- if (moved) {
- evt.cancelable && evt.preventDefault();
- !options.dropBubble && evt.stopPropagation();
- }
-
- ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
-
- if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
- // Remove clone(s)
- cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
- }
-
- if (dragEl) {
- if (this.nativeDraggable) {
- off(dragEl, 'dragend', this);
- }
-
- _disableDraggable(dragEl);
-
- dragEl.style['will-change'] = ''; // Remove classes
- // ghostClass is added in dragStarted
-
- if (moved && !awaitingDragStarted) {
- toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
- //code added by me (Kyle) starts here!
- cardMasterUpdated()
- //code added by me (Kyle) ends here!
- }
-
- toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event
-
- _dispatchEvent({
- sortable: this,
- name: 'unchoose',
- toEl: parentEl,
- newIndex: null,
- newDraggableIndex: null,
- originalEvent: evt
- });
-
- if (rootEl !== parentEl) {
- if (newIndex >= 0) {
- // Add event
- _dispatchEvent({
- rootEl: parentEl,
- name: 'add',
- toEl: parentEl,
- fromEl: rootEl,
- originalEvent: evt
- }); // Remove event
-
-
- _dispatchEvent({
- sortable: this,
- name: 'remove',
- toEl: parentEl,
- originalEvent: evt
- }); // drag from one list and drop into another
-
-
- _dispatchEvent({
- rootEl: parentEl,
- name: 'sort',
- toEl: parentEl,
- fromEl: rootEl,
- originalEvent: evt
- });
-
- _dispatchEvent({
- sortable: this,
- name: 'sort',
- toEl: parentEl,
- originalEvent: evt
- });
- }
-
- putSortable && putSortable.save();
- } else {
- if (newIndex !== oldIndex) {
- if (newIndex >= 0) {
- // drag & drop within the same list
- _dispatchEvent({
- sortable: this,
- name: 'update',
- toEl: parentEl,
- originalEvent: evt
- });
-
- _dispatchEvent({
- sortable: this,
- name: 'sort',
- toEl: parentEl,
- originalEvent: evt
- });
- }
- }
- }
-
- if (Sortable.active) {
- /* jshint eqnull:true */
- if (newIndex == null || newIndex === -1) {
- newIndex = oldIndex;
- newDraggableIndex = oldDraggableIndex;
- }
-
- _dispatchEvent({
- sortable: this,
- name: 'end',
- toEl: parentEl,
- originalEvent: evt
- }); // Save sorting
-
-
- this.save();
- }
- }
- }
-
- this._nulling();
- },
- _nulling: function _nulling() {
- pluginEvent('nulling', this);
- rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
- savedInputChecked.forEach(function (el) {
- el.checked = true;
- });
- savedInputChecked.length = lastDx = lastDy = 0;
- },
- handleEvent: function handleEvent(
- /**Event*/
- evt) {
- switch (evt.type) {
- case 'drop':
- case 'dragend':
- this._onDrop(evt);
-
- break;
-
- case 'dragenter':
- case 'dragover':
- if (dragEl) {
- this._onDragOver(evt);
-
- _globalDragOver(evt);
- }
-
- break;
-
- case 'selectstart':
- evt.preventDefault();
- break;
- }
- },
-
- /**
- * Serializes the item into an array of string.
- * @returns {String[]}
- */
- toArray: function toArray() {
- var order = [],
- el,
- children = this.el.children,
- i = 0,
- n = children.length,
- options = this.options;
-
- for (; i < n; i++) {
- el = children[i];
-
- if (closest(el, options.draggable, this.el, false)) {
- order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
- }
- }
-
- return order;
- },
-
- /**
- * Sorts the elements according to the array.
- * @param {String[]} order order of the items
- */
- sort: function sort(order) {
- var items = {},
- rootEl = this.el;
- this.toArray().forEach(function (id, i) {
- var el = rootEl.children[i];
-
- if (closest(el, this.options.draggable, rootEl, false)) {
- items[id] = el;
- }
- }, this);
- order.forEach(function (id) {
- if (items[id]) {
- rootEl.removeChild(items[id]);
- rootEl.appendChild(items[id]);
- }
- });
- },
-
- /**
- * Save the current sorting
- */
- save: function save() {
- var store = this.options.store;
- store && store.set && store.set(this);
- },
-
- /**
- * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
- * @param {HTMLElement} el
- * @param {String} [selector] default: `options.draggable`
- * @returns {HTMLElement|null}
- */
- closest: function closest$1(el, selector) {
- return closest(el, selector || this.options.draggable, this.el, false);
- },
-
- /**
- * Set/get option
- * @param {string} name
- * @param {*} [value]
- * @returns {*}
- */
- option: function option(name, value) {
- var options = this.options;
-
- if (value === void 0) {
- return options[name];
- } else {
- var modifiedValue = PluginManager.modifyOption(this, name, value);
-
- if (typeof modifiedValue !== 'undefined') {
- options[name] = modifiedValue;
- } else {
- options[name] = value;
- }
-
- if (name === 'group') {
- _prepareGroup(options);
- }
- }
- },
-
- /**
- * Destroy
- */
- destroy: function destroy() {
- pluginEvent('destroy', this);
- var el = this.el;
- el[expando] = null;
- off(el, 'mousedown', this._onTapStart);
- off(el, 'touchstart', this._onTapStart);
- off(el, 'pointerdown', this._onTapStart);
-
- if (this.nativeDraggable) {
- off(el, 'dragover', this);
- off(el, 'dragenter', this);
- } // Remove draggable attributes
-
-
- Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
- el.removeAttribute('draggable');
- });
-
- this._onDrop();
-
- sortables.splice(sortables.indexOf(this.el), 1);
- this.el = el = null;
- },
- _hideClone: function _hideClone() {
- if (!cloneHidden) {
- pluginEvent('hideClone', this);
- if (Sortable.eventCanceled) return;
- css(cloneEl, 'display', 'none');
-
- if (this.options.removeCloneOnHide && cloneEl.parentNode) {
- cloneEl.parentNode.removeChild(cloneEl);
- }
-
- cloneHidden = true;
- }
- },
- _showClone: function _showClone(putSortable) {
- if (putSortable.lastPutMode !== 'clone') {
- this._hideClone();
-
- return;
- }
-
- if (cloneHidden) {
- pluginEvent('showClone', this);
- if (Sortable.eventCanceled) return; // show clone at dragEl or original position
-
- if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
- rootEl.insertBefore(cloneEl, dragEl);
- } else if (nextEl) {
- rootEl.insertBefore(cloneEl, nextEl);
- } else {
- rootEl.appendChild(cloneEl);
- }
-
- if (this.options.group.revertClone) {
- this.animate(dragEl, cloneEl);
- }
-
- css(cloneEl, 'display', '');
- cloneHidden = false;
- }
- }
-};
-
-function _globalDragOver(
-/**Event*/
-evt) {
- if (evt.dataTransfer) {
- evt.dataTransfer.dropEffect = 'move';
- }
-
- evt.cancelable && evt.preventDefault();
-}
-
-function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
- var evt,
- sortable = fromEl[expando],
- onMoveFn = sortable.options.onMove,
- retVal; // Support for new CustomEvent feature
-
- if (window.CustomEvent && !IE11OrLess && !Edge) {
- evt = new CustomEvent('move', {
- bubbles: true,
- cancelable: true
- });
- } else {
- evt = document.createEvent('Event');
- evt.initEvent('move', true, true);
- }
-
- evt.to = toEl;
- evt.from = fromEl;
- evt.dragged = dragEl;
- evt.draggedRect = dragRect;
- evt.related = targetEl || toEl;
- evt.relatedRect = targetRect || getRect(toEl);
- evt.willInsertAfter = willInsertAfter;
- evt.originalEvent = originalEvent;
- fromEl.dispatchEvent(evt);
-
- if (onMoveFn) {
- retVal = onMoveFn.call(sortable, evt, originalEvent);
- }
-
- return retVal;
-}
-
-function _disableDraggable(el) {
- el.draggable = false;
-}
-
-function _unsilent() {
- _silent = false;
-}
-
-function _ghostIsLast(evt, vertical, sortable) {
- var rect = getRect(lastChild(sortable.el, sortable.options.draggable));
- var spacer = 10;
- return vertical ? evt.clientX > rect.right + spacer || evt.clientX <= rect.right && evt.clientY > rect.bottom && evt.clientX >= rect.left : evt.clientX > rect.right && evt.clientY > rect.top || evt.clientX <= rect.right && evt.clientY > rect.bottom + spacer;
-}
-
-function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
- var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
- targetLength = vertical ? targetRect.height : targetRect.width,
- targetS1 = vertical ? targetRect.top : targetRect.left,
- targetS2 = vertical ? targetRect.bottom : targetRect.right,
- invert = false;
-
- if (!invertSwap) {
- // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
- if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
- // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2
- // check if past first invert threshold on side opposite of lastDirection
- if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
- // past first invert threshold, do not restrict inverted threshold to dragEl shadow
- pastFirstInvertThresh = true;
- }
-
- if (!pastFirstInvertThresh) {
- // dragEl shadow (target move distance shadow)
- if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
- : mouseOnAxis > targetS2 - targetMoveDistance) {
- return -lastDirection;
- }
- } else {
- invert = true;
- }
- } else {
- // Regular
- if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
- return _getInsertDirection(target);
- }
- }
- }
-
- invert = invert || invertSwap;
-
- if (invert) {
- // Invert of regular
- if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
- return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
- }
- }
-
- return 0;
-}
-/**
- * Gets the direction dragEl must be swapped relative to target in order to make it
- * seem that dragEl has been "inserted" into that element's position
- * @param {HTMLElement} target The target whose position dragEl is being inserted at
- * @return {Number} Direction dragEl must be swapped
- */
-
-
-function _getInsertDirection(target) {
- if (index(dragEl) < index(target)) {
- return 1;
- } else {
- return -1;
- }
-}
-/**
- * Generate id
- * @param {HTMLElement} el
- * @returns {String}
- * @private
- */
-
-
-function _generateId(el) {
- var str = el.tagName + el.className + el.src + el.href + el.textContent,
- i = str.length,
- sum = 0;
-
- while (i--) {
- sum += str.charCodeAt(i);
- }
-
- return sum.toString(36);
-}
-
-function _saveInputCheckedState(root) {
- savedInputChecked.length = 0;
- var inputs = root.getElementsByTagName('input');
- var idx = inputs.length;
-
- while (idx--) {
- var el = inputs[idx];
- el.checked && savedInputChecked.push(el);
- }
-}
-
-function _nextTick(fn) {
- return setTimeout(fn, 0);
-}
-
-function _cancelNextTick(id) {
- return clearTimeout(id);
-} // Fixed #973:
-
-
-if (documentExists) {
- on(document, 'touchmove', function (evt) {
- if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
- evt.preventDefault();
- }
- });
-} // Export utils
-
-
-Sortable.utils = {
- on: on,
- off: off,
- css: css,
- find: find,
- is: function is(el, selector) {
- return !!closest(el, selector, el, false);
- },
- extend: extend,
- throttle: throttle,
- closest: closest,
- toggleClass: toggleClass,
- clone: clone,
- index: index,
- nextTick: _nextTick,
- cancelNextTick: _cancelNextTick,
- detectDirection: _detectDirection,
- getChild: getChild
-};
-/**
- * Get the Sortable instance of an element
- * @param {HTMLElement} element The element
- * @return {Sortable|undefined} The instance of Sortable
- */
-
-Sortable.get = function (element) {
- return element[expando];
-};
-/**
- * Mount a plugin to Sortable
- * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
- */
-
-
-Sortable.mount = function () {
- for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
- plugins[_key] = arguments[_key];
- }
-
- if (plugins[0].constructor === Array) plugins = plugins[0];
- plugins.forEach(function (plugin) {
- if (!plugin.prototype || !plugin.prototype.constructor) {
- throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
- }
-
- if (plugin.utils) Sortable.utils = _objectSpread({}, Sortable.utils, plugin.utils);
- PluginManager.mount(plugin);
- });
-};
-/**
- * Create sortable instance
- * @param {HTMLElement} el
- * @param {Object} [options]
- */
-
-
-Sortable.create = function (el, options) {
- return new Sortable(el, options);
-}; // Export
-
-
-Sortable.version = version;
-
-var autoScrolls = [],
- scrollEl,
- scrollRootEl,
- scrolling = false,
- lastAutoScrollX,
- lastAutoScrollY,
- touchEvt$1,
- pointerElemChangedInterval;
-
-function AutoScrollPlugin() {
- function AutoScroll() {
- this.defaults = {
- scroll: true,
- scrollSensitivity: 30,
- scrollSpeed: 10,
- bubbleScroll: true
- }; // Bind all private methods
-
- for (var fn in this) {
- if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
- this[fn] = this[fn].bind(this);
- }
- }
- }
-
- AutoScroll.prototype = {
- dragStarted: function dragStarted(_ref) {
- var originalEvent = _ref.originalEvent;
-
- if (this.sortable.nativeDraggable) {
- on(document, 'dragover', this._handleAutoScroll);
- } else {
- if (this.options.supportPointer) {
- on(document, 'pointermove', this._handleFallbackAutoScroll);
- } else if (originalEvent.touches) {
- on(document, 'touchmove', this._handleFallbackAutoScroll);
- } else {
- on(document, 'mousemove', this._handleFallbackAutoScroll);
- }
- }
- },
- dragOverCompleted: function dragOverCompleted(_ref2) {
- var originalEvent = _ref2.originalEvent;
-
- // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
- if (!this.options.dragOverBubble && !originalEvent.rootEl) {
- this._handleAutoScroll(originalEvent);
- }
- },
- drop: function drop() {
- if (this.sortable.nativeDraggable) {
- off(document, 'dragover', this._handleAutoScroll);
- } else {
- off(document, 'pointermove', this._handleFallbackAutoScroll);
- off(document, 'touchmove', this._handleFallbackAutoScroll);
- off(document, 'mousemove', this._handleFallbackAutoScroll);
- }
-
- clearPointerElemChangedInterval();
- clearAutoScrolls();
- cancelThrottle();
- },
- nulling: function nulling() {
- touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
- autoScrolls.length = 0;
- },
- _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
- this._handleAutoScroll(evt, true);
- },
- _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
- var _this = this;
-
- var x = (evt.touches ? evt.touches[0] : evt).clientX,
- y = (evt.touches ? evt.touches[0] : evt).clientY,
- elem = document.elementFromPoint(x, y);
- touchEvt$1 = evt; // IE does not seem to have native autoscroll,
- // Edge's autoscroll seems too conditional,
- // MACOS Safari does not have autoscroll,
- // Firefox and Chrome are good
-
- if (fallback || Edge || IE11OrLess || Safari) {
- autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change
-
- var ogElemScroller = getParentAutoScrollElement(elem, true);
-
- if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
- pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour
-
- pointerElemChangedInterval = setInterval(function () {
- var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
-
- if (newElem !== ogElemScroller) {
- ogElemScroller = newElem;
- clearAutoScrolls();
- }
-
- autoScroll(evt, _this.options, newElem, fallback);
- }, 10);
- lastAutoScrollX = x;
- lastAutoScrollY = y;
- }
- } else {
- // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll
- if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
- clearAutoScrolls();
- return;
- }
-
- autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
- }
- }
- };
- return _extends(AutoScroll, {
- pluginName: 'scroll',
- initializeByDefault: true
- });
-}
-
-function clearAutoScrolls() {
- autoScrolls.forEach(function (autoScroll) {
- clearInterval(autoScroll.pid);
- });
- autoScrolls = [];
-}
-
-function clearPointerElemChangedInterval() {
- clearInterval(pointerElemChangedInterval);
-}
-
-var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
- // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
- if (!options.scroll) return;
- var x = (evt.touches ? evt.touches[0] : evt).clientX,
- y = (evt.touches ? evt.touches[0] : evt).clientY,
- sens = options.scrollSensitivity,
- speed = options.scrollSpeed,
- winScroller = getWindowScrollingElement();
- var scrollThisInstance = false,
- scrollCustomFn; // New scroll root, set scrollEl
-
- if (scrollRootEl !== rootEl) {
- scrollRootEl = rootEl;
- clearAutoScrolls();
- scrollEl = options.scroll;
- scrollCustomFn = options.scrollFn;
-
- if (scrollEl === true) {
- scrollEl = getParentAutoScrollElement(rootEl, true);
- }
- }
-
- var layersOut = 0;
- var currentParent = scrollEl;
-
- do {
- var el = currentParent,
- rect = getRect(el),
- top = rect.top,
- bottom = rect.bottom,
- left = rect.left,
- right = rect.right,
- width = rect.width,
- height = rect.height,
- canScrollX = void 0,
- canScrollY = void 0,
- scrollWidth = el.scrollWidth,
- scrollHeight = el.scrollHeight,
- elCSS = css(el),
- scrollPosX = el.scrollLeft,
- scrollPosY = el.scrollTop;
-
- if (el === winScroller) {
- canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
- canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
- } else {
- canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
- canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
- }
-
- var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
- var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
-
- if (!autoScrolls[layersOut]) {
- for (var i = 0; i <= layersOut; i++) {
- if (!autoScrolls[i]) {
- autoScrolls[i] = {};
- }
- }
- }
-
- if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
- autoScrolls[layersOut].el = el;
- autoScrolls[layersOut].vx = vx;
- autoScrolls[layersOut].vy = vy;
- clearInterval(autoScrolls[layersOut].pid);
-
- if (vx != 0 || vy != 0) {
- scrollThisInstance = true;
- /* jshint loopfunc:true */
-
- autoScrolls[layersOut].pid = setInterval(function () {
- // emulate drag over during autoscroll (fallback), emulating native DnD behaviour
- if (isFallback && this.layer === 0) {
- Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
-
- }
-
- var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
- var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
-
- if (typeof scrollCustomFn === 'function') {
- if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
- return;
- }
- }
-
- scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
- }.bind({
- layer: layersOut
- }), 24);
- }
- }
-
- layersOut++;
- } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
-
- scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
-}, 30);
-
-var drop = function drop(_ref) {
- var originalEvent = _ref.originalEvent,
- putSortable = _ref.putSortable,
- dragEl = _ref.dragEl,
- activeSortable = _ref.activeSortable,
- dispatchSortableEvent = _ref.dispatchSortableEvent,
- hideGhostForTarget = _ref.hideGhostForTarget,
- unhideGhostForTarget = _ref.unhideGhostForTarget;
- if (!originalEvent) return;
- var toSortable = putSortable || activeSortable;
- hideGhostForTarget();
- var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
- var target = document.elementFromPoint(touch.clientX, touch.clientY);
- unhideGhostForTarget();
-
- if (toSortable && !toSortable.el.contains(target)) {
- dispatchSortableEvent('spill');
- this.onSpill({
- dragEl: dragEl,
- putSortable: putSortable
- });
- }
-};
-
-function Revert() {}
-
-Revert.prototype = {
- startIndex: null,
- dragStart: function dragStart(_ref2) {
- var oldDraggableIndex = _ref2.oldDraggableIndex;
- this.startIndex = oldDraggableIndex;
- },
- onSpill: function onSpill(_ref3) {
- var dragEl = _ref3.dragEl,
- putSortable = _ref3.putSortable;
- this.sortable.captureAnimationState();
-
- if (putSortable) {
- putSortable.captureAnimationState();
- }
-
- var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
-
- if (nextSibling) {
- this.sortable.el.insertBefore(dragEl, nextSibling);
- } else {
- this.sortable.el.appendChild(dragEl);
- }
-
- this.sortable.animateAll();
-
- if (putSortable) {
- putSortable.animateAll();
- }
- },
- drop: drop
-};
-
-_extends(Revert, {
- pluginName: 'revertOnSpill'
-});
-
-function Remove() {}
-
-Remove.prototype = {
- onSpill: function onSpill(_ref4) {
- var dragEl = _ref4.dragEl,
- putSortable = _ref4.putSortable;
- var parentSortable = putSortable || this.sortable;
- parentSortable.captureAnimationState();
- dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
- parentSortable.animateAll();
- },
- drop: drop
-};
-
-_extends(Remove, {
- pluginName: 'removeOnSpill'
-});
-
-var OnSpill = [Remove, Revert];
-
-var lastSwapEl;
-
-function SwapPlugin() {
- function Swap() {
- this.defaults = {
- swapClass: 'sortable-swap-highlight'
- };
- }
-
- Swap.prototype = {
- dragStart: function dragStart(_ref) {
- var dragEl = _ref.dragEl;
- lastSwapEl = dragEl;
- },
- dragOverValid: function dragOverValid(_ref2) {
- var completed = _ref2.completed,
- target = _ref2.target,
- onMove = _ref2.onMove,
- activeSortable = _ref2.activeSortable,
- changed = _ref2.changed,
- cancel = _ref2.cancel;
- if (!activeSortable.options.swap) return;
- var el = this.sortable.el,
- options = this.options;
-
- if (target && target !== el) {
- var prevSwapEl = lastSwapEl;
-
- if (onMove(target) !== false) {
- toggleClass(target, options.swapClass, true);
- lastSwapEl = target;
- } else {
- lastSwapEl = null;
- }
-
- if (prevSwapEl && prevSwapEl !== lastSwapEl) {
- toggleClass(prevSwapEl, options.swapClass, false);
- }
- }
-
- changed();
- completed(true);
- cancel();
- },
- drop: function drop(_ref3) {
- var activeSortable = _ref3.activeSortable,
- putSortable = _ref3.putSortable,
- dragEl = _ref3.dragEl;
- var toSortable = putSortable || this.sortable;
- var options = this.options;
- lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);
-
- if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {
- if (dragEl !== lastSwapEl) {
- toSortable.captureAnimationState();
- if (toSortable !== activeSortable) activeSortable.captureAnimationState();
- swapNodes(dragEl, lastSwapEl);
- toSortable.animateAll();
- if (toSortable !== activeSortable) activeSortable.animateAll();
- }
- }
- },
- nulling: function nulling() {
- lastSwapEl = null;
- }
- };
- return _extends(Swap, {
- pluginName: 'swap',
- eventProperties: function eventProperties() {
- return {
- swapItem: lastSwapEl
- };
- }
- });
-}
-
-function swapNodes(n1, n2) {
- var p1 = n1.parentNode,
- p2 = n2.parentNode,
- i1,
- i2;
- if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;
- i1 = index(n1);
- i2 = index(n2);
-
- if (p1.isEqualNode(p2) && i1 < i2) {
- i2++;
- }
-
- p1.insertBefore(n2, p1.children[i1]);
- p2.insertBefore(n1, p2.children[i2]);
-}
-
-var multiDragElements = [],
- multiDragClones = [],
- lastMultiDragSelect,
- // for selection with modifier key down (SHIFT)
-multiDragSortable,
- initialFolding = false,
- // Initial multi-drag fold when drag started
-folding = false,
- // Folding any other time
-dragStarted = false,
- dragEl$1,
- clonesFromRect,
- clonesHidden;
-
-function MultiDragPlugin() {
- function MultiDrag(sortable) {
- // Bind all private methods
- for (var fn in this) {
- if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
- this[fn] = this[fn].bind(this);
- }
- }
-
- if (sortable.options.supportPointer) {
- on(document, 'pointerup', this._deselectMultiDrag);
- } else {
- on(document, 'mouseup', this._deselectMultiDrag);
- on(document, 'touchend', this._deselectMultiDrag);
- }
-
- on(document, 'keydown', this._checkKeyDown);
- on(document, 'keyup', this._checkKeyUp);
- this.defaults = {
- selectedClass: 'sortable-selected',
- multiDragKey: null,
- setData: function setData(dataTransfer, dragEl) {
- var data = '';
-
- if (multiDragElements.length && multiDragSortable === sortable) {
- multiDragElements.forEach(function (multiDragElement, i) {
- data += (!i ? '' : ', ') + multiDragElement.textContent;
- });
- } else {
- data = dragEl.textContent;
- }
-
- dataTransfer.setData('Text', data);
- }
- };
- }
-
- MultiDrag.prototype = {
- multiDragKeyDown: false,
- isMultiDrag: false,
- delayStartGlobal: function delayStartGlobal(_ref) {
- var dragged = _ref.dragEl;
- dragEl$1 = dragged;
- },
- delayEnded: function delayEnded() {
- this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1);
- },
- setupClone: function setupClone(_ref2) {
- var sortable = _ref2.sortable,
- cancel = _ref2.cancel;
- if (!this.isMultiDrag) return;
-
- for (var i = 0; i < multiDragElements.length; i++) {
- multiDragClones.push(clone(multiDragElements[i]));
- multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;
- multiDragClones[i].draggable = false;
- multiDragClones[i].style['will-change'] = '';
- toggleClass(multiDragClones[i], this.options.selectedClass, false);
- multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);
- }
-
- sortable._hideClone();
-
- cancel();
- },
- clone: function clone(_ref3) {
- var sortable = _ref3.sortable,
- rootEl = _ref3.rootEl,
- dispatchSortableEvent = _ref3.dispatchSortableEvent,
- cancel = _ref3.cancel;
- if (!this.isMultiDrag) return;
-
- if (!this.options.removeCloneOnHide) {
- if (multiDragElements.length && multiDragSortable === sortable) {
- insertMultiDragClones(true, rootEl);
- dispatchSortableEvent('clone');
- cancel();
- }
- }
- },
- showClone: function showClone(_ref4) {
- var cloneNowShown = _ref4.cloneNowShown,
- rootEl = _ref4.rootEl,
- cancel = _ref4.cancel;
- if (!this.isMultiDrag) return;
- insertMultiDragClones(false, rootEl);
- multiDragClones.forEach(function (clone) {
- css(clone, 'display', '');
- });
- cloneNowShown();
- clonesHidden = false;
- cancel();
- },
- hideClone: function hideClone(_ref5) {
- var _this = this;
-
- var sortable = _ref5.sortable,
- cloneNowHidden = _ref5.cloneNowHidden,
- cancel = _ref5.cancel;
- if (!this.isMultiDrag) return;
- multiDragClones.forEach(function (clone) {
- css(clone, 'display', 'none');
-
- if (_this.options.removeCloneOnHide && clone.parentNode) {
- clone.parentNode.removeChild(clone);
- }
- });
- cloneNowHidden();
- clonesHidden = true;
- cancel();
- },
- dragStartGlobal: function dragStartGlobal(_ref6) {
- var sortable = _ref6.sortable;
-
- if (!this.isMultiDrag && multiDragSortable) {
- multiDragSortable.multiDrag._deselectMultiDrag();
- }
-
- multiDragElements.forEach(function (multiDragElement) {
- multiDragElement.sortableIndex = index(multiDragElement);
- }); // Sort multi-drag elements
-
- multiDragElements = multiDragElements.sort(function (a, b) {
- return a.sortableIndex - b.sortableIndex;
- });
- dragStarted = true;
- },
- dragStarted: function dragStarted(_ref7) {
- var _this2 = this;
-
- var sortable = _ref7.sortable;
- if (!this.isMultiDrag) return;
-
- if (this.options.sort) {
- // Capture rects,
- // hide multi drag elements (by positioning them absolute),
- // set multi drag elements rects to dragRect,
- // show multi drag elements,
- // animate to rects,
- // unset rects & remove from DOM
- sortable.captureAnimationState();
-
- if (this.options.animation) {
- multiDragElements.forEach(function (multiDragElement) {
- if (multiDragElement === dragEl$1) return;
- css(multiDragElement, 'position', 'absolute');
- });
- var dragRect = getRect(dragEl$1, false, true, true);
- multiDragElements.forEach(function (multiDragElement) {
- if (multiDragElement === dragEl$1) return;
- setRect(multiDragElement, dragRect);
- });
- folding = true;
- initialFolding = true;
- }
- }
-
- sortable.animateAll(function () {
- folding = false;
- initialFolding = false;
-
- if (_this2.options.animation) {
- multiDragElements.forEach(function (multiDragElement) {
- unsetRect(multiDragElement);
- });
- } // Remove all auxiliary multidrag items from el, if sorting enabled
-
-
- if (_this2.options.sort) {
- removeMultiDragElements();
- }
- });
- },
- dragOver: function dragOver(_ref8) {
- var target = _ref8.target,
- completed = _ref8.completed,
- cancel = _ref8.cancel;
-
- if (folding && ~multiDragElements.indexOf(target)) {
- completed(false);
- cancel();
- }
- },
- revert: function revert(_ref9) {
- var fromSortable = _ref9.fromSortable,
- rootEl = _ref9.rootEl,
- sortable = _ref9.sortable,
- dragRect = _ref9.dragRect;
-
- if (multiDragElements.length > 1) {
- // Setup unfold animation
- multiDragElements.forEach(function (multiDragElement) {
- sortable.addAnimationState({
- target: multiDragElement,
- rect: folding ? getRect(multiDragElement) : dragRect
- });
- unsetRect(multiDragElement);
- multiDragElement.fromRect = dragRect;
- fromSortable.removeAnimationState(multiDragElement);
- });
- folding = false;
- insertMultiDragElements(!this.options.removeCloneOnHide, rootEl);
- }
- },
- dragOverCompleted: function dragOverCompleted(_ref10) {
- var sortable = _ref10.sortable,
- isOwner = _ref10.isOwner,
- insertion = _ref10.insertion,
- activeSortable = _ref10.activeSortable,
- parentEl = _ref10.parentEl,
- putSortable = _ref10.putSortable;
- var options = this.options;
-
- if (insertion) {
- // Clones must be hidden before folding animation to capture dragRectAbsolute properly
- if (isOwner) {
- activeSortable._hideClone();
- }
-
- initialFolding = false; // If leaving sort:false root, or already folding - Fold to new location
-
- if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {
- // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible
- var dragRectAbsolute = getRect(dragEl$1, false, true, true);
- multiDragElements.forEach(function (multiDragElement) {
- if (multiDragElement === dragEl$1) return;
- setRect(multiDragElement, dragRectAbsolute); // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted
- // while folding, and so that we can capture them again because old sortable will no longer be fromSortable
-
- parentEl.appendChild(multiDragElement);
- });
- folding = true;
- } // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out
-
-
- if (!isOwner) {
- // Only remove if not folding (folding will remove them anyways)
- if (!folding) {
- removeMultiDragElements();
- }
-
- if (multiDragElements.length > 1) {
- var clonesHiddenBefore = clonesHidden;
-
- activeSortable._showClone(sortable); // Unfold animation for clones if showing from hidden
-
-
- if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {
- multiDragClones.forEach(function (clone) {
- activeSortable.addAnimationState({
- target: clone,
- rect: clonesFromRect
- });
- clone.fromRect = clonesFromRect;
- clone.thisAnimationDuration = null;
- });
- }
- } else {
- activeSortable._showClone(sortable);
- }
- }
- }
- },
- dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {
- var dragRect = _ref11.dragRect,
- isOwner = _ref11.isOwner,
- activeSortable = _ref11.activeSortable;
- multiDragElements.forEach(function (multiDragElement) {
- multiDragElement.thisAnimationDuration = null;
- });
-
- if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {
- clonesFromRect = _extends({}, dragRect);
- var dragMatrix = matrix(dragEl$1, true);
- clonesFromRect.top -= dragMatrix.f;
- clonesFromRect.left -= dragMatrix.e;
- }
- },
- dragOverAnimationComplete: function dragOverAnimationComplete() {
- if (folding) {
- folding = false;
- removeMultiDragElements();
- }
- },
- drop: function drop(_ref12) {
- var evt = _ref12.originalEvent,
- rootEl = _ref12.rootEl,
- parentEl = _ref12.parentEl,
- sortable = _ref12.sortable,
- dispatchSortableEvent = _ref12.dispatchSortableEvent,
- oldIndex = _ref12.oldIndex,
- putSortable = _ref12.putSortable;
- var toSortable = putSortable || this.sortable;
- if (!evt) return;
- var options = this.options,
- children = parentEl.children; // Multi-drag selection
-
- if (!dragStarted) {
- if (options.multiDragKey && !this.multiDragKeyDown) {
- this._deselectMultiDrag();
- }
-
- toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));
-
- if (!~multiDragElements.indexOf(dragEl$1)) {
- multiDragElements.push(dragEl$1);
- dispatchEvent({
- sortable: sortable,
- rootEl: rootEl,
- name: 'select',
- targetEl: dragEl$1,
- originalEvt: evt
- }); // Modifier activated, select from last to dragEl
-
- if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
- var lastIndex = index(lastMultiDragSelect),
- currentIndex = index(dragEl$1);
-
- if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {
- // Must include lastMultiDragSelect (select it), in case modified selection from no selection
- // (but previous selection existed)
- var n, i;
-
- if (currentIndex > lastIndex) {
- i = lastIndex;
- n = currentIndex;
- } else {
- i = currentIndex;
- n = lastIndex + 1;
- }
-
- for (; i < n; i++) {
- if (~multiDragElements.indexOf(children[i])) continue;
- toggleClass(children[i], options.selectedClass, true);
- multiDragElements.push(children[i]);
- dispatchEvent({
- sortable: sortable,
- rootEl: rootEl,
- name: 'select',
- targetEl: children[i],
- originalEvt: evt
- });
- }
- }
- } else {
- lastMultiDragSelect = dragEl$1;
- }
-
- multiDragSortable = toSortable;
- } else {
- multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);
- lastMultiDragSelect = null;
- dispatchEvent({
- sortable: sortable,
- rootEl: rootEl,
- name: 'deselect',
- targetEl: dragEl$1,
- originalEvt: evt
- });
- }
- } // Multi-drag drop
-
-
- if (dragStarted && this.isMultiDrag) {
- // Do not "unfold" after around dragEl if reverted
- if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {
- var dragRect = getRect(dragEl$1),
- multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');
- if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;
- toSortable.captureAnimationState();
-
- if (!initialFolding) {
- if (options.animation) {
- dragEl$1.fromRect = dragRect;
- multiDragElements.forEach(function (multiDragElement) {
- multiDragElement.thisAnimationDuration = null;
-
- if (multiDragElement !== dragEl$1) {
- var rect = folding ? getRect(multiDragElement) : dragRect;
- multiDragElement.fromRect = rect; // Prepare unfold animation
-
- toSortable.addAnimationState({
- target: multiDragElement,
- rect: rect
- });
- }
- });
- } // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert
- // properly they must all be removed
-
-
- removeMultiDragElements();
- multiDragElements.forEach(function (multiDragElement) {
- if (children[multiDragIndex]) {
- parentEl.insertBefore(multiDragElement, children[multiDragIndex]);
- } else {
- parentEl.appendChild(multiDragElement);
- }
-
- multiDragIndex++;
- }); // If initial folding is done, the elements may have changed position because they are now
- // unfolding around dragEl, even though dragEl may not have his index changed, so update event
- // must be fired here as Sortable will not.
-
- if (oldIndex === index(dragEl$1)) {
- var update = false;
- multiDragElements.forEach(function (multiDragElement) {
- if (multiDragElement.sortableIndex !== index(multiDragElement)) {
- update = true;
- return;
- }
- });
-
- if (update) {
- dispatchSortableEvent('update');
- }
- }
- } // Must be done after capturing individual rects (scroll bar)
-
-
- multiDragElements.forEach(function (multiDragElement) {
- unsetRect(multiDragElement);
- });
- toSortable.animateAll();
- }
-
- multiDragSortable = toSortable;
- } // Remove clones if necessary
-
-
- if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
- multiDragClones.forEach(function (clone) {
- clone.parentNode && clone.parentNode.removeChild(clone);
- });
- }
- },
- nullingGlobal: function nullingGlobal() {
- this.isMultiDrag = dragStarted = false;
- multiDragClones.length = 0;
- },
- destroyGlobal: function destroyGlobal() {
- this._deselectMultiDrag();
-
- off(document, 'pointerup', this._deselectMultiDrag);
- off(document, 'mouseup', this._deselectMultiDrag);
- off(document, 'touchend', this._deselectMultiDrag);
- off(document, 'keydown', this._checkKeyDown);
- off(document, 'keyup', this._checkKeyUp);
- },
- _deselectMultiDrag: function _deselectMultiDrag(evt) {
- if (dragStarted) return; // Only deselect if selection is in this sortable
-
- if (multiDragSortable !== this.sortable) return; // Only deselect if target is not item in this sortable
-
- if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return; // Only deselect if left click
-
- if (evt && evt.button !== 0) return;
-
- while (multiDragElements.length) {
- var el = multiDragElements[0];
- toggleClass(el, this.options.selectedClass, false);
- multiDragElements.shift();
- dispatchEvent({
- sortable: this.sortable,
- rootEl: this.sortable.el,
- name: 'deselect',
- targetEl: el,
- originalEvt: evt
- });
- }
- },
- _checkKeyDown: function _checkKeyDown(evt) {
- if (evt.key === this.options.multiDragKey) {
- this.multiDragKeyDown = true;
- }
- },
- _checkKeyUp: function _checkKeyUp(evt) {
- if (evt.key === this.options.multiDragKey) {
- this.multiDragKeyDown = false;
- }
- }
- };
- return _extends(MultiDrag, {
- // Static methods & properties
- pluginName: 'multiDrag',
- utils: {
- /**
- * Selects the provided multi-drag item
- * @param {HTMLElement} el The element to be selected
- */
- select: function select(el) {
- var sortable = el.parentNode[expando];
- if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;
-
- if (multiDragSortable && multiDragSortable !== sortable) {
- multiDragSortable.multiDrag._deselectMultiDrag();
-
- multiDragSortable = sortable;
- }
-
- toggleClass(el, sortable.options.selectedClass, true);
- multiDragElements.push(el);
- },
-
- /**
- * Deselects the provided multi-drag item
- * @param {HTMLElement} el The element to be deselected
- */
- deselect: function deselect(el) {
- var sortable = el.parentNode[expando],
- index = multiDragElements.indexOf(el);
- if (!sortable || !sortable.options.multiDrag || !~index) return;
- toggleClass(el, sortable.options.selectedClass, false);
- multiDragElements.splice(index, 1);
- }
- },
- eventProperties: function eventProperties() {
- var _this3 = this;
-
- var oldIndicies = [],
- newIndicies = [];
- multiDragElements.forEach(function (multiDragElement) {
- oldIndicies.push({
- multiDragElement: multiDragElement,
- index: multiDragElement.sortableIndex
- }); // multiDragElements will already be sorted if folding
-
- var newIndex;
-
- if (folding && multiDragElement !== dragEl$1) {
- newIndex = -1;
- } else if (folding) {
- newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')');
- } else {
- newIndex = index(multiDragElement);
- }
-
- newIndicies.push({
- multiDragElement: multiDragElement,
- index: newIndex
- });
- });
- return {
- items: _toConsumableArray(multiDragElements),
- clones: [].concat(multiDragClones),
- oldIndicies: oldIndicies,
- newIndicies: newIndicies
- };
- },
- optionListeners: {
- multiDragKey: function multiDragKey(key) {
- key = key.toLowerCase();
-
- if (key === 'ctrl') {
- key = 'Control';
- } else if (key.length > 1) {
- key = key.charAt(0).toUpperCase() + key.substr(1);
- }
-
- return key;
- }
- }
- });
-}
-
-function insertMultiDragElements(clonesInserted, rootEl) {
- multiDragElements.forEach(function (multiDragElement, i) {
- var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];
-
- if (target) {
- rootEl.insertBefore(multiDragElement, target);
- } else {
- rootEl.appendChild(multiDragElement);
- }
- });
-}
-/**
- * Insert multi-drag clones
- * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted
- * @param {HTMLElement} rootEl
- */
-
-
-function insertMultiDragClones(elementsInserted, rootEl) {
- multiDragClones.forEach(function (clone, i) {
- var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];
-
- if (target) {
- rootEl.insertBefore(clone, target);
- } else {
- rootEl.appendChild(clone);
- }
- });
-}
-
-function removeMultiDragElements() {
- multiDragElements.forEach(function (multiDragElement) {
- if (multiDragElement === dragEl$1) return;
- multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement);
- });
-}
-
-// export default Sortable;
-// export { AutoScrollPlugin as AutoScroll, MultiDragPlugin as MultiDrag, OnSpill, Sortable, SwapPlugin as Swap };
\ No newline at end of file
diff --git a/OLDdata/site/icons/discord.png b/OLDdata/site/icons/discord.png
deleted file mode 100644
index f25fab6f..00000000
Binary files a/OLDdata/site/icons/discord.png and /dev/null differ
diff --git a/OLDdata/site/icons/izzetright.png b/OLDdata/site/icons/izzetright.png
deleted file mode 100644
index b533b395..00000000
Binary files a/OLDdata/site/icons/izzetright.png and /dev/null differ
diff --git a/OLDdata/site/icons/massdrop.png b/OLDdata/site/icons/massdrop.png
deleted file mode 100644
index 00920675..00000000
Binary files a/OLDdata/site/icons/massdrop.png and /dev/null differ
diff --git a/OLDdata/site/icons/patreon.png b/OLDdata/site/icons/patreon.png
deleted file mode 100644
index 36c0fca7..00000000
Binary files a/OLDdata/site/icons/patreon.png and /dev/null differ
diff --git a/OLDdata/site/icons/paypal-512.png b/OLDdata/site/icons/paypal-512.png
deleted file mode 100644
index 467100ac..00000000
Binary files a/OLDdata/site/icons/paypal-512.png and /dev/null differ
diff --git a/OLDdata/site/icons/paypal.png b/OLDdata/site/icons/paypal.png
deleted file mode 100644
index 0f36713d..00000000
Binary files a/OLDdata/site/icons/paypal.png and /dev/null differ
diff --git a/OLDdata/site/icons/pucatrade.png b/OLDdata/site/icons/pucatrade.png
deleted file mode 100644
index a55f8079..00000000
Binary files a/OLDdata/site/icons/pucatrade.png and /dev/null differ
diff --git a/OLDdata/site/icons/reddit.png b/OLDdata/site/icons/reddit.png
deleted file mode 100644
index f7d1d79a..00000000
Binary files a/OLDdata/site/icons/reddit.png and /dev/null differ
diff --git a/OLDdata/site/icons/twitter.png b/OLDdata/site/icons/twitter.png
deleted file mode 100644
index 885ba87e..00000000
Binary files a/OLDdata/site/icons/twitter.png and /dev/null differ
diff --git a/OLDdata/site/images/layerBackground.png b/OLDdata/site/images/layerBackground.png
deleted file mode 100644
index fb1a1cdc..00000000
Binary files a/OLDdata/site/images/layerBackground.png and /dev/null differ
diff --git a/OLDdata/site/images/lowpoly.png b/OLDdata/site/images/lowpoly.png
deleted file mode 100644
index 2d6e1d17..00000000
Binary files a/OLDdata/site/images/lowpoly.png and /dev/null differ
diff --git a/OLDdata/site/images/lowpoly.xcf b/OLDdata/site/images/lowpoly.xcf
deleted file mode 100644
index 4ed417bb..00000000
Binary files a/OLDdata/site/images/lowpoly.xcf and /dev/null differ
diff --git a/OLDdata/site/images/samples/1.png b/OLDdata/site/images/samples/1.png
deleted file mode 100644
index 5b0d76a2..00000000
Binary files a/OLDdata/site/images/samples/1.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/10.png b/OLDdata/site/images/samples/10.png
deleted file mode 100644
index f7a86740..00000000
Binary files a/OLDdata/site/images/samples/10.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/11.png b/OLDdata/site/images/samples/11.png
deleted file mode 100644
index be2a3c51..00000000
Binary files a/OLDdata/site/images/samples/11.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/12.png b/OLDdata/site/images/samples/12.png
deleted file mode 100644
index c020cc78..00000000
Binary files a/OLDdata/site/images/samples/12.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/2.png b/OLDdata/site/images/samples/2.png
deleted file mode 100644
index 83d569c0..00000000
Binary files a/OLDdata/site/images/samples/2.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/3.png b/OLDdata/site/images/samples/3.png
deleted file mode 100644
index c74b22ba..00000000
Binary files a/OLDdata/site/images/samples/3.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/4.png b/OLDdata/site/images/samples/4.png
deleted file mode 100644
index fb277b30..00000000
Binary files a/OLDdata/site/images/samples/4.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/5.png b/OLDdata/site/images/samples/5.png
deleted file mode 100644
index 33f3517f..00000000
Binary files a/OLDdata/site/images/samples/5.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/6.png b/OLDdata/site/images/samples/6.png
deleted file mode 100644
index 7b3064f7..00000000
Binary files a/OLDdata/site/images/samples/6.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/7.png b/OLDdata/site/images/samples/7.png
deleted file mode 100644
index c6f97cbc..00000000
Binary files a/OLDdata/site/images/samples/7.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/8.png b/OLDdata/site/images/samples/8.png
deleted file mode 100644
index e08337ee..00000000
Binary files a/OLDdata/site/images/samples/8.png and /dev/null differ
diff --git a/OLDdata/site/images/samples/9.png b/OLDdata/site/images/samples/9.png
deleted file mode 100644
index 974279c0..00000000
Binary files a/OLDdata/site/images/samples/9.png and /dev/null differ
diff --git a/OLDdata/site/other/askScryfall/askScryfall.js b/OLDdata/site/other/askScryfall/askScryfall.js
deleted file mode 100644
index e82b8883..00000000
--- a/OLDdata/site/other/askScryfall/askScryfall.js
+++ /dev/null
@@ -1,22 +0,0 @@
-var fullAbilityList = new Array()
-
-function loadAbilities() {
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4) {
- fullAbilityList = xhttp.responseText.split("$$$")
- for (var i = 0; i < 3; i ++) {
- fullAbilityList[i] = fullAbilityList[i].split(";")
- }
- }
- }
- xhttp.open("GET", "data/site/other/askScryfall/planeswalkerAbilities.txt", true);
- xhttp.send();
-}
-
-function randomAbility(index) {
- possibleAbilities = fullAbilityList[index]
- document.getElementById("askScryfallResult").innerHTML = possibleAbilities[Math.floor(Math.random() * (possibleAbilities.length - 1))].replace(/\\"/g, '"')
-}
-
-loadAbilities()
diff --git a/OLDdata/site/other/askScryfall/askScryfallAbilityListGenerator.html b/OLDdata/site/other/askScryfall/askScryfallAbilityListGenerator.html
deleted file mode 100644
index ae80bc75..00000000
--- a/OLDdata/site/other/askScryfall/askScryfallAbilityListGenerator.html
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
- Ask Scryfall - Ability List Generator
-
-
-
-
-
-
-
-
diff --git a/OLDdata/site/other/askScryfall/minus.png b/OLDdata/site/other/askScryfall/minus.png
deleted file mode 100644
index dc106d44..00000000
Binary files a/OLDdata/site/other/askScryfall/minus.png and /dev/null differ
diff --git a/OLDdata/site/other/askScryfall/planeswalkerAbilities.txt b/OLDdata/site/other/askScryfall/planeswalkerAbilities.txt
deleted file mode 100644
index eb7926cd..00000000
--- a/OLDdata/site/other/askScryfall/planeswalkerAbilities.txt
+++ /dev/null
@@ -1 +0,0 @@
-Up to X target Beebles can't be blocked this turn, where X is the number of cards in your hand.;Draw a card. Each player puts the top two cards of their library into their graveyard.;Put a +1/+1 counter on each of up to two target creatures.;Look at the top four cards of your library. You may reveal an enchantment card from among them and put that card into your hand. Put the rest on the bottom of your library in a random order.;Create a 2/3 blue and black Nightmare creature token with \"Whenever this creature attacks or blocks, each opponent exiles the top two cards of their library.\";Put two +1/+1 counters on up to one target creature you control.;Up to one target creature gets +3/+0 and gains first strike until end of turn.;Draw a card, then discard a card.;Target creature gets +2/+0 and gains first strike and trample until end of turn.;Create a Food token. (It's an artifact with \"{2}, {T}, Sacrifice this artifact: You gain 3 life.\");Target artifact or creature loses all abilities and becomes a green Elk creature with base power and toughness 3/3.;Until your next turn, whenever a creature deals combat damage to Urza, Academy Headmaster, destroy that creature.;Tap target permanent, then untap another target permanent.;Create a 3/3 green Beast creature token.;You draw a card and you lose 1 life.;Put three +1/+1 counters on up to one target creature.;Urza, Academy Headmaster deals 2 damage to any target.;Up to one target creature gets +2/+0 until end of turn.;Until your next turn, up to one target creature gets -5/-0.;You gain 2 life. Put two +1/+1 counters on up to one target creature.;Distribute two +1/+1 counters among up to two target creatures. They gain trample until end of turn.;Elementals you control get +2/+0 until end of turn.;Each opponent gets an emblem with \"At the beginning of your upkeep, this emblem deals 1 damage to you.\";Target creature you control gains deathtouch and lifelink until end of turn. If it's a Vampire, put a +1/+1 counter on it.;You may sacrifice a Vampire. When you do, Urza, Academy Headmaster deals 3 damage to any target and you gain 3 life.;Until your next turn, up to one target creature gets -2/-0 and loses flying.;You gain life equal to the number of creatures you control plus the number of planeswalkers you control.;Return up to one target land card from your graveyard to your hand.;Creatures you control with flying get +1/+1 until end of turn.;Urza, Academy Headmaster deals X damage to each opponent, where X is the number of artifacts you control. You gain X life.;Draw a card.;Until end of turn, Urza, Academy Headmaster becomes a 5/5 white Soldier creature that's still a planeswalker. Prevent all damage that would be dealt to him this turn. (He can't attack if he was cast this turn.);Until your next turn, you may cast sorcery spells as though they had flash.;Choose a nonland card name, then reveal the top four cards of your library. Put all cards with the chosen name from among them into your hand and the rest into your graveyard.;Urza, Academy Headmaster deals 1 damage to target player or planeswalker.;Scry 1.;You draw a card. Each opponent exiles a card from their hand or a permanent they control.;Add {R} or {G}. Creature spells you cast this turn can't be countered.;You gain 3 life.;Until your next turn, up to one target creature gains vigilance and reach.;Put three +1/+1 counters on up to one target noncreature land you control. Untap it. It becomes a 0/0 Elemental creature with vigilance and haste that's still a land.;Add one mana of any color.\";Until end of turn, each planeswalker you control becomes a 4/4 red Dragon creature and gains flying.;Exile the top card of your library. You may play it this turn.;Create a 2/2 black Zombie creature token.;Target player puts the top two cards of their library into their graveyard. Draw a card.;Up to one other target creature you control gains your choice of vigilance, lifelink, or indestructible until end of turn.;Exile the top card of your library face down and look at it. Create a 2/2 colorless Spirit creature token. When that token leaves the battlefield, put the exiled card into your hand.;Until your next turn, up to one target noncreature artifact becomes an artifact creature with power and toughness each equal to its converted mana cost.;Creatures you control get +1/+1 and gain haste until end of turn.;You gain 2 life and draw a card.;Exile up to two target cards from a single graveyard. You gain 2 life if at least one creature card was exiled this way.;Until end of turn, whenever a creature you control deals combat damage to a player, put a loyalty counter on Urza, Academy Headmaster.;Add {R} or {G}. If that mana is spent on a creature spell, it gains riot. (It enters the battlefield with your choice of a +1/+1 counter or haste.);Each player discards a card.;Target player exiles a card from their hand.;Put a +1/+1 counter on up to one target creature. That creature gains menace until end of turn.;Draw a card.;You may sacrifice another permanent. If you do, you gain 1 life and draw a card.;Look at the top two cards of your library. Put one of them into your hand and the other into your graveyard.;Create a 1/1 colorless Servo artifact creature token.;The next spell you cast this turn costs {1} less to cast for each artifact you control as you cast it.;Discard a card, then draw a card. If a land card is discarded this way, draw an additional card.;Untap each enchanted permanent you control.;Draw a card, then put a card from your hand on top of your library.;Put two +1/+1 counters on up to one target creature.;Urza, Academy Headmaster deals 1 damage to each opponent and each creature your opponents control.;Target player loses 2 life.;Draw a card.;You gain 1 life for each creature you control.;Draw two cards.;Look at the top four cards of your library. You may reveal a creature or land card from among them and put it into your hand. Put the rest on the bottom of your library in a random order.;You may discard a card. If you do, draw a card.;Add two mana in any combination of colors. Spend this mana only to cast Dragon spells.;Put the top three cards of your library into your graveyard. If at least one of them is a Zombie card, each opponent loses 2 life and you gain 2 life.;Create a 1/1 colorless Thopter artifact creature token with flying.;Put a +1/+1 counter on each of up to two target creatures.;Target creature gets +2/+2 until end of turn.;Target creature can't be blocked this turn.;Discard up to two cards, then draw that many cards.;During target player's next turn, each creature that player controls attacks if able.;Until your next turn, up to two target creatures each have base power and toughness 0/3 and lose all abilities.;Add {R}{R}. Urza, Academy Headmaster deals 2 damage to target player.;Untap up to one target artifact or creature.;Draw a card. At the beginning of the next end step, untap up to two lands.;Add {R}{R}{R}. Spend this mana only to cast instant or sorcery spells.;Discard up to three cards, then draw that many cards.;Reveal the top two cards of your library. An opponent chooses one of them. Put that card into your hand and exile the other with a silver counter on it.;Look at the top card of target player's library. You may put that card on the bottom of that player's library.;Urza, Academy Headmaster deals 1 damage to target opponent or planeswalker and each creature that player or that planeswalker's controller controls.;Creatures you control get +1/+0 until end of turn.;Put a loyalty counter on Urza, Academy Headmaster for each creature you control.;Each opponent discards a card and loses 2 life.;Head to AskUrza.com and click +1.;Put two +1/+1 counters on up to one target Dinosaur you control.;Draw a card.;Untap all creatures you control.;Create a 2/2 black Pirate creature token with menace.;You gain life equal to the greatest power among creatures you control.;Whenever one or more creatures you control deal combat damage to a player this turn, draw a card, then discard a card.;Each opponent loses 3 life unless that player sacrifices a nonland permanent or discards a card.;Untap up to two target creatures and up to two target lands.;Up to one target creature gains double strike until end of turn.;Target opponent exiles cards from the top of their library until they exile a nonland card. Until end of turn, you may cast that card without paying its mana cost.;Each opponent exiles two cards from their hand.;Destroy target noncreature permanent.;Target land you control becomes a 4/4 Elemental creature with trample. It's still a land.;Untap up to four target Forests.;Urza, Academy Headmaster deals 1 damage to target player or planeswalker and 1 damage to up to one target creature that player or that planeswalker's controller controls. That creature can't block this turn.;During target opponent's next turn, creatures that player controls attack Urza, Academy Headmaster if able.;Create a 1/1 green Elf Druid creature token with \"{T}: Add {G}.\";Put a -1/-1 counter on up to one target creature.;Untap all creatures you control. Those creatures get +1/+1 until end of turn.;Scry 2.;Create a 2/2 black Zombie creature token. Put the top two cards of your library into your graveyard.;Until your next turn, prevent all damage target permanent would deal.;Look at the top card of your library. If it's a creature card, you may reveal it and put it into your hand.;Reveal cards from the top of your library until you reveal an artifact card. Put that card into your hand and the rest on the bottom of your library in a random order.;Put two +1/+1 counters on up to one target creature.;Reveal cards from the top of your library until you reveal a creature card. Put that card into your hand and the rest on the bottom of your library in a random order.;Create a colorless artifact token named Etherium Cell with \"{T}, Sacrifice this artifact: Add one mana of any color.\";Reveal the top three cards of your library. Put all nonland permanent cards revealed this way into your hand and the rest on the bottom of your library in any order.;You gain 3 life.;Urza, Academy Headmaster deals 2 damage to each opponent.;Scry 1. Urza, Academy Headmaster deals 1 damage to each opponent.;Until your next turn, up to one target creature gets -3/-0 and its activated abilities can't be activated.;Untap target land you control. Until your next turn, it becomes a 5/5 Elemental creature with haste. It's still a land.;Exile the top card of your library. You may cast that card. If you don't, Urza, Academy Headmaster deals 2 damage to each opponent.;Add {R}{R}.;Create a 0/1 green Plant creature token.;Create a 1/1 colorless Construct artifact creature token with defender.;Choose up to two target creatures. Until your next turn, whenever either of those creatures deals combat damage, you draw a card.;Up to one target creature gets -2/-1 until your next turn.;Target player draws two cards, then discards two cards.;Reveal the top card of your library and put that card into your hand. Each opponent loses life equal to its converted mana cost.;You may discard a card. If you do, draw a card.;Until end of turn, up to one target creature gets +2/+2 and gains vigilance and haste.;Creatures you control get +1/+1 and gain trample until end of turn.;Scry 1, then draw a card.;Create two 3/1 red Elemental creature tokens with haste. Exile them at the beginning of the next end step.;Untap up to one target creature and up to one target land.;Until end of turn, Urza, Academy Headmaster becomes a 5/5 Human Soldier Ally creature with indestructible that's still a planeswalker. Prevent all damage that would be dealt to him this turn.;Reveal the top card of your library. If it's a land card, put it onto the battlefield. Otherwise, put it into your hand.;Urza, Academy Headmaster deals 2 damage to target player or planeswalker.;Each player discards a card.;Up to one target creature gets -2/-0 until your next turn.;Up to one target creature an opponent controls attacks Urza, Academy Headmaster during its controller's next turn if able.;Until your next turn, target creature gains indestructible. Untap that creature.;Untap up to two target artifacts.;Draw a card, then add one mana of any color.;Look at the top card of your library. If it's a noncreature, nonland card, you may reveal it and put it into your hand.;Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls.;Create three 1/1 white Soldier creature tokens.;Urza, Academy Headmaster deals 3 damage to any target.;Urza, Academy Headmaster deals 1 damage to target player or planeswalker.;Each player draws a card.;Target player discards a card.;Untap two target lands.;Each opponent loses 1 life. You gain life equal to the life lost this way.;Look at the top two cards of your library. Put one of them into your hand and the other on the bottom of your library.;Create a 1/1 white Kor Soldier creature token. You may attach an Equipment you control to it.;Until your next turn, creatures you control get +1/+0 and gain lifelink.;Until end of turn, Urza, Academy Headmaster becomes a legendary 4/4 red Dragon creature with flying, indestructible, and haste. (He doesn't lose loyalty while he's not a planeswalker.);Destroy another target planeswalker.;Create a 3/3 black Beast creature token with deathtouch.;Look at the top two cards of your library. Put one of them into your graveyard.;Until end of turn, up to one target creature gets +1/+1 and gains first strike, vigilance, and lifelink.;Distribute three +1/+1 counters among one, two, or three target creatures you control.;Look at the top four cards of your library. You may reveal an Aura, creature, or planeswalker card from among them and put it into your hand. Put the rest on the bottom of your library in any order.;Until your next turn, whenever a creature an opponent controls attacks, it gets -1/-0 until end of turn.;Add X mana in any combination of {R} and/or {G}, where X is the number of creatures you control.;Exile the top three cards of target opponent's library.;Reveal the top five cards of your library. Put all creature cards revealed this way into your hand and the rest on the bottom of your library in any order.;Search your library for a Swamp card, reveal it, and put it into your hand. Then shuffle your library.;Draw a card. Target player puts the top card of their library into their graveyard.;Put a +1/+1 counter on up to one target creature.;Creatures you control get +1/+1 and gain haste until end of turn.;Create a 1/1 white Soldier creature token.;Target creature gets +3/+3 and gains flying until end of turn.;Draw a card, then discard a card at random.;Create a 1/1 black Vampire creature token with lifelink.;Put a loyalty counter on Urza, Academy Headmaster for each creature target opponent controls.;Urza, Academy Headmaster deals 1 damage to any target.;Tap target permanent. It doesn't untap during its controller's next untap step.;Untap target Mountain. It becomes a 4/4 red Elemental creature until end of turn. It's still a land.;Exile target permanent you own. Return it to the battlefield under your control at the beginning of the next end step.;Create a 1/1 black Wolf creature token with deathtouch.;Target permanent doesn't untap during its controller's next untap step.;Urza, Academy Headmaster deals 2 damage to any target and you gain 2 life.;Look at the top five cards of your library. You may reveal an artifact card from among them and put it into your hand. Put the rest on the bottom of your library in any order.;You gain 1 life for each creature you control.;You gain 2 life.;Search your library for a card named Nissa's Chosen and put it onto the battlefield. Then shuffle your library.;You gain 2 life for each Elf you control.;Discard a card. If a red card is discarded this way, Urza, Academy Headmaster deals 4 damage to any target.$$$Draw a card.;Search your library and/or graveyard for a card named Sunlit Hoplite and put it onto the battlefield. If you search your library this way, shuffle it.;Exile target creature or enchantment you don't control until target enchantment you control leaves the battlefield.;Return target nonland permanent to its owner's hand, then that player exiles a card from their hand.;Up to two target creatures you control each get +2/+1 until end of turn.;Create two 1/1 white Human Soldier creature tokens.;You gain 5 life.;Until end of turn, Urza, Academy Headmaster becomes a copy of target creature you control. Prevent all damage that would be dealt to him this turn.;Urza, Academy Headmaster deals 1 damage to each of up to two target creatures. Those creatures can't block this turn.;Create two 2/2 black and green Wolf creature tokens with \"When this creature dies, put a loyalty counter on each Garruk you control.\";Destroy target creature. Draw a card.;Destroy target nonland permanent.;Urza, Academy Headmaster deals 3 damage to any target.;Draw cards equal to the greatest power among creatures you control.;Destroy target creature.;Reveal cards from the top of your library until you reveal a creature card. Put that card into your hand and the rest on the bottom of your library in a random order.;Urza, Academy Headmaster deals 4 damage to target creature and 2 damage to that creature's controller.;Urza, Academy Headmaster deals 4 damage to any target. You gain 4 life.;Return up to two target creatures to their owners' hands.;Exile target creature. Its controller gains 2 life.;Target creature you control deals damage equal to its power to target creature or planeswalker.;Add {R}{R}.;Urza, Academy Headmaster deals 2 damage to any target.;Urza, Academy Headmaster deals 3 damage to each non-Elemental creature.;Put a loyalty counter on each red planeswalker you control.;Create two 1/1 red Elemental creature tokens. They gain haste. Sacrifice them at the beginning of the next end step.;You may cast target instant or sorcery card with converted mana cost 3 or less from your graveyard. If that card would be put into your graveyard this turn, exile it instead.;You may put a Vampire creature card from your hand onto the battlefield.;Create a 4/4 blue Elemental Bird creature token with flying.;Create a 2/2 white Cat Soldier creature token named Ajani's Pridemate with \"Whenever you gain life, put a +1/+1 counter on Ajani's Pridemate.\";If you have at least 15 life more than your starting life total, exile Urza, Academy Headmaster and each artifact and creature your opponents control.;Urza, Academy Headmaster deals 1 damage to any target.;Create a 4/4 white Angel creature token with flying and vigilance.;Return target artifact card from your graveyard to your hand.;Create a 1/1 black Assassin creature token with deathtouch and \"Whenever this creature deals damage to a planeswalker, destroy that planeswalker.\";Target creature gets +2/+1 and gains haste until end of turn. Scry 1.;Target artifact you control becomes a copy of another target artifact or creature you control until end of turn, except it's an artifact in addition to its other types.;Untap target permanent.;Exile target creature.;You gain life equal to the greatest toughness among creatures you control.;Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls.;Target player puts the top four cards of their library into their graveyard. Then exile each opponent's graveyard.;Amass 2. (Put two +1/+1 counters on an Army you control. If you don't control one, create a 0/0 black Zombie Army creature token first.);Return up to one target artifact, creature, or enchantment to its owner's hand. Draw a card.;Return target card from your graveyard to your hand.;When you cast your next instant or sorcery spell this turn, copy that spell. You may choose new targets for the copy.;Destroy target creature or planeswalker.;Target creature you control fights target creature you don't control.;Put a +1/+1 counter on each creature you control and a loyalty counter on each other planeswalker you control.;Look at the top three cards of your library. Exile one face down and put the rest on the bottom of your library in any order. For as long as it remains exiled, you may look at that card and you may cast it if it's a creature card.;Put a +1/+1 counter on target creature.;Create a 2/2 green Wolf creature token.;Create a 1/1 red Devil creature token with \"When this creature dies, it deals 1 damage to any target.\";Create a 4/4 red Dragon creature token with flying.;Urza, Academy Headmaster deals 2 damage to any target.;Destroy target creature. Its controller draws two cards.;Each player sacrifices two creatures.;Target player discards a card.;Look at the top four cards of your library. You may reveal a noncreature, nonland card from among them and put it into your hand. Put the rest on the bottom of your library in a random order.;Create a 2/2 blue Wizard creature token. Draw a card, then discard a card.;Exile target creature with power 4 or greater.;Create a 0/3 white Wall creature token with defender.;Destroy target permanent that's one or more colors.;You may choose an artifact card you own from outside the game or in exile, reveal that card, and put it into your hand.;Urza, Academy Headmaster deals 3 damage to any target.;Tap target creature. It doesn't untap during its controller's next untap step.;Exile target nonland permanent with converted mana cost 1 or less.;Create a 1/1 colorless Thopter artifact creature token with flying. You gain 1 life.;Look at the top four cards of your library. You may reveal up to two creature cards from among them and put them into your hand. Put the rest on the bottom of your library in a random order.;Target player sacrifices a creature.;Exile target permanent.;Destroy target creature.;Urza, Academy Headmaster deals 3 damage divided as you choose among one, two, or three targets.;Destroy target nonland permanent with converted mana cost 3 or less.;Urza, Academy Headmaster deals damage to target creature equal to the total number of instant and sorcery cards you own in exile and in your graveyard.;Return up to two target land cards from your graveyard to the battlefield.;Create a white Aura enchantment token named Mask attached to another target permanent. The token has enchant permanent and totem armor.;Exile another target permanent you own, then return it to the battlefield under your control.;Target creature you control deals damage equal to its power to target creature you don't control.;Urza, Academy Headmaster deals 4 damage to target player or planeswalker.;Return target creature card from your graveyard to your hand.;Until your next turn, target artifact you control becomes a 5/5 creature in addition to its other types.;Creatures you control get +2/+2 until end of turn.;Urza, Academy Headmaster deals 10 damage to target creature or planeswalker.;Put target creature or planeswalker card from a graveyard onto the battlefield under your control.;Destroy target artifact, enchantment, or creature with flying.;Target creature gets -X/-X until end of turn, where X is the number of Zombies you control.;You may cast Zombie cards from your graveyard this turn.;Draw a card. If you control three or more artifacts, draw two cards instead.;Return target creature card with converted mana cost 2 or less from your graveyard to the battlefield.;If you don't control a creature named Mowu, create Mowu, a legendary 3/3 green Hound creature token.;Draw two cards.;Sacrifice an artifact. If you do, return target artifact card from your graveyard to the battlefield.;Urza, Academy Headmaster deals 3 damage to each tapped creature target player controls.;Target player draws two cards. Until your next turn, instant, sorcery, and planeswalker spells that player casts cost {2} less to cast.;Urza, Academy Headmaster deals 3 damage to target creature or planeswalker.;You gain 2 life and draw two cards.;Put target nonland permanent into its owner's library third from the top.;Put a card you own with a silver counter on it from exile into your hand.;Create a 0/0 colorless Construct artifact creature token with \"This creature gets +1/+1 for each artifact you control.\";Draw three cards, then put two cards from your hand on top of your library in any order.;Return target creature to its owner's hand.;Return target Pirate card from your graveyard to the battlefield.;Destroy target creature.;Target creature gets +X/+X until end of turn, where X is the number of creatures you control.;Gain control of target creature until end of turn. Untap it. It gains haste until end of turn. Sacrifice it at the beginning of the next end step if it has converted mana cost 3 or less.;Head to AskUrza.com and click -1.;Target Dinosaur you control deals damage equal to its power to target creature you don't control.;Destroy target artifact, creature, or enchantment. Create a Treasure token. (It's an artifact with \"{T}, Sacrifice this artifact: Add one mana of any color.\");Create a 3/3 green Dinosaur creature token with trample.;Create a 2/2 blue Illusion creature token with \"When this creature becomes the target of a spell, sacrifice it.\";Destroy target creature. Draw a card.;Target creature gets +5/+5 until end of turn.;Urza, Academy Headmaster deals 2 damage divided as you choose among one or two targets.;Urza, Academy Headmaster deals 7 damage to target opponent, creature an opponent controls, or planeswalker an opponent controls.;Gain control of target creature.;Exile the top card of your library. You may play it this turn.;Destroy target tapped creature.;Until end of turn, Urza, Academy Headmaster becomes a 6/6 Human Soldier creature that's still a planeswalker. Prevent all damage that would be dealt to him this turn.;Destroy target artifact or enchantment.;Destroy target creature with a -1/-1 counter on it.;Until end of turn, Urza, Academy Headmaster becomes a 5/5 Human Soldier creature with indestructible that's still a planeswalker. Prevent all damage that would be dealt to him this turn.;Look at the top card of your library. If it's a land card or a creature card with converted mana cost less than or equal to the number of loyalty counters on Urza, Academy Headmaster, you may put that card onto the battlefield.;Return target creature card from your graveyard to the battlefield. That creature is a black Zombie in addition to its other colors and types.;Until end of turn, Urza, Academy Headmaster becomes a 4/4 Human Soldier creature with indestructible that's still a planeswalker. Prevent all damage that would be dealt to him this turn.;You get an emblem with \"As long as you control a Gideon planeswalker, you can't lose the game and your opponents can't win the game.\";Target creature you control fights another target creature.;Target opponent loses life equal to the number of artifacts you control.;Target creature gets +X/-X until end of turn, where X is the number of artifacts you control.;Exile target creature. Its controller gains life equal to its power.;Reveal the top two cards of your library. Put all land cards from among them onto the battlefield and the rest into your hand.;Urza, Academy Headmaster deals 4 damage to target creature.;Create a token that's a copy of target artifact or creature you control, except it's an artifact in addition to its other types. That token gains haste. Exile it at the beginning of the next end step.;You gain 2 life and draw a card.;Return target permanent card from your graveyard to your hand.;Urza, Academy Headmaster deals 4 damage to target creature.;Put a +1/+1 counter on each creature you control.;Exile Urza, Academy Headmaster or up to one target creature. Return that card to the battlefield under its owner's control at the beginning of your next upkeep. You lose 2 life.;Each opponent loses 2 life and you gain 2 life.;Each opponent discards a card and you draw a card.;You may sacrifice an artifact. If you do, destroy target artifact or creature.;Tap up to two target nonland permanents. They don't untap during their controller's next untap step.;Put the top two cards of your library into your graveyard, then you may return a creature card from your graveyard to your hand.;Gain control of target artifact.;Exile target enchantment, tapped artifact, or tapped creature.;Create a 2/2 green Wolf creature token. Transform Arlinn Kord.;Urza, Academy Headmaster deals 3 damage to any target. Transform Arlinn, Embraced by the Moon.;Return target creature to its owner's hand.;Discard all the cards in your hand, then draw that many cards plus one.;Reveal the top four cards of your library. You may put a creature card and/or a land card from among them into your hand. Put the rest into your graveyard.;Create a 2/2 white Knight Ally creature token.;You get an emblem with \"Creatures you control get +1/+1.\";Create Ashaya, the Awoken World, a legendary 4/4 green Elemental creature token.;Urza, Academy Headmaster deals 2 damage to target creature.;You may cast target instant or sorcery card from your graveyard this turn. If that card would be put into your graveyard this turn, exile it instead.;Until end of turn, Urza, Academy Headmaster becomes a 4/4 Human Soldier creature with indestructible that's still a planeswalker. Prevent all damage that would be dealt to him this turn.;Create a 4/4 red Dragon creature token with flying.;When you cast your next instant or sorcery spell from your hand this turn, it gains rebound. (Exile the spell as it resolves. At the beginning of your next upkeep, you may cast that card from exile without paying its mana cost.);Draw a card. You may play an additional land this turn.;Destroy all creatures with power 4 or greater.;Target player draws a card.;Search your library for a card, then shuffle your library and put that card on top of it.;Create a 3/3 green Beast creature token.;Creatures you control get +3/+3 and gain trample until end of turn.;Create a 5/5 black Demon creature token with flying. You lose 2 life.;Untap up to four target permanents.;You may put an Equipment card from your hand or graveyard onto the battlefield.;Create a 2/2 black Vampire creature token with flying.;Urza, Academy Headmaster deals 4 damage to target creature.;Destroy target creature. You gain life equal to its toughness.;Return another target nonland permanent to its owner's hand.;Put a +1/+1 counter on each creature you control and a loyalty counter on each other planeswalker you control.;Reveal the top three cards of your library. An opponent separates those cards into two piles. Put one pile into your hand and the other on the bottom of your library in any order.;Create a 2/2 red and green Satyr creature token with haste.;You may put a green creature card from your hand onto the battlefield.;Target creature gets +X/+X or -X/-X until end of turn, where X is the number of Swamps you control.;Target player puts the top ten cards of their library into their graveyard.;Target creature gains flying and double strike until end of turn.;Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn.;Urza, Academy Headmaster deals damage equal to the number of cards in target player's hand to that player.;You get an emblem with \"Creatures you control get +1/+0.\";Until end of turn, Urza, Academy Headmaster becomes a Human Soldier creature with power and toughness each equal to the number of loyalty counters on him and gains indestructible. He's still a planeswalker. Prevent all damage that would be dealt to him this turn.;When you cast your next instant or sorcery spell this turn, copy that spell. You may choose new targets for the copy.;Draw a card for each tapped creature target player controls.;Add {R} for each Mountain you control.;Creatures can't be blocked this turn.;Garruk Relentless deals 3 damage to target creature. That creature deals damage equal to its power to him.;Create a 2/2 green Wolf creature token.;Sacrifice a creature. If you do, search your library for a creature card, reveal it, put it into your hand, then shuffle your library.;Creatures you control gain trample and get +X/+X until end of turn, where X is the number of creature cards in your graveyard.;Urza, Academy Headmaster deals 3 damage to any target and you gain 3 life.;Target opponent's life total becomes 10.;Target artifact becomes an artifact creature with base power and toughness 5/5.;Target player loses X life and you gain X life, where X is twice the number of artifacts you control.;Create three 1/1 white Soldier creature tokens.;Put a +1/+1 counter on each creature you control. Those creatures gain vigilance until end of turn.;Reveal the top card of your library and put it into your hand. Urza, Academy Headmaster deals damage to himself equal to that card's converted mana cost.;Target creature's controller sacrifices it, then that player creates a 5/5 red Dragon creature token with flying.;Each Dragon creature you control deals damage equal to its power to target player or planeswalker.;Each player discards their hand, then draws three cards.$$$Put target creature card from a graveyard onto the battlefield under your control.;Gain control of all creatures target opponent controls.;Until end of turn, creatures you control gain flying and get +X/+X, where X is your devotion to white.;Return all enchantment cards from your graveyard to the battlefield.;You may cast up to three face-up cards your opponents own from exile without paying their mana costs.;Until end of turn, each creature you control has base power and toughness 10/10 and gains trample.;Gain control of all creatures until end of turn. Untap them. They gain haste until end of turn.;Draw four cards. When you do, Urza, Academy Headmaster deals damage to any target equal to the number of cards in your hand.;Exchange control of target artifact or creature you control and target creature an opponent controls with power 3 or less.;You get an emblem with \"Creatures you control get +3/+3 and have trample.\";Create three 1/1 black Assassin creature tokens with \"Whenever this creature deals combat damage to a player, that player loses the game.\";Flip five coins. Take an extra turn after this one for each coin that comes up heads.;Create a 6/6 green Wurm creature token for each land you control.;Target opponent gets an emblem with \"Whenever a player draws a card, you lose 2 life.\";Target creature gets +10/+10 and gains trample until end of turn.;Urza, Academy Headmaster deals 10 damage to target player and each creature that player controls.;Until end of turn, each Vampire you control gains \"{T}: Gain control of target creature.\";Creatures you control with flying get +5/+5 until end of turn.;Creatures you control gain flying and double strike until end of turn.;You may choose a creature card you own from outside the game, reveal it, and put it into your hand.;You get an emblem with \"Islands you control have '{T}: Draw a card.'\";You get an emblem with \"Instant and sorcery cards in your graveyard have retrace.\" (You may cast instant and sorcery cards from your graveyard by discarding a land card in addition to paying their other costs.);You get an emblem with \"If you control a creature, damage that would reduce your life total to less than 1 reduces it to 1 instead.\";Exile the top ten cards of your library. Put all artifact cards from among them onto the battlefield.;Creatures you control can't be blocked this turn.;Exile Urza, Academy Headmaster and each creature your opponents control.;Each opponent who doesn't control a legendary creature or planeswalker loses the game.;You get an emblem with \"Lands you control have indestructible.\" Search your library for any number of Forest cards, put them onto the battlefield tapped, then shuffle your library.;Exile the top seven cards of your library. You may play them this turn.;Each opponent chooses a permanent they control of each permanent type and sacrifices the rest.;Draw seven cards. Then if your library has no cards in it, you win the game.;Exile target nonland permanent.;Put three +1/+1 counters on each creature you control. Those creatures gain trample until end of turn.;Tap all permanents target opponent controls. That player skips their next untap step.;Urza, Academy Headmaster deals damage to target player equal to the number of cards that player owns in exile and you gain that much life.;Look at the top ten cards of your library. Put three of them into your hand and the rest on the bottom of your library in a random order.;You get an emblem with \"At the beginning of each end step, create a 4/4 red and green Beast creature token with trample.\";Separate all permanents target player controls into two piles. That player sacrifices all permanents in the pile of their choice.;Restart the game, leaving in exile all non-Aura permanent cards exiled with Urza, Academy Headmaster. Then put those cards onto the battlefield under your control.;For each creature card in your graveyard, put a +1/+1 counter on each creature you control.;Draw seven cards. Urza, Academy Headmaster deals 7 damage to each creature your opponents control.;You get an emblem with \"Whenever a creature you control deals combat damage to a player, that player loses the game.\";You get an emblem with \"Whenever you cast an instant or sorcery spell, this emblem deals 4 damage to any target and you draw two cards.\";For each artifact you control, create a token that's a copy of it. Those tokens gain haste. Exile those tokens at the beginning of the next end step.;Destroy up to six target nonland permanents, then create six 2/2 green Cat Warrior creature tokens with forestwalk.;Put the top seven cards of your library into your graveyard. Return all non-Aura enchantment cards from your graveyard to the battlefield, then do the same for Aura cards.;Choose left or right. Each player gains control of all nonland permanents other than Urza, Academy Headmaster controlled by the next player in the chosen direction.;Creatures you control get +4/+4 and gain trample until end of turn.;Search your library for any number of Dragon creature cards, put them onto the battlefield, then shuffle your library.;Destroy up to two target creatures. Put up to two creature cards from graveyards onto the battlefield under your control.;Put any number of cards from your hand onto the battlefield face down. They're 5/5 artifact creatures.;Put X +1/+1 counters on target creature, where X is your life total.;Exile all but the bottom card of target player's library.;You get an emblem with \"Creatures you control get +2/+2 and have vigilance, trample, and indestructible.\";Create four 5/5 red Dragon creature tokens with flying.;You get an emblem with \"At the beginning of your end step, search your library for a permanent card, put it onto the battlefield, then shuffle your library.\";You get an emblem with \"At the beginning of your end step, create three 1/1 white Cat creature tokens with lifelink.\";Until end of turn, target creature gains trample and gets +X/+X, where X is the number of lands you control.;Tap all creatures your opponents control. You take an extra turn after this one.;You get an emblem with \"Whenever an artifact is put into your graveyard from the battlefield, return that card to the battlefield at the beginning of the next end step.\";Target player gets an emblem with \"Whenever you activate an ability that isn't a mana ability, copy it. You may choose new targets for the copy.\";Target player gets an emblem with \"Whenever you cast an instant or sorcery spell, copy it. You may choose new targets for the copy.\";Urza, Academy Headmaster deals 10 damage to target player and each creature and planeswalker they control.;Take an extra turn after this one.;You get an emblem with \"Whenever you draw a card, exile target permanent an opponent controls.\";You get an emblem with \"You may cast instant and sorcery cards from your graveyard. If a card cast this way would be put into your graveyard, exile it instead.\";Exile all cards from target player's library, then that player shuffles their hand into their library.;Destroy all creatures target opponent controls. Urza, Academy Headmaster deals damage to that player equal to their total power.;Until end of turn, creatures you control gain deathtouch and \"Whenever this creature deals damage to an opponent, that player loses the game.\";You get an emblem with \"Whenever a creature enters the battlefield under your control, you may draw a card.\";Each opponent loses life equal to the number of cards in their graveyard.;Head to AskUrza.com and click -6.;Dinosaurs you control get +4/+4 until end of turn.;Gain control of up to three target creatures.;Target player's life total becomes 1.;Create two tokens that are copies of Urza, Academy Headmaster, except they're not legendary.;Urza, Academy Headmaster deals 7 damage to each opponent. You draw seven cards.;Look at the top ten cards of your library. You may put any number of creature and/or land cards from among them onto the battlefield. Put the rest on the bottom of your library in a random order.;Search your library for up to two creature and/or planeswalker cards, put them onto the battlefield, then shuffle your library.;Exile each nonland permanent your opponents control.;Urza, Academy Headmaster deals 7 damage to target player or planeswalker. That player or that planeswalker's controller discards seven cards, then sacrifices seven permanents.;Search your library for any number of basic land cards, put them onto the battlefield, then shuffle your library. Those lands become 4/4 Elemental creatures with trample. They're still lands.;Exile the top ten cards of your library. Choose an instant or sorcery card exiled this way and copy it three times. You may cast the copies without paying their mana costs.;Draw a card for each green creature you control.;Return all creature cards from your graveyard to the battlefield.;Creatures you control get +2/+2 until end of turn. Tap all creatures your opponents control.;Untap up to two target lands you control. They become 5/5 Elemental creatures with flying and haste until end of turn. They're still lands.;Destroy all non-Zombie creatures.;You get an emblem with \"Creatures you control have double strike, trample, hexproof, and haste.\";Gain control of all artifacts and creatures target opponent controls.;Put X +1/+1 counters on target creature, where X is your life total. That creature gains trample until end of turn.;You get an emblem with \"At the beginning of combat on your turn, target artifact you control becomes an artifact creature with base power and toughness 5/5.\";Put five +1/+1 counters on each creature you control and five loyalty counters on each other planeswalker you control.;Creatures you control get +5/+5 and gain trample until end of turn.;Urza, Academy Headmaster deals 6 damage to target player or planeswalker and each creature that player or that planeswalker's controller controls.;Search your library for up to three artifact cards with different names, put them onto the battlefield, then shuffle your library.;You get an emblem with \"Your opponents can't untap more than two permanents during their untap steps.\";You get an emblem with \"Whenever a land enters the battlefield under your control, you may draw a card.\";You get an emblem with \"Whenever you cast a spell, this emblem deals 5 damage to any target.\";You gain X life and draw X cards, where X is the number of lands you control.;Choose target artifact card in a graveyard or artifact on the battlefield. Create three tokens that are copies of it.;Draw three cards. You get an emblem with \"You may cast spells from your hand without paying their mana costs.\";You get an emblem with \"At the beginning of your end step, create X 2/2 black Zombie creature tokens, where X is two plus the number of Zombies you control.\";You get an emblem with \"Whenever you cast a spell that targets one or more permanents, gain control of those permanents.\";Create a number of 1/1 black Vampire Knight creature tokens with lifelink equal to the highest life total among all players.;Search your library for an artifact or creature card, put it onto the battlefield, then shuffle your library. It gains haste. Return it to your hand at the beginning of the next end step.;You get an emblem with \"Creatures you control have haste and '{T}: This creature deals damage equal to its power to any target.'\";You get an emblem with \"Whenever an opponent casts their first spell each turn, counter that spell.\";You get an emblem with \"Whenever a creature enters the battlefield under your control, you may have it fight target creature.\" Then create three 8/8 blue Octopus creature tokens.;Untap up to six target lands. They become 6/6 Elemental creatures. They're still lands.;Urza, Academy Headmaster deals 6 damage to each opponent. Each player dealt damage this way gets an emblem with \"At the beginning of your upkeep, this emblem deals 3 damage to you.\";You get an emblem with \"Whenever a creature dies, return it to the battlefield under your control at the beginning of the next end step.\";You get an emblem with \"Whenever you cast a spell, target opponent puts the top five cards of their library into their graveyard.\";Artifacts you control become artifact creatures with base power and toughness 5/5 until end of turn.;Search your library for any number of Dragon creature cards and put them onto the battlefield. Then shuffle your library.;You get an emblem with \"Your opponents can't cast noncreature spells.\";You get an emblem with \"At the beginning of your end step, create a 9/9 blue Kraken creature token.\";You get an emblem with \"Creatures you control get +2/+2 and have flying.\";You gain 7 life, draw seven cards, then put up to seven permanent cards from your hand onto the battlefield.;Urza, Academy Headmaster deals 10 damage to target player or planeswalker and each creature that player or that planeswalker's controller controls.;Target player puts the top twenty cards of their library into their graveyard.;Put all creature cards from all graveyards onto the battlefield under your control.;You get an emblem with \"{1}{B}, Sacrifice a creature: You gain X life and draw X cards, where X is the sacrificed creature's power.\";You get an emblem with \"You may activate loyalty abilities of planeswalkers you control on any player's turn any time you could cast an instant.\";Create a colorless Equipment artifact token named Stoneforged Blade. It has indestructible, \"Equipped creature gets +5/+5 and has double strike,\" and equip {0}.;You get an emblem with \"At the beginning of each opponent's upkeep, that player sacrifices a creature.\";You get an emblem with \"At the beginning of your draw step, draw two additional cards\" and \"At the beginning of your end step, discard your hand.\";Target opponent gets an emblem with \"Whenever a creature attacks you, it gets +5/+5 and gains trample until end of turn.\";Each player shuffles their hand and graveyard into their library. You draw seven cards.;You get an emblem with \"If a source would deal damage to you or a planeswalker you control, prevent all but 1 of that damage.\";You gain 100 life.;For each player, search that player's library for a nonland card and exile it, then that player shuffles their library. You may cast those cards without paying their mana costs.;Exile the top seven cards of your library. You may put any number of creature and/or land cards from among them onto the battlefield.;Exile all cards from all opponents' hands and graveyards.;You get an emblem with \"Whenever you cast a creature spell, you may search your library for a creature card, put it onto the battlefield, then shuffle your library.\";You get an emblem with \"Swamps you control have '{T}: Add {B}{B}{B}{B}.'\";Any number of target players each draw twenty cards.;Create X 2/2 white Cat creature tokens, where X is your life total.;Create five 4/4 red Dragon creature tokens with flying.;You get an emblem with \"Artifacts, creatures, enchantments, and lands you control have indestructible.\";Gain control of all creatures until end of turn. Untap them. They gain haste until end of turn.;Destroy up to three target creatures and/or other planeswalkers. Return each card put into a graveyard this way to the battlefield under your control.;Exile all other permanents.;Urza, Academy Headmaster deals 6 damage to each of up to six targets.;You get an emblem with \"You have no maximum hand size\" and \"Whenever a card is put into your graveyard from anywhere, you may return it to your hand.\";You get an emblem with \"Mountains you control have '{T}: This land deals 1 damage to any target.'\";You get an emblem with \"Whenever you cast a spell, exile target permanent.\";Destroy all lands target player controls.;You control target player during that player's next turn.;Destroy all other permanents except for lands and tokens.;Create a white Avatar creature token. It has \"This creature's power and toughness are each equal to your life total.\";Search your library for any number of Elf creature cards and put them onto the battlefield. Then shuffle your library.;Cast any number of red instant and/or sorcery cards from your graveyard without paying their mana costs.$$$
\ No newline at end of file
diff --git a/OLDdata/site/other/askScryfall/plus.png b/OLDdata/site/other/askScryfall/plus.png
deleted file mode 100644
index 0cb5784a..00000000
Binary files a/OLDdata/site/other/askScryfall/plus.png and /dev/null differ
diff --git a/OLDdata/site/other/askScryfall/ultimate.png b/OLDdata/site/other/askScryfall/ultimate.png
deleted file mode 100644
index e553ee85..00000000
Binary files a/OLDdata/site/other/askScryfall/ultimate.png and /dev/null differ
diff --git a/OLDdata/site/other/askScryfall/urzaBlank.png b/OLDdata/site/other/askScryfall/urzaBlank.png
deleted file mode 100644
index 2d5bd89f..00000000
Binary files a/OLDdata/site/other/askScryfall/urzaBlank.png and /dev/null differ
diff --git a/OLDdata/site/other/life/NoSleep.js b/OLDdata/site/other/life/NoSleep.js
deleted file mode 100644
index 9453d5fe..00000000
--- a/OLDdata/site/other/life/NoSleep.js
+++ /dev/null
@@ -1,192 +0,0 @@
-/*! NoSleep.js v0.9.0 - git.io/vfn01 - Rich Tibbett - MIT license */
-(function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define([], factory);
- else if(typeof exports === 'object')
- exports["NoSleep"] = factory();
- else
- root["NoSleep"] = factory();
- })(typeof self !== 'undefined' ? self : this, function() {
- return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId]) {
-/******/ return installedModules[moduleId].exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ i: moduleId,
-/******/ l: false,
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.l = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // define getter function for harmony exports
-/******/ __webpack_require__.d = function(exports, name, getter) {
-/******/ if(!__webpack_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, {
-/******/ configurable: false,
-/******/ enumerable: true,
-/******/ get: getter
-/******/ });
-/******/ }
-/******/ };
-/******/
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function getDefault() { return module['default']; } :
-/******/ function getModuleExports() { return module; };
-/******/ __webpack_require__.d(getter, 'a', getter);
-/******/ return getter;
-/******/ };
-/******/
-/******/ // Object.prototype.hasOwnProperty.call
-/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ (function(module, exports, __webpack_require__) {
-
- "use strict";
-
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- var _require = __webpack_require__(1),
- webm = _require.webm,
- mp4 = _require.mp4;
-
- // Detect iOS browsers < version 10
-
-
- var oldIOS = typeof navigator !== 'undefined' && parseFloat(('' + (/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0, ''])[1]).replace('undefined', '3_2').replace('_', '.').replace('_', '')) < 10 && !window.MSStream;
-
- var NoSleep = function () {
- function NoSleep() {
- var _this = this;
-
- _classCallCheck(this, NoSleep);
-
- if (oldIOS) {
- this.noSleepTimer = null;
- } else {
- // Set up no sleep video element
- this.noSleepVideo = document.createElement('video');
-
- this.noSleepVideo.setAttribute('muted', '');
- this.noSleepVideo.setAttribute('title', 'No Sleep');
- this.noSleepVideo.setAttribute('playsinline', '');
-
- this._addSourceToVideo(this.noSleepVideo, 'webm', webm);
- this._addSourceToVideo(this.noSleepVideo, 'mp4', mp4);
-
- this.noSleepVideo.addEventListener('loadedmetadata', function () {
- if (_this.noSleepVideo.duration <= 1) {
- // webm source
- _this.noSleepVideo.setAttribute('loop', '');
- } else {
- // mp4 source
- _this.noSleepVideo.addEventListener('timeupdate', function () {
- if (_this.noSleepVideo.currentTime > 0.5) {
- _this.noSleepVideo.currentTime = Math.random();
- }
- });
- }
- });
- }
- }
-
- _createClass(NoSleep, [{
- key: '_addSourceToVideo',
- value: function _addSourceToVideo(element, type, dataURI) {
- var source = document.createElement('source');
- source.src = dataURI;
- source.type = 'video/' + type;
- element.appendChild(source);
- }
- }, {
- key: 'enable',
- value: function enable() {
- if (oldIOS) {
- this.disable();
- console.warn('\n NoSleep enabled for older iOS devices. This can interrupt\n active or long-running network requests from completing successfully.\n See https://github.com/richtr/NoSleep.js/issues/15 for more details.\n ');
- this.noSleepTimer = window.setInterval(function () {
- if (!document.hidden) {
- window.location.href = window.location.href.split('#')[0];
- window.setTimeout(window.stop, 0);
- }
- }, 15000);
- } else {
- this.noSleepVideo.play();
- }
- }
- }, {
- key: 'disable',
- value: function disable() {
- if (oldIOS) {
- if (this.noSleepTimer) {
- console.warn('\n NoSleep now disabled for older iOS devices.\n ');
- window.clearInterval(this.noSleepTimer);
- this.noSleepTimer = null;
- }
- } else {
- this.noSleepVideo.pause();
- }
- }
- }]);
-
- return NoSleep;
- }();
-
- ;
-
- module.exports = NoSleep;
-
-/***/ }),
-/* 1 */
-/***/ (function(module, exports, __webpack_require__) {
-
- "use strict";
-
-
- module.exports = {
- webm: 'data:video/webm;base64,GkXfo0AgQoaBAUL3gQFC8oEEQvOBCEKCQAR3ZWJtQoeBAkKFgQIYU4BnQI0VSalmQCgq17FAAw9CQE2AQAZ3aGFtbXlXQUAGd2hhbW15RIlACECPQAAAAAAAFlSua0AxrkAu14EBY8WBAZyBACK1nEADdW5khkAFVl9WUDglhohAA1ZQOIOBAeBABrCBCLqBCB9DtnVAIueBAKNAHIEAAIAwAQCdASoIAAgAAUAmJaQAA3AA/vz0AAA=',
- mp4: 'data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA='
- };
-
-/***/ })
-/******/ ]);
- });
diff --git a/OLDdata/site/other/life/life.js b/OLDdata/site/other/life/life.js
deleted file mode 100644
index 8810ca5c..00000000
--- a/OLDdata/site/other/life/life.js
+++ /dev/null
@@ -1,362 +0,0 @@
-//============================================//
-// Card Conjurer, by Kyle Burton //
-//============================================//
-console.log("1.1")
-//define variables
-var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = false, playerList = [], rowHeight = 0, columnWidth = 0, rowCount = 0, isFullscreen = true, mouseClickId = 0, noSleep = new NoSleep(), canEnableNoSleep = false
-//Setup the enabler for no sleep
-document.addEventListener("click", enableNoSleep, false);
-function enableNoSleep() {
- if (canEnableNoSleep) {
- document.removeEventListener("click", enableNoSleep, false);
- noSleep.enable();
- }
-}
-//This function sets everything up
-function fullscreen() {
- //Full screen!
- grid = document.getElementById("gridShell")
- if (grid.requestFullscreen) {
- grid.requestFullscreen()
- } else if (grid.mozRequestFullScreen) {
- grid.mozRequestFullScreen()
- } else if (grid.webkitRequestFullscreen) {
- grid.webkitRequestFullscreen()
- } else if (grid.msRequestFullscreen) {
- grid.msRequestFullscreen()
- } else {
- isFullscreen = false
- document.getElementById("return").classList.add("permaHidden")
- document.getElementById("gridShell").classList.add("fullscreenUnavailable")
- }
-}
-function startGame() {
- canEnableNoSleep = document.getElementById("inputWakeLock").checked
- fullscreen()
- document.getElementById("return").classList.remove("hidden")
- //hide the settings and grab player count and starting life total
- document.getElementById("settings").classList.add("hidden")
- playerCount = parseInt(document.getElementById("inputPlayerCount").value)
- startingLifeTotal = parseInt(document.getElementById("inputStartingLife").value)
- //determine the layout based on player count
- if (playerCount % 2 == 0) {
- if (playerCount >= 6) {
- firstPlayerWide = true
- lastPlayerWide = true
- }
- } else {
- lastPlayerWide = true
- }
- //Make all the player boxes
- for (var i = 1; i <= playerCount; i ++) {
- //determine if the current box is rotated or widened
- var rotation, wide = false
- var orientationIndexAdjust = 0
- if (firstPlayerWide) {
- orientationIndexAdjust += 1
- }
- if (i == 1 && firstPlayerWide) {
- rotation = 180
- } else if (i == playerCount && lastPlayerWide) {
- rotation = 0
- } else if ((i + orientationIndexAdjust) % 2 == 0) {
- rotation = 270
- } else {
- rotation = 90
- }
- if ((i == 1 && firstPlayerWide) || (i == playerCount && lastPlayerWide)) {wide = true}
- playerList[i - 1] = new playerBox(i, rotation, wide)
- document.getElementById("inputPlayer").innerHTML += ""
- }
- //Determine the grid size
- if (isFullscreen) {
- columnWidth = screen.width / 2 - 2
- } else {
- columnWidth = window.innerWidth / 2 - 2
- }
- rowCount = (playerCount - playerCount % 2) / 2 + 1
- if (playerCount == 2 || playerCount == 4) {
- rowCount -= 1
- }
-// console.log("Row count: " + rowCount)
- if (isFullscreen) {
- rowHeight = screen.height / rowCount - 2
-// console.log("Full screen, rowHeight: " + rowHeight)
-// console.log("screen.height: " + screen.height)
- } else {
- var heightToUse = window.innerHeight
- if (document.documentElement.clientHeight > heightToUse) {
-// console.log("document.documentElement.clientHeight: " + document.documentElement.clientHeight)
- heightToUse = document.documentElement.clientHeight
- }
- rowHeight = heightToUse / rowCount - 2
-// console.log("Not full screen, rowHeight: " + rowHeight)
-// console.log("window.innerHeight: " + window.innerHeight)
- }
- //Now that all the player boxes are made, they must be configured
- for (var i = 1; i <= playerCount; i++) {
- configurePlayerBox(i)
- }
- drawAllPlayerBoxes()
-}
-function playerBox(playerBoxID, canvasRotation, wide) {
- //Actually needed vars
- this.id = playerBoxID
- this.rotation = canvasRotation
- this.life = startingLifeTotal
- this.canvas = document.createElement("canvas")
- this.direction = 0
- this.holdTime = 0
- this.touchId = 0.5
- this.color = "#222222"
- this.textColor = "#ffffff"
- this.image = new Image()
- this.image.customVarID = playerBoxID
- this.image.onload = function() {drawPlayerBox(this.customVarID)}
- //vars to make navigation easier
- this.canvas.customVarID = playerBoxID
- this.canvas.customVarContext = this.canvas.getContext("2d")
- this.canvas.customVarContext.customVarCanvas = this.canvas
- //css classes
- this.canvas.classList.add("playerBox")
- if (wide) {
- this.canvas.classList.add("widePlayerBox")
- }
- //add it to the html
- document.getElementById("mainGrid").appendChild(this.canvas)
-}
-function configurePlayerBox(playerBoxID) {
- //All of this configures the size/shape/orientation of the player boxes
- var currentPlayer = playerList[playerBoxID - 1]
- var context = currentPlayer.canvas.customVarContext
- currentPlayer.canvas.width = columnWidth
- if (playerList[playerBoxID - 1].canvas.classList.contains("widePlayerBox")) {
- currentPlayer.canvas.width = columnWidth * 2 + 2
- }
- currentPlayer.canvas.height = rowHeight
- context.translate(currentPlayer.canvas.width / 2, currentPlayer.canvas.height / 2)
- context.rotate(Math.PI / 180 * currentPlayer.rotation)
-}
-
-function resetLife() {
- for (var i = 1; i <= playerCount; i++) {
- playerList[i - 1].life = startingLifeTotal
- }
- document.getElementById('menu').classList.add('hidden')
- drawAllPlayerBoxes()
-}
-function updateColorSelector() {
- document.getElementById("inputPlayerColor").value = playerList[parseInt(document.getElementById("inputPlayer").value) - 1].color
- document.getElementById("inputTextColor").value = playerList[parseInt(document.getElementById("inputPlayer").value) - 1].textColor
-}
-function updateBackgroundColor(color) {
- playerList[parseInt(document.getElementById("inputPlayer").value) - 1].color = color
- drawPlayerBox(parseInt(document.getElementById("inputPlayer").value))
-}
-function updateTextColor(color) {
- playerList[parseInt(document.getElementById("inputPlayer").value) - 1].textColor = color
- drawPlayerBox(parseInt(document.getElementById("inputPlayer").value))
-}
-function loadImage(event, destination) {
- var input = event.target
- var reader = new FileReader()
- reader.onload = function() {
- var dataURL = reader.result
- destination.src = dataURL
- }
- reader.readAsDataURL(input.files[0])
-}
-var savedArtList = [], cardArtUrlList = [], cardArtArtistList = []
-function inputCardArtName(cardArtNameInput) {
- var xhttp = new XMLHttpRequest()
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- savedArtList = this.responseText.split('"art_crop":"')
- savedArtList.splice(0, 1)
- document.getElementById("inputCardArtNameNumber").max = savedArtList.length
- document.getElementById("inputCardArtNameNumber").value = 1
- for (i = 0; i < savedArtList.length; i ++) {
- cardArtUrlList[i] = savedArtList[i].split('","border_crop":')[0]
- }
- for (i = 0; i < savedArtList.length; i ++) {
- cardArtArtistList[i] = savedArtList[i].slice(savedArtList[i].indexOf('"artist":"') + 10, savedArtList[i].indexOf('","border_color":'))
- }
- inputCardArtNameNumber(1)
- }
- }
- xhttp.open("GET", "https://api.scryfall.com/cards/search?order=released&unique=art&q=name%3D" + cardArtNameInput.replace(/ /g, "_"), true)
- xhttp.send()
-}
-function inputCardArtNameNumber(cardArtNameNumberInput) {
- playerList[parseInt(document.getElementById('inputPlayer').value) - 1].image.src = cardArtUrlList[cardArtNameNumberInput - 1]
-}
-document.getElementById("mainGrid").addEventListener("touchmove", function(event) {
- event.preventDefault()
-}, false)
-function rollRNG() {
- document.getElementById("rngOutput").innerHTML = Math.floor(Math.random() * (parseInt(document.getElementById("inputRNGMax").value) - parseInt(document.getElementById("inputRNGMin").value) + 1) + parseInt(document.getElementById("inputRNGMin").value))
-}
-function drawPlayerBox(playerBoxID) {
- var currentPlayerBox = playerList[playerBoxID - 1]
- var context = currentPlayerBox.canvas.customVarContext
- context.textBaseline = "middle"
- var tempFontSize = 100
- context.font = "100pt belerenbsc"
- context.fillStyle = currentPlayerBox.color
- var tempCanvasHeight = currentPlayerBox.canvas.height, tempCanvasWidth = currentPlayerBox.canvas.width
- if (playerList[playerBoxID - 1].rotation == 90 || playerList[playerBoxID - 1].rotation == 270) {
- tempCanvasHeight = tempCanvasWidth
- tempCanvasWidth = currentPlayerBox.canvas.height
- }
- context.fillRect(tempCanvasWidth / -2, tempCanvasHeight / -2, tempCanvasWidth, tempCanvasHeight)
- if (currentPlayerBox.image.src != "") {
- var imageToDraw = currentPlayerBox.image
- if (imageToDraw.width / imageToDraw.height > tempCanvasWidth / tempCanvasHeight) {
- //The image is wider and should be fitted to its height
- context.drawImage(imageToDraw, tempCanvasHeight / imageToDraw.height * imageToDraw.width / -2, tempCanvasHeight / -2, tempCanvasHeight / imageToDraw.height * imageToDraw.width, tempCanvasHeight)
- } else {
- //The image is taller and should be fitted to its width
- context.drawImage(imageToDraw, tempCanvasWidth / -2, tempCanvasWidth / imageToDraw.width * imageToDraw.height / -2, tempCanvasWidth, tempCanvasWidth / imageToDraw.width * imageToDraw.height)
- }
- }
- if (currentPlayerBox.life < 1) {
- context.fillStyle = "#0008"
- context.fillRect(tempCanvasWidth / -2, tempCanvasHeight / -2, tempCanvasWidth, tempCanvasHeight)
- context.fillStyle = "#800"
- } else {
- context.fillStyle = playerList[playerBoxID - 1].textColor
- }
- while (context.measureText(currentPlayerBox.life).width >= tempCanvasWidth) {
- tempFontSize -= 1
- context.font = tempFontSize + "pt belerenbsc"
- }
- var horizontalShift = -1 * parseInt(context.measureText(currentPlayerBox.life).width) / 2
- context.strokeStyle = "black"
- context.lineWidth = 5
- context.strokeText(currentPlayerBox.life, horizontalShift, 0)
- context.fillText(currentPlayerBox.life, horizontalShift, 0)
-}
-function drawAllPlayerBoxes() {
- for (var i = 1; i <= playerList.length; i ++) {
- drawPlayerBox(i)
- }
-}
-//Event Listener magic! (always records mouse/touch positions so the loop can work without events)
-var touchX = [], touchY = []
-document.getElementById("mainGrid").addEventListener("mousedown", startMouseCoordinates, true)
-window.addEventListener("mousemove", updateMouseCoordinates, true)
-window.addEventListener("mouseup", endMouseCoordinates, true)
-function startMouseCoordinates() {
- mouseClickId += 1
- playerList[event.target.customVarID - 1].touchId = mouseClickId
- singleTap(event.target)
-}
-function updateMouseCoordinates() {
- touchX[0] = event.clientX
- touchY[0] = event.clientY}
-function endMouseCoordinates() {
- for (var i = 1; i <= playerList.length; i++) {
- playerList[i - 1].touchId = 0.5
- }
-}
-window.addEventListener("touchstart", switchToTouchEvents, true)
-function switchToTouchEvents() {
- window.removeEventListener("touchstart", switchToTouchEvents, true)
- document.getElementById("mainGrid").removeEventListener("mousedown", startMouseCoordinates, true)
- window.removeEventListener("mousemove", updateMouseCoordinates, true)
- window.removeEventListener("mouseup", endMouseCoordinates, true)
- document.getElementById("mainGrid").addEventListener("touchstart", startTouch, true)
- window.addEventListener("touchmove", moveTouch, true)
- window.addEventListener("touchend", endTouch, true)
-}
-function startTouch() {
- playerList[event.changedTouches[0].target.customVarID - 1].touchId = event.changedTouches[0].identifier
- moveTouch()
- singleTap(event.changedTouches[0].target)
-}
-function moveTouch() {
- touchX = [], touchY = []
- for (var i = 0; i < event.touches.length; i ++) {
- touchX[i] = event.touches[i].clientX
- touchY[i] = event.touches[i].clientY
- }
-}
-function endTouch() {
- for (var i = 1; i <= playerList.length; i++) {
- if (playerList[i - 1].touchId == event.changedTouches[0].identifier) {
- playerList[i - 1].touchId = 0.5
- }
- }
- moveTouch()
-}
-//Tap (and click) functions
-function singleTap(targetPlayerBox) {
-// console.log("Box #" + targetPlayerBox.customVarID + " was pressed")
- var playerBoxBounds = targetPlayerBox.getBoundingClientRect()
-// console.log("Bounds:")
-// console.log(playerBoxBounds)
- var tappedPlayerBox = playerList[targetPlayerBox.customVarID - 1]
- var lifeAdjust = 0
-// console.log("Rotation: " + tappedPlayerBox.rotation)
-// console.log("touchX: " + touchX[touchX.length - 1] + "\ntouchY: " + touchY[touchY.length - 1])
- if (tappedPlayerBox.rotation == 0 || tappedPlayerBox.rotation == 180) {
-// console.log(touchX[touchX.length - 1])
-// console.log(playerBoxBounds.width / 2 + playerBoxBounds.left)
- if (touchX[touchX.length - 1] > playerBoxBounds.width / 2 + playerBoxBounds.left) {
- lifeAdjust = 1
- } else {
- lifeAdjust = -1
- }
- } else {
-// console.log(touchY[touchY.length - 1])
-// console.log(playerBoxBounds.height / 2 + playerBoxBounds.top)
- if (touchY[touchY.length - 1] > playerBoxBounds.height / 2 + playerBoxBounds.top) {
- lifeAdjust = 1
- } else {
- lifeAdjust = -1
- }
- }
- if (tappedPlayerBox.rotation == 180 || tappedPlayerBox.rotation == 270) {
- lifeAdjust *= -1
- }
-// console.log(lifeAdjust)
- tappedPlayerBox.direction = lifeAdjust
- tappedPlayerBox.life += lifeAdjust
- drawPlayerBox(tappedPlayerBox.id)
- setTimeout(clockCheck.bind(null, tappedPlayerBox, tappedPlayerBox.touchId), 500)
-}
-function clockCheck(tappedPlayerBox, lastTapID) {
- if (tappedPlayerBox.touchId == lastTapID) {
- tappedPlayerBox.life += tappedPlayerBox.direction
- drawPlayerBox(tappedPlayerBox.id)
- if (tappedPlayerBox.holdTime >= 150) {
- setTimeout(clockCheck.bind(null, tappedPlayerBox, tappedPlayerBox.touchId), 10)
- } else if (tappedPlayerBox.holdTime >= 50) {
- setTimeout(clockCheck.bind(null, tappedPlayerBox, tappedPlayerBox.touchId), 50)
- } else {
- setTimeout(clockCheck.bind(null, tappedPlayerBox, tappedPlayerBox.touchId), 100)
- }
- tappedPlayerBox.holdTime += 1
- } else {
- tappedPlayerBox.holdTime = 0
- }
-}
-//Hopefully stops the pesky double-tap zoom:
-var doubleTouchStartTimestamp = 0
-document.getElementById("mainGrid").addEventListener("touchstart", function() {
- var now = +(new Date())
- if (doubleTouchStartTimestamp + 500 > now){
- event.preventDefault()
- }
- doubleTouchStartTimestamp = now
-})
-//Updated :D
-
-var inputsToRemoveAutocorrect = document.querySelectorAll("input");
-
-inputsToRemoveAutocorrect.forEach(input => {
- input.setAttribute("autocomplete", "off")
- input.setAttribute("autocorrect", "off")
- input.setAttribute("autocapitalize", "off")
- input.setAttribute("spellcheck", false)
- })
diff --git a/OLDdata/site/other/life/menuButton.png b/OLDdata/site/other/life/menuButton.png
deleted file mode 100644
index 012267b9..00000000
Binary files a/OLDdata/site/other/life/menuButton.png and /dev/null differ
diff --git a/OLDdata/site/other/life/menuExitButton.png b/OLDdata/site/other/life/menuExitButton.png
deleted file mode 100644
index 707a98c2..00000000
Binary files a/OLDdata/site/other/life/menuExitButton.png and /dev/null differ
diff --git a/OLDdata/site/other/setSymbol/setSymbol.js b/OLDdata/site/other/setSymbol/setSymbol.js
deleted file mode 100644
index 1f3a3040..00000000
--- a/OLDdata/site/other/setSymbol/setSymbol.js
+++ /dev/null
@@ -1,134 +0,0 @@
-var svg = document.getElementById('displaySVG');
-var svgWidth = 500, svgHeight = 500, setSymbolWidth = 300, setSymbolHeight = 300;
-var svgStroke = svg.children[1]
-var svgFill = svg.children[2]
-svg.setAttribute('width', svgWidth);
-svg.setAttribute('height', svgHeight);
-var imageType = 'svg';
-var canvas = document.getElementById('displayCanvas');
-canvas.width = svgWidth
-canvas.height = svgHeight
-var context = canvas.getContext('2d');
-var setSymbolImage = new Image();
-setSymbolImage.onload = drawSetSymbol;
-var setSymbolPath = '';
-fetchSVGData('https://raw.githubusercontent.com/andrewgioia/Keyrune/master/svg/rtr.svg');
-
-
-function fetchSVGData(url) {
- hideShow();
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && xhttp.status != 404) {
- imageType = 'svg'
- setSymbolPath = xhttp.responseText.split('d="')[1].split('">')[0];
- svgStroke.setAttribute('d', setSymbolPath);
- svgFill.setAttribute('d', setSymbolPath);
- var svgPathBoundingBox = svgStroke.getBBox();
- if (svgPathBoundingBox.width > svgPathBoundingBox.height) {
- scaleAmount = setSymbolWidth / svgPathBoundingBox.width;
- } else {
- scaleAmount = setSymbolHeight / svgPathBoundingBox.height;
- }
- svgStroke.setAttribute('transform', 'scale(' + scaleAmount + ') translate(' + parseFloat(((svgWidth - svgPathBoundingBox.width * scaleAmount)/2/scaleAmount)-svgPathBoundingBox.x) + ', ' + parseFloat(((svgHeight - svgPathBoundingBox.height * scaleAmount)/2/scaleAmount)-svgPathBoundingBox.y) + ')');
- svgFill.setAttribute('transform', 'scale(' + scaleAmount + ') translate(' + parseFloat(((svgWidth - svgPathBoundingBox.width * scaleAmount)/2/scaleAmount)-svgPathBoundingBox.x) + ', ' + parseFloat(((svgHeight - svgPathBoundingBox.height * scaleAmount)/2/scaleAmount)-svgPathBoundingBox.y) + ')');
- decorateSVG();
- }
- }
- xhttp.open('GET', url, true);
- xhttp.send();
-}
-
-function decorateSVG() {
- if (imageType == 'svg') {
- var setSymbolGradient = document.getElementById('inputSetSymbolRarity').value;
- var setSymbolStrokeColor = 'black';
- if (setSymbolGradient == 'Common') {
- setSymbolStrokeColor = 'white'
- }
- svgStroke.setAttribute('stroke', setSymbolStrokeColor)
- svgFill.setAttribute('fill', 'url(#grad' + setSymbolGradient + ')');
- } else {
- drawSetSymbol()
- }
-}
-
-function downloadSetSymbolImage(linkElement) {
- linkElement.download = 'setSymbol.' + imageType
- if (imageType == 'svg') {
- var serializer = new XMLSerializer();
- var source = serializer.serializeToString(svg);
-
- //add name spaces.
- if(!source.match(/^