Skip to content

Instantly share code, notes, and snippets.

@P0lip

P0lip/wykop Secret

Created February 18, 2015 22:34
Show Gist options
  • Save P0lip/26cb4db0aba2ead3f406 to your computer and use it in GitHub Desktop.
Save P0lip/26cb4db0aba2ead3f406 to your computer and use it in GitHub Desktop.
const { Cc, Ci, Cu } = require("chrome");
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
const wykopURL = new RegExp("http://.*.wykop.pl");
const windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
let windowEnumerator = windowMediator.getEnumerator("navigator:browser");
let window;
const onChangeListener = {
onLocationChange(aProgress, aRequest, aURI) {
if (wykopURL.test(aURI.name)) {
startup();
window.gBrowser.removeTabsProgressListener(this);
}
}
};
while((window = windowEnumerator.getNext()))
window.gBrowser.addTabsProgressListener(onChangeListener);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment