$(document).ready(function () { $("#discard_draft").click(function(){ if(!confirm("This action will permanently delete the current Draft version! Are you sure?")) { return false; } }); $("#revert").click(function(){ var message = "This action will copy this historic version and make it the new current version."; if ($("#draft_exists").length){ message += "\n\nThere is an active draft; if you continue it will be discarded."; } if (!confirm(message + " Are you sure?")) { return false; } else { var reason = prompt("Please give a short reason for the reversion."); if (!reason) { alert("A reason for the change is required. Please try again."); return false; } var href = $(this).attr("href") + "?reason=" + encodeURI(reason) $(this).attr("href", href) return true; } }); $("#view_history").click(function(){ $(this).replaceWith('

...Loading...

'); $.get("/language/ajax/the-great-game/history/load/", function(data){ $("#view_history").replaceWith(data); }); return false; }); });