Advertisement
Aister

Enter to comment / chat for MooSocial

May 25th, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.     function kd(e, obj) {
  3.         if (typeof window.orientation === 'undefined') {
  4.             var evtobj = window.event? event : e
  5.             if (evtobj.keyCode == 13) {
  6.                 var w = document.getElementsByClassName('textcomplete-dropdown'),
  7.                 b = w.length,
  8.                 g = false;
  9.                 for (var x = 0; x < b; x++) {
  10.                     if (w[x].style.display == "block") { g = true; }
  11.                 }
  12.                 if (!evtobj.shiftKey && !g) {
  13.                     e.preventDefault();
  14.                     if (obj.id == 'postComment') a = document.getElementById('commentButton_0').childNodes;
  15.                     else a = document.getElementById('commentButton_' + obj.id.slice(12)).childNodes;
  16.                     for (i = 0; i < a.length; i++) {
  17.                         if (a[i].tagName == 'A') {
  18.                             a[i].click();
  19.                         } else console.log(a[i].tagName);
  20.                     }
  21.                 }
  22.             }
  23.         } else { console.log(window.orientation); }
  24.     }
  25. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement