Advertisement
muymusicacom

_exitpop.js

Feb 16th, 2014
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    
  2.  
  3.     function addLoadEvent(func) {
  4.              var oldonload = window.onload;
  5.              if (typeof window.onload != 'function') {
  6.                         window.onload = func; } else {
  7.                         window.onload = function() {
  8.                                 if (oldonload) { oldonload();
  9.                                 }   func();
  10.                         }
  11.                         }
  12.     }
  13.                        
  14.     function addClickEvent(a,i,func) {
  15.                 if (typeof a[i].onclick != 'function') {
  16.                            a[i].onclick = func;
  17.                 }
  18.     }
  19.            
  20.     var theDiv = '<div id="ExitSplashDiv"  style="display:block; width:100%; height:100%; position:absolute; background:#FFFFFF; margin-top:0px; margin-left:0px;" align="center">';
  21.            
  22.     theDiv = theDiv + '<iframe src="'+exitsplashpage+'" width="100%" height="100%" align="middle" frameborder="0"></iframe>';
  23.    
  24.     theDiv = theDiv + '</div>';
  25.  
  26.     theBody = document.body;
  27.         if (!theBody) {
  28.             theBody = document.getElementById("body");
  29.  
  30.         if (!theBody) {
  31.                 theBody = document.getElementsByTagName("body")[0];
  32.         }
  33.         }
  34.            
  35.         var NoPopUp = false;
  36.            
  37.             function DisplayExitSplash(){
  38.                 if(NoPopUp == false) {
  39.                     window.scrollTo(0,0);
  40.                     NoPopUp=true; divtag = document.createElement("div");
  41.                     divtag.setAttribute("id","ExitSplashMainOuterLayer");
  42.                     divtag.style.position="absolute"; divtag.style.width="100%";
  43.                     divtag.style.height="100%"; divtag.style.zIndex="99";
  44.                     divtag.style.left="0px"; divtag.style.top="0px";
  45.                     divtag.innerHTML=theDiv;
  46.                     theBody.innerHTML="";
  47.                     theBody.topMargin="0px";
  48.                     theBody.rightMargin="0px";
  49.                     theBody.bottomMargin="0px";
  50.                     theBody.leftMargin="0px";
  51.                     theBody.style.overflow="hidden";
  52.                     theBody.appendChild(divtag);
  53.                     return exitsplashmessage;
  54.                 }
  55.             }
  56.                
  57.         var a = document.getElementsByTagName('A');
  58.            
  59.             for (var i = 0; i < a.length; i++) {
  60.                     if(a[i].target !== 'test') {addClickEvent(a,i,
  61.                    
  62.                     function(){ NoPopUp=true; });
  63.                    
  64.                     }
  65.                         else {
  66.                                 addClickEvent(a,i,
  67.                     function(){ NoPopUp=false; });
  68.                         }
  69.             }
  70.                    
  71.         disablelinksfunc = function(){var a = document.getElementsByTagName('A');
  72.                                  for (var i = 0; i < a.length; i++) {
  73.                                     if(a[i].target !== '_blank') {addClickEvent(a,i, function(){ NoPopUp=true; });
  74.                         }
  75.                             else{addClickEvent(a,i, function(){ NoPopUp=false;});}}}
  76.                        
  77.                 addLoadEvent(disablelinksfunc);
  78.                
  79.                 disableformsfunc = function(){ var f = document.getElementsByTagName('FORM');
  80.                         for (var i=0;i<f.length;i++){
  81.                             if (!f[i].onclick){ f[i].onclick=function(){ NoPopUp=true; }
  82.                         }
  83.                             else if (!f[i].onsubmit){ f[i].onsubmit=function(){ NoPopUp=true; }}}}
  84.  
  85.                 addLoadEvent(disableformsfunc);
  86.                
  87.                 window.onbeforeunload = DisplayExitSplash;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement