|
@@ -0,0 +1,198 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html>
|
|
|
+ <head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="apple-mobile-web-app-capable" content="yes" />
|
|
|
+ <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
|
|
|
+ <meta name="theme-color" content="#4b75ff">
|
|
|
+ <link rel="stylesheet" href="../script/semantic/semantic.min.css">
|
|
|
+ <script src="../script/jquery.min.js"></script>
|
|
|
+ <script src="../script/semantic/semantic.min.js"></script>
|
|
|
+ <script src="../script/ao_module.js"></script>
|
|
|
+ <title>Camera</title>
|
|
|
+ <style>
|
|
|
+ body{
|
|
|
+ background-color: black;
|
|
|
+ }
|
|
|
+
|
|
|
+ .topcontrol{
|
|
|
+ position: fixed;
|
|
|
+ top: 0px;
|
|
|
+ left: 0px;
|
|
|
+ width: 100%;
|
|
|
+ padding: 8px;
|
|
|
+ z-index: 1000;
|
|
|
+ }
|
|
|
+
|
|
|
+ .clickable{
|
|
|
+ width: 3em;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .right-floated{
|
|
|
+ position: absolute;
|
|
|
+ right: 8px;
|
|
|
+ top: 8px;
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
+
|
|
|
+ .imgwrapper{
|
|
|
+ position: fixed;
|
|
|
+ top: 0px;
|
|
|
+ left: 0px;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ z-index: 10;
|
|
|
+ }
|
|
|
+ .imgbox {
|
|
|
+ display: grid;
|
|
|
+ height: 100%;
|
|
|
+ z-index: 10 !important;
|
|
|
+ }
|
|
|
+ .center-fit {
|
|
|
+ max-width: 100%;
|
|
|
+ max-height: 100vh;
|
|
|
+ margin: auto;
|
|
|
+ z-index: 10;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div class="topcontrol">
|
|
|
+ <div class="clickable" onclick="backToCamera();">
|
|
|
+ <img class="ui mini image" src="img/icons/back-arrow.svg"/>
|
|
|
+ </div>
|
|
|
+ <div class="right-floated">
|
|
|
+ <div class="clickable" onclick="openInFolder();" style="display: inline-block;">
|
|
|
+ <img class="ui mini image" src="img/icons/folder.svg"/>
|
|
|
+ </div>
|
|
|
+ <div class="clickable" onclick="deleteThis();" style="display: inline-block;">
|
|
|
+ <img class="ui mini image" src="img/icons/delete.svg"/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="imgwrapper">
|
|
|
+ <div class="imgbox">
|
|
|
+ <img id="viewpoint" class="center-fit" src='img/place-holder.png'>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <script>
|
|
|
+ let photoList = [];
|
|
|
+ let currentViewingPhoto = 0; //The index of current viewing photo
|
|
|
+ let saveTarget = "user:/Photo/DCIM/";
|
|
|
+
|
|
|
+ function backToCamera(){
|
|
|
+ window.location.href = "index.html";
|
|
|
+ }
|
|
|
+
|
|
|
+ $(document).ready(function(){
|
|
|
+ //Load the latest image
|
|
|
+ ao_module_agirun("Camera/backend/listPhoto.js",{
|
|
|
+ savetarget: saveTarget,
|
|
|
+ }, function(data){
|
|
|
+ if (data.error !== undefined || data == ""){
|
|
|
+ //No photo
|
|
|
+ }else{
|
|
|
+ //Load it
|
|
|
+ currentViewingPhoto = 0;
|
|
|
+ photoList = data;
|
|
|
+ $("#viewpoint").attr('src', '../media/?file=' + data[0]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ function openInFolder(){
|
|
|
+ if (currentViewingPhoto == ""){
|
|
|
+ //Unknown error. open the DCIM folder
|
|
|
+ ao_module_openPath(saveTarget);
|
|
|
+ }else{
|
|
|
+ //Open the folder and highlight the picture
|
|
|
+ var filedata = currentViewingPhoto.split("/");
|
|
|
+ var filename = filedata.pop();
|
|
|
+ var fileRoot = filedata.join("/");
|
|
|
+ ao_module_openPath(fileRoot, filename);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ function nextPhoto(){
|
|
|
+ if (currentViewingPhoto == currentViewingPhoto.length - 1){
|
|
|
+ //Already the last photo
|
|
|
+ }else{
|
|
|
+ renderPhotoByPath(currentViewingPhoto + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function previousPhoto(){
|
|
|
+ if (currentViewingPhoto == 0){
|
|
|
+ //Already the firs photo
|
|
|
+ }else{
|
|
|
+ renderPhotoByPath(currentViewingPhoto - 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function renderPhotoByPath(index){
|
|
|
+ if (photoList[index] != undefined){
|
|
|
+ currentViewingPhoto = index;
|
|
|
+ $("#viewpoint").attr('src', '../media/?file=' + photoList[index]);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ Special code to handle swipe left and right
|
|
|
+
|
|
|
+ */
|
|
|
+
|
|
|
+ document.addEventListener('touchstart', handleTouchStart, false);
|
|
|
+ document.addEventListener('touchmove', handleTouchMove, false);
|
|
|
+
|
|
|
+ var xDown = null;
|
|
|
+ var yDown = null;
|
|
|
+
|
|
|
+ function getTouches(evt) {
|
|
|
+ return evt.touches || // browser API
|
|
|
+ evt.originalEvent.touches; // jQuery
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleTouchStart(evt) {
|
|
|
+ const firstTouch = getTouches(evt)[0];
|
|
|
+ xDown = firstTouch.clientX;
|
|
|
+ yDown = firstTouch.clientY;
|
|
|
+ };
|
|
|
+
|
|
|
+ function handleTouchMove(evt) {
|
|
|
+ if ( ! xDown || ! yDown ) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var xUp = evt.touches[0].clientX;
|
|
|
+ var yUp = evt.touches[0].clientY;
|
|
|
+
|
|
|
+ var xDiff = xDown - xUp;
|
|
|
+ var yDiff = yDown - yUp;
|
|
|
+
|
|
|
+ if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {/*most significant*/
|
|
|
+ if ( xDiff > 0 ) {
|
|
|
+ /* left swipe */
|
|
|
+ nextPhoto();
|
|
|
+ } else {
|
|
|
+ /* right swipe */
|
|
|
+ previousPhoto();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ( yDiff > 0 ) {
|
|
|
+ /* up swipe */
|
|
|
+ } else {
|
|
|
+ /* down swipe */
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /* reset values */
|
|
|
+ xDown = null;
|
|
|
+ yDown = null;
|
|
|
+ };
|
|
|
+ </script>
|
|
|
+ </body>
|
|
|
+</html>
|