-
Notifications
You must be signed in to change notification settings - Fork 94
/
ajaxify-bookmarklet-helper.js
37 lines (31 loc) · 1.54 KB
/
ajaxify-bookmarklet-helper.js
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
(function (window, undefined) {
"use strict";
// jQuery
window.jQuery || document.write('<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"><\/script>');
// History & ScrollTo (Wait for jQuery)
var interval = setInterval(function () {
if (window.jQuery) {
clearInterval(interval);
// History.js & ScrollTo.js
window.History || document.write('<script src="//browserstate.github.io/history.js/scripts/bundled/html4+html5/jquery.history.js"><\/script>');
jQuery.ScrollTo || document.write('<script src="//balupton.github.io/jquery-scrollto/lib/jquery-scrollto.js"><\/script>');
interval = setInterval(function () {
if (window.History && window.History.initHtml4) {
clearInterval(interval);
// Ajaxify-html5.js
document.write('<script src="//rawgithub.com/browserstate/ajaxify/master/ajaxify-html5.js"><\/script>');
interval = setInterval(function () {
if (jQuery.fn.ajaxify) {
clearInterval(interval);
alert('History.js It! Is ready for action!');
}
}, 500);
} else if (console && console.log) {
console.log("Loading history.js and scrollto.js");
}
}, 500);
} else if (console && console.log) {
console.log("Loading jQuery");
}
}, 500);
}(window));