1024浏览助手

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

Från och med 2020-04-07. Se den senaste versionen.

// ==UserScript==
// @name         1024浏览助手
// @author       zxf10608
// @version      2.4.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/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/8AMbIhAOfr1gDe584A1ufWAELb/wBSw0IAKcPGAK3XtQBzx2sAnM+1AIzDrQBavloAOboxAJzXrQCcy6UAY8eU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A/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*
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_openInTab
// @grant        GM_registerMenuCommand
// @grant        window.close
// @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: "访问主页"
            }),
            isTabs: true,
            skin: 'tab',
            css: windowcss,
            frameStyle: {
                height: '450px',
                width: '409px',
                zIndex: '2147483648',
            },
            fields: {
                jpgMain: {
                    section: ['图片优化', '修改图片显示样式'],
                    label: '图片排列方式',
                    labelPos: 'left',
                    type: 'select',
                    'options': ['平铺', '单列', '双列'],
                    'default': '平铺'
                },
                jpgShow: {
                    label: '图片显示尺寸',
                    labelPos: 'left',
                    type: 'select',
                    'options': ['缩略图', '中等图', '大图'],
                    'default': '缩略图'
                },
                jpgNewtab: {
                    label: '图片打开方式',
                    labelPos: 'left',
                    type: 'select',
                    'options': ['当前页面打开', '新标签前台打开', '新标签后台打开'],
                    'default': '新标签前台打开'
                },
                open_viidii: {
                    label: '关闭图片优化,仅快速打开图片跳转',
                    labelPos: 'left',
                    type: 'checkbox',
                    default: false,
                },
                reminder: {
                    label: '温馨提示',
                    labelPos: 'right',
                    type: 'button',
                    click: function() {
                        alert('1、封面图始终独占一行,修改显示尺寸仅支持引用自img599.net的图片,大图需消耗更多带宽和内存。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_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,
                },
                OtherJpg: {
                    section: ['其他功能', '优化浏览体验'],
                    label: '显示图片引用来源',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                hide_Information: {
                    label: '隐藏楼主信息栏',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                threadOpen_background: {
                    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: false,
                },
                jpg_Load: {
                    label: '开启图片延迟加载',
                    labelPos: 'right',
                    type: 'checkbox',
                    default: false,
                },
                hide_Reply: {
                    label: '所有回复',
                    labelPos: 'left',
                    type: 'select',
                    'options': ['默认隐藏', '默认显示'],
                    'default': '默认显示'
                },
            },
            events: {
                save: function() {
                    GM_config.close()
                }
            },
        })
    };
    config();
    var localHref = window.location.href;
    var hrefHash = 'a[href*="hash="]';
    var torrentHref = 'a[href*="rmdown"],a[href*="bbcb"],a[href*="motelppp"],a[href*="365shares"],a[href*="qqxbt"],a[href*="busdown"],a[href*="gueizu"]';
    if (localHref.match(/^(?=.*htm_data)(?=.*html)/) != null) {
        $('.tpc_content:eq(0)').addClass('CL1024');
        if (GM_config.get('font_Color')) {
            var color2 = "color:blue"
        } else {
            var color2 = ""
        }; if (!GM_config.get('open_viidii')) {
            var src1 = $('script').text().match(/\[(\S*)\]/)[1];
            console.log('图片属性名称:' + src1)
        } else {
            var src1 = '6666'
        };
        var newHtml = $('.CL1024').html().replace(/(http|https):\/\/www\.viidii\.(com|info)\/\?/g, '').replace(/&nbsp;/gi, '').replace(/<\/?b>/gi, '').replace(/______/g, '.').replace(new RegExp(src1, 'g'), 'src2');
        $('.CL1024').html(newHtml);
        $(torrentHref).each(function() {
            var newHref = $(this).attr('href').replace(/&z/g, '');
            $(this).attr('href', newHref)
        });
        var adCL = function() {
            if (GM_config.get('adBlockMain')) {
                $('.CL1024>span').not('[class^="f"]').contents().unwrap();
                $('.CL1024').prevAll().remove('br');
                $('.CL1024').contents().filter(function() {
                    return this.nodeType == 3
                }).wrap('<p style=' + color2 + '></p>').end().filter('br').remove();
                var datalink2 = 'img[data-link$=".jpg"],img[data-link$=".jpeg"],img[data-link$=".gif"],img[data-link$=".png"]';
                if ( localHref.match(/htm_data\/200([0-9])?\/7\//) == null ) {
					$('p:first').prevAll().not(''+torrentHref+','+datalink2+'').remove();
				};
                var adClass = '.CL1024>a[target="_blank"]:not([class^="f"]),img[data-link]+p,.CL1024 [class^="f"]:has(img),.CL1024 a[onclick],.CL1024>br';
                $(adClass).not('' + torrentHref + ',' + datalink2 + '').remove()
            };
            if (GM_config.get('adBack')) {
                setTimeout(function() {
                    $('.tips,.sptable_do_not_remove').hide();
                    if (typeof $('.tpc_content').html() === 'undefined' || $('.CL1024').height() < 100) {
                        alert('1024浏览助手:屏蔽反广告检测已失效,请关闭该功能,恢复正常浏览。')
                    }
                }, 1700)
            }
        };
        adCL();
        var jpg = function() {
            $('img[src2]').addClass('oldJpg');
            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).attr('data-link').indexOf('kccdk') != -1) {
                    var newlink = $(this).attr('src2').replace(/thumbs\//, '').replace('.th', '').replace('.md', '').replace('jpg', 'jpeg');
                    $(this).attr('src2', newlink)
                };
                if ($(this).attr('data-link').indexOf('img599') != -1) {
                    $(this).attr('data-link', $(this).attr('src2').replace('.th', ''));
                    if (GM_config.get('jpgShow') == '中等图') {
                        $(this).attr('src2', $(this).attr('src2').replace('.th', '.md'))
                    } else if (GM_config.get('jpgShow') == '大图') {
                        $(this).attr('src2', $(this).attr('src2').replace('.th', ''));
                        $(this).after('&nbsp;')
                    } else {
                        console.log('缩略图')
                    }
                };
                if (GM_config.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'
                };
                var jpglink = $(this).attr('data-link');
                $(this).replaceWith('<a href=' + jpglink + ' target="_self" class="newJpg"> <img src=' + jpgLocal + ' data-original=' + jpgLoad + ' alt="图片加载失败" title="点击查看原图" class="newImg" style="cursor: pointer;max-width:1024px"></a>')
            });
            $('.newJpg').each(function() {
                var newlink = $(this).attr('href');
                $(this).click(function() {
                    if (GM_config.get('jpgNewtab') == '新标签前台打开') {
                        GM_openInTab(newlink, false);
                        return false
                    } else if (GM_config.get('jpgNewtab') == '新标签后台打开') {
                        GM_openInTab(newlink);
                        return false
                    } else {
                        console.log('当前页面打开')
                    }
                })
            });
            if (GM_config.get('jpgMain') == '双列' && jpgBig) {
                $('.newJpg:even').after('<br>')
            } else if (GM_config.get('jpgMain') == '双列') {
                $('.newJpg:odd').after('<br>')
            } else if (GM_config.get('jpgMain') == '单列') {
                $('.newJpg').after('&nbsp;', '<br>')
            } else {
                console.log('平铺')
            }; if (GM_config.get('OtherJpg')) {
                $('.newImg:last').each(function() {
                    if (GM_config.get('jpg_Load')) {
                        var src = 'data-original'
                    } else {
                        var src = 'src'
                    }; if ($(this).attr(src).indexOf('img599') != -1) {
                        var Gallery = 'img599.net图库'
                    } else if ($(this).attr(src).indexOf('kccdk') != -1) {
                        var Gallery = 'kccdk.com图库'
                    } else if ($(this).attr(src).indexOf('picbaron') != -1) {
                        var Gallery = 'picbaron.com图库'
                    } else if ($(this).attr(src).indexOf('imgbabes') != -1) {
                        var Gallery = 'www.imgbabes.com图库'
                    } else if ($(this).attr(src).indexOf('xoimg') != -1) {
                        var Gallery = 'www.xoimg.club图库'
                    } else {
                        var Gallery = '未知图库'
                    };
                    $('.newJpg:first').before('<p style=' + color2 + '>【图片引用】:' + Gallery + ' </p>')
                })
            }
        };
        if (!GM_config.get('open_viidii')) {
            jpg();
            if (GM_config.get('jpg_Load')) {
                var lazyLoadInstance = new LazyLoad({
                    elements_selector: ".newImg",
                    data_src: 'original',
                })
            }
        } else {
            $('img').each(function() {
                $(this).after('&nbsp;')
            })
        };
        var magnet1 = function() {
            if (GM_config.get('torrentRepeat')) {
                var hrefa = 'a[href*="bbcb"]';
                var hrefb = 'a[href*="rmdown"]';
                var hrefc = '[class^="f"]a[href*="gueizu"]';
                $(hrefa).prevAll(hrefa).remove();
                $(hrefb).prevAll(hrefb).remove();
                $(hrefc).prevAll(hrefc).remove()
            }
        };
        magnet1();
        var magnet2 = function() {
            $(torrentHref).each(function() {
                if ($(this).attr('href').indexOf('hash=201') != -1) {
                    $(this).attr('href', $(this).attr('href').replace('201', ''))
                };
                var torrentLink = $(this).attr('href');
                $(this).hide();
                $('.newJpg').last().nextAll().not('a,br').remove();
                if (torrentLink.indexOf('rmdown') != -1) {
                    var tempLink = torrentLink.split('hash=');
                    var magnetHref = 'magnet:?xt=urn:btih:' + tempLink[1].substring(0, 40);
                    var hashTorrent = '<a href=' + torrentLink + ' class="newTorrent">种子下载</a>';
                    if (GM_config.get('torrentMain') == '磁力纯文本') {
                        var hashMagnet = '<p>' + magnetHref + '</p>'
                    } else {
                        var hashMagnet = '<a href=' + magnetHref + ' class="newTorrent">磁力链接</a>'
                    }
                } else {
                    var otherTorrent = '<a href=' + torrentLink + ' class="newTorrent">备用种子下载</a>'
                }; if (GM_config.get('torrentPlace') == '全部图片前') {
                    $('.newJpg:first').before(hashMagnet, hashTorrent, otherTorrent)
                } else if (GM_config.get('torrentPlace') == '全部图片后') {
                    $('.newJpg:last').after(hashMagnet, hashTorrent, otherTorrent);
                    $('.newImg:last').after('<br>')
                } else {
                    $('.CL1024').prepend(otherTorrent, hashMagnet, hashTorrent)
                }
            });
            $('[class^="f"]').filter('a[target="_blank"],:contains(種子),:contains(大圖),:contains(AD)').remove();
            $('.newTorrent').after('<br>');
            $('.newTorrent').attr({
                'target': '_blank',
                'style': 'cursor:pointer;color:#2f5fa1;'
            })
        };
        if (GM_config.get('torrentMain') != '不做改动' && !GM_config.get('open_viidii')) {
            magnet2()
        } else {
            $(torrentHref).each(function() {
                $(this).wrap('<p></p>')
            })
        }; if (GM_config.get('hide_Information')) {
            $('th:eq(0)').hide();
            $('.CL1024,.tiptop:eq(0),.tipad:eq(0),h4').css('padding', '0px 115px')
        };
        if (GM_config.get('adBlockMain')) {
            window.onload = function() {
                $('.CL1024 img').each(function() {
                    var w = $(this).width();
                    var h = $(this).height();
                    if (w > 850 && h < 280) {
                        $(this).remove()
                    }
                })
            }
        };
        var replyClass = '.t.t2:gt(0),.t:last,td[align="left"]:last';
        if (GM_config.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')
        });
        if (GM_config.get('go_Top')) {
            $('body').append('<img src="//gitee.com/zxf10608/js/raw/master/gotop.png" class="Top" style="position:fixed; bottom:20px; right:10px; cursor:pointer;}" title="返回顶部">');
            $(".Top").click(function() {
                $('html,body').animate({
                    scrollTop: '0px'
                }, 'slow')
            }) 
		$(window).scroll(function() {
                var s = $(window).scrollTop();
                if (s > 500) {
                    $(".Top").fadeIn(600)
                } else {
                    $(".Top").fadeOut(600)
                }
            })
        }
    };
    if (document.title.indexOf('t66y') != -1 && GM_config.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 && GM_config.get('open_viidii')) {
        var viidiiOpen = function() {
            $('.al').remove();
            var newlink2 = $('.bglink').attr('href');
            window.location.href = newlink2
        };
        viidiiOpen()
    };
    if (localHref.indexOf('thread0806.php') != -1 && GM_config.get('threadOpen_background')) {
        var threadOpen = function() {
            $('.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).click(function() {
                    GM_openInTab(newlink);
                    return false
                })
            })
        };
        threadOpen()
    };
    if (GM_config.get('adOther')) {
        if (localHref.match(/^(?=.*picbaron)(?=.*html)/) != null && GM_config.get('ad_PicBaron')) {
            var picAd = function() {
                $(':submit').click();
                $('img[src$=".jpg"]').each(function() {
                    var newlink = $(this).attr('src');
                    window.location.href = newlink
                })
            };
            picAd()
        };
        if (localHref.indexOf('www.rmdown.com') != -1 && GM_config.get('ad_rmdown')) {
            var rmdownAd = function() {
                $('a[target="_blank"]').hide();
                $('#foo1ter').css('display', '')
            };
            rmdownAd()
        };
        if (localHref.indexOf('download.bbcb.tw') != -1 && GM_config.get('ad_bbcb')) {
            var bbcbAd = function() {
                $('a[target="_blank"],.tm-footer').hide();
                $('.uk-button').removeAttr('onclick')
            };
            bbcbAd()
        };
        if (localHref.indexOf('motelppp.com') != -1 && GM_config.get('ad_motelppp')) {
            var motelpppAd = function() {
                $('#countdown').attr('class', 'countdown end');
                $('#btnDownload').removeAttr('disabled').removeClass('disabled-btn');
                $('img[src$=".gif"]').hide()
            };
            motelpppAd()
        };
        if (localHref.indexOf('www.imgbabes.com') != -1 && GM_config.get('ad_imgbabes')) {
            var imgbabesAd = function() {
                $(':submit').click();
                $('a[target="_blank"],#transparentbg').hide();
                $('img[src$=".jpg"]').each(function() {
                    var newlink = $(this).attr('src');
                    window.location.href = newlink;
                    return false
                })
            };
            imgbabesAd()
        }
    }
})();