thử xem coi đúng ý k, cơ mà cái nút download video facebook đang dùng cái gì download thếCó cách nào lúc xem video facebook nó tự mở rộng ra ko bác @Fioren, mỗi lần muốn xem comment phải bấm mở rộng video mới xem được
Xem tệp đính kèm 3313063
Mã:
// ==UserScript==
// @name FB Watch → Reel
// @namespace FB Watch → Reel
// @version 1.0
// @match https://www.facebook.com/*
// @match https://www.facebook.com/
// ==/UserScript==
(function () {
'use strict';
function tryRedirect(href) {
try {
const url = new URL(href);
const vid = url.searchParams.get('v');
if (!vid || !url.pathname.startsWith('/watch')) return false;
const target = `${url.protocol}//${url.host}/reel/${vid}`;
if (location.href !== target) {
location.replace(target);
return true;
}
} catch (_) {}
return false;
}
if (tryRedirect(location.href)) return;
const observer = new MutationObserver(() => tryRedirect(location.href));
observer.observe(document, { subtree: true, childList: true });
const wrapHistory = (method) => {
const orig = history[method];
history[method] = function () {
const result = orig.apply(this, arguments);
tryRedirect(location.href);
return result;
};
};
wrapHistory('pushState');
wrapHistory('replaceState');
function waitForElement(selector, callback) {
const el = document.querySelector(selector);
if (el) return callback(el);
const mo = new MutationObserver(() => {
const element = document.querySelector(selector);
if (element) {
mo.disconnect();
callback(element);
}
});
mo.observe(document, { childList: true, subtree: true });
}
window.addEventListener('load', () => {
if (!location.pathname.startsWith('/reel/')) return;
waitForElement('div[role="button"][aria-label="Comment"]', (btn) => {
setTimeout(() => btn.click(), 500);
});
});
})();


