]> git.mxchange.org Git - friendica.git/blobdiff - js/filebrowser.js
core
[friendica.git] / js / filebrowser.js
index 58d050a743a871dbf3c1cfefef5dfde7851a5fdd..78cee0e77ed8f7349d4ca434ea60a338cc4e859e 100644 (file)
  *             });\r
  **/\r
 \r
-\r
-/*\r
- * IMPORTANT\r
- * \r
- *  This is a modified version to work with \r
- *  the frio theme.and bootstrap modals\r
- *  \r
- *  The origninal file is under:\r
- *  js/filebrowser.js\r
- * \r
- */\r
-\r
-\r
 var FileBrowser = {\r
        nickname : "",\r
        type : "",\r
        event: "",\r
        id : null,\r
 \r
-       init: function(nickname, type, hash) {\r
+       init: function(nickname, type) {\r
                FileBrowser.nickname = nickname;\r
                FileBrowser.type = type;\r
                FileBrowser.event = "fbrowser."+type;\r
-\r
-               if (hash!=="") {\r
-                       var h = hash.replace("#","");\r
-                       var destination = h.split("-")[0];\r
+               if (location['hash']!=="") {\r
+                       var h = location['hash'].replace("#","");\r
+                       FileBrowser.event = FileBrowser.event + "." + h.split("-")[0];\r
                        FileBrowser.id = h.split("-")[1];\r
-                       FileBrowser.event = FileBrowser.event + "." + destination;\r
-                       if (destination == "comment") {\r
-                               // get the comment textimput field\r
-                               var commentElm = document.getElementById("comment-edit-text-" + FileBrowser.id);\r
-                       }\r
-               };\r
+               }\r
 \r
                console.log("FileBrowser:", nickname, type,FileBrowser.event, FileBrowser.id );\r
 \r
@@ -95,15 +76,10 @@ var FileBrowser = {
 \r
                $(".folders a, .path a").on("click", function(e){\r
                        e.preventDefault();\r
-                       var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=modal";\r
-\r
-                       // load new content to fbrowser window\r
-                       $(".fbrowser").load(url,function(){\r
-                               $(function() {FileBrowser.init(nickname, type, hash);});\r
-                       });\r
+                       var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=minimal" + location['hash'];\r
+                       location.href = url;\r
                });\r
 \r
-               //embed on click\r
                $(".photo-album-photo-link").on('click', function(e){\r
                        e.preventDefault();\r
 \r
@@ -115,36 +91,13 @@ var FileBrowser = {
                                // attachment links are "baseurl/attach/id"; we need id\r
                                embed = "[attachment]"+this.dataset.link.split("/").pop()+"[/attachment]";\r
                        }\r
-\r
-                       // Delete prefilled Text of the comment input\r
-                       // Note: not the best solution but function commentOpenUI don't\r
-                       // work as expected (we need a way to wait until commentOpenUI would be finished).\r
-                       // As for now we insert pieces of this function here\r
-                       if ((commentElm !== null) && (typeof commentElm !== "undefined")) {\r
-                               if (commentElm.value == aStr.comment){\r
-                                       commentElm.value = "";\r
-                                       $("#comment-edit-text-" + FileBrowser.id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty");\r
-                                       $("#comment-edit-submit-wrapper-" + FileBrowser.id).show();\r
-                                       $("#comment-edit-text-" + FileBrowser.id).attr('tabindex','9');\r
-                                       $("#comment-edit-submit-" + FileBrowser.id).attr('tabindex','10');\r
-                               }\r
-\r
-                       }\r
                        console.log(FileBrowser.event, this.dataset.filename, embed, FileBrowser.id);\r
                        parent.$("body").trigger(FileBrowser.event, [\r
                                this.dataset.filename,\r
                                embed,\r
-                               FileBrowser.id,\r
-                               this.dataset.img\r
+                               FileBrowser.id\r
                        ]);\r
 \r
-                       // close model\r
-                       $('#modal').modal('hide');\r
-//                     if (id!=="") {\r
-//                             commentExpand(FileBrowser.id);\r
-//                             //$("#comment-edit-text-558").empty();\r
-//                     };\r
-\r
                });\r
 \r
                if ($("#upload-image").length)\r
@@ -161,14 +114,8 @@ var FileBrowser = {
                                                        $('#profile-rotator').hide();\r
                                                        return;\r
                                                }\r
-//                                             location = baseurl + "/fbrowser/image/?mode=modal"+location['hash'];\r
-//                                             location.reload(true);\r
-\r
-                                               var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=modal"\r
-                                               // load new content to fbrowser window\r
-                                               $(".fbrowser").load(url,function(){\r
-                                                       $(function() {FileBrowser.init(nickname, type, hash);});\r
-                                               });\r
+                                               location = baseurl + "/fbrowser/image/?mode=minimal"+location['hash'];\r
+                                               location.reload(true);\r
                                        }\r
                                }\r
                        );\r
@@ -186,17 +133,11 @@ var FileBrowser = {
                                                        $('#profile-rotator').hide();\r
                                                        return;\r
                                                }\r
-//                                             location = baseurl + "/fbrowser/file/?mode=modal"+location['hash'];\r
-//                                             location.reload(true);\r
-\r
-                                               var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=modal"\r
-                                               // load new content to fbrowser window\r
-                                               $(".fbrowser").load(url,function(){\r
-                                                       $(function() {FileBrowser.init(nickname, type, hash);});\r
-                                               });\r
+                                               location = baseurl + "/fbrowser/file/?mode=minimal"+location['hash'];\r
+                                               location.reload(true);\r
                                        }\r
                                }\r
                );\r
-       },\r
+       }\r
 };\r
 \r