-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtapermonkey-joyreactor
49 lines (45 loc) · 1.5 KB
/
tapermonkey-joyreactor
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
// ==UserScript==
// @name joyreactor media expose
// @namespace jQueryForChromeExample
// @include http*://*joyreactor.cc/*
// @include http*://*joyreactor.com/*
// @author Christian Noel Reyes
// @description automatically exposes enlarged / downloadable media files
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main() {
// Note, jQ replaces $ to avoid conflicts.
jQ("a.prettyPhotoLink").each(function(index,value){
var obj = jQ(value);
obj.replaceWith(
jQ("<img>").attr("src", obj.attr("href"))
.attr("width", 800)
.css({
"border" : "2px dotted red"
})
);
});
jQ("a.video_gif_source").each(function(index,value){
var obj = jQ(value);
obj.replaceWith(
jQ("<img>").attr("src", obj.attr("href"))
.attr("width", 800)
.css({
"border" : "2px dotted blue"
})
);
});
}
// load jQuery and execute the main function
addJQuery(main);