]> _ Git - cubeextranet.git/commitdiff
wip #1710 @0.25
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 13 Dec 2017 10:46:46 +0000 (10:46 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 13 Dec 2017 10:46:46 +0000 (10:46 +0000)
inc/ws/Util/html5/centerbook/class.ws.html5.compiler.php
inc/ws/Util/html5/centerbook/class.ws.html5.links.php

index e7924bca2fbc4a80e376adbb6a91d3d4384be04c..60aace958e9f9996cbe31f97ee5dd236b9346f86 100644 (file)
@@ -270,6 +270,13 @@ class wsHTML5Compiler {
                        $e[1] = mb_strtoupper($lang);
                }
                $lang = implode('_', $e);
+
+               $langsMap = ['fr' => 'fr_FR', 'en' => 'en_US'];
+
+               if (isset($langsMap[$lang])) {
+                       $lang = $langsMap[$lang];
+               }
+
                $this->beginBody[] = "<div id=\"fb-root\"></div>
 <script>(function(d, s, id) {
   var js, fjs = d.getElementsByTagName(s)[0];
@@ -416,11 +423,13 @@ class wsHTML5Compiler {
         * Duplicate paths are ignored.
         * @param $path
         */
-       public function addJs($path) {
+       public function addJs($path, $collection = null) {
 
+               if (null === $collection) {
                // If JS is external, it will be included via the pluginJs collection
                // Otherwise, it will be compiled into the main JS file
                $collection = (preg_match('#^https?://#i', $path) === 1) ? 'pluginJs' : 'jsFiles';
+               }
 
                if (!in_array($path, $this->$collection)) {
                        $this->{$collection}[] = $path;
@@ -553,9 +562,10 @@ class wsHTML5Compiler {
                        }
                }
 
-               $securitypolicywhitelist = implode(' ', array_unique($this->securityPolicyWhitelist));
-
-               $vars = array('titre', 'credits', 'statsfooter', 'ga', 'style', 'script', 'pagesContents', 'description', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'securitypolicywhitelist');
+               if ($this->phonegap) {
+                       $csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
+               }
+               $vars = array('titre', 'credits', 'statsfooter', 'ga', 'style', 'script', 'pagesContents', 'description', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp');
                foreach ($vars as $v) {
                        $html = str_replace('<!-- $' . $v . ' -->', $$v, $html);
                }
@@ -1391,6 +1401,15 @@ class wsHTML5Compiler {
 
                $lessVariables['menu-breakpoint'] = $menuBreakpoint;
                $lessVariables['menu-background'] = $menuColor->toCSS();
+               if ($this->theme->parametres->subSecondaryColor) {
+                       $lessVariables['menu-button-background'] = wsHTML5::colorToCSS($this->theme->parametres->subSecondaryColor);
+               } else {
+                       $lessVariables['menu-background-green'] = 'max(@max, min(255-45, green(@menu-background)))';
+                       $lessVariables['menu-background-red'] = 'max(@max, min(255-45, red(@menu-background)))';
+                       $lessVariables['menu-background-blue'] = 'max(@max, min(255-45, blue(@menu-background)))';
+                       $lessVariables['menu-button-background'] = 'overlay(rgb(@menu-background-red, @menu-background-green, @menu-background-blue), #c0c0c0)';
+               }
+
                $lessVariables['menu-text'] = $menuTextColor;
                $lessVariables['menu-field-background'] = wsHTML5::colorToCSS($this->theme->parametres->subFieldColor);
                $lessVariables['menu-field-text'] = wsHTML5::colorToCSS($this->theme->parametres->subTextFieldColor);
@@ -1398,11 +1417,6 @@ class wsHTML5Compiler {
                $lessVariables['menu-select-text'] = wsHTML5::colorToCSS($this->theme->parametres->subTextSelectColor);
                $lessVariables['icon-color'] = wsHTML5::colorToCSS($this->theme->parametres->couleurI);
 
-
-               $menuMultiply = $menuColor->multiply($menuColor);
-               $menuMultiply2 = $menuMultiply->multiply($menuColor);
-
-
                // Archives
                if ($this->book->parametres->externalArchivesBack) {
                        $this->vdir->copy($this->wdir . '/' . $this->book->parametres->externalArchivesBack, 'data/images/' . $this->book->parametres->externalArchivesBack);
index ab2fc24cfe3c4509185df876f5d6213e661cabf3..57650bc5cf8a974ae31c7cc3d9a9220f338d0566 100644 (file)
@@ -517,7 +517,7 @@ class internalLink extends normalLink {
 
 class videoLink extends wsHTML5Link {
        public static function addVideoJS($compiler) {
-               $compiler->addJs('js/libs/videojs/video.min.js');
+               $compiler->addJs('js/libs/videojs/video.withscalefix.js');
                $compiler->addLess('videojs/videojs');
        }
 
@@ -1262,6 +1262,7 @@ class zoomLink extends normalLink {
        public function generateImage() {
 
                $maxzoom = ((int)$this->to !== 0) ? $this->to : 2; // Max zoom level might not always be set in the link editor
+               $maxzoom = min($maxzoom, 4.166666667);
 
                // TODO: Consider generating higher-res images (eg. 2x) for HiDPI screens. Maybe some extra optimisations can be done on the larger images...