= 1024
},
isthreecolumns() {
return document.documentelement.clientwidth >= 768 && document.documentelement.clientwidth < 1280
},
cdnurl(path) {
return `https://imgcdn9.piccdn1.cfd${path}`
},
itemurl(item) {
let dmprefix = item.dm ? `/dm${item.dm}` : '';
let url = this.locale === 'zh' ? `${dmprefix}/${item.dvd_id}` : `${dmprefix}/${this.locale}/${item.dvd_id}`
if (item.recommend_id) {
url += `#${item.recommend_id}`
if (item.scenario) {
url += `_${item.scenario}`
}
} else if (this.ismain && item.scenario) {
url += `#${item.scenario}`
}
return url
},
generatefullitemtitle(item) {
const titlefield = this.translatedfield('title', this.locale)
item['full_title'] = item['dvd_id']
? `${item['dvd_id'].touppercase().replace('-uncensored-leak', '').replace('-chinese-subtitle', '').replace('-english-subtitle', '')} ${item[titlefield]}`
: ' '
return item
},
translatedfield(field, locale) {
return locale === 'ja' ? field : `${field}_${locale}`
},
translatedvalue(object, field, locale) {
return this.purify(object[this.translatedfield(field, locale)])
},
togglesearch() {
let type
this.showsearch = ! this.showsearch
if (this.showsearch) {
this.showdropdown = null
this.$nexttick(() => {
this.$refs.search.select()
})
}
},
search(keyword) {
keyword = keyword.trim()
if (! keyword) {
return
}
keyword = encodeuricomponent(keyword.replace('\\', ''))
if (window.location.href.includes('/legacy')) {
window.location.href = this.locale === this.fallbacklocale ? `/legacy?keyword=${keyword}` : `/${this.locale}/legacy?keyword=${keyword}`
return
}
let searchhistory = this.getsearchhistory()
if (searchhistory.includes(keyword)) {
searchhistory.splice(searchhistory.indexof(keyword), 1)
}
searchhistory.unshift(keyword);
window.cookies.set('search_history', json.stringify(searchhistory), { expires: 365 })
window.location.href = this.locale === this.fallbacklocale ? `/search/${keyword}` : `/${this.locale}/search/${keyword}`
},
getsearchhistory() {
const searchhistorytext = window.cookies.get('search_history')
if (! searchhistorytext) {
return []
}
return json.parse(searchhistorytext).slice(0, 5)
},
clearsearchhistory() {
window.cookies.remove('search_history')
this.searchhistory = []
},
clearwatchhistory() {
this.showdropdown = null
if (! confirm(`adakah anda pasti untuk mengosongkan semua sejarah tontonan?`)) {
return
}
window.axios.delete('https://www.missav.art/api/history').then(response => {
alert(`sejarah tontonan telah dikosongkan.`)
window.location.href = 'https://www.missav.art/ms/history'
})
},
localizedurl(locale) {
let path = window.location.pathname
if (! path.endswith('/')) {
path = `${path}/`
}
path = path + window.location.search
if (locale === this.fallbacklocale) {
return this.removetrailingslash(path
.replace('/cn/', '/').replace('/en/', '/').replace('/ja/', '/').replace('/ko/', '/').replace('/ms/', '/').replace('/th/', '/').replace('/de/', '/').replace('/fr/', '/').replace('/vi/', '/').replace('/id/', '/').replace('/fil/', '/').replace('/pt/', '/')
)
}
if (path.includes('/cn/') || path.includes('/en/') || path.includes('/ja/') || path.includes('/ko/') || path.includes('/ms/') || path.includes('/th/') || path.includes('/de/') || path.includes('/fr/') || path.includes('/vi/') || path.includes('/id/') || path.includes('/fil/') || path.includes('/pt/')) {
return this.removetrailingslash(path
.replace('/cn/', `/${locale}/`).replace('/en/', `/${locale}/`).replace('/ja/', `/${locale}/`).replace('/ko/', `/${locale}/`).replace('/ms/', `/${locale}/`).replace('/th/', `/${locale}/`).replace('/de/', `/${locale}/`).replace('/fr/', `/${locale}/`).replace('/vi/', `/${locale}/`).replace('/id/', `/${locale}/`).replace('/fil/', `/${locale}/`).replace('/pt/', `/${locale}/`)
)
}
return this.removetrailingslash(
this.dmcadummy ? path.replace(this.dmcadummy, `${this.dmcadummy}/${locale}`) : `/${locale}${path}`
)
},
removetrailingslash(url) {
if (url.substr(url.length - 1) === '/') {
return url.slice(0, -1)
}
return url.replace('/?', '?')
},
redirecttobaselocalizedurl() {
window.cookies.set('localized', 1, { expires: 30 })
settimeout(() => {
window.location.href = '/?localized=1'
}, 100)
},
loadrecaptcha() {
if (! this.loadedrecaptcha) {
this.loadedrecaptcha = true
let script = document.createelement('script')
script.type = 'text/javascript';
script.sr>