{
	"plugins": [],
	"functions": {
		"copyText": {
			"js": "let args = arguments[0]; navigator.clipboard.writeText(args).then(() => console.log('copied!'));"
		},
		"copyElementText": {
			"js": "let args = arguments[0]; navigator.clipboard.writeText(document.querySelector(args).innerText).then(() => console.log('copied!'));"
		},
		"fileDrop": {
			"js": "let args = arguments[0]; let inp, el = document.querySelector(args.container); if (!window[args.id]) el.innerHTML += '<label for=\"'+args.id+'\"><img src=\"https://image.freepik.com/free-icon/upload-arrow_318-26670.jpg\" style=\"position:absolute; width:40%; top:30%; left: 30%; right:30%; bottom:30%;\"></label><input type=\"file\" id=\"' + args.id + '\" multiple style=\"opacity:0; background:red; position:absolute; top:0; left: 0; right:0; bottom:0\"/>'; el.addEventListener('dragover', (e) => {el.style.opacity = 0.5; e.preventDefault()}); el.addEventListener('dragleave', (e) => {el.style.opacity = 1;}); el.addEventListener('drop', (e) => {window[args.id].files = e.dataTransfer.files; e.preventDefault(); el.style.opacity = 1; if (args.on && args.on.drop) js.callback({do:args.on.drop}); }); window[args.id].addEventListener('change', (e) => {window[args.id].files = e.dataTransfer.files; e.preventDefault(); el.style.opacity = 1; if (args.on && args.on.drop) js.callback({do:args.on.drop}); });  "
		},
		"click": {
			"js": "let args = arguments[0]; let el = document.querySelector(args); el.click();"
		},
		"urlParam": {
			"js": "let args = arguments[0]; let params = new URLSearchParams(document.location.search); return params.get(args);"
		},
		"log": {
			"js": "let args = arguments[0]; let text = (args.text) ? args.text : args;  if (typeof text == 'string') {let style = ''; if (args.color) style += 'color: '+args.color+';'; if (args.background) style += 'background: '+args.background+';'; console.log('%c '+text, style);} else {console.log(text)}"
		},
		"confirm": {
			"js": "let args = arguments[0]; if (confirm(args.request)) { if (args.on && args.on.confirm) js.do(args.on.confirm) } else { if (args.on && args.on.cancel) js.do(args.on.cancel) };"
		},
		"prompt": {
			"js": "let promptResponse = prompt(args.label, args.placeholder); if (promptResponse == null || promptResponse == '') {if (args.on && args.on.cancel) js.do(args.on.cancel, null, promptResponse) } else { if (args.on && args.on.confirm) js.do(args.on.confirm, null, promptResponse) }"
		},
		"cookieSet": {
			"js": "let args = arguments[0]; const d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); let expires = 'expires='+d.toUTCString(); document.cookie = args.name + '=' + args.value + ';' + args.expires + ';path=/';"
		},
		"cookieGet": {
			"js": "let args = arguments[0]; let name = args.name + '='; let ca = document.cookie.split(';');  for(let i = 0; i < ca.length; i++) {let c = ca[i]; while (c.charAt(0) == ' ') {c = c.substring(1);} if (c.indexOf(name) == 0) {return c.substring(name.length, c.length); } } return '';"
		},
		"ifAvif": {
			"js": "let args = arguments[0]; console.log('avif check'); let avif = new Image(); avif.src ='data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A='; avif.onload = function () { js.callback({do:args.then}); }; avif.onerror = function () { js.callback({do:args.else}); };"
		},
		"pathFromHash": {
			"js": "let args = arguments[0]; let pathString = String(window.location.hash).substr(1); console.log(pathString.split('/'));return pathString.split('/')"
		}
	},
	"parts": {
		"browser": {
			"changePage": {
				"do": [
					{
						"attr": {
							"selector": ".{arguments:pagesClass}",
							"addClass": "hidden"
						}
					},
					{
						"attr": {
							"selector": ".{arguments:pagesClass}[data-value='{arguments:pageId}']",
							"removeClass": "hidden"
						}
					},
					{
						"attr": {
							"selector": ".menu-focus",
							"removeClass": "menu-focus"
						}
					},
					{
						"attr": {
							"selector": ".menuItem[data-id='{arguments:pageId}']",
							"addClass": "menu-focus"
						}
					},
					{
						"part": {
							"do": "{arguments:pageChanger}",
							"arguments": {
								"page": "{arguments:pageId}",
								"path": "{arguments:pagePath}"
							}
						}
					}
				]
			},
			"pathFromHash": {
				"do": [
					{
						"set": {
							"var hashPath": "String('{location hash}').substr(1)"
						}
					},
					{
						"set": {
							"var viewPath": "String('{var hashPath}').split('/')"
						}
					},
					{
						"part": {
							"do": "{arguments:do}",
							"arguments": {
								"path": "{var viewPath}"
							}
						}
					}
				]
			},
			"pageFromHash": {
				"do": [
					{
						"set": {
							"var hashPath": "String('{location hash}').substr(1)"
						}
					},
					{
						"set": {
							"var viewPath": "String('{var hashPath}').split('/')"
						}
					},
					{
						"browser:changePage": {
							"pageId": "{var viewPath 0}",
							"pagePath": "{var viewPath 1}",
							"pageChanger": "{arguments:pageChanger}",
							"pagesClass": "{arguments:pagesClass}",
							"pagesInit": "{arguments:pagesInit}"
						}
					}
				]
			},
			"title": {
				"do": [
					{
						"html": {
							"selector": "title",
							"text": "test"
						}
					},
					{
						"set": {
						"document title": "{arguments}"
						}
					}
				]
			},
			"copyOnClick": {
				"do": [
					{
						"html": {
							"selector": "{arguments:selector}",
							"on": {
								"mousedown": [
									{
										"copyElementText": "{arguments:selector}"
									}
								]
							}
						}
					}
				]
			}
		}
	}
}