Sleazy Fork is available in English.

1024浏览助手

支持自定义屏蔽1024广告、屏蔽反广告检测、显示游客站内搜索框、图片延迟加载、修改图片显示尺寸和排列方式、种子链接转磁力链接、取消外链跳转、屏蔽指定回复等。

Versión del día 31/5/2020. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name         1024浏览助手
// @author       zxf10608
// @version      3.1.3
// @namespace    https://greasyfork.org/users/9280
// @description  支持自定义屏蔽1024广告、屏蔽反广告检测、显示游客站内搜索框、图片延迟加载、修改图片显示尺寸和排列方式、种子链接转磁力链接、取消外链跳转、屏蔽指定回复等。
// @require      https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
// @require      https://cdn.bootcss.com/vanilla-lazyload/12.3.0/lazyload.min.js
// @require      https://greasyfork.org/scripts/400393-spotlight/code/Spotlight.js
// @require      https://greasyfork.org/scripts/398240-gm-config-zh-cn/code/GM_config_zh-CN.js
// @icon      	 data:image/x-icon;base64,AAABAAIAEBAAAAAAAABoBQAAJgAAACAgAAAAAAAAqAgAAI4FAAAoAAAAEAAAACAAAAABAAgAAAAAAEABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAw/cASro5AIzLtQAhw5wAc+P/ANbfxgB703MAWrqcAELT9wBCumsAzvP/ACGuIQCc3+cAMcvGACG2SgCc35QAY8NaAK3fxgAhx+cAhL6UAGvXvQDn894Aa7JzAFLLhACl060AQsNSAM7r3gBSrnsAANv/ADG6rQA5sikAxte1AIzThAB7z6UAnMecAFLT5wAYw9YA9/fvADG6OQBr2+8AELqcAHPHlACU29YAnNe9AHu6hACM16UAGMf3AFrDSgC957UAxufOAK3PvQBasmsAa89rAGvLrQDW784AreOtAFrLlABKvnsASrZaAITj/wBrsoQA5/PvADG2SgBSvowApdOcAFLHcwAIz/cAjNe9AHPLewApshgAOb5CAL3bvQB7upwAWstaAFK+awCE03sA7+/nACmyKQBCtjEAztu9ALXjzgCl284AY8tjAK3XpQCU27UAlNuMAJTPrQCMy6UAhM+tAO/39wAAz/8A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HBSlgTwFmdFYqZ/gEBAfyPe4X8AQEBAfwX5LPPNsXBwcHBbgzE5yb4rIrDAQEB/IgDt/wBAQEBAQGA/DIewcHBwcHBFhuWrq2NUY78AQEB5cILXAEBAQEBAf78TcvBwcHBwcHNIYaLio1itf8BAQFcCx80AQEBAQEBAQENd8HBwcHBDhZF7XExrCaDZfwBAfza/XL8AQEBAQEBKOx5bsHBwcECfzmiJzFmvBXc/wEB/IV7j/4Bvr6+AQEoilPdHkoqLkPEOSRxM0xG+HqQ/AEBXJHUlcwF09NCAUxGM2dXCF1fff1hRHPtZiNw+IOzAQF0GlBKwcHBwcG/mVH63iakzjQDH/D0uO2fI8f7FUf+dNFKwcHBwcHBwceZMfoGFfjOIAPabB0k91tmKM4mitc/xsHBwcHBwcHBz5nfM96Kq5DxpodgRHMk7UbH/IONJcbBwcHBwcHBwcEj5spJ4rirlIj95I4kc6KLbS0BwytKwcHBwcHBwcHBwey1/p/n360viKbxw7XjRHPzZvwoGMXBwcHBwcHBwcHB2GX8n+e1rWIp/SD/zmQk+vJWag8JwcHBwcHBwcHBwcEtZfxJ7eONYqcDtP5lF5Bz+vnOEirBwcHBwcHBwcHBwcfD/p886Iqkp6Zc/C3/w+P0W65vKsHBwcHBwcHBwcHB/3z+UTypR0V1rwcBw/78s6Ly817GwcHBwcHBwcHBwcFO/78x52jKmqfaygH+/AH8jovzVcbBwcHBwcHBwcHBwU78/Efegyhj/a/8Afz8AQH8R/IQSsHBwcHBwcHBwcHBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
// @homepageURL  https://greasyfork.org/zh-CN/scripts/398915
// @include      http*://*/htm_data/*.html
// @include      http*://*/thread0806.php*
// @include      http*://*t66y.com/*
// @include      http*://picbaron.com/*.html
// @include      http*://img599.net/*
// @include      http*://www.rmdown.com/*
// @include      http*://download.bbcb.tw/*
// @include      http*://www.imgbabes.com/*
// @include      http*://motelppp.com/*
// @include      http*://www.viidii.info/?action=image*
// @include      /^https?://\w+\.\w+\.(icu|xyz)/index\.php$/
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_openInTab
// @grant        GM_download
// @grant        GM_notification
// @grant        GM_setClipboard
// @grant        GM_xmlhttpRequest
// @connect      rmdown.com
// @connect      imgbabes.com
// @connect      t66y.com
// @connect      *
// @grant        GM_registerMenuCommand
// @run-at       document-end
// @compatible   chrome
// @license      MIT License
// ==/UserScript==

(function() {
    $.ajaxSetup({
        cache: true
    });
    if (typeof(GM_config) == 'undefined') {
        alert('1024浏览助手:GM_config库文件加载失败,脚本无法正常使用,请刷新网页重新加载!')
    } else {
        console.log('1024浏览助手:jQuery、GM_config库加载成功')
    };

    function config() {
        var windowcss = '#Cfg {background-color: lightblue;} #Cfg .reset_holder {float: left; position: relative; bottom: -1em;} #Cfg .saveclose_buttons {margin: .7em;} #Cfg .section_desc {font-size: 10pt;}';
        GM_registerMenuCommand('设置', opencfg);

        function opencfg() {
            GM_config.open()
        };
        GM_config.init({
            id: 'Cfg',
            title: GM_config.create('a', {
                href: 'https://greasyfork.org/zh-CN/scripts/398915',
                target: '_blank',
                textContent: '1024浏览助手',
                title: '作者:zxf10608 版本:v3.1 点击访问主页'
            }),
            isTabs: true,
            skin: 'tab',
            css: windowcss,
            frameStyle: {
                height: '480px',
                width: '409px',
                zIndex: '2147483648',
            },
            fields: {
                jpgMain: {
                    section: ['图片优化', '修改图片显示样式,QQ交流群:1093946331'],
                    label: '图片排列方式',
                    labelPos: 'left',
                    type: 'select',
                    'options': ['平铺', '单列', '双列'],
                    'default': '平铺'
                },
                jpgShow: {
                    label: '图片显示尺寸',
                    labelPos: 'left',
                    type: 'select',
                    'options': ['缩略图', '中等图', '大图'],
                    'default': '缩略图'
                },
                jpgNewtab: {
                    label: '图片新标签后台打开',
                    labelPos: 'left',
                    type: 'checkbox',
                    default: false,
                },
                jpg_Origin: {
                    label: '显示图片引用来源',
                    labelPos: 'left',
                    type: 'checkbox',
                    default: false,
                },
                gallery: {
                    label: '开启相册预览模式',
                    labelPos: 'left',
                    type: 'checkbox',
                    default: false,
                },
                jpg_Load: {
                    label: '开启图片延迟加载',
                    labelPos: 'left',
                    type: 'checkbox',
                    default: false,
                },
                open_viidii: {
                    label: '关闭优化,仅快速打开图片跳转',
                    labelPos: 'left',
                    type: 'checkbox',
                    default: false,
                },
                reminder: {
                    label: '温馨提示',
                    labelPos: 'right',
                    type: 'button',
                    click: function() {
                        alert('1、修改显示尺寸和开启相册预览模式仅支持引用自“img599.net”的图片,大图需消耗更多带宽和内存。\n 2、当图片显示异常,请开启“关闭图片优化,仅快速打开图片跳转”,恢复图片原始样式。')
                    }
                },
                adBlockMain: {
                    section: ['广告屏蔽', '开启后页面将重新排版,文字和图片整体上移'],
                    label: '屏蔽1024超链接及图片广告',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                },
                adBack: {
                    label: '屏蔽反广告检测及其横条广告',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                adOther: {
                    label: '屏蔽第三方网站广告总开关',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                    line: 'start',
                },
                ad_img599: {
                    label: 'img599图库',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                },
                ad_PicBaron: {
                    label: 'PicBaron图库',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                },
                ad_imgbabes: {
                    label: 'imgbabes图库',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                },
                ad_rmdown: {
                    label: 'rmdown下载库',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                },
                ad_motelppp: {
                    label: 'motelppp下载库',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                },
                ad_bbcb: {
                    label: 'bbcb下载库',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                    line: 'end',
                },
                reminder2: {
                    label: '温馨提示',
                    labelPos: 'right',
                    type: 'button',
                    click: function() {
                        alert('广告种类繁多,且经常更新,不保证100%屏蔽,如有广告遗漏,请留言反馈。')
                    }
                },
                torrentMain: {
                    section: ['种子转换', '种子链接转换,均保留原始链接。'],
                    label: '种子链接转为',
                    labelPos: 'left',
                    type: 'select',
                    'options': ['磁力超链接', '磁力纯文本', '不做改动'],
                    'default': '磁力超链接'
                },
                torrentPlace: {
                    label: '磁力链接位置',
                    labelPos: 'left',
                    type: 'select',
                    'options': ['贴内标题后', '全部图片前', '全部图片后'],
                    'default': '全部图片前'
                },
                torrentRepeat: {
                    label: '移除重复种子链接',
                    labelPos: 'left',
                    type: 'checkbox',
                    default: true,
                },
                torrentDown: {
                    label: '开启种子快捷下载',
                    labelPos: 'left',
                    type: 'checkbox',
                    default: false,
                },
                magnetCopy: {
                    label: '显示磁力链接复制按钮',
                    labelPos: 'left',
                    type: 'checkbox',
                    default: false,
                },
                Other_hide: {
                    section: ['其他设置', '优化浏览体验'],
                    label: '隐藏楼主信息栏',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                threadOpen_background: {
                    label: '主题帖后台打开',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                threadShow: {
                    label: '主题帖图片预览',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                font_Color: {
                    label: '贴内字体改为蓝色',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                tourist_Search: {
                    label: '显示游客站内搜索框',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                go_Top: {
                    label: '显示返回顶部悬浮按钮',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                },
                hide_Reply: {
                    label: '所有回复',
                    labelPos: 'left',
                    type: 'select',
                    'options': ['默认折叠', '默认展开'],
                    'default': '默认展开'
                },
                blackTxt: {
                    'label': '屏蔽包含以下关键词的回复',
                    'type': 'textarea',
                    'default': '1024|感谢|支持|收藏|看看'
                },
            },
            events: {
                save: function() {
                    GM_config.close()
                }
            },
        })
    };
    config();
    var G = GM_config;
    var localHref = window.location.href;
    var dataLink2 = 'img[data-link$=".jpg"],img[data-link$=".jpeg"],img[data-link$=".png"],img[data-link$=".bmp"],img[data-link$=".gif"]';
    var torrentHref = 'a[href*="rmdown"],a[href*="bbcb"],a[href*="motelppp"],a[href*="365shares"],a[href*="qqxbt"],a[href*="busdown"],a[href*="gueizu"],a[href*="3wpan"],a[href*="bvmqkla.de/x"]';

    function AjaxCall(href, callback) {
        GM_xmlhttpRequest({
            method: "GET",
            url: href,
            onload: function(data, status) {
                if (data.readyState == 4 && data.status == 200) {
                    var htmlTxt = data.responseText;
                    callback(null, htmlTxt)
                }
            },
            onerror: function(error) {
                callback(error)
            },
            ontimeout: function(error) {
                callback(error)
            },
        })
    };
    if (localHref.match(/htm_data\S*\.html/) != null) {
        var ready = function() {
            $('.tpc_content:eq(0)').addClass('CL1024');
            if (!G.get('open_viidii')) {
                var src1 = $('script').text().match(/img\[([a-z-]+)\]/)[1];
                console.log('图片属性名称:' + src1)
            } else {
                var src1 = '6666'
            };
            var newHtml = $('.CL1024').html().replace(/&(amp;)?z/gi, '').replace(/https?\S+viidii\.(com|info)\/\?/gi, '').replace(/\s*&nbsp;\s*/gi, '').replace(/<\/?b>/gi, '').replace(/_{4,}/g, '.').replace(new RegExp(src1, 'g'), 'src2');
            $('.CL1024').html(newHtml);
            $('.CL1024 img').addClass('oldJpg')
        };
        ready();
        if (G.get('font_Color')) {
            var color2 = "color:blue"
        } else {
            var color2 = ""
        }; if (G.get('adBlockMain')) {
            $('.CL1024').prevAll().remove('br');
            $('.CL1024>span').not('[class^="f"]').contents().unwrap();
            $('.CL1024').contents().filter(function() {
                return this.nodeType == 3
            }).wrap('<p style=' + color2 + '></p>').end().filter('br').remove();
            if (localHref.match(/htm_data\/200[0-9]\/7\//) == null) {
                $('p:first').prevAll().not(torrentHref + dataLink2).remove();
                $('img[src2$=".gif"],.CL1024 [class^="f"]:has(img),.image-big-text').remove()
            };
            var adClass = '.CL1024 a[target="_blank"]:not([class^="f"]),.CL1024 a[onclick],.CL1024>br';
            $(adClass).not(torrentHref + dataLink2).remove()
        };
        if (G.get('adBack') && !G.get('open_viidii')) {
            var adName = $('script').text().match(/r\w+S/)[0];
            $('body').append('<script>' + adName + '=null;</script>');
            $('.tips,.sptable_do_not_remove').remove();
            if (typeof $('.tpc_content').html() == 'undefined' || $('.CL1024').height() < 100) {
                alert('1024浏览助手:屏蔽反广告检测已失效,请关闭该功能,恢复正常浏览。')
            }
        };
        if (!G.get('open_viidii')) {
            var txt = 'img599.net|kccdk.com|picbaron.com|imgbabes.com|www.xoimg.club|www.privacypic.com|img250|img300.picturelol.com'.split('|');
            for (var i = 0; i < txt.length; i++) {
                if ($('.oldJpg:eq(-1)').attr('src2').indexOf(txt[i]) != -1) {
                    var Gallery = txt[i] + '图库';
                    if (txt[i].match(/img599|kccdk|privacypic|img250|img300/) != null) {
                        var img599 = true
                    };
                    break
                } else {
                    var Gallery = '未知图库'
                }
            };
            if (G.get('jpg_Origin')) {
                $('.oldJpg:first').before('<p style=' + color2 + '>【图片引用】:' + Gallery + ' </p>')
            }
        };
        var jpg = function() {
            if (typeof($('.oldJpg:first').attr('data-link')) == 'undefined') {
                var jpgBig = true
            };
            $('.oldJpg').each(function() {
                if (typeof($(this).attr('data-link')) == 'undefined') {
                    $(this).attr('data-link', $(this).attr('src2'));
                    $(this).after('&nbsp;', '<br>')
                };
                if ($(this).attr('src2').indexOf('sinaimg') != -1) {
                    $(this).attr('src2', $(this).attr('src2').replace(/https:/, "http:"))
                };
                if ($(this).parent().hasClass('image-big')) {
                    $(this).unwrap()
                };
                if ($(this).attr('data-link').indexOf('kccdk') != -1) {
                    var newlink = $(this).attr('src2').replace(/(.*)thumbs\/(.*)\.(th|md)\.jpg/, '$1$2.jpeg');
                    $(this).attr('src2', newlink);
                    $(this).attr('data-link', newlink)
                };
                if ($(this).attr('data-link').indexOf('img599') != -1) {
                    $(this).attr('data-link', $(this).attr('src2').replace(/\.(th|md)/, ''));
                    if (G.get('jpgShow') == '中等图') {
                        $(this).attr('src2', $(this).attr('src2').replace('.th', '.md'))
                    } else if (G.get('jpgShow') == '大图') {
                        $(this).attr('src2', $(this).attr('src2').replace('.th', ''));
                        $(this).after('&nbsp;')
                    }
                };
                var jpglink = $(this).attr('data-link');
                if (G.get('jpg_Load')) {
                    var jpgLocal = 'https://gitee.com/zxf10608/js/raw/master/loading00.gif';
                    var jpgLoad = $(this).attr('src2')
                } else {
                    var jpgLocal = $(this).attr('src2');
                    var jpgLoad = '0'
                };
                $(this).replaceWith('<a href=' + jpglink + ' target="_blank" class="newJpg"> <img src=' + jpgLocal + ' data-original=' + jpgLoad + ' alt="图片加载失败" title="点击查看原图" class="newImg" style="cursor:pointer;max-width:1024px"></a>')
            });
            if (G.get('jpgNewtab')) {
                $('.CL1024').on('click', '.newJpg', function(event) {
                    GM_openInTab($(this).attr('href'));
                    return false
                })
            };
            if (G.get('jpgMain') == '双列' && jpgBig) {
                $('.newJpg:even').after('<br>')
            } else if (G.get('jpgMain') == '双列') {
                $('.newJpg:odd').after('<br>')
            } else if (G.get('jpgMain') == '单列') {
                $('.newJpg').after('&nbsp;', '<br>')
            };
            if (G.get('jpg_Load')) {
                var load_error = function(element) {
                    console.log("图片延迟加载失败!", element.getAttribute("data-original"))
                };
                var load_finish = function() {
                    console.log("所有图片延迟加载完成")
                };
                var lazyLoadInstance = new LazyLoad({
                    elements_selector: '.newImg',
                    data_src: 'original',
                    threshold: 100,
                    callback_error: load_error,
                    callback_finish: load_finish
                })
            }
        };
        if (!G.get('open_viidii')) {
            jpg()
        } else {
            $('img').each(function() {
                $(this).after('&nbsp;')
            })
        }; if (G.get('torrentRepeat')) {
            var torrent = torrentHref.split(',');
            for (var i = 0; i < torrent.length; i++) {
                $(torrent[i] + ':not(:first)').remove()
            }
        };
        var magnet2 = function() {
            $(torrentHref).each(function() {
                var torrentLink = $(this).attr('href');
                $(this).remove();
                $('.newJpg').last().nextAll().not('a,br').remove();
                if (torrentLink.indexOf('rmdown') != -1) {
                    var hash = torrentLink.replace(/(.*)hash=(20[0-9])?(\w{40})/, '$3');
                    var magnetHref = 'magnet:?xt=urn:btih:' + hash;
                    var hashTorrent = '<a href=' + torrentLink + ' class="newTorrent rmdown">种子下载</a>';
                    if (G.get('magnetCopy')) {
                        setTimeout(function() {
                            $('.newMagnet').after('<a class="copy" data-href=' + magnetHref + ' href="javascript: void(0);" target="_blank" title="复制磁力链接">&nbsp;复制</a>');
                            copy()
                        }, 50)
                    };
                    if (G.get('torrentDown')) {
                        AjaxCall(torrentLink, function(error, htmlTxt) {
                            if (error) {
                                console.log(torrentLink + '异步加载请求失败!');
                                return
                            };
                            var reffValue = htmlTxt.match(/value="([a-z0-9]+)"/)[1];
                            var refValue = htmlTxt.match(/Code:\s((20[0-9])?[a-z0-9]{40})/)[1];
                            var rmdownLink = 'http://www.rmdown.com/download.php?reff=' + reffValue + '&ref=' + refValue;
                            $('.rmdown').attr('href', rmdownLink);
                            console.log('rmdown种子真实地址:' + rmdownLink)
                        })
                    };
                    if (G.get('torrentMain') == '磁力纯文本') {
                        var hashMagnet = '<p>' + magnetHref + '</p>'
                    } else {
                        var hashMagnet = '<a href=' + magnetHref + ' class="newTorrent newMagnet">磁力链接</a>'
                    }
                } else if (torrentLink.indexOf('bbcb') != -1 && G.get('torrentDown')) {
                    var bbcbLink = torrentLink.replace(/(.*)list\.php\?name=(\w+)/, '$1down.php/$2.torrent');
                    var otherTorrent = '<a href=' + bbcbLink + ' class="newTorrent">备用种子下载</a>';
                    console.log('bbcb种子真实地址:' + bbcbLink)
                } else {
                    var otherTorrent = '<a href=' + torrentLink + ' class="newTorrent">备用种子下载</a>'
                }; if (G.get('torrentPlace') == '全部图片前') {
                    $('.newJpg:first').before(hashMagnet, hashTorrent, otherTorrent)
                } else if (G.get('torrentPlace') == '全部图片后') {
                    $('.newJpg:last').after(hashMagnet, hashTorrent, otherTorrent);
                    $('.newImg:last').after('<br>')
                } else {
                    $('.CL1024').prepend(otherTorrent, hashMagnet, hashTorrent)
                }
            });
            if (localHref.match(/htm_data\/200[0-9]\/7\//) == null) {
                $('[class^="f"]').remove()
            } else {
                $('[class^="f"]').filter('a[target="_blank"],:contains(種子),:contains(大圖),:contains(图片連結),:contains(AD)').remove()
            };
            $('.newTorrent').after('<br>');
            $('.newTorrent').attr({
                'target': '_blank',
                'style': 'cursor:pointer;color:#2f5fa1;'
            })
        };
        if (G.get('torrentMain') != '不做改动' && !G.get('open_viidii')) {
            magnet2()
        } else {
            $(torrentHref).each(function() {
                $(this).wrap('<p></p>')
            })
        }; if (G.get('Other_hide')) {
            $('th:eq(0)').hide();
            $('.CL1024,.tiptop:eq(0),.tipad:eq(0),h4').css('padding', '0px 115px')
        };
        if (G.get('adBlockMain')) {
            window.onload = function() {
                $('.CL1024 img').each(function() {
                    var w = $(this).width();
                    var h = $(this).height();
                    if (w > 850 && h < 280) {
                        $(this).remove()
                    }
                })
            }
        };
        if (G.get('gallery') && img599 && !G.get('open_viidii')) {
            if (typeof(Spotlight) == 'undefined') {
                alert('Spotlight库加载失败,相册预览模式无法使用!')
            } else {
                console.log('Spotlight库加载成功。')
            };
            $('.newJpg').addClass('spotlight');
            $('.newJpg').attr({
                'data-title': false,
                'player': 2000
            });
            $(document).ready(function() {
                var txt = '全屏|自动调整|缩小|放大|主题|自动播放|关闭|上一张|下一张'.split('|');
                $('.arrow-left').attr('title', txt[7]);
                $('.arrow-right').attr('title', txt[8]);
                for (var i = 0; i < 8; i++) {
                    $('.icon:eq(' + i + ')').attr('title', txt[i])
                };
                $('.icon.fullscreen').before('<div class="icon download" title="下载当前图片" style="cursor:pointer;"></div>');
                $('.download').css({
                    'background-image': 'url(//gitee.com/zxf10608/js/raw/master/download01.svg)',
                    'background-position': 'left center',
                    'background-size': '21px 21px'
                });
                $('.download').click(function() {
                    var Link = $('.pane>img').attr('src');
                    var fileName = Link.split('/').slice(-1).toString();
                    download(Link, fileName)
                })
            })
        };
        $('.t.t2:not(:first)').each(function() {
            var blackList = G.get('blackTxt');
            if ($(this).text().match(new RegExp('/' + blackList + '/')) != null) {
                $(this).remove()
            }
        });
        var reply = function() {
            var replyClass = '.t.t2:gt(0),.t:last,td[align="left"]:last';
            if (G.get('hide_Reply') == '默认展开') {
                var txt = '折叠回复'
            } else {
                var txt = '展开回复';
                $(replyClass).hide()
            };
            $('.tipad:eq(0)').append('<button class="reply" style="cursor:pointer;">' + txt + '</button>');
            $('.reply').click(function() {
                if ($('.reply').text() == "展开回复") {
                    $('.reply').text("折叠回复")
                } else {
                    $('.reply').text("展开回复")
                };
                $(replyClass).slideToggle('fast')
            })
        };
        reply();
        if (G.get('go_Top')) {
            $('body').append('<img src="https://gitee.com/zxf10608/js/raw/master/gotop.png" class="goTop" style="position:fixed; width:50px; bottom:10px; right:10px; cursor:pointer; display:none;" title="返回顶部">');
            $(".goTop").click(function() {
                $('html,body').animate({
                    scrollTop: '0px'
                }, 'slow')
            });
            $(window).scroll(function() {
                var s = $(window).scrollTop();
                if (s > 500) {
                    $(".goTop").fadeIn(600)
                } else {
                    $(".goTop").fadeOut(600)
                }
            })
        };

        function copy() {
            $('.CL1024').on('click', '.copy', function(event) {
                GM_setClipboard($(this).data('href'));
                var txt = '磁力链接复制完成。';
                Popup(txt)
            })
        };

        function download(Link, fileName) {
            GM_download({
                url: Link,
                name: fileName,
                onload: function() {
                    var txt = fileName + ' 下载完成。';
                    Popup(txt)
                },
                onerror: function() {
                    alert('下载失败')
                },
                ontimeout: function() {
                    alert('下载超时')
                },
            })
        };

        function Popup(txt) {
            GM_notification({
                title: '1024浏览助手:',
                text: txt,
                timeout: 3000,
            })
        }
    };
    if (document.title.indexOf('t66y') != -1 && G.get('tourist_Search')) {
        var cx = '017632740523370213667:kcbl-j-fmok';
        $.getScript('https://cse.google.com/cse.js?cx=' + cx, function() {
            $('.gsrch').css({
                'width': '300px',
                'height': '50px',
                'float': 'right',
                'margin': '5px -39px 0 0'
            })
        }).fail(function() {
            alert('显示游客站内搜索框失败!请翻墙后再开启!')
        });
        $('.banner').append('<div class="gsrch"><gcse:search></gcse:search></div>')
    };
    if (localHref.indexOf('www.viidii.info/?action=image') != -1 && G.get('open_viidii')) {
        var viidiiOpen = function() {
            $('.al').remove();
            var newlink = $('.bglink').attr('href');
            window.location.href = newlink
        };
        viidiiOpen()
    };
    if (localHref.indexOf('thread0806.php') != -1) {
        $('.tal a:gt(2)').each(function() {
            var Link = $(this).attr('href');
            var locaHref = window.location.href;
            var tempLink = locaHref.split('thread0806');
            var newlink = tempLink[0].substring(0) + Link;
            $(this).attr('data-href', newlink);
            if (G.get('threadOpen_background')) {
                $(this).click(function() {
                    GM_openInTab(newlink);
                    return false
                })
            }
        });
        var showImage = function() {
            $('body').append('<img class="imgshow" style="position:absolute; border:1px solid gray; display:none;" src="0">');
            $('.tal a:gt(2)').hover(function(e) {
                var thiz = $(this);
                trigger = setTimeout(function() {
                    if (typeof(thiz.attr('data-src')) != 'undefined') {
                        var bigLink = thiz.attr('data-src');
                        $('.imgshow').attr('src', bigLink)
                    } else {
                        var srcLink = thiz.attr('data-href');
                        AjaxCall(srcLink, function(error, htmlTxt) {
                            if (error) {
                                console.log(srcLink + '异步加载请求失败');
                                alert('图片预览失败,请确认网络畅通!');
                                return
                            };
                            var srcName = htmlTxt.match(/img\[([a-z-]+)\]/)[1];
                            var tempTxt = htmlTxt.split(srcName).slice(-6).toString();
                            var jpgLink = tempTxt.match(/https?\S+(jpe?g|png|gif|bmp)/)[0];
                            if (jpgLink.match(/kccdk|img599/) != null) {
                                var bigLink = jpgLink.replace('.th', '.md')
                            } else {
                                var bigLink = jpgLink
                            };
                            thiz.attr('data-src', bigLink);
                            $('.imgshow').attr('src', bigLink)
                        })
                    };
                    setTimeout(function() {
                        var t = thiz.offset().top;
                        var h = ($(window).height()) * 0.7;
                        if (t - h > 0) {
                            var num = '-100%'
                        } else {
                            var num = '0'
                        };
                        $('.imgshow').css({
                            top: e.pageY,
                            left: e.pageX,
                            transform: 'translateY(' + num + ')'
                        }).fadeIn('slow')
                    }, 600)
                }, 500)
            }, function() {
                clearTimeout(trigger);
                $('.imgshow').removeAttr('src').fadeOut('slow')
            })
        };
        if (G.get('threadShow')) {
            showImage()
        }
    };
    if (G.get('adOther')) {
        if (localHref.indexOf('img599.net') != -1 && G.get('ad_img599')) {
            $('.google-ad2_fixed').remove();
            $('a[target="_blank"]').remove()
        };
        if (localHref.match(/^(?=.*picbaron)(?=.*html)/) != null && G.get('ad_PicBaron')) {
            $(':submit').click();
            $('img[src$=".jpg"],img[src$=".jpeg"]').each(function() {
                var newlink = $(this).attr('src');
                window.location.href = newlink
            })
        };
        if (localHref.indexOf('www.rmdown.com') != -1 && G.get('ad_rmdown')) {
            $('a[target="_blank"]').hide();
            $('#foo1ter').css('display', '')
        };
        if (localHref.indexOf('download.bbcb.tw') != -1 && G.get('ad_bbcb')) {
            $('a[target="_blank"],.tm-footer').hide();
            $('.uk-button').removeAttr('onclick')
        };
        if (localHref.indexOf('motelppp.com') != -1 && G.get('ad_motelppp')) {
            $('#countdown').attr('class', 'countdown end');
            $('#btnDownload').removeAttr('disabled').removeClass('disabled-btn');
            $('img[src$=".gif"]').hide()
        };
        if (localHref.indexOf('www.imgbabes.com') != -1 && G.get('ad_imgbabes')) {
            $(':submit').click();
            $('a[target="_blank"],#transparentbg').hide();
            $('img[src$=".jpg"]').each(function() {
                var newlink = $(this).attr('src');
                window.location.href = newlink;
                return false
            })
        }
    }
})();