Netflix 4K

针对 Netflix 伪造 4K 分辨率支持

目前为 2022-04-28 提交的版本。查看 最新版本

// ==UserScript==
// @name         Netflix 4K
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  针对 Netflix 伪造 4K 分辨率支持
// @author       TGSAN
// @match        https://www.netflix.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=netflix.com
// @run-at       document-start
// @grant        unsafeWindow
// ==/UserScript==

(function() {
    // 'use strict';

    delete unsafeWindow.screen;
    unsafeWindow.__defineGetter__('screen',function(){
        let s=[];
        s['width']=3840;
        s['height']=2160;
        s['availWidth']=3840;
        s['availHeight']=2160;
        s['availLeft']=0;
        s['availTop']=0;
        s['colorDepth']=32;
        s['isExtended']=false;
        s['pixelDepth']=32;
        return s;
    })

    delete unsafeWindow.devicePixelRatio;
    unsafeWindow.devicePixelRatio = 4;

    // window.MSMediaKeys.isTypeSupportedWithFeaturesOriginal = MSMediaKeys.isTypeSupportedWithFeatures;
    // window.MSMediaKeys.isTypeSupportedWithFeatures = function (a, b) {
    //     const reg = /,display-res-[x|y]=\d+?,display-res-[x|y]=\d+?/
    //     b = b.replace(reg, "");
    //     if (this.isTypeSupportedWithFeaturesOriginal(a, b) !== '') console.log("Hook MSMediaKeys isTypeSupportedWithFeatures:", a, b);
    //     return "probably";
    // }
})();