From: Vincent Date: Wed, 11 Nov 2020 19:05:28 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f17889b0611374bf208cf6b87decaf27932597f9;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e3b766c..cdebdca 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,51 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + - @@ -908,14 +949,7 @@ - - - - 1595521318353 - 1595609479854 @@ -1253,7 +1287,14 @@ - @@ -1299,12 +1340,12 @@ - + - + diff --git a/config/switch.php b/config/switch.php index a384d61..ffa3738 100644 --- a/config/switch.php +++ b/config/switch.php @@ -1,9 +1,16 @@ 'Salon', 'bureausun' => 'Bureau', 'entree' => 'Entrée', 'cuisine' => 'Cuisine', 'chambre' => 'Chambre', 'litvincent' => 'Lit Vincent', 'litjerome' => 'Lit Jérôme', 'sdb' => 'Salle de bain', 'cour' => 'Cour', 'balcon' => 'Balcon', 'wc' => 'WC']; +$shortcuts['switchshare'] = []; +$share = ['salon', 'bureau', 'sdb', 'cuisine', 'chambre']; +$rooms = ['salon' => 'Salon', 'bureau' => 'Bureau', 'entree' => 'Entrée', 'cuisine' => 'Cuisine', 'chambre' => 'Chambre', 'litvincent' => 'Lit Vincent', 'litjerome' => 'Lit Jérôme', 'sdb' => 'Salle de bain', 'cour' => 'Cour', 'balcon' => 'Balcon', 'wc' => 'WC']; foreach ($rooms as $room => $label) { if (config('DEVICE') === $room) { continue; } $shortcuts['switch'][] = ['type' => 'switch', 'room' => $room, 'label' => $label]; + +} + +foreach ($share as $item) { + $shortcuts['switchshare'][] = ['type' => 'switchshare', 'room' => $item, 'label' => $rooms[$item]]; } \ No newline at end of file diff --git a/images/backgrounds/-litjerome.jpg b/images/backgrounds/-litjerome.jpg deleted file mode 100644 index 2f06ce9..0000000 Binary files a/images/backgrounds/-litjerome.jpg and /dev/null differ diff --git a/images/backgrounds/balcon.jpg b/images/backgrounds/balcon.jpg deleted file mode 100644 index a5e7e73..0000000 Binary files a/images/backgrounds/balcon.jpg and /dev/null differ diff --git a/images/backgrounds/bureau.jpg b/images/backgrounds/bureau.jpg deleted file mode 100644 index ee66cf5..0000000 Binary files a/images/backgrounds/bureau.jpg and /dev/null differ diff --git a/images/backgrounds/bureausun.jpg b/images/backgrounds/bureausun.jpg deleted file mode 100644 index 2ecb1be..0000000 Binary files a/images/backgrounds/bureausun.jpg and /dev/null differ diff --git a/images/backgrounds/chambre.jpg b/images/backgrounds/chambre.jpg deleted file mode 100644 index 8cabff2..0000000 Binary files a/images/backgrounds/chambre.jpg and /dev/null differ diff --git a/images/backgrounds/cour.jpg b/images/backgrounds/cour.jpg deleted file mode 100644 index b7404c5..0000000 Binary files a/images/backgrounds/cour.jpg and /dev/null differ diff --git a/images/backgrounds/cuisine.jpg b/images/backgrounds/cuisine.jpg deleted file mode 100644 index 68bd0e6..0000000 Binary files a/images/backgrounds/cuisine.jpg and /dev/null differ diff --git a/images/backgrounds/entree.jpg b/images/backgrounds/entree.jpg deleted file mode 100644 index cd25fde..0000000 Binary files a/images/backgrounds/entree.jpg and /dev/null differ diff --git a/images/backgrounds/litjerome.jpg b/images/backgrounds/litjerome.jpg deleted file mode 100644 index 78796c3..0000000 Binary files a/images/backgrounds/litjerome.jpg and /dev/null differ diff --git a/images/backgrounds/litvincent.jpg b/images/backgrounds/litvincent.jpg deleted file mode 100644 index 2f56534..0000000 Binary files a/images/backgrounds/litvincent.jpg and /dev/null differ diff --git a/images/backgrounds/salon.jpg b/images/backgrounds/salon.jpg deleted file mode 100644 index 1e8b28c..0000000 Binary files a/images/backgrounds/salon.jpg and /dev/null differ diff --git a/images/backgrounds/sdb.jpg b/images/backgrounds/sdb.jpg deleted file mode 100644 index 9288a51..0000000 Binary files a/images/backgrounds/sdb.jpg and /dev/null differ diff --git a/images/backgrounds/wc.jpg b/images/backgrounds/wc.jpg deleted file mode 100644 index bb50a4e..0000000 Binary files a/images/backgrounds/wc.jpg and /dev/null differ diff --git a/images/rooms/medium/balcon.jpg b/images/rooms/medium/balcon.jpg new file mode 100644 index 0000000..5e9947a Binary files /dev/null and b/images/rooms/medium/balcon.jpg differ diff --git a/images/rooms/medium/bureau.jpg b/images/rooms/medium/bureau.jpg new file mode 100644 index 0000000..e25d00c Binary files /dev/null and b/images/rooms/medium/bureau.jpg differ diff --git a/images/rooms/medium/bureausun.jpg b/images/rooms/medium/bureausun.jpg new file mode 100644 index 0000000..3bdde35 Binary files /dev/null and b/images/rooms/medium/bureausun.jpg differ diff --git a/images/rooms/medium/chambre.jpg b/images/rooms/medium/chambre.jpg new file mode 100644 index 0000000..b7139ab Binary files /dev/null and b/images/rooms/medium/chambre.jpg differ diff --git a/images/rooms/medium/cour.jpg b/images/rooms/medium/cour.jpg new file mode 100644 index 0000000..36ede8c Binary files /dev/null and b/images/rooms/medium/cour.jpg differ diff --git a/images/rooms/medium/cuisine.jpg b/images/rooms/medium/cuisine.jpg new file mode 100644 index 0000000..7895241 Binary files /dev/null and b/images/rooms/medium/cuisine.jpg differ diff --git a/images/rooms/medium/entree.jpg b/images/rooms/medium/entree.jpg new file mode 100644 index 0000000..cd25fde Binary files /dev/null and b/images/rooms/medium/entree.jpg differ diff --git a/images/rooms/medium/litjerome.jpg b/images/rooms/medium/litjerome.jpg new file mode 100644 index 0000000..1b72952 Binary files /dev/null and b/images/rooms/medium/litjerome.jpg differ diff --git a/images/rooms/medium/litvincent.jpg b/images/rooms/medium/litvincent.jpg new file mode 100644 index 0000000..2386353 Binary files /dev/null and b/images/rooms/medium/litvincent.jpg differ diff --git a/images/rooms/medium/salon.jpg b/images/rooms/medium/salon.jpg new file mode 100644 index 0000000..fe0c1a4 Binary files /dev/null and b/images/rooms/medium/salon.jpg differ diff --git a/images/rooms/medium/sdb.jpg b/images/rooms/medium/sdb.jpg new file mode 100644 index 0000000..924dcf0 Binary files /dev/null and b/images/rooms/medium/sdb.jpg differ diff --git a/images/rooms/medium/wc.jpg b/images/rooms/medium/wc.jpg new file mode 100644 index 0000000..65fb78f Binary files /dev/null and b/images/rooms/medium/wc.jpg differ diff --git a/images/rooms/originaux/balcon.jpg b/images/rooms/originaux/balcon.jpg new file mode 100644 index 0000000..a5e7e73 Binary files /dev/null and b/images/rooms/originaux/balcon.jpg differ diff --git a/images/rooms/originaux/bureau.jpg b/images/rooms/originaux/bureau.jpg new file mode 100644 index 0000000..2ecb1be Binary files /dev/null and b/images/rooms/originaux/bureau.jpg differ diff --git a/images/rooms/originaux/bureausun.jpg b/images/rooms/originaux/bureausun.jpg new file mode 100644 index 0000000..2ecb1be Binary files /dev/null and b/images/rooms/originaux/bureausun.jpg differ diff --git a/images/rooms/originaux/chambre.jpg b/images/rooms/originaux/chambre.jpg new file mode 100644 index 0000000..8cabff2 Binary files /dev/null and b/images/rooms/originaux/chambre.jpg differ diff --git a/images/rooms/originaux/cour.jpg b/images/rooms/originaux/cour.jpg new file mode 100644 index 0000000..b7404c5 Binary files /dev/null and b/images/rooms/originaux/cour.jpg differ diff --git a/images/rooms/originaux/cuisine.jpg b/images/rooms/originaux/cuisine.jpg new file mode 100644 index 0000000..8ddf21e Binary files /dev/null and b/images/rooms/originaux/cuisine.jpg differ diff --git a/images/rooms/originaux/entree.jpg b/images/rooms/originaux/entree.jpg new file mode 100644 index 0000000..cd25fde Binary files /dev/null and b/images/rooms/originaux/entree.jpg differ diff --git a/images/rooms/originaux/litjerome.jpg b/images/rooms/originaux/litjerome.jpg new file mode 100644 index 0000000..78796c3 Binary files /dev/null and b/images/rooms/originaux/litjerome.jpg differ diff --git a/images/rooms/originaux/litvincent.jpg b/images/rooms/originaux/litvincent.jpg new file mode 100644 index 0000000..2f56534 Binary files /dev/null and b/images/rooms/originaux/litvincent.jpg differ diff --git a/images/rooms/originaux/salon.jpg b/images/rooms/originaux/salon.jpg new file mode 100644 index 0000000..1e8b28c Binary files /dev/null and b/images/rooms/originaux/salon.jpg differ diff --git a/images/rooms/originaux/sdb.jpg b/images/rooms/originaux/sdb.jpg new file mode 100644 index 0000000..9288a51 Binary files /dev/null and b/images/rooms/originaux/sdb.jpg differ diff --git a/images/rooms/originaux/wc.jpg b/images/rooms/originaux/wc.jpg new file mode 100644 index 0000000..bb50a4e Binary files /dev/null and b/images/rooms/originaux/wc.jpg differ diff --git a/images/rooms/small/balcon.jpg b/images/rooms/small/balcon.jpg new file mode 100644 index 0000000..28fbc58 Binary files /dev/null and b/images/rooms/small/balcon.jpg differ diff --git a/images/rooms/small/bureau.jpg b/images/rooms/small/bureau.jpg new file mode 100644 index 0000000..efaea14 Binary files /dev/null and b/images/rooms/small/bureau.jpg differ diff --git a/images/rooms/small/bureausun.jpg b/images/rooms/small/bureausun.jpg new file mode 100644 index 0000000..efaea14 Binary files /dev/null and b/images/rooms/small/bureausun.jpg differ diff --git a/images/rooms/small/chambre.jpg b/images/rooms/small/chambre.jpg new file mode 100644 index 0000000..9f4c83f Binary files /dev/null and b/images/rooms/small/chambre.jpg differ diff --git a/images/rooms/small/cour.jpg b/images/rooms/small/cour.jpg new file mode 100644 index 0000000..339caf7 Binary files /dev/null and b/images/rooms/small/cour.jpg differ diff --git a/images/rooms/small/cuisine.jpg b/images/rooms/small/cuisine.jpg new file mode 100644 index 0000000..fdd2242 Binary files /dev/null and b/images/rooms/small/cuisine.jpg differ diff --git a/images/rooms/small/entree.jpg b/images/rooms/small/entree.jpg new file mode 100644 index 0000000..fb77812 Binary files /dev/null and b/images/rooms/small/entree.jpg differ diff --git a/images/rooms/small/litjerome.jpg b/images/rooms/small/litjerome.jpg new file mode 100644 index 0000000..dfb0690 Binary files /dev/null and b/images/rooms/small/litjerome.jpg differ diff --git a/images/rooms/small/litvincent.jpg b/images/rooms/small/litvincent.jpg new file mode 100644 index 0000000..469d947 Binary files /dev/null and b/images/rooms/small/litvincent.jpg differ diff --git a/images/rooms/small/salon.jpg b/images/rooms/small/salon.jpg new file mode 100644 index 0000000..4fe3d2a Binary files /dev/null and b/images/rooms/small/salon.jpg differ diff --git a/images/rooms/small/sdb.jpg b/images/rooms/small/sdb.jpg new file mode 100644 index 0000000..475ed39 Binary files /dev/null and b/images/rooms/small/sdb.jpg differ diff --git a/images/rooms/small/wc.jpg b/images/rooms/small/wc.jpg new file mode 100644 index 0000000..6b33c6c Binary files /dev/null and b/images/rooms/small/wc.jpg differ diff --git a/index.php b/index.php index f3a5f4c..e671762 100644 --- a/index.php +++ b/index.php @@ -58,12 +58,12 @@ function relativePath($p) diff --git a/js/cordova.js b/js/cordova.js index 7b0e81c..e0872a3 100644 --- a/js/cordova.js +++ b/js/cordova.js @@ -4,9 +4,8 @@ function onDeviceReady() { initCordova(); } - function initCordova() { - console.log('init cordova'); + try { screen.orientation.lock('landscape'); } catch (e) { @@ -20,15 +19,11 @@ function initCordova() { } 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 - }) + window.plugins.intentShim.onIntent(function (intent) { + window.shareurl = intent.extras[window.plugins.intentShim.EXTRA_TEXT]; + window.location.hash = '#/section/switchshare/'; }); - }catch (e){ - + } catch (e) { + console.log(e); } } \ No newline at end of file diff --git a/js/home.js b/js/home.js index fde3b57..dcca7e9 100644 --- a/js/home.js +++ b/js/home.js @@ -122,6 +122,10 @@ $(function () { return false; }); + $(document).on(clickevent, '.switchshare', function () { + window.location = $(this).attr('href') + 'scripts/share.php?text=' + encodeURIComponent(window.shareurl); + }); + $(document).on(clickevent, '[data-volume]', function () { $.get('scripts/volume.php?volume=' + $(this).data('volume') + '%'); return true; diff --git a/scripts/lib/lib.php b/scripts/lib/lib.php index a742e2d..68e603f 100644 --- a/scripts/lib/lib.php +++ b/scripts/lib/lib.php @@ -311,10 +311,15 @@ function shortcut($s, $hash) } else if ($s['type'] == 'ifttt') { $attrs['class'] = 'ifttt'; $attrs['data-event'] = $s['event']; - } else if ($s['type'] == 'switch') { - $h = isset($_GET['h']) && $_GET['h'] ? $_GET['h'] : $_SERVER['HTTP_HOST']; - $attrs['href'] = '//' . $s['room'] . '.home.tortuga.enhydra.fr/?h=' . $h; - $attrs['style'] = 'background-image:url(/images/backgrounds/' . $s['room'] . '.jpg);background-size:cover;color:#fff;text-shadow:3px;'; + } else if ($s['type'] == 'switch' || $s['type'] === 'switchshare') { + $attrs['href'] = '//' . $s['room'] . '.home.tortuga.enhydra.fr/'; + if ($s['type'] == 'share') { + $h = isset($_GET['h']) && $_GET['h'] ? $_GET['h'] : $_SERVER['HTTP_HOST']; + $attrs['href'] .= '?h=' . $h; + } else { + $attrs['class'] = $s['type']; + } + $attrs['style'] = 'background-image:url(/images/rooms/small/' . $s['room'] . '.jpg);background-size:cover;color:#fff;text-shadow:3px;'; } if (isset($s['seen']) && $s['seen']) {