Greasy Fork is available in English.

WebAdRule Extra Script

This script is an extension of the Web Ad Rule to fix something that easylist can't handle

  1. // ==UserScript==
  2. // @name WebAdRule Extra Script
  3. // @version 1.1.0
  4. // @namespace http://tampermonkey.net/
  5. // @match *://*.51cto.com/*
  6. // @match *://*.segmentfault.com/*
  7. // @match *://juejin.cn/*
  8. // @grant GM_addStyle
  9. // @run-at document-start
  10. // @require https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js
  11. // @author xndeye
  12. // @description This script is an extension of the Web Ad Rule to fix something that easylist can't handle
  13. // @license MIT
  14. // ==/UserScript==
  15. (function () {
  16. 'use strict';
  17. })();
  18.  
  19.  
  20. let domain = null;
  21. function getdomain() {
  22. if (!domain) {
  23. domain = document.location.hostname.split('.').slice(-2).join('.')
  24. console.log('<WebAdRule Extra Script> : ' + domain)
  25. }
  26. return domain ? domain : ''
  27. }
  28.  
  29. /**
  30. * Inject on document-start
  31. */
  32. switch (getdomain()) {
  33. default:
  34. break;
  35. }
  36.  
  37. /**
  38. * Execute after page load
  39. */
  40. window.onload = function () {
  41. switch (getdomain()) {
  42. case '51cto.com':
  43. setTimeout(function () {
  44. $(".copy_btn").each(function () {
  45. $(this).text('复制');
  46. this.setAttribute('class', 'copy-r');
  47. this.onclick = function () {
  48. var item = $(this.getAttribute('data-clipboard-target'));
  49. if (item[0].tagName === 'CODE') {
  50. navigator.clipboard.writeText(item.text())
  51. } else {
  52. navigator.clipboard.writeText(item.siblings().text());
  53. }
  54. }
  55. });
  56. }, 1000);
  57. break;
  58.  
  59. case 'juejin.cn':
  60. document.oncopy = event => event.clipboardData.setData('text', window.getSelection(0).toString());
  61. $('a[href]').each(function () {
  62. console.log($(this).html());
  63. let link = $(this).attr('href').replace('https://link.juejin.cn?target=', '');
  64. if (typeof link !== 'undefined') {
  65. $(this).attr('href', decodeURIComponent(link));
  66. }
  67. })
  68. break;
  69.  
  70. case 'segmentfault.com':
  71. $('.article a[href]').each(function () {
  72. if ($(this).attr('href').startsWith('https://link.segmentfault.com')) {
  73. $(this).attr('href', $(this).text());
  74. }
  75. })
  76. break;
  77.  
  78. default:
  79. break;
  80. }
  81. }