Brave-Detection-Blocker-Chr.../block-script.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

2022-03-27 11:43:26 +00:00
let nav = function Navigator() {};
let copyNavRef = window.navigator;
nav = nav.bind(function () {
return window.navigator;
});
newNav = new nav();
2022-03-28 18:26:22 +00:00
const primitivesNav = {
2022-03-27 11:43:26 +00:00
userAgent: window.navigator.userAgent,
appVersion: window.navigator.appVersion,
platform: window.navigator.platform,
vendor: window.navigator.vendor,
2022-03-28 15:26:32 +00:00
userLanguage: window.navigator.userLanguage,
language: window.navigator.language,
2022-03-28 17:54:45 +00:00
cookieEnabled: true,
2022-03-28 18:26:22 +00:00
appCodeName: window.navigator.appCodeName,
appName: window.navigator.appName,
product: window.navigator.product,
geolocation: window.navigator.geolocation,
onLine: window.navigator.onLine,
2022-03-25 18:10:48 +00:00
};
2022-03-28 18:26:22 +00:00
2022-03-25 18:10:48 +00:00
for (let prop in window.navigator) {
if (prop === 'brave') {
continue;
}
2022-03-27 11:43:26 +00:00
newNav.prop = copyNavRef.prop;
2022-03-25 18:10:48 +00:00
}
2022-03-28 18:26:22 +00:00
for (let prop in primitivesNav) {
primitivesNav.hasOwnProperty(prop) &&
2022-03-25 18:10:48 +00:00
Object.defineProperty(newNav, prop, {
2022-03-28 18:26:22 +00:00
value: primitivesNav[prop],
2022-03-25 18:10:48 +00:00
writable: true,
});
}
Object.defineProperty(window, 'navigator', {
value: newNav,
writable: true,
2022-03-27 11:43:26 +00:00
enumerable: true,
configurable: true,
2022-03-25 18:10:48 +00:00
});