-
-
Save irae/134722 to your computer and use it in GitHub Desktop.
This file contains 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 Inventário do brute | |
// @namespace La e My Brute | |
// @description Adiciona a opção de visualizar o inventário do adversário na arena | |
// @include http://*.labrute.com/arene | |
// @include http://*.mybrute.com/arene | |
// ==/UserScript== | |
// Add jQuery | |
var GM_JQ = document.createElement('script'); | |
GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js'; | |
GM_JQ.type = 'text/javascript'; | |
document.getElementsByTagName('head')[0].appendChild(GM_JQ); | |
// Check if jQuery's loaded | |
function GM_wait() { | |
if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); } | |
else { | |
letsJQuery(unsafeWindow.jQuery); | |
} | |
} | |
GM_wait(); | |
// All your GM code must be inside this function | |
function letsJQuery($) { | |
// Determina o domínio | |
var domain = unsafeWindow.location.href.match(/http:\/\/.*?(\..*)\/arene/)[1]; | |
domain = (domain == ".labrute.com") ? ".labrute.fr" : domain | |
// Remove elementos desnecessários | |
$(".caracs").css('width', '160px'); | |
$('.areneLeft .center').remove(); | |
// Lateral direita | |
var right = $('.areneRight'); | |
right.html(""); | |
// Remove eventos dos box e adiciona a opção de inventário | |
var mini = $('.miniCaracs'); | |
for(i = 0; i < mini.length; i++ ) { | |
(function(self) { | |
var id = self.find('div.swf').attr("id").replace(/swf_brute_/, ''); | |
var url = "http://" + id + domain + "/cellule"; | |
self.attr("onclick", null); | |
self.attr("onmouseover", null); | |
self.attr("onmouseout", null); | |
var name = self.find("div.name"); | |
var name_value = name.html(); | |
var link = $('<a href="' + url + '" target="_blank">' + name_value + '</a>'); | |
name.html(link); | |
// Inside | |
GM_xmlhttpRequest({ | |
method: "GET", | |
url: url, | |
onload: function(response) { | |
if (response.status == 200) { | |
var flash_vars = response.responseText.match(/.*FlashVars.*"(.*inventory.*)"/)[1]; | |
name.html(name_value); | |
name.click(function() { | |
var embed = '<embed width="310" height="600" scale="noscale" \ | |
flashvars="' + flash_vars + '" \ | |
allowscriptaccess="always" menu="false" quality="high" bgcolor="#FFFFFF" name="inventory" id="inventory" \ | |
src="http://data' + domain + '/swf/uc.swf?v=15" type="application/x-shockwave-flash"/>'; | |
right.html("<h2>" + name_value + "</h2>"); | |
right.append(embed); | |
}) | |
} | |
} | |
}); | |
})(mini.eq(i)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment