[gimp-web/header-image] Try a fix for CSP vs. rotate-header-image



commit dc7399e1bb9c6481089bb7c75ee89bcf9b371e48
Author: Pat David <patdavid gmail com>
Date:   Mon Jan 16 15:08:20 2017 -0600

    Try a fix for CSP vs. rotate-header-image

 content/js/rotateHeaderImg.js |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/content/js/rotateHeaderImg.js b/content/js/rotateHeaderImg.js
index c8d3937..e2a0e16 100644
--- a/content/js/rotateHeaderImg.js
+++ b/content/js/rotateHeaderImg.js
@@ -53,15 +53,19 @@ 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?)
-    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 );
+    // .. 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 style = "linear-gradient(rgba(44,52,80,0.5), rgba(44,62,80,0.5)), url('"+ image.file +"')";
+    imgBanner.style.backgroundImage = style;
 }
 
 himage.src = image.file;


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