Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <img src="%%VIEW_URL_UNESC%%" width="1" height="1" style="display:none"/>
- <script type="text/javascript">
- if(typeof DFP_intro === "undefined"){
- var DFP_intro = {
- timerAutoClose: "20", //Segundos até fechar automaticamente
- width: "800", //largura da layer
- height: "600", //altura da layer
- tempoDelayFechar: 4, //tempo de delay do botão de fechar, em segundos
- clickoverlay: false, //true para gerar layer de click por cima do flash
- vidID: "0", //no caso de ser Intro Video, colocar o id do video que consta no BO IOL
- iframe: false, //true no caso de ser indicado um url/iframe no material a servir
- imagem: false, //true no caso de ser servida uma imagem, tem de ser incluída a imagem no campo fallback, abaixo
- material: "%%FILE:SWF1%%",
- fallback: "",
- mode: "transparent", //alterar por transparent, se desejado
- distanciaTopo: "80", //distância desde o topo da janela
- distanciaLeft: "0", //Posição horizontal 0 = centrado
- destUrl: "%%CLICK_URL_ESC%%%%DEST_URL%%",
- dynamicUrl: false, //ativa a substituição dinâmica da string tvi pelo site onde passa a pub
- getDynamicUrl: function(){
- var hostDfp = String(window.location.host).replace('www.', '');
- if (hostDfp.indexOf("iol") >-1) {
- //Tem dominio IOL
- //é o IOl.pt?
- if(hostDfp.split(".")[0] ==="iol") {
- return "iol.pt";
- }else{
- return hostDfp.split(".")[0];
- }
- }else {
- //fora do domínio IOL -> retorna dominio
- return hostDfp.split(".")[0];
- };
- },
- click: function () {
- if(DFP_intro.dynamicUrl){
- return DFP_intro.destUrl.replace(/tvi/gi,DFP_intro.getDynamicUrl());
- }else{
- return "%%CLICK_URL_ESC%%%%DEST_URL%%";
- }
- },
- utm_campaign_value: 'qem', //nome da campanha, promoção, produto etc
- utm: false, //alterar para false se não queremos por algum motivo usar utm
- utm_medium_value: 'display', //nome do veículo/medium (banner, email, ppc, etc)
- 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_intro.srcMacro(p);
- img.style.display="none";
- return img;
- }
- },
- Image: function(file, selector, w, h, click){
- if(!click){click = unescape(DFP_intro.zclk())}
- DFP_intro.getEl(selector).innerHTML='<a href="'+DFP_intro.click()+'" target="_blank"><img src="'+file+'" alt="" width="'+w+'" height="'+h+'" border="0" /></a>';
- },
- iframeScript3rd: function(container, src, w, h, beacon){
- var t;
- src.indexOf("bs.serving-sys.com")>-1 ? t = DFP_intro.ebIfrm : t= DFP_intro.Ifrm3rd;
- DFP_intro.iframeGen(DFP_intro.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: I'm 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_intro.domSwf("temp"+r, selector);
- DFP_intro.gen(file, "temp"+r, w1, h1, mode, click);
- },
- FecharBtn: function () {
- DFP_intro.debug("[DFP] - Intro Close Button init");
- dad = document.getElementById("IntroWrapper223");
- son = document.createElement("div");
- son.innerHTML = "<div id='intro_close' style='width: 100%; height: 50px; margin: 2px auto; text-align:center'><div style=' width: 230px; height:50px; cursor:pointer; margin:0px 0px 0px auto;'><img alt='close' src='http://newsl.iol.pt//pub/resources/introv1/generico_c.png' /></div></div>";
- dad.insertBefore(son, dad.firstChild);
- document.getElementById('intro_close').onclick = function(e){
- DFP_intro.mycounter('IntroWrapper', 'destroy');
- e.stopPropagation();
- };
- },
- preventDefault: function (e) {
- e = e || window.event;
- if (e.preventDefault)
- e.preventDefault();
- e.returnValue = false;
- },
- wheel: function (e) {
- DFP_intro.preventDefault(e);
- },
- DisableScroll: function (){
- document.body.style.overflow = 'hidden';
- document.getElementsByTagName("html")[0].style.overflow ='hidden';
- window.scrollTo(0, 0);
- if (typeof jwplayer != "undefined") {
- if (typeof jwplayer() === "object") {
- if (jwplayer().hasOwnProperty("setVolume") ) {
- jwplayer().setVolume("0")
- }
- };
- };
- if (window.addEventListener) {
- window.addEventListener('DOMMouseScroll', this.wheel, false);
- }
- window.onmousewheel = document.onmousewheel = this.wheel;
- document.ontouchmove = function(e){
- e.preventDefault();
- };
- },
- EnableScroll: function (){
- document.body.style.overflow = 'visible';
- document.getElementsByTagName("html")[0].style.overflow ='visible';
- if (typeof jwplayer != "undefined") {
- if (typeof jwplayer() === "object") {
- if (jwplayer().hasOwnProperty("setVolume") ) {
- jwplayer().setVolume("25")
- }
- };
- };
- if (window.removeEventListener) {
- window.removeEventListener('DOMMouseScroll', this.wheel, false);
- }
- window.onmousewheel = document.onmousewheel = document.onkeydown = null;
- document.ontouchmove = function(e){
- return true;
- }
- },
- Layer: function(who, w1, h1, top, left, counter){
- if(document.getElementById("MPU1"))document.getElementById("MPU1").style.display ='none';
- if(document.getElementById("LDB1"))document.getElementById("LDB1").style.display ='none';
- DFP_intro.DisableScroll();
- DFP_intro.domSwf("IntroWrapper", who, "first", "100%", "100%");
- var a = DFP_intro.getEl("IntroWrapper");
- a.style.margin = "auto";
- a.style.width = "100%";
- a.style.height = "100%";
- a.style.top = "0px";
- a.style.left = "0px";
- a.style.position = "fixed";
- a.style.zIndex= "10000";
- a.style.overflow = "visible";
- a.style.backgroundColor = "#fff";
- DFP_intro.domSwf("IntroWrapper223", "IntroWrapper", "first", w1, "0");
- var a = DFP_intro.getEl("IntroWrapper223");
- a.style.margin = "auto";
- a.style.width = w1+"px";
- a.style.position = "relative";
- a.style.zIndex= "9999";
- a.style.overflow = "visible";
- DFP_intro.domSwf("IntroDiv", "IntroWrapper223", "first", w1, h1);
- var b = document.getElementById("IntroDiv");
- b.style.position = "absolute";
- b.style.top = top+"px";
- b.style.left = left+"px";
- b.style.zIndex = "9998";
- b.style.overflow = "visible";
- DFP_intro.domSwf("zahirLayer2223", "IntroDiv", "first", w1, h1);
- setTimeout (function check_barraIOL () {
- if (document.getElementById("barraIOL")) {
- document.getElementById("barraIOL").style.display = 'none';
- }else {
- setTimeout (check_barraIOL, 300);
- }
- },
- 300);
- setTimeout("DFP_intro.FecharBtn()", DFP_intro.tempoDelayFechar * 1000);
- if(counter){
- counter= counter * 1000;
- setTimeout("DFP_intro.mycounter('IntroWrapper', 'destroy')", counter);
- }
- if ((DFP_intro.clickoverlay) && (document.getElementById("IntroDiv"))){
- dad = document.getElementById("IntroDiv");
- son = document.createElement("div");
- son.innerHTML = "<div id='overlay_click' style='cursor:pointer; position:absolute; top: 0px; right: 0px; z-index 10001; width: 800px; cursor:pointer; height:600px'><img src='http://s0.2mdn.net/dot.gif' height='600' width='800'/></div>";
- dad.insertBefore(son, dad.firstChild);
- document.getElementById('overlay_click').onclick = function(e){
- window.open(DFP_intro.click());
- e.stopPropagation();
- }
- };
- },
- 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){
- DFP_intro.Layer("body", DFP_intro.width, DFP_intro.height, DFP_intro.distanciaTopo, DFP_intro.distanciaLeft , DFP_intro.timerAutoClose);
- var t = setInterval(function() {
- if (typeof swfobject != "undefined") {
- clearInterval(t);
- t = null;
- if (swfobject.hasFlashPlayerVersion("8.0.0")) {
- DFP_intro.debug("[DFP_intro] - Has flash -> getAd()")
- if(!click){click = DFP_intro.click()}
- var flashvars = {
- ad: "DFP_intro.AS2JS223",
- vidID: DFP_intro.vidID,
- 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);
- }else{
- DFP_intro.debug("[DFP_intro] - No flash -> getAd()");
- }
- }
- }, 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 (DFP_intro.iframe) {
- DFP_intro.Layer("body", DFP_intro.width, DFP_intro.height, DFP_intro.distanciaTopo, DFP_intro.distanciaLeft , DFP_intro.timerAutoClose);
- DFP_intro.iframeGen(file, "IntroDiv", DFP_intro.width, DFP_intro.height);
- }else{
- if (!DFP_intro.isMobile()) {
- if((DFP_intro.fallback != "") && (DFP_intro.fallback)){
- DFP_intro.Layer("body", DFP_intro.width, DFP_intro.height, DFP_intro.distanciaTopo, DFP_intro.distanciaLeft , DFP_intro.timerAutoClose);
- DFP_intro.Image(DFP_intro.fallback, "zahirLayer2223", DFP_intro.width, DFP_intro.height);
- }else {
- if (typeof swfobject != "undefined") {
- DFP_intro.getAd(file, selector, w1, h1, mode, click);
- }else{
- DFP_intro.load(DFP_intro.swfOurl);
- DFP_intro.getAd(file, selector, w1, h1, mode, click);
- };
- }
- }else{ //mobile
- if(DFP_intro.fallback != ""){
- DFP_intro.Layer("body", DFP_intro.width, DFP_intro.height, DFP_intro.distanciaTopo, DFP_intro.distanciaLeft , DFP_intro.timerAutoClose);
- DFP_intro.Image(DFP_intro.fallback, "zahirLayer2223", DFP_intro.width, DFP_intro.height);
- };
- }
- };
- },
- 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_intro.zclk());}
- return src;
- },
- mycounter: function(who, what){
- if (document.getElementById(who)){
- switch(what){
- case "destroy":
- var el = document.getElementById(who);
- el.parentNode.removeChild(el);
- document.getElementsByTagName("html")[0].style.overflow ='visible';
- DFP_intro.EnableScroll();
- if(document.getElementById("MPU1"))document.getElementById("MPU1").style.display ='block';
- if(document.getElementById("LDB1"))document.getElementById("LDB1").style.display ='table';
- if(document.getElementById("barraIOL"))document.getElementById("barraIOL").style.display ='block';
- //tvi24 hack
- var host = String(window.location.host).replace('www.', '')
- if ((host === "tvi24.iol.pt") || ((host === "lux.iol.pt"))){
- var elems = document.getElementsByTagName('*'), i;
- for (i in elems) {
- if((' ' + elems[i].className + ' ').indexOf(' ' + "mrec" + ' ')
- > -1) {
- elems[i].style.float = "none"
- };
- };
- };
- if (host === "lux.iol.pt"){
- $('.manchetes, #media_gal, #media_gal_2, .lookdodia').iosSlider('update');
- };
- 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_intro.mycounter("IntroWrapper223", "destroy");
- }else if(what == "open"){
- try{console.log("open");}catch(e){};
- }
- },
- isMobile: function () {
- var userAgent = navigator.userAgent||navigator.vendor||window.opera;
- if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|android|ipad|playbook|silk|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0,4)))
- return true;
- else
- return false;
- },
- isIOS: function () {
- var userAgent = navigator.userAgent||navigator.vendor||window.opera;
- if(/ip(hone|od|ad)/i.test(userAgent))
- return true;
- else
- return false;
- }
- }
- //init
- if(!document.getElementById("IntroWrapper")) { //avoid more than one instance of an intro
- DFP_intro.gen(DFP_intro.material, "zahirLayer2223", DFP_intro.width, DFP_intro.height, DFP_intro.mode);
- };
- };
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement