Facebook
From asd, 9 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 672
  1. window.addEventListener('keydown', function (e) {
  2.         "use strict";
  3.         if (e.keyCode == "X".charCodeAt(0)) {
  4.                 var x = location.search.match(/\d+/)[0];
  5.                 var c = new XMLHttpRequest;
  6.                 c.open("GET", "/game.php?village=" + x + "&screen=place&try=confirm");
  7.                 c.onreadystatechange = function () {
  8.                         if (200 == c.status && 4 == c.readyState) {
  9.                                 var d = document.createElement("div");
  10.                                 d.innerHTML = c.responseText;
  11.                                 d = d.getElementsByClassName("unitsInput");
  12.                                 var serialize = "";
  13.                                 var e = d.length;
  14.                                 while (e--)
  15.                                         serialize += d[e].nextSibling.nextSibling.href.match(/[^_\W]+(?=')/) + "=" + d[e].nextSibling.nextSibling.innerHTML.match(/\d+/g) + "&";
  16.                                 serialize = serialize.replace(/=(?=0)./g, "=");
  17.                                 c.open("POST", "/game.php?village=" + x + "&screen=place&try=confirm");
  18.                                 c.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  19.                                 c.onreadystatechange = function () {
  20.                                         var a, b;
  21.                                         200 == c.status && 4 == c.readyState && (a = (new DOMParser).parseFromString(c.responseText, "text/html").getElementsByTagName("form")[0], b = new FormData(a), c.open("POST", a.getAttributeNode("action").value), c.send(b))
  22.                                 };
  23.                                 console.log(serialize);
  24.                                 c.send(serialize + "x=" + localStorage.coords.split('|')[0] + "&y=" + localStorage.coords.split('|')[1] + "&attack=1")
  25.                         }
  26.                 };
  27.                 c.send();
  28.         } else if (e.keyCode == "Q".charCodeAt(0)) {
  29.                 if (confirm('zapisać koordy?'))
  30.                         localStorage.coords = document.getElementById('content_value').innerHTML.match(/(\d+)\|(\d+)/g)[0]
  31.         }
  32. })
  33.