X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Ftheme%2Ffrio%2Fjs%2Fmodal.js;h=b58288318da3b01bc459c00b7fe2793fe42ce8e7;hb=571a4fed99a5aa215d622d140246861bcf44dbce;hp=0a881f10f6f9d5aa06a35cfd94abf508c5c032ef;hpb=c138455c5e25fbb11a12d959d1737de2116d356f;p=friendica.git diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index 0a881f10f6..b58288318d 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -62,6 +62,11 @@ $(document).ready(function(){ toggleJotNav(this); }); + // bookmarklet page needs an jot modal which appears automatically + if(window.location.pathname.indexOf("/bookmarklet") >=0 && $("#jot-modal").length){ + jotShow(); + } + // Open filebrowser for elements with the class "image-select" // The following part handles the filebrowser for field_fileinput.tpl $("body").on("click", ".image-select", function(){ @@ -153,13 +158,22 @@ Dialog._load = function(url) { */ function loadModalTitle() { // clear the text of the title - //$("#modal-title").empty(); + $("#modal-title").empty(); // hide the first element with the class "heading" of the modal body $("#modal-body .heading").first().hide(); + var title = ""; + // get the text of the first element with "heading" class - var title = $("#modal-body .heading").first().text(); + title = $("#modal-body .heading").first().text(); + + // for event modals we need some speacial handling + if($("#modal-body .event-wrapper .event-summary").length) { + title = ' '; + var eventsum = $("#modal-body .event-wrapper .event-summary").text(); + title = title + eventsum; + } // and append it to modal title if (title!=="") { @@ -210,7 +224,7 @@ function editpost(url) { url = url + " #profile-jot-form"; //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 // the page html. To avoid js conflicts we store the original jot in the variable jotcache. @@ -227,7 +241,7 @@ function editpost(url) { jotreset(); modal - .find('#jot-modal-body') + .find('#jot-modal-content') .load(url, function (responseText, textStatus) { if ( textStatus === 'success' || textStatus === 'notmodified') @@ -253,7 +267,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(); @@ -267,15 +281,31 @@ 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"); } +// Wall Message needs a special handling because in some cases +// it redirects you to your own server. In such cases we can't +// load it into a modal +function openWallMessage(url) { + // split the the url in its parts + var parts = parseUrl(url); + + // If the host isn't the same we can't load it in a modal. + // So we will go to to the url directly + if( ("host" in parts) && (parts.host !== window.location.host)) { + window.location.href = url; + } else { + // otherwise load the wall message into a modal + addToModal(url); + } +}