Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Bring Battlelog Hooahs back!
// ==UserScript==
// @name Bring Battlelog Hooahs back!
// @namespace http://andersevenrud.github.io/
// @version 0.7
// @description You get the old "Hooah" back instead of "Like" (In the Battle Feed!)
// @match http://battlelog.battlefield.com/*
// @updateURL https://gist.github.com/andersevenrud/c4cf8ec40ed25c2ef2cf/raw/bbhooah.user.js
// @downloadURL https://gist.github.com/andersevenrud/c4cf8ec40ed25c2ef2cf/raw/bbhooah.user.js
// @author andersevenrud
// ==/UserScript==
/*
=== INSTALLATION ===
1: Install Greasemonkey (Firefox) or Tampermonkey (Chrome) browser extension.
2: Click the "RAW" button on this gist and it should install automatically
3: Refresh battlelog and it should now work automatically when you browse activity
If it does not install automatically:
1: Go to battlelog, click the browser extension icon and choose to add a new file or script
2: Copy/Paste this file
3: Refresh battlelog and it should now work automatically when you browse the activity
=== NOTES ===
Only works with English. In the "Battle Feed" and "Updates" dropdown.
On a serious note though... I don't care if they changed it. I just did this for the lulz
=== ALSO TAKE A LOOK AT ===
* Better Battlelog Favourite Server Browser
https://gist.github.com/andersevenrud/b49950126c344261ce17
* Better Battlelog Loadout
https://gist.github.com/andersevenrud/d9f3ae140a587106f21d
* Battlelog Server Browser Blacklist
https://gist.github.com/andersevenrud/e275e0b600578bcf6e26
* Fullscreen Battlelog Server Browser (BF4)
https://gist.github.com/andersevenrud/c684dac238b87fdc8bda
*/
(function () {
function hooah() {
$(".feed-like-item a").each(function () {
if (!$(this).hasClass("hooah-custom")) {
$(this).html('<i class="icon hooah"></i>Hooah!');
$(this).addClass("hooah-custom");
}
});
$(".feed-unlike-item a").each(function () {
if (!$(this).hasClass("hooah-custom")) {
$(this).html('<i class="icon hooah"></i>Un-hooah!');
$(this).addClass("hooah-custom");
}
});
$(".feed-story-likes").each(function () {
if (!$(this).hasClass("hooah-custom")) {
$(this).html($(this).html().replace(/ like this/, ' hooahs this'));
$(this).addClass("hooah-custom");
}
});
$(".comcenter-notification").each(function () {
if (!$(this).hasClass("hooah-custom")) {
$(this).html($(this).html().replace(/ likes your/, ' hooahs your'));
$(this).addClass("hooah-custom");
}
});
}
$("#feed-load-more").on("click", function () {
hooah();
});
$("#updates-icon").on("click", function() {
hooah();
});
if ( window.location.href.match(/\/bf4\/?$/) ) {
setTimeout(function() {
hooah();
}, 100);
}
$(document).ajaxComplete(function (ev, resp, req) {
if ( req.url.match(/\/bf4\/?$/) || req.url.match(/^\/bf4\/(updates|like|feed)/) ) {
setTimeout(function() {
hooah();
}, 100);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment