Advertisement
Guest User

MAD MEN: IT'S RIGHT THIS TIME!

a guest
Dec 11th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. // ==UserScript==
  2. // @name TVGuideRig_MadMen_Overall
  3. // @namespace tvrig
  4. // @include http://www.tv.com/lists/SpecialFeatures:list:best-overall-series/widget/poll/*
  5. // @version 2.3
  6. // ==/UserScript==
  7.  
  8. //default speed is 1 second between votes
  9. var speed=1000;
  10.  
  11. if( window.location.search.indexOf('speed=') == -1 ) {
  12. speed = parseInt(prompt('Confirm this dialog to start script\n\nHow fast should this autism fest run at?\n(Lower is faster)', speed));
  13. window.location.href = window.location.href + (window.location.href.indexOf('?')==-1 ? '?' : '&') + 'speed=' + speed;
  14. } else {
  15. function getQueryVariable(variable)
  16. {
  17. var query = window.location.search.substring(1), vars = query.split('&');
  18. for (var i=0;i<vars.length;i++) {
  19. var pair = vars[i].split('=');
  20. if (pair[0] == variable) {
  21. return pair[1];
  22. }
  23. }
  24. }
  25. function spamVotes()
  26. {
  27. if(attempts == 20)
  28. window.location.reload();
  29. if(idleNum && idleNum<idleTotal)
  30. {
  31. idleNum++;
  32. return;
  33. }else
  34. idleNum=0;
  35. var x = new XMLHttpRequest(),
  36. msg = {'vote_rate_limit': '3',
  37. 'list_id': 'SpecialFeatures:list:best-overall-series',
  38. 'id': 's:2471',
  39. 'a': 'a',
  40. 'v': '+1'},
  41. string = 'inp=' + encodeURIComponent(JSON.stringify(msg)) + '&csrfmiddlewaretoken=' + (document.cookie.match(/csrftoken=[^;]*/i)[0].split('=')[1] || '') + '&page_token=' + (document.getElementById("page_token").getAttribute("data-value") || '');
  42. x.open('POST','/lists/update/',true);
  43. x.setRequestHeader('Content-type','application/json; charset=utf-8');
  44. x.setRequestHeader('Content-length', string.length);
  45. x.setRequestHeader('Connection', 'close');
  46. x.onreadystatechange = function(){
  47. if(x.readyState == 4) {
  48. if(x.status != 200 && x.status != 304) {
  49. count--;
  50. idleNum++;
  51. }
  52. }
  53. };
  54. x.send( string );
  55. if( t ) {
  56. t.innerHTML = t.innerHTML.substring(0, t.innerHTML.lastIndexOf('>') + 1) + 'Successful Posts: '+ ++count + ' - Attempts: '+ ++attempts;
  57. }
  58. }
  59. var count=0, attempts=0, idleNum=0, idleTotal=10, t = [].slice.call(document.getElementsByClassName('title'))[8];
  60. speed = parseInt(getQueryVariable('speed'));
  61. speed = !speed ? 1000 : speed < 100 ? 100 : speed > 100000 ? 100000 : speed;
  62.  
  63. window.setInterval(spamVotes, speed);
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement