-
Notifications
You must be signed in to change notification settings - Fork 0
/
injectedCode.js
executable file
·50 lines (42 loc) · 1.53 KB
/
injectedCode.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
if (window.location.href.indexOf('/agar.io/') + 1) {
window.stop();
document.documentElement.innerHTML = 'Initialize plugin...';
var xhr = new XMLHttpRequest();
xhr.open('GET', window.location.href, true);
xhr.onerror = function () {
document.documentElement.innerHTML = 'Error getting Agar.io client';
};
xhr.onload = function () {
var page = document.implementation.createHTMLDocument("");
page.documentElement.innerHTML = this.responseText;
var newPage = document.importNode(page.documentElement, true);
var nodeList = newPage.querySelectorAll('script');
for (var i = 0; i < nodeList.length; ++i) {
var node = nodeList[i];
if (node.src.indexOf('main_out') > 0){
node.removeAttribute('src');
node.src = '';
}
if (node.innerHTML.indexOf('MiniclipAPI') > 0)
{
//node.removeAttribute('src');
//node.innerHTML = '';
//node.src = '';
}
}
document.replaceChild(newPage, document.documentElement);
var s;
var scripts = [
chrome.extension.getURL('client.js'),
'http://www.parsecdn.com/js/parse-latest.js',
// 'https://code.jquery.com/ui/1.11.4/jquery-ui.min.js'
];
for (i = 0; i < scripts.length; ++i) {
s = document.createElement('SCRIPT');
s.charset = 'UTF-8';
s.src = scripts[i];
document.getElementsByTagName('HEAD')[0].appendChild(s);
}
}
xhr.send();
}