forked from jimrollenhagen/pywhatauto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbutton.user.js
115 lines (110 loc) · 4.16 KB
/
button.user.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// ==UserScript==
// @name What.cd Whatauto link creator
// @namespace test.com
// @author blubbablubb
// @description Userscript to add a download button next to the torrent on the following sites.
// @include http*://*what.cd/*
// @include http*://*broadcasthe.net/*
// @include http*://*fux0r.eu/*
// @include http*://*passthepopcorn.me/*
// @include http*://*tehconnection.eu/*
// @include https://www.waffles.fm/*
// @include http*://*hdbits.org/*
// @include http*://*bitmetv.org/*
// @include http*://*sceneaccess.eu/*
// @include http*://*awesome-hd.net/*
// @include http*://*bit-hdtv.com/*
// @include http*://*x264.me/*
// @version 0.0.21
// @date 2014-14-05
// ==/UserScript==
// EDIT THE FOLLOWING LINE WITH YOUR HOST (OR IP) + PORT WHICH YOU HAVE SELECTED IN setup.conf IN pyWHATAUTO
var weblink = "http://example.com:1337/dl.pywa?pass=youwouldliketoknowthisone";
if (/https?.*?what\.cd.*/.test(document.URL)) {
var linkregex = /torrents.php\?action=download.*?id=(\d+).*/i;
var devider = ' | ';
var site = "whatcd";
} else if (/https?.*?broadcasthe\.net.*/.test(document.URL)) {
var linkregex = /torrents.php\?action=download.*?id=(\d+).*?authkey=.*?torrent_pass=.*/i;
var devider = ' | ';
var site = "broadcasthenet";
} else if (/https?.*?fux0r\.eu.*/.test(document.URL)) {
var linkregex = /torrents.php\?action=download.*?id=(\d+).*?/i;
var devider = ' : ';
var site = "fux0r";
} else if (/https?.*?passthepopcorn\.me.*/.test(document.URL)) {
var linkregex = /torrents.php\?action=download.*?id=(\d+).*?authkey=.*?torrent_pass=.*/i;
var devider = ' | ';
var site = "passthepopcorn";
} else if (/https?.*?tehconnection\.eu.*/.test(document.URL)) {
var linkregex = /torrents.php\?action=download.*?id=(\d+).*?authkey=.*?torrent_pass=.*/i;
var devider = ' | ';
var site = "tehconnection";
} else if (/https?.*?waffles\.fm.*/.test(document.URL)) {
var linkregex = /.*?download.php\/\d+\/(\d+)\/(.*?)\.torrent\?passkey.*/i;
var devider = ' | ';
var site = "waffles";
var includename = "2";
} else if (/https?.*?hdbits\.org.*/.test(document.URL)) {
var linkregex = /download.php\?id=(\d+).*/i;
var devider = ' | ';
var site = "hdbits";
// var includename = "2";
} else if (/https?.*?bitmetv\.org.*/.test(document.URL)) {
var linkregex = /.*?download.php\/(\d+)\/(.*?)\.torrent$/i;
var devider = ' | ';
var site = "bitmetv";
var includename = "2";
} else if (/https?.*?sceneaccess\.eu.*/.test(document.URL)) {
var linkregex = /downloadbig.php\?id=(\d+).*?/i;
var devider = ' | ';
var site = "sceneaccess";
} else if (/https?.*?awesome-hd\.net.*/.test(document.URL)) {
var linkregex = /torrents.php\?action=download.*?id=(\d+).*?/i;
var devider = ' | ';
var site = "awesomehd";
} else if (/https?.*?bit-hdtv\.com.*/.test(document.URL)) {
var linkregex = /.*?download.php\/(\d+)\/(.*?)\.torrent.*/i;
var devider = ' | ';
var site = "bithdtv";
var includename = "2";
} else if (/https?.*?x264\.me.*/.test(document.URL)) {
var linkregex = /.*?download.php\/(\d+)\/(.*?)\.torrent.*/i;
var devider = ' | ';
var site = "bithdtv";
var includename = "2";
} else {
alert("You have found a bug. Go and tell blubba!");
}
alltorrents = new Array();
for (var i=0; i < document.links.length; i++) {
alltorrents.push(document.links[i]);
}
for (var i=0; i < alltorrents.length; i++) {
if (linkregex.exec(alltorrents[i])) {
if (includename == 1) {
id = RegExp.$2;
name = RegExp.$1;
} else if (includename == 2) {
id = RegExp.$1;
name = RegExp.$2;
} else {
id = RegExp.$1;
}
createlink(alltorrents[i],id,name);
}
}
function createlink(linkelement,id,name) {
var link = document.createElement("pyWA");
link.appendChild(document.createElement("a"));
link.firstChild.appendChild(document.createTextNode("pWA"));
link.appendChild(document.createTextNode(devider));
if (name) {
link.firstChild.href=weblink+"&name="+name+"&site="+site+"&id="+id;
} else {
link.firstChild.href=weblink+"&site="+site+"&id="+id;
}
link.firstChild.target="_blank";
link.firstChild.title="Direct Download to pyWHATauto";
linkelement.parentNode.insertBefore(link, linkelement);
}