# setmore-appointments/9.3/script/setmoreFormScript.js

Setmore, version 9.3. 50 lines.

- Page: https://pluginprobe.com/plugins/setmore-appointments/9.3/code/script/setmoreFormScript.js
- Raw: https://pluginprobe.com/plugins/setmore-appointments/9.3/raw/script/setmoreFormScript.js
- Modified: 2019-04-08T13:07:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/setmore-appointments/9.3/code/script/setmoreFormScript.js#L10-L20`.

```javascript
window.onload = function () {
	var bookingPageUrl = document.querySelector("#setmore_booking_page_url").value;

	if (bookingPageUrl && bookingPageUrl != "https://my.setmore.com" && bookingPageUrl != null && bookingPageUrl != "") {
		document.querySelector(".sm-acc-info").style.display = "block";
	}
	else {
		document.querySelector(".sm-acc-info").style.display = "none";
	}
	var optionList = document.querySelector('.sm-dropdown ul');
	document.querySelector("#dropDown").onclick = function () {
		optionList.style.display = "block ";
	}
	var langList = document.querySelectorAll('.sm-dropdown ul li');

	for (var i = 0; i < langList.length; i++) {
		langList[i].onclick = function () {
			document.querySelector(".sm-dropdown input").value = this.textContent;
			optionList.style.display = "none ";
		}
	}

	document.addEventListener("click", function (event) {
		if (event.target.className == "fa fa-sort-down" || event.target.className == "langaugeList") {
			optionList.style.display = "block ";
		} else {
			optionList.style.display = "none";
		}
	});

	document.querySelector(".btn-login").onclick = function () {
		var siteUrl = this.getAttribute("siteurl");
		var popupWindow = window.open('https://my.setmore.com/integration/wordpress/oauth?siteUrl=' + siteUrl, "_blank", "scrollbars=yes,resizable=yes,top=108,left=0,right=0,width=821,height=625,margin= 0 auto;");
		popupWindow.focus();
		var pollTimer = window.setInterval(function () {
			console.log('the popupwindow', popupWindow.location.href);
			if (popupWindow.location.href.indexOf("status=true") != -1) {
				const urlParams = new URLSearchParams(popupWindow.location.search);
				document.querySelector(".sm-acc-info").style.display = "block";
				document.querySelector("#setmore_booking_page_url").value = urlParams.get("bookingpageurl");
				window.clearInterval(pollTimer);
				popupWindow.close();
			}
		}, 1000);
	}
}




```
