Skip to content

Commit cad327c

Browse files
committed
Fix demo
1 parent a38a61d commit cad327c

4 files changed

Lines changed: 62 additions & 28 deletions

File tree

demo.html

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,24 @@
77
height: 3px;
88
background-color: #FFC01F;
99
}
10+
.pace-inactive {
11+
display: none;
12+
}
1013
</style>
1114

15+
<script>
16+
paceOptions = {
17+
elements: {
18+
selectors: ['.x']
19+
}
20+
};
21+
</script>
1222
<script src="pace.js"></script>
1323
<script>
1424
function load(time){
15-
$.ajax({
16-
url: "http://localhost:5646/" + time,
17-
complete: function(){
18-
console.log('done', arguments);
19-
}
20-
});
25+
var x = new XMLHttpRequest()
26+
x.open('GET', "http://localhost:5646/" + time, true);
27+
x.send();
2128
};
2229

2330
load(20);
@@ -28,8 +35,10 @@
2835

2936

3037
setTimeout(function(){
31-
$('body').append($('<div class="x"></div>'));
32-
}, 4000);
38+
var el = document.createElement("div");
39+
el.className = 'x';
40+
document.body.appendChild(el);
41+
}, 10000);
3342

3443
</script>
3544
</head>

pace.coffee

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,8 @@ getFromDOM = (key='options', json=true) ->
9393
console.error "Error parsing inline pace options", e
9494

9595
window.Pace ?= {}
96-
Pace.options ?= {}
9796

98-
options = extend Pace?.options, getFromDOM(), defaultOptions
97+
options = Pace.options = extend defaultOptions, window.paceOptions, getFromDOM()
9998

10099
if domTheme = getFromDOM('theme', false)
101100
options.theme = domTheme
@@ -403,7 +402,7 @@ do init = ->
403402

404403
for type in ['ajax', 'elements', 'document', 'eventLag']
405404
if options[type] isnt false
406-
sources.push new ELEMENT_KEYS[type](options[type])
405+
sources.push new SOURCE_KEYS[type](options[type])
407406

408407
bar = new Bar
409408

@@ -430,7 +429,7 @@ Pace.restart = ->
430429
Pace.stop()
431430
Pace.go()
432431

433-
Page.go = ->
432+
Pace.go = ->
434433
bar.render()
435434

436435
cancelAnimation = false

pace.js

Lines changed: 41 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)