]> _ Git - cubeextranet.git/commitdiff
wip #3097 @2
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 9 Oct 2019 15:13:10 +0000 (15:13 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 9 Oct 2019 15:13:10 +0000 (15:13 +0000)
fluidbook/compile/hybrid/index.html [new file with mode: 0644]
inc/ws/Util/packager/class.ws.packager.html.php

diff --git a/fluidbook/compile/hybrid/index.html b/fluidbook/compile/hybrid/index.html
new file mode 100644 (file)
index 0000000..a3c19ef
--- /dev/null
@@ -0,0 +1,19 @@
+<!doctype html>\r
+<html>\r
+<head>\r
+    <meta name="viewport" content="width=device-width">\r
+    <script>\r
+        var redirect;\r
+        var locationWithoutHash = window.location.href.split('#')[0];\r
+        var hash = window.location.hash;\r
+        if (window.matchMedia('(min-width: $breakpoint)').matches) {\r
+            redirect = 'd';\r
+        } else {\r
+            redirect = 'mf';\r
+        }\r
+        window.location = './' + redirect + '/index.html?hybrid=1&from=' + encodeURIComponent(locationWithoutHash) + hash;\r
+    </script>\r
+</head>\r
+<body style="background-color: #$bgcolor;">\r
+</body>\r
+</html>
\ No newline at end of file
index 6fa8741170a511b33321b27032e28841b29d4a76..1e68dcdd9408001a17bdc2807acf4b7f0ecb10b1 100644 (file)
@@ -248,17 +248,24 @@ class wsPackagerHTML extends wsPackager
             return;
         }
         $dest = $this->vdir . 'm';
-        $this->_compileHTML5($this->book_id, $this->book, $dest);
-
-        try {
-            $mfid = $this->book->parametres->mobilefirstFluidbookId;
-            if ($mfid != '' && (int)$mfid > 0) {
-                $mfbook = $this->daoBook->selectById($mfid);
-                $dest .= '/mf';
-                $this->_compileHTML5($mfid, $mfbook, $dest);
+
+        $mfid = $this->book->parametres->mobilefirstFluidbookId;
+        if ($mfid != '' && (int)$mfid > 0) {
+            $mfbook = $this->daoBook->selectById($mfid);
+            $this->_compileHTML5($this->book_id, $this->book, $dest . '/d');
+            $this->_compileHTML5($mfid, $mfbook, $dest . '/mf');
+
+            $hybrid = file_get_contents(WS_COMPILE_ASSETS . '/hybrid/index.html');
+            $replace = [
+                'breakpoint' => ((int)$this->book->parametres->mobilefirstBreakpoint - 1) . 'px',
+                'bgcolor' => $this->theme->parametres->loadingBackColor
+            ];
+            foreach ($replace as $var => $value) {
+                $hybrid = str_replace('$' . $var, $value, $hybrid);
             }
-        } catch (Exception $e) {
-            die($e->getMessage());
+            file_put_contents($dest . '/index.html', $hybrid);
+        } else {
+            $this->_compileHTML5($this->book_id, $this->book, $dest);
         }
 
         fb(time(), 'end prepare html5');