Created
July 7, 2017 17:33
-
-
Save mhz-tamb/f0319dac5b9219f8c4b9e7d11c0dc4a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name BattleGroup | |
// @namespace DreamWar | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Sergey Shiryaev <[email protected]> | |
// @match http://dreamwar.ru/battle_group.php* | |
// @run-at document-end | |
// @grant none | |
// ==/UserScript== | |
Notification.requestPermission(); | |
(() => { | |
'use strict'; | |
let refresh = document.querySelector('[accesskey="5"]'); | |
let submit = document.querySelector('input[type="submit"]'); | |
let sleep = (time) => { | |
return new Promise((resolve) => setTimeout(resolve, time)); | |
}; | |
if (Notification.permission === "granted" && !submit && !refresh) { | |
let notification= new Notification('Бой завершен'); | |
setTimeout(() => { | |
notification.close(); | |
}, 2500); | |
} | |
sleep(250).then(() => { | |
Array.prototype.forEach.call(document.querySelectorAll('input[name="skills[]"]'), (item) => { | |
item.setAttribute('checked', true); | |
}); | |
if (submit !== null) submit.click(); else refresh.click(); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment