- $(".jot-nav #jot-perms-lnk").parent("li").hide();
-
- // rename the the original div jot-preview-content because the edit function
- // does load the content for the modal from another source and preview won't work
- // if this div would exist twice
- // $("#jot-content #profile-jot-form").attr("id","#profile-jot-form-renamed");
- // $("#jot-content #jot-preview-content").attr("id","#jot-preview-content-renamed");
-
- // 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 move the original jot to the end of the page
- // so the editpost jot would be the first jot in html structure.
- // After closing the modal we move the original jot back to it's orginal position in the html structure.
- //
- // Note: For now it seems to work but this isn't optimal because we have doubled ID names for the jot div's.
- // We need to have a better solution for this in the future.
- $("section #jot-content #profile-jot-form").appendTo("footer #cache-container");
+ $(".jot-nav .jot-perms-lnk").parent("li").addClass("hidden");
+
+ // 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 > #jot-sections");
+
+ // remove the original Jot as long as the edit Jot is open
+ jotcache.remove();
+
+ // add the class "edit" to the modal to have some kind of identifier to
+ // have the possibility to e.g. put special event-listener
+ $("#jot-modal").addClass("edit-jot");