From 4c9a3d20f6a98243b6271bf1a9db573c299389cf Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 16 Aug 2011 07:26:17 +0000 Subject: [PATCH] --- inc/ws/DAO/class.ws.dao.book.php | 2 +- inc/ws/Util/html5/class.ws.html5.compiler.php | 38 +++++++++++++------ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index bd80334f7..1aadb3f78 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -536,7 +536,7 @@ class wsDAOBook extends commonDAO { return false; } - $checks = array($r->changedate, filemtime(WS_COMPILE_ASSETS . '/_html5')); + $checks = array($r->changedate, cubeFiles::filemtimeRecursive(WS_COMPILE_ASSETS . '/_html5')); $reffile = WS_BOOKS . '/html5/' . $book_id; if (!file_exists($reffile)) { diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index abed44590..0b89cc366 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -4,7 +4,9 @@ class wsHTML5Compiler { protected static $resolutions = array(36, 72, 150); protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', ''); - protected static $jsFiles = array('js/libs/modernizr.js', + protected static $jsFiles = array( + 'js/libs/cube/fb.js', + 'js/libs/modernizr.js', 'js/libs/jquery/jquery.js', 'js/libs/jquery/jquery.transform.js', 'js/libs/jquery/jquery.mousewheel.js', @@ -47,6 +49,8 @@ class wsHTML5Compiler { protected $daoBook; protected $needToRecompileContents = true; protected $needToRecompileSettings = true; + protected $width; + protected $height; function __construct($book_id) { global $core; @@ -84,6 +88,13 @@ class wsHTML5Compiler { $this->scale = 4; $this->multiply = $this->pdf2htmlRatio * $this->scale; $this->numerotation = explode(',', $this->book->numerotation); + + $daoDoc = new wsDAODocument($core->con); + $firstDoc = $daoDoc->selectById($this->pages[1]['document_id']); + $size = $firstDoc->generalInfos['size']; + + $this->width = round($size[0],2); + $this->height = round($size[1],2); } public function virtualToPhysical($virtual) { @@ -276,8 +287,8 @@ class wsHTML5Compiler { } $config = $this->writeConfig(); - $js=$config.file_get_contents($minimized); - file_put_contents($this->vdir.'/data/datas.js',$config); + $js = $config . file_get_contents($minimized); + file_put_contents($this->vdir . '/data/datas.js', $config); file_put_contents($this->vdir . '/data/fluidbook.js', $js); } @@ -286,6 +297,8 @@ class wsHTML5Compiler { $config->numerotation = explode(',', $this->book->numerotation); $config->id = $this->book->book_id; $config->cacheDate = TIME; + $config->width=$this->width; + $config->height=$this->height; return 'var DATAS=' . json_encode($config) . ';' . "\n"; } @@ -414,20 +427,20 @@ class wsHTML5Compiler { $res = array(); // General theme - $h = $this->book->parametres->height . 'px'; - $w2 = ($this->book->parametres->width * 2) . 'px'; - $w = $this->book->parametres->width . 'px'; - $wm = ($this->book->parametres->width * $this->multiply) . 'px'; - $hm = ($this->book->parametres->height * $this->multiply) . 'px'; + $h = $this->height . 'px'; + $w2 = ($this->width * 2) . 'px'; + $w = $this->width . 'px'; + $wm = ($this->width * $this->multiply) . 'px'; + $hm = ($this->height * $this->multiply) . 'px'; - $navTop = ($this->book->parametres->height - 40 - 100) / 2; + $navTop = ($this->height - 40 - 100) / 2; $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}'; $res[] = '.background{' . $this->writeCSSUA('transform-origin', 'top left') . ';}'; foreach (self::$resolutions as $r) { $ratio = round(72 / $r, 2); - $wr = $this->book->parametres->width / $ratio; - $hr = $this->book->parametres->height / $ratio; + $wr = $this->width / $ratio; + $hr = $this->height / $ratio; $br = '.background.r' . $r . '{'; if ($ratio != 1) { @@ -547,6 +560,7 @@ class wsHTML5Compiler { // Links Styles $res = array_merge($res, $links); $res[] = '.link a.displayArea:hover,.link a.displayArea.animating{background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';}'; + $res[]='.link a.displayArea{-webkit-tap-highlight-color:'.self::colorToCSS($this->theme->parametres->linksColor, 0.4).';}'; // Menus # View @@ -554,7 +568,7 @@ class wsHTML5Compiler { $res[] = '.landscape #view{width:' . $w2 . ';min-height:' . $h . '}'; $res[] = '#view{background-color:' . self::colorToCSS($this->theme->parametres->couleurB) . ';color:' . self::colorToCSS($this->theme->parametres->subTextColor) . ';}'; # Index - $ratio = $this->book->parametres->width / $this->book->parametres->height; + $ratio = $this->width / $this->height; $thumbh = round(100 / $ratio); $res[] = '#index .thumb img{width:100px;height:' . $thumbh . 'px;}'; $res[] = '#index .doubleThumb{height:' . $thumbh . 'px;' . $this->writeCSSUA('box-shadow', '0 0 3px ' . $shadowColor) . '}'; -- 2.39.5