Mercurial > hg > digilib
comparison xul/content/dialog_colors.js @ 199:49cb8a445126
restarting with version control of xul sidebar/toolbar
author | luginbue |
---|---|
date | Fri, 27 Feb 2004 11:24:53 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
198:c50e0e77d697 | 199:49cb8a445126 |
---|---|
1 /* | |
2 Copyright (C) 2003 WTWG, Uni Bern | |
3 | |
4 This program is free software; you can redistribute it and/or | |
5 modify it under the terms of the GNU General Public License | |
6 as published by the Free Software Foundation; either version 2 | |
7 of the License, or (at your option) any later version. | |
8 | |
9 This program is distributed in the hope that it will be useful, | |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 GNU General Public License for more details. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
15 along with this program; if not, write to the Free Software | |
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | |
17 | |
18 Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3 | |
19 */ | |
20 | |
21 function markCurrentColors() { | |
22 | |
23 var add = opener.content.getParameter('rgba'); | |
24 var mult = opener.content.getParameter('rgbm'); | |
25 | |
26 if ( add == '' ) { | |
27 add = "0/0/0"; | |
28 } | |
29 | |
30 if ( mult == '' ) { | |
31 mult = "0/0/0"; | |
32 } | |
33 | |
34 add = add.split("/"); | |
35 mult = mult.split("/"); | |
36 | |
37 var items = document.getElementById('add_red_popup').childNodes; | |
38 | |
39 for ( i = 0; i < items.length; i++ ) { | |
40 if ( parseFloat(items[i].getAttribute('value')) == parseFloat(add[0]) ) { | |
41 document.getElementById('add_red_list').selectedItem = items[i]; | |
42 } | |
43 } | |
44 | |
45 items = document.getElementById('add_green_popup').childNodes; | |
46 | |
47 for ( i = 0; i < items.length; i++ ) { | |
48 if ( parseFloat(items[i].getAttribute('value')) == parseFloat(add[1]) ) { | |
49 document.getElementById('add_green_list').selectedItem = items[i]; | |
50 } | |
51 } | |
52 | |
53 items = document.getElementById('add_blue_popup').childNodes; | |
54 | |
55 for ( i = 0; i < items.length; i++ ) { | |
56 if ( parseFloat(items[i].getAttribute('value')) == parseFloat(add[2]) ) { | |
57 document.getElementById('add_blue_list').selectedItem = items[i]; | |
58 } | |
59 } | |
60 | |
61 items = document.getElementById('mult_red_popup').childNodes; | |
62 | |
63 for ( i = 0; i < items.length; i++ ) { | |
64 if ( parseFloat(items[i].getAttribute('value')) == parseFloat(mult[0]) ) { | |
65 document.getElementById('mult_red_list').selectedItem = items[i]; | |
66 } | |
67 } | |
68 | |
69 items = document.getElementById('mult_green_popup').childNodes; | |
70 | |
71 for ( i = 0; i < items.length; i++ ) { | |
72 if ( parseFloat(items[i].getAttribute('value')) == parseFloat(mult[1]) ) { | |
73 document.getElementById('mult_green_list').selectedItem = items[i]; | |
74 } | |
75 } | |
76 | |
77 items = document.getElementById('mult_blue_popup').childNodes; | |
78 | |
79 for ( i = 0; i < items.length; i++ ) { | |
80 if ( parseFloat(items[i].getAttribute('value')) == parseFloat(mult[2]) ) { | |
81 document.getElementById('mult_blue_list').selectedItem = items[i]; | |
82 } | |
83 } | |
84 | |
85 | |
86 } | |
87 | |
88 | |
89 function change() { | |
90 | |
91 var old_add = opener.content.getParameter('rgba'); | |
92 var old_mult = opener.content.getParameter('rgbm'); | |
93 | |
94 var add = new Array(); | |
95 var mult = new Array(); | |
96 | |
97 if ( old_add == '' ) { | |
98 old_add = "0/0/0"; | |
99 } | |
100 | |
101 if ( old_mult == '' ) { | |
102 old_mult = "0/0/0"; | |
103 } | |
104 | |
105 | |
106 var items = document.getElementById('add_red_popup').childNodes; | |
107 | |
108 for ( i = 0; i <items.length; i++ ) { | |
109 if ( items[i].getAttribute('selected') == 'true' ) { | |
110 add[0] = items[i].getAttribute('value'); | |
111 } | |
112 } | |
113 | |
114 items = document.getElementById('add_green_popup').childNodes; | |
115 | |
116 for ( i = 0; i <items.length; i++ ) { | |
117 if ( items[i].getAttribute('selected') == 'true' ) { | |
118 add[1] = items[i].getAttribute('value'); | |
119 } | |
120 } | |
121 | |
122 items = document.getElementById('add_blue_popup').childNodes; | |
123 | |
124 for ( i = 0; i <items.length; i++ ) { | |
125 if ( items[i].getAttribute('selected') == 'true' ) { | |
126 add[2] = items[i].getAttribute('value'); | |
127 } | |
128 } | |
129 | |
130 add = add.join("/"); | |
131 | |
132 items = document.getElementById('mult_red_popup').childNodes; | |
133 | |
134 for ( i = 0; i <items.length; i++ ) { | |
135 if ( items[i].getAttribute('selected') == 'true' ) { | |
136 mult[0] = items[i].getAttribute('value'); | |
137 } | |
138 } | |
139 | |
140 items = document.getElementById('mult_green_popup').childNodes; | |
141 | |
142 for ( i = 0; i <items.length; i++ ) { | |
143 if ( items[i].getAttribute('selected') == 'true' ) { | |
144 mult[1] = items[i].getAttribute('value'); | |
145 } | |
146 } | |
147 | |
148 items = document.getElementById('mult_blue_popup').childNodes; | |
149 | |
150 for ( i = 0; i <items.length; i++ ) { | |
151 if ( items[i].getAttribute('selected') == 'true' ) { | |
152 mult[2] = items[i].getAttribute('value'); | |
153 } | |
154 } | |
155 | |
156 mult = mult.join("/"); | |
157 | |
158 if ( (add != old_add) || (mult != old_mult) ) { | |
159 opener.content.colors(add, mult); | |
160 } | |
161 } | |
162 | |
163 | |
164 function close_dialog() { | |
165 | |
166 window.close(); | |
167 | |
168 } |