Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name auto zapraszanie na kolos
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author Sharley
- // @match http://hutena.margonem.pl/
- // @grant none
- // ==/UserScript==
- g.loadQueue.push({
- fun: () => {
- if(!localStorage.getItem(`invitePos`))
- {
- let tmpObj = {
- x: 0,
- y: 0
- };
- localStorage.setItem(`invitePos`, JSON.stringify(tmpObj));
- };
- const squad = []
- let inviteInterval
- let coords = JSON.parse(localStorage.getItem(`invitePos`));
- if(!localStorage.getItem(`inviteInput`)) localStorage.setItem('inviteInput','Wypisz kogo zapraszać');
- const startGetPlayers = () => {
- inviteInterval = setInterval(getPlayers, 2000)
- }
- const getPlayers = () => {
- for(n in g.other){
- if ((Math.abs(hero.x - g.other[n].x) <= 1 && Math.abs(hero.y - g.other[n].y) <= 1) && !isset(g.party[n]) && squad.includes(g.other[n].nick)){
- _g("party&a=inv&id="+n)
- }
- }
- }
- const stopAction = () => {
- clearInterval(inviteInterval)
- }
- if(squad == null)
- {
- squad = [];
- };
- const inviteMenu = document.createElement('div')
- inviteMenu.style.position = 'absolute';
- inviteMenu.style.left = `${coords.x}px`;
- inviteMenu.style.top = `${coords.y}px`;
- inviteMenu.style.background = '#333';
- inviteMenu.style.width = `300px`;
- inviteMenu.style.height = `200px`;
- inviteMenu.style.border = 'none';
- const input = document.createElement('input')
- input.id = 'invite-input'
- input.value = localStorage.getItem(`inviteInput`)
- const button = document.createElement('button')
- button.textContent = 'Zapraszaj'
- const buttonOff = document.createElement('button')
- buttonOff.textContent = 'Wyłącz'
- input.addEventListener('input', (e) => {
- localStorage.setItem('inviteInput', e.target.value);
- squad.push(e.target.value);
- })
- button.addEventListener('click', () => {
- message('Odpalam')
- startGetPlayers()
- })
- buttonOff.addEventListener('click', () => {
- message('Wylaczam zapraszanie')
- stopAction()
- })
- document.body.appendChild(inviteMenu)
- inviteMenu.appendChild(button)
- inviteMenu.appendChild(buttonOff)
- $(inviteMenu).draggable({
- stop: () => {
- let tmpObj = {
- x: parseInt(inviteMenu.style.left),
- y: parseInt(inviteMenu.style.top)
- };
- localStorage.setItem(`invitePos`, JSON.stringify(tmpObj));
- message(`Zapisano pozycję`);
- }
- });
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement