[ZAHIR] Main Object


/ Published in: JavaScript
Save to your folder(s)

Este é o pedaço de código que deve ser sempre incluído em freetext


Copy this code and paste it in your HTML
  1. ZAHIR$sitio = function () {
  2. return{
  3.  
  4.  
  5. zclk: "$zahir/pl/click.pl%3fskey=$skey",
  6. swfOurl: "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",
  7. ebIfrm: "$zahir/eyeblaster.php?src=",
  8. Ifrm3rd: "$zahir/iframe.php?s=",
  9.  
  10.  
  11.  
  12. pixelTop: function(){return ZAHIR$sitio.validate("$descreve", "100")},
  13. pixelLeft: function(){return ZAHIR$sitio.validate("$iframesrc", "0")},
  14. destroyCounter: function(){return ZAHIR$sitio.validate("$scriptsrc", "30")},
  15.  
  16.  
  17.  
  18. validate: function (param, default_value){
  19. if (param == ""){param = default_value}
  20. return param;
  21. },
  22.  
  23.  
  24. getEl: function (i){return document.getElementById(i)},
  25.  
  26. pixel: function(p) {
  27. if(p){
  28. img = new Image(1,1)
  29. img.src = ZAHIR$sitio.srcMacro(p);
  30. img.style.display="none";
  31. return img;
  32. }
  33. },
  34.  
  35.  
  36. Image: function(file, selector, w, h, click){
  37. if(!click){click = unescape(ZAHIR$sitio.zclk)}
  38. ZAHIR$sitio.getEl(selector).innerHTML='<a href="'+click+'" target="_blank"><img src="'+file+'" alt="" width="'+w+'" height="'+h+'" border="0" /></a>';
  39.  
  40. },
  41.  
  42.  
  43. BGimage: function(where, color, file, xpos, ypos, type ){
  44. var rpt = "no-repeat";
  45. if (where == "body"){
  46. var y = document.getElementsByTagName('body')[0];
  47. }else{
  48. var y = document.getElementById (where);
  49. };
  50. //y.style.backgroundColor = color;
  51. //y.backgroundImage = url(file);
  52.  
  53. y.style.background=''+color+' url('+file+') '+type+' '+rpt+' '+xpos+' '+ypos+'';
  54.  
  55. },
  56.  
  57.  
  58. BGclick: function(where, click){
  59.  
  60. if(!click){click = ZAHIR$sitio.zclk};
  61. jQuery(where).css('position','relative');
  62.  
  63.  
  64. var elWidth = jQuery(where).width();
  65. var screen=(document.all) ? document.body.offsetWidth : window.innerWidth;
  66. var height = 1000;var bandas = 150;
  67.  
  68. leftbg= jQuery('<div class="adserverbg" style="position:absolute; width:'+bandas+'px; height:'+height+'px; top:-25px; left:'+-bandas+'px; cursor:pointer"></div>');
  69. rightbg= jQuery('<div class="adserverbg" style="position:absolute; width:'+bandas+'px; height:'+height+'px; top:-25px; left:'+elWidth+'px; cursor:pointer"></div>');
  70. jQuery(where).prepend(leftbg);
  71. jQuery(where).prepend(rightbg);
  72.  
  73. jQuery(".adserverbg").click(function () {
  74. window.open(unescape(click));
  75. });
  76.  
  77. if (jQuery('#pubTop').length) {
  78. jQuery("#pubTop").click(function () {
  79. window.open(unescape(click));
  80. });
  81. };
  82.  
  83.  
  84.  
  85. },
  86.  
  87.  
  88. iframeScript3rd: function(container, src, w, h, beacon){
  89. var t;
  90. src.indexOf("bs.serving-sys.com")>-1 ? t = ZAHIR$sitio.ebIfrm : t= ZAHIR$sitio.Ifrm3rd;
  91. ZAHIR$sitio.iframeGen(ZAHIR$sitio.srcMacro(t+escape(src)), container, w, h);
  92. },
  93.  
  94.  
  95. iframeGen: function(src, container, w, h) {
  96. var zcont='<IFRAME SRC="'+ZAHIR$sitio.srcMacro(t+escape(src))+'" WIDTH="'+w+'" HEIGHT="'+h+'" MARGINWIDTH="0" MARGINHEIGHT="0" HSPACE="0" VSPACE="0" FRAMEBORDER="0" SCROLLING="no"></iframe>';
  97. if (document.getElementById(container)){
  98. document.getElementById(container).innerHTML = zcont;
  99. }else{try{console.log("Adserver_Error: I'm trying to append content to an inexistent container: tag id: $sitio");}catch(e){};}
  100. },
  101.  
  102.  
  103.  
  104. Banner: function(file, selector, w1, h1, mode, click){
  105. var r=Math.floor(Math.random()*110)
  106. ZAHIR$sitio.domSwf("temp"+r, selector);
  107. ZAHIR$sitio.gen(file, "temp"+r, w1, h1, mode, click);
  108. },
  109.  
  110.  
  111.  
  112. Layer: function(who, w1, h1, top, left, counter){
  113.  
  114. ZAHIR$sitio.domSwf("zahirWrapper$sitio", who, "first", w1, "0");
  115.  
  116. var a = ZAHIR$sitio.getEl("zahirWrapper$sitio");
  117. a.style.margin = "auto";
  118. a.style.width = w1+"px";
  119. a.style.position = "relative";
  120. a.style.zIndex= "10000";
  121. a.style.overflow = "visible";
  122.  
  123. ZAHIR$sitio.domSwf("zahirLayer$sitio", "zahirWrapper$sitio", "first", w1, h1);
  124. var b = document.getElementById("zahirLayer$sitio");
  125. b.style.position = "absolute";
  126. b.style.top = top+"px";
  127. b.style.left = left+"px";
  128. b.style.zIndex = "10000";
  129. b.style.overflow = "visible";
  130.  
  131. ZAHIR$sitio.domSwf("zahirLayer2$sitio", "zahirLayer$sitio", "first", w1, h1);
  132.  
  133. if(counter){
  134. counter= counter * 1000;
  135. setTimeout("ZAHIR$sitio.mycounter('zahirWrapper$sitio', 'destroy')", counter)
  136. }
  137. },
  138.  
  139. domSwf: function(el, who, where, w, h ){
  140.  
  141. var newEl = document.createElement("div");
  142. newEl.id = el;
  143.  
  144. if (who == "body"){
  145. var y = document.getElementsByTagName('body')[0];
  146. }else{
  147. var y = document.getElementById (who);
  148. }
  149. if(where == "first"){
  150. y.insertBefore(newEl, y.firstChild);
  151. }else{
  152. y.appendChild(newEl);
  153. }
  154.  
  155. },
  156.  
  157.  
  158.  
  159. getAd: function(file, selector, w1, h1, mode, click){
  160.  
  161. var t = setInterval(function() {
  162. if (typeof swfobject != "undefined") {
  163. if (swfobject.hasFlashPlayerVersion("8.0.0")) {
  164. if(!click){click = ZAHIR$sitio.zclk}
  165. var flashvars = {
  166. ad: "ZAHIR$sitio.AS2JS$sitio",
  167. clickTag: click,
  168. clickTAG: click,
  169. clicktag: click
  170. }
  171. var params = {
  172. menu: "false",
  173. quality: "high",
  174. wmode: mode,
  175. AllowScriptAccess: "always"
  176. }
  177. var attributes = {id: selector}
  178.  
  179. swfobject.embedSWF(file, selector, w1, h1, "8.0.0", "", flashvars, params, attributes);
  180. };
  181. clearInterval(t);
  182. t = null;
  183. }
  184. }, 250);
  185. },
  186.  
  187.  
  188. load: function (what) {
  189. var head = document.getElementsByTagName("head")[0];
  190. var script = document.createElement("script");
  191. script.type = "text/javascript";
  192. script.src = what;
  193. head.appendChild(script);
  194. },
  195.  
  196. gen: function(file, selector, w1, h1, mode, click){
  197. if (typeof swfobject != "undefined") {
  198. ZAHIR$sitio.getAd(file, selector, w1, h1, mode, click);
  199. }else{
  200. ZAHIR$sitio.load(ZAHIR$sitio.swfOurl);
  201. ZAHIR$sitio.getAd(file, selector, w1, h1, mode, click);
  202. }
  203. },
  204.  
  205. srcMacro: function (src){
  206. var ord=Math.floor(Math.random()*101)
  207. if(src.indexOf("zahirord")>-1){src= src.replace(/zahirord/gi, ord);}
  208. if(src.indexOf("zahirclick")>-1){src= src.replace(/zahirclick/gi, ZAHIR$sitio.zclk);}
  209. return src;
  210. },
  211.  
  212.  
  213. mycounter: function(who, what){
  214. if (document.getElementById(who)){
  215. switch(what){
  216. case "destroy":
  217. var el = document.getElementById(who);
  218. el.parentNode.removeChild(el);
  219.  
  220. break;
  221. case "hide":
  222. var el = document.getElementById(who);
  223. el.style.display = "none";
  224.  
  225. break;
  226. case "empty":
  227. var el = document.getElementById(who);
  228. while (el.hasChildNodes()){
  229. el.removeChild(el.lastChild);
  230. };
  231.  
  232. break;
  233. case "reload":
  234. if(reloadAd){
  235. var el = document.getElementById(who);
  236. el.parentNode.removeChild(el);
  237. reloadAd($sitio);
  238. }
  239. break;
  240. default:
  241. var el = document.getElementById(who);
  242. el.parentNode.removeChild(el);
  243.  
  244. };
  245. };
  246. },
  247.  
  248.  
  249. //event control from actionscript
  250. AS2JS$sitio: function (what) {
  251.  
  252. if(what == "close"){
  253. try{console.log("close");}catch(e){};
  254. ZAHIR$sitio.mycounter("zahirWrapper$sitio", "destroy")
  255.  
  256.  
  257. }else if(what == "open"){
  258. try{console.log("open");}catch(e){};
  259. ZAHIR$sitio.Layer("body", "$width", "$height", ZAHIR$sitio.pixelTop(), ZAHIR$sitio.pixelLeft() , ZAHIR$sitio.destroyCounter());
  260. ZAHIR$sitio.gen("$banner", "zahirLayer2$sitio", "$width", "$height", "opaque");
  261. }
  262. }
  263.  
  264. }
  265. }();
  266.  
  267. //usa o $umporum como tracking pixel, se o campo tiver link
  268. if ("$umporum" != ""){ZAHIR$sitio.pixel("$umporum")}

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.