forked from php/web-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserprefs.js
42 lines (36 loc) · 1.25 KB
/
userprefs.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
// Get a value of one cookie set by it's name
// Impmentation from the JS 1.3 Client Guide by Netscape
function getCookie(Name)
{
var search = Name + "=";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1) { end = document.cookie.length; }
return unescape(document.cookie.substring(offset, end));
}
}
return null;
}
// Make events in the user's country bold
function boldEvents()
{
// Get cookie if possible
country = getCookie("COUNTRY");
if (typeof(country) == "string") {
// Get country code from cookie
country = country.substring(0, 3);
// If DOM is supported, get <span>s
if (document.getElementsByTagName) {
spans = document.getElementsByTagName("span");
// Style every span bold which is for this country
for (var i = 0; i < spans.length; i++) {
if (spans[i].className == "event_" + country + " vevent") {
spans[i].style.fontWeight = "bold";
}
}
}
}
}