InfoInSidebar

Add sidebar with torrent info from top info box

As of 2014-12-29. See the latest version.

  1. // ==UserScript==
  2. // @name InfoInSidebar
  3. // @description Add sidebar with torrent info from top info box
  4. // @version 1.0
  5. // @author Monkeys
  6. // @namespace empornium.me
  7. // @include *torrents.empornium.me/torrents.php?id=*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11.  
  12. (function(){
  13.  
  14. var cells = document.getElementById("top_info").querySelectorAll('td');
  15. var className = "sideInfo"; //the orginal empornium class to make it match the page elements
  16. var styleInfo = "position: fixed; bottom: 1em; right: 1em;"; //additional style to put it in the correct position
  17. var outputInfo; //html as a string to be put in the div for the sidebar
  18. var outputDiv = document.createElement('div');
  19. outputDiv.setAttribute('style', styleInfo);
  20. outputDiv.className='top_info';
  21.  
  22. outputInfo = "<table>";
  23.  
  24. for (var ii = 0; ii < cells.length; ii++)
  25. {//go through each of the cell in the top info table and build the side bar table from them
  26. var thisCell = cells[ii].innerHTML;
  27. thisCell = thisCell.replace('<span class="time"', '</td></tr><tr><td><span class="time"')
  28. outputInfo += "<tr><td>"+thisCell+"</td></tr>";
  29. }
  30.  
  31. outputInfo += "</table>";
  32. outputDiv.innerHTML = outputInfo;
  33. document.body.appendChild(outputDiv); //doesn't really matter where we put the new element since it has absolute positioning
  34.  
  35. })();