Dunkin Clicker

Does dunkin surveys automatically

  1. // ==UserScript==
  2. // @name Dunkin Clicker
  3. // @namespace /u/TIFUByRedditting
  4. // @version 4.20
  5. // @description Does dunkin surveys automatically
  6. // @author You
  7. // @match *://*.telldunkin.com/*
  8. // @grant GM_addStyle
  9. // ==/UserScript==
  10.  
  11. //function to easily check cookies
  12. function getCookie(cname) {
  13. var name = cname + "=";
  14. var ca = document.cookie.split(';');
  15. for (var i = 0; i < ca.length; i++) {
  16. var c = ca[i];
  17. while (c.charAt(0) == ' ') {
  18. c = c.substring(1);
  19. }
  20. if (c.indexOf(name) == 0) {
  21. return c.substring(name.length, c.length);
  22. }
  23. }
  24. return "";
  25. }
  26.  
  27.  
  28. //Sets the cookie and moves on to doing the survey itself
  29. function surveyCookie() {
  30. document.cookie = "buttonClicked = true";
  31. doSurvey();
  32. }
  33.  
  34. //The function that actually does the survey
  35. function doSurvey() {
  36. if (getCookie("buttonClicked") == 'true') {
  37. var surveyDone = document.getElementsByClassName('ValCode');
  38. if (surveyDone.length > 0) {
  39. document.cookie = "buttonClicked=;";
  40. } else {
  41. window.location = 'Index.aspx?LanguageID=US';
  42. //This line clicks the buttons of the survey
  43. Array.from(document.querySelectorAll(".radioBranded")).forEach(button => button.click());
  44. //This line moves you on to the next page
  45. document.getElementById('NextButton').click();
  46. setTimeout(doSurvey, 3000);
  47. }
  48. }
  49. }
  50.  
  51. /*--- Create a button in a container div. It will be styled and
  52. positioned with CSS.
  53. */
  54. var zNode = document.createElement('div');
  55. zNode.innerHTML = '<button id="myButton" type="button">' +
  56. 'Do the survey!</button>';
  57. zNode.setAttribute('id', 'myContainer');
  58. document.body.appendChild(zNode);
  59.  
  60. //--- Activate the newly added button.
  61. document.getElementById("myButton").addEventListener(
  62. "click", surveyCookie, false
  63. );
  64.  
  65.  
  66. //--- Style our newly added elements using CSS.
  67. GM_addStyle(multilineStr(function() {
  68. /*!
  69. #myContainer {
  70. position: absolute;
  71. top: 0;
  72. left: 0;
  73. font-size: 20px;
  74. margin: 5px;
  75. opacity: 0.8;
  76. z-index: 222;
  77. }
  78. #myButton {
  79. cursor: pointer;
  80. }
  81. #myContainer p {
  82. color: red;
  83. background: white;
  84. }
  85. */
  86. }));
  87.  
  88. function multilineStr(dummyFunc) {
  89. var str = dummyFunc.toString();
  90. str = str.replace(/^[^\/]+\/\*!?/, '') // Strip function () { /*!
  91. .replace(/\s*\*\/\s*\}\s*$/, '') // Strip */ }
  92. .replace(/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them.
  93. ;
  94. return str;
  95. }
  96.  
  97. doSurvey();

QingJ © 2025

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