Cookie Clicker Helper

try to take over the cookies!

  1. // ==UserScript==
  2. // @name Cookie Clicker Helper
  3. // @namespace https://orteil.dashnet.org/cookieclicker/
  4. // @version 1.0
  5. // @description try to take over the cookies!
  6. // @author Hubertokf
  7. // @match *://orteil.dashnet.org/cookieclicker/
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant none
  10. // @grant GM_addStyle
  11. // @grant GM_getValue
  12. // @grant GM_setValue
  13. // @require http://code.jquery.com/jquery-3.4.1.min.js
  14. // @license MIT
  15. // ==/UserScript==
  16.  
  17.  
  18. (function() {
  19. 'use strict';
  20. var $ = window.jQuery;
  21.  
  22. console.log("Cookie Clicker Helper Init")
  23.  
  24. function cookieHack() {
  25. function centerObj(o) {
  26. var offset = o.offset();
  27. var width = o.width();
  28. var height = o.height();
  29.  
  30. var centerX = offset.left + width / 2;
  31. var centerY = offset.top + height / 2;
  32. var pos = {
  33. x: centerX,
  34. y: centerY,
  35. };
  36.  
  37. return pos;
  38. }
  39.  
  40. $(document).keydown(function( event ) {
  41. if ( event.which == 72 ) {
  42. $("#hackbox").toggle();
  43. }
  44. });
  45.  
  46. $("body").on("mousedown", "#septop", function (e) {
  47. e.preventDefault();
  48. $(this)
  49. .parent()
  50. .addClass("draggable")
  51. .parents()
  52. .on("mousemove", function (e) {
  53. $(".draggable")
  54. .offset({
  55. top: e.pageY - 10,
  56. left: e.pageX - $(".draggable").outerWidth() / 2,
  57. })
  58. .on("mouseup", function () {
  59. $(this).removeClass("draggable");
  60. });
  61. });
  62. }).on("mouseup", function () {
  63. $(".draggable").removeClass("draggable");
  64. });
  65.  
  66.  
  67. var styles = `
  68. #hackbutton {
  69. bottom: 16px;
  70. right: 0;
  71. height: 45px;
  72. left: 0;
  73. margin-left: auto;
  74. margin-right: auto;
  75. padding-top: 6px;
  76. background-position: 0px -48px;
  77. }
  78.  
  79. #septop{
  80. position: relative;
  81. }
  82.  
  83. #septop:active{
  84. cursor: move;
  85. }
  86.  
  87. #hackboxClose{
  88. text-align: right;
  89. float: right;
  90. cursor: pointer;
  91. font-size: 15px;
  92. font-weight: bold;
  93. padding: 0 5px;
  94. }
  95.  
  96. #hackbox{
  97. display: none;
  98. width: 300px;
  99. /* height: 200px; */
  100. margin: 0 auto;
  101. right: 0;
  102. left: 0;
  103. top: 200px;
  104. position: absolute;
  105. background-color: rgba(0,0,0,0.6);
  106. z-index: 99999999;
  107. }
  108.  
  109. #hackcredits{
  110. margin-top: 20px;
  111. font-size: 9px;
  112. text-align: right;
  113. color: #aaa;
  114. margin: 4px;
  115. }
  116.  
  117. #hacklist{
  118. padding: 20px;
  119. }
  120.  
  121. #hacklist li{
  122. margin-bottom: 10px;
  123. min-height: 22px;
  124. }
  125.  
  126. .hackitem{
  127. font-family: 'Kavoon', Georgia,serif;
  128. font-size: 18px;
  129. text-shadow: 0px 0px 4px #000;
  130. color: #fff;
  131. float: left;
  132. line-height: 22px;
  133. }
  134.  
  135. .swcookie{
  136. float: right !important;
  137. }
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161. /* Toogle button */
  162.  
  163. /* ============================================================
  164. COMMON
  165. ============================================================ */
  166. #wrapper {
  167. min-width: 600px;
  168. }
  169.  
  170. .settings {
  171. display: table;
  172. width: 100%;
  173. }
  174. .settings .row {
  175. display: table-row;
  176. }
  177. .settings .question,
  178. .settings .switch {
  179. display: table-cell;
  180. vertical-align: middle;
  181. padding: 10px;
  182. }
  183. .settings .question {
  184. width: 600px;
  185. font-family: "Roboto Slab", serif;
  186. font-size: 20px;
  187. }
  188.  
  189. /* ============================================================
  190. COMMON
  191. ============================================================ */
  192. .cmn-toggle {
  193. position: absolute;
  194. margin-left: -9999px;
  195. visibility: hidden;
  196. }
  197. .cmn-toggle + label {
  198. display: block;
  199. position: relative;
  200. cursor: pointer;
  201. outline: none;
  202. -webkit-user-select: none;
  203. -moz-user-select: none;
  204. -ms-user-select: none;
  205. user-select: none;
  206. }
  207.  
  208. /* ============================================================
  209. SWITCH 1 - ROUND
  210. ============================================================ */
  211. input.cmn-toggle-round + label {
  212. padding: 2px;
  213. width: 42px;
  214. height: 18px;
  215. background-color: rgba(0,0,0,0.5);
  216. -webkit-border-radius: 60px;
  217. -moz-border-radius: 60px;
  218. -ms-border-radius: 60px;
  219. -o-border-radius: 60px;
  220. border-radius: 60px;
  221. }
  222. input.cmn-toggle-round + label:before, input.cmn-toggle-round + label:after {
  223. display: block;
  224. position: absolute;
  225. top: 1px;
  226. left: 1px;
  227. bottom: 1px;
  228. content: "";
  229. }
  230. input.cmn-toggle-round + label:before {
  231. right: 1px;
  232. background-color: #555;
  233. -webkit-border-radius: 60px;
  234. -moz-border-radius: 60px;
  235. -ms-border-radius: 60px;
  236. -o-border-radius: 60px;
  237. border-radius: 60px;
  238. -webkit-transition: background 0.4s;
  239. -moz-transition: background 0.4s;
  240. -o-transition: background 0.4s;
  241. transition: background 0.4s;
  242. }
  243. input.cmn-toggle-round + label:after {
  244. width: 20px;
  245. background-color: #ddd;
  246. -webkit-border-radius: 100%;
  247. -moz-border-radius: 100%;
  248. -ms-border-radius: 100%;
  249. -o-border-radius: 100%;
  250. border-radius: 100%;
  251. -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  252. -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  253. box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  254. -webkit-transition: margin 0.4s;
  255. -moz-transition: margin 0.4s;
  256. -o-transition: margin 0.4s;
  257. transition: margin 0.4s;
  258. }
  259. input.cmn-toggle-round:checked + label:before {
  260. background-color: #8ce196;
  261. }
  262. input.cmn-toggle-round:checked + label:after {
  263. margin-left: 25px;
  264. }
  265. `
  266.  
  267. const getUpgrades = () => [
  268. {name: "Cursor", id: "#product0"},
  269. {name: "Vovó", id: "#product1"},
  270. {name: "Fazenda", id: "#product2"},
  271. {name: "Mina", id: "#product3"},
  272. {name: "Fábrica", id: "#product4"},
  273. {name: "Banco", id: "#product5"},
  274. {name: "Templo", id: "#product6"},
  275. {name: "Torre de bruxos", id: "#product7"},
  276. {name: "Carregamento", id: "#product8"},
  277. {name: "Laboratório de alquimia", id: "#product9"},
  278. {name: "Portal", id: "#product10"},
  279. {name: "Máquina do tempo", id: "#product11"},
  280. {name: "Condensador antimatéria", id: "#product12"},
  281. {name: "Prisma", id: "#product13"},
  282. {name: "Criador do acaso", id: "#product14"},
  283. {name: "Motor fractal", id: "#product15"},
  284. {name: "Console de javascript", id: "#product16"},
  285. {name: "Ocioverso", id: "#product17"},
  286. {name: "Confeiteiro de córtex", id: "#product18"},
  287. ]
  288.  
  289. var box = `
  290. <div id='hackbox' class=''>
  291. <div id='septop' class='separatorBottom'>
  292. <div id='hackboxClose'>X</div>
  293. </div>
  294. <ul id='hacklist'>
  295. <li>
  296. <div class='hackitem'>Auto Click</div>
  297. <div class='switch swcookie'>
  298. <input id='autoclick' class='cmn-toggle cmn-toggle-round' type='checkbox'>
  299. <label for='autoclick'></label>
  300. </div>
  301. </li>
  302. <li>
  303. <div class='hackitem'>Clicks per second</div>
  304. <input type="number" id="cps" min="0" value="100" style="width: 50px; float: right;">
  305. </li>
  306. <li>
  307. <div class='hackitem'>Auto Gold Cookie</div>
  308. <div class='switch swcookie'>
  309. <input id='autogoldcookie' class='cmn-toggle cmn-toggle-round' type='checkbox'>
  310. <label for='autogoldcookie'></label>
  311. </div>
  312. </li>
  313. <li>
  314. <div class='hackitem'>Auto Cervo Natal</div>
  315. <div class='switch swcookie'>
  316. <input id='autocervonatal' class='cmn-toggle cmn-toggle-round' type='checkbox'>
  317. <label for='autocervonatal'></label>
  318. </div>
  319. </li>
  320. <li>
  321. <div class='hackitem'>Auto upgrade</div>
  322. <div class='switch swcookie'>
  323. <input id='autoupgrade' class='cmn-toggle cmn-toggle-round' type='checkbox'>
  324. <label for='autoupgrade'></label>
  325. </div>
  326. <select id="upgrade-selector">
  327. ${getUpgrades().map((upgrade)=>`<option value=${upgrade.id}>${upgrade.name}</option>`)}
  328. <option></option>
  329. </select>
  330. </li>
  331. <div>
  332. </ul>
  333. <div id='hackcredits'>Made by Fozter | v0.6</div>
  334. </div>;
  335. `
  336.  
  337. var headID = document.getElementsByTagName("head")[0];
  338. var cssNode = document.createElement("style");
  339. cssNode.type = "text/css";
  340. cssNode.rel = "stylesheet";
  341. cssNode.innerHTML = styles
  342.  
  343. $("head").prepend(cssNode);
  344.  
  345. $("body").prepend(box);
  346.  
  347. $("body").on("click", "#hackboxClose", function () {
  348. $("#hackbox").hide();
  349. });
  350.  
  351.  
  352.  
  353. var autoclick;
  354. var autogoldcookie;
  355. var autocervonatal;
  356. var autoupgrade;
  357. var cps;
  358. var upgrade;
  359.  
  360.  
  361.  
  362.  
  363. $('#cps').on("change input", function() {
  364. if ($(this).val() > 0) {
  365. cps = $(this).val();
  366.  
  367. if (autoclick) {
  368. clearInterval(autoclick);
  369. autoclick = setInterval(function () {
  370. $("#bigCookie").click();
  371. }, cps);
  372. }
  373. }
  374. });
  375.  
  376. $("body").on("click", "#autoupgrade", function () {
  377. $(this).toggleClass("btactv");
  378.  
  379. if ($(this).hasClass("btactv")) {
  380. autoupgrade = setInterval(() => {
  381. upgrade = $('#upgrade-selector').val();
  382. $(upgrade).click();
  383. //$(document.elementFromPoint(centerObj($("#bigCookie")).x, centerObj($("#bigCookie")).y )).click();
  384. }, 5000);
  385. } else {
  386. clearInterval(autoupgrade);
  387. }
  388. });
  389.  
  390. $("body").on("click", "#autoclick", function () {
  391. $(this).toggleClass("btactv");
  392.  
  393. if ($(this).hasClass("btactv")) {
  394. autoclick = setInterval(function () {
  395. $("#bigCookie").click();
  396. //$(document.elementFromPoint(centerObj($("#bigCookie")).x, centerObj($("#bigCookie")).y )).click();
  397. }, cps);
  398. } else {
  399. clearInterval(autoclick);
  400. }
  401. });
  402.  
  403. $("body").on("click", "#autocervonatal", function () {
  404. $(this).toggleClass("btactv");
  405.  
  406. if ($(this).hasClass("btactv")) {
  407. autocervonatal = setInterval(function () {
  408. $("#seasonPopup").click();
  409. }, 5000);
  410. } else {
  411. clearInterval(autocervonatal);
  412. }
  413. });
  414.  
  415. $("body").on("click", "#autogoldcookie", function () {
  416. $(this).toggleClass("btactv");
  417. if ($(this).hasClass("btactv")) {
  418. autogoldcookie = setInterval(function () {
  419. //$("#goldenCookie").click();
  420. $(".shimmer").click();
  421. //$(document.elementFromPoint(centerObj($("#goldenCookie")).x, centerObj($("#bigCookie")).y )).click();
  422. }, 5000);
  423. } else {
  424. clearInterval(autogoldcookie);
  425. }
  426. });
  427.  
  428. $("body").on("click", "#autoupgrade", function () {
  429. $(this).toggleClass("btactv");
  430. if ($(this).hasClass("btactv")) {
  431. autogoldcookie = setInterval(function () {
  432. //$("#goldenCookie").click();
  433. $(".shimmer").click();
  434. //$(document.elementFromPoint(centerObj($("#goldenCookie")).x, centerObj($("#bigCookie")).y )).click();
  435. }, 5000);
  436. } else {
  437. clearInterval(autogoldcookie);
  438. }
  439. });
  440. }
  441.  
  442. $( document ).ready(function() {
  443. cookieHack()
  444. });
  445.  
  446.  
  447.  
  448. })();

QingJ © 2025

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