Greasy Fork is available in English.
针对 Netflix 伪造 4K 分辨率支持
当前为
// ==UserScript==
// @name Netflix 4K
// @namespace http://tampermonkey.net/
// @version 0.5
// @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';
if (self.unsafeWindow) {
console.log("use unsafeWindow mode");
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;
if (unsafeWindow.MSMediaKeys) {
unsafeWindow.MSMediaKeys.isTypeSupportedWithFeaturesOriginal = unsafeWindow.MSMediaKeys.isTypeSupportedWithFeatures;
unsafeWindow.MSMediaKeys.isTypeSupportedWithFeatures = function (a, b) {
const reg = /,display-res-[x|y]=\d+?,display-res-[x|y]=\d+?/
b = b.replace(reg, "");
let r = this.isTypeSupportedWithFeaturesOriginal(a, b);
if (r !== '') {
console.log("Hook MSMediaKeys isTypeSupportedWithFeatures:", a, b, r !== '');
} else {
console.debug("Hook MSMediaKeys isTypeSupportedWithFeatures:", a, b, r !== '');
}
return r;
}
}
} else {
console.log("use window mode");
delete window.screen;
window.__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 window.devicePixelRatio;
window.devicePixelRatio = 4;
if (window.MSMediaKeys) {
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, "");
let r = this.isTypeSupportedWithFeaturesOriginal(a, b);
if (r !== '') {
console.log("Hook MSMediaKeys isTypeSupportedWithFeatures:", a, b, r !== '');
} else {
console.debug("Hook MSMediaKeys isTypeSupportedWithFeatures:", a, b, r !== '');
}
return r;
}
}
}
})();