diff --git a/index.html b/index.html index e3a02cd..59a3250 100644 --- a/index.html +++ b/index.html @@ -4,19 +4,20 @@ Comfitu.re - Sweet and Cozy - - + +
+
   ___            __ _ _
  / __|___ _ __  / _(_) |_ _  _   _ _ ___
-| (__/ _ \ '  \|  _| |  _| || |_| '_/ -_)   v1.2.1
+| (__/ _ \ '  \|  _| |  _| || |_| '_/ -_)   v1.2.2
  \___\___/_|_|_|_| |_|\__|\_,_(_)_| \___|   by Fristi IN A CAN.
             
Home @@ -180,6 +181,12 @@

Changelog

+

+ 1.2.2 Patch:
+ - Cleaned up javascript code
+ - Fixed issue with doubly loading wallpaper
+ - Added version query string to css and javascript urls to prevent cache issues +

1.2.1 Patch:
- Set a default background image for the no-javascript crowd
diff --git a/script.js b/script.js index f85a504..1c428e8 100644 --- a/script.js +++ b/script.js @@ -1,9 +1,5 @@ -console.debug('load'); - (function (){ - - console.debug('anonymous'); - + var comfiture = {}; var activeLink; var activeContent; var wallpapers = [ @@ -15,6 +11,13 @@ console.debug('load'); '9.png', ]; + //Function to set the wallpaper + comfiture.setupWallpaper = function () { + let wallpaper = wallpapers[Math.floor(Math.random() * wallpapers.length)]; + document.querySelector('.background').style.backgroundImage = 'url("backgrounds/'+wallpaper+'")'; + }; + + //Onload window.addEventListener('load', function(){ //Hide all content let contents = document.querySelectorAll('.content'); @@ -27,10 +30,6 @@ console.debug('load'); if(!hash) hash = '#home'; switchActiveContent(hash); - //Set random wallpaper - let wallpaper = wallpapers[Math.floor(Math.random() * wallpapers.length)]; - document.querySelector('.background').style.backgroundImage = 'url("backgrounds/'+wallpaper+'")'; - //Add click event handlers for header/footer links window.addEventListener("click", event => { var elements = document.querySelectorAll('header a, footer a'); @@ -62,4 +61,7 @@ console.debug('load'); } } + //Expose comfiture object to document + window.comfiture = comfiture; + })(); \ No newline at end of file