Toggle Dlsite language

Switch between ecchi-eng and maniax in circle, and RJ and RE

目前為 2020-05-15 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Toggle Dlsite language
// @namespace   zero.toogledlsitelan
// @description Switch between ecchi-eng and maniax in circle, and RJ and RE
// @include     *://www.dlsite.com/*
// @version     1.2
// @grant       none
// ==/UserScript==

var url = window.location.href;

if (url.includes("maniax") || url.includes("ecchi-eng")){
  var navlink = document.getElementsByClassName("eisysGroupHeaderAccount");
  
  navlink[0].innerHTML = " <li class='eisysGroupHeaderAccount-link'><a id='toggle' "
    + "class='eisysGroupRegist-link' style='font-weight:bold;text-decoration:underline' "
    + ">Toggle Site</a></li> " + navlink[0].innerHTML;
}

document.addEventListener("DOMContentLoaded", function(){
  var toggle = document.getElementById("toggle");

  if (url.includes("circle") && url.includes("maniax")){
    url = url.replace("maniax", "ecchi-eng");
    //location.replace(url);  
    toggle.href = url;
  }else if (url.includes("circle") && url.includes("ecchi-eng")){
    url = url.replace("ecchi-eng", "maniax");
    //location.replace(url);  
    toggle.href = url;
  }
  
  if (url.includes("product_id") && url.includes("RJ")){
    url = url.replace("RJ", "RE");
    //location.replace(url);  
    toggle.href = url;
  }else if (url.includes("product_id") && url.includes("RE")){
    url = url.replace("RE", "RJ");
    //location.replace(url);  
    toggle.href = url;
  }
});