Mercurial > hg > digilib-old
annotate xul/content/settings.js @ 408:bd95a59ba0f9
moved styles to a separate stylesheet
author | hertzhaft |
---|---|
date | Tue, 13 Dec 2005 13:30:29 +0100 |
parents | bf945fcf9105 |
children |
rev | line source |
---|---|
203
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
1 /* |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
2 Copyright (C) 2003 WTWG, Uni Bern |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
3 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
4 This program is free software; you can redistribute it and/or |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
5 modify it under the terms of the GNU General Public License |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
6 as published by the Free Software Foundation; either version 2 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
7 of the License, or (at your option) any later version. |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
8 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
12 GNU General Public License for more details. |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
13 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
15 along with this program; if not, write to the Free Software |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
17 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
18 Author: Christian Luginbuehl, 24.01.2004 , Version Alcatraz 0.5 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
19 */ |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
20 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
21 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
22 include(jslib_dirutils); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
23 include(jslib_file); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
24 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
25 var du = new DirUtils(); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
26 var f = new File('alcatraz.pref'); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
27 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
28 f.initPath(du.getPrefsDir()); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
29 f.append('alcatraz.pref'); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
30 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
31 function getSetting(name) { |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
32 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
33 if (f.exists()) { |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
34 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
35 f.open(); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
36 var content = f.read(); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
37 f.close(); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
38 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
39 var lines = content.split(/\n/); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
40 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
41 for (i = 0; i <lines.length; i++) { |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
42 var line = lines[i].split('='); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
43 if (line[0] == name) { |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
44 return line[1]; |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
45 } |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
46 } |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
47 } |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
48 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
49 return null; |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
50 } |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
51 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
52 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
53 function saveSetting(name, value) { |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
54 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
55 var content = ""; |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
56 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
57 if (f.exists()) { |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
58 f.open(); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
59 content = f.read(); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
60 f.close(); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
61 f.remove(); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
62 } |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
63 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
64 f.create(); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
65 f.open('w'); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
66 f.write(name + '=' + value + '\n'); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
67 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
68 var lines = content.split(/\n/); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
69 |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
70 for (i = 0; i < lines.length; i++) { |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
71 var line = lines[i].split('='); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
72 if (line[0] != name && line[0] != '') { |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
73 f.write(line[0] + '=' + line[1] + '\n'); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
74 } |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
75 } |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
76 f.close(); |
bf945fcf9105
restarting with version control of xul sidebar/toolbar
luginbue
parents:
diff
changeset
|
77 } |