X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Ftheme%2Ffrio%2Fjs%2Ffilebrowser.js;h=40c0fbb7443bb9daecd3c7f4cd47f1da166548a9;hb=cf9a65cded8e8f270aedbb3ba46d5fe2fe351b4c;hp=8617e802075c96489c9332d6004b07e6a5308b57;hpb=835e54dfc367a30f714d8369857c5c575fb77eae;p=friendica.git diff --git a/view/theme/frio/js/filebrowser.js b/view/theme/frio/js/filebrowser.js index 8617e80207..40c0fbb744 100644 --- a/view/theme/frio/js/filebrowser.js +++ b/view/theme/frio/js/filebrowser.js @@ -81,17 +81,17 @@ var FileBrowser = { var destination = h.split("-")[0]; FileBrowser.id = h.split("-")[1]; FileBrowser.event = FileBrowser.event + "." + destination; - if (destination == "comment") { + if (destination === "comment") { // Get the comment textimput field var commentElm = document.getElementById("comment-edit-text-" + FileBrowser.id); } }; - console.log("FileBrowser:", nickname, type,FileBrowser.event, FileBrowser.id ); + console.log("FileBrowser: " + nickname, type, FileBrowser.event, FileBrowser.id); FileBrowser.postLoad(); - $(".error a.close").on("click", function(e) { + $(".error .close").on("click", function(e) { e.preventDefault(); $(".error").addClass("hidden"); }); @@ -110,12 +110,12 @@ var FileBrowser = { e.preventDefault(); var embed = ""; - if (FileBrowser.type == "image") { - embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img][/url]"; + if (FileBrowser.type === "image") { + embed = "[url=" + this.dataset.link + "][img]" + this.dataset.img + "[/img][/url]"; } - if (FileBrowser.type == "file") { + if (FileBrowser.type === "file") { // attachment links are "baseurl/attach/id"; we need id - embed = "[attachment]"+this.dataset.link.split("/").pop()+"[/attachment]"; + embed = "[attachment]" + this.dataset.link.split("/").pop() + "[/attachment]"; } // Delete prefilled Text of the comment input @@ -123,7 +123,7 @@ var FileBrowser = { // work as expected (we need a way to wait until commentOpenUI would be finished). // As for now we insert pieces of this function here if ((commentElm !== null) && (typeof commentElm !== "undefined")) { - if (commentElm.value == "") { + if (commentElm.value === "") { $("#comment-edit-text-" + FileBrowser.id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty"); $("#comment-edit-submit-wrapper-" + FileBrowser.id).show(); $("#comment-edit-text-" + FileBrowser.id).attr('tabindex','9'); @@ -131,7 +131,9 @@ var FileBrowser = { } } + console.log(FileBrowser.event, this.dataset.filename, embed, FileBrowser.id); + parent.$("body").trigger(FileBrowser.event, [ this.dataset.filename, embed, @@ -164,19 +166,20 @@ var FileBrowser = { //AjaxUpload for images var image_uploader = new window.AjaxUpload( 'upload-image', - { action: 'wall_upload/'+FileBrowser.nickname+'?response=json&album=' + albumname, + { action: 'wall_upload/' + FileBrowser.nickname + '?response=json&album=' + albumname, name: 'userfile', responseType: 'json', - onSubmit: function(file,ext) { + onSubmit: function(file, ext) { $(".fbrowser-content").hide(); $(".fbrowser .profile-rotator-wrapper").show(); $(".error").addClass('hidden'); }, onComplete: function(file,response) { - if (response['error']!= undefined) { + if (response['error'] != undefined) { $(".error span").html(response['error']); $(".error").removeClass('hidden'); $(".fbrowser .profile-rotator-wrapper").hide(); + $(".fbrowser-content").show(); return; } @@ -197,7 +200,7 @@ var FileBrowser = { 'upload-file', { action: 'wall_attach/' + FileBrowser.nickname + '?response=json', name: 'userfile', - onSubmit: function(file,ext) { + onSubmit: function(file, ext) { $(".fbrowser-content").hide(); $(".fbrowser .profile-rotator-wrapper").show(); $(".error").addClass('hidden'); @@ -207,6 +210,7 @@ var FileBrowser = { $(".error span").html(response['error']); $(".error").removeClass('hidden'); $('#profile-rotator').hide(); + $(".fbrowser-content").show(); return; } @@ -229,7 +233,6 @@ var FileBrowser = { $(".fbrowser .fbswitcher [data-mode=" + FileBrowser.type + "]").addClass("active"); // We need to add the AjaxUpload to the button FileBrowser.uploadButtons(); - }, // Load new content (e.g. change photo album) @@ -238,7 +241,7 @@ var FileBrowser = { $(".fbrowser .profile-rotator-wrapper").show(); // load new content to fbrowser window - $(".fbrowser").load(url, function(responseText, textStatus){ + $(".fbrowser").load(url, function(responseText, textStatus) { $(".profile-rotator-wrapper").hide(); if (textStatus === 'success') { $(".fbrowser_content").show(); @@ -251,7 +254,7 @@ var FileBrowser = { initGallery: function() { $(".fbrowser.image .fbrowser-content-container").justifiedGallery({ 'rowHeight': 80, - 'margins': 3, + 'margins': 4, 'border': 0 }); }