Browse Source

Fixed embedded photo viewer

TC pushbot 5 2 years ago
parent
commit
1846561d94

+ 1 - 0
autopush.bat

@@ -1,5 +1,6 @@
 @echo off
 set /p id="Enter commit notes: "
+del .\.git\index.lock
 git pull
 git add -A
 git commit -m "%id%"

+ 9 - 5
web/Photo/embedded.html

@@ -63,8 +63,8 @@
 </head>
 <body>
     <img id="img" style="max-height: 100vh;max-width: 100%;">
-    <img class="left arrow" onclick="previousImage();" src="embedded/arrow-left.svg">
-    <img class="right arrow" onclick="nextImage();" src="embedded/arrow-right.svg">
+    <img class="left arrow" style="display:none;" onclick="previousImage();" src="embedded/arrow-left.svg">
+    <img class="right arrow" style="display:none;" onclick="nextImage();" src="embedded/arrow-right.svg">
     <img class="zoom in" onclick="zoomIn();" src="embedded/zoom-in.svg">
     <img class="zoom out" onclick="zoomOut();" src="embedded/zoom-out.svg">
     <img class="print" onclick="PrintImage();" src="embedded/print.svg">
@@ -223,7 +223,7 @@
                     alert(data.error);
                 }else{
                     nearbyFileList = data;
-
+                    $(".arrow").css("display", "");
                     //Track which index currently the user is viewing
                     for (var i = 0; i < nearbyFileList.length; i++){
                         var thisPath = nearbyFileList[i];
@@ -270,10 +270,14 @@
             var nextPhoto = currentViewingIndex;
             if (e.keyCode == 37){
                 //<-
-                previousImage();
+                if (nearbyFileList.length > 0){
+                    previousImage();
+                }
             }else if (e.keyCode == 39){
                 //->
-                nextImage();
+                if (nearbyFileList.length > 0){
+                    nextImage();
+                }
             }else{
                 //Invalid keycode to operate
                 return;

+ 5 - 3
web/Photo/embedded/listNearbyImage.js

@@ -12,12 +12,14 @@ function listNearby(){
     dirpath = dirpath.join("/");
 
     //Get nearby files and filter out the one that is web supported photo format
-    var nearbyFiles = filelib.aglob(dirpath + "/*", "user")
+    var nearbyFiles = filelib.readdir(dirpath, "user")
     for (var i = 0; i < nearbyFiles.length; i++){
-        var ext = nearbyFiles[i].split(".").pop();
+        var thisFile = nearbyFiles[i];
+        //console.log(JSON.stringify(nearbyFiles[i]));
+        var ext = thisFile.Ext.substr(1);
         ext = ext.toLowerCase();
         if (ext == "png" || ext == "jpg" || ext == "jpeg" || ext == "gif" || ext == "webp"){
-            result.push(nearbyFiles[i]);
+            result.push(thisFile.Filepath);
         }
     }
 

+ 6 - 1
web/SystemAO/file_system/file_operation.html

@@ -648,7 +648,9 @@
                     switch (progress.StatusFlag) {
                         case 1:
                             if ($("#opricon").attr("src") != "img/paused.png"){
+                                //Show paused UI state
                                 $("#opricon").attr("src", "img/paused.png");
+                                $("#pauseButton").text(applocale.getString("button/resume","Resume"));
                             }
                             break;
                         case 2:
@@ -658,15 +660,18 @@
                             break;
                         default:
                             if ($("#opricon").attr("src") != originalIcon){
+                                //Show 
                                 $("#opricon").attr("src",originalIcon);
+                                $("#pauseButton").text(applocale.getString("button/pause","Pause"));
                             }
                     }
                 }
                 $("#progressbar").css("width", progress.Progress + "%");
                 $("#progress").text(progress.Progress + "%")
-                if (progress.Progress == 100){
+                if (progress.Progress >= 100){
                     //Set progress bar to green
                     $("#progressbar").css("background-color", "#2bba35");
+                    $("#progress").text("100%");
                 }
             }
 

+ 11 - 2
web/desktop.system

@@ -938,6 +938,7 @@
 
             .backgroundtaskObject{
                 padding: 0.4em;
+                padding-right: 0.8em;
                 padding-left: 1.2em;
             }
 
@@ -1130,6 +1131,7 @@
 
     <!-- Background Task Panel -->
     <div id="backgroundTaskPanel" class="" style="display:none;">
+        <!--
         <div class="backgroundtaskObject">
             <small>src > dest (test.mp4)</small>
             <div class="ui grid">
@@ -1151,6 +1153,7 @@
               </div>
               <div class="ui divider" style="margin-top: 0;"></div>
         </div>
+        -->
     </div>
 
     <!-- Content / Quick Access Panel-->
@@ -1449,6 +1452,12 @@
         function updateBackgroundgTaskList(){
             //Update background tasks
             $.get("system/file_system/ongoing", function(tasks){
+
+                tasks.sort(function(a, b) { 
+                    return a.ID > b.ID;
+                });
+
+                console.log(tasks);
                 $("#backgroundTaskPanel").html("");
                 tasks.forEach(function(task){
                     console.log(task);
@@ -1465,14 +1474,14 @@
                     $("#backgroundTaskPanel").append(`<div class="backgroundtaskObject ${pausedClass}">
                         <small>${centerTruncat(task.Src, 22, "...")} <i class="angle right icon"></i> ${centerTruncat(task.Dest, 22, "...")} (${centerTruncat(task.LatestFile, 30, "...")})</small>
                         <div class="ui grid">
-                            <div class="twelve wide column" style="padding-right: 0.4em;">
+                            <div class="twelve wide column" style="padding-right: 0.4em; padding-bottom: 0.4em;">
                                 <div class="ui mini active progress">
                                     <div class="bar" style="width: ${task.Progress}%;">
                                         <div class="progress">${task.Progress}%</div>
                                     </div>
                                 </div>
                             </div>
-                            <div class="four wide column"  style="padding-top: 0.4em; padding-left: 0;" align="right">
+                            <div class="four wide column"  style="padding-top: 0.4em; padding-left: 0;  padding-bottom: 0.4em;" align="right">
                                 <button class="circular ui mini basic icon ${cancelBtnDisabled} button" oprid="${task.ID}" onclick="handleBackgroundTaskPauseToggle('${task.ID}', this, ${task.FileOperationSignal==1});">
                                     <i class="${pauseIcon} icon"></i>
                                 </button>