To Archive Of Sins

To archiveofsins.com

当前为 2025-03-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name To Archive Of Sins
  3. // @namespace http://github.com/hangjeff
  4. // @version 2025-03-19_14h23m
  5. // @description To archiveofsins.com
  6. // @author hangjeff
  7. // @match https://boards.4chan.org/h/*
  8. // @match https://boards.4chan.org/hc/*
  9. // @match https://boards.4chan.org/hm/*
  10. // @match https://boards.4chan.org/i/*
  11. // @match https://boards.4chan.org/lgbt/*
  12. // @match https://boards.4chan.org/r/*
  13. // @match https://boards.4chan.org/s/*
  14. // @match https://boards.4chan.org/soc/*
  15. // @match https://boards.4chan.org/t/*
  16. // @match https://boards.4chan.org/u/*
  17. // @exclude https://boards.4chan.org/search*
  18. // @require https://code.jquery.com/jquery-3.7.1.slim.min.js
  19. // @grant none
  20. // ==/UserScript==
  21.  
  22. (function() {
  23. 'use strict';
  24.  
  25. // Your code here...
  26. $('.thread').each(function(){
  27. let Komica_Thread_Url = window.location.href;
  28. if(!Komica_Thread_Url.includes('thread')){
  29. Komica_Thread_Url = Komica_Thread_Url.substring(0, Komica_Thread_Url.lastIndexOf('/') + 1);
  30. if(!($(this).find('.postContainer').find('.replylink').first().attr('href') === undefined) ){
  31. Komica_Thread_Url = Komica_Thread_Url + $(this).find('.postContainer').find('.replylink').first().attr('href');
  32. //alert(Komica_Thread_Url);
  33. }
  34. else{
  35. // Komica_Thread_Url = Komica_Thread_Url + $(this).find('.threadpost').find('.category a:last').attr('href');
  36. console.log('404 Thread Not Found!');
  37. }
  38. }
  39. // alert( Komica_Thread_Url);
  40. $(this).find('.postInfo').first().after(ArchiveIs_Create(Komica_Thread_Url, 'Archive Of Sins'));
  41.  
  42. })
  43.  
  44. function ArchiveIs_Create(myUrl, myTarget){
  45. let btn = $('<button>', {
  46. text: 'Redirect to ' + myTarget,
  47. tabindex: '1',
  48. click: function(event){
  49. event.preventDefault();
  50. window.open(myUrl.replace("https://boards.4chan.org/", "https://archiveofsins.com/"), '_blank');
  51. return false;
  52. }
  53. }).css({'display': 'inline-block', 'background-color': 'green'});
  54. return btn;
  55. }
  56.  
  57. })();