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
მთლიანი ინსტალაციები
14
რეიტინგი
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.