Greasy Fork

来自缓存

Greasy Fork is available in English.

阿里云盘多倍速播放

阿里云视频倍速播放增加了额外倍速的选择,增加的方式是在原有的倍速播放样式基础上增加,保证使用方便及样式统一

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         阿里云盘多倍速播放
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  阿里云视频倍速播放增加了额外倍速的选择,增加的方式是在原有的倍速播放样式基础上增加,保证使用方便及样式统一
// @author       wenzheng.li
// @match        *://www.aliyundrive.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=aliyundrive.com
// @license      MIT
// ==/UserScript==

(function() {
  'use strict';
  window.addEventListener('load', () => {
  const interval = setInterval(() => {
    const video = document.querySelector('video')
    const ul = document.querySelector('.drawer-list-grid--2S0tk')
    const close =
      ul.parentElement.parentElement.previousElementSibling.children.item(1)
    let firstChild = [...ul.children].find(
      (el) => el.firstChild.textContent === '1.5 倍'
    )
    const rates = ['3', '2.5', '2']
    rates.forEach((rate) => {
      const cloneNode = firstChild.cloneNode(true)
      cloneNode.firstChild.innerHTML = `${rate}倍`
      ul.insertBefore(cloneNode, firstChild)
      firstChild = cloneNode
    })
    const backRateNodes = [...ul.children]
    const changeSelectColor = (select) => {
      setTimeout(() => {
        backRateNodes.forEach((item) => {
          item.dataset.isCurrent = 'false'
        })
        if (!select.dataset.isCurrent) {
          select.parentElement.dataset.isCurrent = 'true'
        } else {
          select.dataset.isCurrent = 'true'
        }
        close.click()
      })
    }
    ul.addEventListener('click', (e) => {
      const target = e.target
      const PlaybackRate = target.textContent.replace('倍', '')
      video.playbackRate = PlaybackRate
      changeSelectColor(target)
    })

    if (video) {
      clearInterval(interval)
    }
  }, 1000)
  })
})();