您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically scrolls through Reels when a video ends!!! You should use ViolentMonkey because Tampermonkey requires enabling developer mode!!!
// ==UserScript== // @name Auto Facebook Reels Scroller // @namespace http://tampermonkey.net/ // @version 1.2 // @description Automatically scrolls through Reels when a video ends!!! You should use ViolentMonkey because Tampermonkey requires enabling developer mode!!! // @author hiensumi // @match *://www.facebook.com/* // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; let pollingInterval = null; let lastUrl = 'nothing'; let enabled = false; function log(...args) { console.log('[AutoReels]', ...args); } function scrollToNextReel() { const nextButton = document.querySelector('[aria-label="Next Card"][role="button"]'); if (nextButton) { nextButton.click(); log('Scrolled to next reel'); } } function activateReelsScript() { enabled = true; if (pollingInterval) clearInterval(pollingInterval); log('Activated for Reels page'); let scrolled = false; pollingInterval = setInterval(() => { // console.log(enabled); if(!enabled) return; let vids = document.querySelectorAll('video'); if(window.location.href.includes('reel') == true && vids.length){ let vid = vids[vids.length - 1] //log(vid.duration - vid.currentTime); if (vid.duration > 2.0 && (vid.duration - vid.currentTime <= 1)) { if (!scrolled) { log('Video ends, scrolling'); scrolled = true; setTimeout(() => { scrollToNextReel(); }, 2000); } } else { scrolled = false; } } else{ enabled = false; setTimeout(() => { log('False activation'); }, 1000); return; } }, 500); } function deactivateReelsScript() { enabled = false; if (pollingInterval) { clearInterval(pollingInterval); pollingInterval = null; log('Deactivated (not on Reels page)'); } } navigation.addEventListener("navigate", e => { setTimeout(() => { log('Navigation: ' + window.location.href); if(window.location.href.includes('reel')){ deactivateReelsScript(); setTimeout(() => { activateReelsScript(); }, 1000); } else{ deactivateReelsScript(); } }, 3000); }); })();