Skip to content

Instantly share code, notes, and snippets.

@epexa
Last active June 29, 2016 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epexa/e4c7c7870d2b3d4f4314404497c16bdf to your computer and use it in GitHub Desktop.
Save epexa/e4c7c7870d2b3d4f4314404497c16bdf to your computer and use it in GitHub Desktop.
cleaner.js
/**
* Cleaner - remove useless elements
* based on Additional Enhancements by XjSv
*
* @author Epexa
* @version 1.0.0
* @url https://gist.githubusercontent.com/Epexa/e4c7c7870d2b3d4f4314404497c16bdf/raw
* @last-edit 06.29.2016 15:40
*/
BBLog.handle('add.plugin', {
id : 'cleaner',
name : 'Cleaner - remove useless elements',
configFlags : [
['option.remove-forum-closed-message', 0],
['option.remove-buy-battlepacks', 0],
['option.remove-buy-hardline', 0],
['option.remove-cookiebar', 0],
['option.remove-store-premium-links', 0],
['option.remove-footer-logos-links', 0],
['option.remove-side-bar', 0],
['option.remove-comcenter', 0],
['option.remove-tiles', 0],
],
translations : {
'en' : {
'option.remove-forum-closed-message' : 'Remove the old forum closed message in top page',
'option.remove-forum-closed-message.tooltip' : 'Remove the message "WE HAVE NOW SUNSET THE BATTLELOG FORUMS. YOU CAN CONTINUE YOUR DISCUSSIONS ON OUR NEW FORUMS AT HTTP://FORUMS.BATTLEFIELD.COM"',
'option.remove-buy-battlepacks' : 'Remove the "BUY BATTLEPACKS" box in the Battlepacks page',
'option.remove-buy-battlepacks.tooltip' : 'Removes the "BUY BATTLEPACKS" box above the "UPCOMING RANK BATTLEPACKS" box in the Battlepacks page.',
'option.remove-tiles' : 'Remove the tiles below the "TOP STORY" in the landing page',
'option.remove-tiles.tooltip' : 'Removes the tiles below the "TOP STORY" in the landing page (battlelog.battlefield.com/bf4/).',
'option.remove-side-bar' : 'Remove the right sidebar in the landing page',
'option.remove-side-bar.tooltip' : 'Removes the right sidebar in the landing page (battlelog.battlefield.com/bf4/) and expands the battle feed.',
'option.remove-buy-hardline' : 'Remove Battlefield Hardline Ad (BUY NOW) in the landing page',
'option.remove-buy-hardline.tooltip' : 'Removes Battlefield Hardline advertisement (BUY NOW) in the landing page (battlelog.battlefield.com/bf4/).',
'option.remove-comcenter' : 'Remove the Com Center panel on the right',
'option.remove-comcenter.tooltip' : 'Removed the Com Center on the right of all BF4 Battlelog Pages and widens the Top bar.',
'option.remove-cookiebar' : 'Remove the EU Cookie Agreement Bottom bar entirely',
'option.remove-cookiebar.tooltip' : 'Removes the Cookie Agreement Bar at the bottom of the page entirely (including the close button thing)',
'option.remove-store-premium-links' : 'Remove the "STORE" and "PREMIUM" links',
'option.remove-store-premium-links.tooltip' : 'Remove the "STORE" and "PREMIUM" links',
'option.remove-footer-logos-links' : 'Remove the logos and links from footer',
'option.remove-footer-logos-links.tooltip' : 'Remove the logos and links from footer',
},
'de' : {
'option.remove-forum-closed-message' : 'Entfernen Tkhe Old Forum klosed messagi Ying Top Pag',
'option.remove-forum-closed-message.tooltip' : 'Entfernen te messagi VE Javea NEU SUNSET TE BATTLELOG Foren. Yu SAN Continuo IOP Diskussions OH UR HEB FORUMS AT NTTP: //FORUMA.BATTLEFIELD.CHUT',
'option.remove-buy-battlepacks' : 'Entferne "Battlepacks kaufen" von Battlepack Seite',
'option.remove-buy-battlepacks.tooltip' : 'Entfernt die "Battlepack kaufen" Box von der Battlepack Seite.',
'option.remove-tiles' : 'Entferne die Boxen unter der Top Story',
'option.remove-tiles.tooltip' : 'Entfernt die Boxen (Empfohlener Server, Platoon, Missionen etc.) von der Startseite (battlelog.battlefield.com/bf4/).',
'option.remove-side-bar' : 'Entferne rechte Seitenleiste auf der Startseite',
'option.remove-side-bar.tooltip' : 'Entfernt die rechte Seitenleiste auf der Startseite und verbreitert den Battlefeed.',
'option.remove-buy-hardline' : 'Entferne Hardline Werbung',
'option.remove-buy-hardline.tooltip' : 'Entfernt den "Hardline kaufen" Werbeblock von der Startseite (battlelog.battlefield.com/bf4/).',
'option.remove-comcenter' : 'Entferne Com Center',
'option.remove-comcenter.tooltip' : 'Entfernt das ComCenter am rechten Bildschirmrand auf allen (BF4) Seiten im Battlelog und passt die Breite an.',
'option.remove-cookiebar' : 'Entferne Cookie Zustimmung',
'option.remove-cookiebar.tooltip' : 'Entfernt die Cookie Zustimmungsleiste am unteren Bildschirmrand komplett.'
},
},
clearElements: function(instance) {
var mode = BBLog.cache('mode');
if (window.location.pathname.substr(0, 5) == '/bf4/') var bf4Url = true; else var bf4Url = false;
instance.removeForumClosedMessage(instance);
instance.removeComCenter(instance);
instance.removeCookieBar(instance);
if (mode != 'mohw') {
instance.removeStorePremiumLinks(instance, bf4Url);
}
if (mode == 'bf4') {
instance.removeBuyBattlePacks(instance);
instance.removeTiles(instance, bf4Url); // only bf4
instance.removeSideBar(instance, bf4Url);
instance.removeBuyHardline(instance, bf4Url);
instance.removeFooterLogosLinks(instance);
}
},
init: function(instance) {
instance.clearElements(instance);
},
domchange: function(instance) {
instance.clearElements(instance);
},
removeForumClosedMessage: function(instance) {
if (instance.storage('option.remove-forum-closed-message') && $('#sitenotice966').length > 0) {
$('#sitenotice966').remove();
}
},
removeBuyBattlePacks: function(instance) {
var url = window.location.href;
if (instance.storage('option.remove-buy-battlepacks') && url.match(/\/battlepacks\//) && $('.battlepacks-buypacks').length > 0) {
$('.battlepacks-buypacks').remove();
}
},
removeTiles: function(instance, bf4Url) {
if (instance.storage('option.remove-tiles') && bf4Url && $('#bottom-tiles').length > 0) {
$('#bottom-tiles').remove();
}
},
removeSideBar: function(instance, bf4Url) {
if (instance.storage('option.remove-side-bar') && bf4Url && $('.base-middle-content, .main-side-column').length > 0) {
var battleFeed = $('.base-middle-content .span8');
if ($(battleFeed).hasClass('span8')) $(battleFeed).removeClass('span8').addClass('span12');
$('.main-side-column').remove();
}
},
removeBuyHardline: function(instance, bf4Url) {
if (instance.storage('option.remove-buy-hardline') && bf4Url && $('#main-header .get-bfh-tile').length > 0) {
$('#main-header .get-bfh-tile').remove();
}
},
removeComCenter: function(instance) {
if (instance.storage('option.remove-comcenter') && $('#comcenter_container').length > 0) {
$('#comcenter_container').remove();
$('#base-header').css('right', 0);
$('#viewport').css('padding-right', 0);
}
},
removeCookieBar: function(instance) {
if (instance.storage('option.remove-cookiebar') && $('#cookie-preferences').length > 0) {
$('#cookie-preferences').remove();
}
},
removeStorePremiumLinks: function(instance, bf4Url) {
if (instance.storage('option.remove-store-premium-links') && $('#base-header-secondary-nav').length > 0) {
$('#base-header-secondary-nav ul').find('li[data-page="odcstore"], li[data-page="premium"]').remove();
if (bf4Url) $('#bottom-tiles > .tiles > .premium').remove();
}
},
removeFooterLogosLinks: function(instance) {
if (instance.storage('option.remove-footer-logos-links')) {
if ($('#footer-logos').length > 0) $('#footer-logos').remove();
if ($('#footer-links').length > 0) $('#footer-links').remove();
$('#footer-wrapper').css({'height': 49, 'bottom': -49});
$('#footer-legal').css('border-top', 'none');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment