Greasy Fork

Shined up real nice.

Greasy Fork is available in English.

宽带山-查看原图

防止猴子屏蔽图片,让帖子中图片还能显示出来

Installer ce script?
Script promotionnel

Vous pourriez également aimer Popup Blocker Script.

Installer ce script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// ==UserScript==
// @name         宽带山-查看原图
// @namespace    undefined
// @version      0.5
// @description  防止猴子屏蔽图片,让帖子中图片还能显示出来
// @author       me
// @match        http*://club.kdslife.com/t_*.html*
// @match        http*://club.kdslife.com/f_*.html*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    $(".reply_message img[class='kds_img gifplayer']").each(function(i,v){

        var imgSrc= $(v).attr('data-gif');

        if ( /(.*)(?<=.gif)(.*)/.test(imgSrc) === true ){

            $(v).parent().find('ins').remove();

            $(v).attr('src',imgSrc.match(/(.*)(.gif)/)[0]);
        }

    });

    function getUrlParam(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r!==null) return unescape(r[2]); return null; //返回参数值
    }


    var currUrl = window.location.href;
    if((/.*club.kdslife.com\/f_15(.*).html(.*)/).test(currUrl)){
        console.log('kdshelper_seturl');
        kdshelper_seturl();
    }else if((/.*club.kdslife.com\/t_(.*).html(.*)/).test(currUrl)){
        console.log('kdshelper_seturl');
        kdshelper_setpic();
    }

    function kdshelper_seturl(){
        $('ul[class="main_List"] li[class="i2"] span[class="n3"]').each(function(i,v){
            var postlinks = $(v).find('a');

            if(postlinks.length > 0){
                var item = postlinks[0];

                if(item && $(item).attr('rel')){
                    var matchpicurl = $(item).attr('rel').match(/(.*)(?=@)/);
                    if (matchpicurl === null || matchpicurl.length === 0)
                        matchpicurl = $(item).attr('rel').match(/(.*)(?=\?)/);
                    if (matchpicurl && matchpicurl.length>0)
                        $(item).attr('href',$(item).attr('href')+'?newpicurl='+matchpicurl[0]);
                }
            }
        });
    }

    function kdshelper_setpic(){

        var newpicurl = getUrlParam('newpicurl');

        if(!newpicurl){
            return;
        }

        if($('#main img[src^="'+ newpicurl +'"]').length > 0){
            return;
        }

        //插入一个img标签
        $('#reply_list_panel .reply_message:first').prepend('<img class="kds_img" src="'+newpicurl+'" data-bd-imgshare-binded="1">');
    }

})();