Advertisement
Guest User

URM Faction Hosp Filter

a guest
Feb 18th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name Faction Hospital - Edited (Also hides offliners)
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.4.1
  5. // @description Shows only faction members that are in the hospital and online, and hides the rest.
  6. // @author muffenman and help from Pi77Bull
  7. // @match https://www.torn.com/factions.php?step=profile&ID=*
  8. // @grant none
  9. // @run-at document-end
  10. // ==/UserScript==
  11.  
  12. // What does this script do?
  13. // It hides all members on faction pages that are not in the hospital and displays the hospital time for those who are.
  14.  
  15. $( ".faction-description" ).css("display", "none", "traveling"); //hides faction description
  16. $( "#war-react-root" ).css("display", "none"); //hides faction war list
  17.  
  18. $('.member-list #icon2').parents("li").hide(); //hides offliners
  19. $('.member-list #icon62').parents("li").hide(); //hides idles
  20. $('.member-list > li:not(:contains("Hospital"))').css("display", "none"); //hides every member that is not in hospital
  21. $('.member-list > li:contains("Hospital")').each((i, j) => { //loops through every member that is in hospital
  22.     $(j).find(".days").text($(j).find("#icon15").attr("title").substr(-16, 8)); //displays time that is found in the hospital icon
  23.  
  24.     var hours = Number($(j).find("#icon15").attr("title").substr(-16, 2)); //> Substr out the hours and convert to Int.
  25.     if (hours <= 1) {
  26.         $(j).css("display", "none"); //> Don't display users with less than an hour in the hospital.
  27.     }
  28.  
  29.     $(".title .days").text("Time"); //changes Days column title to "Time"
  30. });
  31. //console.log("Made by muffenman [2002712] and Pi77Bull [2082618] . If you like it, send us a message or a gift either is fine :P \"I love your script!\".");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement