您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Add next button for 115 HTML5 player
当前为
// ==UserScript== // @name [email protected] // @namespace http://tampermonkey.net/ // @version 0.1 // @description Add next button for 115 HTML5 player // @author zaypen // @match http*://*/* // @require https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js // @grant none // ==/UserScript== /*jslint browser:true*/ /*global _ */ (function() { 'use strict'; function main() { var items = Array.apply(null, document.querySelectorAll('.video-playlist .vpl-container .item-list li')); var remainingItems = _.dropWhile(items, function (item) { return item.className !== 'hover'; }); var nextItem = _.head(_.tail(remainingItems)); var playNext = function(e) { window.location.href = nextItem.querySelector('a').href; }; var nextButton = document.createElement('a'); nextButton.href = 'javascript:;'; nextButton.innerHTML = '<i class="icon-operate iop-playing" style="background-size: 400% 200%;"></i>'; nextButton.className = 'btn-switch'; nextButton.onclick = playNext; var playButton = document.querySelector('.operate-bar a[btn="play"]'); if (playButton && nextItem) { playButton.insertAdjacentElement('afterend', nextButton); document.body.addEventListener('keyup', function(e) { if (e.key === "PageDown") { playNext(); } }); return true; } } function retry(fn, interval, times) { var ret = fn(); if (!ret && times) { setTimeout(function () { retry(fn, interval, times--); }, interval); } } retry(main, 500, 10); })();