Flingster - Smart Auto-Skipper & Timer

Automatically skips males and sponsored ads with a draggable UI.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Flingster - Smart Auto-Skipper & Timer
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Automatically skips males and sponsored ads with a draggable UI.
// @author       Reddit Community
// @license      MIT
// @match        *://flingster.com/*
// @match        *://*.flingster.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // --- 1. VISUAL STYLES ---
    const estilo = document.createElement('style');
    estilo.innerHTML = `
        .flingster-panel { position: fixed; background-color: #111; color: #ddd; border: 1px solid #333; border-radius: 5px; font-family: Arial, sans-serif; font-size: 12px; z-index: 999999; box-shadow: 0 4px 8px rgba(0,0,0,0.5); }
        .flingster-header { background-color: #000; padding: 5px 10px; border-bottom: 1px solid #333; border-radius: 5px 5px 0 0; font-weight: bold; display: flex; justify-content: space-between; cursor: move; }
        .flingster-content { padding: 10px; }
        .flingster-btn { width: 100%; background: #000; color: white; border: 1px solid #555; padding: 5px; cursor: pointer; margin-top: 5px;}
        .flingster-btn:hover { background: #222; }
        .check-row { display: flex; align-items: center; margin-bottom: 8px; }
        .check-row input { margin-right: 8px; cursor: pointer; }
    `;
    document.head.appendChild(estilo);

    // --- DRAG & DROP FUNCTION ---
    function makeDraggable(element, handle) {
        let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
        handle.onmousedown = dragMouseDown;

        function dragMouseDown(e) {
            e = e || window.event;
            e.preventDefault();
            pos3 = e.clientX;
            pos4 = e.clientY;
            document.onmouseup = closeDragElement;
            document.onmousemove = elementDrag;
        }

        function elementDrag(e) {
            e = e || window.event;
            e.preventDefault();
            pos1 = pos3 - e.clientX;
            pos2 = pos4 - e.clientY;
            pos3 = e.clientX;
            pos4 = e.clientY;
            element.style.right = 'auto'; 
            element.style.bottom = 'auto';
            element.style.top = (element.offsetTop - pos2) + "px";
            element.style.left = (element.offsetLeft - pos1) + "px";
        }

        function closeDragElement() {
            document.onmouseup = null;
            document.onmousemove = null;
        }
    }

    // --- 2. SESSION TIMER ---
    const topBar = document.createElement('div');
    topBar.id = 'flingster-top-bar';
    topBar.className = 'flingster-panel';
    topBar.style.top = '10px';
    topBar.style.left = '50%';
    topBar.style.transform = 'translateX(-50%)';
    topBar.style.display = 'flex';
    topBar.style.gap = '15px';
    topBar.style.padding = '5px 15px';
    topBar.innerHTML = `
        <span style="cursor: move;" id="timer-drag-handle"><b>Flingster Timer</b></span>
        <span id="f-session-time">Session: 00:00:00</span>
        <button class="flingster-btn" style="width: auto; padding: 0 10px; margin: 0;" id="f-reset-btn">Reset</button>
    `;
    document.body.appendChild(topBar);
    
    makeDraggable(topBar, document.getElementById('timer-drag-handle'));

    let sessionSeconds = 0;
    const sessionDisplay = document.getElementById('f-session-time');
    setInterval(() => {
        sessionSeconds++;
        let hrs = Math.floor(sessionSeconds / 3600).toString().padStart(2, '0');
        let mins = Math.floor((sessionSeconds % 3600) / 60).toString().padStart(2, '0');
        let secs = (sessionSeconds % 60).toString().padStart(2, '0');
        sessionDisplay.innerText = `Session: ${hrs}:${mins}:${secs}`;
    }, 1000);
    document.getElementById('f-reset-btn').addEventListener('click', () => { sessionSeconds = 0; });

    // --- 3. AUTO-SKIPPER PANEL ---
    const skipperPanel = document.createElement('div');
    skipperPanel.className = 'flingster-panel';
    skipperPanel.style.top = '100px';
    skipperPanel.style.right = '20px'; 
    skipperPanel.style.width = '220px';
    skipperPanel.innerHTML = `
        <div class="flingster-header" id="skipper-drag-handle" title="Click and drag to move">
            <span>Auto-Skipper</span>
            <span style="cursor:pointer; color:red;" id="skip-close">[-]</span>
        </div>
        <div class="flingster-content">
            <div class="check-row">
                <input type="checkbox" id="skip-males" checked>
                <label for="skip-males">Auto-Skip Males</label>
            </div>
            <div class="check-row">
                <input type="checkbox" id="skip-ads" checked>
                <label for="skip-ads">Skip Sponsored Ads</label>
            </div>
            
            <button class="flingster-btn" id="btn-start-skipper">Start Skipper</button>
            <div id="skip-status" style="text-align:center; margin-top:5px; color:#aaa; font-weight:bold;">Off</div>
        </div>
    `;
    document.body.appendChild(skipperPanel);

    makeDraggable(skipperPanel, document.getElementById('skipper-drag-handle'));

    document.getElementById('skip-close').addEventListener('click', () => { skipperPanel.style.display = 'none'; });

    // --- 4. THE MAGIC: AUTO-SKIPPER LOGIC ---
    let isSkipperActive = false;
    let skipInterval = null;
    let isSkipping = false; 

    const btnSkip = document.getElementById('btn-start-skipper');
    const statusSkip = document.getElementById('skip-status');

    function doSkip() {
        if (isSkipping) return; 
        
        const nextBtn = document.querySelector('.mrb-next');
        if (nextBtn) {
            isSkipping = true;
            nextBtn.click();
            statusSkip.innerText = "Skipping! >>";
            
            // Safe delay (1.2 seconds) to let new cam load
            setTimeout(() => { 
                isSkipping = false; 
                if(isSkipperActive) statusSkip.innerText = "Scanning..."; 
            }, 1200); 
        }
    }

    btnSkip.addEventListener('click', () => {
        isSkipperActive = !isSkipperActive;
        
        if (isSkipperActive) {
            btnSkip.innerText = "Stop Skipper";
            btnSkip.style.backgroundColor = "#005500"; 
            statusSkip.innerText = "Scanning...";
            statusSkip.style.color = "#4ade80";

            // Checks screen every 500ms safely
            skipInterval = setInterval(() => {
                if (isSkipping) return;

                if (document.getElementById('skip-males').checked && document.querySelector('.gndr_male')) {
                    doSkip();
                }
                else if (document.getElementById('skip-ads').checked && document.querySelector('.flag-sponsored')) {
                    doSkip();
                }
            }, 500);

        } else {
            btnSkip.innerText = "Start Skipper";
            btnSkip.style.backgroundColor = "#000";
            statusSkip.innerText = "Off";
            statusSkip.style.color = "#aaa";
            clearInterval(skipInterval);
        }
    });

})();