Brave-Detection-Blocker-Chr.../block-script.js
2022-03-30 10:21:17 +03:00

47 lines
1.6 KiB
JavaScript

let nav = function Navigator() {};
let copyNavRef = window.navigator;
nav = nav.bind(function () {
return window.navigator;
});
newNav = new nav();
const navClones = {
userAgent: window.navigator.userAgent,
appVersion: window.navigator.appVersion,
platform: window.navigator.platform,
vendor: window.navigator.vendor,
language: window.navigator.language,
cookieEnabled: true,
appCodeName: window.navigator.appCodeName,
appName: window.navigator.appName,
product: window.navigator.product,
geolocation: window.navigator.geolocation,
onLine: window.navigator.onLine,
sendBeacon: window.navigator.sendBeacon.bind(window.navigator),
getBattery: window.navigator.getBattery.bind(window.navigator),
vibrate: window.navigator.vibrate.bind(window.navigator),
share: window.navigator.share.bind(window.navigator),
canShare: window.navigator.canShare.bind(window.navigator),
registerProtocolHandler: window.navigator.registerProtocolHandler.bind(window.navigator),
requestMediaKeySystemAccess: window.navigator.requestMediaKeySystemAccess.bind(window.navigator),
requestMIDIAccess: window.navigator.requestMIDIAccess.bind(window.navigator),
};
for (let prop in window.navigator) {
if (prop === 'brave') {
continue;
}
newNav[prop] = copyNavRef[prop];
}
for (let prop in navClones) {
navClones.hasOwnProperty(prop) &&
Object.defineProperty(newNav, prop, {
value: navClones[prop],
writable: true,
});
}
Object.defineProperty(window, 'navigator', {
value: newNav,
writable: true,
enumerable: true,
configurable: true,
});