diff --git a/data/site/main.js b/data/site/main.js index cc192676..c4512b18 100644 --- a/data/site/main.js +++ b/data/site/main.js @@ -5,6 +5,7 @@ var cardWidth = 750, cardHeight = 1050 var version = {} var date = new Date() +var initiated = false document.getElementById("inputInfoNumber").value = date.getFullYear() //Make all the canvases and their contexts var mainCanvas = document.getElementById("mainCanvas") @@ -85,6 +86,7 @@ function init() { //Runs any tests. This should not do anything when published. setTimeout(testFunction, 100) checkCookies() + initiated = true } //Loads an image. Only actually loads images the first time each image is loaded, otherwise assigns it. function loadImage(index, target = "none") { @@ -245,6 +247,9 @@ function updateBottomInfoCanvas() { window[version.bottomInfoFunction]() } function updateCardCanvas() { + if (!initiated) { + return + } //clear it cardContext.fillStyle = "black" cardContext.fillRect(0, 0, cardWidth, cardHeight) @@ -316,7 +321,10 @@ function finishChangingVersion() { } } for (var i = 0; i < version.textList.length; i ++) { - document.getElementById("inputWhichText").innerHTML += "" + document.getElementById("inputWhichTextTabs").innerHTML += "
" + version.textList[i][0] + "
" + if (i == 0) { + document.getElementsByClassName("tabButton text")[0].classList.add("activeTab") + } } hideShowColors(true) loadOpacityValue() @@ -708,6 +716,31 @@ function checkCookies() { } +function tabFunction(event, section, target, specialFunction = "none") { + var tabButtons = document.getElementsByClassName("tabButton " + section) + for (var i = 0; i < tabButtons.length; i++) { + tabButtons[i].className = tabButtons[i].className.replace(" activeTab", "") + } + event.currentTarget.className += " activeTab" + if (specialFunction != "none") { + window[specialFunction](event, section, target) + } else { + var tabContents = document.getElementsByClassName("tabContent " + section) + for (var i = 0; i < tabContents.length; i++) { + tabContents[i].className = tabContents[i].className.replace(" displayed", "") + } + document.getElementById(target).className += " displayed" + } +} +function textTabFunction(event, section, target) { + 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] +} + /*To do list: watermarks diff --git a/data/site/styles.css b/data/site/styles.css index 53f29b37..b4ef9c0c 100644 --- a/data/site/styles.css +++ b/data/site/styles.css @@ -40,7 +40,8 @@ --shifting-color-1-light: #c8ff64; --light-color: #eee; --dark-color: #333; - --clear-light: #1111; + --clear-light: #0001; + --clear-dark: #0003; } footer { background-color: var(--dark-color); @@ -276,3 +277,39 @@ footer a:hover { grid-gap: 1em; } } + + +/*WIP*/ +.tab { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(6em, 1fr)); + grid-auto-rows: min-content; +/* align-items: center;*/ +} +.tabButton { + text-align: center; + background: var(--clear-light); + border: 1px solid var(--light-color); + font: 1.2em belerenbsc; + padding: 0.1em 0em; +} +.tabButton.activeTab { + background: var(--clear-dark); +} +.tabContent { + display: none; +} +.tabContent.displayed { + display: block; +} + + + + + + + + + + + diff --git a/index.html b/index.html index c593c7f9..a39d47dd 100644 --- a/index.html +++ b/index.html @@ -42,7 +42,9 @@
Text
-
Select the text you want to edit
+
+ Select the text you want to edit +
Edit the selected text
Enter the mana cost. Include spaces!