devenv / AntiMatter Dimentions Automator

// ==UserScript==
// @name         AntiMatter Dimentions Automator
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Automates Antimatter Dimensions resets
// @author       Devenv
// @license      MIT
// @require http://code.jquery.com/jquery-1.12.4.min.js
// @match        http://ivark.github.io/
// @match        https://ivark.github.io/
// ==/UserScript==

// ==OpenUserJS==
// @author Devenv
// ==/OpenUserJS==


(function() {

    var VERSION = "1.9";

    $('body').append('<div id="lastrunfloat" style="font-family: Typewriter; font-size: 10px; border: 1px solid black; cursor: move; padding:5px; background: white"></div>');
    $("#lastrunfloat").css("position", "absolute").css("left", "1%").css("top", "87%");

    function autoStandard(){
      $('#bigcrunch').click();
      $('#secondSoftReset').click();
      $('#softReset').click();
      $('#maxall').click();
      if (parseInt($("#eightAmount").text()) >= 50 && parseInt($("#sacrifice").text().match('[0-9.]*x')[0].replace('x', '')) > 50) {
        $("#sacrifice").click()
      }
      $('#parent').children('tr:visible').last().children('td').eq(2).children('button').click()
      //$($('#parent').children('tr:visible').get().reverse()).each(function(i, tr) {
      //    if(parseInt($(tr).children('td').eq(1).text().trim().match('\\([0-9]*\\)')[0].replaceAll('()', '') < 10)) {
      //      $(tr).children('td').eq(2).children('button').click()
      //    }
      //})
    }
  
    function updateStats(){
        $("#lastrunfloat").html($('#thisInfinity').text() + "<br>" + $("#run1").html() + "<br>" + $("#run2").html());
    }

    setInterval(autoStandard, 10);
  	setInterval(updateStats, 1000);
  
    dragElement(document.getElementById(("lastrunfloat")));
    function dragElement(elmnt) {
        var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
        elmnt.onmousedown = dragMouseDown;
        function dragMouseDown(e) {
            e = e || window.event;
            pos3 = e.clientX;
            pos4 = e.clientY;
            document.onmouseup = closeDragElement;
            document.onmousemove = elementDrag;
        }
        function elementDrag(e) {
            e = e || window.event;
            pos1 = pos3 - e.clientX;
            pos2 = pos4 - e.clientY;
            pos3 = e.clientX;
            pos4 = e.clientY;
            elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
            elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
        }
        function closeDragElement() {
            document.onmouseup = null;
            document.onmousemove = null;
        }
    }

})();