home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / komunikace / kmeleon / K-Meleon1.1.3en-US.exe / chrome / embed.jar / kmprefs / content / pref-kbookmarks.xul < prev    next >
Extensible Markup Language  |  2007-04-23  |  9KB  |  225 lines

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/css" href="chrome://global/skin/"?>
  3. <?xul-overlay href="chrome://kmprefs/content/kplugins/bookmarksbar.xul"?>
  4. <?xul-overlay href="chrome://kmprefs/content/kplugins/booklistmanager.xul"?>
  5. <!DOCTYPE page SYSTEM "chrome://kmprefs/locale/pref-kbookmarks.dtd">
  6. <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
  7. id="prefBookmarks" onload="kBookmarks.init()">
  8.  
  9. <stringbundle id="pref_bundle" src="chrome://kmprefs/locale/pref.properties"/>
  10. <stringbundle id="brws_bundle" src="chrome://kmprefs/locale/pref-browsing.properties"/>
  11.  
  12. <script type="application/x-javascript" src="chrome://kmprefs/content/pref.js"/>
  13. <script type="application/x-javascript">
  14. <![CDATA[
  15. var kBookmarks = {
  16.  
  17. _base: null,
  18. _pref: null,
  19. _bndl: null,
  20.  
  21. _url: null,
  22. _mAD: null,
  23. _mML: null,
  24.  
  25. load : null,
  26. init : function() {
  27.     kLayers.init();
  28.     this.load  = kPlugin.load("bookmarks");
  29.     this._base = "kmeleon.plugins.bookmarks.";
  30.     this._pref = new Array(    "load",
  31.                 "askforFolder");
  32.     this._url  = this._base + "openurl";
  33.     this._mAD  = this._base + "menuAutoDetect";
  34.     this._mML  = this._base + "maxMenuLength";
  35.     this._bndl = document.getElementById("brws_bundle");
  36.     this._setControls();
  37.  
  38.     document.getElementById("openURLInCurrent").label = this._bndl.getString(kLayers.load?"layer_current":"window_current");
  39.     document.getElementById("openURLInLayer"  ).label = this._bndl.getString("layer_new");
  40.     document.getElementById("openURLInWindow" ).label = this._bndl.getString("window_new");
  41.  
  42.     for(var j=0;j<this._pref.length;j++) initCheckbox(this._base+this._pref[j]);
  43.     kBookmarksBar.init();
  44.     kBooklistManager.init("bookmarks");
  45. },
  46. setLength: function(elemID,prefVal) {
  47.     var val = parseInt(prefVal);
  48.  
  49.     if(prefVal)
  50.         if(isNaN(val) || val<0)
  51.             alert(document.getElementById("pref_bundle").getString("positive_integer_expected"));
  52.         else {
  53.             pref.setBoolPref(this._mAD,false);
  54.             // bug: Bookmarks menu disappears when kmeleon.plugins.bookmarks.maxMenuLength is in [1,7]
  55.             pref.setIntPref(this._mML,(val<8)?8:val);
  56.         }
  57.     else restoreDefault(elemID);
  58. },
  59. setOpen: function() {
  60.     pref.setCharPref(this._url,document.getElementById(this._url).value);
  61.     this._initOpen();
  62. },
  63. toggle: function() {
  64.     toggleCheckbox(this._base+this._pref[0]);
  65.     this.load = !this.load;
  66.     this._setControls();
  67.     kBookmarksBar._setControls();
  68.     kBooklistManager._setControls();
  69. },
  70. toggleForce: function(elem) {
  71.     pref.setBoolPref(this._mAD,!elem.checked);
  72.     elem.nextSibling.disabled = !elem.checked;
  73.     if(elem.nextSibling.value == 9999) elem.nextSibling.value = "";
  74.     elem.nextSibling.focus();
  75. },
  76. toggleOpen: function(chkBox) {
  77.     if(chkBox.checked)
  78.         pref.setCharPref(this._url,chkBox.id);
  79.     else
  80.         pref.setCharPref(this._url,chkBox.previousSibling.value);
  81.     this._initOpen();
  82. },
  83. toggleSpillover: function() {
  84.     var val = document.getElementById(this._mAD).value;
  85.  
  86.     val = (val == "true") ? true : false;
  87.     pref.setBoolPref(this._mAD,val);
  88.     if(!val) pref.setIntPref(this._mML,9999);
  89.     this._initSpillover();
  90. },
  91. _initOpen: function() {
  92.     var grp = document.getElementById(this._url), val;
  93.  
  94.     try {
  95.         val = pref.getCharPref(this._url);
  96.     } catch(e) {
  97.         if(this.load) for(var j=0,c=document.getElementById(this._url).childNodes;j<c.length;j++) c[j].setAttribute("disabled",true);
  98.     }
  99.  
  100.     document.getElementById("layers(OpenURLBg)").checked = false;
  101.     document.getElementById("ID_OPEN_LINK_IN_BACKGROUND").checked = false;
  102.     switch(val) {
  103.         case "ID_OPEN_LINK"              : grp.selectedIndex = 0; break;
  104.         case "layers(OpenURL)"           : grp.selectedIndex = 1; break;
  105.         case "layers(OpenURLBg)"         : grp.selectedIndex = 1; document.getElementById("layers(OpenURLBg)").checked = true; break;
  106.         case "ID_OPEN_LINK_IN_NEW_WINDOW": grp.selectedIndex = 2; break;
  107.         case "ID_OPEN_LINK_IN_BACKGROUND": grp.selectedIndex = 2; document.getElementById("ID_OPEN_LINK_IN_BACKGROUND").checked = true; break;
  108.         default                          : grp.selectedIndex =-1;
  109.     }
  110. },
  111. _initSpillover: function() {
  112.     var auto, grp = document.getElementById(this._mAD), val;
  113.  
  114.     try {
  115.         auto = pref.getBoolPref(this._mAD);
  116.     } catch(e) {
  117.         grp.selectedIndex = -1;
  118.         for(var j=0,c=grp.childNodes;j<2;j++) c[j].setAttribute("disabled",true);
  119.         document.getElementById("force").disabled = true;
  120.         document.getElementById(this._mML).disabled = true;
  121.         return;
  122.     }
  123.  
  124.     try {
  125.         val = pref.getIntPref(this._mML);
  126.     } catch(e) {
  127.         val = "";
  128.     }
  129.     document.getElementById(this._mML).value = val;
  130.     if(isNaN(val)) val = 0;
  131.  
  132.     if(auto) {
  133.         grp.selectedIndex = 1;
  134.         document.getElementById("force").checked = false;
  135.         document.getElementById("force").disabled = false;
  136.         document.getElementById(this._mML).disabled = true;
  137.     } else {
  138.         grp.selectedIndex = (val == 9999) ? 0 : 1;
  139.         document.getElementById("force").checked = (val>7 && val<9999) ? true : false;
  140.         document.getElementById("force").disabled = (grp.selectedIndex == 0) ? true : false;
  141.         document.getElementById(this._mML).disabled = !document.getElementById("force").checked;
  142.     }
  143. },
  144. _setControls: function() {
  145.     if(this.load) {
  146.         disableAll(false);
  147.         this._initOpen();
  148.         this._initSpillover();
  149.         document.getElementById("openURLInLayer"            ).disabled = !kLayers.load;
  150.         document.getElementById("layers(OpenURLBg)"         ).disabled = !kLayers.load;
  151.         document.getElementById("openURLInWindow"           ).disabled =  kLayers.only;
  152.         document.getElementById("ID_OPEN_LINK_IN_BACKGROUND").disabled =  kLayers.only;
  153.     } else {
  154.         this._initOpen();
  155.         this._initSpillover();
  156.         disableAll(true);
  157.         document.getElementById("force").disabled = true;
  158.         document.getElementById(this._mML).disabled = true;
  159.     }
  160.     document.getElementById(this._base+this._pref[0]).disabled = kPlugin.absent("bookmarks");
  161. }
  162.  
  163. };
  164. ]]>
  165. </script>
  166.  
  167. <vbox flex="1" style="overflow:auto">
  168.   <dialogheader title="&bookmarks.header;"/>
  169.   <separator class="thin"/>
  170.   <checkbox oncommand="kBookmarks.toggle()" id="kmeleon.plugins.bookmarks.load" label="&bookmarks.enable;"/>
  171.   <separator class="thin"/>
  172.   <checkbox oncommand="toggleCheckbox(this.id)" id="kmeleon.plugins.bookmarks.askforFolder" label="&bookmarks.askforFolder;"/>
  173.   <vbox id="kBookmarksLoad"/>
  174.   <separator class="thick"/>
  175.   <tabcontrol flex="1">
  176.     <tabbox flex="1">
  177.       <tabs>
  178.         <tab id="kBookmarksMenuTab" label="&bookmarks.menu;"/>
  179.         <tab id="kBookmarksTBarTab"/>
  180.         <tab id="kBooklistManagTab" label="&bookmarks.manager;"/>
  181.       </tabs>
  182.       <tabpanels flex="1">
  183.         <tabpanel flex="1" orient="vertical" style="overflow:auto">
  184.           <separator class="thin"/>
  185. <!-- Bookmarks Menu -->
  186. <hbox>
  187.   <groupbox flex="1">
  188.     <caption label="&bookmarks.open;"/>
  189.     <separator class="thin"/>
  190.     <radiogroup id="kmeleon.plugins.bookmarks.openurl">
  191.       <radio oncommand="kBookmarks.setOpen()" value="ID_OPEN_LINK" id="openURLInCurrent"/>
  192.       <radio oncommand="kBookmarks.setOpen()" value="layers(OpenURL)" id="openURLInLayer"/>
  193.       <checkbox oncommand="kBookmarks.toggleOpen(this)" id="layers(OpenURLBg)" label="&inBackground;" style="margin-left:2em"/>
  194.       <radio oncommand="kBookmarks.setOpen()" value="ID_OPEN_LINK_IN_NEW_WINDOW" id="openURLInWindow"/>
  195.       <checkbox oncommand="kBookmarks.toggleOpen(this)" id="ID_OPEN_LINK_IN_BACKGROUND" label="&inBackground;" style="margin-left:2em"/>
  196.     </radiogroup>
  197.     <separator class="thin"/>
  198.   </groupbox>
  199.   <groupbox flex="1">
  200.     <caption label="&spillover.label;"/>
  201.     <separator class="thin"/>
  202.     <description>&spillover.descr;</description>
  203.     <radiogroup id="kmeleon.plugins.bookmarks.menuAutoDetect">
  204.       <radio oncommand="kBookmarks.toggleSpillover()" value="false" label="&spillover.arrows;"/>
  205.       <radio oncommand="kBookmarks.toggleSpillover()" value="true" label="&spillover.submenu;"/>
  206.       <hbox align="center">
  207.         <checkbox oncommand="kBookmarks.toggleForce(this)" id="force" label="&spillover.forceBefore;" style="margin-left:2em"/>
  208.         <textbox id="kmeleon.plugins.bookmarks.maxMenuLength" size="4" class="uri-element" oninput="kBookmarks.setLength(this.id,this.value)"/>
  209.         <label value="&spillover.forceAfter;"/>
  210.       </hbox>
  211.     </radiogroup>
  212.   </groupbox>
  213. </hbox>
  214. <separator class="thick"/>
  215. <description>&restartNote2;</description>
  216. <!-- Bookmarks Menu -->
  217.         </tabpanel>
  218.     <tabpanel id="kBookmarksTBar"/>
  219.         <tabpanel id="kBooklistManag"/>
  220.       </tabpanels>
  221.     </tabbox>
  222.   </tabcontrol>
  223. </vbox>
  224.  
  225. </page>