// Designed by Mohammad Bahoosh// Copyright (c) by moisrex
// All rights reserved.
(function(){
function find_size(i,now,blurs){
var blur=Math.abs(parseInt(now-i));
return blurs[blur];
}
var plus=true;
Number.prototype.do_plus=function(){
if(plus==true)
return this+1;
else
return this-1;
};
function change_plus(){
if(plus==true)
plus=false;
else
plus=true;
}
function change_font_chars(elem,opts){
var cl='getElementsByClassName',
now=elem.getAttribute('effect');
now=now?parseInt(now):0;
var el=elem[cl]('moisrex_character');
now=now.do_plus();
if(now>el.length || now<0)
change_plus();
elem.setAttribute('effect',now);
for(var i=0;i<el.length;i++)
el.style.textShadow='none';
for(var i=now-opts.blurs.length-1;i<now+opts.blurs.length-1;i++){
if(el)
el.style.textShadow='0 0 1px '+opts.colors[0]+', 0 0 '+find_size(i,now,opts.blurs)+'px '+opts.colors[1];
}
var time=30;
setTimeout(function(){
change_font_chars(elem,opts);
},time);
}
Element.prototype.set_effect=function(opts){
var d=document,
e='getElementsByTagName',
cr='createElement';
var sources=this.innerHTML.trim();
this.innerHTML='';
this.setAttribute('effect',0);
for(var i=0;i<sources.length;i++){
var el=d[cr]('span');
el.innerHTML=sources.charAt(i);
el.className='moisrex_character';
this.appendChild(el);
}
change_font_chars(this,opts);
};
})();