function goto() {
window.open(data.appLink)
}

function init(){
	document.body.style.overflow='hidden'
	if(!window.location.href.match('id')){
		document.body.innerHTML = "<p style='font-size:64px;font-weight:800;text-align:center'>404</p><p style='font-size:64px;font-weight:800;text-align:center'>Not Found</p>"
		document.body.style.display = 'flex'
		document.body.style.alignItems="center"
		document.body.style.justifyContent="center"
		document.body.style.flexDirection="column"
		return
	}
	if (window.location.href.match('id')) {
		let index = window.location.href.match('id').index
		let idIndex = window.location.href.substring(index + 3)
		if (data[idIndex])
			{
				document.body.innerHTML = 
				`<iframe src=${data[idIndex]} style='width:100%;height:100%'></iframe>`
			}
	}
}

function appendImg(i, d) {
	let img = document.createElement("img")
	img.src = i.l
	img.setAttribute('class', 'T75of B5GQxf')
	img.setAttribute('alt', 'Imagem da captura de tela')
	img.setAttribute('itemprop', 'image')
	img.setAttribute('tabindex', '0')
	img.setAttribute('load', 'lazy')
	img.setAttribute('data-screenshot-index', '0')
	img.addEventListener('click', function imgGo() {
		if (i.v)
			window.open(i.v)
	})
	d.appendChild(img)
}

function appendDivSon(i, d) {
	let divSon = document.createElement("div")
	divSon.setAttribute('jscontroller', 'RQJprf')
	divSon.setAttribute('class', 'Atcj9b')
	d.appendChild(divSon)
	appendImg(i, divSon)
}

function appendDiv(i) {
	let div = document.createElement("div")
	div.setAttribute('class', 'ULeU3b Utde2e')
	div.setAttribute('role', 'listitem')
	appendDivSon(i, div)
	document.getElementById("list").appendChild(div)
}
$('document').ready(() => {
	document.body.style.display = 'block'
	// init()
	$('#appicon_3')[0].src = data.app.v
	$('#app_name')[0].innerText = data.app.l
	$('#advator')[0].src = data.advator.l
	$('#description')[0].innerHTML = data.app.content
	$('#xg1aie')[0].innerText = data.app.time
	$('#download')[0].innerText = data.app.downloads
	$('#star')[0].innerText = data.app.star
	$('#age')[0].innerText = data.app.age
	let link = document.createElement('link')
	link.rel = 'shortcut icon'
	link.href = data.webTitle.v
	document.head.appendChild(link)
	for (let i in data.swiper) {
		appendDiv(data.swiper[i])
	}
	new Vue({
		el: "#app"
	})
})