SerlitePD

PD5.1 Chat Tools

Aug 20th, 2018
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. /*
  2. // PD5.1 Chat Tools
  3. // Created by Serlite
  4. //
  5. // - Enables using Tab to perform autocomplete when referencing users in chat
  6. //
  7. // NOTE: Only compatible with modern browsers, as no backwards compatibility is implemented.
  8. */
  9.  
  10. window.onload = function(){
  11. // Enables using Tab to perform autocomplete when referencing users in chat
  12. var chatInput = document.querySelector('[class^="styles__Textarea"]');
  13. chatInput.onkeydown = function(e){
  14. if (e.key == "Tab"){
  15. e.preventDefault();
  16. var availableNames = document.querySelectorAll('#app > [class^="styles__Wrap"] > [class^="styles__Content"] > [class^="styles__Wrap"] > [class^="styles__Wrap"] > div[class^="styles__Wrap"] > button')
  17. if (availableNames.length > 0){
  18. availableNames[0].click();
  19. }
  20. }
  21. }
  22. };
Advertisement
Add Comment
Please, Sign In to add comment