Greasy Fork is available in English.

TikTok to TikWM Redirect

Redirect TikTok video links to tikwm.com in a new tab when middle-clicked

ผู้เขียน
femto
จำนวนติดตั้งประจำวัน
0
จำนวนติดตั้งทั้งหมด
40
คะแนน
0 0 0
เวอร์ชัน
0.6
สร้างเมื่อ
02-06-2024
อัปเดตเมื่อ
02-06-2024
สัญญาอนุญาต
ไม่มี
ปรับใช้กับ

Script Name: TikTok to TikWM Redirect

Description:
Redirects TikTok video links to tikwm.com in a new tab when middle-clicked.
Works on both TikTok's website and Discord's chat platform.

Features:
Middle-click TikTok video links to open them on tikwm.com in a new tab.
Supports two URL formats:
Direct TikTok video links (e.g., https://www.tiktok.com/@username/video/1234567890)
Discord's URL pattern for TikTok videos (e.g., https://www.tiktok.com/username/video/1234567890)

How it Works:
Listens for middle clicks on elements.
Checks if clicked element is a link ( tag) with a matching TikTok URL pattern.
Extracts video ID from the URL using regular expressions (if it's a TikTok link).
Constructs the corresponding tikwm.com URL using the extracted video ID.
Opens the constructed tikwm.com URL in a new tab using GM_openInTab (Tampermonkey-specific).
Prevents the default middle-click behavior.

Additional Notes:
Relies on GM_openInTab, which might not work with all userscript managers.