GetSsLink

获取此网页https://doub.io/sszhfx/的SS和SSR链接

当前为 2017-10-08 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         GetSsLink
// @homepage     https://github.com/sumspec/GetSsLink
// @version      1.0
// @date         2017-10-08
// @description  获取此网页https://doub.io/sszhfx/的SS和SSR链接
// @author       sumspec
// @require      https://code.jquery.com/jquery-3.2.1.min.js
// @include      https://doub.io/sszhfx/*
// @include      https://doub.bid/sszhfx/*
// @icon         https://doub.io/wp-content/themes/yusi1.0/img/logo.ico
// @run-at       document-end
// @copyright    2017+,sumspec
// @license      MIT License
// @namespace undefined
// ==/UserScript==

(function() {
    'use strict';

    var ss_code = '', ssr_code = '';
    $('.pull-right:first').before('<button class="get_code action" data-index="ss">SS</button><button class="get_code action" data-index="ssr">SSR</button>');
    $('body').append('<div class="msg_box" style="display:none"></div>');
    $('.msg_box').append('<div class="msg_box_main"></div>');
    $('.msg_box_main').append('<textarea class="msg_box_code"></textarea>');
    $('.msg_box_main').append('<button class="btn_copy action">复制</button>');
    $('.msg_box_main').append('<button class="btn_close action">关闭</button>');
    $('.msg_box').css({'width':'100%','height':'100%','backgroundColor':'rgba(0, 0, 0, 0.5)','position':"fixed",'left':'0','top':'0','z-index':'10000'});
    $('.msg_box_main').css({'width':'800px','height':'500px','backgroundColor':'#EEEEEE','margin':'0 auto','border':'5px solid #1ABC9C'});
    $('.msg_box_code').css({'width':'760px','height':'460px','overflow':'scroll','overflowX':'hidden','resize':'none','padding':'20px','margin':'0','border':'0'});
    $('.btn_copy,.btn_close').css({'position':'relative','left':'-5px','top':'10px'});
    $('.btn_copy').click(function(){
        $('.msg_box_code').select();
        document.execCommand('copy',false,null);
        alert('已复制到剪贴板!');
        $('.msg_box').css({'display':'none'});
    });
    $('.btn_close').click(function(){$('.msg_box').css({'display':'none'});});
    
    $('.dl1').each(function(){
        var ss_match = $(this).attr('href').match(/ss\:\/\/\w+/g);
        var ssr_match = $(this).attr('href').match(/ssr\:\/\/\w+/g);
        if (ss_match!==null) ss_code += ss_match[0] + '\r\n';
        if (ssr_match!==null) ssr_code += ssr_match[0] + '\r\n';
    });

    $(document).on('click', '.get_code', function (e) {
        if($(e.target).attr('data-index') == 'ss'){
            $('.msg_box').css({'display':'block'});
            $('.msg_box_code').text(ss_code);
        }
        if($(e.target).attr('data-index') == 'ssr'){
            $('.msg_box').css({'display':'block'});
            $('.msg_box_code').text(ssr_code);
        }
    });}
)();