Captcha Counter

Counts the number of hits remaining before you get a captcha

  1. // ==UserScript==
  2. // @name Captcha Counter
  3. // @version 0.9
  4. // @match https://www.mturk.com/mturk/*
  5. // @copyright 2014+, Tjololo
  6. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
  7. // @namespace https://gf.qytechs.cn/users/710
  8. // @description Counts the number of hits remaining before you get a captcha
  9. // ==/UserScript==
  10.  
  11. var hitId = "";
  12. if (document.getElementsByName("hitId")[0])
  13. hitId = document.getElementsByName("hitId")[0].value;
  14. var captchanum = 35;
  15. if (localStorage["captcha_number"]){
  16. captchanum = parseInt(localStorage["captcha_number"]);
  17. }
  18. var count = 0;
  19. if (localStorage["captcha_counter"]){
  20. count = parseInt(localStorage["captcha_counter"]);
  21. console.log("Count: "+count);
  22. }
  23.  
  24. if(window.location.href.indexOf("accept") > -1) {
  25. if ($('input[name="userCaptchaResponse"]').length > 0) {
  26. count = 0;
  27. localStorage["captcha_counter"] = count;
  28. console.log("Captcha found: "+count);
  29. }
  30. else{
  31. if (hitId != "" && $('div[class="message error"]').length == 0){
  32. console.log("Accepted Hit");
  33. count+=1;
  34. localStorage["captcha_counter"]=count;
  35. console.log((captchanum-count)+" hits left until captcha!");
  36. if (count == captchanum)
  37. alert("Next hit is a captcha!");
  38. //alert((captchanum-count)+" hits left until captcha!");
  39. }
  40. else{
  41. console.log("No hit accepted");
  42. }
  43. }
  44. }
  45. else{
  46. if ($('input[name="userCaptchaResponse"]').length > 0) {
  47. count = 0;
  48. localStorage["captcha_counter"] = count;
  49. console.log("Captcha found: "+count);
  50. }
  51. }
  52.  
  53. if (captchanum-count == 1)
  54. captchaCountStr = (captchanum-count)+" hit left until captcha!";
  55. else if (captchanum-count == 0)
  56. captchaCountStr = "Last hit before captcha!";
  57. else
  58. captchaCountStr = (captchanum-count)+" hits left until captcha!";
  59.  
  60. var row = document.createElement("tr");
  61. var cell = document.createElement("td");
  62. if ($('#theTime').length)
  63. var table = $('#theTime').parents('table')[0];
  64. else
  65. var table = $('.title_orange_text_bold:first').parents('tbody')[0];
  66. cell.className = "title_orange_text";
  67. cell.setAttribute("align","left");
  68. cell.setAttribute("valign","top");
  69. cell.setAttribute("style","white-space: nowrap; padding-top: 1ex;");
  70. cell.style.paddingTop = "3px";
  71. cell.addEventListener("click", function clickCell(e) {
  72. var num_str=prompt("How many hits do you accept before you get a captcha? Note: This includes returns","35");
  73. var num = parseint(num_str);
  74. if (num){
  75. localStorage["captcha_number"] = num;
  76. alert("Captcha number saved as "+num);
  77. }
  78. });
  79. cell.innerHTML="<b>Captcha:</b> <span>"+captchaCountStr+"</span>";
  80. row.appendChild(cell);
  81. table.appendChild(row);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址