2Posit

Watch playposit videos at 1.5x, 2x, or 10x speed!

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         2Posit
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Watch playposit videos at 1.5x, 2x, or 10x speed!
// @author       reesericci
// @match        https://api.playposit.com/player_v2/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=playposit.com
// @grant        none
// @license      GPL-v3.0-or-later
// ==/UserScript==



function waitForElm(selector) {
    return new Promise(resolve => {
        if (document.querySelector(selector)) {
            return resolve(document.querySelector(selector));
        }

        const observer = new MutationObserver(mutations => {
            if (document.querySelector(selector)) {
                resolve(document.querySelector(selector));
                observer.disconnect();
            }
        });

        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    });
}


(async function() {
    'use strict';

    await waitForElm("#playback-speed-select-all");

    let oneFiveOption = document.createElement("option")
    oneFiveOption.value = 1.5;
    oneFiveOption.text = "1.5x Speed"

    let twoOption = document.createElement("option")
    twoOption.value = 2;
    twoOption.text = "2x Speed"

    let tenOption = document.createElement("option")
    tenOption.value = 10;
    tenOption.text = "10x Speed"

    document.getElementById("playback-speed-select-all").add(oneFiveOption)
    document.getElementById("playback-speed-select-all").add(twoOption)
    document.getElementById("playback-speed-select-all").add(tenOption)
})();