X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Ftheme%2Ffrio%2Fjs%2Fmodal.js;h=82b1ebdb919db133baade1a63cf15efc32f9e09e;hb=7c9a0ec4594fa6d45cc615f8bde914bcc131226d;hp=15a4f7f6e63905ec515071c5c841416d4b7d2a5a;hpb=9f99f37975600b19dd412aaa58bcd1d078f86499;p=friendica.git diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index 15a4f7f6e6..82b1ebdb91 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -204,6 +204,19 @@ function addToModal(url) { }); } +// Add a element (by it's id) to a bootstrap modal +function addElmToModal(id) { + var elm = $(id).html(); + var modal = $('#modal').modal(); + + modal + .find('#modal-body') + .append(elm) + .modal.show; + + loadModalTitle(); +} + // function to load the html from the edit post page into // the jot modal function editpost(url) { @@ -221,15 +234,15 @@ function editpost(url) { } var modal = $('#jot-modal').modal(); - url = url + " #profile-jot-form"; + url = url + " #jot-sections"; //var rand_num = random_digits(12); - $(".jot-nav #jot-perms-lnk").parent("li").hide(); + $(".jot-nav .jot-perms-lnk").parent("li").addClass("hidden"); - // For editpost we load the modal html form the edit page. So we would have two jot forms in + // For editpost we load the modal html of "jot-sections" of the edit page. So we would have two jot forms in // the page html. To avoid js conflicts we store the original jot in the variable jotcache. // After closing the modal original jot should be restored at its orginal position in the html structure. - jotcache = $("#jot-content > #profile-jot-form"); + jotcache = $("#jot-content > #jot-sections"); // remove the original Jot as long as the edit Jot is open jotcache.remove(); @@ -241,7 +254,7 @@ function editpost(url) { jotreset(); modal - .find('#jot-modal-body') + .find('#jot-modal-content') .load(url, function (responseText, textStatus) { if ( textStatus === 'success' || textStatus === 'notmodified') @@ -267,7 +280,7 @@ function jotreset() { // We need this to prevent that the modal displays old content $('body').on('hidden.bs.modal', '#jot-modal.edit-jot', function () { $(this).removeData('bs.modal'); - $(".jot-nav #jot-perms-lnk").parent("li").show(); + $(".jot-nav .jot-perms-lnk").parent("li").removeClass("hidden"); $("#profile-jot-form #jot-title-wrap").show(); $("#profile-jot-form #jot-category-wrap").show(); @@ -281,14 +294,14 @@ function jotreset() { // remove the "edit-jot" class so we can the standard behavior on close $("#jot-modal.edit-jot").removeClass("edit-jot"); - $("#jot-modal-body").empty(); + $("#jot-modal-content").empty(); }); } // Give the active "jot-nav" list element the class "active" function toggleJotNav (elm) { // select all li of jot-nav and remove the active class - $(elm).closest(".jot-nav").children("li").removeClass("active"); + $(".jot-nav li").removeClass("active"); // add the active class to the parent of the link which was selected $(elm).parent("li").addClass("active"); }