Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--
- Last update: 30/10/2014
- 21/05/2014: Multiplas opções de expansão/fechar
- 22/11: Possibilidade de forçar Btn Fechar
- 22/11: Possibilidade de servir vídeo via Newsl
- 22/11: Possibilidade de servir SWF ou imagem
- 21/11: clickTag Overlay
- -->
- <img src="%%VIEW_URL_UNESC%%http://s0.2mdn.net/dot.gif" width="1" height="1" style="display:none"/>
- <script type='text/javascript'>
- if (typeof DFP_bo ==='undefined'){
- var DFP_bo = {
- //SWF1/IMG1 (normal)
- swf1: '%%FILE:SWF1%%',
- width: '980',
- height: '100',
- //SWF2/IMG2 (expandido)
- swf2: '%%FILE:SWF2%%',
- width2: '980',
- height2: '430',
- ForceBtnFechar: true, //Quando não existe mesmo botão "label de fechar"
- ForceBtnFecharOverlay: false, //Coloca overlay sobre o swf2, com ação de fechar (Já existe o "label de fechar")
- ForceBtnFecharWidth: 80, //Largura da área de overlay
- ForceBtnFecharHeight: 30, //Altura da área de overlay
- ForceBtnFecharBottom: 0, // Posição Y da área de Overlay. Normalmente está encostada ao bottom do ad
- ForceBtnFecharRight: 0, // Posição Y da área de Overlay. Normalmente está alinhado à direita
- videoNewsl: false, //puxa vídeo no newsl, com o nosso player
- videoNewslIframeUrl: 'http://newsl.iol.pt/pub/campanhas/missaosorriso/iframe-vid.html',
- videoNewslVideoUrl: 'video.flv',
- videoNewsWidth: 465, //Largura do video
- videoNewsHeight: 340, //Altura do video
- videoNewsTop: 50, // Posição Y da área de video sobre o ad.
- videoNewsLeft: 50, // Posição X da área de video sobre o ad.
- mode: 'transparent', //alterar por transparent, se desejado
- clickTagOverlay: true, //Coloca Evento de expansão com Overlay no swf1
- //DO NOT CHANGE BELOW
- click: '%%CLICK_URL_ESC%%%%DEST_URL%%',
- dfpmacro: '%%CLICK_URL_ESC%%',
- pre_utm_build: function () {if(this.click.indexOf('?') > -1){return '%26';}else{return '?'}},
- utm_content_value: function(){return this.width+'x'+this.height}, //nome/variação do ad
- utm_source_value: document.domain, //default is document value
- utm_build: function(){return this.pre_utm_build()+'utm_source%3D'+this.utm_source_value+'%26utm_medium%3D'+this.utm_medium_value+'%26utm_content%3D'+this.utm_content_value()+'%26utm_campaign%3D'+this.utm_campaign_value+''},
- zclk: function(){if(this.utm){return this.dfpmacro+this.click+this.utm_build()}else{return this.click}},
- debug: function(m){try{console.log('ADSERVER DEBUG POS: '+m)}catch(e){}},
- swfOurl: 'http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js',
- validate: function (param, default_value){
- if (param == ''){param = default_value}
- return param;
- },
- getEl: function (i){return document.getElementById(i)},
- pixel: function(p) {
- if(p){
- img = new Image(1,1)
- img.src = DFP_bo.srcMacro(p);
- img.style.display='none';
- return img;
- }
- },
- Image: function(file, selector, w, h, click){
- if(!click){click = DFP_bo.click}
- DFP_bo.getEl(selector).innerHTML='<a href='+click+' target="_blank"><img src='+file+' alt="" width='+w+' height='+h+' border="0" /></a>';
- },
- bannerOver: function (pixels, click, anim) {
- anim = anim || false;
- var pivot = '#bannerover';
- if(!$(pivot).length) {
- var bo=$('<div></div>');
- bo.attr('id', pivot);
- $('body').append(bo);
- }
- /* Do not change below */
- $(pivot).css('display','block');
- $(pivot).css('width','100%');
- $(pivot).css('margin','0 auto');
- if (anim) {
- $(pivot).animate({
- height: pixels+'px'
- }, 2000, function() {
- if (click != undefined){
- $(this).css('cursor','pointer');
- $(this).click(function() {
- window.open(click)
- });
- };
- });
- }else {
- $(pivot).css('height',pixels+'px');
- if (click != undefined){
- $(pivot).css('cursor','pointer');
- $(pivot).click(function() {
- window.open(click)
- });
- };
- }
- },
- iframeScript3rd: function(container, src, w, h, beacon){
- var t;
- src.indexOf('bs.serving-sys.com')>-1 ? t = DFP_bo.ebIfrm : t= DFP_bo.Ifrm3rd;
- DFP_bo.iframeGen(DFP_bo.srcMacro(t+escape(src)), container, w, h);
- },
- iframeGen: function(src, container, w, h) {
- var zcont='<IFRAME SRC='+src+' WIDTH='+w+' HEIGHT='+h+' MARGINWIDTH="0" MARGINHEIGHT="0" HSPACE="0" VSPACE="0" FRAMEBORDER="0" SCROLLING="no"></iframe>';
- if (document.getElementById(container)){
- document.getElementById(container).innerHTML = zcont;
- }else{try{console.log('Adserver_Error: trying to append content to an inexistent container: tag id: 223');}catch(e){};}
- },
- Banner: function(file, selector, w1, h1, mode, click){
- var r=Math.floor(Math.random()*110)
- DFP_bo.domSwf('temp'+r, selector);
- DFP_bo.gen(file, 'temp'+r, w1, h1, mode, click);
- },
- domSwf: function(el, who, where, w, h ){
- var newEl = document.createElement('div');
- newEl.id = el;
- if (who == 'body'){
- var y = document.getElementsByTagName('body')[0];
- }else{
- var y = document.getElementById (who);
- }
- if(where == 'first'){
- y.insertBefore(newEl, y.firstChild);
- }else{
- y.appendChild(newEl);
- }
- },
- getAd: function(file, selector, w1, h1, mode, click){
- var t = setInterval(function() {
- if (typeof swfobject != 'undefined') {
- if (swfobject.hasFlashPlayerVersion('8.0.0')) {
- if(!click){click = escape(DFP_bo.zclk())}
- var flashvars = {
- ad: 'DFP_bo.AS2JS223',
- clickTag: click,
- clickTAG: click,
- clicktag: click
- }
- var params = {
- menu: 'false',
- quality: 'high',
- wmode: mode,
- AllowScriptAccess: 'always'
- }
- var attributes = {id: selector}
- swfobject.embedSWF(file, selector, w1, h1, '8.0.0', '', flashvars, params, attributes);
- };
- clearInterval(t);
- t = null;
- }
- }, 250);
- },
- load: function (what) {
- var head = document.getElementsByTagName('head')[0];
- var script = document.createElement('script');
- script.type = 'text/javascript';
- script.src = what;
- head.appendChild(script);
- },
- gen: function(file, selector, w1, h1, mode, click){
- if (typeof swfobject != 'undefined') {
- DFP_bo.getAd(file, selector, w1, h1, mode, click);
- }else{
- DFP_bo.load(DFP_bo.swfOurl);
- DFP_bo.getAd(file, selector, w1, h1, mode, click);
- }
- },
- srcMacro: function (src){
- var ord=Math.floor(Math.random()*10001)
- if(src.indexOf('rand')>-1){src= src.replace(/rand/gi, ord);}
- //if(src.indexOf('click')>-1){src= src.replace(/click/gi, DFP_bo.zclk());}
- return src;
- },
- mycounter: function(who, what){
- if (document.getElementById(who)){
- switch(what){
- case 'destroy':
- // var el = document.getElementById(who);
- // el.parentNode.removeChild(el);
- $('#'+who).fadeOut('slow', function() {
- $('#'+who).remove();
- document.body.style.overflow = 'auto';
- $('#barraIOL').fadeIn();
- });
- break;
- case 'hide':
- var el = document.getElementById(who);
- el.style.display = 'none';
- break;
- case 'empty':
- var el = document.getElementById(who);
- while (el.hasChildNodes()){
- el.removeChild(el.lastChild);
- };
- break;
- case 'reload':
- if(reloadAd){
- var el = document.getElementById(who);
- el.parentNode.removeChild(el);
- reloadAd(223);
- }
- break;
- default:
- var el = document.getElementById(who);
- el.parentNode.removeChild(el);
- };
- };
- },
- //event control from actionscript
- AS2JS223: function (what) {
- if(what == 'close'){
- try{console.log('close');}catch(e){};
- DFP_bo.mycounter('zahirWrapper223', 'destroy')
- }else if(what == 'open'){
- try{console.log('open');}catch(e){};
- DFP_bo.Layer('body', '$width', '$height', DFP_bo.pixelTop(), DFP_bo.pixelLeft() , DFP_bo.destroyCounter());
- DFP_bo.gen('$banner', 'zahirLayer2223', '$width', '$height', 'opaque');
- }
- }
- };
- function yourFunctionToRun(){
- $(function() {
- //DO IT
- $('#LDB1').remove();
- $('#bannerover').css('display','block');
- $('#bannerover').css('height',DFP_bo.height+'px');
- $('#bannerover').css('textAlign','center');
- $('#bannerover').css('width',DFP_bo.width+'px');
- $('#bannerover').css('position','relative');
- $('#bannerover').css('margin','10px auto');
- DFP_bo.Banner(DFP_bo.swf1, 'bannerover', DFP_bo.width, DFP_bo.height, DFP_bo.mode)
- //Gera layer por cima do swf1- no caso de não ter esta ação de rollover no Actionscript
- if (DFP_bo.clickTagOverlay) {
- $('#bannerover').prepend('<div id="BO-clicktag" style="cursor:pointer; position:absolute; top: 0px; right: 0px; z-index 10000; width: 980px; cursor:pointer; height:100px"><img src="http://s0.2mdn.net/dot.gif" height="100" width="980"/></div>');
- $('#BO-clicktag').mouseover(function() {openThis()});
- };
- });
- }
- function runYourFunctionWhenJQueryIsLoaded() {
- if (window.$){
- //possibly some other JQuery checks to make sure that everything is loaded here
- yourFunctionToRun();
- } else {
- setTimeout(runYourFunctionWhenJQueryIsLoaded, 50);
- }
- }
- runYourFunctionWhenJQueryIsLoaded();
- function openThis() {
- DFP_bo.debug('openThis f called');
- $('#bannerover').empty();
- //DFP_bo.Image(DFP_bo.swf2, 'bannerover', DFP_bo.width2, DFP_bo.height2) //if image
- DFP_bo.Banner(DFP_bo.swf2, 'bannerover', DFP_bo.width2, DFP_bo.height2, DFP_bo.mode);
- $('#bannerover').animate({
- height: DFP_bo.height2+'px'
- }, 2000, function() {
- if (DFP_bo.videoNewsl) {
- $('#bannerover').append('<div id="videoBO" style="position:absolute; top: '+DFP_bo.videoNewsTop+'px; left:'+DFP_bo.videoNewsLeft+'px; z-index: 10000; width: '+DFP_bo.videoNewsWidth+'px; height: '+DFP_bo.videoNewsHeight+'px;"></div>');
- DFP_bo.iframeGen(''+DFP_bo.videoNewslIframeUrl+'?file='+DFP_bo.videoNewslVideoUrl+'&w='+DFP_bo.videoNewsWidth+'&h='+DFP_bo.videoNewsHeight+'', 'videoBO', DFP_bo.videoNewsWidth, DFP_bo.videoNewsHeight);
- };
- if (DFP_bo.ForceBtnFechar) {
- $('#bannerover').append('<div style="position:absolute; bottom:'+DFP_bo.ForceBtnFecharBottom+'px; right:'+DFP_bo.ForceBtnFecharRight+'px; cursor:pointer; font-size: 11px; margin: 2px auto 0px; padding:4px; background-color:#333; display:block; text-align:right; color: #fff;" id="closepointer">FECHAR</div>');
- $('#closepointer').click(function() {closeThis() });
- };
- if (DFP_bo.ForceBtnFecharOverlay) {
- $('#bannerover').append('<div style="position:absolute; bottom:'+DFP_bo.ForceBtnFecharBottom+'px; right:'+DFP_bo.ForceBtnFecharRight+'px; width: '+DFP_bo.ForceBtnFecharWidth+'px; height: '+DFP_bo.ForceBtnFecharHeight+'px; cursor:pointer; font-size: 11px; margin: 2px auto 0px; padding:4px; background-color:#333; display:block; text-align:right; color: #fff;" id="closepointer">FECHAR</div>');
- $('#closepointer').click(function() {closeThis() });
- };
- });
- };
- function closeThis() {
- DFP_bo.debug('[DFP_bo] ->closeThis () ');
- $('#bannerover').animate({
- height: parseInt(DFP_bo.height)+20+'px'
- }, 2000, function() {
- $('#bannerover').empty()
- DFP_bo.Banner(DFP_bo.swf1, 'bannerover', DFP_bo.width, DFP_bo.height, DFP_bo.mode);
- if (DFP_bo.clickTagOverlay) {
- $('#bannerover').prepend('<div id="BO-clicktag" style="cursor:pointer; position:absolute; top: 0px; right: 0px; z-index 10000; width: 980px; cursor:pointer; height:100px"><img src="http://s0.2mdn.net/dot.gif" height="100" width="980"/></div>');
- $('#BO-clicktag').click(function() {window.open(DFP_bo.click) });
- };
- //EXPANDIR
- $('#bannerover').append('<div style="position:absolute; top: 100px; right:0px; cursor:pointer; font-size: 11px; margin: 2px auto 0px; padding:4px; background-color:#333; display:block; text-align:right; color: #fff;" id="openpointer">EXPANDIR</div>');
- $('#openpointer').click(function() {openThis() });
- });
- };
- function pub_close() { closeThis() };
- };
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement