Plurk no redirector

try to take over the world!

  1. // ==UserScript==
  2. // @name Plurk no redirector
  3. // @namespace http://mmis1000.me/
  4. // @version 0.1.10
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://www.plurk.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. /* global jQuery, getBody, Media */
  12. jQuery(function() {
  13. // window.Media = null;
  14.  
  15. function shouldBeExclude(el) {
  16. function checkStop(el) {
  17. return jQuery(el).is('a.ex_link') &&
  18. !jQuery(el).is('.pictureservices') &&
  19. !jQuery(el).is('.iframeembed') &&
  20. !jQuery(el).is('.plink') &&
  21. !(/^https?:\/\/[^\.]+\.plurk\.com\//).test(el.attr('href') + '');
  22. }
  23.  
  24. let currentEl = jQuery(el);
  25. let shouldStop = checkStop(currentEl)
  26.  
  27. while (currentEl.get(0) && !shouldStop) {
  28. currentEl = currentEl.parent();
  29. shouldStop = shouldStop || checkStop(currentEl);
  30. }
  31.  
  32. console.log('check', shouldStop, shouldStop ? currentEl : el);
  33.  
  34. if (shouldStop) {
  35. currentEl.attr('rel', 'noreferrer noopener')
  36. }
  37.  
  38. return shouldStop;
  39. }
  40.  
  41. var $body = jQuery('#layout_body');
  42. $body.on('click', '#layout_content a.ex_link', function(el){el.target && el.target.setAttribute('rel', 'noreferrer noopener')})
  43.  
  44. jQuery._data(jQuery('#layout_body').get(0), 'events').click
  45. .map((o)=>[o.handler.toString(), o])
  46. // .filter((arr)=>(/hasClass\("ex_link"\)/).test(arr[0]) || (/_hideLink/).test(arr[0]))
  47. .forEach(function ([code, layoutBodyClickData]) {
  48. jQuery('#layout_body').off('click', layoutBodyClickData.handler);
  49. const handler = function (ev) {
  50. if (shouldBeExclude(ev.target)) {
  51. console.log('stop go plurk')
  52. return;
  53. } else {
  54. return layoutBodyClickData.handler.call(this, ev);
  55. }
  56. }
  57.  
  58. if (layoutBodyClickData.selector) {
  59. jQuery('#layout_body').on('click', layoutBodyClickData.selector, handler)
  60. } else {
  61. jQuery('#layout_body').on('click', handler)
  62. }
  63. })
  64.  
  65. try {
  66. const verticalTimelineClickData = jQuery._data(jQuery('#vert_timeline').get(0), 'events').click
  67. .map((o)=>[o.handler.toString(), o])
  68. .filter((arr)=>(/window\.open\(this\.href\)/).test(arr[0]))[0][1]
  69.  
  70. jQuery('#vert_timeline').off('click', verticalTimelineClickData.handler)
  71.  
  72. jQuery._data(jQuery('#vert_timeline').get(0), 'events').click
  73. .map((o)=>[o.handler.toString(), o])
  74. // .filter((arr)=>(/_hideLink/).test(arr[0]))
  75. .forEach(function ([code, layoutBodyClickData]) {
  76. jQuery('#vert_timeline').off('click', layoutBodyClickData.handler);
  77. const handler = function (ev) {
  78. if (shouldBeExclude(ev.target)) {
  79. console.log('stop go plurk', ev.target)
  80. return;
  81. } else {
  82. return layoutBodyClickData.handler.call(this, ev);
  83. }
  84. }
  85.  
  86. if (layoutBodyClickData.selector) {
  87. jQuery('#vert_timeline').on('click', layoutBodyClickData.selector, handler)
  88. } else {
  89. jQuery('#vert_timeline').on('click', handler)
  90. }
  91. })
  92. } catch (e) {
  93. // '#vert_timeline' does not exist
  94. }
  95. console.log('loaded')
  96. });

QingJ © 2025

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