Greasy Fork 还支持 简体中文。

AVIF to JPG Redirector

砍掉b站专栏区图片的avif后缀,访问jpg格式的图源

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         AVIF to JPG Redirector
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  砍掉b站专栏区图片的avif后缀,访问jpg格式的图源
// @match        http://*/*
// @match        https://*/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 获取当前页面的 URL
    var currentUrl = window.location.href;

    // 检查 URL 是否匹配特定模式:*.jpg@*.avif
    var pattern = /(.+)\.jpg@.+\.avif$/;
    if (pattern.test(currentUrl)) {
        // 提取原始 JPG 图片的 URL
        var originalUrl = currentUrl.replace(pattern, '$1.jpg');
        
        // 打开新的页面
        window.location.href = originalUrl;
    }
})();