PageSourceSearch

https://www.cjf.jus.br/cjf/++resource++brasil.gov.tiles/banner_rotativo.js

js cjf.jus.br collected 2026-10-02 07:04:48 UTC 8,430 bytes, 228 lines download raw bytes

1/*globals window */
2var portalBrasil = {
3  init: function () {
4    this.tileBannerRotativo();
5    this.alturaBannerRotativo();
6  },
7  // Tile Banner Rotativo
8  corrigeAlturaFaixa: function () {
9    if ($(".template-compose #tile_banner_rotativo").length === 0) {
10      var imgBannerRotativo    = $('#tile_banner_rotativo .activeSlide .banner img'),
11        credito              = $('#tile_banner_rotativo .activeSlide .credito'),
12        botoesBannerRotativo = $('#tile_banner_rotativo .button-nav');
13
14      var sobrescrito = $('#tile_banner_rotativo').hasClass('chamada_sobrescrito');
15      if (sobrescrito) {
16        botoesBannerRotativo.css('top',
17                                 imgBannerRotativo.height()         -
18                                 botoesBannerRotativo.height()      +
19                                 (credito ? credito.height() : 0)   -
20                                 18);
21      } else {
22        botoesBannerRotativo.css('top',
23                                 imgBannerRotativo.height()         -
24                                 botoesBannerRotativo.height()      +
25                                 (credito ? credito.height() : 0));
26      }
27    }
28  },
29  tileBannerRotativo: function () {
30    if ($('#tile_banner_rotativo').length > 0) {
31      $('#tile_banner_rotativo .button-nav, .orderTiles .button-nav').on('click focus mouseover', function (e) {
32        e.preventDefault();
33        $("#tile_banner_rotativo li").removeClass('activeSlide');
34        $(this).closest('li').addClass('activeSlide');
35        portalBrasil.corrigeAlturaFaixa();
36      });
37
38      var updateCarrossel = function () {
39        if (($('#tile_banner_rotativo a:hover').length === 0)   &&
40            ($('#tile_banner_rotativo a:focus').length === 0)   &&
41            ($(".template-compose #tile_banner_rotativo").length === 0)) {
42
43          var totalSlides = $("#tile_banner_rotativo li").length;
44
45          if (totalSlides > 1) {
46            var activeSlide       = $('#tile_banner_rotativo li.activeSlide'),
47              activeSlideNumber = parseInt(activeSlide.attr('data-slidenumber'), 10),
48              nextSlideNumber   = (activeSlideNumber % totalSlides) + 1,
49              nextSlide         = $('#banner' + nextSlideNumber);
50
51            activeSlide.removeClass('activeSlide');
52            nextSlide.addClass('activeSlide');
53            portalBrasil.corrigeAlturaFaixa();
54          }
55        }
56        var path = window.location.pathname;
57	if (path.indexOf('/compose') != -1 ){
58                window.setTimeout(updateCarrossel, 400);
59		$('#tile_banner_rotativo img').height('auto');
60	}
61        window.setTimeout(updateCarrossel, 4000);
62      };
63      var path = window.location.pathname;
64       if (path.indexOf('/compose') != -1 ){
65               window.setTimeout(updateCarrossel, 400);
66               $('#tile_banner_rotativo img').height('auto');
67       }
68
69      window.setTimeout(updateCarrossel, 4000);
70    }
71  },
72  resizeAlturaBannerRotativo: function () {
73    if ($(".template-compose #tile_banner_rotativo").length === 0) {
74      var containerBannerRotativo = $('#tile_banner_rotativo'),
75        itemBannerRotativo = $('#tile_banner_rotativo li');
76
77      var sobrescrito = $('#tile_banner_rotativo').hasClass('chamada_sobrescrito');
78
79      // ajusta altura de cada item do banner
80      var bannerMaior = 0;
81
82      itemBannerRotativo.each(function () {
83        var altura = ($(this).find('img')      ? $(this).find('img').height()      : 0)  +
84                     ($(this).find('.credito') ? $(this).find('.credito').height() : 0)  +
85                     ($(this).find('.title')   ? $(this).find('.title').height()   : 0)  +
86                     ($(this).find('.descr')   ? $(this).find('.descr').height()   : 0);
87        if (sobrescrito) {
88          altura = altura - ($(this).find('.title')   ? $(this).find('.title').height()   : 0);
89        }
90        if (bannerMaior < altura) {
91          bannerMaior = altura;
92        }
93      });
94      itemBannerRotativo.css('height', bannerMaior);
95      // ajusta altura do container do banner rotativo (22px = margin bottom default dos tiles)
96      containerBannerRotativo.animate({'height': bannerMaior + 22}, 100, portalBrasil.corrigeAlturaFaixa);
97    }
98  },
99  alturaBannerRotativo: function () {
100    $(window).resize(portalBrasil.resizeAlturaBannerRotativo);
101  }
102};
103
104var portalBrasilCompor = {
105  init: function () {
106    if ($('.template-compose #tile_banner_rotativo').length > 0) {
107      this.removeObjFromTile();
108      this.sortableTileItens();
109    }
110  },
111
112  removeObjFromTile: function () {
113
114    var objPortal = this;
115
116    $("#tile_banner_rotativo a").click(function (e) {
117      e.preventDefault();
118    });
119
120    $("#tile_banner_rotativo .tile-remove-item").remove();
121    $("#tile_banner_rotativo").each(function () {
122      var child = $(this).children('*[data-uid]');
123      child.append("<i class='tile-remove-item'><span class='text'>remove</span></i>");
124    });
125
126    $("#tile_banner_rotativo .tile-remove-item").unbind("click");
127    $("#tile_banner_rotativo .tile-remove-item").click(function (e) {
128      e.preventDefault();
129      var obj = $(this).parent();
130      var uid = obj.attr("data-uid");
131      var tile = obj.parents('.tile');
132
133      tile.find('.loading-mask').addClass('show remove-tile');
134      var tile_type = tile.attr("data-tile-type");
135      var tile_id = tile.attr("id");
136      $.ajax({
137        url: "@@removeitemfromlisttile",
138        data: {'tile-type': tile_type, 'tile-id': tile_id, 'uid': uid},
139        success: function (info) {
140          tile.html(info);
141          objPortal.titleMarkupSetup();
142          tile.find('.loading-mask').removeClass('show remove-tile');
143          return false;
144        }
145      });
146    });
147  },
148
149  titleMarkupSetup: function () {
150    $('#content .tile').each(function () {
151      if ($(this).find('.loading-mask')[0] === undefined) {
152        $(this).append('<div class="loading-mask"/>');
153      }
154    });
155    this.removeObjFromTile();
156  },
157
158  sortableTileItens: function () {
159
160    var objPortal = this;
161
162    $("#tile_banner_rotativo").liveSortable({
163      stop: function (event, ui) {
164        var uids = [];
165
166        $(this).children().each(function (index) {
167          if ($(this).attr("data-uid") !== undefined) {
168            uids.push($(this).attr("data-uid"));
169          }
170        });
171
172        var tile = $(this).closest('.tile'),
173          tile_type = tile.attr("data-tile-type"),
174          tile_id = tile.attr("id");
175
176        $.ajax({
177          url: "@@updatelisttilecontent",
178          data: {'tile-type': tile_type, 'tile-id': tile_id, 'uids': uids},
179          success: function (info) {
180            tile.html(info);
181            objPortal.removeObjFromTile();
182            return false;
183          }
184        });
185      }
186    });
187  }
188};
189
190var politica ={
191
192    init: function () {
193
194	if(localStorage.getItem("showed")==="Sim"){
195
196		return;
197
198	}
199
200        var div1 = document.createElement("div");
201
202        document.getElementsByTagName('body')[0].appendChild(div1);
203
204        div1.outerHTML = '<div id="politica_privacidade" style="display: flex;"><div  style="position: fixed; right: 0;
204  left: 0;  bottom: 0; background-color: #004164; color: #fff; font-size: 14px; display: inline-flex;  padding: 1em 6em 1em 6em; z-index: 99999;"><div id="lgpd-cookie_text"  style="margin: auto;">O Portal do CJF utiliza cookies para auxiliar na sua navegação e melhorar nossos serviços. Ao acessá-lo, você aceita os termos da nossa <a href="https://sei.cjf.jus.br/sei/publicacoes/controlador_publicacoes.php?acao=publicacao_visualizar&id_documento=259680&id_orgao_publicacao=0" target="_blank" style="color: #F5AF00;">política de privacidade</a>.</div><div style="margin: auto;"><button style="color: #004164; background-color: #F5AF00; border: none; border-radius: 5px; padding: 5px 30px 5px 30px; font-weight: 900; font-size: 16px; transition: 0.3s; display: inline-flex; opacity: 0.9; cursor: pointer;" id="btn-politica">Fechar</button></div></div></div>';
205
206
207
208		document.getElementById("btn-politica").addEventListener("click", function (e) {
209
210			e.stopPropagation();
211
212			document.getElementById("politica_privacidade").style.display  = "none";
213
214			localStorage.setItem("showed", "Sim");
215
216        });
217
218	}
219
220}
221$(window).load(function () {
222  if ($('#tile_banner_rotativo').length > 0) {
223    portalBrasil.init();
224    portalBrasilCompor.init();
225    portalBrasil.resizeAlturaBannerRotativo();
226    politica.init();
227  }
228});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.