Toggle Dlsite language

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

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

您需要先安裝使用者腳本管理器擴展,如 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.0
// @grant       none
// ==/UserScript==

var url = window.location.href;

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

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