[SNIPPET] Getting some useful informations from bblog - Better Battlelog Forums #67997

Sitemap
Post edited 1 x times, last by
Topicstarter
I had to write a little snippet to gain some information about the currently logged user:

//get the html source of the assignments-link
var code = $('li[data-page="assignments"]').html();
//trim to anything inside href=""
var url = code.match('href=\"(.*)\"');
//write the splittet data into an array
var data = url[1].split("/");
//optional for debugging purposes output per alert)
alert("Game: "+data[1]+"\nLanguage: "+data[2]+"\nUsername: "+data[4]+"\nUser-ID: "+data[6]);


How you can see, this snippet stores Game-ID, Language-ID, Username and User-ID in an array (data).

This can be useful for building own links etc.

Thats all for know :)
All that is already stored in the BBLog cache
BBLog.cache("soldier.id")
BBLog.cache("soldier.name")
BBLog.cache("account.name")
BBLog.cache("platform")
Topicstarter
BrainFooLong wrote:
All that is already stored in the BBLog cache
BBLog.cache("soldier.id")
BBLog.cache("soldier.name")
BBLog.cache("account.name")
BBLog.cache("platform")


Oh, good to know :)

I will then rewrite some of my plugins!

Thank you :>
Is language stored in BBlog cache?
dapil wrote:
Is language stored in BBlog cache?


BBLog.cache("battlelog.language"); // Language from Battlelog, with trailing slash
BBLog.cache("language"); // Language for the addon, same as battlelog, if available in BBLog, otherwise EN