Greasy Fork

Greasy Fork is available in English.

虎牙免登陆

虎牙免登陆换画质

当前为 2018-01-05 提交的版本,查看 最新版本

// ==UserScript==
// @name         虎牙免登陆
// @version      0.1
// @description  虎牙免登陆换画质
// @author       You
// @match        http://www.huya.com/*
// @grant        none
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @namespace http://greasyfork.icu/users/165658
// ==/UserScript==

(function() {
    'use strict';
    wait4Element("li[ibitrate='500']", 1500, function() {
        console.log('no login loaded');
        $(".player-videotype-list li").click(function(e) {
            var n = this;
            console.log(this);
            var s = $(n).attr("iBitRate");
            var o = $(n).attr("channelId");
            vplayer.vcore.reqBitRate(s,o);
            $('#player-login-tip-wrap').remove();
            $('.player-chest-login').remove();
        });
    });
})();

function wait4Element(selector, time, func) {
    if (document.querySelector(selector) !== null) {
        func();
        return;
    } else {
        setTimeout(function() {
            wait4Element(selector, time, func);
        }, time);
    }
}