Selaa lähdekoodia

Added multi selection for mobile on File Manager

TC pushbot 5 4 vuotta sitten
vanhempi
commit
0a5711ce51

+ 46 - 2
web/SystemAO/file_system/file_explorer.html

@@ -1021,6 +1021,9 @@
             <div class="item singleObjectOnlyHide" onclick="shareFile();">
                 <i class="share alternate icon"></i> Share
             </div>
+            <div class="item mobileonly" onclick="toggleCtrl();">
+                <i class="mouse pointer icon"></i> Multi-select
+            </div>
             <div class="item" onclick="copy();">
                 <i class="copy icon"></i> Copy
                 <span class="description">Ctrl + C</span>
@@ -1779,7 +1782,7 @@
             var lastClickedFileID = 0;
             function bindFileObjectEvents(){
                 $(".fileObject").off("click").on('click',function(evt){
-                    if (isMobile){
+                    if (!ctrlHold && isMobile){
                         //If on mobile, click means open
                         openthis(this,evt);
                         return
@@ -1862,6 +1865,35 @@
                 $(".fileObject").off("contextmenu").on("contextmenu", function(evt){
                     evt.preventDefault();
                    
+                    if (isFirefox && isMobile){
+                        //Firefox Mobile. Fix select with context menu not working bug
+                        var selectedObject = $(evt.target);
+                        
+                       if ($(selectedObject).hasClass("fileObject")){
+                           if (!ctrlHold){
+                                $(".fileObject.selected").removeClass("selected");
+                           }
+                            $(selectedObject).addClass("selected");
+                       }else{
+                           //Uptrace 5 layers for fileObject
+                           for (var i = 0; i < 5; i++){
+                                if ($(selectedObject).hasClass("fileObject") == false){
+                                    selectedObject = $(selectedObject).parent();
+                                }else{
+                                    break;
+                                }
+                           }
+
+                           if (!ctrlHold){
+                                $(".fileObject.selected").removeClass("selected");
+                           }
+                            $(selectedObject).addClass("selected");
+                       }
+
+                    }
+
+
+
                     calculateContextMenuOffsets(evt);
 
                     //Show all options by defaults
@@ -1893,6 +1925,12 @@
                         $("#contextmenu").css("top",window.innerHeight - $("#contextmenu").height() + "px");
                     }
 
+                    if (isMobile){
+                        $("#contextmenu").find(".mobileonly").show();
+                    }else{
+                        $("#contextmenu").find(".mobileonly").hide();
+                    }
+
                 });
 
                 //Right click on empty space of the file selector
@@ -2691,7 +2729,7 @@
                     var downloadURL = "/media?file=" + encodeURIComponent($(".fileObject.selected").attr("filepath")) + "&download=true";
                     var filename = $(".fileObject.selected").attr("filename");
                     generateDownloadFromURL(downloadURL,escape(filename));
-                }else{
+                }else if ($(".fileObject.selected").length > 1){
                     //Do zip and download for multiple files
                     $(".fileObject.selected").each(function(){
                         fileList.push($(this).attr("filepath"));
@@ -2712,6 +2750,8 @@
                         }
                     });
                     
+                }else{
+                    alert("No file selected!")
                 }
                 
             }
@@ -4423,6 +4463,10 @@
             }
         }
 
+        function toggleCtrl(){
+            ctrlHold = !ctrlHold;
+        }
+
         function appendUploadFileItem(filename, filesize){
             var newuuid = uuidv4();
             var humanReadableFilesize = bytesToSize(filesize);

BIN
web/TorrentA/img/desktop_icon.png


BIN
web/TorrentA/img/desktop_icon.psd


BIN
web/TorrentA/img/function_icon.png


BIN
web/TorrentA/img/function_icon.psd


BIN
web/TorrentA/img/small_icon.png


BIN
web/TorrentA/img/small_icon.psd


+ 0 - 37
web/TorrentA/index.html

@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <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 charset="UTF-8">
-        <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/ao_module.js"></script>
-        <script src="../script/semantic/semantic.min.js"></script>
-        <title>TorrentA</title>
-        <style>
-            body{
-                background-color:white;
-            }
-        </style>
-    </head>
-    <body>
-        <br>
-        <div class="ui container">
-            <h1>Hello World</h1>
-            <p>This WebApp is still work in progress</p>
-        </div>
-        
-        <script>
-            var flist = ao_module_loadInputFiles();
-            if (flist == null){
-                
-            }else{
-               
-            }
-
-         
-        </script>
-    </body>
-</html>

+ 0 - 29
web/TorrentA/init.agi

@@ -1,29 +0,0 @@
-/*
-	TorrentA 
-	authro: tobychui
-
-	
-*/
-
-
-//Define the launchInfo for the module
-var moduleLaunchInfo = {
-    Name: "TorrentA",
-	Group: "Download",
-	IconPath: "TorrentA/img/small_icon.png",
-	Version: "0.1",
-	StartDir: "TorrentA/index.html",
-	SupportFW: true,
-	LaunchFWDir: "TorrentA/index.html",
-	SupportEmb: true,
-	LaunchEmb: "TorrentA/embedded.html",
-	InitFWSize: [1150, 640],
-	InitEmbSize: [1150, 640],
-	SupportedExt: [".torrent"]
-}
-
-//Require aria2
-requirepkg("aria2",true)
-
-//Register the module
-registerModule(JSON.stringify(moduleLaunchInfo));