Visitante do Google
Testando: guest = AurelioAHeckert? Não
%STARTINCLUDE%
<style type="text/css">
#olaVisitaGoogle{
display: none;
border: 2px solid #D00;
font-size: 90%;
line-height: 140%;
margin: 0% 20% 0% 10%;
padding: 3px 70px 3px 10px;
background-color: #F0F0F0;
background-image: url("%ATTACHURL%/bolasGoogle.gif");
background-repeat: no-repeat;
background-position: 100% 100%;
}
</style>
<script type="text/javascript">
<!-- // <pre>
document.write( "<div id='olaVisitaGoogle'>olaVisitaGoogle</div>" );
window.GB_ORIG_onload = window.onload;
window.onload = function() {
if ( /.*google\.com.*\?.*q=.*/.test( document.referrer ) ) {
// Se entrou aqui é porque veio de uma busca no google
// Se usar unescape no lugar de decodeURI ele não faz a conversão UFT-8 <-> ISO e creca a string.
var googleBusca = decodeURI( document.referrer.replace( /.*(\?|&)q=([^&]+).*/, "$2" ).replace( /\+/g, " " ) );
// Retira caracteres indesejados e espaços repetidos:
googleBusca = googleBusca.replace( /[^a-z0-9_áàãâéèêíìîóòôõúùûç]/ig, " " ).replace( /\s+/g, " " )
// converte maiúsculas em minúsculas e transforma em array de palavras:
googleBusca = googleBusca.toLowerCase().split(" ");
function corGB( i ) {
var cores = [ "#BFB", "#FDA", "#FCC", "#BDF", "#EBF", "#FFA" ];
return cores[ i % cores.length ];
}
function MarcaBuscaLoop(node) {
var borda = "\\b|\\s|\\.|,|;|!|\\?|@|#|$|%|\"|'|^|~|-|=|\\+|\\*|\\(|\\)|\\[|\\]|\\{|\\}|\\/|\\\\|\\|";
if ( node.nodeName == "#text" ) {
var newNode = document.createElement("text");
var txt = node.textContent.replace( /&/g, "&alt;" ).replace( /</g, "<" ).replace( />/g, ">" );
for ( var i=0; i<googleBusca.length; i++ ) {
var er = new RegExp( "("+borda+")("+ googleBusca[i] +")("+borda+")", "ig");
if ( er.test(node.textContent) ) {
txt = txt.replace( er, '$1<span style="background-color:'+ corGB(i) +'">$2</span>$3');
}
//else { txt = "[("+ googleBusca[i] +")"+ txt +"]" }
}
newNode.innerHTML = txt;
node.parentNode.replaceChild(newNode, node);
}
else {
for( var i=0; i < node.childNodes.length; i++ ) {
var childNode = node.childNodes[i]
if ( ! /^(INPUT|SELECT|TEXTAREA|SCRIPT|FRAMESET|IFRAME)$/.test(childNode.nodeName) ) {
MarcaBuscaLoop(childNode);
}
}
}
}
MarcaBuscaLoop(document.body);
txtGB = '';
for ( var i=0; i<googleBusca.length; i++ ) {
txtGB += ' <span style="background-color:'+ corGB(i) +'">'+ googleBusca[i] +'</span> ';
}
document.getElementById("olaVisitaGoogle").style.display = "block";
document.getElementById("olaVisitaGoogle").innerHTML = "Olá visitante do Google,<br/>" +
"Sua busca <i>"+ txtGB +"</i> está marcada no texto.<br/>" +
"Essa funcionalidade ainda está em teste, se algo deu errado:<br/>" +
"<a href='mailto:aurium<nop>@gmail.com?subject=Bug%20Script%20VisitanteGoogle&body=Link:%20" +
escape( document.referrer +"\n%BASEWEB%.%BASETOPIC%" ) +
"'>Clique Aqui para me enviar o Bug</a><br/>" +
"<a href='"+ document.location.href +"'>Clique Aqui para ver a página sem a busca</a>";
// fim do if google
}
window.GB_ORIG_onload()
// fim do onload
}
// </pre> -->
</script>
%STOPINCLUDE%