]> _ Git - cubeextranet.git/commitdiff
done #2654 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 28 May 2019 12:30:31 +0000 (12:30 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 28 May 2019 12:30:31 +0000 (12:30 +0000)
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php
inc/ws/Util/html5/mobilefirst/class.ws.html5.links.php

index 5fd212c26daa249e8cc81452f6df0c8961c7fd92..94dda2e57feb5b4d7f1796f039931fe574091d77 100644 (file)
@@ -38,6 +38,7 @@ class wsHTML5Compiler
         'tweenmax' =>
             ['js/libs/gsap/TweenMax.min.js',
                 'js/libs/gsap/jquery.gsap.min.js',
+                'js/libs/gsap/plugins/ScrollToPlugin.min.js',
                 'js/libs/threejs/Tweenmax.threejs.js',],
         'hammer' => ['js/libs/hammer.min.js',],
         'gal' =>
@@ -90,7 +91,11 @@ class wsHTML5Compiler
                 'js/libs/fluidbook/fluidbook.print.js',
                 'js/libs/fluidbook/fluidbook.secure.js',
                 'js/libs/fluidbook/fluidbook.js',
-                'js/main.js']
+                'js/main.js'],
+        'mobilefirst' => [
+            'js/libs/fluidbook/fluidbook.mobilefirst.js',
+            'js/libs/fluidbook/mobilefirst/fluidbook.mobilefirst.slider.js',
+        ],
     ];
 
     public $specialJsFiles = array();
@@ -290,10 +295,21 @@ class wsHTML5Compiler
         }
         $this->numerotation = explode(',', $this->book->numerotation);
 
+        if ($this->book->parametres->mobileNavigationType === 'mobilefirst') {
+            $this->initMobileFirst();
+        } else {
+
+        }
+
         $this->initConfig();
         $this->log('Defined dimensions');
     }
 
+    public function initMobileFirst()
+    {
+        $this->theme->parametres->usePageEdges = false;
+    }
+
     public function initConfig()
     {
         $this->config = cubeObject::merge($this->book->parametres->toStandardObject(), $this->theme->parametres->toStandardObject());
@@ -1394,14 +1410,19 @@ class wsHTML5Compiler
             $finals['widget'] = $this->widgetJsFiles;
         }
 
+        $dirminimized = $this->assets . '/js/min/';
+        if (!file_exists($dirminimized)) {
+            mkdir($dirminimized, 0777, true);
+        }
+
         foreach ($finals as $jsfinal => $files) {
             $mintime = 0;
             $hash = hash('sha256', json_encode($files));
-            $minimized = $this->assets . '/js/min/' . $jsfinal . '-' . $hash . '-min.js';
+            $minimized = $dirminimized . $jsfinal . '-' . $hash . '-min.js';
             if (!file_exists(dirname($minimized))) {
                 mkdir(dirname($minimized));
             }
-            if (file_exists($minimized)) {
+            if (file_exists($minimized) && filesize($minimized) > 0) {
                 $mintime = filemtime($minimized);
                 $reminimize = false;
             } else {
@@ -1568,6 +1589,7 @@ class wsHTML5Compiler
         }
 
         $rasterizePages = $this->config->rasterizePages;
+        $this->config->pagesDimensions = [];
 
         $thumbs = array();
         foreach ($this->pages as $page => $infos) {
@@ -1591,6 +1613,10 @@ class wsHTML5Compiler
                         }
                         $doc->makeHTML5Files($infos['document_page']);
                     }
+                    if ($r == 150 && file_exists($source)) {
+                        $d = getimagesize($source);
+                        $this->config->pagesDimensions[$page] = array($this->cssWidth, $d[1] * ($this->cssWidth / $d[0]));
+                    }
                     $ok = $this->vdir->copy($source, 'data/background/' . $r . '/' . $backgroundsPrefix . $page . '.jpg');
                     if (!$ok && $r = 300) {
                         $this->maxRes = 150;
@@ -1726,6 +1752,7 @@ class wsHTML5Compiler
         $lessContents = '';
 
         $lessVariables = array();
+        $lessVariables['css-scale'] = $this->cssScale;
         $lessVariables['slider-display'] = $this->_lessBoolean($this->theme->parametres->pagesBar);
         $lessVariables['slider-thumb-background'] = wsHTML5::colorToCSS($this->theme->parametres->pageBarThumbBack);
 
@@ -1762,22 +1789,6 @@ class wsHTML5Compiler
         $lessVariables['shadow-opacity'] = wsHTML5::colorToArray($this->theme->parametres->bookShadeColor)['opacity'] * 1.2;
         $lessVariables['edges-display'] = $this->_lessBoolean($this->theme->parametres->usePageEdges);
 
-        $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.doublePage._3d{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}';
-        $res[] = '.doublePage,#pages,#links,#searchHighlights{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}';
-        $res[] = '.landscape .doublePage._2d.axis_x.next{' . wsHTML5::writeCSSUA('transform', 'translate3d(' . $w2 . ',0,0)') . '}';
-        $res[] = '.landscape .doublePage._2d.axis_x.prev{' . wsHTML5::writeCSSUA('transform', 'translate3d(-' . $w2 . ',0,0)') . '}';
-        $res[] = '.portrait .doublePage._2d.axis_x.next{' . wsHTML5::writeCSSUA('transform', 'translate3d(' . $w . ',0,0)') . '}';
-        $res[] = '.portrait .doublePage._2d.axis_x.prev{' . wsHTML5::writeCSSUA('transform', 'translate3d(-' . $w . ',0,0)') . '}';
-        $res[] = '.doublePage._2d.axis_y.next{' . wsHTML5::writeCSSUA('transform', 'translate3d(0,' . $h . ',0)') . '}';
-        $res[] = '.doublePage._2d.axis_y.prev{' . wsHTML5::writeCSSUA('transform', 'translate3d(0,-' . $h . ',0)') . '}';
-
-
-        $left = $w;
-
-        $res[] = '.doublePage._3d{left:' . $left . ';}';
-        $res[] = '#links.right{left:-' . $left . ';}';
-        $res[] = '.landscape .page.right{left:' . $left . '}';
-
         $lessVariables['page-number-color'] = wsHTML5::colorToCSS($this->theme->parametres->colorPageNumber);
         $lessVariables['display-page-number'] = $this->_lessBoolean($this->theme->parametres->displayPageNumber);
         $lessVariables['page-transition-duration'] = $this->book->parametres->mobileTransitionDuration . 's';
index 76e4b31a4f77abd3736595f090b7947619d49fd2..1265fb4943733fc18525c64957b4342fb00f9515 100644 (file)
@@ -347,7 +347,7 @@ class wsHTML5Link
 
     public function getCSSContainer()
     {
-        if (!($this instanceof contentLink) && intval($this->page) % 2 == 1) {
+        if (!($this instanceof contentLink) && intval($this->page) % 2 == 1 && $this->compiler->book->parametres->mobileNavigationType != 'mobilefirst') {
             $this->page--;
             $this->left += $this->compiler->width;
         }
@@ -1320,7 +1320,7 @@ class htmlMultimediaLink extends wsHTML5Link
 
     public function getCSSContainer()
     {
-        if (!($this instanceof contentLink) && $this->page % 2 == 1) {
+        if (!($this instanceof contentLink) && $this->page % 2 == 1 && $this->compiler->book->parametres->mobileNavigationType != 'mobilefirst') {
             $this->page--;
             $this->left += $this->compiler->width;
         }
@@ -1576,7 +1576,7 @@ class inpesPopinLink extends htmlMultimediaLink
 
     public function getCSSContainer()
     {
-        if (!($this instanceof contentLink) && $this->page % 2 == 1) {
+        if (!($this instanceof contentLink) && $this->page % 2 == 1 && $this->compiler->book->parametres->mobileNavigationType != 'mobilefirst') {
             $this->page--;
             $this->left += $this->compiler->width;
         }
index 0174cdcea817fd2a1338e8dfff7331a574172688..1265fb4943733fc18525c64957b4342fb00f9515 100644 (file)
@@ -413,7 +413,7 @@ class normalLink extends wsHTML5Link
         }
         $t = $this->getTooltip();
         if ($t !== false) {
-            $attrs .= ' data-tooltip="' . $t . '"';
+            $attrs .= ' data-tooltip="' . htmlentities($t, ENT_QUOTES) . '"';
         }
         if (isset($this->extra->blinkdelay)) {
             $attrs .= ' data-blinkdelay="' . intval($this->extra->blinkdelay) . '"';