Podnapisi.net Download Buttons

Adds download buttons to subtitles list (in search).

  1. // ==UserScript==
  2. // @name Podnapisi.net Download Buttons
  3. // @author NuJumala <nujumala@gmail.com>
  4. // @namespace www.podnapisi.net
  5. // @grant none
  6. // @include http://*.podnapisi.net/*/search*
  7. // @description Adds download buttons to subtitles list (in search).
  8. // @version 1.7.0
  9. // ==/UserScript==
  10.  
  11. $ = unsafeWindow.jQuery;
  12. if ($ == null) {
  13. return;
  14. }
  15. $('#ppodnapisiFps').parent().before('<th class="posts">DL</th>');
  16. $('.list_div2 a').each(function(index, element) {
  17. href = $(element).attr('href');
  18. matches = href.match(/.*-p(.*)/);
  19. if(matches) {
  20. id = 'dl-'+matches[1];
  21. button = '<td id="'+id+'" align="center"><a rel="'+href+'"><img vspace="5" hspace="5" alt="Podnapisi" src="http://static2.podnapisi.net/images/nextgen/podnapisi/download.gif" class = "slikevvrsti"></a></td>';
  22. $(element).parents().eq(1).children().eq(0).hide();
  23. $(element).parents().eq(2).children().eq(0).after(button);
  24. $('#'+id).click(function() {
  25. $.ajax({
  26. url: $('a', this).attr('rel'),
  27. beforeSend: function(xhr) { xhr.setRequestHeader('X-Requested-With', {toString: function(){ return ''; }}); },
  28. dataFilter: function(data) { return data; }
  29. }).done(function(data) {
  30. $.ajax({
  31. url: $('.#subtitle .footer a', data).attr('href'),
  32. beforeSend: function(xhr) { xhr.setRequestHeader('X-Requested-With', {toString: function(){ return ''; }}); },
  33. dataFilter: function(data) { return data; }
  34. }).done(function(data) {
  35. matches = data.match(/(\/hr\/ppodnapisi\/download.*?)'/m);
  36. window.location.href = matches[1];
  37. });
  38. });
  39. });
  40. }
  41. });
  42.  
  43. // EOF