Advertisement
Degritone

BBS non-HTML Post Link Fix

Oct 25th, 2021
673
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name             BBS non-HTML Post Link Fix
  3. // @namespace        dollars-bbs.org
  4. // @author           Degritone
  5. // @description      Fixes incorrectly formatted >> links
  6. // @match            *://*.dollars-bbs.org/*
  7. // @grant            none
  8. // ==/UserScript==
  9.  
  10. function work(loaded){
  11.   let replies = document.getElementsByClassName("replytext");
  12.   if(!replies){
  13.     setTimeout(work,100,false);
  14.     return;
  15.   }
  16.   if(!loaded){
  17.     setInterval(work,400,true);
  18.     return;
  19.   }
  20.  
  21.   for(let i=0;i<replies.length;i++){
  22.     let as = replies[i].getElementsByTagName("a");
  23.     for(let j=0;j<as.length;j++){
  24.       if(as[j].href.startsWith("https://dollars-bbs.org") && as[j].href.includes("kareha.pl")){
  25.         as[j].href = as[j].href.replace(/kareha\.pl/,"res");
  26.         as[j].href = as[j].href.replace(/\/(?=[0-9]+$)/,".html#");
  27.       }
  28.     }
  29.   }
  30. }
  31.  
  32. work(false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement