HEX
Server: Apache/2.4.57 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2
System: Linux vmi267337.contaboserver.net 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64
User: ohirex (1008)
PHP: 8.2.8
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec
Upload Files
File: /home/ohirex/web/ohirex.com/public_html/join/scripts/pixels/tiktok/ttpxviewcontentpercent.js
<script>
document.addEventListener("DOMContentLoaded", function() {

	var executeWhenReachedPagePercentage = function (percentage, callback) {
		if (typeof percentage !== 'number') 
			console.error('First parameter must be a number, got', typeof percentage, 'instead', );

		if (typeof callback !== 'function') 
			console.error( 'Second parameter must be a function, got', typeof callback, 'instead', );

		function getDocumentLength() {
			var D = document;
			var height=0;
			if (D.body===null){
				height=Math.max(
					D.documentElement.scrollHeight,
					D.documentElement.offsetHeight,
					D.documentElement.clientHeight);
			}
			else{
				height= Math.max(
					D.body.scrollHeight, D.documentElement.scrollHeight,
					D.body.offsetHeight, D.documentElement.offsetHeight,
					D.body.clientHeight, D.documentElement.clientHeight);
			}
			return height;
		}

		function getWindowLength() {
			return window.innerHeight ||
			(document.documentElement || document.body).clientHeight;
		}

		function getScrollableLength() {
			if (getDocumentLength() > getWindowLength()) {
				return getDocumentLength() - getWindowLength();
			} else {
				return 0;
			}
		}

		var scrollableLength = getScrollableLength();

		window.addEventListener("resize", function () {
			scrollableLength = getScrollableLength();
		}, false)

		function getCurrentScrolledLengthPosition() {
			return window.pageYOffset ||
			(document.documentElement || document.body.parentNode || document.body).scrollTop;
		}

		function getPercentageScrolled() {
			if (scrollableLength == 0) {
				return 100;
			} else {
				return getCurrentScrolledLengthPosition() / scrollableLength * 100;
			}
		}

		var executeCallback = (function () {
			var wasExecuted = false;
			return function () {
				if (!wasExecuted && getPercentageScrolled() > percentage) {
					wasExecuted = true;
					callback();
				}
			};
		})();

		if (getDocumentLength() == 0 ||
			(getWindowLength() / getDocumentLength() * 100 >= percentage)) {
			callback();
		} else {
			window.addEventListener('scroll', executeCallback, false);
		}
	};

	executeWhenReachedPagePercentage({PERCENT}, function () {
		ttq.track('ViewContent');
	});
});
</script>