]> _ Git - cubeextranet.git/commitdiff
wip #3148 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 17 Oct 2019 10:43:04 +0000 (10:43 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 17 Oct 2019 10:43:04 +0000 (10:43 +0000)
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index 41cd9b025c3655f75e578039860dc57ba0a647a6..c7fdb605acc5e3db3f01d3f9f32e398c17ab5af7 100644 (file)
@@ -1311,6 +1311,26 @@ class wsHTML5Compiler
                 continue;
             }
 
+            $linksToAdd = [$link];
+            if ($this->book_id == 18153) {
+                if ($link->overlapDoublePage()) {
+                    $linksToAdd[] = $link->getRightClone();
+                }
+            }
+
+            foreach ($linksToAdd as $lta) {
+                $c = $lta->getHTMLContainer();
+                $css[] = $lta->getCSSContainer();
+                if (!isset($pages[$lta->page])) {
+                    $pages[$lta->page] = '';
+                    $cpages[$lta->page] = '';
+                }
+                if ($lta instanceof contentLink) {
+                    $cpages[$lta->page] .= $c;
+                } else {
+                    $pages[$lta->page] .= $c;
+                }
+            }
             // Make old "aftersearch" link compatible with new "extra" menu option by extracting link URL
             if ($link->page == 'aftersearch') {
                 $this->config->afterSearchLink = $link->to;
@@ -1322,18 +1342,6 @@ class wsHTML5Compiler
             }
 
 
-            $c = $link->getHTMLContainer();
-            $css[] = $link->getCSSContainer();
-            if (!isset($pages[$link->page])) {
-                $pages[$link->page] = '';
-                $cpages[$link->page] = '';
-            }
-            if ($link instanceof contentLink) {
-                $cpages[$link->page] .= $c;
-            } else {
-                $pages[$link->page] .= $c;
-            }
-
             $allLinksData[$linkData['uid']] = $linkData;
 
             if ($link->keep()) {
index 3e42d60b06a7b0a357234bb4b797db43d41c43fa..5a01229734d752a9cad95e8c9684b030d852a890 100644 (file)
@@ -36,6 +36,7 @@ class wsHTML5Link
     public $scorm;
     public $hidden = false;
     public $zindex = 4;
+    public $rightClone = false;
     public $iframeType = "none";
 
     protected $_init;
@@ -259,6 +260,22 @@ class wsHTML5Link
         $this->init();
     }
 
+    public function overlapDoublePage()
+    {
+        return ($this->page % 2 == 0 && $this->left + $this->width > $this->compiler->width);
+    }
+
+    public function getRightClone()
+    {
+        $res = clone $this;
+        $res->page++;
+        $res->left -= $this->compiler->width;
+        $res->rightClone = true;
+        $res->id .= '_c';
+        $res->init();
+        return $res;
+    }
+
     public function init()
     {
 
@@ -271,7 +288,7 @@ class wsHTML5Link
 
     public function getTooltip()
     {
-        if (is_null($this->infobulle) || !$this->infobulle) {
+        if ($this->infobulle === null || !$this->infobulle) {
             if ($this->getDefaultTooltip() === false) {
                 return;
             }
@@ -288,9 +305,13 @@ class wsHTML5Link
     public function getHTMLContainerClass()
     {
         $res = trim('link ' . $this->class);
-        if (intval($this->page) % 2 == 1) {
+        if ((int)$this->page % 2 == 1) {
             $res .= ' odd';
         }
+        if ($this->rightClone) {
+            $res .= ' rightclone';
+        }
+
         return $res;
     }