SinkDark/myblog/static/admin/js/cancel.js
2024-09-17 17:30:58 +08:00

14 lines
410 B
JavaScript

(function($) {
'use strict';
$(function() {
$('.cancel-link').on('click', function(e) {
e.preventDefault();
if (window.location.search.indexOf('&_popup=1') === -1) {
window.history.back(); // Go back if not a popup.
} else {
window.close(); // Otherwise, close the popup.
}
});
});
})(django.jQuery);