Czy taki kod wychwyci każdy adblocker?

Czy taki kod wychwyci każdy adblocker?
Sos BBq - Biki-Miki
  • Rejestracja: dni
  • Ostatnio: dni
  • Lokalizacja: jakieś zadupie w wielkopolsce
  • Postów: 46
0

Tak jak w temacie.

Kopiuj
var retry = 0;

function checkIfStarted()
{
	var demo = document.getElementById( "demo" );
	if( demo.contentWindow["$status"]["started"] ) // We can assume that no adblocker has been avoiding script execution.
	{
		// Relay mouse-up and mouse-move to iFrame
		// This listeners are only invoked outside the iframe
		// so we do not need to check if they have been invoked within
		// the iframe to avoid double invokation.
		// Tested with: Chrome

		var position = { x: 0, y: 0 };

		var onMouseUp = function ( e )
		{
			demo.contentWindow.dispatchEvent( new MouseEvent( e.type, e ) );
		};

		var onMouseMove = function ( e )
		{
			var r = demo.getBoundingClientRect();

			position.x = e.pageX - ( r.left + document.body.scrollLeft );
			position.y = e.pageY - ( r.top + document.body.scrollTop ) + 30;// - 50; // WELL, well,...

			demo.contentWindow['injectMouseMove']( position ); // exposed over defrac
		};

		window.addEventListener( "mouseup", onMouseUp );
		window.addEventListener( "mousemove", onMouseMove );

		cular.pageEvents.on("dispose", function() {
			window.removeEventListener( "mouseup", onMouseUp );
			window.removeEventListener( "mousemove", onMouseMove );
		});

		console.log( "Initialized from outside." );
	}
	else
	{
		if( ++retry == 5 ) // Tried five times to make sure we did not run into timing issues.
		{
			alert( "Please disable your Adblocker for this site" );
		}
		else
		{
			self.setTimeout( checkIfStarted, 500 );
		}
	}
}

function waitForStatus()
{
	var demo = document.getElementById( "demo" );
	if( !demo || !demo.contentWindow || !demo.contentWindow["$status"] )
		self.setTimeout( waitForStatus, 500 );
	else
		self.setTimeout( checkIfStarted, 500 );
}

self.setTimeout( waitForStatus, 500 );
.__.
  • Rejestracja: dni
  • Ostatnio: dni
1

Mamy za Ciebie testować?

Tu jest prosta i ciekawa metoda https://stackoverflow.com/questions/4869154/how-to-detect-adblock-on-my-website

Sos BBq - Biki-Miki
  • Rejestracja: dni
  • Ostatnio: dni
  • Lokalizacja: jakieś zadupie w wielkopolsce
  • Postów: 46
0
.__. napisał(a):

Mamy za Ciebie testować?

Tu jest prosta i ciekawa metoda https://stackoverflow.com/questions/4869154/how-to-detect-adblock-on-my-website

Dzięki :)

Zarejestruj się i dołącz do największej społeczności programistów w Polsce.

Otrzymaj wsparcie, dziel się wiedzą i rozwijaj swoje umiejętności z najlepszymi.