Only-bangumi.tv

Point all domain names to bangumi.tv

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Only-bangumi.tv
// @namespace   BLDF
// @description Point all domain names to bangumi.tv
// @homepage    https://github.com/NeKoOuO/bangumiscripts
// @homepage    https://greasyfork.org/scripts/485822-only-bangumi-tv
// @include     /^https?:\/\/(doujin\.|)(bgm\.tv|bangumi\.tv)/
// @version     0.0.6
// @grant       none
// ==/UserScript==

(function() {
  // 取得目前使用的域名
  var domain = "bangumi.tv";
  var protocol = window.location.protocol;

  var links = document.getElementsByTagName('a');

  for(var j = 0, len = links.length; j < len; j++) {
    var link = links[j];
    if (link.href.match(/https?:\/\/(doujin\.|)(bgm\.tv|bangumi\.tv)/)) {
      link.href = link.href.replace(/https?:\/\/(doujin\.|)(bgm\.tv|bangumi\.tv)/, protocol + '//' + domain);
      link.innerHTML = link.innerHTML.replace(/https?:\/\/(doujin\.|)(bgm\.tv|bangumi\.tv)/, protocol + '//' + domain);
    }
  }
})();