Sleazy Fork is available in English.

1024浏览助手

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

Fra 20.09.2020. Se den seneste versjonen.

// ==UserScript==
// @name         1024浏览助手
// @author       zxf10608
// @version      4.0
// @namespace    https://greasyfork.org/users/9280
// @description  支持自定义屏蔽1024广告、屏蔽反广告检测、显示游客站内搜索框、图片延迟加载、修改图片显示尺寸和排列方式、种子链接转磁力链接、取消外链跳转、屏蔽指定回复等。
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js
// @require      https://cdn.bootcdn.net/ajax/libs/vanilla-lazyload/17.1.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      	 https://gitee.com/zxf10608/js/raw/master/1024logo.ico
// @homepageURL  https://greasyfork.org/zh-CN/scripts/398915
// @include      http*://*/htm_data/*.html
// @include      http*://*/htm_mob/*.html
// @include      http*://*/read.php?fid=*
// @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_download
// @grant        GM_openInTab
// @grant        GM_notification
// @grant        GM_setClipboard
// @grant        GM_xmlhttpRequest
// @connect      rmdown.com
// @connect      imgbabes.com
// @connect      t66y.com
// @connect      *

// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_registerMenuCommand
// @run-at       document-end
// @compatible   chrome
// @license      GPL License
// ==/UserScript==

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

    function config() {
        var windowcss = '#Cfg input[type="checkbox"] {margin: 3px 3px 3px 0px;} #Cfg .config_var {margin-left: 10%;margin-right: 10%;} #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 版本:' + newVersion + ' 点击访问主页'
            }),
            isTabs: true,
            skin: 'tab',
            css: windowcss,
            frameStyle: {
                height: '500px',
                width: '426px',
                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: 'right',
                    type: 'checkbox',
                    default: false,
                },
                jpg_Origin: {
                    label: '显示图片引用来源',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                gallery: {
                    label: '开启相册预览模式',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                },
                jpg_Load: {
                    label: '开启图片延迟加载',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                },
                close_JpgMain: {
                    label: '关闭优化,仅快速打开图片跳转',
                    labelPos: 'right',
                    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: true,
                },
                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: 'right',
                    type: 'checkbox',
                    default: true,
                },
                torrentDown: {
                    label: '开启种子快捷下载',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: true,
                },
                magnetCopy: {
                    label: '显示磁力链接复制按钮',
                    labelPos: 'right',
                    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: true,
                },
                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,
                },
                wide_Screen: {
                    label: '默认开启宽屏显示',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                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 dataLink = '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"],a[href*="fijidown"],a[href*="finedac"]';

    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|mob)\S*\.html|read\.php\?fid=/) != null) {
        var ready = function() {
            $('.tpc_content:eq(0)').addClass('CL1024');
            $('.CL1024 img').addClass('oldJpg');
            $('.CL1024 a[target="_blank"]').addClass('oldTorrent');
            if (!G.get('close_JpgMain')) {
                var src1 = $('script').text().match(/img\[([a-z-]+)\]/)[1]
            } 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(/={4,}/g, '').replace(new RegExp(src1, 'g'), 'src2');
            $('.CL1024').html(newHtml)
        };
        ready();
        if (G.get('font_Color')) {
            var color2 = "color:blue"
        } else {
            var color2 = ""
        }; if (localHref.match(/htm_data\/200[0-9]\/7\//) != null) {
            var thread_fid_7 = true
        } else {
            var thread_fid_7 = false
        }; if (G.get('adBlockMain')) {
            $('.CL1024').prevAll().remove('br');
            $('.CL1024 .image-big,blockquote,b').not('[class^="f"]').contents().unwrap();
            $('.CL1024').contents().filter(function() {
                return this.nodeType == 3
            }).wrap('<p style=' + color2 + '></p>');
            $('.CL1024>br').remove();
            if (!thread_fid_7) {
                $('.CL1024 br').remove();
                $('p:first').prevAll().not(torrentHref + dataLink).remove();
                $('.CL1024 img[src2$=".gif"],.CL1024 [class^="f"]:has(img),.CL1024 a[onclick],.image-big-text,.quote,.t_like').not(torrentHref + dataLink).remove();
                $('.CL1024 span').not('[class^="f"]').contents().unwrap();
                $('.oldTorrent').each(function() {
                    if ($(this).is(torrentHref) || $(this).prev().find('*').addBack().is('img') || $(this).next().find('*').addBack().is('img')) {
                        return
                    };
                    $(this).remove()
                })
            }
        };
        if (G.get('adBack')) {
            var adName = $('script').text().match(/r\w+S/)[0];
            $('body').append('<script>function ' + adName + ' (){}</script>');
            $('.tips,.sptable_do_not_remove,#footer').remove()
        };
        if (typeof $('.tpc_content:eq(0)').html() == 'undefined' || $('.CL1024').height() < 100) {
            alert('1024浏览助手:屏蔽1024广告或屏蔽反广告检测异常,请关闭该功能,恢复正常浏览。')
        };
        if (G.get('wide_Screen')) {
            var w = '100%';
            $('#header,#main').css('max-width', w)
        } else {
            var w = '1024px'
        }; if (!G.get('close_JpgMain')) {
            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 (!$('.oldJpg:first').is('[data-link]')) {
                var jpgBig = true
            };
            $('.oldJpg').each(function(i) {
                if (!$(this).is('[data-link]')) {
                    $(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).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') && i > 1) {
                    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:' + w + '"></a>')
            });
            if (G.get('jpgNewtab')) {
                $('.CL1024').on('click', '.newJpg', function() {
                    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: 'img[src$="loading00.gif"]',
                    data_src: 'original',
                    threshold: 100,
                    callback_error: load_error,
                    callback_finish: load_finish
                })
            }
        };
        if (!G.get('close_JpgMain')) {
            jpg()
        } else {
            $('.oldJpg').after('&nbsp;')
        }; if (G.get('torrentRepeat')) {
            for (var i = 0; i < $('.oldTorrent').length; i++) {
                var Link1 = $('.oldTorrent').eq(i).attr('href');
                $('.oldTorrent').eq(i).attr('own', '1');
                $('.oldTorrent').each(function() {
                    var Link2 = $(this).attr('href');
                    if (Link1 == Link2 && !$(this).is('[own]')) {
                        $(this).remove()
                    }
                })
            }
        };
        var magnet2 = function() {
            if (G.get('adBlockMain')) torrentHref = '.oldTorrent';
            $(torrentHref).each(function() {
                var torrentLink = $(this).attr('href');
                var txt = $(this).text().replace(/點擊進入下載\s?/g, '');
                $(this).remove();
                $('.newJpg,.oldJpg').last().nextAll().not('a,br').remove();
                if (torrentLink.indexOf('rmdown') != -1) {
                    var hash = torrentLink.replace(/(.*)hash=(20[0-9])?(\w{40})/, '$3');
                    var magnetLink = 'magnet:?xt=urn:btih:' + hash;
                    GM_setValue('magnet', magnetLink);
                    GM_setValue('torrent', torrentLink);
                    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)
                        })
                    }
                } 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 otherTorrent">其他种子 ' + txt + '</a><br>'
                }; if (G.get('torrentPlace') == '全部图片前') {
                    setTimeout(function() {
                        $('.newJpg,.oldJpg').first().before(otherTorrent)
                    }, 10)
                } else if (G.get('torrentPlace') == '全部图片后') {
                    $('.newJpg,.oldJpg').last().after(otherTorrent)
                } else {
                    $('.CL1024').prepend(otherTorrent)
                }
            });
            var magnetLink = GM_getValue('magnet') || '0';
            var torrentLink = GM_getValue('torrent') || '0';
            var hashMagnet = '',
                hashTorrent = '';
            GM_setValue('magnet', '0');
            GM_setValue('torrent', '0');
            if (magnetLink != 0) {
                if (G.get('torrentMain') == '磁力纯文本') {
                    var hashMagnet = '<p>' + magnetLink + '</p>'
                } else {
                    var hashMagnet = '<a href=' + magnetLink + ' class="newTorrent newMagnet">磁力链接</a><a href="javascript: void(0);" class="copy" data-href=' + magnetLink + ' style="display:none;" title="复制磁力链接">&nbsp;复制</a><br>'
                }
            };
            if (torrentLink != 0) {
                var hashTorrent = '<a href=' + torrentLink + ' class="newTorrent rmdown">种子下载</a><br>'
            };
            if (G.get('torrentPlace') == '全部图片前') {
                $('.newJpg,.oldJpg').first().before(hashMagnet, hashTorrent)
            } else if (G.get('torrentPlace') == '全部图片后') {
                $('.newJpg,.oldJpg').last().after('<br>', hashMagnet, hashTorrent)
            } else {
                $('.CL1024').prepend(hashMagnet, hashTorrent)
            }; if (G.get('magnetCopy')) $('.copy').show();
            if (!thread_fid_7) {
                $('[class^="f"]').remove()
            } else {
                $('[class^="f"]').filter('a[target="_blank"],:contains(種子),:contains(大圖),:contains(图片連結),:contains(AD)').remove()
            };
            setTimeout(function() {
                if ($('.otherTorrent').length == 1) {
                    $('.otherTorrent').text('备用种子下载')
                };
                $('.newTorrent,.copy').css({
                    'target': '_blank',
                    'style': 'cursor:pointer;color:#2f5fa1;'
                })
            }, 80)
        };
        if (G.get('torrentMain') != '不做改动' && !thread_fid_7) {
            magnet2()
        } else if (G.get('adBlockMain')) {
            $('.oldTorrent').before('<br>').after('<br>')
        };
        if (G.get('Other_hide')) {
            $('th:eq(0),.r_two: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('close_JpgMain')) {
            if (typeof(Spotlight) == 'undefined') {
                alert('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:gt(0)').each(function() {
            var blackList = G.get('blackTxt');
            if ($(this).find('.tpc_content').text().match(new RegExp(blackList, 'g')) != 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');
                return false
            })
        };
        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)
                }
            })
        };
        $('.CL1024').on('click', '.copy', function(event) {
            GM_setClipboard($(this).data('href'));
            var txt = '磁力链接复制完成。';
            Popup(txt);
            return false
        });

        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,
            })
        };
        var ver = GM_getValue('version') || '';
        if (ver != newVersion) {
            var txt='1024浏览助手 '+newVersion+' 更新日志:\n更新日期:2020年9月20日 全新升级,众多优化!\n1、优化大量逻辑,降低依赖,增强性能。同时“图片优化”、“广告屏蔽”、“种子转换”功能实现独立开启;\n2、优化“图片延迟加载”,前两张图片一律直接显示不延时;\n3、新增“默认开启宽屏显示”,需到“其他设置”中开启;\n4、改进广告屏蔽规则;\n5、增强种子链接识别;\n6、修复picbaron.com图库去广告功能;\n7、更新jQuery、lazyload库源地址;\n8、修复n处bug,务必更新!';
			alert(txt);
            GM_setValue('version', newVersion)
        }
    };
    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('close_JpgMain')) {
        var viidiiOpen = function() {
            $('.al').remove();
            var newlink = $('.bglink').attr('href');
            window.location.href = newlink
        };
        viidiiOpen()
    };
    if (localHref.indexOf('thread0806.php') != -1) {
        $('.tal a').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() {
            var trigger;
            $('body').append('<img class="imgshow" style="position:absolute; border:1px solid gray; display:none;" src="0">');
            $('.tal a').hover(function(e) {
                var thiz = $(this);
                trigger = setTimeout(function() {
                    if (thiz.is('[data-src]')) {
                        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)
                }, 400)
            }, 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')) {
            $(document).ready(function() {
                $(':submit').click();
                setTimeout(function() {
                    var newlink = $('.pic').attr('src');
                    window.location.href = newlink
                }, 1000)
            })
        };
        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
            })
        }
    }
})();