diff --git a/homepage/cookies.js b/homepage/cookies.js new file mode 100644 index 0000000..ec3df8e --- /dev/null +++ b/homepage/cookies.js @@ -0,0 +1,25 @@ +/* + these code snippets stolen from + https://www.w3schools.com/js/js_cookies.asp +*/ + +window.setCookie = function(cname, cvalue, exdays) { + var d = new Date(); + d.setTime(d.getTime() + (exdays*24*60*60*1000)); + var expires = "expires="+ d.toUTCString(); + document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; +}; + +window.getCookie = function(cname) { + var name = cname + "="; + var decodedCookie = decodeURIComponent(document.cookie); + var ca = decodedCookie.split(';'); + for(var i = 0; i + + + + +

Hi, I'm Deven Blake. I'm just your normal everyday nerd.

diff --git a/homepage/quotes.js b/homepage/quotes.js new file mode 100644 index 0000000..1d84ed4 --- /dev/null +++ b/homepage/quotes.js @@ -0,0 +1,35 @@ +window.initializequotes = function() { + window.quotes = [ + [ "Yeah, that's just how it is. Just, nothing. So much nothing that it hurts.", + "danger/u/ aefd79" ], + [ "Reason has always existed, but not always in a reasonable form.", + "Katy Perry" ], + [ "Consult your pineal gland.", + "Eris" ], + [ "Back to 8chan please", + "Skyglider" ], + [ "No, I am your father.", + "Darth Vader" ], + [ "A checklist can aid here.", + "Lance Leventhal" ], + [ "Special thanks to Ками for their help adding quotes to this page.", + "Deven Blake" ] + ]; + window.quote = ["", ""] +} + +window.setStyling = function(sheet) { + document.getElementById('styling').setAttribute('href', sheet); + return sheet; +}; + +window.genQuote = function() { + if(window.quote != ["",""]) window.quotes.push(window.quote); + quoteindex = Math.floor(Math.random() * window.quotes.length); + window.quote = window.quotes.splice(quoteindex, 1); + console.log("Quote set to:"); + console.log(window.quote); + document.getElementById('quote').textContent = '\"' + window.quote[0] + '\"'; + document.getElementById('quoteauthor').textContent = '~ ' + window.quote[1]; + document.getElementById('getaquote').setAttribute('value', 'Get another free quote today!'); +} diff --git a/homepage/sheets.js b/homepage/sheets.js new file mode 100644 index 0000000..17148a1 --- /dev/null +++ b/homepage/sheets.js @@ -0,0 +1,11 @@ +// Depends on cookies.js + +window.setStyling = function(sheet) { + document.getElementById('styling').setAttribute('href', sheet); + return sheet; +}; + +window.initializesheets = function() { + var sheet = window.getCookie('sheet'); + if(sheet != '') window.setStyling(sheet); +};