home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 2010 Software/Programs / PCGuia_programas.iso / Software / Internet / FlashGet / flashget3.3.0.1092en.exe / FlashGet3.xpi / chrome / FlashGet3.jar / content / flashgetmenu.js < prev    next >
Encoding:
Text File  |  2009-07-21  |  2.9 KB  |  137 lines

  1.  
  2. function OnLoad()
  3. {
  4.     var contextMenu = document.getElementById("contentAreaContextMenu");
  5.     if (contextMenu)
  6.     {
  7.         contextMenu.addEventListener("popupshowing", Onflashget3Menu, false);
  8.     }
  9. }
  10.  
  11. window.addEventListener("load", OnLoad, false);
  12.  
  13. function Onflashget3Menu(event)
  14. {
  15.     if(!Findflashget())
  16.     {
  17.         gContextMenu.showItem("flashget3Single",false);
  18.         gContextMenu.showItem("flashget3Seq",false);
  19.         gContextMenu.showItem("flashget3All",false);
  20.         
  21.         return ;
  22.     }
  23.  
  24.     gContextMenu.showItem("flashget3Seq",true);
  25.     if(gContextMenu.onSaveableLink)
  26.     {
  27.         gContextMenu.showItem("flashget3Single",true);
  28.         gContextMenu.showItem("flashget3All",false);
  29.     }
  30.     else
  31.     {
  32.         gContextMenu.showItem("flashget3Single",false);
  33.         gContextMenu.showItem("flashget3All",true);
  34.     }    
  35. }
  36.  
  37. function Onflashget3Single(event)
  38. {
  39.     var obj
  40.     try
  41.     {
  42.         const cid = "@flashget.com/FlashgetXpiEx;1";
  43.         obj = Components.classes[cid].createInstance();
  44.         obj = obj.QueryInterface(Components.interfaces.IFlashgetXpi);
  45.     } 
  46.     catch (err) 
  47.     {
  48.         return;
  49.     }
  50.     
  51.     if ( obj == null )
  52.     {
  53.         return;
  54.     }
  55.     
  56.     var strRef = document.commandDispatcher.focusedWindow.document.URL;
  57.     
  58.     var strUrl = gContextMenu.link.toString();
  59.     
  60.     var strRemark = gContextMenu.target.textContent;
  61.     
  62.     var strCookie = document.commandDispatcher.focusedWindow.document.cookie;
  63.     
  64.     if (strUrl.length <8)
  65.     {
  66.         return false;
  67.     }
  68.     
  69.     obj.AddUrl(strUrl, strRemark, strRef, "FlashGet3",strCookie, 0);
  70. }
  71.  
  72. function Onflashget3All(event)
  73. {
  74.     var obj
  75.     try
  76.     {
  77.         const cid = "@flashget.com/FlashgetXpiEx;1";
  78.         obj = Components.classes[cid].createInstance();
  79.         obj = obj.QueryInterface(Components.interfaces.IFlashgetXpi);
  80.     } 
  81.     catch (err) 
  82.     {
  83.         return;
  84.     }
  85.     
  86.     if ( obj == null )
  87.     {
  88.         return;
  89.     }
  90.  
  91.     var strRef = document.commandDispatcher.focusedWindow.document.URL;
  92.     var strCookie = document.commandDispatcher.focusedWindow.document.cookie;
  93.     
  94.     var strLinks = document.commandDispatcher.focusedWindow.document.links;
  95.     var strImages = document.commandDispatcher.focusedWindow.document.images;
  96.     
  97.     var nLinkNum = strLinks.length;
  98.     var nImageNum = strImages.length;
  99.     
  100.     var nAllNum = nLinkNum;
  101.     
  102.     var my_array = new Array(nAllNum * 2 + 1);
  103.     my_array[0] = strRef;
  104.     
  105.     var i = 0;
  106.     for (i = 0; i < nLinkNum; i++)
  107.       {
  108.         my_array[i*2+1]=strLinks[i].href.toString();
  109.         my_array[i*2+2]=strLinks[i].innerText ? strLinks[i].innerText : "";
  110.       }
  111.  
  112.     obj.AddAllUrl(my_array.length, my_array, "FlashGet3",strCookie, 0);
  113. }
  114.  
  115. function Onflashget3Flv(event) 
  116. {
  117.     var obj
  118.     try
  119.     {
  120.         const cid = "@flashget.com/FlashgetXpiEx;1";
  121.         obj = Components.classes[cid].createInstance();
  122.         obj = obj.QueryInterface(Components.interfaces.IFlashgetXpi);
  123.     } catch (err) {
  124.         return;
  125.     }
  126.     
  127.     if ( obj == null )
  128.     {
  129.         return;
  130.     }
  131.     
  132.     var strRef = document.commandDispatcher.focusedWindow.document.URL;
  133.     
  134.     obj.FlvDetector(strRef, "FlashGet3", 0);
  135. }
  136.  
  137.