$res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.doublePage._3d{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}';
$res[] = '.doublePage,#pages,#links,.landscape #shadow.double{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}';
- $res[] = '.landscape .doublePage._2d.axis_x.next{' . $this->writeCSSUA('transform', 'translate3d(' . $w2 . ',0,0)') . '}';
- $res[] = '.landscape .doublePage._2d.axis_x.prev{' . $this->writeCSSUA('transform', 'translate3d(-' . $w2 . ',0,0)') . '}';
- $res[] = '.portrait .doublePage._2d.axis_x.next{' . $this->writeCSSUA('transform', 'translate3d(' . $w . ',0,0)') . '}';
- $res[] = '.portrait .doublePage._2d.axis_x.prev{' . $this->writeCSSUA('transform', 'translate3d(-' . $w . ',0,0)') . '}';
- $res[] = '.doublePage._2d.axis_y.next{' . $this->writeCSSUA('transform', 'translate3d(0,' . $h . ',0)') . '}';
- $res[] = '.doublePage._2d.axis_y.prev{' . $this->writeCSSUA('transform', 'translate3d(0,-' . $h . ',0)') . '}';
-
- /* $res[] = '.dev .landscape .doublePage._2d.axis_x.next{left:' . $w2 . ';' . $this->writeCSSUA('transform', 'none') . '}';
- $res[] = '.dev .landscape .doublePage._2d.axis_x.prev{left:-' . $w2 . ';' . $this->writeCSSUA('transform', 'none') . '}';
- $res[] = '.dev .portrait .doublePage._2d.axis_x.next{left:' . $w . ';' . $this->writeCSSUA('transform', 'none') . '}';
- $res[] = '.dev .portrait .doublePage._2d.axis_x.prev{left:-' . $w . ';' . $this->writeCSSUA('transform', 'none') . '}';
- $res[] = '.dev .doublePage._2d.axis_y.next{top:' . $h . ';' . $this->writeCSSUA('transform', 'none') . '}';
- $res[] = '.dev .doublePage._2d.axis_y.prev{top:-' . $h . ';' . $this->writeCSSUA('transform', 'none') . '}';
-
- $res[] = '.dev .landscape .doublePage._2d.axis_x.next{' . $this->writeCSSUA('transform', 'translate(' . $w2 . ',0)') . '}';
- $res[] = '.dev .landscape .doublePage._2d.axis_x.prev{' . $this->writeCSSUA('transform', 'translate(-' . $w2 . ',0)') . '}';
- $res[] = '.dev .portrait .doublePage._2d.axis_x.next{' . $this->writeCSSUA('transform', 'translate(' . $w . ',0)') . '}';
- $res[] = '.dev .portrait .doublePage._2d.axis_x.prev{' . $this->writeCSSUA('transform', 'translate(-' . $w . ',0)') . '}';
- $res[] = '.dev .doublePage._2d.axis_y.next{' . $this->writeCSSUA('transform', 'translate(0,' . $h . ')') . '}';
- $res[] = '.dev .doublePage._2d.axis_y.prev{' . $this->writeCSSUA('transform', 'translate(0,-' . $h . ')') . '}'; */
+ $res[] = '.landscape .doublePage._2d.axis_x.next{' . self::writeCSSUA('transform', 'translate3d(' . $w2 . ',0,0)') . '}';
+ $res[] = '.landscape .doublePage._2d.axis_x.prev{' . self::writeCSSUA('transform', 'translate3d(-' . $w2 . ',0,0)') . '}';
+ $res[] = '.portrait .doublePage._2d.axis_x.next{' . self::writeCSSUA('transform', 'translate3d(' . $w . ',0,0)') . '}';
+ $res[] = '.portrait .doublePage._2d.axis_x.prev{' . self::writeCSSUA('transform', 'translate3d(-' . $w . ',0,0)') . '}';
+ $res[] = '.doublePage._2d.axis_y.next{' . self::writeCSSUA('transform', 'translate3d(0,' . $h . ',0)') . '}';
+ $res[] = '.doublePage._2d.axis_y.prev{' . self::writeCSSUA('transform', 'translate3d(0,-' . $h . ',0)') . '}';
+
+ /* $res[] = '.dev .landscape .doublePage._2d.axis_x.next{left:' . $w2 . ';' . self::writeCSSUA('transform', 'none') . '}';
+ $res[] = '.dev .landscape .doublePage._2d.axis_x.prev{left:-' . $w2 . ';' . self::writeCSSUA('transform', 'none') . '}';
+ $res[] = '.dev .portrait .doublePage._2d.axis_x.next{left:' . $w . ';' . self::writeCSSUA('transform', 'none') . '}';
+ $res[] = '.dev .portrait .doublePage._2d.axis_x.prev{left:-' . $w . ';' . self::writeCSSUA('transform', 'none') . '}';
+ $res[] = '.dev .doublePage._2d.axis_y.next{top:' . $h . ';' . self::writeCSSUA('transform', 'none') . '}';
+ $res[] = '.dev .doublePage._2d.axis_y.prev{top:-' . $h . ';' . self::writeCSSUA('transform', 'none') . '}';
+
+ $res[] = '.dev .landscape .doublePage._2d.axis_x.next{' . self::writeCSSUA('transform', 'translate(' . $w2 . ',0)') . '}';
+ $res[] = '.dev .landscape .doublePage._2d.axis_x.prev{' . self::writeCSSUA('transform', 'translate(-' . $w2 . ',0)') . '}';
+ $res[] = '.dev .portrait .doublePage._2d.axis_x.next{' . self::writeCSSUA('transform', 'translate(' . $w . ',0)') . '}';
+ $res[] = '.dev .portrait .doublePage._2d.axis_x.prev{' . self::writeCSSUA('transform', 'translate(-' . $w . ',0)') . '}';
+ $res[] = '.dev .doublePage._2d.axis_y.next{' . self::writeCSSUA('transform', 'translate(0,' . $h . ')') . '}';
+ $res[] = '.dev .doublePage._2d.axis_y.prev{' . self::writeCSSUA('transform', 'translate(0,-' . $h . ')') . '}'; */
$res[] = '.doublePage._3d{left:' . $w . ';}';
$res[] = '#links.right{left:-' . $w . ';}';
} else {
$res[] = '#pagesnumbers{display:none;}';
}
- $res[] = '.doublePage._2d,.doublePage._3d{' . $this->writeCSSUA('transition', 'all ' . $this->book->parametres->mobileTransitionDuration . 's ease-in-out') . '}';
+ $res[] = '.doublePage._2d,.doublePage._3d{' . self::writeCSSUA('transition', 'all ' . $this->book->parametres->mobileTransitionDuration . 's ease-in-out') . '}';
- $res[] = '.background{' . $this->writeCSSUA('transform-origin', 'top left') . ';}';
+ $res[] = '.background{' . self::writeCSSUA('transform-origin', 'top left') . ';}';
foreach (self::$resolutions as $r) {
$ratio = round(72 / $r, 3) * $cssScale;
$br = '.background.r' . $r . '{';
if ($ratio != 1) {
- $br.=$this->writeCSSUA('transform', 'scale(' . $ratio . ')') . ';';
+ $br.=self::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 = '.texts{' . self::writeCSSUA('transform-origin', 'top left') . ';';
+ $texts.=self::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.='}';
$search.='color:' . self::colorToCSS($this->theme->parametres->couleurS) . ';';
$search.='background-color:' . self::colorToCSS($this->theme->parametres->searchFieldColor) . ';';
if ($this->theme->parametres->searchShadeAlpha > 0) {
- $search.=$this->writeCSSUA('box-shadow', '1px 1px 4px rgba(0,0,0,' . ($this->theme->parametres->searchShadeAlpha / 100) . ')') . ' inset;';
+ $search.=self::writeCSSUA('box-shadow', '1px 1px 4px rgba(0,0,0,' . ($this->theme->parametres->searchShadeAlpha / 100) . ')') . ' inset;';
}
$search.='}';
$res[] = $search;
// Book shadow
$shadowColor = self::colorToCSS($this->theme->parametres->bookShadeColor);
if ($shadowColor != 'transparent') {
- $res[] = '#shadow{' . $this->writeCSSUA('box-shadow', '0 0 20px ' . $shadowColor) . '}';
+ $res[] = '#shadow{' . self::writeCSSUA('box-shadow', '0 0 20px ' . $shadowColor) . '}';
}
// Links Styles
$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{height:' . $thumbh . 'px;' . self::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) . '}';
return $body;
}
- protected function writeCSSUA($property, $value) {
+ public static function writeCSSUA($property, $value) {
$res = array();
foreach (self::$uaPrefixes as $prefix) {
$res[] = $prefix . $property . ':' . $value;
} else {
return new videoPopupLink($id, $init, $compiler);
}
- case 6:
- return new multimediaLink($id, $init, $compiler);
+
case 7:
if ($compiler->book->parametres->customLinkClass == 'WescoLink') {
return new wescoLink($id, $init, $compiler);
$compiler->addBookmarkGroup($init);
break;
case 21:
- return new htmlMultimediaLink($id, $init, $compiler);
+ case 6:
+ return self::getMultimediaInstance($id, $init, $compiler);
+ break;
default:
return null;
}
}
+ public static function getMultimediaInstance($id, $init, &$compiler) {
+ if ($init['alternative'] == '') {
+ return null;
+ }
+
+ $ext = mb_strtolower(files::getExtension($init['alternative']));
+
+ if ($ext == 'oam') {
+ if ($init['inline']) {
+ return new htmlMultimediaLink($id, $init, $compiler);
+ } else {
+ return new htmlMultimediaPopupLink($id, $init, $compiler);
+ }
+ } else if (in_array($ext, array('gif', 'jpeg', 'jpg', 'png', 'svg'))) {
+ if ($init['inline']) {
+ return new htmlMultimediaImage($id, $init, $compiler);
+ } else {
+ return new htmlMultimediaPopupImage($id, $init, $compiler);
+ }
+ }
+ return null;
+ }
+
public function __construct($id, $init, &$compiler) {
foreach ($init as $k => $v) {
$this->$k = $v;
}
+ $this->wdir = WS_BOOKS . '/working/' . $compiler->book_id . '/';
$this->id = $id;
$this->compiler = $compiler;
}
}
+class htmlMultimediaImage extends wsHTML5Link {
+
+ public function getHTMLContainerClass() {
+ return 'link multimedia';
+ }
+
+ public function getHTMLContent() {
+ $w = $this->width * $this->getCssScale();
+ $h = $this->height * $this->getCssScale();
+ $this->copyExternalFile($this->alternative);
+ $alt = '<img src="' . wsHTML5Link::getUniversalLocation($this->alternative) . '" width="' . $w . '" height="' . $h . '" />';
+ return $alt;
+ }
+
+}
+
+class htmlMultimediaPopupImage extends normalLink {
+
+ public function getURL() {
+ $this->copyExternalFile($this->alternative);
+ return '#/multimedia/' . $this->alternative;
+ }
+
+ public function getAdditionnalContent() {
+ $dim = getimagesize($this->wdir . '/' . $this->alternative);
+ $markup = '<div class="multimediaContainer"><img src="' . wsHTML5Link::getUniversalLocation($this->alternative) . '" width="' . $dim[0] . '" height="' . $dim[1] . '" class="multimedia" /></div>';
+ return ' data-multimedia="' . rawurlencode($markup) . '" ';
+ }
+
+ public function keep() {
+ return true;
+ }
+
+}
+
class contentLink extends wsHTML5Link {
public function getHTMLContainerClass() {
}
-class multimediaLink extends wsHTML5Link {
-
- public function getHTMLContainerClass() {
- return 'link multimedia';
- }
-
- public function getHTMLContent() {
- //$this->copyExternalFile($this->to);
- $w = $this->width * $this->getCssScale();
- $h = $this->height * $this->getCssScale();
- if ($this->alternative != '') {
- $this->copyExternalFile($this->alternative);
- }
- $alt = $this->alternative == '' ? '' : '<img src="' . wsHTML5Link::getUniversalLocation($this->alternative) . '" width="' . $w . '" height="' . $h . '" />';
- return $alt;
- }
-
-}
-
class htmlMultimediaLink extends wsHTML5Link {
protected $_config = null;
public function getHTMLContent() {
if ($this->_content == '') {
- $d = $this->unzipFile($this->to, true);
+ $d = $this->unzipFile($this->alternative, true);
$this->_config = $this->getConfig($d['dir']);
-
- $this->_correctFiles($d['dir']);
-
$w = $this->width * $this->getCssScale();
$h = $this->height * $this->getCssScale();
- $res = '<script type="text/javascript" src="' . $d['fdir'] . '/' . $this->_config['name'] . '_edgePreload.js"></script>';
- $res.=$this->_config['content'];
+ $iw = $this->_config['width'] * $this->getCssScale();
+ $ih = $this->_config['height'] * $this->getCssScale();
+ $res = '<iframe width="' . $iw . '" height="' . $ih . '" src="' . $d['fdir'] . '/' . $this->_config['html'] . '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';
$this->copyExternalDir($d['dir']);
$this->_content = $res;
}
}
}
- /**
- *
- * @param SplFileInfo $file
- */
- protected function _correctFile($file) {
- $d = 'data/links/' . $this->to . '/';
- $content = file_get_contents($file);
- foreach ($this->_config['assets'] as $a) {
- $content = str_replace($a, $d . $a, $content);
- }
- $content = str_replace("='images/';", "='$d"."images/';",$content);
- file_put_contents($file, $content);
+ public function getCSS() {
+ $sx = $this->width / ($this->_config['width'] * $this->getCssScale());
+ $sy = $this->height / ($this->_config['height'] * $this->getCssScale());
+
+ $res = wsHTML5Compiler::writeCSSUA('transform', 'scale(' . $sx . ',' . $sy . ')');
+ $res.= wsHTML5Compiler::writeCSSUA('transform-origin', '0% 0%');
+ return $res;
}
public function getConfig($d) {
$x = simplexml_load_file($config, 'SimpleXMLElement', LIBXML_NOCDATA);
$c = CubeIT_Util_Xml::toObject($x);
- $props = array('default-width' => 'width', 'default-height' => 'height');
+ $props = array('default-width' => 'width', 'default-height' => 'height', 'html-page' => 'html');
$res = array('content' => trim($c->content), 'name' => $c->_name, 'assets' => array());