Advertisement
Guest User

Untitled

a guest
Aug 18th, 2011
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var MafiaaFireRocks_Parasites_MonkeyLights = new function () {
  2. //"use strict";
  3.  
  4.  
  5.  
  6.  
  7.             var xmlDoc = null;
  8.             var countXmlUrl = 0;
  9.            
  10.             var xmlUrl = [
  11.                         'http://mafiaafire.com/xml-update/mf_xml_list.xml',
  12.                         'http://ezee.se/xml-update/mf_xml_list.xml',
  13.                         'http://ilovemafiaafire.net/mf_xml_list.xml',
  14.                         'http://rihanna-samuel.com/mf_xml_list.xml'
  15.                         ];
  16.             xmlUrl.sort(function ()
  17.             {
  18.                 return 0.5 - Math.random();
  19.             })
  20.  
  21.  
  22.  
  23.             var realXmlUrl = xmlUrl[countXmlUrl];
  24.             var notificationUrl = 'http://mafiaafire.com/xml-update/click_here_for_details.php';
  25.             var root_node = null;
  26.             var second_node = null;
  27.             var p1 = '';
  28.             var p2 = null;
  29.             var timervar = null;
  30.             var timervar2 = null;
  31.             var mafiaafireFilterUrl = '';
  32.             var originalUrl = '';
  33.             var http_request = null;
  34.             // start Storage
  35.             var url = "http://mafiaafire.com";
  36.             var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
  37.             var ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"].getService(Components.interfaces.nsIScriptSecurityManager);
  38.             var dsm = Components.classes["@mozilla.org/dom/storagemanager;1"].getService(Components.interfaces.nsIDOMStorageManager);
  39.             var uri = ios.newURI(url, "", null);
  40.             var principal = ssm.getCodebasePrincipal(uri);
  41.             var storage = dsm.getLocalStorageForPrincipal(principal, "");
  42.             // end Storage
  43.             //Calling the interface for preferences
  44.             var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
  45.             var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
  46.             prefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
  47.             var alertsService = Components.classes["@mozilla.org/alerts-service;1"].getService(Components.interfaces.nsIAlertsService);
  48.             var this_version = null;
  49.             try
  50.             {
  51.                 // Firefox 4 and later; Mozilla 2 and later
  52.                 Components.utils.import("resource://gre/modules/AddonManager.jsm");
  53.                 AddonManager.getAddonByID("parasites@mafiaafire.com", function (addon)
  54.                 {
  55.                     //alert("My extension's version is r" + addon.version);
  56.                     self.this_version = addon.version;
  57.                 });
  58.             }
  59.             catch (ex)
  60.             {
  61.                 // Firefox 3.6 and before; Mozilla 1.9.2 and before
  62.                 var em = Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager);
  63.                 var addon = em.getItemForID("parasites@mafiaafire.com");
  64.                 //alert("My extension's version is rr" + addon.version);
  65.                 self.this_version = addon.version;
  66.             }
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.             // get the domain name from the current url
  76.             get_domain_name: function ()
  77.             {
  78.                 var urlbar = window.content.location.href;
  79.                 var domain_name_parts = urlbar.match(/:\/\/(.[^/]+)/)[1].split('.');
  80.                 if (domain_name_parts.length >= 3)
  81.                 {
  82.                     domain_name_parts[0] = '';
  83.                 }
  84.                 var dn = domain_name_parts.join('.');
  85.                 if (dn.indexOf('.') == 0) return dn.substr(1);
  86.                 else return dn;
  87.             },
  88.             filterUrl: function ()
  89.             {
  90.                 var urlBar = window.content.location.href;
  91.                 //check if url bar is blank or empty
  92.                 if (urlBar == 'about:blank' || urlBar == '' || urlBar.indexOf('http') < 0) {return false;}
  93.                 //1. get domain
  94.                 var processing_domain = get_domain_name();
  95.                 //alert(processing_domain);
  96.                 //Couldn't fetch the XML config, so returning gracefully
  97.                
  98.  
  99.  
  100.                             self.mafiaafireFilterUrl = '';
  101.                             self.mafiaafireFilterUrl = "bing.com";
  102.                             window.stop(); // Totally stop the page from loading.
  103.                             window.content.location.replace("chrome://Parasites_MonkeyLights/content/wait_page.html");
  104.  
  105.             }
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.            
  124.         var Parasites_MonkeyLights_urlBarListener = {
  125.             QueryInterface: function (aIID)
  126.             {
  127.                 if (aIID.equals(Components.interfaces.nsIWebProgressListener) || aIID.equals(Components.interfaces.nsISupportsWeakReference) || aIID.equals(Components.interfaces.nsISupports)) return this;
  128.                 throw Components.results.NS_NOINTERFACE;
  129.             },
  130.             //Called when the location of the window being watched changes
  131.             onLocationChange: function (aProgress, aRequest, aURI)
  132.             {
  133.                 // This fires when the location bar changes; that is load event is confirmed
  134.                 // or when the user switches tabs. If you use myListener for more than one tab/window,
  135.                 // use aProgress.DOMWindow to obtain the tab/window which triggered the change.
  136.                 main.filterUrl();
  137.             },
  138.             //Notification indicating the state has changed for one of the requests associated with aWebProgress.
  139.             onStateChange: function (aProgress, aRequest, aFlag, aStatus)
  140.             {
  141.                 if (aFlag & self.STATE_START)
  142.                 {
  143.                     // This fires when the load event is initiated
  144.                 }
  145.                 if (aFlag & self.STATE_STOP)
  146.                 {
  147.                     // This fires when the load finishes
  148.                 }
  149.             },
  150.             //Notification that the progress has changed for one of the requests associated with aWebProgress
  151.             onProgressChange: function ()
  152.             {},
  153.             //Notification that the status of a request has changed. The status message is intended to be displayed to the user.
  154.             onStatusChange: function ()
  155.             {},
  156.             //Notification called for security progress
  157.             onSecurityChange: function ()
  158.             {},
  159.             onLinkIconAvailable: function ()
  160.             {}
  161.         };//Parasites_MonkeyLights_urlBarListener
  162.  
  163.         var onLoad = function ()
  164.         {
  165.             //Initiating the progressListerner
  166.             gBrowser.addProgressListener(Parasites_MonkeyLights_urlBarListener);
  167.             //Load the block list xml form server
  168.             //self.main.request_xml();
  169.         };
  170.  
  171.         var onUnload = function ()
  172.         {
  173.             // Remove the progressListerner
  174.             gBrowser.removeProgressListener(Parasites_MonkeyLights_urlBarListener);
  175.         };
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183. //MafiaaFire_Redirector_mafiaafire.init();
  184.  
  185. /*
  186. MafiaaFireRocks_Parasites_MonkeyLights.init = init;
  187. MafiaaFireRocks_Parasites_MonkeyLights.onLoad = onLoad;
  188. MafiaaFireRocks_Parasites_MonkeyLights.onUnLoad = onUnLoad;
  189.  
  190.  
  191.  
  192.     }(this));
  193. */
  194. }
  195. MafiaaFireRocks_Parasites_MonkeyLights.init();
  196.  
  197. // this function is Called on window Onload event
  198. window.addEventListener("load", function (e)
  199. {
  200.     MafiaaFireRocks_Parasites_MonkeyLights.onLoad();
  201. }, false);
  202. window.addEventListener("unload", function (e)
  203. {
  204.     MafiaaFireRocks_Parasites_MonkeyLights.onUnload();
  205. }, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement