PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/tiktechtok.org/wp-content/plugins/jetpack/modules/widgets/milestone/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/tiktechtok.org/wp-content/plugins/jetpack/modules/widgets/milestone/milestone.js

/* global MilestoneConfig */

var Milestone = ( function () {
	var Milestone = function ( args ) {
		var widget_content = document.getElementById( args.content_id ),
			id = args.id,
			refresh = args.refresh * 1000;

		this.timer = function () {
			var instance = this;
			var xhr = new XMLHttpRequest();

			xhr.onload = function () {
				var response = JSON.parse( xhr.responseText ),
					httpCheck = xhr.status >= 200 && xhr.status < 300,
					responseCheck =
						'undefined' !== typeof response.message && 'undefined' !== typeof response.refresh;

				if ( httpCheck && responseCheck ) {
					var countdownElement = widget_content.querySelector( '.milestone-countdown' );

					countdownElement.outerHTML = response.message;
					refresh = response.refresh * 1000;

					if ( ! refresh ) {
						return;
					}

					setTimeout( function () {
						instance.timer();
					}, refresh );
				}
			};

			xhr.open( 'GET', MilestoneConfig.api_root + 'jetpack/v4/widgets/' + id );
			xhr.send();
		};

		if ( refresh > 0 ) {
			this.timer();
		}
	};
	return function ( args ) {
		return new Milestone( args );
	};
} )();

( function () {
	var i,
		MilestoneInstances = {};

	if ( typeof MilestoneConfig === 'undefined' ) {
		return;
	}

	for ( i = 0; i < MilestoneConfig.instances.length; i++ ) {
		MilestoneInstances[ i ] = new Milestone( MilestoneConfig.instances[ i ] );
	}
} )();