1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
Oinktube/plugin/AdBlockerDetector/script.js
2024-04-16 14:48:52 -03:00

17 lines
No EOL
839 B
JavaScript

function checkScriptBlocking() {
const url = 'https://imasdk.googleapis.com/js/sdkloader/ima3.js';
// Fetching the script with 'no-cors' mode
fetch(url, { mode: 'no-cors' })
.then(response => {
console.log('IMA SDK fetched (no-cors mode). Status might not be verifiable.', response);
// Since we can't check the status or content size, we assume it's not blocked if it gets here
blockAdBlock.onDetected(adBlockDetected); // Continue with non-blocking logic
})
.catch(error => {
console.log('Error fetching IMA SDK:', error.message);
avideoToastError('IMA not loaded'); // Display error toast
adBlockDetected(); // Assume blocked if there's an error
});
}
document.addEventListener('DOMContentLoaded', checkScriptBlocking);