Favoriteserver plugin - Better Battlelog Forums #1934

Sitemap
Topicstarter
I have put together a pluigin so i can have my favorite server on the home page. Like this:
http://img39.imageshack.us/img39/7120/battlelogbattlefieldcome.png

I cant get the join server butons to work. I do not see where I can find "gameid" and the "guid" parameters that you have to send when you submit the forme.

The form i send looks like this:

Does someone know how I get hold of "gameid" and the "guid" parameters?

The code looks like this:ServerFavorites = {
servers : [],
serverId ],
apiUrl : "http://api.bf3stats.com/pc/server/",

init : function() {
this.serverId[0] = "09570e32-dbb7-4059-8158-460b5c15b77e";
this.serverId[1] = "3e532eab-320c-437d-a7f8-1bd9dda2c719";
this.serverId[2] = "f9ba51bc-e9b0-40ad-bee5-02ddd56ef92f";
this.serverId[3] = "018a8c29-2c78-40c7-acb9-bd08ac6f88f7";
this.serverId[4] = "690a349d-6029-4431-9050-a4845bb43c48";

var element = $("#main-loggedin-content > #main-loggedin-leftcolumn");
element.empty();
element.append(
$("").append(document.createTextNode('Absolution Crew eSport´s servers'))
)

for (i = 0; i 35) {
servers.srvName = servers.srvName.slice(0,35) + '...';
}

servers.players = data.srv.players + "/" + data.srv.slots
servers.mode = data.srv.mode_name
servers.mapName = data.srv.map_name
servers.mapImage = data.srv.map_image
servers.url = data.srv.battlelog
servers.mapImage = data.srv.map_image
servers.ip = data.srv.ip
servers.port = data.srv.port
servers.id = data.srv.id

var element = $("#main-loggedin-content > #main-loggedin-leftcolumn");

element.append(
$("").append(
$("").append(
$("").append(
$("")
)
)
).append(
$("").append(
$("").text(servers.srvName)
).append($("")).append(document.createTextNode(servers.players + ' players')).
append($("")).append(document.createTextNode(servers.mapName)).
append($("")).append(document.createTextNode(servers.mode))
).append($('').append(
$('').addClass('base-left serverguide-join-server base-no-ajax').attr(
{
method : 'GET',
id : 'serverguide-show-joinserver-form',
action : servers.url,
guid : '',
'data-processed-server' : 'true'
}
).append(
$('').attr('type', 'hidden').attr('name', 'gameip').attr('value', servers.ip)).append(
$('').attr('type', 'hidden').attr('name', 'gameid').attr('value', '')).append(
$('').attr('type', 'hidden').attr('name', 'gameport').attr('value', servers.port)).append(
$('').attr('type', 'hidden').attr('name', 'gamename').attr('value', 2)).append(
$('').attr('type', 'hidden').attr('name', 'action').attr('value', '')).append(
$('').attr('type', 'submit').attr('name', 'submit').attr('value', 'Join server').addClass('base-button-arrow-almost-gigantic')
))
).append($('')).attr('class', 'base-clear')
).append($(''));


});
},

makeLocalizedUrl : function(path)
{
var url = "";
if(BBLog.battlelogLanguage != null && BBLog.battlelogLanguage != 'en')
url = '/bf3/' + BBLog.battlelogLanguage + path;
else
url = '/bf3' + path;
return url;
}

};


$(document).ready(function() {
$('ul.base-header-soldier-nav').css({"margin-right":"-35px"});
ServerFavorites.init();
});
Wou, those are some big buttons :D
Topicstarter
Yes i know, any idea on how to get the "gameid" and the "guid" variables?
Well those are fetched into the join server button on the server page or server browser page.
So you should store them somehow.
Topicstarter
I get the variables from BBLog.getJSONFromBattlelog('bla bla url'), but i can´t get the button to work. Have Dice added some kind of security for this?
The "Join Server" button should use the gamemanager/launcher.
I'm not really sure anyways, I'm not an expert with these things.
Topicstarter
I managed to make the buttons to work with this code:
$('.hellions-mupp-class form').submit(function (event) {
event.preventDefault();
$("#gamecontrol-game-launcher").show();
gamemanager.joinServerByUrl($(this).attr("action"), null, function(foundServer) {});
return false;
});
This is a nice plugin. Any plans on releasing it?