var contatotal = 0;
$(function() {
jQuery.aawords = document.body.createTextRange ?
/*
Version for IE using TextRanges.
*/
function(node, te, teurl) {
var r = document.body.createTextRange();
r.moveToElementText(node);
var contaw = 0;
for (var i = 0; r.findText(te); i++) {
var el = r.parentElement();
var nome = String(el.tagName)
if (nome != 'A' && contaw < 2 && contatotal < 8) {
contaw = contaw+1;
//r.pasteHTML('' + r.text + '<\/a>');
r.pasteHTML('' + r.text + '<\/a>');
}
r.collapse(false);
}
}
:
/*
(Complicated) version for Mozilla and Opera using span tags.
*/
function(node, te, lau) {
var pos, skip, spannode, middlebit, endbit, middleclone;
skip = 0;
if (node.nodeType == 3) {
pos = node.data.toUpperCase().indexOf(te);
if (pos >= 0 && contatotal < 5) {
spannode = document.createElement("a");
spannode.className = "product_link";
middlebit = node.splitText(pos);
endbit = middlebit.splitText(te.length);
middleclone = middlebit.cloneNode(true);
spannode.appendChild(middleclone);
middlebit.parentNode.replaceChild(spannode, middlebit);
//spannode.title = "ajax:teste.asp?p="+lau;
spannode.href = 'http://www.andafter.org/ofertas/' + lau;
spannode.target = "_blank";
spannode.rel = "nofollow";
//spannode.href = oul;
skip = 1;
contatotal = contatotal+1;
}
}
else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
for (var i = 0; i < node.childNodes.length; ++i) {
var nome = String(node.childNodes[i].tagName);
if (nome != "A"){
i += $.aawords(node.childNodes[i], te, lau);
}
}
}
return skip;
}
;
});
jQuery.fn.removeHighlight = function() {
this.find("span.highlight").each(function() {
with (this.parentNode) {
replaceChild(this.firstChild, this);
normalize();
}
});
return this;
};
$(document).ready(function(){
//Adiciona carrinho em links para o Buscapé
//$("a[href*='buscape']").addClass("product_link");
$("#HOTWordsTxt").each(function() {
$.aawords(this, " MP3 ", "mp3-mp4");$.aawords(this, " PROGRAMADOR ", "livro/desenvolvedor");$.aawords(this, " VELOCIDADE ", "jogos-pc/needd-for-speed");$.aawords(this, " COOKIES ", "livro/asp");$.aawords(this, " DVD ", "dvd/the-big-bang-theory");$.aawords(this, " PS3 ", "jogos-ps3");$.aawords(this, " FOTOGRAFIA ", "camera-digital");$.aawords(this, " DESIGN ", "livro/design");$.aawords(this, " TELA ", "monitor");$.aawords(this, " IPOD ", "mp3-mp4");$.aawords(this, " HUMOR ", "dvd/the-big-bang-theory");$.aawords(this, " MONITOR ", "monitor");$.aawords(this, " TRABALHAR ", "livro/emprego");$.aawords(this, " SERIADOS ", "dvd/season");$.aawords(this, " RUBY ", "livro/ruby-on-rails");$.aawords(this, " FOTO ", "camera-digital");$.aawords(this, " SERIADO ", "dvd/season");$.aawords(this, " PHP ", "livro/php");$.aawords(this, " NOTEBOOK ", "notebook");$.aawords(this, " GEEK ", "livro/geek");$.aawords(this, " CERVEJA ", "caneca-chopp");$.aawords(this, " DESENHAR ", "mesa-digitalizadora");$.aawords(this, " MOBILIDADE ", "notebook/eeepc");$.aawords(this, " JOGO ", "jogos-pc");$.aawords(this, " TABLET ", "mesa-digitalizadora");$.aawords(this, " MARIO ", "");$.aawords(this, " CAFÉ ", "cafeteira");$.aawords(this, " BLOGS ", "livro/blog");$.aawords(this, " JAVASCRIPT ", "livro/javascript");$.aawords(this, " SIMPSONS ", "dvd/simpsons");$.aawords(this, " INTERNET ", "livro/internet");$.aawords(this, " ASP ", "livro/asp");$.aawords(this, " DESENHO ", "mesa-digitalizadora/wacon");$.aawords(this, " CARRO ", "automoveis");$.aawords(this, " TV ", "tv/hdtv");$.aawords(this, " ILUSTRAÇÃO ", "mesa-digitalizadora/wacon");$.aawords(this, " FILMES ", "dvd");$.aawords(this, " EMPREGO ", "livro/emprego");$.aawords(this, " PROGRAMAÇÃO ", "livro/programacao");$.aawords(this, " DESENVOLVEDOR ", "livro/desenvolvedor");$.aawords(this, " TRABALHO ", "livro/emprego");$.aawords(this, " NERD ", "livro/nerd");$.aawords(this, " SEGURANÇA ", "livro/seguranca-internet");$.aawords(this, " CORRIDA ", "jogos-pc/needd-for-speed");$.aawords(this, " FILME ", "dvd");$.aawords(this, " GAME ", "jogos-pc");$.aawords(this, " FUTEBOL ", "futebol");$.aawords(this, " LIVRO ", "livro");$.aawords(this, " CELULAR ", "celular/nokia");$.aawords(this, " COMPUTADOR ", "notebook");$.aawords(this, " ENGRAÇADO ", "dvd/simpsons");$.aawords(this, " WACON ", "mesa-digitalizadora");$.aawords(this, " MERCEDES ", "automoveis/mercedes");$.aawords(this, " PROGRAMAR ", "livro/logica-de-programacao");$.aawords(this, " CAFETEIRA ", "cafeteira");$.aawords(this, " AUTOMOTIVO ", "automoveis");$.aawords(this, " CONEXÃO ", "informatica/modem");$.aawords(this, " FORMATAR ", "notebook");$.aawords(this, " VÍDEO ", "filmadora");
});
});