git-svn-id: svn://euphorik.ch/pompage@45 02bbb61a-6d21-0410-aba0-cb053bdfd66a
[pompage.git] / doc / webdeveloper / options / options.js
1 var webdeveloper_optionsDataBoolean = new Array();
2 var webdeveloper_optionsDataInteger = new Array();
3 var webdeveloper_optionsDataString = new Array();
4 var webdeveloper_resizeDescription = null;
5 var webdeveloper_resizeHeight = null;
6 var webdeveloper_resizeViewport = false;
7 var webdeveloper_resizeWidth = null;
8 var webdeveloper_toolBookmarklet = null;
9 var webdeveloper_toolDescription = null;
10 var webdeveloper_toolKey = null;
11 var webdeveloper_toolPath = null;
12 var webdeveloper_toolURL = null;
13 var webdeveloper_viewSourceWithDescription = null;
14 var webdeveloper_viewSourceWithKey = null;
15 var webdeveloper_viewSourceWithPath = null;
16
17 // Adds a resize option
18 function webdeveloper_addResize()
19 {
20 window.openDialog("chrome://webdeveloper/content/options/dialogs/resize.xul", "webdeveloper-resize-dialog", "centerscreen,chrome,modal", "add");
21
22 // If the description, height and width are set
23 if(webdeveloper_resizeDescription && webdeveloper_resizeHeight && webdeveloper_resizeWidth)
24 {
25 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
26 var listCell = pageDocument.createElement("listcell");
27 var listItem = pageDocument.createElement("listitem");
28 var resizeBox = pageDocument.getElementById("webdeveloper-listbox");
29 var stringBundle = document.getElementById("webdeveloper-string-bundle");
30
31 listCell.setAttribute("label", webdeveloper_resizeDescription);
32 listItem.appendChild(listCell);
33
34 listCell = pageDocument.createElement("listcell");
35 listCell.setAttribute("label", webdeveloper_resizeWidth);
36 listItem.appendChild(listCell);
37
38 listCell = pageDocument.createElement("listcell");
39 listCell.setAttribute("label", webdeveloper_resizeHeight);
40 listItem.appendChild(listCell);
41
42 listCell = pageDocument.createElement("listcell");
43
44 // If resizing the viewport
45 if(webdeveloper_resizeViewport)
46 {
47 listCell.setAttribute("label", stringBundle.getString("webdeveloper_yes"));
48 }
49 else
50 {
51 listCell.setAttribute("label", stringBundle.getString("webdeveloper_no"));
52 }
53
54 listItem.appendChild(listCell);
55
56 resizeBox.selectItem(resizeBox.appendChild(listItem));
57 resizeBox.ensureElementIsVisible(resizeBox.selectedItem);
58 }
59 }
60
61 // Adds a tool
62 function webdeveloper_addTool()
63 {
64 window.openDialog("chrome://webdeveloper/content/options/dialogs/tool.xul", "webdeveloper-tool-dialog", "centerscreen,chrome,modal", "add");
65
66 // If the description and the bookmarklet, path or URL are set
67 if(webdeveloper_toolDescription && (webdeveloper_toolBookmarklet || webdeveloper_toolPath || webdeveloper_toolURL))
68 {
69 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
70 var listCell = pageDocument.createElement("listcell");
71 var listItem = pageDocument.createElement("listitem");
72 var stringBundle = document.getElementById("webdeveloper-string-bundle");
73 var toolBox = pageDocument.getElementById("webdeveloper-listbox");
74
75 listCell.setAttribute("label", webdeveloper_toolDescription);
76
77 // If the bookmarklet is set
78 if(webdeveloper_toolBookmarklet)
79 {
80 listCell.setAttribute("type", stringBundle.getString("webdeveloper_bookmarklet"));
81 }
82 else if(webdeveloper_toolPath)
83 {
84 listCell.setAttribute("type", stringBundle.getString("webdeveloper_application"));
85 }
86 else
87 {
88 listCell.setAttribute("type", stringBundle.getString("webdeveloper_url"));
89 }
90
91 listItem.appendChild(listCell);
92
93 listCell = pageDocument.createElement("listcell");
94
95 // If the bookmarklet is set
96 if(webdeveloper_toolBookmarklet)
97 {
98 listCell.setAttribute("label", webdeveloper_toolBookmarklet);
99 }
100 else if(webdeveloper_toolPath)
101 {
102 listCell.setAttribute("label", webdeveloper_toolPath);
103 }
104 else
105 {
106 listCell.setAttribute("label", webdeveloper_toolURL);
107 }
108
109 listCell.setAttribute("crop", "end");
110 listItem.appendChild(listCell);
111
112 listCell = pageDocument.createElement("listcell");
113
114 // If the key is set
115 if(webdeveloper_toolKey)
116 {
117 listCell.setAttribute("label", webdeveloper_toolKey);
118 }
119
120 listItem.appendChild(listCell);
121
122 toolBox.selectItem(toolBox.appendChild(listItem));
123 toolBox.ensureElementIsVisible(toolBox.selectedItem);
124 }
125 }
126
127 // Adds a view source with option
128 function webdeveloper_addViewSourceWith()
129 {
130 window.openDialog("chrome://webdeveloper/content/options/dialogs/view_source_with.xul", "webdeveloper-view-source-with-dialog", "centerscreen,chrome,modal", "add");
131
132 // If the description and path are set
133 if(webdeveloper_viewSourceWithDescription && webdeveloper_viewSourceWithPath)
134 {
135 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
136 var listCell = pageDocument.createElement("listcell");
137 var listItem = pageDocument.createElement("listitem");
138 var stringBundle = document.getElementById("webdeveloper-string-bundle");
139 var viewSourceWithBox = pageDocument.getElementById("webdeveloper-listbox");
140
141 listCell.setAttribute("label", webdeveloper_viewSourceWithDescription);
142 listItem.appendChild(listCell);
143
144 listCell = pageDocument.createElement("listcell");
145 listCell.setAttribute("label", webdeveloper_viewSourceWithPath);
146 listCell.setAttribute("crop", "end");
147 listItem.appendChild(listCell);
148
149 listCell = pageDocument.createElement("listcell");
150
151 // If the key is set
152 if(webdeveloper_viewSourceWithKey)
153 {
154 listCell.setAttribute("label", webdeveloper_viewSourceWithKey);
155 }
156
157 listItem.appendChild(listCell);
158
159 viewSourceWithBox.selectItem(viewSourceWithBox.appendChild(listItem));
160 viewSourceWithBox.ensureElementIsVisible(viewSourceWithBox.selectedItem);
161 }
162 }
163
164 // Handles changing the options page
165 function webdeveloper_changePage(pageList)
166 {
167 webdeveloper_storeOptions();
168 webdeveloper_setIntegerPreference("webdeveloper.options.last.page", pageList.selectedIndex);
169
170 document.getElementById("webdeveloper-options-iframe").setAttribute("src", pageList.selectedItem.value);
171 }
172
173 // Deletes a resize option
174 function webdeveloper_deleteResize()
175 {
176 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
177 var resizeBox = pageDocument.getElementById("webdeveloper-listbox");
178 var selectedItem = resizeBox.selectedItem;
179
180 // If an item is selected and the deletion is confirmed
181 if(selectedItem && webdeveloper_deleteConfirmation(document.getElementById("webdeveloper-string-bundle").getString("webdeveloper_resizeDeleteConfirmation")))
182 {
183 resizeBox.removeChild(selectedItem);
184 }
185 }
186
187 // Deletes a tool
188 function webdeveloper_deleteTool()
189 {
190 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
191 var toolBox = pageDocument.getElementById("webdeveloper-listbox");
192 var selectedItem = toolBox.selectedItem;
193
194 // If an item is selected and it is a separator or the deletion is confirmed
195 if(selectedItem && (selectedItem.childNodes[0].tagName == "separator" || webdeveloper_deleteConfirmation(document.getElementById("webdeveloper-string-bundle").getString("webdeveloper_toolDeleteConfirmation"))))
196 {
197 toolBox.removeChild(selectedItem);
198 }
199 }
200
201 // Deletes a tool
202 function webdeveloper_deleteViewSourceWith()
203 {
204 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
205 var viewSourceWithBox = pageDocument.getElementById("webdeveloper-listbox");
206 var selectedItem = viewSourceWithBox.selectedItem;
207
208 // If an item is selected and the deletion is confirmed
209 if(selectedItem && webdeveloper_deleteConfirmation(document.getElementById("webdeveloper-string-bundle").getString("webdeveloper_viewSourceWithDeleteConfirmation")))
210 {
211 viewSourceWithBox.removeChild(selectedItem);
212 }
213 }
214
215 // Edits a resize option
216 function webdeveloper_editResize()
217 {
218 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
219 var resizeBox = pageDocument.getElementById("webdeveloper-listbox");
220 var selectedItem = resizeBox.selectedItem;
221
222 // If an option is selected
223 if(selectedItem)
224 {
225 var stringBundle = document.getElementById("webdeveloper-string-bundle");
226 var viewportValue = false;
227
228 // If the viewport value is set to yes
229 if(selectedItem.childNodes[3].getAttribute("label") == stringBundle.getString("webdeveloper_yes"))
230 {
231 viewportValue = true;
232 }
233
234 window.openDialog("chrome://webdeveloper/content/options/dialogs/resize.xul", "webdeveloper-resize-dialog", "centerscreen,chrome,modal", "edit", selectedItem.childNodes[0].getAttribute("label"), selectedItem.childNodes[1].getAttribute("label"), selectedItem.childNodes[2].getAttribute("label"), viewportValue);
235
236 // If the description, height and width are set
237 if(webdeveloper_resizeDescription && webdeveloper_resizeHeight && webdeveloper_resizeWidth)
238 {
239 var listCell = pageDocument.createElement("listcell");
240
241 webdeveloper_removeAllChildElements(selectedItem);
242
243 listCell.setAttribute("label", webdeveloper_resizeDescription);
244 selectedItem.appendChild(listCell);
245
246 listCell = pageDocument.createElement("listcell");
247 listCell.setAttribute("label", webdeveloper_resizeWidth);
248 selectedItem.appendChild(listCell);
249
250 listCell = pageDocument.createElement("listcell");
251 listCell.setAttribute("label", webdeveloper_resizeHeight);
252 selectedItem.appendChild(listCell);
253
254 listCell = pageDocument.createElement("listcell");
255
256 // If resizing the viewport
257 if(webdeveloper_resizeViewport)
258 {
259 listCell.setAttribute("label", stringBundle.getString("webdeveloper_yes"));
260 }
261 else
262 {
263 listCell.setAttribute("label", stringBundle.getString("webdeveloper_no"));
264 }
265
266 selectedItem.appendChild(listCell);
267 resizeBox.ensureElementIsVisible(selectedItem);
268 }
269 }
270 }
271
272 // Edits a tool
273 function webdeveloper_editTool()
274 {
275 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
276 var toolBox = pageDocument.getElementById("webdeveloper-listbox");
277 var selectedItem = toolBox.selectedItem;
278
279 // If an option is selected
280 if(selectedItem)
281 {
282 var selectedCell = selectedItem.childNodes[0];
283
284 // If this is not a separator
285 if(selectedCell.tagName != "separator")
286 {
287 window.openDialog("chrome://webdeveloper/content/options/dialogs/tool.xul", "webdeveloper-tool-dialog", "centerscreen,chrome,modal", "edit", selectedCell.getAttribute("label"), selectedItem.childNodes[2].getAttribute("label"), selectedItem.childNodes[1].getAttribute("label"), selectedCell.getAttribute("type"));
288
289 // If the description and the bookmarklet, path or URL are set
290 if(webdeveloper_toolDescription && (webdeveloper_toolBookmarklet || webdeveloper_toolPath || webdeveloper_toolURL))
291 {
292 var listCell = pageDocument.createElement("listcell");
293 var stringBundle = document.getElementById("webdeveloper-string-bundle");
294
295 webdeveloper_removeAllChildElements(selectedItem);
296
297 listCell.setAttribute("label", webdeveloper_toolDescription);
298
299 // If the bookmarklet is set
300 if(webdeveloper_toolBookmarklet)
301 {
302 listCell.setAttribute("type", stringBundle.getString("webdeveloper_bookmarklet"));
303 }
304 else if(webdeveloper_toolPath)
305 {
306 listCell.setAttribute("type", stringBundle.getString("webdeveloper_application"));
307 }
308 else
309 {
310 listCell.setAttribute("type", stringBundle.getString("webdeveloper_url"));
311 }
312
313 selectedItem.appendChild(listCell);
314
315 listCell = pageDocument.createElement("listcell");
316
317 // If the bookmarklet is set
318 if(webdeveloper_toolBookmarklet)
319 {
320 listCell.setAttribute("label", webdeveloper_toolBookmarklet);
321 }
322 else if(webdeveloper_toolPath)
323 {
324 listCell.setAttribute("label", webdeveloper_toolPath);
325 }
326 else
327 {
328 listCell.setAttribute("label", webdeveloper_toolURL);
329 }
330
331 listCell.setAttribute("crop", "end");
332 selectedItem.appendChild(listCell);
333
334 listCell = pageDocument.createElement("listcell");
335
336 // If the key is set
337 if(webdeveloper_toolKey)
338 {
339 listCell.setAttribute("label", webdeveloper_toolKey);
340 }
341
342 selectedItem.appendChild(listCell);
343 toolBox.ensureElementIsVisible(selectedItem);
344 }
345 }
346 }
347 }
348
349 // Edits a view source with option
350 function webdeveloper_editViewSourceWith()
351 {
352 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
353 var viewSourceWithBox = pageDocument.getElementById("webdeveloper-listbox");
354 var selectedItem = viewSourceWithBox.selectedItem;
355
356 // If an option is selected
357 if(selectedItem)
358 {
359 window.openDialog("chrome://webdeveloper/content/options/dialogs/view_source_with.xul", "webdeveloper-view-source-with-dialog", "centerscreen,chrome,modal", "edit", selectedItem.childNodes[0].getAttribute("label"), selectedItem.childNodes[1].getAttribute("label"), selectedItem.childNodes[2].getAttribute("label"));
360
361 // If the description and path are set
362 if(webdeveloper_viewSourceWithDescription && webdeveloper_viewSourceWithPath)
363 {
364 var listCell = pageDocument.createElement("listcell");
365
366 webdeveloper_removeAllChildElements(selectedItem);
367
368 listCell.setAttribute("label", webdeveloper_viewSourceWithDescription);
369 selectedItem.appendChild(listCell);
370
371 listCell = pageDocument.createElement("listcell");
372 listCell.setAttribute("label", webdeveloper_viewSourceWithPath);
373 listCell.setAttribute("crop", "end");
374 selectedItem.appendChild(listCell);
375
376 listCell = pageDocument.createElement("listcell");
377
378 // If the key is set
379 if(webdeveloper_viewSourceWithKey)
380 {
381 listCell.setAttribute("label", webdeveloper_viewSourceWithKey);
382 }
383
384 selectedItem.appendChild(listCell);
385 viewSourceWithBox.ensureElementIsVisible(selectedItem);
386 }
387 }
388 }
389
390 // Initializes the colors and fonts page
391 function webdeveloper_initializeColorsAndFonts()
392 {
393 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
394
395 // If the generated content font size preference is set
396 if(typeof webdeveloper_optionsDataInteger["webdeveloper.generated.content.font.size"] != "undefined")
397 {
398 pageDocument.getElementById("webdeveloper.generated.content.font.size").value = webdeveloper_optionsDataInteger["webdeveloper.generated.content.font.size"];
399 }
400 else if(webdeveloper_isPreferenceSet("webdeveloper.generated.content.font.size"))
401 {
402 pageDocument.getElementById("webdeveloper.generated.content.font.size").value = webdeveloper_getIntegerPreference("webdeveloper.generated.content.font.size", true);
403 }
404
405 // If the feature tooltip text color is set
406 if(typeof webdeveloper_optionsDataString["webdeveloper.feature.tooltip.color.text"] != "undefined")
407 {
408 pageDocument.getElementById("webdeveloper.feature.tooltip.color.text").color = webdeveloper_optionsDataString["webdeveloper.feature.tooltip.color.text"].trim();
409 }
410 else if(webdeveloper_isPreferenceSet("webdeveloper.feature.tooltip.color.text"))
411 {
412 pageDocument.getElementById("webdeveloper.feature.tooltip.color.text").color = webdeveloper_getStringPreference("webdeveloper.feature.tooltip.color.text", true);
413 }
414
415 // If the feature tooltip background color is set
416 if(typeof webdeveloper_optionsDataString["webdeveloper.feature.tooltip.color.background"] != "undefined")
417 {
418 pageDocument.getElementById("webdeveloper.feature.tooltip.color.background").color = webdeveloper_optionsDataString["webdeveloper.feature.tooltip.color.background"].trim();
419 }
420 else if(webdeveloper_isPreferenceSet("webdeveloper.feature.tooltip.color.background"))
421 {
422 pageDocument.getElementById("webdeveloper.feature.tooltip.color.background").color = webdeveloper_getStringPreference("webdeveloper.feature.tooltip.color.background", true);
423 }
424
425 // If the feature tooltip border color is set
426 if(typeof webdeveloper_optionsDataString["webdeveloper.feature.tooltip.color.border"] != "undefined")
427 {
428 pageDocument.getElementById("webdeveloper.feature.tooltip.color.border").color = webdeveloper_optionsDataString["webdeveloper.feature.tooltip.color.border"].trim();
429 }
430 else if(webdeveloper_isPreferenceSet("webdeveloper.feature.tooltip.color.border"))
431 {
432 pageDocument.getElementById("webdeveloper.feature.tooltip.color.border").color = webdeveloper_getStringPreference("webdeveloper.feature.tooltip.color.border", true);
433 }
434
435 // If the feature tooltip opacity is set
436 if(typeof webdeveloper_optionsDataString["webdeveloper.feature.tooltip.opacity"] != "undefined")
437 {
438 pageDocument.getElementById("webdeveloper.feature.tooltip.opacity").value = webdeveloper_optionsDataString["webdeveloper.feature.tooltip.opacity"];
439 }
440 else if(webdeveloper_isPreferenceSet("webdeveloper.feature.tooltip.opacity"))
441 {
442 pageDocument.getElementById("webdeveloper.feature.tooltip.opacity").value = webdeveloper_getStringPreference("webdeveloper.feature.tooltip.opacity", true);
443 }
444 }
445
446 // Initializes the dashboard page
447 function webdeveloper_initializeDashboard()
448 {
449 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
450
451 // If the edit CSS text color is set
452 if(typeof webdeveloper_optionsDataString["webdeveloper.edit.color.text"] != "undefined")
453 {
454 pageDocument.getElementById("webdeveloper.edit.color.text").color = webdeveloper_optionsDataString["webdeveloper.edit.color.text"].trim();
455 }
456 else if(webdeveloper_isPreferenceSet("webdeveloper.edit.color.text"))
457 {
458 pageDocument.getElementById("webdeveloper.edit.color.text").color = webdeveloper_getStringPreference("webdeveloper.edit.color.text", true);
459 }
460
461 // If the edit CSS background color is set
462 if(typeof webdeveloper_optionsDataString["webdeveloper.edit.color.background"] != "undefined")
463 {
464 pageDocument.getElementById("webdeveloper.edit.color.background").color = webdeveloper_optionsDataString["webdeveloper.edit.color.background"].trim();
465 }
466 else if(webdeveloper_isPreferenceSet("webdeveloper.edit.color.background"))
467 {
468 pageDocument.getElementById("webdeveloper.edit.color.background").color = webdeveloper_getStringPreference("webdeveloper.edit.color.background", true);
469 }
470
471 // If the edit CSS font preference is set
472 if(typeof webdeveloper_optionsDataInteger["webdeveloper.edit.font.size"] != "undefined")
473 {
474 pageDocument.getElementById("webdeveloper.edit.font.size").value = webdeveloper_optionsDataInteger["webdeveloper.edit.font.size"];
475 }
476 else if(webdeveloper_isPreferenceSet("webdeveloper.edit.font.size"))
477 {
478 pageDocument.getElementById("webdeveloper.edit.font.size").value = webdeveloper_getIntegerPreference("webdeveloper.edit.font.size", true);
479 }
480
481 // If the edit CSS update frequency preference is set
482 if(typeof webdeveloper_optionsDataInteger["webdeveloper.edit.update.frequency"] != "undefined")
483 {
484 pageDocument.getElementById("webdeveloper.edit.update.frequency").value = webdeveloper_optionsDataInteger["webdeveloper.edit.update.frequency"];
485 }
486 else if(webdeveloper_isPreferenceSet("webdeveloper.edit.update.frequency"))
487 {
488 pageDocument.getElementById("webdeveloper.edit.update.frequency").value = webdeveloper_getIntegerPreference("webdeveloper.edit.update.frequency", true);
489 }
490
491 // If the edit CSS wrap preference is set
492 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.edit.wrap"] != "undefined")
493 {
494 pageDocument.getElementById("webdeveloper.edit.wrap").checked = webdeveloper_optionsDataBoolean["webdeveloper.edit.wrap"];
495 }
496 else if(webdeveloper_isPreferenceSet("webdeveloper.edit.wrap"))
497 {
498 pageDocument.getElementById("webdeveloper.edit.wrap").checked = webdeveloper_getBooleanPreference("webdeveloper.edit.wrap", true);
499 }
500
501 // If the style information dashboard preference is set
502 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.style.information.dashboard"] != "undefined")
503 {
504 pageDocument.getElementById("webdeveloper.style.information.dashboard").checked = webdeveloper_optionsDataBoolean["webdeveloper.style.information.dashboard"];
505 }
506 else if(webdeveloper_isPreferenceSet("webdeveloper.style.information.dashboard"))
507 {
508 pageDocument.getElementById("webdeveloper.style.information.dashboard").checked = webdeveloper_getBooleanPreference("webdeveloper.style.information.dashboard", true);
509 }
510
511 // If the DOM Inspector dashboard preference is set
512 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.dom.inspector.dashboard"] != "undefined")
513 {
514 pageDocument.getElementById("webdeveloper.dom.inspector.dashboard").checked = webdeveloper_optionsDataBoolean["webdeveloper.dom.inspector.dashboard"];
515 }
516 else if(webdeveloper_isPreferenceSet("webdeveloper.dom.inspector.dashboard"))
517 {
518 pageDocument.getElementById("webdeveloper.dom.inspector.dashboard").checked = webdeveloper_getBooleanPreference("webdeveloper.dom.inspector.dashboard", true);
519 }
520
521 // If the error console dashboard preference is set
522 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.error.console.dashboard"] != "undefined")
523 {
524 pageDocument.getElementById("webdeveloper.error.console.dashboard").checked = webdeveloper_optionsDataBoolean["webdeveloper.error.console.dashboard"];
525 }
526 else if(webdeveloper_isPreferenceSet("webdeveloper.error.console.dashboard"))
527 {
528 pageDocument.getElementById("webdeveloper.error.console.dashboard").checked = webdeveloper_getBooleanPreference("webdeveloper.error.console.dashboard", true);
529 }
530 }
531
532 // Initializes the general page
533 function webdeveloper_initializeGeneral()
534 {
535 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
536
537 // If the hide menu preference is set
538 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.menu.hide"] != "undefined")
539 {
540 pageDocument.getElementById("webdeveloper.menu.hide").checked = webdeveloper_optionsDataBoolean["webdeveloper.menu.hide"];
541 }
542 else if(webdeveloper_isPreferenceSet("webdeveloper.menu.hide"))
543 {
544 pageDocument.getElementById("webdeveloper.menu.hide").checked = webdeveloper_getBooleanPreference("webdeveloper.menu.hide", true);
545 }
546 else
547 {
548 pageDocument.getElementById("webdeveloper.menu.hide").checked = false;
549 }
550
551 // If the hide context menu preference is set
552 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.context.hide"] != "undefined")
553 {
554 pageDocument.getElementById("webdeveloper.context.hide").checked = webdeveloper_optionsDataBoolean["webdeveloper.context.hide"];
555 }
556 else if(webdeveloper_isPreferenceSet("webdeveloper.context.hide"))
557 {
558 pageDocument.getElementById("webdeveloper.context.hide").checked = webdeveloper_getBooleanPreference("webdeveloper.context.hide", true);
559 }
560 else
561 {
562 pageDocument.getElementById("webdeveloper.context.hide").checked = false;
563 }
564
565 // If the hide confirmation dialogs preference is set
566 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.confirmation.dialogs.hide"] != "undefined")
567 {
568 pageDocument.getElementById("webdeveloper.confirmation.dialogs.hide").checked = webdeveloper_optionsDataBoolean["webdeveloper.confirmation.dialogs.hide"];
569 }
570 else if(webdeveloper_isPreferenceSet("webdeveloper.confirmation.dialogs.hide"))
571 {
572 pageDocument.getElementById("webdeveloper.confirmation.dialogs.hide").checked = webdeveloper_getBooleanPreference("webdeveloper.confirmation.dialogs.hide", true);
573 }
574 else
575 {
576 pageDocument.getElementById("webdeveloper.confirmation.dialogs.hide").checked = false;
577 }
578
579 // If the hide informational dialogs preference is set
580 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.informational.dialogs.hide"] != "undefined")
581 {
582 pageDocument.getElementById("webdeveloper.informational.dialogs.hide").checked = webdeveloper_optionsDataBoolean["webdeveloper.informational.dialogs.hide"];
583 }
584 else if(webdeveloper_isPreferenceSet("webdeveloper.informational.dialogs.hide"))
585 {
586 pageDocument.getElementById("webdeveloper.informational.dialogs.hide").checked = webdeveloper_getBooleanPreference("webdeveloper.informational.dialogs.hide", true);
587 }
588 else
589 {
590 pageDocument.getElementById("webdeveloper.informational.dialogs.hide").checked = false;
591 }
592
593 // If the toolbar icons preference is set
594 if(typeof webdeveloper_optionsDataString["webdeveloper.toolbar.icons"] != "undefined")
595 {
596 pageDocument.getElementById("webdeveloper.toolbar.icons").value = webdeveloper_optionsDataString["webdeveloper.toolbar.icons"];
597 }
598 else if(webdeveloper_isPreferenceSet("webdeveloper.toolbar.icons"))
599 {
600 pageDocument.getElementById("webdeveloper.toolbar.icons").value = webdeveloper_getStringPreference("webdeveloper.toolbar.icons", true);
601 }
602 else
603 {
604 pageDocument.getElementById("webdeveloper.toolbar.icons").selectedIndex = 0;
605 }
606
607 // If the open tabs preference is set
608 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.open.tabs"] != "undefined")
609 {
610 pageDocument.getElementById("webdeveloper.open.tabs").checked = webdeveloper_optionsDataBoolean["webdeveloper.open.tabs"];
611 }
612 else if(webdeveloper_isPreferenceSet("webdeveloper.open.tabs"))
613 {
614 pageDocument.getElementById("webdeveloper.open.tabs").checked = webdeveloper_getBooleanPreference("webdeveloper.open.tabs", true);
615 }
616
617 // If the open tabs background preference is set
618 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.open.tabs.background"] != "undefined")
619 {
620 pageDocument.getElementById("webdeveloper.open.tabs.background").checked = webdeveloper_optionsDataBoolean["webdeveloper.open.tabs.background"];
621 }
622 else if(webdeveloper_isPreferenceSet("webdeveloper.open.tabs.background"))
623 {
624 pageDocument.getElementById("webdeveloper.open.tabs.background").checked = webdeveloper_getBooleanPreference("webdeveloper.open.tabs.background", true);
625 }
626 else
627 {
628 pageDocument.getElementById("webdeveloper.open.tabs.background").checked = false;
629 }
630
631 pageDocument.getElementById("webdeveloper.open.tabs.background").disabled = !pageDocument.getElementById("webdeveloper.open.tabs").checked;
632 }
633
634 // Initializes the keys page
635 function webdeveloper_initializeKeys()
636 {
637 var mainDocument = null;
638
639 // If there is a parent window
640 if(window.opener)
641 {
642 // If there is a grand parent window
643 if(window.opener.opener)
644 {
645 mainDocument = window.opener.opener.document;
646 }
647 else
648 {
649 mainDocument = window.opener.document;
650 }
651 }
652 else
653 {
654 mainDocument = document;
655 }
656
657 // If a main document was found
658 if(mainDocument)
659 {
660 var keySet = mainDocument.getElementById("mainKeyset");
661
662 // If the key set was not found
663 if(!keySet)
664 {
665 keySet = mainDocument.getElementById("navKeys");
666 }
667
668 // If the key set was found
669 if(keySet)
670 {
671 var description = null;
672 var horizontalBox = null;
673 var id = null;
674 var labelElement = null;
675 var key = null;
676 var keys = keySet.childNodes;
677 var keysLength = keys.length;
678 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
679 var row = null;
680 var rows = pageDocument.getElementById("webdeveloper-key-rows");
681 var spacer = null;
682 var stringBundle = document.getElementById("webdeveloper-string-bundle");
683 var modifiers = null;
684 var textBox = null;
685
686 // If running on a Mac
687 if(webdeveloper_isMac())
688 {
689 modifiers = stringBundle.getString("webdeveloper_keyboardShortcutModifiersMac");
690 }
691 else
692 {
693 modifiers = stringBundle.getString("webdeveloper_keyboardShortcutModifiers");
694 }
695
696 // Loop through the keys
697 for(var i = 0; i < keysLength; i++)
698 {
699 key = keys.item(i);
700
701 // If the key has and id attribute starting with webdeveloper-
702 if(key.hasAttribute("id") && key.getAttribute("id").indexOf("webdeveloper-") == 0)
703 {
704 description = pageDocument.createElement("description");
705 horizontalBox = pageDocument.createElement("hbox");
706 id = key.getAttribute("id").split("-").join(".");
707 labelElement = pageDocument.createElement("label");
708 row = pageDocument.createElement("row");
709 textBox = pageDocument.createElement("textbox");
710
711 labelElement.setAttribute("control", id);
712 labelElement.setAttribute("value", key.getAttribute("label"));
713 row.appendChild(labelElement);
714
715 description.setAttribute("value", modifiers);
716 horizontalBox.appendChild(description);
717
718 // If the option is defined
719 if(typeof webdeveloper_optionsDataString[id] != "undefined")
720 {
721 textBox.setAttribute("value", webdeveloper_optionsDataString[id].trim());
722 }
723 else if(webdeveloper_isPreferenceSet(id))
724 {
725 textBox.setAttribute("value", webdeveloper_getStringPreference(id, true));
726 }
727 else
728 {
729 textBox.setAttribute("value", key.getAttribute("key"));
730 }
731
732 textBox.setAttribute("id", id);
733 textBox.setAttribute("size", "1");
734 textBox.setAttribute("maxlength", "1");
735 horizontalBox.appendChild(textBox);
736
737 horizontalBox.setAttribute("align", "center");
738 row.appendChild(horizontalBox);
739
740 row.setAttribute("align", "center");
741 rows.appendChild(row);
742 }
743 }
744 }
745 }
746 }
747
748 // Initializes the miscellaneous page
749 function webdeveloper_initializeMiscellaneous()
750 {
751 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
752
753 // If the populate form fields email preference is set
754 if(typeof webdeveloper_optionsDataString["webdeveloper.populate.form.fields.email"] != "undefined")
755 {
756 pageDocument.getElementById("webdeveloper.populate.form.fields.email").value = webdeveloper_optionsDataString["webdeveloper.populate.form.fields.email"];
757 }
758 else if(webdeveloper_isPreferenceSet("webdeveloper.populate.form.fields.email"))
759 {
760 pageDocument.getElementById("webdeveloper.populate.form.fields.email").value = webdeveloper_getStringPreference("webdeveloper.populate.form.fields.email", true);
761 }
762
763 // If the tidy information preference is set
764 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.information.tidy"] != "undefined")
765 {
766 pageDocument.getElementById("webdeveloper.information.tidy").checked = webdeveloper_optionsDataBoolean["webdeveloper.information.tidy"];
767 }
768 else if(webdeveloper_isPreferenceSet("webdeveloper.information.tidy"))
769 {
770 pageDocument.getElementById("webdeveloper.information.tidy").checked = webdeveloper_getBooleanPreference("webdeveloper.information.tidy", true);
771 }
772 else
773 {
774 pageDocument.getElementById("webdeveloper.information.tidy").checked = false;
775 }
776
777 // If the open CSS console error preference is set
778 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.open.css.console.error"] != "undefined")
779 {
780 pageDocument.getElementById("webdeveloper.open.css.console.error").checked = webdeveloper_optionsDataBoolean["webdeveloper.open.css.console.error"];
781 }
782 else if(webdeveloper_isPreferenceSet("webdeveloper.open.css.console.error"))
783 {
784 pageDocument.getElementById("webdeveloper.open.css.console.error").checked = webdeveloper_getBooleanPreference("webdeveloper.open.css.console.error", true);
785 }
786 else
787 {
788 pageDocument.getElementById("webdeveloper.open.css.console.error").checked = false;
789 }
790
791 // If the open JavaScript console warning preference is set
792 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.open.javascript.console.warning"] != "undefined")
793 {
794 pageDocument.getElementById("webdeveloper.open.javascript.console.warning").checked = webdeveloper_optionsDataBoolean["webdeveloper.open.javascript.console.warning"];
795 }
796 else if(webdeveloper_isPreferenceSet("webdeveloper.open.javascript.console.warning"))
797 {
798 pageDocument.getElementById("webdeveloper.open.javascript.console.warning").checked = webdeveloper_getBooleanPreference("webdeveloper.open.javascript.console.warning", true);
799 }
800 else
801 {
802 pageDocument.getElementById("webdeveloper.open.javascript.console.warning").checked = false;
803 }
804
805 // If the open JavaScript console error preference is set
806 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.open.javascript.console.error"] != "undefined")
807 {
808 pageDocument.getElementById("webdeveloper.open.javascript.console.error").checked = webdeveloper_optionsDataBoolean["webdeveloper.open.javascript.console.error"];
809 }
810 else if(webdeveloper_isPreferenceSet("webdeveloper.open.javascript.console.error"))
811 {
812 pageDocument.getElementById("webdeveloper.open.javascript.console.error").checked = webdeveloper_getBooleanPreference("webdeveloper.open.javascript.console.error", true);
813 }
814 else
815 {
816 pageDocument.getElementById("webdeveloper.open.javascript.console.error").checked = false;
817 }
818 }
819
820 // Initializes the options dialog
821 function webdeveloper_initializeOptions(checkDialogParameters)
822 {
823 var pageList = document.getElementById("webdeveloper-options-page-list");
824 var selectPage = 0;
825
826 // If check dialog parameters and window arguments are set
827 if(checkDialogParameters && window.arguments)
828 {
829 selectPage = webdeveloper_translatePageNameToIndex(window.arguments[0]);
830 }
831 else if(webdeveloper_isPreferenceSet("webdeveloper.options.last.page"))
832 {
833 selectPage = webdeveloper_getIntegerPreference("webdeveloper.options.last.page");
834 }
835
836 pageList.selectedIndex = selectPage;
837
838 document.getElementById("webdeveloper-options-iframe").setAttribute("src", pageList.selectedItem.value);
839 }
840
841 // Initializes the resize page
842 function webdeveloper_initializeResize()
843 {
844 var description = null;
845 var descriptionValue = null;
846 var height = null;
847 var heightValue = null;
848 var listCell = null;
849 var listItem = null;
850 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
851 var resizeBox = pageDocument.getElementById("webdeveloper-listbox");
852 var resizeCount = 0;
853 var stringBundle = document.getElementById("webdeveloper-string-bundle");
854 var no = stringBundle.getString("webdeveloper_no");
855 var viewport = null;
856 var viewportValue = false;
857 var width = null;
858 var widthValue = null;
859 var yes = stringBundle.getString("webdeveloper_yes");
860
861 // If the resize count preference is set
862 if(typeof webdeveloper_optionsDataInteger["webdeveloper.resize.count"] != "undefined")
863 {
864 resizeCount = webdeveloper_optionsDataInteger["webdeveloper.resize.count"];
865 }
866 else if(webdeveloper_isPreferenceSet("webdeveloper.resize.count"))
867 {
868 resizeCount = webdeveloper_getIntegerPreference("webdeveloper.resize.count", true);
869 }
870
871 // Loop through the possible resize options
872 for(var i = 1; i <= resizeCount; i++)
873 {
874 description = "webdeveloper.resize." + i + ".description";
875 height = "webdeveloper.resize." + i + ".height";
876 viewport = "webdeveloper.resize." + i + ".viewport";
877 width = "webdeveloper.resize." + i + ".width";
878
879 // If the description is set
880 if(typeof webdeveloper_optionsDataString[description] != "undefined")
881 {
882 descriptionValue = webdeveloper_optionsDataString[description].trim();
883 }
884 else if(webdeveloper_isPreferenceSet(description))
885 {
886 descriptionValue = webdeveloper_getStringPreference(description, true);
887 }
888 else
889 {
890 descriptionValue = null;
891 }
892
893 // If the width is set
894 if(typeof webdeveloper_optionsDataInteger[width] != "undefined")
895 {
896 widthValue = webdeveloper_optionsDataInteger[width];
897 }
898 else if(webdeveloper_isPreferenceSet(width))
899 {
900 widthValue = webdeveloper_getIntegerPreference(width, true);
901 }
902 else
903 {
904 widthValue = null;
905 }
906
907 // If the height is set
908 if(typeof webdeveloper_optionsDataInteger[height] != "undefined")
909 {
910 heightValue = webdeveloper_optionsDataInteger[height];
911 }
912 else if(webdeveloper_isPreferenceSet(height))
913 {
914 heightValue = webdeveloper_getIntegerPreference(height, true);
915 }
916 else
917 {
918 heightValue = null;
919 }
920
921 // If the viewport is set
922 if(typeof webdeveloper_optionsDataBoolean[viewport] != "undefined")
923 {
924 viewportValue = webdeveloper_optionsDataBoolean[viewport];
925 }
926 else if(webdeveloper_isPreferenceSet(viewport))
927 {
928 viewportValue = webdeveloper_getBooleanPreference(viewport, true);
929 }
930 else
931 {
932 viewportValue = false;
933 }
934
935 // If the description, width and height are set
936 if(descriptionValue && widthValue && heightValue)
937 {
938 listItem = pageDocument.createElement("listitem");
939
940 listCell = pageDocument.createElement("listcell");
941 listCell.setAttribute("label", descriptionValue);
942 listItem.appendChild(listCell);
943
944 listCell = pageDocument.createElement("listcell");
945 listCell.setAttribute("label", widthValue);
946 listItem.appendChild(listCell);
947
948 listCell = pageDocument.createElement("listcell");
949 listCell.setAttribute("label", heightValue);
950 listItem.appendChild(listCell);
951
952 listCell = pageDocument.createElement("listcell");
953
954 // If resizing the viewport
955 if(viewportValue)
956 {
957 listCell.setAttribute("label", yes);
958 }
959 else
960 {
961 listCell.setAttribute("label", no);
962 }
963
964 listItem.appendChild(listCell);
965 resizeBox.appendChild(listItem);
966 }
967 }
968
969 webdeveloper_listBoxSelected();
970 }
971
972 // Initializes the tools page
973 function webdeveloper_initializeTools()
974 {
975 var bookmarklet = null;
976 var bookmarkletValue = null;
977 var description = null;
978 var descriptionValue = null;
979 var key = null;
980 var keyValue = null;
981 var listCell = null;
982 var listItem = null;
983 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
984 var path = null;
985 var pathValue = null;
986 var separator = null;
987 var separatorValue = false;
988 var stringBundle = document.getElementById("webdeveloper-string-bundle");
989 var applicationType = stringBundle.getString("webdeveloper_application");
990 var bookmarkletType = stringBundle.getString("webdeveloper_bookmarklet");
991 var toolBox = pageDocument.getElementById("webdeveloper-listbox");
992 var toolCount = 0;
993 var url = null;
994 var urlType = stringBundle.getString("webdeveloper_url");
995 var urlValue = null;
996
997 // If the tool count preference is set
998 if(typeof webdeveloper_optionsDataInteger["webdeveloper.tool.count"] != "undefined")
999 {
1000 toolCount = webdeveloper_optionsDataInteger["webdeveloper.tool.count"];
1001 }
1002 else if(webdeveloper_isPreferenceSet("webdeveloper.tool.count"))
1003 {
1004 toolCount = webdeveloper_getIntegerPreference("webdeveloper.tool.count", true);
1005 }
1006
1007 // Loop through the possible tools
1008 for(var i = 1; i <= toolCount; i++)
1009 {
1010 bookmarklet = "webdeveloper.tool." + i + ".bookmarklet";
1011 description = "webdeveloper.tool." + i + ".description";
1012 key = "webdeveloper.tool." + i + ".key";
1013 path = "webdeveloper.tool." + i + ".path";
1014 separator = "webdeveloper.tool." + i + ".separator";
1015 url = "webdeveloper.tool." + i + ".url";
1016
1017 // If the bookmarklet is set
1018 if(typeof webdeveloper_optionsDataString[bookmarklet] != "undefined")
1019 {
1020 bookmarkletValue = webdeveloper_optionsDataString[bookmarklet].trim();
1021 }
1022 else if(webdeveloper_isPreferenceSet(bookmarklet))
1023 {
1024 bookmarkletValue = webdeveloper_getStringPreference(bookmarklet, true);
1025 }
1026 else
1027 {
1028 bookmarkletValue = null;
1029 }
1030
1031 // If the description is set
1032 if(typeof webdeveloper_optionsDataString[description] != "undefined")
1033 {
1034 descriptionValue = webdeveloper_optionsDataString[description].trim();
1035 }
1036 else if(webdeveloper_isPreferenceSet(description))
1037 {
1038 descriptionValue = webdeveloper_getStringPreference(description, true);
1039 }
1040 else
1041 {
1042 descriptionValue = null;
1043 }
1044
1045 // If the key is set
1046 if(typeof webdeveloper_optionsDataString[key] != "undefined")
1047 {
1048 keyValue = webdeveloper_optionsDataString[key].trim();
1049 }
1050 else if(webdeveloper_isPreferenceSet(key))
1051 {
1052 keyValue = webdeveloper_getStringPreference(key, true);
1053 }
1054 else
1055 {
1056 keyValue = null;
1057 }
1058
1059 // If the path is set
1060 if(typeof webdeveloper_optionsDataString[path] != "undefined")
1061 {
1062 pathValue = webdeveloper_optionsDataString[path].trim();
1063 }
1064 else if(webdeveloper_isPreferenceSet(path))
1065 {
1066 pathValue = webdeveloper_getStringPreference(path, true);
1067 }
1068 else
1069 {
1070 pathValue = null;
1071 }
1072
1073 // If the separator is set
1074 if(typeof webdeveloper_optionsDataBoolean[separator] != "undefined")
1075 {
1076 separatorValue = webdeveloper_optionsDataBoolean[separator];
1077 }
1078 else if(webdeveloper_isPreferenceSet(separator))
1079 {
1080 separatorValue = webdeveloper_getBooleanPreference(separator, true);
1081 }
1082 else
1083 {
1084 separatorValue = false;
1085 }
1086
1087 // If the URL is set
1088 if(typeof webdeveloper_optionsDataString[url] != "undefined")
1089 {
1090 urlValue = webdeveloper_optionsDataString[url].trim();
1091 }
1092 else if(webdeveloper_isPreferenceSet(url))
1093 {
1094 urlValue = webdeveloper_getStringPreference(url, true);
1095 }
1096 else
1097 {
1098 urlValue = null;
1099 }
1100
1101 // If the separator is set
1102 if(separatorValue)
1103 {
1104 listItem = pageDocument.createElement("listitem");
1105 separator = pageDocument.createElement("separator");
1106
1107 separator.setAttribute("class", "groove");
1108 listItem.appendChild(separator);
1109
1110 separator = pageDocument.createElement("separator");
1111 separator.setAttribute("class", "groove");
1112 listItem.appendChild(separator);
1113
1114 separator = pageDocument.createElement("separator");
1115 separator.setAttribute("class", "groove");
1116 listItem.appendChild(separator);
1117
1118 toolBox.appendChild(listItem);
1119 }
1120 else if(descriptionValue && (bookmarkletValue || pathValue || urlValue))
1121 {
1122 listItem = pageDocument.createElement("listitem");
1123
1124 listCell = pageDocument.createElement("listcell");
1125 listCell.setAttribute("label", descriptionValue);
1126
1127 // If the bookmarklet is set
1128 if(bookmarkletValue)
1129 {
1130 listCell.setAttribute("type", bookmarkletType);
1131 }
1132 else if(pathValue)
1133 {
1134 listCell.setAttribute("type", applicationType);
1135 }
1136 else
1137 {
1138 listCell.setAttribute("type", urlType);
1139 }
1140
1141 listItem.appendChild(listCell);
1142
1143 listCell = pageDocument.createElement("listcell");
1144
1145 // If the bookmarklet is set
1146 if(bookmarkletValue)
1147 {
1148 listCell.setAttribute("label", bookmarkletValue);
1149 }
1150 else if(pathValue)
1151 {
1152 listCell.setAttribute("label", pathValue);
1153 }
1154 else
1155 {
1156 listCell.setAttribute("label", urlValue);
1157 }
1158
1159 listCell.setAttribute("crop", "end");
1160 listItem.appendChild(listCell);
1161
1162 listCell = pageDocument.createElement("listcell");
1163
1164 // If the key is set
1165 if(keyValue)
1166 {
1167 listCell.setAttribute("label", keyValue);
1168 }
1169
1170 listItem.appendChild(listCell);
1171 toolBox.appendChild(listItem);
1172 }
1173 }
1174
1175 webdeveloper_listBoxSelected();
1176 }
1177
1178 // Initializes the validation page
1179 function webdeveloper_initializeValidation()
1180 {
1181 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
1182 var validateLocalCSSProfile = "css21";
1183 var validateLocalCSSProfileRadio = pageDocument.getElementById("webdeveloper-validate-local-css21-radio");
1184
1185 // If the Section 508 preference is set
1186 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.section508"] != "undefined")
1187 {
1188 pageDocument.getElementById("webdeveloper.validate.local.accessibility.section508").checked = webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.section508"];
1189 }
1190 else if(webdeveloper_isPreferenceSet("webdeveloper.validate.local.accessibility.section508"))
1191 {
1192 pageDocument.getElementById("webdeveloper.validate.local.accessibility.section508").checked = webdeveloper_getBooleanPreference("webdeveloper.validate.local.accessibility.section508", true);
1193 }
1194
1195 // If the WAI priority 1 preference is set
1196 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.wai.priority1"] != "undefined")
1197 {
1198 pageDocument.getElementById("webdeveloper.validate.local.accessibility.wai.priority1").checked = webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.wai.priority1"];
1199 }
1200 else if(webdeveloper_isPreferenceSet("webdeveloper.validate.local.accessibility.wai.priority1"))
1201 {
1202 pageDocument.getElementById("webdeveloper.validate.local.accessibility.wai.priority1").checked = webdeveloper_getBooleanPreference("webdeveloper.validate.local.accessibility.wai.priority1", true);
1203 }
1204
1205 // If the WAI priority 2 preference is set
1206 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.wai.priority2"] != "undefined")
1207 {
1208 pageDocument.getElementById("webdeveloper.validate.local.accessibility.wai.priority2").checked = webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.wai.priority2"];
1209 }
1210 else if(webdeveloper_isPreferenceSet("webdeveloper.validate.local.accessibility.wai.priority2"))
1211 {
1212 pageDocument.getElementById("webdeveloper.validate.local.accessibility.wai.priority2").checked = webdeveloper_getBooleanPreference("webdeveloper.validate.local.accessibility.wai.priority2", true);
1213 }
1214
1215 // If the WAI priority 3 preference is set
1216 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.wai.priority3"] != "undefined")
1217 {
1218 pageDocument.getElementById("webdeveloper.validate.local.accessibility.wai.priority3").checked = webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.wai.priority3"];
1219 }
1220 else if(webdeveloper_isPreferenceSet("webdeveloper.validate.local.accessibility.wai.priority3"))
1221 {
1222 pageDocument.getElementById("webdeveloper.validate.local.accessibility.wai.priority3").checked = webdeveloper_getBooleanPreference("webdeveloper.validate.local.accessibility.wai.priority3", true);
1223 }
1224
1225 // If the CSS profile preference is set
1226 if(typeof webdeveloper_optionsDataString["webdeveloper.validate.local.css.profile"] != "undefined")
1227 {
1228 validateLocalCSSProfile = webdeveloper_optionsDataString["webdeveloper.validate.local.css.profile"];
1229 }
1230 else if(webdeveloper_isPreferenceSet("webdeveloper.validate.local.css.profile"))
1231 {
1232 validateLocalCSSProfile = webdeveloper_getStringPreference("webdeveloper.validate.local.css.profile", true);
1233 }
1234
1235 // If validate local CSS profile is set to CSS 3
1236 if(validateLocalCSSProfile == "css3")
1237 {
1238 validateLocalCSSProfileRadio = pageDocument.getElementById("webdeveloper-validate-local-css3-radio");
1239 }
1240
1241 validateLocalCSSProfileRadio.radioGroup.selectedItem = validateLocalCSSProfileRadio;
1242
1243 // If the show outline preference is set
1244 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.validate.local.html.show.outline"] != "undefined")
1245 {
1246 pageDocument.getElementById("webdeveloper.validate.local.html.show.outline").checked = webdeveloper_optionsDataBoolean["webdeveloper.validate.local.html.show.outline"];
1247 }
1248 else if(webdeveloper_isPreferenceSet("webdeveloper.validate.local.html.show.outline"))
1249 {
1250 pageDocument.getElementById("webdeveloper.validate.local.html.show.outline").checked = webdeveloper_getBooleanPreference("webdeveloper.validate.local.html.show.outline", true);
1251 }
1252
1253 // If the show parse tree preference is set
1254 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.validate.local.html.show.parse.tree"] != "undefined")
1255 {
1256 pageDocument.getElementById("webdeveloper.validate.local.html.show.parse.tree").checked = webdeveloper_optionsDataBoolean["webdeveloper.validate.local.html.show.parse.tree"];
1257 }
1258 else if(webdeveloper_isPreferenceSet("webdeveloper.validate.local.html.show.parse.tree"))
1259 {
1260 pageDocument.getElementById("webdeveloper.validate.local.html.show.parse.tree").checked = webdeveloper_getBooleanPreference("webdeveloper.validate.local.html.show.parse.tree", true);
1261 }
1262
1263 // If the show source preference is set
1264 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.validate.local.html.show.source"] != "undefined")
1265 {
1266 pageDocument.getElementById("webdeveloper.validate.local.html.show.source").checked = webdeveloper_optionsDataBoolean["webdeveloper.validate.local.html.show.source"];
1267 }
1268 else if(webdeveloper_isPreferenceSet("webdeveloper.validate.local.html.show.source"))
1269 {
1270 pageDocument.getElementById("webdeveloper.validate.local.html.show.source").checked = webdeveloper_getBooleanPreference("webdeveloper.validate.local.html.show.source", true);
1271 }
1272 }
1273
1274 // Initializes the view source page
1275 function webdeveloper_initializeViewSource()
1276 {
1277 var description = null;
1278 var descriptionValue = null;
1279 var key = null;
1280 var keyValue = null;
1281 var listCell = null;
1282 var listItem = null;
1283 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
1284 var path = null;
1285 var pathValue = null;
1286 var viewSourceWithBox = pageDocument.getElementById("webdeveloper-listbox");
1287 var viewSourceWithCount = 0;
1288
1289 // If the view source in tab preference is set
1290 if(typeof webdeveloper_optionsDataBoolean["webdeveloper.view.source.tab"] != "undefined")
1291 {
1292 pageDocument.getElementById("webdeveloper.view.source.tab").checked = webdeveloper_optionsDataBoolean["webdeveloper.view.source.tab"];
1293 }
1294 else if(webdeveloper_isPreferenceSet("webdeveloper.view.source.tab"))
1295 {
1296 pageDocument.getElementById("webdeveloper.view.source.tab").checked = webdeveloper_getBooleanPreference("webdeveloper.view.source.tab", true);
1297 }
1298 else
1299 {
1300 pageDocument.getElementById("webdeveloper.view.source.tab").checked = false;
1301 }
1302
1303 // If the view source with count preference is set
1304 if(typeof webdeveloper_optionsDataInteger["webdeveloper.view.source.with.count"] != "undefined")
1305 {
1306 viewSourceWithCount = webdeveloper_optionsDataInteger["webdeveloper.view.source.with.count"];
1307 }
1308 else if(webdeveloper_isPreferenceSet("webdeveloper.view.source.with.count"))
1309 {
1310 viewSourceWithCount = webdeveloper_getIntegerPreference("webdeveloper.view.source.with.count", true);
1311 }
1312
1313 // Loop through the possible view source with options
1314 for(var i = 1; i <= viewSourceWithCount; i++)
1315 {
1316 description = "webdeveloper.view.source.with." + i + ".description";
1317 key = "webdeveloper.view.source.with." + i + ".key";
1318 path = "webdeveloper.view.source.with." + i + ".path";
1319
1320 // If the description is set
1321 if(typeof webdeveloper_optionsDataString[description] != "undefined")
1322 {
1323 descriptionValue = webdeveloper_optionsDataString[description].trim();
1324 }
1325 else if(webdeveloper_isPreferenceSet(description))
1326 {
1327 descriptionValue = webdeveloper_getStringPreference(description, true);
1328 }
1329 else
1330 {
1331 descriptionValue = null;
1332 }
1333
1334 // If the key is set
1335 if(typeof webdeveloper_optionsDataString[key] != "undefined")
1336 {
1337 keyValue = webdeveloper_optionsDataString[key].trim();
1338 }
1339 else if(webdeveloper_isPreferenceSet(key))
1340 {
1341 keyValue = webdeveloper_getStringPreference(key, true);
1342 }
1343 else
1344 {
1345 keyValue = null;
1346 }
1347
1348 // If the path is set
1349 if(typeof webdeveloper_optionsDataString[path] != "undefined")
1350 {
1351 pathValue = webdeveloper_optionsDataString[path].trim();
1352 }
1353 else if(webdeveloper_isPreferenceSet(path))
1354 {
1355 pathValue = webdeveloper_getStringPreference(path, true);
1356 }
1357 else
1358 {
1359 pathValue = null;
1360 }
1361
1362 // If the description and path are set
1363 if(descriptionValue && pathValue)
1364 {
1365 listItem = pageDocument.createElement("listitem");
1366 listCell = pageDocument.createElement("listcell");
1367
1368 listCell.setAttribute("label", descriptionValue);
1369 listItem.appendChild(listCell);
1370
1371 listCell = pageDocument.createElement("listcell");
1372 listCell.setAttribute("label", pathValue);
1373 listCell.setAttribute("crop", "end");
1374 listItem.appendChild(listCell);
1375
1376 listCell = pageDocument.createElement("listcell");
1377
1378 // If the key is set
1379 if(keyValue)
1380 {
1381 listCell.setAttribute("label", keyValue);
1382 }
1383
1384 listItem.appendChild(listCell);
1385 viewSourceWithBox.appendChild(listItem);
1386 }
1387 }
1388
1389 webdeveloper_listBoxSelected();
1390 }
1391
1392 // Called whenever a list box is selected
1393 function webdeveloper_listBoxSelected()
1394 {
1395 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
1396 var deleteButton = pageDocument.getElementById("webdeveloper-delete");
1397 var editButton = pageDocument.getElementById("webdeveloper-edit");
1398 var listBox = pageDocument.getElementById("webdeveloper-listbox");
1399 var moveDownButton = pageDocument.getElementById("webdeveloper-move-down");
1400 var moveUpButton = pageDocument.getElementById("webdeveloper-move-up");
1401 var selectedIndex = listBox.selectedIndex;
1402
1403 // If an item is selected
1404 if(listBox.selectedItem)
1405 {
1406 deleteButton.disabled = false;
1407 editButton.disabled = false;
1408
1409 // If this is the first item
1410 if(selectedIndex == 0)
1411 {
1412 moveUpButton.disabled = true;
1413 }
1414 else
1415 {
1416 moveUpButton.disabled = false;
1417 }
1418
1419 // If this is the last item
1420 if(selectedIndex == listBox.getRowCount() - 1)
1421 {
1422 moveDownButton.disabled = true;
1423 }
1424 else
1425 {
1426 moveDownButton.disabled = false;
1427 }
1428 }
1429 else
1430 {
1431 deleteButton.disabled = true;
1432 editButton.disabled = true;
1433 moveDownButton.disabled = true;
1434 moveUpButton.disabled = true;
1435 }
1436 }
1437
1438 // Moves the selected item down
1439 function webdeveloper_moveDown()
1440 {
1441 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
1442 var resizeBox = pageDocument.getElementById("webdeveloper-listbox");
1443 var selectedItem = resizeBox.selectedItem;
1444
1445 // If an item is selected and it is not at the bottom
1446 if(selectedItem && resizeBox.selectedIndex != resizeBox.getRowCount() - 1)
1447 {
1448 resizeBox.selectItem(resizeBox.insertBefore(selectedItem, resizeBox.getNextItem(selectedItem, 2)));
1449 }
1450 }
1451
1452 // Moves the selected item up
1453 function webdeveloper_moveUp()
1454 {
1455 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
1456 var resizeBox = pageDocument.getElementById("webdeveloper-listbox");
1457 var selectedItem = resizeBox.selectedItem;
1458
1459 // If an item is selected and it is not at the top
1460 if(selectedItem && resizeBox.selectedIndex != 0)
1461 {
1462 resizeBox.selectItem(resizeBox.insertBefore(selectedItem, resizeBox.getPreviousItem(selectedItem, 1)));
1463 }
1464 }
1465
1466 // Adds a new separator
1467 function webdeveloper_newSeparator()
1468 {
1469 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
1470 var listItem = pageDocument.createElement("listitem");
1471 var separator = pageDocument.createElement("separator");
1472 var toolBox = pageDocument.getElementById("webdeveloper-listbox");
1473
1474 separator.setAttribute("class", "groove");
1475 listItem.appendChild(separator);
1476
1477 separator = pageDocument.createElement("separator");
1478 separator.setAttribute("class", "groove");
1479 listItem.appendChild(separator);
1480
1481 separator = pageDocument.createElement("separator");
1482 separator.setAttribute("class", "groove");
1483 listItem.appendChild(separator);
1484
1485 toolBox.selectItem(toolBox.appendChild(listItem));
1486 toolBox.ensureElementIsVisible(toolBox.selectedItem);
1487 }
1488
1489 // Resets the user's options
1490 function webdeveloper_resetOptions()
1491 {
1492 var promptServiceInterface = Components.interfaces.nsIPromptService;
1493 var stringBundle = document.getElementById("webdeveloper-string-bundle");
1494
1495 // If the reset is confirmed
1496 if(Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(promptServiceInterface).confirmEx(null, stringBundle.getString("webdeveloper_resetConfirmation"), stringBundle.getString("webdeveloper_resetConfirmationMessage"), promptServiceInterface.BUTTON_TITLE_YES * promptServiceInterface.BUTTON_POS_0 + promptServiceInterface.BUTTON_TITLE_CANCEL * promptServiceInterface.BUTTON_POS_1, stringBundle.getString("webdeveloper_reset"), null, null, null, {}) == 0)
1497 {
1498 webdeveloper_optionsDataBoolean = new Array();
1499 webdeveloper_optionsDataInteger = new Array();
1500 webdeveloper_optionsDataString = new Array();
1501
1502 webdeveloper_deletePreferenceBranch("webdeveloper.");
1503 webdeveloper_setStringPreference("webdeveloper.version", webdeveloper_parseVersion("1.1.4"));
1504
1505 webdeveloper_configureKeyboardShortcuts(true);
1506 webdeveloper_setupDefaultOptions();
1507 webdeveloper_setupLocalizedOptions();
1508 webdeveloper_initializeOptions(false);
1509 }
1510 }
1511
1512 // Saves the user's options
1513 function webdeveloper_saveOptions()
1514 {
1515 var parentWindow = null;
1516 var option = null;
1517 var optionValue = null;
1518
1519 // Make sure current page is stored
1520 webdeveloper_storeOptions();
1521
1522 // Loop through the boolean options
1523 for(option in webdeveloper_optionsDataBoolean)
1524 {
1525 webdeveloper_setBooleanPreference(option, webdeveloper_optionsDataBoolean[option]);
1526 }
1527
1528 // Loop through the integer options
1529 for(option in webdeveloper_optionsDataInteger)
1530 {
1531 optionValue = webdeveloper_optionsDataInteger[option];
1532
1533 // If the option value is set
1534 if(optionValue)
1535 {
1536 webdeveloper_setIntegerPreference(option, optionValue);
1537 }
1538 else if(webdeveloper_isPreferenceSet(option))
1539 {
1540 webdeveloper_deletePreference(option);
1541 }
1542 }
1543
1544 // Loop through the string options
1545 for(option in webdeveloper_optionsDataString)
1546 {
1547 optionValue = webdeveloper_optionsDataString[option];
1548
1549 // If the option value is set or the preference currently has a value
1550 if(optionValue || webdeveloper_isPreferenceSet(option))
1551 {
1552 webdeveloper_setStringPreference(option, optionValue);
1553 }
1554 }
1555
1556 webdeveloper_changeOptions();
1557 webdeveloper_configureKeyboardShortcuts(false);
1558 }
1559
1560 // Stores the user's options to be saved later
1561 function webdeveloper_storeOptions()
1562 {
1563 var childNodes = null;
1564 var description = null;
1565 var i = 0;
1566 var iFrame = document.getElementById("webdeveloper-options-iframe");
1567 var iFrameSrc = iFrame.getAttribute("src");
1568 var key = null;
1569 var listCell = null;
1570 var listItem = null;
1571 var pageDocument = iFrame.contentDocument;
1572 var path = null;
1573 var stringBundle = document.getElementById("webdeveloper-string-bundle");
1574
1575 // If this is the colors page
1576 if(iFrameSrc.indexOf("colors_fonts") != -1)
1577 {
1578 webdeveloper_optionsDataInteger["webdeveloper.generated.content.font.size"] = pageDocument.getElementById("webdeveloper.generated.content.font.size").value;
1579 webdeveloper_optionsDataString["webdeveloper.feature.tooltip.color.background"] = pageDocument.getElementById("webdeveloper.feature.tooltip.color.background").color;
1580 webdeveloper_optionsDataString["webdeveloper.feature.tooltip.color.border"] = pageDocument.getElementById("webdeveloper.feature.tooltip.color.border").color;
1581 webdeveloper_optionsDataString["webdeveloper.feature.tooltip.color.text"] = pageDocument.getElementById("webdeveloper.feature.tooltip.color.text").color;
1582 webdeveloper_optionsDataString["webdeveloper.feature.tooltip.opacity"] = pageDocument.getElementById("webdeveloper.feature.tooltip.opacity").value;
1583 }
1584 else if(iFrameSrc.indexOf("dashboard") != -1)
1585 {
1586 var updateFrequency = pageDocument.getElementById("webdeveloper.edit.update.frequency").value;
1587
1588 webdeveloper_optionsDataBoolean["webdeveloper.dom.inspector.dashboard"] = pageDocument.getElementById("webdeveloper.dom.inspector.dashboard").checked;
1589 webdeveloper_optionsDataBoolean["webdeveloper.edit.wrap"] = pageDocument.getElementById("webdeveloper.edit.wrap").checked;
1590 webdeveloper_optionsDataBoolean["webdeveloper.error.console.dashboard"] = pageDocument.getElementById("webdeveloper.error.console.dashboard").checked;
1591 webdeveloper_optionsDataBoolean["webdeveloper.style.information.dashboard"] = pageDocument.getElementById("webdeveloper.style.information.dashboard").checked;
1592 webdeveloper_optionsDataInteger["webdeveloper.edit.font.size"] = pageDocument.getElementById("webdeveloper.edit.font.size").value;
1593 webdeveloper_optionsDataString["webdeveloper.edit.color.background"] = pageDocument.getElementById("webdeveloper.edit.color.background").color;
1594 webdeveloper_optionsDataString["webdeveloper.edit.color.text"] = pageDocument.getElementById("webdeveloper.edit.color.text").color;
1595
1596 // If the update frequency is set and is a valid integer and is positive
1597 if(updateFrequency && parseInt(updateFrequency) == updateFrequency && updateFrequency >= 0)
1598 {
1599 webdeveloper_optionsDataInteger["webdeveloper.edit.update.frequency"] = updateFrequency;
1600 }
1601 else
1602 {
1603 webdeveloper_optionsDataInteger["webdeveloper.edit.update.frequency"] = 0;
1604 }
1605 }
1606 else if(iFrameSrc.indexOf("general") != -1)
1607 {
1608 webdeveloper_optionsDataBoolean["webdeveloper.context.hide"] = pageDocument.getElementById("webdeveloper.context.hide").checked;
1609 webdeveloper_optionsDataBoolean["webdeveloper.confirmation.dialogs.hide"] = pageDocument.getElementById("webdeveloper.confirmation.dialogs.hide").checked;
1610 webdeveloper_optionsDataBoolean["webdeveloper.informational.dialogs.hide"] = pageDocument.getElementById("webdeveloper.informational.dialogs.hide").checked;
1611 webdeveloper_optionsDataBoolean["webdeveloper.menu.hide"] = pageDocument.getElementById("webdeveloper.menu.hide").checked;
1612 webdeveloper_optionsDataBoolean["webdeveloper.open.tabs"] = pageDocument.getElementById("webdeveloper.open.tabs").checked;
1613 webdeveloper_optionsDataBoolean["webdeveloper.open.tabs.background"] = pageDocument.getElementById("webdeveloper.open.tabs.background").checked;
1614 webdeveloper_optionsDataString["webdeveloper.toolbar.icons"] = pageDocument.getElementById("webdeveloper.toolbar.icons").value;
1615 }
1616 else if(iFrameSrc.indexOf("keys") != -1)
1617 {
1618 var textBox = null;
1619 var textBoxes = pageDocument.getElementById("webdeveloper-key-rows").getElementsByTagName("textbox");
1620 var textBoxesLength = textBoxes.length;
1621
1622 // Loop through the text boxes
1623 for(i = 0; i < textBoxesLength; i++)
1624 {
1625 textBox = textBoxes.item(i);
1626
1627 webdeveloper_optionsDataString[textBox.getAttribute("id")] = textBox.value.trim();
1628 }
1629 }
1630 else if(iFrameSrc.indexOf("miscellaneous") != -1)
1631 {
1632 webdeveloper_optionsDataBoolean["webdeveloper.information.tidy"] = pageDocument.getElementById("webdeveloper.information.tidy").checked;
1633 webdeveloper_optionsDataBoolean["webdeveloper.open.css.console.error"] = pageDocument.getElementById("webdeveloper.open.css.console.error").checked;
1634 webdeveloper_optionsDataBoolean["webdeveloper.open.javascript.console.warning"] = pageDocument.getElementById("webdeveloper.open.javascript.console.warning").checked;
1635 webdeveloper_optionsDataBoolean["webdeveloper.open.javascript.console.error"] = pageDocument.getElementById("webdeveloper.open.javascript.console.error").checked;
1636 webdeveloper_optionsDataString["webdeveloper.populate.form.fields.email"] = pageDocument.getElementById("webdeveloper.populate.form.fields.email").value;
1637 }
1638 else if(iFrameSrc.indexOf("resize") != -1)
1639 {
1640 var height = null;
1641 var resizeBox = pageDocument.getElementById("webdeveloper-listbox");
1642 var resizeCount = webdeveloper_getIntegerPreference("webdeveloper.resize.count", true);
1643 var viewport = null;
1644 var viewportValue = false;
1645 var width = null;
1646 var yes = stringBundle.getString("webdeveloper_yes");
1647
1648 // Loop through the previous resize options
1649 for(i = 1; i <= resizeCount; i++)
1650 {
1651 description = "webdeveloper.resize." + i + ".description";
1652 height = "webdeveloper.resize." + i + ".height";
1653 width = "webdeveloper.resize." + i + ".width";
1654
1655 webdeveloper_optionsDataInteger[height] = "";
1656 webdeveloper_optionsDataInteger[width] = "";
1657 webdeveloper_optionsDataString[description] = "";
1658 }
1659
1660 resizeCount = resizeBox.getRowCount();
1661
1662 // Loop through the possible resize options
1663 for(i = 1; i <= resizeCount; i++)
1664 {
1665 description = "webdeveloper.resize." + i + ".description";
1666 height = "webdeveloper.resize." + i + ".height";
1667 listItem = resizeBox.getItemAtIndex(i - 1);
1668 childNodes = listItem.childNodes;
1669 viewport = "webdeveloper.resize." + i + ".viewport";
1670 viewportValue = false;
1671 width = "webdeveloper.resize." + i + ".width";
1672
1673 // If the viewport label is set to yes
1674 if(listItem.childNodes[3].getAttribute("label") == yes)
1675 {
1676 viewportValue = true;
1677 }
1678
1679 webdeveloper_optionsDataBoolean[viewport] = viewportValue;
1680 webdeveloper_optionsDataInteger[width] = listItem.childNodes[1].getAttribute("label");
1681 webdeveloper_optionsDataInteger[height] = listItem.childNodes[2].getAttribute("label");
1682 webdeveloper_optionsDataString[description] = listItem.childNodes[0].getAttribute("label").trim();
1683 }
1684
1685 webdeveloper_optionsDataInteger["webdeveloper.resize.count"] = resizeCount;
1686 }
1687 else if(iFrameSrc.indexOf("tools") != -1)
1688 {
1689 var applicationType = stringBundle.getString("webdeveloper_application");
1690 var bookmarklet = null;
1691 var bookmarkletType = stringBundle.getString("webdeveloper_bookmarklet");
1692 var separator = null;
1693 var toolBox = pageDocument.getElementById("webdeveloper-listbox");
1694 var toolCount = toolBox.getRowCount();
1695 var toolPreviousCount = webdeveloper_getIntegerPreference("webdeveloper.tool.count", true);
1696 var url = null;
1697
1698 // Loop through the previous tools
1699 for(i = 1; i <= toolCount || i <= toolPreviousCount; i++)
1700 {
1701 bookmarklet = "webdeveloper.tool." + i + ".bookmarklet";
1702 description = "webdeveloper.tool." + i + ".description";
1703 key = "webdeveloper.tool." + i + ".key";
1704 path = "webdeveloper.tool." + i + ".path";
1705 separator = "webdeveloper.tool." + i + ".separator";
1706 url = "webdeveloper.tool." + i + ".url";
1707
1708 webdeveloper_optionsDataBoolean[separator] = false;
1709 webdeveloper_optionsDataString[bookmarklet] = "";
1710 webdeveloper_optionsDataString[description] = "";
1711 webdeveloper_optionsDataString[key] = "";
1712 webdeveloper_optionsDataString[path] = "";
1713 webdeveloper_optionsDataString[url] = "";
1714 }
1715
1716 // Loop through the possible tools
1717 for(i = 1; i <= toolCount; i++)
1718 {
1719 bookmarklet = "webdeveloper.tool." + i + ".bookmarklet";
1720 description = "webdeveloper.tool." + i + ".description";
1721 listItem = toolBox.getItemAtIndex(i - 1);
1722 childNodes = listItem.childNodes;
1723 listCell = listItem.childNodes[0];
1724 key = "webdeveloper.tool." + i + ".key";
1725 path = "webdeveloper.tool." + i + ".path";
1726 separator = "webdeveloper.tool." + i + ".separator";
1727 url = "webdeveloper.tool." + i + ".url";
1728
1729 // If the first cell is a separator
1730 if(listCell.tagName == "separator")
1731 {
1732 webdeveloper_optionsDataBoolean[separator] = true;
1733 }
1734 else
1735 {
1736 webdeveloper_optionsDataString[description] = listCell.getAttribute("label").trim();
1737 webdeveloper_optionsDataString[key] = listItem.childNodes[2].getAttribute("label").trim();
1738
1739 // If the tool type equals application
1740 if(listCell.getAttribute("type") == applicationType)
1741 {
1742 webdeveloper_optionsDataString[path] = listItem.childNodes[1].getAttribute("label").trim();
1743 }
1744 else if(listCell.getAttribute("type") == bookmarkletType)
1745 {
1746 webdeveloper_optionsDataString[bookmarklet] = listItem.childNodes[1].getAttribute("label").trim();
1747 }
1748 else
1749 {
1750 webdeveloper_optionsDataString[url] = listItem.childNodes[1].getAttribute("label").trim();
1751 }
1752 }
1753 }
1754
1755 webdeveloper_optionsDataInteger["webdeveloper.tool.count"] = toolCount;
1756 }
1757 else if(iFrameSrc.indexOf("validation") != -1)
1758 {
1759 var validateLocalCSSProfile = "css21";
1760
1761 // If the validate local CSS 3 radio button is selected
1762 if(pageDocument.getElementById("webdeveloper-validate-local-css3-radio").selected)
1763 {
1764 validateLocalCSSProfile = "css3";
1765 }
1766
1767 webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.section508"] = pageDocument.getElementById("webdeveloper.validate.local.accessibility.section508").checked;
1768 webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.wai.priority1"] = pageDocument.getElementById("webdeveloper.validate.local.accessibility.wai.priority1").checked;
1769 webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.wai.priority2"] = pageDocument.getElementById("webdeveloper.validate.local.accessibility.wai.priority2").checked;
1770 webdeveloper_optionsDataBoolean["webdeveloper.validate.local.accessibility.wai.priority3"] = pageDocument.getElementById("webdeveloper.validate.local.accessibility.wai.priority3").checked;
1771 webdeveloper_optionsDataBoolean["webdeveloper.validate.local.html.show.outline"] = pageDocument.getElementById("webdeveloper.validate.local.html.show.outline").checked;
1772 webdeveloper_optionsDataBoolean["webdeveloper.validate.local.html.show.parse.tree"] = pageDocument.getElementById("webdeveloper.validate.local.html.show.parse.tree").checked;
1773 webdeveloper_optionsDataBoolean["webdeveloper.validate.local.html.show.source"] = pageDocument.getElementById("webdeveloper.validate.local.html.show.source").checked;
1774 webdeveloper_optionsDataString["webdeveloper.validate.local.css.profile"] = validateLocalCSSProfile;
1775 }
1776 else if(iFrameSrc.indexOf("view_source") != -1)
1777 {
1778 var viewSourceWithBox = pageDocument.getElementById("webdeveloper-listbox");
1779 var viewSourceWithCount = viewSourceWithBox.getRowCount();
1780 var viewSourceWithPreviousCount = webdeveloper_getIntegerPreference("webdeveloper.view.source.with.count", true);
1781
1782 // Loop through the previous view source with options
1783 for(i = 1; i <= viewSourceWithCount || i <= viewSourceWithPreviousCount; i++)
1784 {
1785 description = "webdeveloper.view.source.with." + i + ".description";
1786 key = "webdeveloper.view.source.with." + i + ".key";
1787 path = "webdeveloper.view.source.with." + i + ".path";
1788
1789 webdeveloper_optionsDataString[description] = "";
1790 webdeveloper_optionsDataString[key] = "";
1791 webdeveloper_optionsDataString[path] = "";
1792 }
1793
1794 // Loop through the possible view source with options
1795 for(i = 1; i <= viewSourceWithCount; i++)
1796 {
1797 description = "webdeveloper.view.source.with." + i + ".description";
1798 listItem = viewSourceWithBox.getItemAtIndex(i - 1);
1799 childNodes = listItem.childNodes;
1800 key = "webdeveloper.view.source.with." + i + ".key";
1801 path = "webdeveloper.view.source.with." + i + ".path";
1802
1803 webdeveloper_optionsDataString[description] = listItem.childNodes[0].getAttribute("label").trim();
1804 webdeveloper_optionsDataString[key] = listItem.childNodes[2].getAttribute("label").trim();
1805 webdeveloper_optionsDataString[path] = listItem.childNodes[1].getAttribute("label").trim();
1806 }
1807
1808 webdeveloper_optionsDataBoolean["webdeveloper.view.source.tab"] = pageDocument.getElementById("webdeveloper.view.source.tab").checked;
1809 webdeveloper_optionsDataInteger["webdeveloper.view.source.with.count"] = viewSourceWithCount;
1810 }
1811 }
1812
1813 // Returns the index of the given page name
1814 function webdeveloper_translatePageNameToIndex(pageName)
1815 {
1816 // If the page name is set
1817 if(pageName)
1818 {
1819 // Switch on the page name
1820 switch(pageName)
1821 {
1822 case "general":
1823 return 0;
1824 case "colors-fonts":
1825 return 1;
1826 case "dashboard":
1827 return 2;
1828 case "keys":
1829 return 3;
1830 case "miscellaneous":
1831 return 4;
1832 case "resize":
1833 return 5;
1834 case "tools":
1835 return 6;
1836 case "validation":
1837 return 7;
1838 case "view-source":
1839 return 8;
1840 default:
1841 return 0;
1842 }
1843 }
1844
1845 return 0;
1846 }
1847
1848 // Updates the tab option status
1849 function webdeveloper_updateTabOptionStatus()
1850 {
1851 var disabled = true;
1852 var pageDocument = document.getElementById("webdeveloper-options-iframe").contentDocument;
1853
1854 // If open tabs is checked
1855 if(pageDocument.getElementById("webdeveloper.open.tabs").checked)
1856 {
1857 disabled = false;
1858 }
1859
1860 pageDocument.getElementById("webdeveloper.open.tabs.background").disabled = disabled;
1861 }