Trư vừa nhờ gemini nó viết cái userscript này, dùng để hiện nội dung link tiktok ở forum vb, đỡ phải click vào link khỏe re Spoiler: code Mã: // ==UserScript== // @name TikTok Embed for GVN (Fixed Domain) // @namespace Violentmonkey Scripts // @match *://*.gamevn.com/* // @match *://*.gvn.co/* // @grant GM_xmlhttpRequest // @version 3.2 // @author Gemini // @description Hỗ trợ nhúng TikTok cho cả gamevn.com và gvn.co // ==/UserScript== (function() { 'use strict'; function createEmbed(element, videoId) { if (!videoId || document.getElementById('tt-' + videoId)) return; const container = document.createElement('div'); container.id = 'tt-' + videoId; // Tăng chiều ngang một chút (330px) và chiều cao (590px) để không bị cắt mép container.style.cssText = "margin: 15px 0; width: 330px; height: 590px; background: #000; border-radius: 12px; overflow: hidden; position: relative; border: 1px solid #333;"; const iframe = document.createElement('iframe'); // Dùng player/v1 giúp video tự scale theo khung iframe.src = `https://www.tiktok.com/player/v1/${videoId}?music_info=1&description=1`; iframe.style.cssText = "width: 100%; height: 100%; border: none; position: absolute; top: 0; left: 0;"; iframe.setAttribute('allow', 'fullscreen; autoplay'); iframe.setAttribute('scrolling', 'no'); container.appendChild(iframe); element.insertAdjacentElement('afterend', container); } const links = document.querySelectorAll('a[href*="tiktok.com"]'); links.forEach(link => { const url = link.href; if (url.includes('/video/')) { const videoId = url.split('/video/')[1]?.split('?')[0]; createEmbed(link, videoId); } else if (url.includes('vt.tiktok.com') || url.includes('vm.tiktok.com')) { GM_xmlhttpRequest({ method: "GET", url: url, onload: function(response) { const finalUrl = response.finalUrl; const match = finalUrl.match(/\/video\/(\d+)/); if (match && match[1]) { createEmbed(link, match[1]); } } }); } }); })();