-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
23 lines (19 loc) · 825 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
document.addEventListener('DOMContentLoaded', function () {
const convertBtn = document.getElementById('convertBtn');
const vipLinkInput = document.getElementById('vipLinkInput');
convertBtn.addEventListener('click', function () {
const vipLink = vipLinkInput.value.trim();
const url = new URL(vipLink);
const gameId = url.pathname.match(/\/games\/(\d+)/)[1];
const linkCode = url.searchParams.get('privateServerLinkCode');
if (gameId && linkCode) {
const robloxProtocolLink = `roblox://placeID=${gameId}&LinkCode=${linkCode}`;
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
const tab = tabs[0];
chrome.tabs.update(tab.id, { url: robloxProtocolLink });
});
} else {
alert('Invalid Roblox VIP link.');
}
});
});