Created
October 8, 2018 13:34
-
-
Save jeffersonRibeiro/bcc2da2d0eb909d98f28ef33875dff89 to your computer and use it in GitHub Desktop.
remove posição para lista de sistes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Remove banner_slb_topo no período de eleição para páginas com régua de apuração */ | |
(function() { | |
var isElection = false; | |
console.log('[ADS] Eleicao Ativa:', isElection); | |
if( isElection && hasElectionHeader() ) { | |
for(var i = 0; i < desktop_positions_list.length; i++) { | |
if(desktop_positions_list[i].id === 'banner_slb_topo') { | |
desktop_positions_list.splice(i, 1); | |
break; | |
} | |
} | |
} | |
function hasElectionHeader() { | |
var g1 = 'g1.globo.com'; | |
var hostname = window.location.hostname; | |
var pathname = window.location.pathname; | |
if( hostname !== g1 ) { | |
return false; | |
} | |
if( pathname === '/' && hostname === g1 ) { | |
return true; | |
} | |
var url_list = [ | |
'/politica/', | |
'/politica/eleicoes/2018/', | |
'/ac/acre/', | |
'/ac/cruzeiro-do-sul-regiao/', | |
'/al/alagoas/', | |
'/am/amazonas/', | |
'/ap/amapa/', | |
'/ba/bahia/', | |
'/ce/ceara/', | |
'/df/distrito-federal/', | |
'/es/espirito-santo/', | |
'/go/goias/', | |
'/ma/maranhao/', | |
'/mg/centro-oeste/', | |
'/mg/grande-minas/', | |
'/mg/minas-gerais/', | |
'/mg/sul-de-minas/', | |
'/mg/triangulo-mineiro/', | |
'/mg/vales-mg/', | |
'/mg/zona-da-mata/', | |
'/ms/mato-grosso-do-sul/', | |
'/mt/mato-grosso/', | |
'/pa/para/', | |
'/pa/santarem-regiao/', | |
'/pb/paraiba/', | |
'/pe/caruaru-regiao/', | |
'/pe/pernambuco/', | |
'/pe/petrolina-regiao/', | |
'/pi/piaui/', | |
'/pr/campos-gerais-sul/', | |
'/pr/norte-noroeste/', | |
'/pr/oeste-sudoeste/', | |
'/pr/parana/', | |
'/rj/norte-fluminense/', | |
'/rj/regiao-dos-lagos/', | |
'/rj/regiao-serrana/', | |
'/rj/rio-de-janeiro/', | |
'/rj/sul-do-rio-costa-verde/', | |
'/rn/rio-grande-do-norte/', | |
'/ro/ariquemes-e-vale-do-jamari/', | |
'/ro/cacoal-e-zona-da-mata/', | |
'/ro/ji-parana-regiao-central/', | |
'/ro/rondonia/', | |
'/ro/vilhena-e-cone-sul/', | |
'/rr/roraima/', | |
'/rs/rio-grande-do-sul/', | |
'/sc/santa-catarina/', | |
'/se/sergipe/', | |
'/sp/bauru-marilia/', | |
'/sp/campinas-regiao/', | |
'/sp/itapetininga-regiao/', | |
'/sp/mogi-das-cruzes-suzano/', | |
'/sp/piracicaba-regiao/', | |
'/sp/presidente-prudente-regiao/', | |
'/sp/ribeirao-preto-franca/', | |
'/sp/santos-regiao/', | |
'/sp/sao-carlos-regiao/', | |
'/sp/sao-jose-do-rio-preto-aracatuba/', | |
'/sp/sao-paulo/', | |
'/sp/sorocaba-jundiai/', | |
'/sp/vale-do-paraiba-regiao/', | |
'/to/tocantins/', | |
'/al/alagoas/eleicoes/2018/', | |
'/ba/bahia/eleicoes/2018/', | |
'/df/distrito-federal/eleicoes/2018/', | |
'/es/espirito-santo/eleicoes/2018/', | |
'/ma/maranhao/eleicoes/2018/', | |
'/mg/minas-gerais/eleicoes/2018/', | |
'/mg/sul-de-minas/eleicoes/2018/', | |
'/mg/zona-da-mata/eleicoes/2018/', | |
'/pa/para/eleicoes/2018/', | |
'/pa/santarem-regiao/eleicoes/2018/', | |
'/pb/paraiba/eleicoes/2018/', | |
'/pe/pernambuco/eleicoes/2018/', | |
'/pe/petrolina-regiao/eleicoes/2018/', | |
'/pi/piaui/eleicoes/2018/', | |
'/pr/campos-gerais-sul/eleicoes/2018/', | |
'/pr/norte-noroeste/eleicoes/2018/', | |
'/pr/oeste-sudoeste/eleicoes/2018/', | |
'/pr/parana/eleicoes/2018/', | |
'/rj/rio-de-janeiro/eleicoes/2018/', | |
'/rn/rio-grande-do-norte/eleicoes/2018/', | |
'/ro/ariquemes-e-vale-do-jamari/eleicoes/2018/', | |
'/ro/cacoal-e-zona-da-mata/eleicoes/2018/', | |
'/ro/ji-parana-regiao-central/eleicoes/2018/', | |
'/ro/rondonia/eleicoes/2018/', | |
'/ro/vilhena-e-cone-sul/eleicoes/2018/', | |
'/rs/rio-grande-do-sul/eleicoes/2018/', | |
'/sc/santa-catarina/eleicoes/2018/', | |
'/se/sergipe/eleicoes/2018/', | |
'/sp/bauru-marilia/eleicoes/2018/', | |
'/sp/campinas-regiao/eleicoes/2018/', | |
'/sp/itapetininga-regiao/eleicoes/2018/', | |
'/sp/mogi-das-cruzes-suzano/eleicoes/2018/', | |
'/sp/piracicaba-regiao/eleicoes/2018/', | |
'/sp/presidente-prudente-regiao/eleicoes/2018/', | |
'/sp/ribeirao-preto-franca/eleicoes/2018/', | |
'/sp/santos-regiao/eleicoes/2018/', | |
'/sp/sao-carlos-regiao/eleicoes/2018/', | |
'/sp/sao-jose-do-rio-preto-aracatuba/eleicoes/2018/', | |
'/sp/sao-paulo/eleicoes/2018/', | |
'/sp/sorocaba-jundiai/eleicoes/2018/', | |
'/sp/vale-do-paraiba-regiao/eleicoes/2018/', | |
'/to/tocantins/eleicoes/2018/' | |
]; | |
var endWithRegExp = new RegExp(pathname + '$'); | |
for(var i = 0; i < url_list.length; i++) { | |
if(!!url_list[i].match(endWithRegExp)) { | |
return true | |
} | |
} | |
return false; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment