32 lines
		
	
	
		
			No EOL
		
	
	
		
			859 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			No EOL
		
	
	
		
			859 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
function toggleCursor(enabled) {
 | 
						|
	if (enabled) {
 | 
						|
		$.post(`https://${resName}/enableCursor`, JSON.stringify({}));
 | 
						|
	} else {
 | 
						|
		$.post(`https://${resName}/disableCursor`, JSON.stringify({}));
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
function loadDialog(dialogName) {
 | 
						|
	var script = document.createElement('script');
 | 
						|
 | 
						|
	script.setAttribute('src',`../utils/dialogs/${dialogName}/${dialogName}.js`);
 | 
						|
 | 
						|
	document.head.appendChild(script);
 | 
						|
}
 | 
						|
 | 
						|
// Messages received by client
 | 
						|
window.addEventListener('message', (event) => {
 | 
						|
	let data = event.data;
 | 
						|
	let action = data.action;
 | 
						|
 | 
						|
	switch(action) {
 | 
						|
		case "loadDialog": {
 | 
						|
			var script = document.createElement('script');
 | 
						|
			script.setAttribute('src',`../utils/dialogs/${data.dialogName}/${data.dialogName}.js`);
 | 
						|
			document.head.appendChild(script);
 | 
						|
			break;
 | 
						|
		}
 | 
						|
	}
 | 
						|
})
 | 
						|
 | 
						|
$.post(`https://${resName}/nuiReady`, JSON.stringify({})); |