[BF4]Item Unlocker - Better Battlelog Forums #111167

Sitemap
Post edited 8 x times, last by
Topicstarter
I found a way to get this to work. It lets you use any locked emblem item, premium or not.
Edit: problem fixed. It only unlocks emblem items now. This is now my first completely working plugin. :D
What do you think?

https://dl.dropboxusercontent.com/s/y0f3kfgvav44abp/item-unlocker.js


Update: as a way of making it more useful, I made the option to hide locked items. With the current system, if you unlocked an item that is in the middle of the list, you would have to scroll all the way to there in order to select it. Hiding locked items will prevent this. Let me know if it accidentally hides anything else.

Updates
1.3.0
*Removes redundant premium items from the general tab. Premium items are in the premium tab untouched.
1.2.0
*Adds remove locked items feature.
1.1.0
*Fixes other locked item throughout the site being unlocked.
It appears as though the class denoting the 'P' icon on premium shapes isn't being applied... does it only show up for people who don't have premium, perchance?

As a workaround, this does the trick (iterate through the premium tab, removing matches from the general list):
list_premium = $('div.emblem-shapes-wrapper[data-shapes="premium"] img.shape')
list_general = $('div.emblem-shapes-wrapper[data-shapes="all"] img.shape')
list_premium.each(function(a,b) {$('div.emblem-shapes-wrapper[data-shapes="all"] img.shape[data-asset="'+$(this).attr('data-asset')+'"]').remove();});
Post edited 1 x times, last by
Topicstarter
poisonblx wrote:
It appears as though the class denoting the 'P' icon on premium shapes isn't being applied... does it only show up for people who don't have premium, perchance?


I dont know. It seemed to work that way in bf3. Is it not working for you?
And do you have a link for .each ()? I don't know much about that one. :)
GameFreakBoy wrote:
I dont know. It seemed to work that way in bf3. Is it not working for you?
And do you have a link for .each ()? I don't know much about that one. :)


Yep! One of jquery's oft misused little toys:
http://api.jquery.com/jQuery.each/


And yeah, the segregate premium from general feature wasn't working for me, hence my going poking at a way to work around it :) ... all BF4-side, incidentally.
Topicstarter
That should work now. For some reason the icons persisted though. They did this weird bunch up together thing floating off in their own row.