X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=js%2Ffilebrowser.js;h=78cee0e77ed8f7349d4ca434ea60a338cc4e859e;hb=ed9c50ea2e2f3ad261bab215723d4ab8ed0877b4;hp=58d050a743a871dbf3c1cfefef5dfde7851a5fdd;hpb=8be0a2268f6a71092ce339164d68432a3be66c6e;p=friendica.git diff --git a/js/filebrowser.js b/js/filebrowser.js index 58d050a743..78cee0e77e 100644 --- a/js/filebrowser.js +++ b/js/filebrowser.js @@ -51,40 +51,21 @@ * }); **/ - -/* - * IMPORTANT - * - * This is a modified version to work with - * the frio theme.and bootstrap modals - * - * The origninal file is under: - * js/filebrowser.js - * - */ - - var FileBrowser = { nickname : "", type : "", event: "", id : null, - init: function(nickname, type, hash) { + init: function(nickname, type) { FileBrowser.nickname = nickname; FileBrowser.type = type; FileBrowser.event = "fbrowser."+type; - - if (hash!=="") { - var h = hash.replace("#",""); - var destination = h.split("-")[0]; + if (location['hash']!=="") { + var h = location['hash'].replace("#",""); + FileBrowser.event = FileBrowser.event + "." + h.split("-")[0]; FileBrowser.id = h.split("-")[1]; - FileBrowser.event = FileBrowser.event + "." + destination; - 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 ); @@ -95,15 +76,10 @@ var FileBrowser = { $(".folders a, .path a").on("click", function(e){ e.preventDefault(); - var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=modal"; - - // load new content to fbrowser window - $(".fbrowser").load(url,function(){ - $(function() {FileBrowser.init(nickname, type, hash);}); - }); + var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=minimal" + location['hash']; + location.href = url; }); - //embed on click $(".photo-album-photo-link").on('click', function(e){ e.preventDefault(); @@ -115,36 +91,13 @@ var FileBrowser = { // attachment links are "baseurl/attach/id"; we need id embed = "[attachment]"+this.dataset.link.split("/").pop()+"[/attachment]"; } - - // Delete prefilled Text of the comment input - // Note: not the best solution but function commentOpenUI don't - // 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 == aStr.comment){ - 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'); - $("#comment-edit-submit-" + FileBrowser.id).attr('tabindex','10'); - } - - } console.log(FileBrowser.event, this.dataset.filename, embed, FileBrowser.id); parent.$("body").trigger(FileBrowser.event, [ this.dataset.filename, embed, - FileBrowser.id, - this.dataset.img + FileBrowser.id ]); - // close model - $('#modal').modal('hide'); -// if (id!=="") { -// commentExpand(FileBrowser.id); -// //$("#comment-edit-text-558").empty(); -// }; - }); if ($("#upload-image").length) @@ -161,14 +114,8 @@ var FileBrowser = { $('#profile-rotator').hide(); return; } -// location = baseurl + "/fbrowser/image/?mode=modal"+location['hash']; -// location.reload(true); - - var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=modal" - // load new content to fbrowser window - $(".fbrowser").load(url,function(){ - $(function() {FileBrowser.init(nickname, type, hash);}); - }); + location = baseurl + "/fbrowser/image/?mode=minimal"+location['hash']; + location.reload(true); } } ); @@ -186,17 +133,11 @@ var FileBrowser = { $('#profile-rotator').hide(); return; } -// location = baseurl + "/fbrowser/file/?mode=modal"+location['hash']; -// location.reload(true); - - var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=modal" - // load new content to fbrowser window - $(".fbrowser").load(url,function(){ - $(function() {FileBrowser.init(nickname, type, hash);}); - }); + location = baseurl + "/fbrowser/file/?mode=minimal"+location['hash']; + location.reload(true); } } ); - }, + } };