Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name TVGuideRig
- // @namespace tvrig
- // @include http://www.tv.com/lists/SpecialFeatures:list:best-animated-series/widget/poll/*
- // @version 2.0
- // ==/UserScript==
- (function(){
- var d = document, w = window,
- getQueryVariable = function(variable) {
- var query = w.location.search.substring(1), vars = query.split("&");
- for (var i=0;i<vars.length;i++) {
- var pair = vars[i].split("=");
- if (pair[0] == variable) {
- return pair[1];
- }
- }
- }, spamVotes, spamID,
- //default speed is 1 second between votes
- speed = 1000;
- if( w.location.search.indexOf('speed=') == -1 ) {
- speed = parseInt(prompt("Confirm this dialog to start script\n\nHow fast should this autism fest run at?\n(Lower is faster)", speed));
- w.location.href = w.location.href + '?speed=' + speed;
- } else {
- speed = parseInt(getQueryVariable('speed'));
- speed = !speed ? 1000 : speed < 100 ? 100 : speed > 100000 ? 100000 : speed;
- w.count = 0;
- spamVotes = function(){
- var t = [].slice.call(d.getElementsByClassName("title"))[9], x = new XMLHttpRequest(),
- msg = {"vote_rate_limit": "3",
- 'list_id': 'SpecialFeatures:list:best-animated-series',
- 'id': 's:79180',
- 'a': 'a',
- 'v': '+1'},
- string = "inp=" + encodeURIComponent(JSON.stringify(msg)) + "&csrfmiddlewaretoken=" + (document.cookie.match(/csrftoken=[^;]*/i)[0].split("=")[1] || "");
- x.open('POST','/lists/update/',true);
- x.setRequestHeader('Content-type','application/json; charset=utf-8');
- x.setRequestHeader("Content-length", string.length);
- x.setRequestHeader("Connection", "close");
- x.onreadystatechange = function(){
- if(x.readyState == 4) {
- if(x.status != 200 && x.status != 304) {
- clearInterval(spamID);
- setTimeout(function(){spamID = w.setInterval(spamVotes, speed)}, 20000);
- }
- }
- };
- x.send( string );
- if( t ) {
- t.innerHTML = t.innerHTML.substring(0, t.innerHTML.lastIndexOf('>') + 1) + "Counter: "+ w.count++;
- }
- };
- spamID = w.setInterval(spamVotes, speed);
- spamVotes();
- }
- }())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement