function skipScroll(e){ var li = e.currentTarget; var ul = $(li).find("ul"); var divscroll = $(li).parent().parent().parent().parent().parent().parent().parent(); var fs = $(divscroll).css("overflow"); if(!$(ul).is(":visible") && fs == "scroll"){ $(divscroll).css("overflow","visible"); $(divscroll).css("margin-bottom","150px"); }else{ $(divscroll).css("overflow","scroll"); } } window.onload = function funcoes(){ var resolucao = screen.width; if(resolucao=="1024"){ var corpo = document.getElementsByTagName("body"); corpo[0].className = "menor"; } if(document.getElementById('caminho')){ document.getElementById('arquivo').onchange = function(){ document.getElementById('caminho').innerHTML = document.getElementById('arquivo').value.substring(0, 32); } } } function abriFormEdicao(titulo,url){ var l_listas = new Lightbox(); var html=""; var json = getSizeBrowser(); json.x = json.x - 100; html="
"; l_listas.abrir(titulo,json.x+"px",html,"fechar"); } function abriFormTokenZapier(titulo,url){ var l_listas = new Lightbox(); var html=""; var json = getSizeBrowser(); json.x = json.x - 100; html="
"; l_listas.abrir(titulo,json.x+"px",html,"fechar"); } function abreModalRelatorioRS(titulo, url, tamanho) { var l_listas = new Lightbox(); var html = ""; var json = getSizeBrowser(); json.x = json.x - 100; if (tamanho == 'full') { json.y = json.y - 200; } else { json.y = '400'; } html = "
"; l_listas.abrir(titulo,json.x+"px",html,"fechar"); } /** * * @param titulo, o Titulo do alerta * @param width, a lagura do alerta * @param texto, o texto do alerta * @param url, Caso queira que o botao funcione como um link * @param botao, O tipo do botao desejado valores aceitavel sao [fechar|erro|ok|url|nenhum|""] */ function alerta(titulo,width,texto,url,botao,fn){ if(url==""){ url="javascript:fechar();" } if( fn == "" || fn == undefined){ fn = "void(0)"; } var idioma= ""; if(idioma=="pt-br"){ idioma="pt_br"; } if(!idioma){ idioma="pt_br"; } var botao_fechar = new Array(); botao_fechar['pt_br'] = "Fechar"; botao_fechar['es'] = "Cerrar"; var botao_sim = new Array(); botao_sim['pt_br'] = "Sim"; botao_sim['es'] = "Sí"; var botao_nao = new Array(); botao_nao['pt_br'] = "Não"; botao_nao['es'] = "No"; var html = '

'+titulo+'

'; switch(botao){ case "fechar": html += texto+'
'; break; case "url": html += texto+'
'; break; case 'nenhum': html += texto+'
'; break; case "erro": html += '

'+texto+'

'; break; case "ok": html += '

'+texto+'

'; break; case "yes": html += '

'+texto+'

'; break; case "yes2": html += '

'+texto+'

'; break; case "yesfunction": html += '

'+texto+'

'; break; case "yesfunctionParam": html += '

'+texto+'

'; break; case "confirma": html += '

'+texto+'

'; break; default: html += texto+'
'; } html += '
'; var janela = document.getElementById("janela"); var pagina = document.getElementsByTagName("body"); janela.innerHTML = html; janela.style.display = "inline"; pagina[0].style.overflow = "hidden"; if(document.getElementById("box-alerta").offsetHeight>0){ //document.getElementById("box-alerta").style.marginTop = "-"+document.getElementById("box-alerta").offsetHeight/2+"px"; //document.getElementById("box-alerta").style.marginLeft = "-"+document.getElementById("box-alerta").offsetHeight+"px"; }//else{ //document.getElementById("box-alerta").style.marginTop = "-57.5px"; //document.getElementById("box-alerta").style.marginLeft = "-150px"; //} /* if(botao=="copiar"){ document.getElementById("botoes").style.width = "192px"; }else if(botao=="fechar" || botao=="erro" || botao=="ok" || botao=="url"){ document.getElementById("botoes").style.width = "81px"; } if(document.getElementById("txt-alerta").offsetHeight){ document.getElementById("bg-right").style.height = document.getElementById("txt-alerta").offsetHeight+"px"; }else{ document.getElementById("bg-right").style.height = "100%" }*/ } /** * * @param titulo, o Titulo do alerta * @param width, a lagura do alerta * @param texto, o texto do alerta * @param url, Caso queira que o botao funcione como um link * @param botao, O tipo do botao desejado valores aceitavel sao [fechar|erro|ok|url|nenhum|""] */ function alertaAV(titulo,width,texto,url,botao,fn){ if(url==""){ url="javascript:fechar();" } if( fn == "" || fn == undefined){ fn = "void(0)"; } var html = '

'+titulo+'

'; switch(botao){ case "fechar": html += texto+'
'; break; default: html += texto+'
'; } html += '
'; var janela = parent.document.getElementById("janela"); var pagina = parent.document.getElementsByTagName("body"); janela.innerHTML = html; janela.style.display = "inline"; pagina[0].style.overflow = "hidden"; if(parent.document.getElementById("box-alerta").offsetHeight>0){ // document.getElementById("box-alerta").style.marginTop = "-"+document.getElementById("box-alerta").offsetHeight/2+"px"; // document.getElementById("box-alerta").style.marginLeft = "-"+document.getElementById("box-alerta").offsetHeight+"px"; }//else{ // document.getElementById("box-alerta").style.marginTop = "-57.5px"; // document.getElementById("box-alerta").style.marginLeft = "-150px"; //} /*if(botao=="copiar"){ document.getElementById("botoes").style.width = "192px"; }else if(botao=="fechar" || botao=="erro" || botao=="ok" || botao=="url"){ document.getElementById("botoes").style.width = "81px"; } if(document.getElementById("txt-alerta").offsetHeight){ document.getElementById("bg-right").style.height = document.getElementById("txt-alerta").offsetHeight+"px"; }else{ document.getElementById("bg-right").style.height = "100%" }*/ } function fechar(){ if(typeof(tempo)!="undefined"){ if(tempo){ clearTimeout(tempo); } } var pagina = document.getElementsByTagName("body"); var janela = document.getElementById("janela"); janela.style.display = "none"; pagina[0].style.overflow = "auto"; } function abreFecha(obj){ verifica = obj.parentNode.className; if(verifica == "box dados fechado"){ obj.parentNode.className = "box dados aberto"; }else{ obj.parentNode.className = "box dados fechado"; } } /** * A função asyncJquery utilza a função ajax do jquery para realizar um ajax assincrono. * Se ocorrer algum erro de comunicacao sera enviado para o console ... * @param url a url do site que sera aberto via ajax * @param metodo POST ou GET * @param dt Tipo de Data esperada como retorno ( html, json, xml e etc ) * @param parametros Objeto com os parametros, tipo parametros = new Object(); parametros["acao"] = "atualizar"; * @param antesDeMandar Funcao que sera executada antes de mandar * @param completou Funcao que sera executada ao completar a * @param callback Função que será executada no retorno do json * @param contextoParametros Os valores passados aqui serao anexados no obj ajax, podendo ser acessados pelo this.contexto em qualquer uma das funcoes passadas como parametro. */ function asyncJquery(url, metodo, dt, parametros, antesDeMandar,completou,callback,contextoParametros){ if(typeof(contextoParametros) == "undefined") contextoParametros = null; var antesdemandar=function( xhr ) { xhr.overrideMimeType( 'text/plain; charset=ISO-8859-1'); if(typeof(antesDeMandar)=="function") antesDeMandar(); }; $.ajax({ url: url, type: metodo, data: parametros, dataType: dt, beforeSend: antesdemandar, complete: completou, success: callback, contexto: contextoParametros, error:function(jqXHR, textStatus, errorThrown){ console.log("\nOcorreu um erro no ajax...\n"); try{ console.log("\njqXHR:" + jqXHR + "\ntextStatus:" + textStatus + "\nerrorThrown:" + errorThrown + "\n"); }catch(err){ console.log(err.message); } } }); } /** * A função syncJquery utilza a função ajax do jquery para realizar um ajax assincrono. * Se ocorrer algum erro de comunicacao sera enviado para o console ... * @param url a url do site que sera aberto via ajax * @param metodo POST ou GET * @param dt Tipo de Data esperada como retorno ( html, json, xml e etc ) * @param parametros Objeto com os parametros, tipo parametros = new Object(); parametros["acao"] = "atualizar"; * @param antesDeMandar Funcao que sera executada antes de mandar * @param completou Funcao que sera executada ao completar a * @param callback Função que será executada no retorno do json * */ function syncJquery(url, metodo, dt, parametros, antesDeMandar,completou,callback){ var antesdemandar=function( xhr ) { xhr.overrideMimeType( 'text/plain; charset=ISO-8859-1'); antesDeMandar(); }; $.ajax({ url: url, async:false, type: metodo, data: parametros, dataType: dt, beforeSend: antesdemandar, complete: completou, success: callback, error:function(jqXHR, textStatus, errorThrown){ console.log("\nOcorreu um erro no ajax..."); try{ console.log("\njqXHR:" + jqXHR + "\ntextStatus:" + textStatus + "\nerrorThrown:" + errorThrown + "\n"); }catch(err){ console.log(err.message); } } }); } /** * Funcoes referentes ao tutorial */ var currentIframe = 0; $('document').ready(function(){ $(".abri-tutorial a").live('click', function(){ window.open( $(this).attr('href') ); return false; }); $(".abri-tutorial").live("click",function(){ if(! $(this).hasClass("naoabrir") ){ if( $(this).attr('id').split('_')[0] == 'iframe' ) currentIframe = $(this).attr('id').split('_')[1]; $("body").animate({ minWidth: '+1387' }, 400 ); if($(this).hasClass("doc")){ var tamanho = $(".box-tutorial").eq(currentIframe).width()+30; $(".margem-box").animate({ marginLeft: tamanho }, 400 ); } $(".box-tutorial").eq(currentIframe).animate({ left: '+0' }, 400 ); if($(this).hasClass('tutorial')==true){ //$(".info.tutorial").slideUp(); } addFunctionInClose(); } }); $(".box-tutorial .horizontal").live("click",function(){ $("body").animate({ minWidth: '1007' }, 400 ); $(".margem-box").animate({ marginLeft: '0' }, 400 ); var tamanho = $(".box-tutorial").width()+30; $(".box-tutorial").animate({ left: '-'+tamanho }, 400, function() { var tamanho = $(".box-tutorial .conteudo").height()+30; $(".box-tutorial").removeClass('vertical'); $(".box-tutorial").addClass('horizontal'); $(".box-tutorial").css('left', '0'); $(".box-tutorial").css('width', '100%'); $(".box-tutorial").css('height', 'auto'); $(".box-tutorial .horizontal").hide(); $(".box-tutorial .vertical").show(); $(".box-tutorial").animate({ top: '-'+tamanho }, 0 ); $(".margem-box").animate({ marginTop: tamanho }, 400 ); $(".box-tutorial").animate({ top: '0' }, 400 ); }); }); $(".box-tutorial .vertical").live("click",function(){ $("body").animate({ minWidth: '1007' }, 400 ); $(".margem-box").animate({ marginTop: '0' }, 400 ); var tamanho = $(".box-tutorial").height()+45; $(".box-tutorial").animate({ top: '-'+tamanho }, 400, function() { $(".box-tutorial").removeClass('horizontal'); $(".box-tutorial").addClass('vertical'); $(".box-tutorial").css('top', '0'); $(".box-tutorial").css('left', '-380px'); $(".box-tutorial").css('width', '350px'); $(".box-tutorial").css('height', '100%'); $(".box-tutorial .horizontal").show(); $(".box-tutorial .vertical").hide(); $("body").animate({ minWidth: '+1387' }, 400 ); var tamanho = $(".box-tutorial").width()+30; $(".margem-box").animate({ marginLeft: tamanho }, 400 ); $(".box-tutorial").animate({ left: '+0' }, 400 ); }); }); $(".noticias .fechar").click(function(){ $(this).parent().animate({ height : '0px' }, 1000, function(){ $(this).remove(); }); }); }); function addFunctionInClose(){ $('.box-tutorial_ifr .fechar', $('.box-tutorial').get(currentIframe).contentWindow.document).live('click', function(){ var tamanhoVertical = $(".box-tutorial").width()+30; $("body").animate({ minWidth: '1007' }, 400 ); $(".margem-box").animate({ marginLeft: '0' }, 400 ); $(".box-tutorial").animate({ left: '-'+tamanhoVertical }, 400, function() { $(".info.tutorial").slideDown(); $(".box-tutorial").css('left', '-380px'); $(".box-tutorial").css('width', '350px'); $(".box-tutorial").css('height', '100%'); }); $(".box-tutorial .horizontal").show(); $(".box-tutorial .vertical").hide(); }); } /** * A funcao cookies trabalha de duas forma, se colocado so o cname ele ira retornar o valor, e se colocar o valor ira criar ou atualizar o cookie. * @param cname O nome do valor no cookie * @param valor O valor para adicionar no cookie * @param expira O numero em minutos em que o cookie deve expirar. * @return mixed */ function cookies(cname,valor,expira){ if(typeof(valor)!="undefined"){//Cria o cookie var exdate=new Date(); var strExpira = ""; if(typeof(expira)!="undefined"){ exdate.setTime(exdate.getTime() + (expira * 60 * 1000)); strExpira = ";expires="+exdate.toUTCString(); } valor=escape(valor) + ((expira==null) ? "" : strExpira + ";path=/;domain=."+domain); document.cookie=cname + "=" + valor; }else{//Busca o valor do cookie se ouver var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i -1; if(! is_chrome ) return false; var compURL = ""; if(origem=='push'){ compURL = "&tipo=push" } if( iframeLoaded == true ) { iframeLoaded = false; iframeLoaded2 = false; var id; var url; var obj; var json; var json_i; id = $(e).attr("id").split("_")[1]; if( url == undefined || !url || url == "") var url = "abreHtml.php?id_campanha=" + id + compURL; json = returnPosition(event); $('#thumb').css("top", ( parseInt( json.y ) - 262) + "px"); $('#thumb').css("left", ( parseInt( json.x ) + 50) + "px"); $('#thumb').show(); $('#thumb iframe').zoomer({ zoom: 0.35, width: 262, height: 262, loadingType: "spinner", message: "", messageURL: url, onComplete: function($iframe) { iframeLoaded = true; iframeLoaded2 = true; $('#thumb').animate({ "top": ( parseInt( json.y ) - 320) + "px" }, function(){ $('#thumb').animate({ "height":"300px" }, function(){ $('#thumb').append(""); }); }); if (info){ var infourl = "abreHtml.php?infoHtml=true&id_campanha=" + id + compURL; }else{ var infourl = "abreHtml.php?id_campanha=" + id + compURL; } $.ajax({ url: "abreHtml.php?infoHtml=true&id_campanha=" + id + compURL, dataType: "json", success : function(json_i) { if( iframeLoaded2 == true ) { $('#thumb center').remove(); $('#thumb .info div').remove(); if(label != false) { $('#thumb .info').append("
"+ObjTradutor['TRA_assunto']+":" + json_i.subject+'
'); $('#thumb .info').append("
Lista:" + json_i.lista+"
"); } if(json_i.filtro) $('#thumb .info').append("
Filtro:" + json_i.filtro+"
"); } if(json_i.lista_exclusao){ $('#thumb .info').append("
Lista Exclusao:" + json_i.lista_exclusao+"
"); } if(json_i.rede){ $('#thumb .info').append("
Rede:" + json_i.rede+"
"); } $('#thumb').animate({ "height":"450px" }, function(){ $('#thumb .info').show("slow"); iframeLoaded2 = true; }); } }); } }); $('#thumb iframe').zoomer('src', url); } } function fecharThumb() { $('#thumb .info').hide(); $('#thumb').hide(); $('#thumb').height("262"); $('#thumb').html('
Label: value
Label: value
Label: value
'); iframeLoaded = true; } /** * Função referente ao dropbox */ $(document).ready(function(){ // $(".content .linha").mousemove(showThumb); // $(".content .linha").mouseout(hideThumb); $("div.scroll").css("padding-bottom","100px"); //$(".scroll .centralizar_qualquer li.primeira").live("click",skipScroll); var listaSelecionada = undefined; $('ul.label').live("click", function () { /*var count = $(this).find('ul').find('li').length; count = ( count * 29 ) ; $(this).find('ul').css({ top: '-'+count+'px' });*/ // Reset $('table tr').removeClass("selecionado"); if( listaSelecionada != undefined && listaSelecionada[0] != $(this).find("li ul")[0] ) { $(listaSelecionada).slideToggle(100); $(listaSelecionada).hide(); } if( listaSelecionada != undefined && listaSelecionada[0] == $(this).find("li ul")[0] ) { listaSelecionada = undefined; $('table tr').removeClass("selecionado"); } else { listaSelecionada = $(this).find("li ul"); $(this).parent().parent().parent().addClass("selecionado"); } //alert('savio'); $(this).find("li ul").slideToggle(100); //$(this).find("li ul").toggle("slide", { direction: "up" }); if( $(this).attr("class") == "label des" ) { alerta(ObjTradutor['TRA_atencao'],'400px',ObjTradutor['TRA_VerListArq'],'','fechar'); $('table tr').removeClass("selecionado"); } }); $(".showThumb").live("click", function(){ var url = $(this).attr("href"); var json = getSizeBrowser(); var html = "
"; lightbox_thumb.id = "lightbox_thumb"; lightbox_thumb.abrir("Visualizar HTML",(json.x-100)+"px",html,"fechar"); return false; }); }); $(document).ready(function(){ var RegexSoNum = /[\d]+/; $(".soNumeros").live("keyup", function(){ var val = $(this).val(); if( RegexSoNum.exec(val) != null ) $(this).val( RegexSoNum.exec(val) ); else $(this).val(""); }); $("#cliqueFiltro").click(function() { $(".filtroLista").toggleClass( "ativado" ); if($("#filtroLista").hasClass("ativado")){ $(this).text( 'FECHAR FILTRO' ); }else{ $(this).text( 'CLIQUE PARA FILTRAR' ); } }); });