Greasemonkey/VDex_Project_Battle_Tool.user.js

82 lines
2.9 KiB
JavaScript
Raw Normal View History

2014-01-05 19:14:05 +01:00
// ==UserScript==
// @name VDex Project Battle Tool
// @namespace http://www.enbewe.de/vdex/
// @description Removes Confirmation Dialog
// @include http://vdexproject.net/battle.php?*
// @include http://vdexproject.net/talk.php?npc=registeel
// @version 0.1
// ==/UserScript==
unsafeWindow.chspoke = function(what,pid) {
var params = "mode=registeel&pid="+pid;
var target = "ajax9.php";
var xmlhttp = unsafeWindow.createXmlhttp();
xmlhttp.onreadystatechange = function () {
if ( xmlhttp.readyState == 1 ) {
unsafeWindow.npctalktext.innerHTML = "Please stand by.<br /><img src=\"http://zangoose.vdexproject.net/loading.gif\" alt=\"Loading...\" />";
unsafeWindow.playertalktext.className = "hidden";
}
if ( xmlhttp.readyState == 4 ) {
unsafeWindow.hiddendiv.innerHTML = xmlhttp.responseText;
var anpc = document.getElementById("ajaxnpc");
if ( anpc ) {
unsafeWindow.npctalktext.innerHTML = anpc.innerHTML;
unsafeWindow.playertalktext.innerHTML = playertalkback.innerHTML;
}
else {
alert (xmlhttp.responseText);
unsafeWindow.npctalktext.innerHTML = "That seems to have been unsuccessful.";
unsafeWindow.playertalktext.innerHTML = playertalkback.innerHTML;
}
playertalktext.className = "";
}
}
unsafeWindow.sendRequest(xmlhttp, target, params);
}
unsafeWindow.usemove = function(bid, move, mname) {
if ( unsafeWindow.midajax ) { return; }
var loaddiv = document.getElementById("loading");
var maindiv = document.getElementById("stuff");
var blog = document.getElementById("battlelog");
var scr = blog.scrollTop;
var target = "bajax.php";
var params = "mode=move&bid="+bid+"&move="+move;
unsafeWindow.midajax = true;
var xmlhttp = unsafeWindow.createXmlhttp();
xmlhttp.onreadystatechange = function () {
if ( xmlhttp.readyState ==1 ) {
loaddiv.innerHTML = '<img src="http://zangoose.vdexproject.net/loading.gif" alt="Loading..." />';
}
if ( xmlhttp.readyState == 4 ) {
loaddiv.innerHTML = "";
maindiv.innerHTML = xmlhttp.responseText;
var blog = document.getElementById("battlelog");
blog.scrollTop = scr+1000;
unsafeWindow.midajax = false;
}
}
unsafeWindow.sendRequest(xmlhttp, target, params);
}
unsafeWindow.cancel = function(bid) {
if ( unsafeWindow.midajax ) { return; }
var loaddiv = document.getElementById("loading");
var maindiv = document.getElementById("stuff");
var target = "bajax.php";
var params = "mode=end&bid="+bid;
unsafeWindow.midajax = true;
var xmlhttp = unsafeWindow.createXmlhttp();
xmlhttp.onreadystatechange = function () {
if ( xmlhttp.readyState ==1 ) {
loaddiv.innerHTML = '<img src="http://zangoose.vdexproject.net/loading.gif" alt="Loading..." />';
maindiv.innerHTML = "";
}
if ( xmlhttp.readyState == 4 ) {
loaddiv.innerHTML = "";
maindiv.innerHTML = xmlhttp.responseText;
unsafeWindow.midajax = false;
}
}
unsafeWindow.sendRequest(xmlhttp, target, params);
}