-
// ==UserScript==
// @name Hitomi 언어설정
// @description -
// @namespace -
// @version 2026.07.20.22.12
// @icon https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://hitomi.la
// @match https://*.la/*
// @grant GM.getValue
// @grant GM.setValue
// @grant GM_registerMenuCommand
// ==/UserScript==
if (window.location.hostname === 'hitomi.la') {
(async () => {
(await GM.getValue('custom') == undefined) ? GM.setValue('custom', '') : await GM.getValue('custom')
let cst = (await GM.getValue('custom') || '').toLowerCase()
, set = _ => {GM.setValue('custom', window.prompt('Type your language',)); window.location.reload()}
, nav = {id:'indonesian',ca:'catalan',cs:'czech',da:'danish',de:'german',et:'estonian',en:'english',es:'spanish',eo:'esperanto',fr:'french',
hi:'hindi',it:'italian',hu:'hungarian',nl:'dutch',nb:'norwegian',pl:'polish',pt:'portuguese',ro:'romanian',sq:'albanian',sk:'slovak',
sr:'serbian',fi:'finnish',sv:'swedish',tl:'tagalog',vi:'vietnamese',tr:'turkish',el:'greek',bg:'bulgarian',mn:'mongolian',ru:'russian',
uk:'ukrainian',he:'hebrew',ar:'arabic',th:'thai',ko:'korean',zh:'chinese',ja:'japanese'}
, txt = (cst == '') ? nav[window.navigator.language.substring(0,2)] : cst
, mov = _ => {window.location = window.location.toString().replace(/-all\./, `-${txt}\.`)}
, tar = document.querySelector('#lang > a')
document.querySelector('#logo > a')?.setAttribute('href', `https://hitomi.la/index-${txt}.html`);
if (document.URL.indexOf(`-${txt}\.`) > -1) {
window.onpopstate = _ => history.go(-2)
history.pushState({}, '')
}
if (document.URL.indexOf('-all.html') > -1) mov()
if (tar) {
tar.href = `https://hitomi.la/index-${txt}.html`
tar.innerHTML = `${txt}<img src="//ltn.gold-usergeneratedcontent.net/down-arrow.png">`
tar.style.cssText = 'padding: 0 10px; width: 150px; display: inline-block'}
GM_registerMenuCommand('Set your language', set)
})()
}