twitter-block-premium

block twitter premium promotion

  1. // ==UserScript==
  2. // @name twitter-block-premium
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.9
  5. // @description block twitter premium promotion
  6. // @author @amormaid
  7. // @match https://twitter.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=arxiv.org
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. const body = document.querySelector("body");
  16. let time_stamp = 0
  17. body.addEventListener('touchstart', () => {
  18. console.log(time_stamp)
  19. if (new Date() - time_stamp < 1000 && window.location.href.includes('verified-get-verified')) {
  20. window.location.href = 'https://twitter.com'
  21. }
  22. time_stamp = new Date() - 0;
  23. })
  24. // window.addEventListener('popstate', () => console.log(1));
  25. // window.addEventListener('pushState', () => console.log(2));
  26. // window.addEventListener('replaceState', () => console.log(3));
  27. // navigation.addEventListener('navigate', () => {
  28. // console.log('page changed');
  29. // if (window.location.href.includes('verified-get-verified')) {
  30. // const body = document.querySelector("body");
  31.  
  32. // const interval_id = setInterval(() => {
  33. // const query_list = Array.from(document.getElementsByTagName('SPAN')).filter(i => i.innerHTML.includes('Maybe later'))
  34. // console.log('get span ', query_list.length)
  35. // if (query_list.length) {
  36. // query_list[0].click()
  37. // }
  38. // }, 5)
  39. // setTimeout(() => clearInterval(interval_id), 5 * 1000)
  40.  
  41.  
  42. // const observer = new MutationObserver(mutations => {
  43. // const query_list = Array.from(document.getElementsByTagName('SPAN')).filter(i => i.innerHTML.includes('Maybe later'))
  44. // console.log('get span ', query_list.length)
  45. // if (query_list.length) {
  46. // query_list[0].click()
  47. // observer.disconnect()
  48. // }
  49. // });
  50. // observer.observe(body, { childList: true, subtree: true });
  51. // }
  52. // });
  53.  
  54. })();