-
-
Save P0lip/26cb4db0aba2ead3f406 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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