Fix image url from Tumblr for BGM

修复BGM中@vince19发布的来自Tumblr的外链图片的URL(-_-#)

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         Fix image url from Tumblr for BGM
// @namespace    https://github.com/ipcjs
// @version      0.0.1
// @description  修复BGM中@vince19发布的来自Tumblr的外链图片的URL(-_-#)
// @author       ipcjs
// @include      http://bgm.tv/ep/*
// @include      http://bangumi.tv/ep/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    var
        NEW_SERVER_NUM = '68',
        REG = /^(https?:\/\/)(\d+)(\.media\.tumblr\.com\/.*)$/,
        imgList = document.querySelectorAll('img.code');
    imgList.forEach(function (item, index) {
        item.src = item.src.replace(REG, '$1' + NEW_SERVER_NUM + '$3');
    });
    // console.log(imgList);
})();