Commit 47dd70fd4da20b708ef60ce3f68b4ebd0a4d02ba
1 parent
edcec464
Exists in
master
and in
5 other branches
refactored code
Showing
1 changed file
with
19 additions
and
30 deletions
Show diff stats
theme.js
1 | -function igualarBlocos(cc){ | |
2 | - try{ | |
3 | - este = this; | |
4 | - jt = jQuery(este); | |
5 | - maisComprido = 0; | |
6 | - maisCurto = 99999; | |
7 | - jQuery(este).find(".block-outer").each(function () { | |
8 | - if(jQuery(this).height() > maisComprido) | |
9 | - maisComprido = jQuery(this).height(); | |
10 | - if(jQuery(this).height() < maisCurto) | |
11 | - maisCurto = jQuery(this).height(); | |
12 | - }); | |
13 | - var inner1= jQuery(este).find(".block-inner-1"); | |
14 | - if(cc!=0){ | |
15 | - jQuery(inner1).each(function (){ jQuery(this).height(maisComprido)}); | |
16 | - jQuery(este).closest(".block-outer").height(jQuery(este).height() + maisComprido - maisCurto + 70 ); | |
17 | - }else{ | |
18 | - //Iguala os inner 2 ao inner 1 | |
19 | - jt.find(".block-inner-1 .block-inner-2").each(function (idx) { | |
20 | - if(idx==2) | |
21 | - jQuery(this).height(315); | |
22 | - }); | |
23 | - } | |
24 | - }catch(err){} | |
1 | +function alignBlocks(containerIndex){ | |
2 | + //Needed to save the original reference to jQuery(this) | |
3 | + jt = jQuery(this); | |
4 | + longerBlock = 0; | |
5 | + jt.find(".block-outer").each(function () { | |
6 | + if(jQuery(this).height() > longerBlock) | |
7 | + longerBlock = jQuery(this).height(); | |
8 | + }); | |
9 | + //Aligns the blocks in the most common situations | |
10 | + jt.find(".block-outer").height(longerBlock); | |
11 | + //Only used for blocks with video, since it uses the size of the iframe | |
12 | + if(jt.find("iframe").length > 0){ | |
13 | + jt.find(".block-inner-1 .block-inner-2").each(function (idx) { | |
14 | + if(idx==2){ | |
15 | + jQuery(this).height(jt.find("iframe").height()); | |
16 | + } | |
17 | + }); | |
18 | + } | |
25 | 19 | } |
26 | 20 | |
27 | 21 | (function($) { |
... | ... | @@ -41,18 +35,13 @@ function igualarBlocos(cc){ |
41 | 35 | $( ".profile-image" ).prepend( "<span class='helper'></span>" ); |
42 | 36 | //insere a mensagem no bloco de trilhas na página inicial// |
43 | 37 | $( ".action-home-index #content .community-track-plugin_track-card-list-block .track_list" ).prepend( "<span class='msg_block'>Construa seu caminho de participação na elaboração de políticas públicas...</span>" ); |
44 | - | |
45 | 38 | //insere a mensagem no bloco de comunidades na página inicial// |
46 | 39 | $( ".action-home-index #content .communities-block .block-inner-2>div" ).prepend( "<span class='msg_block'>Participe dos dialogos entre governo e sociedade em comunidades temáticas...</span>" ); |
47 | - | |
48 | 40 | $( ".action-home-index #content .communities-block .block-inner-2>div.block-footer-content .msg_block" ).remove(); |
49 | - | |
50 | 41 | //Alinha os blocos do tipo container lado a lado |
51 | - $('.container-block-plugin_container-block').each(igualarBlocos); | |
52 | - | |
42 | + $('.container-block-plugin_container-block').each(alignBlocks); | |
53 | 43 | })(jQuery); |
54 | 44 | |
55 | - | |
56 | 45 | (function(){var e='<div id="wrapper-barra-brasil"><div class="brasil-flag"><a href="http://brasil.gov.br" class="link-barra">Brasil</a></div><span class="acesso-info"><a href="http://brasil.gov.br/barra#acesso-informacao" class="link-barra">Acesso à informação</a></span><ul class="list"><li class="list-item first"><a href="http://brasil.gov.br/barra#participe" class="link-barra">Participe</a></li><li class="list-item"><a href="http://www.servicos.gov.br/" class="link-barra">Serviços</a></li><li class="list-item"><a href="http://www.planalto.gov.br/legislacao" class="link-barra">Legislação</a></li><li class="list-item last last-item"><a href="http://brasil.gov.br/barra#orgaos-atuacao-canais" class="link-barra">Canais</a></li></ul></div>',t,n,r,i,s,o,u;n=document.getElementById("barra-brasil"),n&&n.parentNode.removeChild(n),r=document.getElementsByTagName("head")[0],t=document.getElementsByTagName("body")[0],o=document.createElement("link"),i=document.createAttribute("href"),u=document.createElement("div"),s=document.createAttribute("id"),s.nodeValue="barra-brasil",u.setAttributeNode(s),u.innerHTML=e,t.insertBefore(u,t.childNodes[0]),window._barrabrasil={insere_css:function(e){var t,n,i;return n=document.createElement("style"),i=document.createAttribute("type"),i.nodeValue="text/css",t=document.createAttribute("media"),t.nodeValue="all",n.setAttributeNode(i),n.setAttributeNode(t),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e)),r.appendChild(n)}};var r,a,f,l;r=document.getElementsByTagName("head")[0],a=document.createElement("script"),l=document.createAttribute("type"),l.nodeValue="text/javascript",f=document.createAttribute("src"),f.nodeValue="https://coletajavascript.serpro.gov.br/estatistica.js",a.setAttributeNode(l),a.setAttributeNode(f),r.appendChild(a)})(),window._barrabrasil.insere_css('#barra-brasil div,#barra-brasil a,#barra-brasil ul,#barra-brasil li{margin:0;padding:0;border:0;font-size:100%;font-family:inherit;vertical-align:baseline}#barra-brasil ul{list-style:none}@font-face{font-family:"Open Sans";font-style:normal;font-weight:700;src:local("Open Sans Bold"),local("OpenSans-Bold"),url("https://themes.googleusercontent.com/static/fonts/opensans/v6/k3k702ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woff") format("woff")}#barra-brasil{height:32px;background:#f1f1f1;font-weight:bold;font-size:12px;line-height:32px;font-family:"Open Sans",Arial,Helvetica,sans-serif}#barra-brasil a{text-decoration:none}div#wrapper-barra-brasil{position:relative;overflow:hidden;margin:0 auto;width:100%;max-width:960px}#barra-brasil .brasil-flag{float:left;padding:7px 0 6px;width:115px;height:19px;border-right:2px solid #dfdfdf}#barra-brasil .brasil-flag .link-barra{display:block;padding-left:42px;width:43px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAATCAIAAAABJ4pRAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABINJREFUeNqUVFtsFFUYPrfdmdnLbLe021baQqWUtdJKL5QiASPiNVqC0TYqUWLShJQmRH3RqPHFRKJvQqIPQNSAAcMDptGEiKjYpLZIkSqGXqjdFlppd3vb7c7Ozpxz/M+2wZD44snszOzJnP//vv///g9XnNiXtNISI1gYq4eUEu4CC7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MQuXlARShxuvPbt+3k0gx9GMsDVp0c7emq8nSiSFjzkVlCuKfHl+Q0aQai21Gb4E7SA59wDWGLLBg+Kk6/lqrKw/4dtWOLfKn/74+r2t3fVX5/IwcyExIBAKFFWOhskyWVx4tG3GmUfKCFRbOHYBNjiC6hBkBTrQRl+mSLeHZkOYOXeMRxIFCb6SME5gYJiGvH7MPn0q5wBCgqkgF4xBEVfdhksTyMmNpFT/chJQJQbkgitE8o73gRe4HsRYe/RJy86IFYtU1pVzSqxC/J8F5fMz/z8CDAAkCSSg0qSX5AAAAABJRU5ErkJggg==") 8px center no-repeat;text-transform:uppercase;line-height:19px}#barra-brasil .acesso-info{position:absolute;left:130px}#barra-brasil .list{position:absolute;top:0;right:0}#barra-brasil .list .first{border-left:2px solid #dfdfdf}#barra-brasil .list-item{display:inline-block;padding:0 15px 0 13px;height:32px;border-right:2px solid #dfdfdf}#barra-brasil .link-barra{color:#606060}@media screen and (max-width: 668px){#barra-brasil .list{top:-100px}}@media screen and (min-width: 960px){#wrapper-barra-brasil{width:960px}}'); |
57 | 46 | |
58 | 47 | ... | ... |