home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 October / Gamestar_77_2005-10_dvd.iso / Programy / nsb-install-8-0.exe / chrome / browser.jar / content / browser / bookmarks / selectBookmark.js < prev    next >
Encoding:
Text File  |  2005-07-29  |  1.8 KB  |  63 lines

  1.  
  2. var gBookmarkTree;
  3. var gOK;
  4. var gUrls;
  5.  
  6. function Startup()
  7. {
  8.   initServices();
  9.   initBMService();
  10.   gOK = document.documentElement.getButton("accept");
  11.   gBookmarkTree = document.getElementById("bookmarks-view");  
  12.   gBookmarkTree.treeBoxObject.selection.select(0);
  13.   gBookmarkTree.focus();
  14. }
  15.  
  16. function onDblClick()
  17. {
  18.   if (!gOK.disabled)
  19.     document.documentElement.acceptDialog();
  20. }
  21.  
  22. function updateOK()
  23. {
  24.   var selection = gBookmarkTree._selection;
  25.   var ds = gBookmarkTree.tree.database;
  26.   var url;
  27.   gUrls = [];
  28.   for (var i=0; i<selection.length; ++i) {
  29.     var type     = selection.type[i];
  30. // XXX protocol is broken since we have unique id...
  31. //    var protocol = selection.protocol[i];
  32. //    if ((type == "Bookmark" || type == "") && 
  33. //        protocol != "find" && protocol != "javascript") {
  34.     if (type == "Bookmark" || type == "") {
  35.       url = BookmarksUtils.getProperty(selection.item[i], NC_NS+"URL", ds)
  36.       if (url)
  37.         gUrls.push(url);
  38.     } else if (type == "Folder" || type == "PersonalToolbarFolder") {
  39.       RDFC.Init(ds, selection.item[i]);
  40.       var children = RDFC.GetElements();
  41.       while (children.hasMoreElements()) {
  42.         var child = children.getNext().QueryInterface(kRDFRSCIID);
  43.         type      = BookmarksUtils.getProperty(child, RDF_NS+"type", ds);
  44. // XXX protocol is broken since we have unique id...
  45. //        protocol  = child.Value.split(":")[0];
  46. //        if (type == NC_NS+"Bookmark" && protocol != "find" && 
  47. //            protocol != "javascript") {
  48.           if (type == NC_NS+"Bookmark") {
  49.           url = BookmarksUtils.getProperty(child, NC_NS+"URL", ds);
  50.           if (url)
  51.             gUrls.push(url);
  52.         }
  53.       }
  54.     }
  55.   }
  56.   gOK.disabled = gUrls.length == 0;
  57. }
  58.  
  59. function onOK(aEvent)
  60. {
  61.   window.arguments[0].url = gUrls.join("|");
  62. }
  63.