BTN - collapse show info

shrink/expand the show info box

  1. // ==UserScript==
  2. // @name BTN - collapse show info
  3. // @description shrink/expand the show info box
  4. // @namespace diff
  5. // @match https://broadcasthe.net/torrents.php
  6. // @grant none
  7. // @version 0.4.1
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. document.head.insertAdjacentHTML('beforeEnd',
  12. `<style type='text/css'>
  13. .diffshrink{ overflow:auto; height:10em; cursor: pointer;}
  14. .diffpointer { cursor: pointer; }
  15. </style>`);
  16.  
  17. const target = document.querySelector('.main_column .head');
  18. if (!target) return;
  19.  
  20. target.innerHTML += ' [shrink/expand]';
  21. target.classList.add('diffpointer');
  22. target.parentNode.classList.add('diffshrink');
  23. target.addEventListener('click', function() {
  24. this.parentNode.classList.toggle('diffshrink');
  25. });
  26. target.parentNode.querySelector('div.body').addEventListener('click', function() {
  27. this.parentNode.classList.remove('diffshrink');
  28. });
  29.  
  30. })();