Last active
August 29, 2015 14:20
-
-
Save VEINHORN/9c36cf92aad970d64bf5 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
var requestCallback; | |
chrome.storage.sync.get({ | |
redirect_domain : "zerx.co", | |
domain_checking_interval : 5000 | |
}, function(items) { | |
console.log(items.domain_checking_interval); | |
setInterval(function() { | |
console.log('Domain name updated.'); | |
check_domain(); | |
if (typeof requestCallback === "function") { | |
chrome.webRequest.onBeforeRequest.removeListener(requestCallback); | |
requestCallback = null; | |
} | |
chrome.webRequest.onBeforeRequest.addListener( | |
function(details) { | |
//requestCallback = this; | |
redirected_url = "http://" + items.redirect_domain; | |
console.log("Redirected to: " + redirected_url); | |
return {redirectUrl: redirected_url}; | |
}, | |
{ | |
urls: ["http://zerx.co/*"], | |
types: ["main_frame"] | |
}, | |
["blocking"] | |
); | |
}, items.domain_checking_interval); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment