Sleazy Fork is available in English.

Hitomi Language Settings

Change all language page to specific language result page.

  1. // ==UserScript==
  2. // @name:ko Hitomi 언어 설정
  3. // @name Hitomi Language Settings
  4. // @name:ja Hitomi言語設定
  5. // @name:zh-TW Hitomi語言設置
  6. // @name:zh-CN Hitomi语言设置
  7.  
  8. // @description:ko 모든 언어 페이지를 특정 언어 결과 페이지로 변경합니다.
  9. // @description Change all language page to specific language result page.
  10. // @description:ja すべての言語ページを特定の言語結果ページに変更します。
  11. // @description:zh-TW 將所有語言頁面更改爲特定語言結果頁面。
  12. // @description:zh-CN 将所有语言页面更改为特定语言结果页面。
  13.  
  14. // @namespace https://ndaesik.tistory.com/
  15. // @version 2022.07.29.04.29
  16. // @author ndaesik & SFGFDSD(修改)
  17. // @icon https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://hitomi.la
  18. // @match https://hitomi.la/*
  19.  
  20. // @grant GM.getValue
  21. // @grant GM.setValue
  22. // @grant GM_registerMenuCommand
  23. // @grant GM_addStyle
  24. // ==/UserScript==
  25.  
  26. (async () => {
  27. let cst = (await GM.getValue('custom')).toLowerCase()
  28. , nav = {zh:'chinese',ja:'japanese',en:'english',ko:'korean'}
  29. , txt = (cst == '') ? nav[window.navigator.language.substring(0,2)] : cst
  30. , mov = _ => {window.location = window.location.toString().replace(/-all\./, `-${txt}\.`)}
  31. , tar = document.querySelector('#lang > a');
  32.  
  33. // 手机端处理
  34. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  35. // 设置语言选择按钮
  36. if (tar) {
  37. tar.href = `https://hitomi.la/index-${txt}.html`
  38. tar.innerHTML = `${txt}<img src="//ltn.hitomi.la/down-arrow.png">`
  39. tar.style.cssText = 'padding: 0 10px; width: 150px; display: inline-block'
  40. tar.addEventListener('click', function(event) {
  41. event.preventDefault(); // 阻止默认行为
  42. setLanguage(txt); // 设置语言
  43. });
  44. }
  45. }
  46.  
  47. // 电脑端处理
  48. else {
  49. let languageButton = document.createElement('button');
  50. languageButton.textContent = '设置语言';
  51. languageButton.id = 'languageButton';
  52. languageButton.addEventListener('click', function() {
  53. setLanguage(txt);
  54. });
  55. document.body.appendChild(languageButton);
  56. }
  57.  
  58. // 设置语言
  59. function setLanguage(language) {
  60. GM.setValue('custom', language).then(() => {
  61. window.location.reload();
  62. });
  63. }
  64. })();