You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
40 KiB

/* Merged Plone Javascript file
* This file is dynamically assembled from separate parts.
* Some of these parts have 3rd party licenses or copyright information attached
* Such information is valid for that section,
* not for the entire composite file
* originating files are separated by - filename.js -
*/
/* - ++resource++config/bootstrap/bootstrap.min.js - */
// https://www12.senado.leg.br/institucional/portal_javascripts/++resource++config/bootstrap/bootstrap.min.js?original=1
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.D
/* - ++resource++config/jquery/18/jquery-configuration.js - */
// https://www12.senado.leg.br/institucional/portal_javascripts/++resource++config/jquery/18/jquery-configuration.js?original=1
var $18=null;try{$18=$} catch(e){}
/* - ++resource++config/js/basic.js - */
////////////////////////////////////////////////////////////////////////////////
// Senado Config
// Basic Javascript
////////////////////////////////////////////////////////////////////////////////
/**
* Request parameter.
* Função para se obter um parâmetro do request.
*
* @param name: request parameter name.
*
* Ex.
*
* var param = getRequest("param");
* if (param) {
* alert(param);
* }
*
*/
function getRequest(name) {
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
return decodeURIComponent(name[1]);
}
/**
* Javascript default parameter.
*
* Only from ES6/ES2015, default parameters is in the language specification.
* Ex. function f(p='') {}
*
* This function simulates the default parameter.
* Ex.
* function f(p) {
* p = defaultParam(p, '');
* }
*/
function defaultParam(arg, defaultValue) {
return typeof arg !== 'undefined' ? arg : defaultValue;
}
/**
* ReplaceAll.
* Replace all ocurrences of string.
*/
function replaceAll(string, searchvalue, newvalue) {
return string.split(searchvalue).join(newvalue);
}
function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
/**
* Format a number.
*/
function formatNumber(number) {
try {
var formated = number.toLocaleString();
if (endsWith(formated,',00') && isInt(number)) { // ie
formated = formated.replace(',00','');
}
return formated;
} catch(e) {
return number;
}
}
/**
* Check if number is integer.
*/
function isInt(n){
return Number(n) === n && n % 1 === 0;
}
/**
* Read cookie.
* @param k - name
*
* Ex.
* readCookie("name")
*/
function readCookie(k,r) {
return(r=RegExp('(^|; )'+encodeURIComponent(k)+'=([^;]*)').exec(document.cookie))?r[2]:null;
}
/**
* Função para carregar um script dinamicamente.
*
* @param src: script path.
* @param callbackFunction: Função que será invocada ao carregar o script.
*/
function scriptDynamicLoad(src, callbackFunction) {
var script = document.createElement('script');
script.setAttribute('src', src);
if (callbackFunction) {
script.onload = function() {
callbackFunction();
};
}
document.getElementsByTagName('head')[0].appendChild(script);
}
/**
* Service Timer.
* Executa uma função com a frequencia determinada pelo timer.
*
* A função 'serviceFunction' deve retornar:
* 'true' para continuar o serviço;
* 'false' para parar o serviço;
*
* @param serviceFunction: Função que será executada pelo serviço.
* @param timerDelay: Frequencia de execução em milisegundos.
*
* Ex. Executar a função 'configCalendar' a cada segundo até chegar o fim de semana.
serviceTimer(configCalendar, 1000);
function configCalendar() {
if (!weekend) {
return true;
}
alert("Weekend!");
return false;
}
*/
function serviceTimer(serviceFunction, timerDelay) {
continueService = serviceFunction();
if (continueService) {
setTimeout(function() {serviceTimer(serviceFunction, timerDelay)}, timerDelay);
}
}
/**
* Função para realizar a pesquisa do plone.
* Copia o texto do parâmetro para o campo de pesquisa do plone e realiza o submit.
* O campo de pesquisa do plone deve estar disponível na página, mesmo que seja oculto.
*
* @param inputPesquisa: Campo de onde será copiado o texto a ser pesquisado.
*/
function realizarPesquisa(inputPesquisa) {
var texto = $(inputPesquisa).val();
$("#portal-searchbox #searchGadget").val(texto);
$("#portal-searchbox form").submit();
}