To Desuarchive

To desuarchive.org

目前为 2025-03-20 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name To Desuarchive
  3. // @namespace http://github.com/hangjeff
  4. // @version 2025-03-20_14h20m
  5. // @description To desuarchive.org
  6. // @author hangjeff
  7. // @match https://boards.4chan.org/a/*
  8. // @match https://boards.4chan.org/aco/*
  9. // @match https://boards.4chan.org/an/*
  10. // @match https://boards.4chan.org/c/*
  11. // @match https://boards.4chan.org/cgl/*
  12. // @match https://boards.4chan.org/co/*
  13. // @match https://boards.4chan.org/d/*
  14. // @match https://boards.4chan.org/fit/*
  15. // @match https://boards.4chan.org/g/*
  16. // @match https://boards.4chan.org/his/*
  17. // @match https://boards.4chan.org/int/*
  18. // @match https://boards.4chan.org/k/*
  19. // @match https://boards.4chan.org/m/*
  20. // @match https://boards.4chan.org/mlp/*
  21. // @match https://boards.4chan.org/mu/*
  22. // @match https://boards.4chan.org/q/*
  23. // @match https://boards.4chan.org/qa/*
  24. // @match https://boards.4chan.org/r9k/*
  25. // @match https://boards.4chan.org/tg/*
  26. // @match https://boards.4chan.org/trash/*
  27. // @match https://boards.4chan.org/vr/*
  28. // @match https://boards.4chan.org/wsg/*
  29. // @exclude https://boards.4chan.org/search*
  30. // @require https://code.jquery.com/jquery-3.7.1.slim.min.js
  31. // @grant none
  32. // ==/UserScript==
  33.  
  34. (function() {
  35. 'use strict';
  36.  
  37. // Your code here...
  38. $('.thread').each(function(){
  39. let Komica_Thread_Url = window.location.href;
  40. if(!Komica_Thread_Url.includes('thread')){
  41. Komica_Thread_Url = Komica_Thread_Url.substring(0, Komica_Thread_Url.lastIndexOf('/') + 1);
  42. if(!($(this).find('.postContainer').find('.replylink').first().attr('href') === undefined) ){
  43. Komica_Thread_Url = Komica_Thread_Url + $(this).find('.postContainer').find('.replylink').first().attr('href');
  44. //alert(Komica_Thread_Url);
  45. }
  46. else{
  47. // Komica_Thread_Url = Komica_Thread_Url + $(this).find('.threadpost').find('.category a:last').attr('href');
  48. console.log('404 Thread Not Found!');
  49. }
  50. }
  51. // alert( Komica_Thread_Url);
  52. $(this).find('.postInfo').first().after(ArchiveIs_Create(Komica_Thread_Url, 'Desuarchive'));
  53.  
  54. })
  55.  
  56. function ArchiveIs_Create(myUrl, myTarget){
  57. let btn = $('<button>', {
  58. text: 'Redirect to ' + myTarget,
  59. tabindex: '1',
  60. click: function(event){
  61. event.preventDefault();
  62. window.open(myUrl.replace("https://boards.4chan.org/", "https://desuarchive.org/"), '_blank');
  63. return false;
  64. }
  65. }).css({'display': 'inline-block', 'background-color': 'green'});
  66. return btn;
  67. }
  68.  
  69. })();