From: vincent@cubedesigners.com Date: Tue, 17 Jul 2012 17:20:55 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=a0d6fff5159f53ce4aeeab9a01e796d704080d2c;p=cubeextranet.git --- diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index 389cfba8b..df634e2d5 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -607,7 +607,7 @@ class wsHTML5Compiler { copy($s, $t); } - protected function writeCSS($file, $links) { + protected function writeCSS($file, $links) { $res = array(); // General theme @@ -627,8 +627,7 @@ class wsHTML5Compiler { $offsetTop = round(($this->optimalHeight - $cssHeight) / 2, 3); $navTop = ($cssHeight - 40 - 100) / 2; - $res[] = '#fluidbook{left:' . $offsetLeft . 'px;top:' . $offsetTop . 'px;}'; - $res[] = '.landscape #fluidbook{left:' . $offsetLeft2 . 'px;}'; + $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links,.doublePage._3d{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}'; $res[] = '.doublePage,#pages,.landscape #shadow.double{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}'; $res[] = '.landscape .doublePage._2d.next{' . $this->writeCSSUA('transform', 'translate3d(' . $w2 . ',0,0)') . '}'; @@ -669,8 +668,13 @@ class wsHTML5Compiler { $res[] = $texts; // Theme + $shade = '.page .shade{'; + $shade.='opacity:' . ($this->theme->parametres->shadeAlpha / 100) . ';'; + $shade.='}'; + $res[] = $shade; + // Background - $body = '#deviceView{'; + $body = '#main,#view.index{'; $body.='background-color:#' . $this->theme->parametres->backgroundColor . ';'; switch ($this->theme->parametres->repeat) { case wsTheme::REPEAT: @@ -681,6 +685,7 @@ class wsHTML5Compiler { break; case wsTheme::RATIO: $body.='background-repeat:no-repeat;'; + $body.='background-size:cover;'; break; case wsTheme::STRETCH: $body.='background-repeat:no-repeat;'; @@ -692,13 +697,6 @@ class wsHTML5Compiler { $body.='background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');'; $body.='background-position:'; - if (file_exists($this->themeRoot . '/' . $this->theme->parametres->backgroundImage)) { - $dim = getimagesize($this->themeRoot . '/' . $this->theme->parametres->backgroundImage); - $this->additionalConfig['backgroundRatio'] = $dim[0] / $dim[1]; - } else { - $this->additionalConfig['backgroundRatio'] = 1; - } - switch ($this->theme->parametres->backgroundVAlign) { case wsTheme::TOP: $body.='top'; @@ -729,7 +727,7 @@ class wsHTML5Compiler { $res[] = $body; // Header - $header = '#header{'; + $header = 'header{'; $header.='height:' . $this->theme->parametres->menuHeight . 'px;'; $header.='background-color:' . self::colorToCSS($this->theme->parametres->menuColor) . ';'; if ($this->theme->parametres->menuImage != '') { @@ -755,7 +753,7 @@ class wsHTML5Compiler { $res[] = $logo; // Credits - $res[] = '#credits,#credits a{color:' . self::colorToCSS($this->theme->parametres->creditsColor) . ';}'; + $res[] = 'footer,footer a{color:' . self::colorToCSS($this->theme->parametres->creditsColor) . ';}'; // Arrows $res[] = '#next,#previous{background-color:' . self::colorToCSS($this->theme->parametres->couleurA) . ';}'; @@ -778,10 +776,10 @@ class wsHTML5Compiler { # Index $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) . '}'; - $res[] = '#index .doubleThumb .overlay{height:' . $thumbh . 'px;}'; - $res[] = '#index .doubleThumb .hits.yes{background-color:' . self::colorToCSS($this->theme->parametres->subSelectColor) . ';color:' . self::colorToCSS($this->theme->parametres->subTextSelectColor) . '}'; + $res[] = '#indexView .thumb img{width:100px;height:' . $thumbh . 'px;}'; + $res[] = '#indexView .doubleThumb{height:' . $thumbh . 'px;' . $this->writeCSSUA('box-shadow', '0 0 3px ' . $shadowColor) . '}'; + $res[] = '#indexView .doubleThumb .overlay{height:' . $thumbh . 'px;}'; + $res[] = '#indexView .doubleThumb .hits.yes{background-color:' . self::colorToCSS($this->theme->parametres->subSelectColor) . ';color:' . self::colorToCSS($this->theme->parametres->subTextSelectColor) . '}'; $res = array_chunk($res, 3500); foreach ($res as $k => $css) { @@ -895,188 +893,6 @@ class wsHTML5Compiler { } class wsHTML5CompilerDev extends wsHTML5Compiler { - - protected function writeCSS($file, $links) { - $res = array(); - - // General theme - $cssWidth = $this->cssWidth; - $cssHeight = $this->cssHeight; - $cssScale = $this->cssScale; - $w2 = ($cssWidth * 2) . 'px'; - - - $h = $cssHeight . 'px'; - - $wm = ($this->width * $this->multiply) . 'px'; - $hm = ($this->height * $this->multiply) . 'px'; - $w = $cssWidth . 'px'; - $offsetLeft = round(($this->optimalWidth - $cssWidth) / 2, 3); - $offsetLeft2 = $offsetLeft * 2; - $offsetTop = round(($this->optimalHeight - $cssHeight) / 2, 3); - $navTop = ($cssHeight - 40 - 100) / 2; - - - $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links,.doublePage._3d{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}'; - $res[] = '.doublePage,#pages,.landscape #shadow.double{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}'; - $res[] = '.landscape .doublePage._2d.next{' . $this->writeCSSUA('transform', 'translate3d(' . $w2 . ',0,0)') . '}'; - $res[] = '.landscape .doublePage._2d.prev{' . $this->writeCSSUA('transform', 'translate3d(-' . $w2 . ',0,0)') . '}'; - $res[] = '.portrait .doublePage._2d.next{' . $this->writeCSSUA('transform', 'translate3d(' . $w . ',0,0)') . '}'; - $res[] = '.portrait .doublePage._2d.prev{' . $this->writeCSSUA('transform', 'translate3d(-' . $w . ',0,0)') . '}'; - $res[] = '.doublePage._3d{left:' . $w . ';}'; - $res[] = '.landscape #shadow.single.right{left: ' . $w . ';}'; - $res[] = '.landscape #shadow.single.right{left: ' . $w . ';}'; - $res[] = '.landscape .page.right{left:' . $w . '}'; - if ($this->theme->parametres->displayPageNumber) { - $res[] = '#pagesnumbers{top:' . $h . ';color:' . self::colorToCSS($this->theme->parametres->colorPageNumber) . '}'; - $res[] = '#pagesnumbers div{width:' . $w . '}'; - } else { - $res[] = '#pagesnumbers{display:none;}'; - } - - - $res[] = '.background{' . $this->writeCSSUA('transform-origin', 'top left') . ';}'; - foreach (self::$resolutions as $r) { - $ratio = round(72 / $r, 3) * $cssScale; - - $wr = $cssWidth / $ratio; - $hr = $cssHeight / $ratio; - - $br = '.background.r' . $r . '{'; - if ($ratio != 1) { - $br.=$this->writeCSSUA('transform', 'scale(' . $ratio . ')') . ';'; - } - $br.='width:' . $wr . 'px;height:' . $hr . 'px;}'; - $res[] = $br; - } - $texts = '.texts{' . $this->writeCSSUA('transform-origin', 'top left') . ';'; - $texts.=$this->writeCSSUA('transform', 'scale(' . round((1 / $this->multiply) * $cssScale * $this->cssSVGScale, 3) . ')') . ';'; - $texts.='width:' . ($wm / $this->cssSVGScale) . '; max-width:' . ($wm / $this->cssSVGScale) . ';'; - $texts.='height:' . ($hm / $this->cssSVGScale) . '; max-height:' . ($hm / $this->cssSVGScale) . ';'; - $texts.='}'; - $res[] = $texts; - - // Theme - $shade = '.page .shade{'; - $shade.='opacity:' . ($this->theme->parametres->shadeAlpha / 100) . ';'; - $shade.='}'; - $res[] = $shade; - - // Background - $body = '#main,#view.index{'; - $body.='background-color:#' . $this->theme->parametres->backgroundColor . ';'; - switch ($this->theme->parametres->repeat) { - case wsTheme::REPEAT: - $body.='background-repeat:repeat;'; - break; - case wsTheme::NONE: - $body.='background-repeat:no-repeat;'; - break; - case wsTheme::RATIO: - $body.='background-repeat:no-repeat;'; - $body.='background-size:cover;'; - break; - case wsTheme::STRETCH: - $body.='background-repeat:no-repeat;'; - $body.='background-size:100% 100%;'; - break; - } - if ($this->theme->parametres->backgroundImage != '') { - copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, $this->vdir . '/data/images/' . $this->theme->parametres->backgroundImage); - $body.='background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');'; - $body.='background-position:'; - - switch ($this->theme->parametres->backgroundVAlign) { - case wsTheme::TOP: - $body.='top'; - break; - case wsTheme::MIDDLE: - $body.='center'; - break; - case wsTheme::BOTTOM: - $body.='bottom'; - break; - } - $body.=' '; - switch ($this->theme->parametres->backgroundHAlign) { - case wsTheme::LEFT: - $body.='left'; - break; - case wsTheme::CENTER: - $body.='center'; - break; - case wsTheme::RIGHT: - $body.='right'; - break; - } - $body.=';'; - } - - $body.='}'; - $res[] = $body; - - // Header - $header = 'header{'; - $header.='height:' . $this->theme->parametres->menuHeight . 'px;'; - $header.='background-color:' . self::colorToCSS($this->theme->parametres->menuColor) . ';'; - if ($this->theme->parametres->menuImage != '') { - copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, $this->vdir . '/data/images/' . $this->theme->parametres->menuImage); - $header.='background-image:url(../images/' . $this->theme->parametres->menuImage . ');'; - $header.='background-repeat:no-repeat;'; - $header.='background-size:100% ' . $this->theme->parametres->menuHeight . 'px;'; - } - $header.='}'; - $res[] = $header; - - //Icons - $res = array_merge($res, $this->writeIcons()); - - // Logo - $logo = '#logo{'; - if ($this->theme->parametres->logo) { - copy($this->themeRoot . '/' . $this->theme->parametres->logo, $this->vdir . '/data/images/' . $this->theme->parametres->logo); - $dim = getimagesize($this->vdir . '/data/images/' . $this->theme->parametres->logo); - $logo.='background-image:url(../images/' . $this->theme->parametres->logo . ');width:' . $dim[0] . 'px;height:' . $dim[1] . 'px;'; - } - $logo.='}'; - $res[] = $logo; - - // Credits - $res[] = 'footer,footer a{color:' . self::colorToCSS($this->theme->parametres->creditsColor) . ';}'; - - // Arrows - $res[] = '#next,#previous{background-color:' . self::colorToCSS($this->theme->parametres->couleurA) . ';}'; - // Book shadow - $shadowColor = self::colorToCSS($this->theme->parametres->bookShadeColor); - if ($shadowColor != 'transparent') { - $res[] = '#shadow{' . $this->writeCSSUA('box-shadow', '0 0 20px ' . $shadowColor) . '}'; - } - - // 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) . ';background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.0001) . ';}'; - - // Menus - # View - $res[] = '.portrait #view{width:' . $w . ';min-height:' . $h . '}'; - $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->width / $this->height; - $thumbh = round(100 / $ratio); - $res[] = '#indexView .thumb img{width:100px;height:' . $thumbh . 'px;}'; - $res[] = '#indexView .doubleThumb{height:' . $thumbh . 'px;' . $this->writeCSSUA('box-shadow', '0 0 3px ' . $shadowColor) . '}'; - $res[] = '#indexView .doubleThumb .overlay{height:' . $thumbh . 'px;}'; - $res[] = '#indexView .doubleThumb .hits.yes{background-color:' . self::colorToCSS($this->theme->parametres->subSelectColor) . ';color:' . self::colorToCSS($this->theme->parametres->subTextSelectColor) . '}'; - - $res = array_chunk($res, 3500); - foreach ($res as $k => $css) { - file_put_contents(sprintf($file, $k), implode("\n", $css)); - } - return count($res); - } - } ?> \ No newline at end of file