网页便利店

一些网页上的简单处理,使其更适合浏览

  1. // ==UserScript==
  2. // @name 网页便利店
  3. // @namespace https://github.com/maxsky/WebPage-CVS
  4. // @version 0.4.10
  5. // @description 一些网页上的简单处理,使其更适合浏览
  6. // @author Max Sky
  7. // @match *://*.blog.csdn.net/article/details/*
  8. // @match *://blog.csdn.net/*/article/details/*
  9. // @match *://link.csdn.net/*
  10. // @match *://www.baidu.com/s*
  11. // @match *://weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi?*
  12. // @match *://c.pc.qq.com/*
  13. // @match *://link.juejin.cn/?target*
  14. // @match *://mac-torrent-download.net/pw*
  15. // @match https://www.google.com
  16. // @license MIT
  17. // @grant none
  18. // ==/UserScript==
  19.  
  20. (function () {
  21. 'use strict';
  22.  
  23. function getCookie(name) {
  24. name = name + '=';
  25.  
  26. let ca = document.cookie.split(';');
  27.  
  28. for (let i = 0; i < ca.length; i++) {
  29. let c = ca[i].trim();
  30. if (c.indexOf(name) === 0) {
  31. return c.substring(name.length, c.length);
  32. }
  33. }
  34.  
  35. return '';
  36. }
  37.  
  38. let domain = document.location.origin;
  39.  
  40. if (domain.indexOf('google.com') > -1) {
  41. let e = document.getElementsByClassName('gb_d');
  42.  
  43. for (let i in e) {
  44. let item = e[i];
  45.  
  46. if (item.getAttribute('data-pid') === '2') {
  47. item.href = item.href.replace(/https:\/\/.*?\//, 'https://' + document.domain + '/');
  48. }
  49. }
  50. }
  51.  
  52. if (domain.indexOf('baidu.com') > -1) {
  53. $('#wrapper_wrapper').bind('DOMSubtreeModified', function () {
  54. let rightContent = $(this).find('#content_right');
  55.  
  56. if (rightContent) {
  57. rightContent.hide();
  58. }
  59. });
  60. } else if (domain.indexOf('csdn.net') > -1) {
  61. if (domain.indexOf('link.csdn.net') > -1) {
  62. const gitCodeUrl = document.querySelector('a.loading-btn');
  63.  
  64. if (gitCodeUrl) {
  65. location.href = gitCodeUrl.href;
  66. } else {
  67. location.href = new URLSearchParams(document.location.search).get('target');
  68. }
  69. return;
  70. }
  71.  
  72. if (!getCookie('unlogin_scroll_step')) {
  73. $('head').append('<style>.login-mark{display:none!important;}#passportbox{display:none!important;}</style>');
  74. }
  75.  
  76. // 移除阅读更多按钮
  77. $('#content_views .hide-preCode-box').remove();
  78.  
  79. // 移除限高
  80. let codeViews = $('#content_views .set-code-hide');
  81.  
  82. codeViews.removeClass('set-code-hide');
  83. codeViews.addClass('set-code-show');
  84.  
  85. // 监听剪切板
  86. $(document.body).bind('copy', function (e) {
  87. var clipboard = window.clipboardData; // IE
  88.  
  89. if (clipboard === undefined) {
  90. clipboard = e.originalEvent.clipboardData;
  91. }
  92.  
  93. let clipboardStr = clipboard.getData('text');
  94.  
  95. if (clipboardStr !== '' && clipboardStr.indexOf('版权声明:本文为博主原创文章') !== -1) {
  96. const regex = /(\n—[^]+)/mg;
  97.  
  98. clipboardStr = clipboardStr.replace(regex, '');
  99.  
  100. if (clipboardStr !== '') {
  101. clipboard.setData('text', clipboardStr);
  102. }
  103. }
  104. });
  105. } else if (domain.indexOf('weixin110.qq.com') > -1) {
  106. const wxpatt = new RegExp(/(?<=cgiData = ).*(?=;)/g);
  107. let data = wxpatt.exec(document.body.getElementsByTagName('script')[0].text);
  108.  
  109. data = JSON.parse(data);
  110.  
  111. if (data.url) {
  112. let url = data.url.replace(/&#x2f;/g, '/');
  113.  
  114. location.href = url.replace(/amp;/g, '&');
  115. }
  116. } else if (domain.indexOf('c.pc.qq.com') > -1) {
  117. const qqpatt = new RegExp(/(?<=">).*/g);
  118.  
  119. let eleUrl = $('#url');
  120.  
  121. if (eleUrl) {
  122. location.href = qqpatt.exec($('#url').html());
  123. } else {
  124. const objUrl = new URL(location.href);
  125.  
  126. location.href = objUrl.searchParams.get('url');
  127. }
  128. } else if (domain.indexOf('link.juejin.cn') > -1) {
  129. const juejinUrl = new URL(location.href);
  130.  
  131. const target = juejinUrl.searchParams.get('target');
  132.  
  133. if (target) {
  134. location.href = target;
  135. }
  136. } else if (domain.indexOf('mac-torrent-download.net') > -1) {
  137. if (location.pathname === '/pw.php') {
  138. const mtpwpatt = new RegExp(/(?<=atob\(').*?(?='\);)/mg);
  139. const realUrl = mtpwpatt.exec($('#entry-content').html());
  140.  
  141. location.href = atob(realUrl);
  142. } else {
  143. const patt = new RegExp(/(?<=_0x54f9=\[).*?(?=];)/mg);
  144. let arrayStr = patt.exec($('#content').prev().html()) + '';
  145.  
  146. arrayStr = arrayStr.replace(/\\x/g, '%');
  147. arrayStr = arrayStr.replace(/'/g, '"');
  148.  
  149. let array = $.parseJSON('[' + arrayStr + ']');
  150.  
  151. if (typeof (array) === 'object') {
  152. let pwd = array[array.length - 1];
  153.  
  154. pwd = atob(pwd);
  155.  
  156. let container = $('#password-container');
  157.  
  158. container.on('DOMNodeInserted', function () {
  159. $(this).css({
  160. 'background-color': '#7bc74d',
  161. 'color': 'white',
  162. 'cursor': 'pointer'
  163. });
  164.  
  165. let passwd = $('#passwd');
  166.  
  167. passwd.css('cursor', 'pointer');
  168. passwd.val(pwd);
  169. });
  170.  
  171. container.click(function () {
  172. var clipboard = window.clipboardData; // IE
  173.  
  174. if (clipboard === undefined) {
  175. const el = document.createElement('textarea');
  176. el.value = pwd;
  177. document.body.append(el);
  178.  
  179. el.select();
  180. document.execCommand('copy');
  181. } else {
  182. clipboard.setData(pwd);
  183. }
  184.  
  185. alert('Copied!');
  186. });
  187. }
  188. }
  189. }
  190. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址