]> _ Git - fluidbook-html5.git/commitdiff
wip #3577 @0:10
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 8 Apr 2020 17:00:25 +0000 (19:00 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 8 Apr 2020 17:00:25 +0000 (19:00 +0200)
js/libs/fluidbook/fluidbook.widget.js

index 3c1a588682d9fb0b753fd41405385c856f1388ff..ebb007a5ae8598bb85e95f197a24c8a1a4484188 100644 (file)
@@ -11,6 +11,13 @@ FluidbookWidget.prototype = {
         if ($_GET['widget'] != '1') {
             return;
         }
+        this.background = false;
+        if ($_GET.hasOwnProperty('background')) {
+            this.background = $_GET['background'];
+            if (this.background !== 'transparent' && this.background.indexOf('rgb') !== 0 && this.background.indexOf('#') !== 0) {
+                this.background = '#' + this.background;
+            }
+        }
         this.action = $_GET.hasOwnProperty('action') ? $_GET['action'] : 'fullscreen';
         this.enabled = true;
         var $this = this;
@@ -50,15 +57,14 @@ FluidbookWidget.prototype = {
     },
 
     enable: function () {
-        console.log('enable widget mode');
+
         $("body").addClass('widget');
-        if ($_GET['background'] !== undefined) {
-            $("#background,#splash").attr('style', 'background-color: ' + $_GET['background'] + ' !important;background-image:none !important');
+        if (this.background !== false) {
+            $("#background,#splash").attr('style', 'background-color: ' + this.background + ' !important;background-image:none !important');
         }
     },
 
     disable: function () {
-        console.log('disable widget mode');
         $("body").removeClass('widget');
         $("#background,#splash").attr('style', '');
     },