-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
91 lines (89 loc) · 3.35 KB
/
script.js
File metadata and controls
91 lines (89 loc) · 3.35 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
(function(){
// Set css for loader
var loaderStyle = '@-webkit-keyframes line-scale {\
0% {\
-webkit-transform: scaley(1);\
transform: scaley(1); }\
50% {\
-webkit-transform: scaley(0.4);\
transform: scaley(0.4); }\
100% {\
-webkit-transform: scaley(1);\
transform: scaley(1); } }\
@keyframes line-scale {\
0% {\
-webkit-transform: scaley(1);\
transform: scaley(1); }\
50% {\
-webkit-transform: scaley(0.4);\
transform: scaley(0.4); }\
100% {\
-webkit-transform: scaley(1);\
transform: scaley(1); } }\
.line-scale > div:nth-child(1) {\
-webkit-animation: line-scale 1s -0.4s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\
animation: line-scale 1s -0.4s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08); }\
.line-scale > div:nth-child(2) {\
-webkit-animation: line-scale 1s -0.3s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\
animation: line-scale 1s -0.3s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08); }\
.line-scale > div:nth-child(3) {\
-webkit-animation: line-scale 1s -0.2s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\
animation: line-scale 1s -0.2s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08); }\
.line-scale > div:nth-child(4) {\
-webkit-animation: line-scale 1s -0.1s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\
animation: line-scale 1s -0.1s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08); }\
.line-scale > div {\
background-color: #1895e6;\
width: 4px;\
height: 30px;\
border-radius: 2px;\
margin: 2.5px;\
-webkit-animation-fill-mode: both;\
animation-fill-mode: both;\
display: inline-block; }\
#fluid-nav-loader {\
position: fixed;\
bottom: 5px;\
right: 25px;\
z-index: 1000;\
display: none;\
}';
// Insert loader style in <head>
var styleElement = document.createElement("style");
styleElement.type = "text/css";
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = loaderStyle;
} else {
styleElement.appendChild(document.createTextNode(loaderStyle));
}
document.getElementsByTagName("head")[0].appendChild(styleElement);
// Insert loader div after footer (hidden by default)
var loaderDiv = '<div id="fluid-nav-loader">\
<div class="line-scale">\
<div></div><div></div><div></div><div></div>\
</div>\
</div>';
document.getElementById('brdfooter').insertAdjacentHTML('beforeend', loaderDiv);
// PJAX links!
pjax.connect({
'container': 'brdmain',
'parseJS': true,
'ready': function(){
console.log("PJAX loaded!");
},
'beforeSend': function(){
document.getElementById('fluid-nav-loader').style.display = "inline-block";
},
'complete': function(){
document.getElementById('fluid-nav-loader').style.display = "none";
},
'success': function(event){
var url = (typeof event.data !== 'undefined') ? event.data.url : '';
console.log("Successfully loaded "+ url);
},
'error': function(event){
var url = (typeof event.data !== 'undefined') ? event.data.url : '';
console.log("Could not load "+ url);
}
});
}());