To 4plebs

To archive.4plebs.org

Verzia zo dňa 20.03.2025. Pozri najnovšiu verziu.

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