From 4adaebc9a47c00419fb849041b934c9a293cbaeb Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 17 Oct 2019 10:43:04 +0000 Subject: [PATCH] wip #3148 @1 --- .../html5/master/class.ws.html5.compiler.php | 32 ++++++++++++------- .../html5/master/class.ws.html5.links.php | 25 +++++++++++++-- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 41cd9b025..c7fdb605a 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -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()) { diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 3e42d60b0..5a0122973 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -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; } -- 2.39.5