]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/frio/js/filebrowser.js
Merge pull request #6589 from rabuzarus/20190204_-_show_forum_account_in_vcard
[friendica.git] / view / theme / frio / js / filebrowser.js
index 8617e802075c96489c9332d6004b07e6a5308b57..40c0fbb7443bb9daecd3c7f4cd47f1da166548a9 100644 (file)
@@ -81,17 +81,17 @@ var FileBrowser = {
                        var destination = h.split("-")[0];\r
                        FileBrowser.id = h.split("-")[1];\r
                        FileBrowser.event = FileBrowser.event + "." + destination;\r
-                       if (destination == "comment") {\r
+                       if (destination === "comment") {\r
                                // Get the comment textimput field\r
                                var commentElm = document.getElementById("comment-edit-text-" + FileBrowser.id);\r
                        }\r
                };\r
 \r
-               console.log("FileBrowser:", nickname, type,FileBrowser.event, FileBrowser.id );\r
+               console.log("FileBrowser: " + nickname,  type, FileBrowser.event, FileBrowser.id);\r
 \r
                FileBrowser.postLoad();\r
 \r
-               $(".error a.close").on("click", function(e) {\r
+               $(".error .close").on("click", function(e) {\r
                        e.preventDefault();\r
                        $(".error").addClass("hidden");\r
                });\r
@@ -110,12 +110,12 @@ var FileBrowser = {
                        e.preventDefault();\r
 \r
                        var embed = "";\r
-                       if (FileBrowser.type == "image") {\r
-                               embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img][/url]";\r
+                       if (FileBrowser.type === "image") {\r
+                               embed = "[url=" + this.dataset.link + "][img]" + this.dataset.img + "[/img][/url]";\r
                        }\r
-                       if (FileBrowser.type == "file") {\r
+                       if (FileBrowser.type === "file") {\r
                                // attachment links are "baseurl/attach/id"; we need id\r
-                               embed = "[attachment]"+this.dataset.link.split("/").pop()+"[/attachment]";\r
+                               embed = "[attachment]" + this.dataset.link.split("/").pop() + "[/attachment]";\r
                        }\r
 \r
                        // Delete prefilled Text of the comment input\r
@@ -123,7 +123,7 @@ var FileBrowser = {
                        // 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 == "") {\r
+                               if (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
@@ -131,7 +131,9 @@ var FileBrowser = {
                                }\r
 \r
                        }\r
+\r
                        console.log(FileBrowser.event, this.dataset.filename, embed, FileBrowser.id);\r
+\r
                        parent.$("body").trigger(FileBrowser.event, [\r
                                this.dataset.filename,\r
                                embed,\r
@@ -164,19 +166,20 @@ var FileBrowser = {
                        //AjaxUpload for images\r
                        var image_uploader = new window.AjaxUpload(\r
                                'upload-image',\r
-                               {       action: 'wall_upload/'+FileBrowser.nickname+'?response=json&album=' + albumname,\r
+                               {       action: 'wall_upload/' + FileBrowser.nickname + '?response=json&album=' + albumname,\r
                                        name: 'userfile',\r
                                        responseType: 'json',\r
-                                       onSubmit: function(file,ext) {\r
+                                       onSubmit: function(file, ext) {\r
                                                $(".fbrowser-content").hide();\r
                                                $(".fbrowser .profile-rotator-wrapper").show();\r
                                                $(".error").addClass('hidden');\r
                                        },\r
                                        onComplete: function(file,response) {\r
-                                               if (response['error']!= undefined) {\r
+                                               if (response['error'] != undefined) {\r
                                                        $(".error span").html(response['error']);\r
                                                        $(".error").removeClass('hidden');\r
                                                        $(".fbrowser .profile-rotator-wrapper").hide();\r
+                                                       $(".fbrowser-content").show();\r
                                                        return;\r
                                                }\r
 \r
@@ -197,7 +200,7 @@ var FileBrowser = {
                                'upload-file',\r
                                {       action: 'wall_attach/' + FileBrowser.nickname + '?response=json',\r
                                        name: 'userfile',\r
-                                       onSubmit: function(file,ext) {\r
+                                       onSubmit: function(file, ext) {\r
                                                $(".fbrowser-content").hide();\r
                                                $(".fbrowser .profile-rotator-wrapper").show();\r
                                                $(".error").addClass('hidden');\r
@@ -207,6 +210,7 @@ var FileBrowser = {
                                                        $(".error span").html(response['error']);\r
                                                        $(".error").removeClass('hidden');\r
                                                        $('#profile-rotator').hide();\r
+                                                       $(".fbrowser-content").show();\r
                                                        return;\r
                                                }\r
 \r
@@ -229,7 +233,6 @@ var FileBrowser = {
                $(".fbrowser .fbswitcher [data-mode=" + FileBrowser.type + "]").addClass("active");\r
                // We need to add the AjaxUpload to the button\r
                FileBrowser.uploadButtons();\r
-               \r
        },\r
 \r
        // Load new content (e.g. change photo album)\r
@@ -238,7 +241,7 @@ var FileBrowser = {
                $(".fbrowser .profile-rotator-wrapper").show();\r
 \r
                // load new content to fbrowser window\r
-               $(".fbrowser").load(url, function(responseText, textStatus){\r
+               $(".fbrowser").load(url, function(responseText, textStatus) {\r
                        $(".profile-rotator-wrapper").hide();\r
                        if (textStatus === 'success') {\r
                                $(".fbrowser_content").show();\r
@@ -251,7 +254,7 @@ var FileBrowser = {
        initGallery: function() {\r
                $(".fbrowser.image .fbrowser-content-container").justifiedGallery({\r
                        'rowHeight': 80,\r
-                       'margins': 3,\r
+                       'margins': 4,\r
                        'border': 0\r
                });\r
        }\r