-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredirect.js
75 lines (67 loc) · 1.8 KB
/
redirect.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
var url = new URL(window.location.href);
var searchParams = url.search.substring(1);
var urlSearchParams = new URLSearchParams(searchParams);
var types = {
// -- Scratch -- MAIN endpoints
"p": {
name: "Scratch Project",
url: "https://scratch.mit.edu/projects/"
},
"u": {
name: "Scratch User",
url: "https://scratch.mit.edu/users/"
},
"dt": { // DT = Discussion Topic
name: "Forum Topic on Scratch",
url: "https://scratch.mit.edu/discuss/topic/"
},
"dp": { // DP = Discussion Post
name: "Forum Post on Scratch",
url: "https://scratch.mit.edu/discuss/post/"
},
// -- UGC - Custom Endpoints
// OCULAR - ocular.jeffalo.net, created by Jeffalo
"ot": {
name: "Ocular Topic",
url: "https://ocular.jeffalo.net/topic/"
},
"op": {
name: "Ocular Post",
url: "https://ocular.jeffalo.net/post/"
},
"ou": {
name: "Ocular User",
url: "https://ocular.jeffalo.net/user/"
},
// SHEFWERLD - shefwerld.rirurin.com, created by CatsUnited
"su": {
name: "Shefwerld Forum Leaderboards - User Stats",
url: "https://shefwerld.rirurin.com/post/user?user="
},
"sl": {
name: "Shefwerld Forum Leaderboards - Leaderboards",
url: "https://shefwerld.rirurin.com/post/?category="
},
// -- SMD - Custom Endpoints
"tw": {
name: "TurboWarp Project",
url: "https://turbowarp.org/"
},
"fp": {
name: "Forkphorus Project",
url: "https://forkphorus.github.io/#"
},
"ep": {
name: "E羊icques Project",
url: "https://sheeptester.github.io/scratch-gui/#"
}
};
var type = urlSearchParams.get("t")
var ugcD = urlSearchParams.get("d")
if (types[type] && ugcD) {
var data = types[type]
document.title = "Redirecting you to: " + data.name
if (data.url) {
window.location.replace(`${data.url}${ugcD}`)
}
}