Veinticuatrofps Enhancer

Display changes for Veinticuatrofps

  1. // ==UserScript==
  2. // @name Veinticuatrofps Enhancer
  3. // @namespace surrealmoviez.info
  4. // @description Display changes for Veinticuatrofps
  5. // @include http://www.veinticuatrofps.com/tracker/*
  6. // @include http://veinticuatrofps.com/tracker/*
  7. // @grant none
  8. // @version 0.0.2
  9. // ==/UserScript==
  10.  
  11. // Link the site banner to the index page
  12. $('img:eq(0)').wrap('<a href="index.php"></a>');
  13.  
  14. // Insert the new search bars
  15. var searchBars = '<td align="left" class="bottom">'
  16. + '<form action="browse.php" method="get" style="display: inline;">'
  17. + '<input type="text" name="search" placeholder="Torrents" style="border: 1px solid grey; border-radius: 2px; background: #DFEFEF; width: 120px; margin-right: 4px;">'
  18. + '<input type="hidden" name="cat" value="0">'
  19. + '</form>'
  20. + '<form action="forums.php" method="get" style="display: inline;">'
  21. + '<input type="text" name="keywords" placeholder="Foros" style="border: 1px solid grey; border-radius: 2px; background: #DFEFEF; width: 120px;">'
  22. + '<input type="hidden" name="action" value="search">'
  23. + '</form>'
  24. + '</td>';
  25.  
  26. $(searchBars).insertAfter('body > table:eq(1) td:eq(1)');
  27.  
  28. // Check if a torrent details page is open
  29. if (document.documentURI.indexOf("/details.php?id=") !== -1 || document.documentURI.indexOf("/offdetails.php?id=") !== -1) {
  30. // Browse magnified snapshots with arrow keys
  31. var thumbnails = $('img.thumbnail');
  32. $(document).keydown(function (e) {
  33. var bodyEls = $('body').children();
  34. if ($(bodyEls.get(bodyEls.length - 1)).is('img')) {
  35. var macroImage = $(bodyEls.get(bodyEls.length - 1));
  36. var currentSrc = macroImage.attr('src');
  37. var currentIndex = thumbnails.index($('.thumbnail[src=' + currentSrc + ']'));
  38. if (e.keyCode === 37 /* left */ && currentIndex > 0) {
  39. macroImage.attr('src', thumbnails.eq(currentIndex - 1).attr('src'));
  40. return false;
  41. } else if (e.keyCode === 39 /* right */ && currentIndex < (thumbnails.length - 1)) {
  42. macroImage.attr('src', thumbnails.eq(currentIndex + 1).attr('src'));
  43. return false;
  44. }
  45. }
  46.  
  47. });
  48. }