~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/php/phpBB3/styles/prosilver/template/styleswitcher.js

  • Committer: dcoles
  • Date: 2008-02-13 04:10:55 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:443
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
function fontsizeup()
 
3
{
 
4
        var active = getActiveStyleSheet();
 
5
 
 
6
        switch (active)
 
7
        {
 
8
                case 'A--':
 
9
                        setActiveStyleSheet('A-');
 
10
                break;
 
11
 
 
12
                case 'A-':
 
13
                        setActiveStyleSheet('A');
 
14
                break;
 
15
 
 
16
                case 'A':
 
17
                        setActiveStyleSheet('A+');
 
18
                break;
 
19
 
 
20
                case 'A+':
 
21
                        setActiveStyleSheet('A++');
 
22
                break;
 
23
 
 
24
                case 'A++':
 
25
                        setActiveStyleSheet('A');
 
26
                break;
 
27
 
 
28
                default:
 
29
                        setActiveStyleSheet('A');
 
30
                break;
 
31
        }
 
32
}
 
33
 
 
34
function fontsizedown()
 
35
{
 
36
        active = getActiveStyleSheet();
 
37
 
 
38
        switch (active)
 
39
        {
 
40
                case 'A++' : 
 
41
                        setActiveStyleSheet('A+');
 
42
                break;
 
43
 
 
44
                case 'A+' : 
 
45
                        setActiveStyleSheet('A');
 
46
                break;
 
47
 
 
48
                case 'A' : 
 
49
                        setActiveStyleSheet('A-');
 
50
                break;
 
51
 
 
52
                case 'A-' : 
 
53
                        setActiveStyleSheet('A--');
 
54
                break;
 
55
 
 
56
                case 'A--' : 
 
57
                break;
 
58
 
 
59
                default :
 
60
                        setActiveStyleSheet('A--');
 
61
                break;
 
62
        }
 
63
}
 
64
 
 
65
function setActiveStyleSheet(title)
 
66
{
 
67
        var i, a, main;
 
68
 
 
69
        for (i = 0; (a = document.getElementsByTagName('link')[i]); i++)
 
70
        {
 
71
                if (a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title'))
 
72
                {
 
73
                        a.disabled = true;
 
74
                        if (a.getAttribute('title') == title)
 
75
                        {
 
76
                                a.disabled = false;
 
77
                        }
 
78
                }
 
79
        }
 
80
}
 
81
 
 
82
function getActiveStyleSheet()
 
83
{
 
84
        var i, a;
 
85
 
 
86
        for (i = 0; (a = document.getElementsByTagName('link')[i]); i++)
 
87
        {
 
88
                if (a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title') && !a.disabled)
 
89
                {
 
90
                        return a.getAttribute('title');
 
91
                }
 
92
        }
 
93
 
 
94
        return null;
 
95
}
 
96
 
 
97
function getPreferredStyleSheet()
 
98
{
 
99
        return ('A-');
 
100
}
 
101
 
 
102
function createCookie(name, value, days)
 
103
{
 
104
        if (days)
 
105
        {
 
106
                var date = new Date();
 
107
                date.setTime(date.getTime() + (days*24*60*60*1000));
 
108
                var expires = '; expires=' + date.toGMTString();
 
109
        }
 
110
        else
 
111
        {
 
112
                expires = '';
 
113
        }
 
114
 
 
115
        document.cookie = name + '=' + value + expires + '; path=/';
 
116
}
 
117
 
 
118
function readCookie(name)
 
119
{
 
120
        var nameEQ = name + '=';
 
121
        var ca = document.cookie.split(';');
 
122
 
 
123
        for (var i = 0; i < ca.length; i++)
 
124
        {
 
125
                var c = ca[i];
 
126
 
 
127
                while (c.charAt(0) == ' ')
 
128
                {
 
129
                        c = c.substring(1, c.length);
 
130
                }
 
131
 
 
132
                if (c.indexOf(nameEQ) == 0)
 
133
                {
 
134
                        return c.substring(nameEQ.length, c.length);
 
135
                }
 
136
        }
 
137
 
 
138
        return null;
 
139
}
 
140
 
 
141
function load_cookie()
 
142
{
 
143
        var cookie = readCookie('style_cookie');
 
144
        var title = cookie ? cookie : getPreferredStyleSheet();
 
145
        setActiveStyleSheet(title);
 
146
}
 
147
 
 
148
function unload_cookie()
 
149
{
 
150
        var title = getActiveStyleSheet();
 
151
        createCookie('style_cookie', title, 365);
 
152
}
 
153
 
 
154
onload_functions.push('load_cookie()');
 
155
onunload_functions.push('unload_cookie()');
 
156
 
 
157
/*
 
158
var cookie = readCookie("style");
 
159
var title = cookie ? cookie : getPreferredStyleSheet();
 
160
setActiveStyleSheet(title);
 
161
*/