SwagTv script

this script will automatically fetch and go to the next video after the meter goes up.

当前为 2014-05-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name SwagTv script
  3. // @namespace swagtv
  4. // @version 0.2
  5. // @description this script will automatically fetch and go to the next video after the meter goes up.
  6. // @include http://video.swagbucks.com/*
  7. // ==/UserScript==
  8. //
  9. // --------------------------------------------------------------------
  10.  
  11. var iLoops = 0;
  12. window.setInterval(reloadTimer,1000);
  13. var doc = document.getElementById("feed-ajax-div");
  14. var notes = null;
  15. var _class = document.getElementsByClassName("thumb-container");
  16.  
  17. for (var i = 0; i < _class.length; i++) {
  18. if (_class[i].className == "thumb-container active") {
  19. var k = i;
  20. break;
  21. }
  22. }
  23. var video = document.getElementById("video-title");
  24. video.parentNode.removeChild(video);
  25. var comment = document.getElementById("commentsCont");
  26. comment.parentNode.removeChild(comment);
  27.  
  28.  
  29.  
  30. var randomNum = 0;
  31. var strPercentStart = null;
  32. var link = null;
  33. var div = null;
  34.  
  35.  
  36. function reloadTimer(){
  37. iLoops++;
  38. //console.log(iLoops);
  39. if (iLoops == 5) {
  40. console.log("k: "+k);
  41. strPercentStart = document.getElementById("meterNumber").innerHTML;
  42. div = document.getElementById("meterDuplicateVideo");
  43. if (div.style.display == 'none') {
  44. randomNum = Math.floor(Math.random()*15 + 50);
  45. }
  46. else {
  47. randomNum = 8;
  48. };
  49. if (k == null) {
  50. console.log("In K=3");
  51. document.getElementsByClassName("feed-ajax-next")[0].click();
  52. k = -1;
  53. }
  54. };
  55. if (iLoops == randomNum){
  56. //console.log(k);
  57. if (strPercentStart == '90%') { //comment out
  58. alert('Captcha'); //comment out
  59. } //comment out
  60. else { //comment out
  61. link = document.getElementsByClassName("thumb-link")[k+1].href;
  62. window.location.href = link;
  63. } //comment out
  64. }
  65. };