GetSsLink

获取逗比根据地分享的SS免费账号链接码

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

  1. // ==UserScript==
  2. // @name GetSsLink
  3. // @namespace https://greasyfork.org/zh-CN/scripts/33887-getsslink
  4. // @homepage https://github.com/sumspec/UserScripts/tree/master/GetSsLink
  5. // @version 1.0
  6. // @date 2017-10-08
  7. // @description 获取逗比根据地分享的SS免费账号链接码
  8. // @author sumspec
  9. // @require https://code.jquery.com/jquery-3.2.1.min.js
  10. // @include https://doub.io/sszhfx/*
  11. // @include https://doub.bid/sszhfx/*
  12. // @icon https://doub.io/wp-content/themes/yusi1.0/img/logo.ico
  13. // @run-at document-end
  14. // @copyright 2017+,sumspec
  15. // @license MIT License
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20. //标签部分
  21. $('.pull-right:first').before('<button class="get_code action" data-index="ss">SS</button><button class="get_code action" data-index="ssr">SSR</button>');
  22. $('body').append('<div class="msg_box" style="display:none"></div>');
  23. $('.msg_box').append('<div class="msg_box_main"></div>');
  24. $('.msg_box_main').append('<textarea class="msg_box_code"></textarea>');
  25. $('.msg_box_main').append('<button class="btn_copy action">复制</button>');
  26. $('.msg_box_main').append('<button class="btn_close action">关闭</button>');
  27. $('.msg_box').css({'width':'100%','height':'100%','backgroundColor':'rgba(0, 0, 0, 0.5)','position':"fixed",'left':'0','top':'0','z-index':'10000'});
  28. $('.msg_box_main').css({'width':'800px','height':'500px','backgroundColor':'#EEEEEE','margin':'0 auto','border':'5px solid #1ABC9C'});
  29. $('.msg_box_code').css({'width':'760px','height':'460px','overflow':'scroll','overflowX':'hidden','resize':'none','padding':'20px','margin':'0','border':'0'});
  30. $('.btn_copy,.btn_close').css({'position':'relative','left':'-5px','top':'10px'});
  31. //复制和关闭
  32. $('.btn_copy').click(function(){
  33. $('.msg_box_code').select();
  34. document.execCommand('copy',false,null);
  35. alert('已复制到剪贴板!');
  36. $('.msg_box').css({'display':'none'});
  37. });
  38. $('.btn_close').click(function(){$('.msg_box').css({'display':'none'});});
  39. //获取链接码
  40. var ss_code = '', ssr_code = '';
  41. $('.dl1').each(function(){
  42. var ss_match = $(this).attr('href').match(/ss\:\/\/\w+/g);
  43. var ssr_match = $(this).attr('href').match(/ssr\:\/\/\w+/g);
  44. if (ss_match!==null) ss_code += ss_match[0] + '\r\n';
  45. if (ssr_match!==null) ssr_code += ssr_match[0] + '\r\n';
  46. });
  47. //点击判断
  48. $(document).on('click', '.get_code', function (e) {
  49. if($(e.target).attr('data-index') == 'ss'){
  50. $('.msg_box').css({'display':'block'});
  51. $('.msg_box_code').text(ss_code);
  52. }
  53. if($(e.target).attr('data-index') == 'ssr'){
  54. $('.msg_box').css({'display':'block'});
  55. $('.msg_box_code').text(ssr_code);
  56. }
  57. });}
  58. )();