Remove inaccessible fav

Remove fav directly

  1. // ==UserScript==
  2. // @name Remove inaccessible fav
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @license GPL
  6. // @description Remove fav directly
  7. // @author You
  8. // @match https://www.nodeseek.com/space/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=nodeseek.com
  10. // @run-at context-menu
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function prompt_removal(link, e) {
  17. if(!confirm('Do you want to remove this link?')) {
  18. // Continue visiting the link (but for what?)
  19. return;
  20. }
  21.  
  22. //// remove the link {{
  23.  
  24. // Sample: "https://www.nodeseek.com/post-16300-1";
  25. const match = link.href.match(/post-(\d+)-1/);
  26. const post_id = parseInt( match[1] );
  27. console.log(post_id); // eg. 16300
  28.  
  29. fetch("https://www.nodeseek.com/api/statistics/collection", {
  30. method: "POST",
  31. headers:{"Content-Type": "application/json"},
  32. body: JSON.stringify({
  33. postId: post_id,
  34. action: "remove"
  35. })
  36. }).then(response => response.json())
  37. .then(data => console.log(data))
  38. .catch(error => console.error(error))
  39.  
  40. // }}
  41.  
  42. e.preventDefault();
  43. }
  44.  
  45. var links = document.querySelectorAll('.discussion-item');
  46. links.forEach( link => {
  47. link.addEventListener('click', (e) => prompt_removal(link, e));
  48. });
  49.  
  50. alert('Clicking on links now offers options to remove them.');
  51.  
  52. })();

QingJ © 2025

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