فهرست منبع

Added sequential thumbnail loading when fallback in file explorer

TC pushbot 5 4 سال پیش
والد
کامیت
f636b087bc
2فایلهای تغییر یافته به همراه29 افزوده شده و 10 حذف شده
  1. 27 10
      web/SystemAO/file_system/file_explorer.html
  2. 2 0
      web/SystemAO/locale/authreq.json

+ 27 - 10
web/SystemAO/file_system/file_explorer.html

@@ -1896,24 +1896,41 @@
                 };
             }
 
+            
             function startFallbackThumbnailLoader(){
                 let startingCurrentDir = currentPath;
+                let fallbackRenderList = [];
                 $(".fileObject").each(function(){
                     let filepath = $(this).attr("filepath");
                     let targetDOM = $(this);
-                    $.ajax({
-                        url: "../../system/file_system/loadThumbnail",
-                        data: {vpath: filepath},
-                        success: function(data){
-                            if (startingCurrentDir == currentPath){
-                                //User still not changed page
-                                if (data.error == undefined && typeof data != "undefined" && data != ""){
-                                    $(targetDOM).find("img").attr("src","data:image/jpg;base64," + data);
-                                }
+                    if ($(this).attr("type") != "folder"){
+                        fallbackRenderList.push([filepath, targetDOM]);
+                    }
+                });
+
+                doThumbnailSequentialLoading(startingCurrentDir, fallbackRenderList, 0);
+            }
+
+            function doThumbnailSequentialLoading(startingCurrentDir, renderlist, index){
+                let filepath = renderlist[index][0];
+                let targetDOM = renderlist[index][1];
+                $.ajax({
+                    url: "../../system/file_system/loadThumbnail",
+                    data: {vpath: filepath},
+                    success: function(data){
+                        if (startingCurrentDir == currentPath){
+                            //User still not changed page
+                            if (data.error == undefined && typeof data != "undefined" && data != ""){
+                                $(targetDOM).find("img").attr("src","data:image/jpg;base64," + data);
                             }
                             
+                            if (index < renderlist.length - 1){
+                                doThumbnailSequentialLoading(startingCurrentDir, renderlist, index + 1);
+                            }
+                        }else{
+                            //User changed page. End the sequence
                         }
-                    })
+                    }
                 });
             }
 

+ 2 - 0
web/SystemAO/locale/authreq.json

@@ -3,6 +3,7 @@
     "version": "1.0",
     "keys": {
         "zh-tw": {
+            "fontFamily":"\"Microsoft JhengHei\",\"SimHei\", \"Apple LiGothic Medium\", \"STHeiti\"",
             "strings":{
                 "page/title" : "管理員身份驗證 ",
                 "button/confirm":"確認",
@@ -15,6 +16,7 @@
             }
         }, 
         "zh-hk": {
+            "fontFamily":"\"Microsoft JhengHei\",\"SimHei\", \"Apple LiGothic Medium\", \"STHeiti\"",
             "strings":{
                 "page/title" : "管理員身份驗證 ",
                 "button/confirm":"確認",