FossilRepo

fossilrepo / assets / admin / js / cancel.ecc4c5ca7b32.js
Blame History Raw 30 lines
1
'use strict';
2
{
3
// Call function fn when the DOM is loaded and ready. If it is already
4
// loaded, call the function now.
5
// http://youmightnotneedjquery.com/#ready
6
function ready(fn) {
7
if (document.readyState !== 'loading') {
8
fn();
9
} else {
10
document.addEventListener('DOMContentLoaded', fn);
11
}
12
}
13
14
ready(function() {
15
function handleClick(event) {
16
event.preventDefault();
17
const params = new URLSearchParams(window.location.search);
18
if (params.has('_popup')) {
19
window.close(); // Close the popup.
20
} else {
21
window.history.back(); // Otherwise, go back.
22
}
23
}
24
25
document.querySelectorAll('.cancel-link').forEach(function(el) {
26
el.addEventListener('click', handleClick);
27
});
28
});
29
}
30

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button