-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
40 lines (36 loc) · 1.18 KB
/
main.js
File metadata and controls
40 lines (36 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(function() {
window.user_name = "sse2cpu";
document.addEventListener("DOMContentLoaded", function() {
$(document).ready(function() {
$(document).on('click', 'a', function(event) {
var url = $(this).attr("href");
if (!url || url.match("^http")) {
return;
}
event.preventDefault();
$("body").load(url, function(event) {
window.scrollTo(0, 0);
history.pushState(null, "", url);
loadNav();
});
});
window.addEventListener("popstate", function() {
var url = location.pathname + location.search;
$("body").load(url, function(event) {
window.scrollTo(0, 0);
history.pushState(null, "", url);
loadNav();
});
});
function loadNav() {
var navbar = $('[data-testid="navbar"]');
if(navbar) {
navbar.load("nav.html");
} else {
console.error("Navigation bar not found on page!");
}
}
loadNav();
});
});
})();