Advertisement
Guest User

BL Post ID script

a guest
Oct 14th, 2018
1,062
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         BL Post Exposer
  3. // @namespace    forums.nrvnqsr.com/
  4. // @version      0.2
  5. // @description  Make post numbers visible without having to do extra clicking
  6. // @author       NMR-3
  7. // @match        forums.nrvnqsr.com/*
  8. // @grant        none
  9. // @require      https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
  10. // ==/UserScript==
  11.  
  12. window.onload = function(){
  13.     var userinfolist = document.getElementsByClassName('userinfo');
  14.     for(var i = 0; i < userinfolist.length; i++){
  15.         addPostIDForEach(userinfolist[i]);
  16.     }
  17. };
  18.  
  19. function addPostIDForEach(item){
  20.     var postid = item.parentElement.parentElement.id;
  21.     postid = postid.slice(5);
  22.  
  23.     var dt = document.createElement("dt");
  24.     dt.innerHTML = "Post ID";
  25.     var dd = document.createElement("dd");
  26.     dd.innerHTML = postid;
  27.  
  28.     var sub = item.getElementsByTagName("dl")[0];
  29.     if(sub != null && sub != undefined){
  30.         sub.appendChild(dt);
  31.         sub.appendChild(dd);
  32.     }
  33.     else {
  34.         item.appendChild(dd);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement