forked from justinfrankel/WHUMP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
70 lines (46 loc) · 1.84 KB
/
README
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
WHUMP v0.x
Web HTML Universal Music Player
Copyright (C) 2015 Cockos Inc
License: GPL
To use, option 1:
Make a file whump_config.js and put it with whump.html:
// can override pl_fntitle, db_fntitle, or fntourl() definitions
function whump_init() {
document.title = "test";
document.getElementById("thdr").innerHTML = "WHUMP-test";
document.getElementById("foot").innerHTML = "Powered by WHUMP";
request_db("database-file.txt"); // can include multiple lines of these if you like
};
To use, option 2:
(if you want search-engines getting your page and don't want the additional javascript file)
Search and replace, e.g. in PHP:
$init_code = 'request_db("database-file.txt");' // can include multiple statements
echo str_replace('<title>WHUMP</title>','<title>test</title>',
str_replace('<div id="thdr"></div>', '<div id="thdr">WHUMP-test</div>',
str_replace('<script src="whump_config.js"></script>','',
str_replace('<div id="foot"></div>', '<div id="foot">Powered by WHUMP</div>',
str_replace('whump_init();', $init_code,
file_get_contents("whump.html"))))));
--------
database-file.txt can be a URL, and the contents of which should be zero or more lines of (tab delimited):
; Prepopulated playlist item:
pre URL
; Item in database:
item URL length_in_seconds
--------
BONUS: want to modify the CSS without having to modify the .html file? Use the following javascript:
function getcssrule(name) {
if (!document.styleSheets) return false;
var ss=document.styleSheets[0],c=0;
for (;;) {
for (var i = 0; i < ss.cssRules.length; i ++) {
var r = ss.cssRules ? ss.cssRules[i] : ss.rules[i];
if (r && r.selectorText.toLowerCase()==name) return r;
}
if (c++) return false;
if (ss.addRule) ss.addRule(name, null,0);
else ss.insertRule(name+" { }", 0);
}
}
Example:
getcssrule("#foot a").style.color = "black";