prostoshop |
25.12.2012 10:32 |
Хотел спросить, а вот это кусок саповского кода же?
<script type="text/javascript">//<![CDATA[
function chameleon(){var blockClass="c4e745-line";var delimeter="|";var tmp=document.getElementsByTagName("div");var l=tmp.length;var divs=[];var countBlock=0;for(var i=0;i<l;i++){if(tmp[i].className=="c4e745-line"){with(tmp[i]){id="c4e745-l-"+countBlock}countBlock++}if(tmp[i].className=="c4e745-l"){with(tmp[i]){id="c4e745-l-to-"+(countBlock-1)}}}for(var i=0;i<countBlock;i++){var o=document.getElementById("c4e745-l-"+i);if(!o||o==undefined){continue}var to=document.getElementById("c4e745-l-to-"+i);if(!to||to==undefined){continue}var text=this.trim(o.innerHTML);if(text==""){continue} var tmp=text.split(delimeter);var links=[];for(var j=0;j<tmp.length;j++){var l=this.GetContext(tmp[j]);if(l!==null){links[j]=l}}this.ShowBlock(links,o,to)}}chameleon.prototyp e.ShowBlock=function(links,o,to){var a,hBlock;for(var i=0;i<links.length;i++){hBlock=this.ce("DIV");with (hBlock){className="block-c4e745-l"}tDiv=this.ce("DIV");a=this.ce("A");a.target='_b lank';a.href=links[i].url;a.appendChild(this.ctn(links[i].title));tDiv.appendChild(a);hBlock.appendChild(tD iv);tDiv=this.ce("DIV");with(tDiv){className="text-c4e745-l"}tDiv.appendChild(this.ctn(links[i].text));hBlock.appendChild(tDiv);tDiv=this.ce("DIV ");with(tDiv){className="host-c4e745-l"}tDiv.appendChild(this.ctn(links[i].site));hBlock.appendChild(tDiv);to.appendChild(hB lock)}o.innerHTML="";o.parentNode.removeChild(o);t o.removeAttribute("id")};chameleon.prototype.GetCo ntext=function(a){a=this.trim(a.replace(/\s+/," "));if(a.match(/(.*)<a [^>]*href=["]([^"]+)"[^>]*>([^<]*)<\/a>(.*)/i)===null){return null}var e=RegExp.$1==""?RegExp.$4:RegExp.$1+RegExp.$3+RegE xp.$4;var c=RegExp.$2;var d=RegExp.$3;if(e==""){e=d}var b=c.replace(/^http:\/\//i,"");b=b.replace(/\/.*$/i,"");b=b.replace(/^www\./i,"");return{url:c,title:d,text:e,site:b}};chamele on.prototype.trim=function(a){return a.length>0?a.replace(/(^\s+|\s+$)/,""):""};chameleon.prototype.ce=function(a){ret urn document.createElement(a)};chameleon.prototype.ctn =function(a){return document.createTextNode(a)};function myInitLinks(){new chameleon()}if(typeof window.addEventListener!="undefined"){window.addEv entListener("load",myInitLinks,false)}else{if(type of window.attachEvent!="undefined"){window.attachEven t("onload",myInitLinks)}};//]]</script>
|