Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name ADIP Rates
- // @version 0.1
- // @description Add an IP/whatever display to the main page
- // @author You
- // @match http*://ivark.github.io/
- // ==/UserScript==
- (function() {
- 'use strict';
- //ADIPRate Script
- $('body').append('<div id="ADIPfloat" style="font-family: Typewriter; font-size: 16px; border: 1px solid black; cursor: move; padding:5px; background: #222"></div>');
- $('#ADIPfloat').append('<span></span>');
- $("#ADIPfloat").css("position", "absolute").css("left", "1%").css("top", "68%");
- window.bestippm=0;
- window.bestip=0;
- $("#ADIPfloat")[0].appendChild(document.createElement("br"));
- //Manual best IP set button
- var IPsetbtn = document.createElement("button");
- IPsetbtn.onclick = function() {
- player.autobuyers[11].priority.mantissa = bestip;
- $("#priority12")[0].value = bestip;
- };
- IPsetbtn.innerHTML = "Set IP";
- $("#ADIPfloat")[0].appendChild(IPsetbtn);
- var resetIP=document.createElement("button");
- resetIP.onclick=function(){bestippm=0;};
- resetIP.innerHTML="Reset";
- $("#ADIPfloat").append(resetIP);
- setInterval(function(){
- var ippm=$("#averagerun")[0].innerHTML.split(" ")[12];
- var ippm2=$("#run1")[0].innerHTML.split(" ")[12];
- var ADIPfloat = document.getElementById(("ADIPfloat"));
- if(player.thisInfinityTime>1&&gainedInfinityPoints()/player.thisInfinityTime>bestippm){bestippm=gainedInfinityPoints()/player.thisInfinityTime;bestip=gainedInfinityPoints();}
- ADIPfloat.firstChild.innerHTML="Last 10: "+ippm+"/min<br>Last: "+ippm2+"/min<br>Best IP amount: "+bestip+"<br>Best IP rate: "+shorten(bestippm*600)+"/min";
- },100);
- //Draggable Script
- dragElement(document.getElementById(("ADIPfloat")));
- function dragElement(elmnt) {
- var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
- elmnt.onmousedown = dragMouseDown;
- function dragMouseDown(e) {
- e = e || window.event; // get the mouse cursor position at startup:
- pos3 = e.clientX;
- pos4 = e.clientY;
- document.onmouseup = closeDragElement; // removes action when the mouse button is raised
- document.onmousemove = elementDrag; // call a function whenever the cursor moves:
- }
- function elementDrag(e) {
- e = e || window.event;
- pos1 = pos3 - e.clientX; // calculate the new cursor position
- pos2 = pos4 - e.clientY;
- pos3 = e.clientX;
- pos4 = e.clientY;
- elmnt.style.top = (elmnt.offsetTop - pos2) + "px"; // set the element's new position
- elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
- }
- function closeDragElement() { // stop moving when mouse button is released:
- document.onmouseup = null;
- document.onmousemove = null;
- }
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement