home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 123 / cdrom123.iso / essenc / extens / wweb / Web Developer.xpi / chrome / webdeveloper.jar / content / webdeveloper / dialogs / outline_elements.js next >
Encoding:
JavaScript  |  2004-11-21  |  1.8 KB  |  56 lines

  1. // Cancels the outline elements
  2. function webdeveloper_cancelOutlineElements()
  3. {
  4.     window.opener.document.getElementById("webdeveloper-outline-custom-elements-menu").setAttribute("checked", false);
  5.  
  6.     window.close();
  7. }
  8.  
  9. // Initializes the outline elements dialog
  10. function webdeveloper_initializeOutlineElements()
  11. {
  12.     const preferencesService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
  13.  
  14.     var color   = null;
  15.     var element = null;
  16.  
  17.     // Loop through the possible custom elements
  18.     for(var i = 1; i <= 5; i++)
  19.     {
  20.         color   = "webdeveloper.custom." + i + ".color";
  21.         element = "webdeveloper.custom." + i + ".element";
  22.  
  23.         // If the color is set
  24.         if(preferencesService.prefHasUserValue(color))
  25.         {
  26.             document.getElementById(color).color = preferencesService.getCharPref(color).trim();
  27.         }
  28.  
  29.         // If the element is set
  30.         if(preferencesService.prefHasUserValue(element))
  31.         {
  32.             document.getElementById(element).value = preferencesService.getCharPref(element).trim();
  33.         }
  34.     }
  35. }
  36.  
  37. // Saves the list of colors and elements to outline
  38. function webdeveloper_saveOutlineElements()
  39. {
  40.     const preferencesService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
  41.  
  42.     var color   = null;
  43.     var element = null;
  44.  
  45.     // Loop through the possible custom elements
  46.     for(var i = 1; i <= 5; i++)
  47.     {
  48.         color   = "webdeveloper.custom." + i + ".color";
  49.         element = "webdeveloper.custom." + i + ".element";
  50.  
  51.         preferencesService.setCharPref(color, document.getElementById(color).color);
  52.         preferencesService.setCharPref(element, document.getElementById(element).value.trim());
  53.     }
  54.  
  55.     window.arguments[0].push(true);
  56. }