Always Your Derpibooru

Automatically redirects you to the Derpibooru domain of your choice when linked to a different domain.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Always Your Derpibooru
// @namespace   Always Your Derpibooru
// @description Automatically redirects you to the Derpibooru domain of your choice when linked to a different domain. 
// @author      DanielTepesKraus | https://www.derpibooru.org/profiles/DanielTepesKraus
// @include     https://derpibooru.org/*
// @include     https://www.derpibooru.org/*
// @include     https://derpiboo.ru/*
// @include     https://www.derpiboo.ru/*
// @include     https://trixiebooru.org*
// @include     https://www.trixiebooru.org*
// @version     1
// @grant       none
// @run-at document-start
// ==/UserScript==
'use strict';

//////////////////////////////////////////////////////////
//THIS IS WHERE YOU SET WHAT DOMAIN YOU WOULD LIKE TO USE.

var Domain = 0;
//0 = Derpibooru.org
//1 = Derpiboo.ru
//2 = Trixiebooru.org
//3 = Krausbooru.org (see note)

//Note:
//Krausbooru is an experimental version of Derpibooru.
//Uses "derpibooru.org" with a vastly improved 
//and more aesthetically pleasing GUI.
//Use at your own risk.

//DON'T TOUCH ANYTHING BELOW THIS LINE.
//////////////////////////////////////////////////////////

var Location = window.location.href;
var ORG = Location.indexOf("derpibooru.org");
var RU = Location.indexOf("derpiboo.ru");
var TRX = Location.indexOf("trixiebooru.org");

window.addEventListener('focus', function() {
  if (Domain == 3){
    var NewName = document.getElementsByClassName("home hide-mobile-t");
    NewName[0].innerHTML = "<img src='http://i.imgur.com/yHTYOEq.png'><a href='/'>Krausbooru</a>";
  }
}, false);

if (TRX > -1){
  if (Domain == 0){
    window.location.replace(Location.replace("trixiebooru.org","derpibooru.org"));
  }else if (Domain == 1){
    window.location.replace(Location.replace("trixiebooru.org","derpiboo.ru"));
  }else if (Domain == 3){
    window.location.replace(Location.replace("trixiebooru.org","derpibooru.org"));
  }
}else if (ORG > -1){
  if (Domain == 1){
    window.location.replace(Location.replace("derpibooru.org","derpiboo.ru"));
  }else if (Domain == 2){
    window.location.replace(Location.replace("derpibooru.org","trixiebooru.org"));
  }
}else if (RU > -1){
  if (Domain == 0){
    window.location.replace(Location.replace("derpiboo.ru","derpibooru.org"));
  }else if (Domain == 2){
    window.location.replace(Location.replace("derpiboo.ru","trixiebooru.org"));
  }else if (Domain == 3){
    window.location.replace(Location.replace("derpiboo.ru","derpibooru.org"));
  }
}