[plonegov-br] Barra Gov e coleta de estatísticas do SERPRO
Felipe Duardo
felipeduardo em gmail.com
Sexta Fevereiro 28 17:20:34 BRT 2014
Eu também acho a forma como essa barra foi desenvolvida um pouco
precária...
e já tivemos vários problemas com ela, por exemplo, e-mag e as boas
praticas de acessibilidade,
dizem que os primeiros link deve ser o salto para o conteúdo e navegação,
mas esse js não deixa fazer isso...
2014-02-28 16:54 GMT-03:00 Charles Henrique <charleshenrique em pgr.mpf.gov.br>
:
> Nunca precisei usar nenhum componente do PloneGov e/ou afins, mas se eu
> precisar observarei o código fonte antes de usar. Agradeço pela observação
> do colega Bruno.
>
> Eis o código do barra.brasil.gov.br/barra.js formatado.
>
> __serpro_estatisticas_corporativa__ = __srp_est_corp = {
> carregado: false,
> idUsuario: "",
> idVisita: "",
> constantes: {
> dominioGIFTransparente: "coletajavascript.serpro.gov.br/",
> caminhoGIFTransparente: "default.aspx",
> parametros: {
> dominio: "dominio",
> infoMonitor: "monitor",
> sistemaOperacional: "so",
> navegador: "navegador",
> plugins: "plugins",
> evitarCache: "_",
> versao: "versao",
> novaVisita: "novavisita",
> novaVisitaDia: "novavisitadia",
> novaVisitaMes: "novavisitames",
> novaVisitaAno: "novavisitaano",
> userId: "userid",
> origem: "origem",
> horaAcesso: "horaacesso",
> horaSaida: "horasaida",
> visitaId: "visitaid",
> termoBuscaExterna: "termo"
> },
> versao: "4.0"
> },
> obterDominio: function (url) {
> if (!url) return null;
> var matches = url.match(/:\/\/([0-9a-zA-Z\.\-:]+)/);
> return matches ? matches[1] : null
> },
> obterCaminho: function (url) {
> if (!url) throw new Error("URL n\u00e3o pode ser vazia nem nula.");
> var re = new RegExp("\\S+?://\\S+?(/[^?]*)"),
> partes = re.exec(url);
> return partes ? partes[1] : "/"
> },
> obterDominioAtual: function () {
> return document.location.host || document.domain
> },
> obterProtocolo: function () {
> var protocolo =
> window.location.protocol || location.protocol;
> return protocolo !== "https:" ? "http:" : protocolo
> },
> gerarGuid: function () {
> var S4 = function () {
> return ((1 + Math.random()) * 65536 |
> 0).toString(16).substring(1)
> };
> return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" +
> S4() + S4() + S4()
> },
> concatenarQueryStrings: function (qs1, qs2) {
> return qs1 && qs2 ? qs1 + "&" + qs2 : qs1 || (qs2 || "")
> },
> agendarParaExecutarAoConcluirCargaDOM: function (callback) {
> var DOMContentLoaded, toplevel = false;
> if (document.addEventListener) DOMContentLoaded = function () {
> document.removeEventListener("DOMContentLoaded",
> DOMContentLoaded, false);
> callback()
> };
> else if (document.attachEvent) DOMContentLoaded = function () {
> if (document.readyState === "complete") {
> document.detachEvent("onreadystatechange",
> DOMContentLoaded);
> callback()
> }
> };
>
> function doScrollCheck() {
> if (__srp_est_corp.carregado) return;
> try {
> document.documentElement.doScroll("left")
> } catch (e) {
> setTimeout(doScrollCheck, 1);
> return
> }
> callback()
> }
> if (document.readyState === "complete") callback();
> if (document.addEventListener) {
> document.addEventListener("DOMContentLoaded",
> DOMContentLoaded,
> false);
> window.addEventListener("load", callback, false)
> } else if (document.attachEvent) {
> document.attachEvent("onreadystatechange", DOMContentLoaded);
> window.attachEvent("onload", callback);
> try {
> toplevel = window.frameElement === null
> } catch (e) {}
> if (document.documentElement.doScroll && toplevel)
> doScrollCheck()
> }
> },
> obterDataCookieDuracao: function (agora) {
> agora = agora || new Date;
> return new Date(agora.setMinutes(agora.getMinutes() + 30))
> },
> obterDataInicioDiaSeguinte: function (agora) {
> agora = agora || new Date;
> var data = new Date(agora.getFullYear(),
> agora.getMonth(), agora.getDate(), 0, 0, 0, 0);
> data.setDate(data.getDate() + 1);
> return data
> },
> obterDataInicioMesSeguinte: function (agora) {
> agora = agora || new Date;
> var data = new Date(agora.getFullYear(), agora.getMonth(),
> agora.getDate(), 0, 0, 0, 0),
> mesInicial = data.getMonth();
> if (data.getDate() < 27) data.setDate(27);
> while (mesInicial === data.getMonth()) data.setDate(data.getDate()
> + 1);
> data.setDate(1);
> return data
> },
> obterDataInicioAnoSeguinte: function (agora) {
> agora = agora || new Date;
> return new Date(agora.getFullYear() + 1, 0, 1, 0, 0,
> 0, 0)
> },
> elementoEstaNoArray: function (array, elemento) {
> var i;
> for (i = 0; i < array.length; i++)
> if (array[i] === elemento) return true;
> return false
> },
> adicionarSeNaoExistir: function (array, elemento) {
> var estaNoArray = __srp_est_corp.elementoEstaNoArray(array,
> elemento);
> if (!estaNoArray) array.push(elemento);
> return estaNoArray
> },
> diferencaArrays: function (array1, array2) {
> var diferenca = [],
> i, e;
> for (i = 0; i < array1.length; i++) {
> e = array1[i];
> if (!__srp_est_corp.elementoEstaNoArray(array2, e))
> diferenca.push(e)
> }
> return diferenca
> },
> adicionarElementos: function (array,
> elementos) {
> if (!("push" in array)) throw new TypeError("array must be an
> array");
> if (!("length" in elementos)) throw new TypeError("elementos must
> be an array");
> for (var i = 0; i < elementos.length; i++) array.push(elementos[i])
> },
> obterPropriedade: function (obj, propriedade, valorPadrao) {
> if (!obj.hasOwnProperty(propriedade)) obj[propriedade] =
> valorPadrao;
> return obj[propriedade]
> },
> caminhoParaDomID: function (caminho) {
> if (!caminho) return caminho;
> var caractere, regexpPrimeiroChar = /[A-Za-z_\.\-]/,
> regexpOutrosChar = /[A-Za-z_\.\-0-9]/,
> id = "",
> i;
> for (i = 0; i < caminho.length; i++) {
> caractere = caminho.charAt(i);
> id += regexpOutrosChar.test(caractere) ? caractere :
> caminho.charCodeAt(i).toString()
> }
> return regexpPrimeiroChar.test(id.charAt(0)) ? id : "_" + id
> },
> obterElemento: function (array, indice) {
> return array[(indice < 0 ? array.length : 0) + indice]
> },
> eSufixo: function (s, sufixo) {
> if (!s || !sufixo) return false;
> return s.slice(-sufixo.length) === sufixo
> },
> queryStringParaDicionario: function (qs) {
> if (qs.length === 0) return {};
> var partes = qs.split("&"),
> dic = {}, nomeValor;
> for (var i = 0; i <
> partes.length; i++) {
> nomeValor = partes[i].split("=");
> dic[nomeValor[0]] = nomeValor[1] || ""
> }
> return dic
> },
> extrairParametroQueryString: function (qs, parametro) {
> if (qs === null || !parametro) throw new Error("Par\u00e2metros
> n\u00e3o podem ser nulos.");
> var qsDict = __srp_est_corp.queryStringParaDicionario(qs);
> if (parametro in qsDict) return qsDict[parametro];
> return null
> },
> Plugins: {
> detectarPluginMimeType: function (mimeType) {
> if (navigator.mimeTypes && navigator.mimeTypes.length) {
> mimeType = navigator.mimeTypes[mimeType];
> return Boolean(mimeType &&
> mimeType.enabledPlugin)
> }
> return false
> },
> FlashDetect: {
> nome: "Flash",
> versao: null,
> detectar: function () {
> var ver = this.getSwfVer();
> if (ver) {
> this.versao = ver.replace("WIN ", "").replace(",",
> ".").split(".")[0];
> return true
> }
> return false
> },
> controlVersion: function controlVersion() {
> var version, axo;
> try {
> axo = new ActiveXObject("ShockwaveFlash.
> ShockwaveFlash.7");
> version = axo.GetVariable("$version")
> } catch (e) {}
> if (!version) try {
> axo = new ActiveXObject("ShockwaveFlash.
> ShockwaveFlash.6");
> version = "WIN 6,0,21,0";
> axo.AllowScriptAccess =
> "always";
> version = axo.GetVariable("$version")
> } catch (e2) {}
> if (!version) try {
> axo = new ActiveXObject("ShockwaveFlash.
> ShockwaveFlash.3");
> version = axo.GetVariable("$version")
> } catch (e3) {}
> if (!version) try {
> axo = new ActiveXObject("ShockwaveFlash.
> ShockwaveFlash.3");
> version = "WIN 3,0,18,0"
> } catch (e4) {}
> if (!version) try {
> axo = new ActiveXObject("ShockwaveFlash.
> ShockwaveFlash");
> version = "WIN 2,0,0,11"
> } catch (e5) {
> version = -1
> }
> return version
> },
> getSwfVer: function () {
> var userAgent = navigator.userAgent,
> isIE = navigator.appVersion.indexOf("MSIE") !== -1,
> isWin = navigator.appVersion.toLowerCase().indexOf("win")
> !== -1,
> isOpera = userAgent.indexOf("Opera") !== -1,
> flashVer = -1,
> swVer2, flashDescription, descArray, tempArrayMajor,
> versionMajor, versionMinor, versionRevision;
> if (navigator.plugins !== null && navigator.plugins.length
> > 0) {
> if (navigator.plugins["Shockwave Flash 2.0"] ||
> navigator.plugins["Shockwave Flash"]) {
> swVer2 = navigator.plugins["Shockwave Flash 2.0"]
> ? " 2.0" : "";
> flashDescription = navigator.plugins["Shockwave
> Flash" + swVer2].description;
> descArray = flashDescription.split(" ");
> tempArrayMajor = descArray[2].split(".");
> versionMajor = tempArrayMajor[0];
> versionMinor = tempArrayMajor[1];
> versionRevision = descArray[3];
> if (versionRevision === "") versionRevision =
> descArray[4];
> if (versionRevision[0] === "d") versionRevision =
> versionRevision.substring(1);
> else if (versionRevision[0] === "r") {
> versionRevision = versionRevision.substring(1);
> if (versionRevision.indexOf("d") > 0)
> versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"))
> }
> flashVer = versionMajor + "." + versionMinor + "."
> + versionRevision
> }
> } else if (userAgent.toLowerCase().indexOf("webtv/2.6")
> !== -1) flashVer = 4;
> else if (userAgent.toLowerCase().indexOf("webtv/2.5") !==
> -1) flashVer = 3;
> else if (userAgent.toLowerCase().indexOf("webtv") !== -1)
> flashVer = 2;
> else if (isIE && (isWin && !isOpera)) flashVer =
> this.controlVersion();
> return flashVer
> }
> },
> JavaDetect: {
> nome: "Java",
> versao: null,
> detectar: function () {
> return typeof navigator.javaEnabled !== "undefined" &&
> navigator.javaEnabled()
> }
> },
> GearsDetect: {
> nome: "Gears",
> versao: null,
> detectar: function () {
> return typeof window.GearsFactory === "function"
> }
> },
> PDFDetect: {
> nome: "PDF",
> versao: null,
> detectar: function () {
> return __srp_est_corp.Plugins.detectarPluginMimeType("
> application/pdf")
> }
> },
> QuickTimeDetect: {
> nome: "QuickTime",
> versao: null,
> detectar: function () {
> return __srp_est_corp.Plugins.
> detectarPluginMimeType("video/quicktime")
> }
> },
> WMPDetect: {
> nome: "WindowsMediaPlayer",
> versao: null,
> detectar: function () {
> return __srp_est_corp.Plugins.detectarPluginMimeType("
> application/x-mplayer2")
> }
> },
> RealPlayerDetect: {
> nome: "RealPlayer",
> versao: null,
> detectar: function () {
> return __srp_est_corp.Plugins.
> detectarPluginMimeType("audio/x-pn-realaudio-plugin")
> }
> },
> SilverlightDetect: {
> nome: "Silverlight",
> versao: null,
> detectar: function () {
> return __srp_est_corp.Plugins.detectarPluginMimeType("
> application/x-silverlight")
> }
> },
> PluginDetect: {
> mapaPlugins: {},
> init: function () {
> var i, pluginDetect, plugin, plugins =
> [__srp_est_corp.Plugins.FlashDetect, __srp_est_corp.Plugins.JavaDetect,
> __srp_est_corp.Plugins.GearsDetect, __srp_est_corp.Plugins.PDFDetect,
> __srp_est_corp.Plugins.QuickTimeDetect, __srp_est_corp.Plugins.WMPDetect,
> __srp_est_corp.Plugins.RealPlayerDetect, __srp_est_corp.Plugins.
> SilverlightDetect];
> for (i = 0; i < plugins.length; i++) {
> pluginDetect = plugins[i];
> try {
> plugin = {
> disponivel: pluginDetect.detectar(),
> nome: pluginDetect.nome,
> versao: pluginDetect.versao
> }
> } catch (e) {
> continue
> }
> this.mapaPlugins[plugin.nome] = plugin
> }
> }
> }
> },
> Cookie: {
> obter: function Cookie(nome) {
> if (!nome || typeof nome !== "string") throw new
> TypeError("Nome deve ser string n\u00e3o vazia.");
> var cookies = document.cookie.split("; "),
> par, i, valorCookie;
> for (i = 0; i < cookies.length; i++) {
> valorCookie = cookies[i];
> par = valorCookie.indexOf("=") > 0 ?
> valorCookie.split("=") : [valorCookie, ""];
> if (nome === par[0]) return unescape(par[1])
> }
> return null
> },
> definir: function (nome, valor, expiracao) {
> if (!nome || !(typeof nome === "string")) throw new
> TypeError("nome deve ser string n\u00e3o vazia.");
> if (typeof valor !== "string") throw new TypeError("valor deve
> ser string.");
> if (expiracao && !(expiracao instanceof Date)) throw new
> TypeError("expiracao deve ser Date ou null.");
> var valorExpiracao = !expiracao ? "" : ";expires=" +
> expiracao.toGMTString();
> document.cookie = nome + "=" + escape(valor) + valorExpiracao +
> ";path=/"
> }
> },
> Serializador: function () {
> this.regexpIdentificadorJS = /^[A-z_\$][A-z_0-9]*$/;
> this.regexpValidacao = /^{.*}$/;
> this.regexpsSeguranca = [/function\s*\(.*\)/, /eval\s*\(.*\)/,
> /submit\s*\(.*\)/, /.\s*location\s*=/, /.\s*href\s*=/, /["\n;]/];
> this.serializar = function (_obj) {
> var i, key, str, len, val, parts;
> switch (typeof _obj) {
> case "number":
> case "boolean":
> return _obj.toString();
> case "string":
> return "'" + _obj + "'";
> case "object":
> if (_obj === null) return "null";
> if (_obj instanceof Date) return "(new Date(" +
> _obj.getTime() +
> "))";
> if (_obj.constructor === Array || typeof _obj.callee !==
> "undefined") {
> len = _obj.length;
> if (len < 0) throw new TypeError("Object has negative
> length: " + _obj);
> else if (len == 0) return "[]";
> parts = [];
> for (i = 0; i < len; i++) parts.push(this.serializar(_
> obj[i]));
> return "[" + parts.join(",") + "]"
> }
> parts = [];
> for (key in _obj) {
> val = _obj[key];
> if (typeof val === "function") continue;
> parts.push(this.normalizarChave(key) + ":" +
> this.serializar(val))
> }
> return "{" + parts.join(",") + "}";
> default:
> throw new TypeError("Cannot serialize object of type " +
> typeof _obj);
> }
> };
> this.recuperar = function (s) {
> var obj, i;
> if (!s) throw new EvalError("Null or empty object
> representation: " + s);
> if (!this.regexpValidacao.test(s)) throw new
> EvalError("Invalid object representation: " + s);
> for (i = 0; i < this.regexpsSeguranca.length; i++)
> if (this.regexpsSeguranca[i].test(s)) throw new
> EvalError("Insecure object representation: " + s);
> try {
> eval("obj = " + s)
> } catch (e) {
> throw new EvalError("Error when eval-ing string " + s + "
> . Error: " + e);
> }
> if (typeof obj !== "object") throw new EvalError('Retrieved
> object is not of type "object": ' +
> s);
> return obj
> };
> this.normalizarChave = function (chave) {
> return this.regexpIdentificadorJS.test(chave) ? chave : "'" +
> chave + "'"
> }
> },
> TermoBusca: {
> obterTermo: function (maquinasBusca, referrer) {
> var i;
> referrer = referrer || document.referrer;
> if (!referrer || referrer.indexOf("?") < 0) return null;
> maquinasBusca = maquinasBusca || __srp_est_corp.TermoBusca.
> maquinasBuscaExternas;
> if (!maquinasBusca) return null;
> for (i = 0; i < maquinasBusca.length; i++) {
> maquina = maquinasBusca[i];
> if (__srp_est_corp.TermoBusca._veioDaMaquinaDeBusca(maquina,
> referrer)) return __srp_est_corp.extrairParametroQueryString(
> referrer.split("?")[1],
> maquina.parametro)
> }
> return null
> },
> MaquinaBusca: function (dominios, parametro,
> caminhosPaginasResultadoBusca) {
> this.dominios = dominios;
> this.parametro = parametro;
> this.caminhosPaginasResultadoBusca =
> caminhosPaginasResultadoBusca || null
> },
> maquinasBuscaExternas: [{
> dominios: ["google.com", "google.com.br", "google.pt"],
> parametro: "q"
> }, {
> dominios: ["bing.com", "bing.com.br"],
> parametro: "q"
> }, {
> dominios: ["search.conduit.com"],
> parametro: "q"
> }, {
> dominios: ["yahoo.com"],
> parametro: "p"
> }],
> maquinasBuscaInternas: [{
> dominios: ["receita.fazenda.gov.br",
> "161.148.231.100"
> ],
> parametro: "Criteria",
> caminhosPaginasResultadoBusca: ["/Aplicacoes/ATBHE/Busca/
> ResultPesq.asp"]
> }],
> _veioDaMaquinaDeBusca: function (maquina, referrer) {
> var i, j, maquina, dominioReferrer =
> __srp_est_corp.obterDominio(referrer),
> caminhoLowerCase = __srp_est_corp.obterCaminho(
> referrer).toLowerCase(),
> dominioPertenceAMaquina = false;
> for (i = 0; i < maquina.dominios.length; i++)
> if (__srp_est_corp.eSufixo(dominioReferrer,
> maquina.dominios[i])) {
> dominioPertenceAMaquina = true;
> break
> }
> if (!dominioPertenceAMaquina) return false;
> if (!maquina.caminhosPaginasResultadoBusca) return true;
> for (i = 0; i < maquina.caminhosPaginasResultadoBusca.length;
> i++)
> if (caminhoLowerCase === maquina.
> caminhosPaginasResultadoBusca[i].toLowerCase()) return true;
> return false
> }
> },
> QueryStringGIFEstatisticas: {
> coletarDominio: function () {
> var dominio = __srp_est_corp.obterDominioAtual();
> return dominio ? __srp_est_corp.constantes.parametros.dominio
> + "=" + dominio : null
> },
> eNovaVisitaSitio: function () {
> var dominioReferrer = __srp_est_corp.obterDominio(
> document.referrer),
> dominio;
> if (!dominioReferrer) return __srp_est_corp.constantes.parametros.novaVisita
> +
> "=" + true;
> dominio = __srp_est_corp.obterDominioAtual();
> if (!dominio) return __srp_est_corp.constantes.parametros.novaVisita
> + "=" + true;
> return __srp_est_corp.constantes.parametros.novaVisita + "="
> + (dominio !== dominioReferrer)
> },
> origem: function () {
> var dominioReferrer = __srp_est_corp.obterDominio(
> document.referrer);
> if (dominioReferrer && dominioReferrer !=
> __srp_est_corp.obterDominio(document.URL)) return
> __srp_est_corp.constantes.parametros.origem + "=" + dominioReferrer
> },
> horaAcesso: function () {
> return __srp_est_corp.constantes.parametros.horaAcesso +
> "=" + (new Date).getHours()
> },
> identificaDuracaoVisita: function () {
> var cookie = __srp_est_corp.Cookie.obter("duracao_visita");
> if (cookie == null) {
> __srp_est_corp.idVisita = __srp_est_corp.gerarGuid();
> __srp_est_corp.Cookie.definir("duracao_visita",
> __srp_est_corp.idVisita, __srp_est_corp.obterDataCookieDuracao());
> return __srp_est_corp.constantes.parametros.visitaId +
> "=" + __srp_est_corp.idVisita
> } else {
> __srp_est_corp.idVisita = cookie;
> __srp_est_corp.Cookie.definir("duracao_visita",
> __srp_est_corp.idVisita, __srp_est_corp.obterDataCookieDuracao());
> return __srp_est_corp.constantes.parametros.visitaId +
> "=" + __srp_est_corp.idVisita
> }
> },
> identificaVisita: function () {
> var cookie = __srp_est_corp.Cookie.obter("nova_visita_ano");
> if (cookie == null) {
> __srp_est_corp.idUsuario = __srp_est_corp.gerarGuid();
> return __srp_est_corp.constantes.parametros.userId + "="
> + __srp_est_corp.idUsuario
> } else {
> __srp_est_corp.idUsuario = cookie;
> return __srp_est_corp.constantes.parametros.userId + "="
> + __srp_est_corp.idUsuario
> }
> },
> eNovaVisitaDia: function () {
> var cookie_dia = __srp_est_corp.Cookie.obter("
> nova_visita_dia");
> if (cookie_dia == null) {
> __srp_est_corp.Cookie.definir("nova_visita_dia",
> __srp_est_corp.idUsuario, __srp_est_corp.obterDataInicioDiaSeguinte());
> return __srp_est_corp.constantes.parametros.novaVisitaDia
> + "=" + true
> } else return __srp_est_corp.constantes.parametros.novaVisitaDia
> + "=" + false
> },
> eNovaVisitaMes: function () {
> var cookie_mes = __srp_est_corp.Cookie.obter("
> nova_visita_mes");
> if (cookie_mes == null) {
> __srp_est_corp.Cookie.definir("nova_visita_mes",
> __srp_est_corp.idUsuario, __srp_est_corp.obterDataInicioMesSeguinte());
> return __srp_est_corp.constantes.parametros.novaVisitaMes
> + "=" + true
> } else return __srp_est_corp.constantes.parametros.novaVisitaMes
> + "=" + false
> },
> eNovaVisitaAno: function () {
> var cookie_ano = __srp_est_corp.Cookie.obter("
> nova_visita_ano");
> if (cookie_ano == null) {
> __srp_est_corp.Cookie.definir("nova_visita_ano",
> __srp_est_corp.idUsuario, __srp_est_corp.obterDataInicioAnoSeguinte());
> return __srp_est_corp.constantes.parametros.novaVisitaAno
> + "=" + true
> } else return __srp_est_corp.constantes.parametros.novaVisitaAno
> + "=" +
> false
> },
> coletarInfoMonitor: function () {
> var info = screen.width + "x" + screen.height + "x" +
> screen.colorDepth;
> return __srp_est_corp.constantes.parametros.infoMonitor + "="
> + info
> },
> coletarPlugins: function () {
> return __srp_est_corp.constantes.parametros.plugins + "=" +
> __srp_est_corp.QueryStringGIFEstatisticas.obterPlugins()
> },
> obterPlugins: function () {
> var plugins = [],
> i, p, str, mapa = __srp_est_corp.Plugins.
> PluginDetect.mapaPlugins;
> for (i in mapa)
> if (mapa.hasOwnProperty(i)) {
> p = mapa[i];
> if (p.disponivel) {
> str = p.nome;
> if (p.versao) str +=
> "." + p.versao;
> plugins.push(str)
> }
> }
> return plugins.join(",")
> },
> coletarTermoBuscaExterna: function () {
> var termo = __srp_est_corp.TermoBusca.obterTermo();
> return termo ? __srp_est_corp.constantes.parametros.termoBuscaExterna
> + "=" + termo : null
> },
> coletarEvitarCache: function () {
> return __srp_est_corp.constantes.parametros.evitarCache + "="
> + (new Date).getTime()
> },
> gerarQueryStringFuncoes: function (arrayFuncoes) {
> var funcao, qs = "";
> while (arrayFuncoes.length > 0) {
> funcao = arrayFuncoes.pop();
> qs = __srp_est_corp.concatenarQueryStrings(qs,
> funcao())
> }
> return qs
> },
> gerarQueryString: function () {
> var queryString, concatenarQueryStrings = __srp_est_corp.
> concatenarQueryStrings;
> __srp_est_corp.Plugins.PluginDetect.init();
> var funcoesEstatisticasPorVisitanteUnicoSitio =
> [this.coletarEvitarCache, this.coletarInfoMonitor, this.coletarPlugins,
> this.coletarTermoBuscaExterna, this.coletarDominio, this.eNovaVisitaSitio,
> this.eNovaVisitaAno, this.eNovaVisitaMes, this.eNovaVisitaDia,
> this.identificaVisita, this.origem, this.horaAcesso,
> this.identificaDuracaoVisita];
> queryString =
> this.gerarQueryStringFuncoes(funcoesEstatisticasPorVisitanteUnicoSitio);
> return queryString
> }
> },
> RequisicaoGIFEstatisticas: {
> obterCaminho: function (caminho) {
> var protocolo, constantes = __srp_est_corp.constantes;
> if (__srp_est_corp.obterDominioAtual() === constantes.dominioGIFTransparente)
> return caminho;
> try {
> protocolo = __srp_est_corp.obterProtocolo()
> } catch (e) {
> protocolo = "http:"
> }
> return protocolo + "//" + constantes.dominioGIFTransparente +
> caminho
> },
> obterCaminhoGIFTransparante: function () {
> return this.obterCaminho(__srp_est_corp.constantes.
> caminhoGIFTransparente)
> },
> agendarGeracaoImagem: function () {
> function aoCarregar() {
> if (__srp_est_corp.carregado || document.getElementById("
> serpro-componente-estatistica-corporativa")) return;
> var imagem = document.createElement("img"),
> queryString, src, constantes =
> __srp_est_corp.constantes;
> __srp_est_corp.carregado = true;
> try {
> queryString = __srp_est_corp.
> QueryStringGIFEstatisticas.gerarQueryString()
> } catch (e) {
> queryString = "erroJS=" + escape(e)
> }
> queryString = __srp_est_corp.concatenarQueryStrings(queryString,
> constantes.parametros.versao + "=" + constantes.versao);
> src = __srp_est_corp.RequisicaoGIFEstatisticas.obterCaminhoGIFTransparante()
> + (queryString ? "?" + queryString : "");
> imagem.setAttribute("id", "serpro-componente-
> estatistica-corporativa");
> imagem.style.position = "absolute";
> imagem.style.top = 0;
> imagem.style.left = 0;
> imagem.style.zIndex = 0;
> imagem.style.width = 0;
> imagem.style.height = 0;
> document.body.appendChild(imagem);
> imagem.setAttribute("src", src)
> }
> __srp_est_corp.agendarParaExecutarAoConcluirCargaDOM(aoCarregar)
> },
> identificaSaidaPagina: function () {
> var constantes = __srp_est_corp.constantes;
> try {
> queryString = __srp_est_corp.QueryStringGIFEstatisticas.
> gerarQueryString()
> } catch (e) {
> queryString = "erroJS=" + escape(e)
> }
> queryString = __srp_est_corp.concatenarQueryStrings(queryString,
> constantes.parametros.versao + "=" + constantes.versao);
> queryString = __srp_est_corp.concatenarQueryStrings(queryString,
> constantes.parametros.horaSaida + "=true");
> src = __srp_est_corp.RequisicaoGIFEstatisticas.obterCaminhoGIFTransparante()
> + (queryString ? "?" + queryString : "");
> synchronous_ajax(src, "")
> }
> }
> };
> (function () {
> __srp_est_corp.RequisicaoGIFEstatisticas.agendarGeracaoImagem(false)
> })();
> window.onbeforeunload = function () {
> __srp_est_corp.RequisicaoGIFEstatisticas.identificaSaidaPagina()
> };
>
> function synchronous_ajax(url, passData) {
> if (window.XMLHttpRequest) AJAX = new XMLHttpRequest;
> else AJAX = new ActiveXObject("Microsoft.XMLHTTP"); if (AJAX) {
> AJAX.open("POST", url, false);
> AJAX.setRequestHeader("Content-type", "application/x-www-form-
> urlencoded");
> AJAX.send(passData);
> return AJAX.responseText
> } else return false
> };
>
> Atenciosamente,
>
> Charles Henrique G. Santos
> Procuradoria Geral da República
> Ministério Público Federal
> (61) 3105-6795
>
> "Ambiente limpo não é o que mais se limpa
> e sim o que menos se suja."
>
> Em 28-02-2014 16:06, Bruno Barbosa escreveu:
>
>> Olá pessoal,
>>
>> Não sei se mais alguém percebeu, mas o código da barra de identidade do
>> governo eletrônico contém referência a um javascript que coleta dados dos
>> usuários e envia ao Serpro.
>>
>> Não sei quanto à questões de privacidade e se isso deveria ser informado
>> de antemão na página onde o código da barra é fornecido, mas além disso
>> isso causa transtornos principalmente para os usuários que usam o navegador
>> Internet Explorer, que a cada request uma mensagem de alerta aparece na
>> tela avisando que algo não está certo.
>>
>> Isso ocorre provavelmente porque a barra do governo chama um código
>> javascript em barra.brasil.gov.br/barra.js e dentro deste, há a
>> referência ao js do Serpro: coletajavascript.serpro.gov.br/estatistica.js
>>
>> Não sou especialista em segurança, mas não é difícil perceber que esse
>> encadeamento faz com os portais que utilizam a barra estão suscetíveis a
>> ter inserido em seu fonte qualquer código sem vosso consentimento.
>>
>> Por que assim como em versões anteriores da barra de identidade do
>> governo, não nos fornecem o material com as especificações necessárias para
>> que possamos nós mesmos codificar e inserir a barra gov? Estas chamadas
>> externas só aumentam o tempo de carregamento da página e faz com que,
>> quando estes servidores de terceiros estejam fora do ar, o carregamento dos
>> demais portais que utilizam a barra fique mais lento.
>>
>> --
>> Bruno Barbosa
>> bsbruno1 em gmail.com
>>
>>
>>
>> _______________________________________________
>> Comunidade Plone no Governo
>> Site: http://www.softwarelivre.gov.br/plone
>> Wiki: http://colab.interlegis.leg.br/wiki/PloneGovBr
>> Lista: https://listas.interlegis.gov.br/mailman/listinfo/plonegov-br
>>
>
> _______________________________________________
> Comunidade Plone no Governo
> Site: http://www.softwarelivre.gov.br/plone
> Wiki: http://colab.interlegis.leg.br/wiki/PloneGovBr
> Lista: https://listas.interlegis.gov.br/mailman/listinfo/plonegov-br
>
--
Felipe Duardo
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.interlegis.gov.br/pipermail/plonegov-br/attachments/20140228/7a53df2d/attachment.html>
Mais detalhes sobre a lista de discussão PloneGov-BR