Greasy Fork

Greasy Fork is available in English.

Bilibili 视频默认选择最高清晰度

try to take over the world!

目前为 2018-11-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         Bilibili 视频默认选择最高清晰度
// @namespace    http://tampermonkey.net/
// @version      0.2018.11.25
// @description  try to take over the world!
// @author       You
// @match        *://www.bilibili.com/video/av*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    var MO = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
    new MO(function (mutations, observer) {
        var element = document.querySelector("div.bui-select-list-wrap li:first-child"), i;
        for (i=0; i<mutations.length; i++) {
            if (element !== null) {
                if (element.click() === 0){
                    observer.disconnect();
                    return 0;
                }
            }
        }
    }).observe(document.getElementById("playerWrap"),{'attributes': true});
})();