EA's new Battlelog service is pretty awesome. Except when it isn't.
- Auto-retries server join so you don't have to spam the button. To cancel auto-retry, click the "Close" button in the Game Manager error popup.
Remembers and auto-re-applies server browser sorting preference.Fixed!- Automatically selects the first server in the server browser after refreshing or sorting.
- Prevents the server browser from scrolling to the top of the page on refresh.
- Ensures that Com center Online friends starts opened, while Offline friends starts collapsed.
- Possibly other stuff related to server browsing / joining.
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:
- In Chrome: Tools > Extensions
- In Firefox: Greasemonkey > Manage User Scripts
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.
- This is a work in progress.
- Lots of messages are logged to the console. Check it out.
- This has been tested in Firefox 7 (with Greasemonkey) and Chrome 17.
- It works for me.
- Hopefully ESN will fix these issues internally, rendering this script obsolete.
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:
- Install Git for Windows if you don't already have it.
- In Git Bash, run
git clone git://github.com/cowboy/battlelog-hacks.git && cd battlelog-hacks && git submodule init && git submodule update
- Disable the
battlelog-hacks.user.js
userscript / extension. See the "What's a Userscript?" section for more information on this. - Drag
battlelog-hacks-dev.user.js
into the browser and click Ok/Continue/Install as-necessary. - Run
start-webserver.cmd
from thedev
subdirectory. - Edit scripts in the
dev\src
subdirectory. - Reload Battlelog.
- Repeat steps 6-7 ad nauseum. Note that if you add or rename files, you'll need to edit
dev\node\files.js
and kill/restart the webserver (step 5). - Once done, run
build.cmd
from thedev
subdirectory to builddist\battlelog-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 dev\src
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/