-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpluggedN.user.js
55 lines (53 loc) · 1.33 KB
/
pluggedN.user.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// ==UserScript==
// @name pluggedN
// @namespace pluggedN.nthitz.github.com
// @description Enhance your Plug.dj Experience
// @include https://plug.dj/*
// @version 1
// @grant none
// ==/UserScript==
function bookmarklet () {
var devMode = false;
var tries = 10;
function waitForAPI() {
if(typeof API === 'undefined') {
tries --;
if(tries > 0) {
setTimeout(waitForAPI,1000)
}
} else {
init();
}
}
var scripts = [];
function init() {
console.log('init');
var server = null;
if(devMode) {
server = 'http://localhost:8000/';
} else {
server = 'https://nthitz.github.io/pluggedN/';
}
scripts = [
server + 'dat.gui.js',
server + 'theme.js',
server + 'bookmarklet.js'
]
loadScripts()
/*
$.getScript(server + 'dat.gui.js',function() {
$.getScript(server + 'theme.js', function() {
$.getScript(server + 'bookmarklet.js');
});
})
*/
}
function loadScripts() {
if(scripts.length > 0) {
var script = scripts.shift()
$.getScript(script, loadScripts)
}
}
waitForAPI()
}
bookmarklet();