[gimp-web/header-image: 21/21] Try to speed up header image loading a little



commit f1ccb3795b0c950aedf2cb899fa88646e79ba6e2
Author: Pat David <patdavid gmail com>
Date:   Mon Jan 16 16:09:37 2017 -0600

    Try to speed up header image loading a little

 content/js/rotateHeaderImg.js             |   41 +++++++++++++++-------------
 themes/newgimp/static/css/home-header.css |    2 +-
 2 files changed, 23 insertions(+), 20 deletions(-)
---
diff --git a/content/js/rotateHeaderImg.js b/content/js/rotateHeaderImg.js
index 345125d..dc5a752 100644
--- a/content/js/rotateHeaderImg.js
+++ b/content/js/rotateHeaderImg.js
@@ -49,26 +49,29 @@ var image = imglist[ Math.floor( Math.random() * (imglist.length) )  ];
 
 var himage = new Image();
 
-himage.onload = function() {
-    // Loading the style as a node into the dom
-    // on the head element (CSP might bork if we do it to the 
-    // element directly as inline (even after load?)
-    // .. CSP _does_ bork, seeing this as an inline style, which is blocked.
-
-    //var css = "#banner {"
-    //css += "background-image: linear-gradient(rgba(44,52,80,0.5), rgba(44,62,80,0.5)), url('"+ image.file 
+"') !important;";
-    //css += "background-size: cover;";
-    //css += "background-position: 0;";
-    //css += "}";
-    //var style = document.createElement('style');
-    //style.type = 'text/css';
-    //style.appendChild( document.createTextNode( css ) );
-    //document.head.appendChild( style );
-    var tmpstyle = "linear-gradient(rgba(44,52,80,0.5), rgba(44,62,80,0.5)), url('"+ image.file +"')";
-    imgBanner.style.backgroundImage = tmpstyle;
-}
+//himage.onload = function() {
+//    // Loading the style as a node into the dom
+//    // on the head element (CSP might bork if we do it to the 
+//    // element directly as inline (even after load?)
+//    // .. CSP _does_ bork, seeing this as an inline style, which is blocked.
+//
+//    //var css = "#banner {"
+//    //css += "background-image: linear-gradient(rgba(44,52,80,0.5), rgba(44,62,80,0.5)), url('"+ 
image.file +"') !important;";
+//    //css += "background-size: cover;";
+//    //css += "background-position: 0;";
+//    //css += "}";
+//    //var style = document.createElement('style');
+//    //style.type = 'text/css';
+//    //style.appendChild( document.createTextNode( css ) );
+//    //document.head.appendChild( style );
+//    var tmpstyle = "linear-gradient(rgba(44,52,80,0.5), rgba(44,62,80,0.5)), url('"+ image.file +"')";
+//    imgBanner.style.backgroundImage = tmpstyle;
+//}
+//
+////himage.src = image.file;
 
-himage.src = image.file;
+var tmpstyle = "linear-gradient(rgba(44,52,80,0.5), rgba(44,62,80,0.5)), url('"+ image.file +"')";
+imgBanner.style.backgroundImage = tmpstyle;
 
 if( typeof( image.title ) !== undefined ){
     title.innerText = image.title;
diff --git a/themes/newgimp/static/css/home-header.css b/themes/newgimp/static/css/home-header.css
index 4f09b87..cfd95ea 100644
--- a/themes/newgimp/static/css/home-header.css
+++ b/themes/newgimp/static/css/home-header.css
@@ -1,3 +1,3 @@
 #banner {
-    background-image: linear-gradient(rgba(44,52,80,0.5), rgba(44,62,80,0.5)), 
url('/theme/images/Niagara_Rainbow.jpg');
+    background-image: linear-gradient(rgba(44,52,80,0.5), rgba(44,62,80,0.5)), 
url('/images/frontpage/headers/Niagara_Rainbow.jpg');
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]