Created
October 7, 2013 17:11
-
-
Save tistaharahap/6871441 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
(function(win) { | |
var xhr = win.XMLHttpRequest ? win.XMLHttpRequest : null; | |
if(xhr === null) | |
return; | |
var org = xhr.open; | |
xhr.open = function(method, url, someBool) { | |
var uris = url.split('?'); | |
if(uris.length > 2) | |
return; | |
var cleanURL = uris[0].replace('http://', '').replace('https://', '').split('/'); | |
if(cleanURL.length < 2) | |
return; | |
var host = cleanURL[0]; | |
var blacklist = [ | |
'172.25.48.182', | |
'172.25.48.182:8006', | |
'172.25.48.182:8004', | |
'172.25.48.111', | |
'ibnads.xl.co.id', | |
'ibnads.xl.co.id:8006', | |
'ibnads.xl.co.id:8004' | |
]; | |
for(var key in blacklist) { | |
if(blacklist[key] === host) { | |
blockPlease(); | |
return; | |
} | |
} | |
org.open(method, url, someBool); | |
}; | |
function blockPlease() { | |
console.log('No go bro. Content is blocked. Don\'t invade our content!'); | |
} | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment