Help Understanding This - Better Battlelog Forums #109893

Post edited 1 x times, last by
Here is a test plugin I have been playing with:

I'm not all that far into learning javascript, but I am starting to see some patterns. I've been trying to get a button to appear in its own box in the BBLog drop down menu. It doesn't matter what it does; it just has to be there. I took a peak at some of the plugins that do this and tried to mimic it, but I must be missing something because it isn't appearing. Any help with it?

Usable link:
Post edited 1 x times, last by
When you compare it with that example plugin
than you will see what's the error. Have a eye on the "configKeys" and "id" parameter.
I got the test plugin to look like mine. It still works, but for some reason mine isn't showing up.
Example plugin:


The only difference between them is the naming as far as I can see.
Also you should remove trailing kommas (,)
var array = [

(instead of var array = [
Post edited 1 x times, last by
Fixed those things, but the inspect element tool in Chrome gave me this error:
Uncaught ReferenceError: BBlog is not defined

Edit: I found it. the "L" in BBLog.handle was lowercase. It is working now. :D
Now I am actually trying to make a real plugin. There are some things that I can't seem to find the id to.
I have this snippet that should change the text of the quick match button in the multiplayer drop down menu to "Last Played Server." Any problems with it?

I hope you don't mind me asking these questions here.
Post edited 1 x times, last by
document.getElementById("btn btn-primary btn-block btn-large base-quickmatch-serverfilter-menu")
Your parameter is not an Id, it's a selector.
I recommend you to use $ (jQuery), so to say
$("btn btn-primary btn-block btn-large base-quickmatch-serverfilter-menu")
Note: you can't use DOM specific functions on these objects.
You have to use
$("btn btn-primary btn-block btn-large base-quickmatch-serverfilter-menu").text('Last played Server')
Take a look at the jQuery documentation:
Post edited 2 x times, last by
kurtextrem wrote:
$("btn btn-primary btn-block btn-large base-quickmatch-serverfilter-menu")

Is wrong because of missing points to select elements with that class name and missing "," to search for multiple classes.

$(".btn, .btn-primary, .btn-block, .btn-large, .base-quickmatch-serverfilter-menu")

Is correct.

Anyway, to learn jQuery, use this epic online school. It's very good and easy for beginners.
I guess yours is wrong to. I think this is what he meant:

But that could select (possibly!) every button which these classes, so you should always look for something unique, Battlelog often does not have Ids, but other things, for example your button has some "data-X" attributes. "data-track='menudropdown.quickmatch'" looks unique, so we use it.