'js/libs/gal/gal.js',
'js/libs/gal/gal.filesystem.js',
'js/libs/hammer.min.js',
- 'js/libs/fluidbook/forms/fluidbook.form.bulle.js',
'js/libs/fluidbook/fluidbook.utils.js',
'js/libs/fluidbook/fluidbook.links.js',
'js/libs/fluidbook/fluidbook.support.js',
if ($this->book->parametres->highlightResults) {
$this->vdir->file_put_contents('data/search.highlight.js', 'var HIGHLIGHTS=' . json_encode($this->daoBook->makeHighlightIndex($this->book, $this->pages)) . ";\r");
}
+ if ($this->book->parametres->searchWordSelectionAlgorithm == 'expression') {
+ $this->vdir->file_put_contents('data/search.texts.js', 'var TEXTS=' . $textes . ";\r");
+ }
}
public function supportSVG() {
$this->config->manifest = $this->writeManifest();
}
+ if ($this->config->form == 'bulle') {
+ $this->addJs('js/libs/fluidbook/forms/fluidbook.form.bulle.js');
+ } else if ($this->config->form == 'bourbon') {
+ $this->addJs('js/libs/parsley.min.js');
+ $this->addJs('js/libs/fluidbook/forms/fluidbook.form.bourbon.js');
+ }
+
if ($this->config->basket) {
+ $this->addJs('js/libs/fluidbook/fluidbook.cart.js');
+ switch ($this->config->basketManager) {
+ case 'Remarkable':
+ $this->addJs('js/libs/parsley.min.js');
+ $this->addJs('js/libs/fluidbook/cart/fluidbook.cart.remarkable.js');
+ break;
+ default:
+ break;
+ }
+
+
if (file_exists($this->config->basketReferences) || CubeIT_Util_Url::isDistant($this->config->basketReferences)) {
$referencesFile = $this->config->basketReferences;
} else {
//Icons
$res = array_merge($res, $this->writeIcons());
- $res[] = '#nav #locales{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurI) . ';}';
// Logo
$logo = '#logo{';
// Links Styles
$lessVariables['links-color'] = wsHTML5::colorToCSS($this->theme->parametres->linksColor);
+ $lessVariables['inlineslideshow-transition-time'] = (floatval($this->book->parametres->inlineSlideshowTransitionDuration) * 1000) . 'ms';
$res = array_merge($res, $links);
// Bookmarks
$this->vdir->copy($source, $dest);
}
+ public function addVideoJs()
+ {
+ $locale = $this->book->lang;
+ $map = ['pt' => 'pt-PT', 'pt-br' => 'pt-BR', 'zh' => 'zh-CN', 'es-pr' => 'es'];
+ if (isset($map[$locale])) {
+ $locale = $map[$locale];
+ }
+
+ $this->addJs('js/libs/videojs/video.withscalefix.js');
+ $this->addJs('js/libs/videojs/lang/' . $locale . '.js');
+ $this->addLess('videojs/videojs');
+ }
+
public function copyLinkFile($source, $dest, $video = false) {
if ($video && $this->book->parametres->mobileVideosPath != '') {
$res['height'] = intval((string)$canvas->getAttribute('height'));
}
+ $m = $xpath->query('//meta[@name="width"]');
+ foreach ($m as $meta) {
+ $res['width'] = intval((string)$meta->getAttribute('content'));
+ }
+
+ $m = $xpath->query('//meta[@name="height"]');
+ foreach ($m as $meta) {
+ $res['height'] = intval((string)$meta->getAttribute('content'));
+ }
+
$r = array('html' => 'index.html', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array());
} else {
$r = array('html' => false, 'inject' => array(file_get_contents($d . '/init.js')), 'injectcss' => array('multimedia.css'), 'injectjs' => array('multimedia.js'));
case 11:
return new actionLink($id, $init, $compiler);
case 12:
- return new basketLink($id, $init, $compiler);
+ switch ($compiler->book->parametres->basketManager) {
+ case 'Remarkable':
+ return new remarkableCartLink($id, $init, $compiler);
+ break;
+ default :
+ return new cartLink($id, $init, $compiler);
+ break;
+ }
case 13: // zoom area
return new zoomLink($id, $init, $compiler);
case 14:
return new colorLink($id, $init, $compiler);
case 15:
+
+ if (stristr($init['to'], '.zip')) {
+ return new inlineSlideshowLink($id, $init, $compiler);
+ } else {
return new imageLink($id, $init, $compiler);
+ }
case 16:
return new fileLink($id, $init, $compiler);
case 17:
}
public function getHTMLContainer() {
- return '<div class="' . $this->getHTMLContainerClass() . '" data-id="' . $this->uid . '" id="l_' . $this->id . '">' . $this->getHTMLContent() . '</div>';
+ return '<div class="' . $this->getHTMLContainerClass() . '" data-id="' . $this->uid . '" id="l_' . $this->id . '"' . $this->getAdditionnalContent() . '>' . $this->getHTMLContent() . '</div>';
}
public function getHTMLContainerClass() {
return $res;
}
- public function getHTMLContent() {
+ public function getHTMLContent()
+ {
return '';
}
- public function getAdditionnalContent() {
+ public function getAdditionnalContent()
+ {
+ return '';
}
public static function getUniversalLocation($loc, $css = false) {
$datas = parse_url($loc);
- if (isset($datas['scheme']) && !is_null($datas['scheme'])) {
+ if (isset($datas['scheme']) && !is_null($datas['scheme']) || strpos($loc, '#') === 0) {
return $loc;
} else {
if ($css) {
public $zindex = 2;
public function getHTMLContainerClass() {
- return parent::getHTMLContainerClass() . ' multimedia';
+ return parent::getHTMLContainerClass() . ' multimedia notinteractive';
}
public function getHTMLContent() {
class videoLink extends wsHTML5Link {
public $zindex = 2;
- public static function addVideoJS($compiler) {
- $compiler->addJs('js/libs/videojs/video.withscalefix.js');
- $compiler->addLess('videojs/videojs');
+ public static function addVideoJS($compiler)
+ {
+ $compiler->addVideoJs();
}
public function getClasses() {
}
-class basketLink extends contentLink {
+class cartLink extends normalLink
+{
- public function getCSS() {
- return 'background-color:#fff;';
+ public function getURL()
+ {
+ return '#';
+ }
+
+ public function getDefaultTooltip()
+ {
+ return 'add to cart';
+ }
+
+ public function getAdditionnalContent()
+ {
+ $res = parent::getAdditionnalContent();
+ $res .= 'data-cart-ref="' . $this->to . '" ';
+ return $res;
}
+ }
+
+class remarkableCartLink extends cartLink
+{
}
}
-class fileLink extends normalLink {
+class inlineSlideshowLink extends contentLink
+{
+ public function getHTMLContent()
+ {
+ $d = $this->unzipFile($this->to, false);
+ $this->compiler->vdir->copyDirectory($d['dir'], $d['fdir']);
+
+ $iterator = CubeIT_Files::getRecursiveDirectoryIterator($d['dir']);
+
+ $files = array();
+ foreach ($iterator as $f) {
+ /* @var $f SplFileInfo */
+ $files[] = $f->getFilename();
+ }
+ sort($files);
+ $f = htmlspecialchars(json_encode($files), ENT_QUOTES);
+
+ return '<div class="inlineslideshow" data-dir="' . str_replace('.', '_', $this->to) . '" data-images="' . $f . '"></div>';
+ }
+}
+
+class fileLink extends normalLink
+{
public function getURL() {
if ($this->compiler->book->parametres->linkFilePrefix && !CubeIT_Util_Url::isDistant($this->to)) {
} elseif ($ext == 'zip') {
$d = $this->unzipFile($this->alternative, false);
$this->_config = $this->getConfigZIP($d['dir']);
+ $html = file_get_contents($d['dir'] . '/index.html');
+ $html = str_replace('var pRatio = window.devicePixelRatio || 1,', 'var pRatio = 0.5,', $html);
$this->copyExternalDir($d['dir'], $d['fdir']);
+ $this->_config['lowDef'] = 'index_ld.html';
+ $this->compiler->vdir->file_put_contents($d['fdir'] . '/' . $this->_config['lowDef'], $html);
} elseif ($ext == 'html') {
$fdir = 'data/links';
$dir = $fdir;
$this->_config = array('html' => false, 'width' => $this->width, 'height' => $this->height);
}
+ if ($this->_config['width'] == 0) {
+ $this->_config['width'] = $this->width;
+ }
+ if ($this->_config['height'] == 0) {
+ $this->_config['height'] = $this->height;
+ }
+
$res = '';
if ($this->_config['html']) {
$this->_url = $d['fdir'] . '/' . $this->_config['html'];
$iw = $this->_config['width'];
$ih = $this->_config['height'];
- $res = '<iframe data-width="' . $iw . '" data-height="' . $ih . '" width="' . $iw . '" height="' . $ih . '" src="' . $this->_url . '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""></iframe>';
+ $ld = '';
+ if (isset($this->_config['lowDef'])) {
+ $ld = ' data-ld="' . str_replace('index.html', $this->_config['lowDef'], $this->_url) . '" ';
+ }
+
+ $res = '<iframe ' . $ld . ' data-width="' . $iw . '" data-height="' . $ih . '" width="' . $iw . '" height="' . $ih . '" src="' . $this->_url . '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""></iframe>';
}
if ($this->_externalIframe !== false) {
$s = $this->in_popup ? 1 : $this->getCssScale();