EA's new Battlelog service is pretty awesome. Except when it isn't.
If you're using Firefox, make sure you have the Greasemonkey add-on installed first.
Note: If you were using the original gist version, uninstall that first. See the "What's a Userscript?" section of this document for more information about managing userscripts.
To install, click this userscript, then click Ok/Continue/Install in any browser confirmation dialogs that pop up. Once installed, reload the Battlelog webpage. You should see a little blue message in the top left of Battlelog confirming that Battlelog Hacks has been loaded.
Userscripts are a convenient way to be able to add extra functionality to webpages. Chrome has native support for userscripts as Extensions, and Firefox supports userscripts via the Greasemonkey add-on.
To manage userscripts:
Once the userscript has been installed, changes to the main script file will automatically load whenever it's updated. Just reload the Battlelog webpage to get the latest version.
And for what it's worth, I've spent a LOT of time in the WebKit inspector, setting breakpoints, monkey-patching methods, tracing through call stacks, etc. I've seen things done in JavaScript that have made my head spin and are going to keep me up at night for years to come. If this script makes your life easier, I'd appreciate a modest donation. It'll help pay for the therapist I'm going to need.
Running in "development" mode:
git clone git://github.com/cowboy/battlelog-hacks.git && cd battlelog-hacks && git submodule init && git submodule update
battlelog-hacks.user.js
userscript / extension. See the "What's a Userscript?" section for more information on this.battlelog-hacks-dev.user.js
into the browser and click Ok/Continue/Install as-necessary.start-webserver.cmd
from the dev
subdirectory.devsrc
subdirectory.devnodefiles.js
and kill/restart the webserver (step 5).build.cmd
from the dev
subdirectory to build distbattlelog-hacks.js
.Remember that once you're done developing, you'll need to disable battlelog-hacks-dev.user.js
and re-enable battlelog-hacks.user.js
. Or just leave the webserver running, always.
In lieu of a formal styleguide, take care to maintain the existing coding style. Issue a pull request when done. Found a bug? File an issue.
Also, please don't edit files in the "dist" subdirectory as they are generated via build.cmd
. You'll find source code in the devsrc
subdirectory!
10/30/2011 Initial release. Not even a version number.
10/30/2011 v0.1.1 Adding "development" web server and userscript. Auto-retry join errors are now whitelisted, to avoid auto-retrying in certain situations (like when kicked from a server). Version number is announced in a little blue box upon start.
10/31/2011 v0.2.0 Split source into sub-files. Broke the hooking stuff out into JavaScript Hooker, included as a submodule. Created a build tool and updated the dev web server.
11/4/2011 v0.3.0 Removed server browser re-sort code (which has been implemented natively). Automatically selects the first server in the server browser after refreshing or sorting.
11/6/2011 v0.3.1 Updated JavaScript Hooker. Now remembers Com center friends list state. Updated Server join auto-retry error list. Streamlined development process slightly.
11/6/2011 v0.3.2 Bugfix: When the server list is refreshed or sorted, the first server is now both highlighted AND selected (it was only getting highlighted).
11/8/2011 v0.3.3 Com center online friends now default to shown, while offline friends default to hidden.
2/26/2011 v0.3.4 Com center online friends are always shown by default, while offline friends are always hidden by default.
Copyright (c) 2012 "Cowboy" Ben Alman
Licensed under the MIT license.
http://benalman.com/about/license/