forked from ErichMoraga/tis-rip
-
Notifications
You must be signed in to change notification settings - Fork 4
/
injected.js
37 lines (31 loc) · 898 Bytes
/
injected.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
while ($ === undefined) {}
$(".footer").remove();
$("link[rel=stylesheet]").each(function(e) {
var ss = $(this);
var href = ss[0].href;
$.ajax({
url: href,
async: false,
success: function(result) {
$("style").remove();
var selem = $("<style type=\"text/css\">" + result + "</style>");
$("head").append(selem);
},
});
ss.remove();
});
$("img").each(function(i, img) {
if (img.currentSrc.indexOf("data:") !== 0) {
var c = document.createElement("canvas");
var ctx = c.getContext("2d");
c.width = img.naturalWidth;
c.height = img.naturalHeight;
ctx.drawImage(img, 0, 0);
var dataURL = c.toDataURL();
img.src = dataURL;
} else {
console.log("already data uri");
}
});
$("script").remove();
return document.documentElement.outerHTML;