]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Wed, 11 Nov 2020 16:13:04 +0000 (17:13 +0100)
committerVincent <vincent@enhydra.fr>
Wed, 11 Nov 2020 16:13:04 +0000 (17:13 +0100)
.idea/workspace.xml
index.php
js/cordova.js [new file with mode: 0644]
js/webapp.js

index 483a0941c3c169c432a20dc001fb6e2e45515b2f..e3b766c555bb5a19709f07ae8ebcfd032a3b723c 100644 (file)
@@ -2,14 +2,10 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/style/menu.less" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/js/cordova.js" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/index.php" beforeDir="false" afterPath="$PROJECT_DIR$/index.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/js/home.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/home.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/js/mmenu/mmenu-light.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/mmenu/mmenu-light.js" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/style/style.css" beforeDir="false" afterPath="$PROJECT_DIR$/style/style.css" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/style/style.less" beforeDir="false" afterPath="$PROJECT_DIR$/style/style.less" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/js/webapp.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/webapp.js" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -58,8 +54,8 @@
         <option value="Setup Script" />
         <option value="Python Script" />
         <option value="HTML File" />
-        <option value="JavaScript File" />
         <option value="Less File" />
+        <option value="JavaScript File" />
       </list>
     </option>
   </component>
     <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1553247665857" />
     <property name="dumpAutoload T:/Drive/Works/home/composer.json" value="--no-interaction --ansi --verbose --optimize" />
     <property name="editor.config.ad.shown" value="true" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/style/fonts/fontawesome" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/../home-android" />
     <property name="list.type.of.created.stylesheet" value="Less" />
     <property name="nodejs_package_manager_path" value="npm" />
     <property name="project.structure.last.edited" value="Problems" />
       <workItem from="1604828693023" duration="1255000" />
       <workItem from="1605001866699" duration="7793000" />
       <workItem from="1605087671373" duration="102000" />
-      <workItem from="1605087787424" duration="13605000" />
-    </task>
-    <task id="LOCAL-00333" summary=".">
-      <created>1595403718905</created>
-      <option name="number" value="00333" />
-      <option name="presentableId" value="LOCAL-00333" />
-      <option name="project" value="LOCAL" />
-      <updated>1595403718906</updated>
+      <workItem from="1605087787424" duration="18827000" />
     </task>
     <task id="LOCAL-00334" summary=".">
       <created>1595521318353</created>
       <option name="project" value="LOCAL" />
       <updated>1605094978427</updated>
     </task>
-    <option name="localTasksCounter" value="382" />
+    <task id="LOCAL-00382" summary=".">
+      <created>1605102367599</created>
+      <option name="number" value="00382" />
+      <option name="presentableId" value="LOCAL-00382" />
+      <option name="project" value="LOCAL" />
+      <updated>1605102367599</updated>
+    </task>
+    <option name="localTasksCounter" value="383" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
       <screen x="0" y="0" width="1707" height="920" />
     </state>
     <state x="740" y="229" key="#com.jetbrains.php.refactoring.extractMethod.PhpExtractMethodDialog#function0/0.0.1707.920@0.0.1707.920" timestamp="1604146905948" />
-    <state x="198" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1605094974306">
+    <state x="198" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1605102357852">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="132" y="0" width="737" height="502" key="CommitChangelistDialog2/0.0.1707.920@0.0.1707.920" timestamp="1605086955514" />
     <state x="701" y="75" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1602171117745" />
-    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1605094974306" />
-    <state x="952" y="244" key="FileChooserDialogImpl" timestamp="1605087475486">
+    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1605102357852" />
+    <state x="952" y="244" key="FileChooserDialogImpl" timestamp="1605104496549">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="635" y="216" key="FileChooserDialogImpl/0.0.1707.920@0.0.1707.920" timestamp="1604227698339" />
-    <state x="952" y="244" key="FileChooserDialogImpl/0.0.2560.1040@0.0.2560.1040" timestamp="1605087475486" />
+    <state x="952" y="244" key="FileChooserDialogImpl/0.0.2560.1040@0.0.2560.1040" timestamp="1605104496549" />
     <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1605089580764">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
index a46c491cf5db0c3518d03857bd1c500390479494..f3a5f4ca879376b27e2c5eaa2aa9dc7984c0f0ee 100644 (file)
--- a/index.php
+++ b/index.php
@@ -82,13 +82,14 @@ function relativePath($p)
     </main>
 </div>
 <?php
-if ($android) {
+if (true) {
     echo '<script src="' . relativePath('js/webapp.js') . '"></script>' . "\n";
 } ?>
 <script>
     CONFIG = <?php echo json_encode(config());    profile('Got config', __FILE__, __LINE__); ?>;
     <?php echo shortcutDir($shortcuts);    profile('Made shortcuts', __FILE__, __LINE__); ?>
 </script>
+<script type="text/javascript" src="cdvfile://localhost/assets/www/cordova.js"/>
 <script src="<?php echo relativePath('js/modernizr.js') ?>"></script>
 <script src="<?php echo relativePath('js/jquery.min.js') ?>"></script>
 <script src="<?php echo relativePath('js/jquery.scrollto.min.js') ?>"></script>
@@ -97,6 +98,7 @@ if ($android) {
 <script src="<?php echo relativePath('js/mmenu/mmenu-light.polyfills.js') ?>"></script>
 <script src="<?php echo relativePath('js/hammer.min.js') ?>"></script>
 <script src="<?php echo relativePath('js/fingers.min.js') ?>"></script>
+<script src="<?php echo relativePath('js/cordova.js') ?>"></script>
 <script src="<?php echo relativePath('js/common.js') ?>"></script>
 <script src="<?php echo relativePath('js/home.js') ?>"></script>
 </body>
diff --git a/js/cordova.js b/js/cordova.js
new file mode 100644 (file)
index 0000000..7b0e81c
--- /dev/null
@@ -0,0 +1,34 @@
+document.addEventListener("deviceready", onDeviceReady, false);
+
+function onDeviceReady() {
+    initCordova();
+}
+
+
+function initCordova() {
+    console.log('init cordova');
+    try {
+        screen.orientation.lock('landscape');
+    } catch (e) {
+        console.log(e);
+    }
+
+    try {
+        StatusBar.hide();
+    } catch (e) {
+        console.log(e);
+    }
+
+    try {
+        window.plugins.intent.setNewIntentHandler(function (intent) {
+            // To get browser URL I had to use
+            var subject = intent.extras['android.intent.extra.SUBJECT'];
+            var url = intent.extras['android.intent.extra.TEXT'];
+            $.ajax({
+                url: '/scripts/share.php?text=' + url
+            })
+        });
+    }catch (e){
+
+    }
+}
\ No newline at end of file
index 5d7193d0ff5ff68f0f34fb780b08c3f6ef2b1e2f..ed087bd32fc7a0a477f8c4ef4da9addc38fbb824 100644 (file)
@@ -29,34 +29,34 @@ function installapp() {
     });
 }
 
-function checkForPageUpdate(registration) {
-    // onupdatefound will fire on first time install and when serviceWorker.js file changes
-    registration.addEventListener("updatefound", function() {
-        // To check if service worker is already installed and controlling the page or not
-        if (navigator.serviceWorker.controller) {
-            var installingSW = registration.installing;
-            installingSW.onstatechange = function() {
-                console.info("Service Worker State :", installingSW.state);
-                switch(installingSW.state) {
-                    case 'installed':
-                        // Now new contents will be added to cache and old contents will be remove so
-                        // this is perfect time to show user that page content is updated.
-                        toast('Site is updated. Refresh the page.', 5000);
-                        break;
-                    case 'redundant':
-                        throw new Error('The installing service worker became redundant.');
-                }
-            }
-        }
-    });
-}
+// function checkForPageUpdate(registration) {
+//     // onupdatefound will fire on first time install and when serviceWorker.js file changes
+//     registration.addEventListener("updatefound", function() {
+//         // To check if service worker is already installed and controlling the page or not
+//         if (navigator.serviceWorker.controller) {
+//             var installingSW = registration.installing;
+//             installingSW.onstatechange = function() {
+//                 console.info("Service Worker State :", installingSW.state);
+//                 switch(installingSW.state) {
+//                     case 'installed':
+//                         // Now new contents will be added to cache and old contents will be remove so
+//                         // this is perfect time to show user that page content is updated.
+//                         toast('Site is updated. Refresh the page.', 5000);
+//                         break;
+//                     case 'redundant':
+//                         throw new Error('The installing service worker became redundant.');
+//                 }
+//             }
+//         }
+//     });
+// }
 
-if ("serviceWorker" in navigator) {
-    navigator.serviceWorker.register('./service-worker.js', {scope: "./"}) //setting scope of sw
-        .then(function (registration) {
-            console.info('Service worker is registered!');
-            checkForPageUpdate(registration); // To check if new content is updated or not
-        })        .catch(function (error) {
-            console.error('Service worker failed ', error);
-        });
-}
+// if ("serviceWorker" in navigator) {
+//     navigator.serviceWorker.register('./service-worker.js', {scope: "./"}) //setting scope of sw
+//         .then(function (registration) {
+//             console.info('Service worker is registered!');
+//             checkForPageUpdate(registration); // To check if new content is updated or not
+//         })        .catch(function (error) {
+//             console.error('Service worker failed ', error);
+//         });
+// }