-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.user.js
More file actions
60 lines (53 loc) · 1.75 KB
/
Copy pathMain.user.js
File metadata and controls
60 lines (53 loc) · 1.75 KB
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
// ==UserScript==
// @name URL Server Join
// @namespace name?
// @version 1.9
// @updateURL https://github.com/Haydz6/URLServerJoin/raw/main/Main.js
// @homepage https://github.com/Haydz6/URLServerJoin
// @downloadURL https://github.com/Haydz6/URLServerJoin/raw/main/Main.js
// @description Join specific server with JobID
// @author Haydz6
// @match http*://*.roblox.com/games/*
// @grant none
// @run-at document-start
// ==/UserScript==
function GetURLParameter(ParamName){
const AllParameters = window.location.search.split("?")[1]
const Parameters = AllParameters && AllParameters.split("&")
if (!Parameters) return
for (let i = 0; i < Parameters.length; i++){
const [Name, Value] = Parameters[i].split("=")
if (Name == ParamName){
return Value
}
}
}
function GrabURLEarly(){
const PlaceID = String(location.href.match(/\/(\d+)\//g)).match(/\d+/g)
const JobID = GetURLParameter("JobID")
return [JobID, PlaceID]
}
function JoinPlace(JobID, PlaceID){
Roblox.GameLauncher.joinGameInstance(parseInt(PlaceID,10), String(JobID))
}
function ClientOpened(){
window.close()
}
const [JobID, PlaceID] = GrabURLEarly()
if (!JobID || !PlaceID) return
function PageLoaded(){
JoinPlace(JobID, PlaceID)
for (const property in Roblox.GameLauncher) {
if (property.slice(0,6).toLowerCase() == "jquery"){
Roblox.GameLauncher[property].events.startClientSucceeded["0"].handler = ClientOpened
}
}
}
function WaitForRoblox(){
if (!Roblox?.GameLauncher?.joinGameInstance || !Roblox?.GameLauncher?.gameLaunchInterface?.joinGameInstance){
setTimeout(WaitForRoblox, 100)
return
}
PageLoaded()
}
WaitForRoblox()