Greasy Fork

Greasy Fork is available in English.

bilibili网页视频简介中的链接可以点击(按行区分)

change black to blue

当前为 2020-08-27 提交的版本,查看 最新版本

// ==UserScript==
// @name         bilibili网页视频简介中的链接可以点击(按行区分)
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  change black to blue
// @author       beibeibeibei
// @match        *.bilibili.com/video/*
// @grant        none
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// ==/UserScript==

(function() {
    'use strict';
    // Your code here...
    var $=jQuery.noConflict();
    var reg = /([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/|[wW]{3}.|[wW][aA][pP].|[fF][tT][pP].|[fF][iI][lL][eE].)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/;
    function hide_info(){
        $("#v_desc").find(".info").hide();
    }
    function show_info(){
        $("#v_desc").find(".info").show();
    }
    function hide_info2(){
        $("#v_desc").find(".info2").hide();
    }
    function show_info2(){
        $("#v_desc").find(".info2").show();
    }
    function new_info2(){
        $("#v_desc").find(".info").after('<div class="info2"></div>');
    }
    function splitLines(str) {return str.split(/\r?\n/);}
    function add_button(){
        if($(".changemodebutton").length < 1){
            $("#v_desc").find(".info").before('<input class="changemodebutton" type="button" value="切换显示" title="点击切换原版和修改版(来自油猴脚本)">');
            $(".changemodebutton").on('click',function click_changemodebutton(){
                if($("#v_desc").find(".info").is(":visible")){
                    hide_info();
                    show_info2();
                    $(".changemodebutton")[0].value = "切换原版";
                }else{
                    show_info();
                    hide_info2();
                    $(".changemodebutton")[0].value = "切换改版";
                }
            });
        }
        if($("#v_desc").find(".info2").length < 1){
            $("#v_desc").find(".info").after('<div class="info2" style="display: none;"></div>');
            $("#v_desc").find(".info2").width($("#v_desc").find(".info").width());
        }
        var info_html = $("#v_desc").find(".info").html();
        var html_array = splitLines(info_html);
        $(".l-con").off('DOMNodeInserted',add_button);
        $("#v_desc").find(".info2").html("");
        for(var i=0;i<html_array.length;i++){
            if(reg.test(html_array[i])){
                $("#v_desc").find(".info2").append('<p><a href="' + html_array[i] + '" target="_blank" style="color:blue;">' + html_array[i] + '</a></p>');
            }else if(html_array[i] == ""){
                $("#v_desc").find(".info2").append('<br>');
            }else{
                $("#v_desc").find(".info2").append('<p>' + html_array[i] + '</p>');
            }
        }
        $(".l-con").on('DOMNodeInserted',add_button);
    }

    $(".l-con").on('DOMNodeInserted',add_button);

    // Your code here...
    // Your code here...
    // Your code here...
})();