Advertisement
SerlitePD

PD4 Chat Menu Customizer

Dec 3rd, 2016
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. //  PD4 Chat Menu Customizer
  3. //  Created by Serlite
  4. //
  5. //  - Hides chat menu options via CSS so unused items won't be accidentally clicked
  6. //  - To hide an item, add the item number to the array "chatItemsToHide". Items are as follows:
  7. //  1: (Unrelated)
  8. //  2: Message
  9. //  3: Tip
  10. //  4: Add to my friends
  11. //  5: View stats
  12. //  6: Ignore
  13. //  7: Mute (mods only)
  14. */
  15.  
  16. loadjQuery();
  17. initializeAugs();
  18.  
  19. var chatItemsToHide = [4, 6];
  20.  
  21. // Adds jQuery to document if needed
  22. function loadjQuery(){
  23.     if (!window.jQuery){
  24.         var script = document.createElement("SCRIPT");
  25.         script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js';
  26.         script.type = 'text/javascript';
  27.         document.getElementsByTagName("head")[0].appendChild(script);
  28.     }
  29. }
  30.  
  31. function initializeAugs(){
  32.   // Give time for jQuery to load
  33.     if (!window.jQuery){
  34.         setTimeout(initializeAugs, 500);
  35.     }
  36.   else{
  37.     if (chatItemsToHide.length > 0){
  38.       var selectorList = "";
  39.       for (var i = 0; i < chatItemsToHide.length; i++){
  40.         if (i > 0){
  41.           selectorList += ",";
  42.         }
  43.         selectorList += "ul.chat__channel__message__tool-tip li:nth-child(" + chatItemsToHide[i] + ")";
  44.       }
  45.  
  46.       jQuery("head").append(
  47.         '<style>'+
  48.         '   ' + selectorList + '{'+
  49.         '       display:none;'+
  50.         '   }'+
  51.         '</style>'
  52.       );
  53.     }
  54.   }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement