Guest User

The JS That O2 insert into every page load

a guest
Jan 25th, 2012
211
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var bmi_htmlEdit=0;var bmi_ie;var bmi_ns;var bmi_safari;var bmi_imageObjSelected;var bmi_ffx_op_toolTip="Shift+R improves the quality of this image. Shift+A improves the quality of all images on this page.";var bmi_toolTip="Shift+R improves the quality of this image. CTRL+F5 reloads the whole page.";var bmi_ns_tooltip="Shift+Reload reloads the whole page.";var bmi_toolTipSeperator=" ... ";var bmi_concatStr="bmi_orig_img";var bmi_frameNotAllowed;var agt=navigator.userAgent.toLowerCase();var is_major=parseInt(navigator.appVersion);var is_minor=parseFloat(navigator.appVersion);var bmi_ns=((agt.indexOf('mozilla')!=-1)&&(agt.indexOf('spoofer')==-1)&&(agt.indexOf('compatible')==-1)&&(agt.indexOf('opera')==-1)&&(agt.indexOf('webtv')==-1)&&(agt.indexOf('hotjava')==-1));var bmi_ns2=(bmi_ns&&(is_major==2));var bmi_ns3=(bmi_ns&&(is_major==3));var bmi_ns4=(bmi_ns&&(is_major==4));var bmi_ns4up=(bmi_ns&&(is_major>=4));var bmi_nsonly=(bmi_ns&&((agt.indexOf(";nav")!=-1)||(agt.indexOf("; nav")!=-1)||(agt.indexOf("Netscape")!=-1)||(agt.indexOf("netscape")!=-1)));var bmi_ns6=(bmi_ns&&(is_major==5));var bmi_ns6up=(bmi_ns&&(is_major>=5));var is_gecko=(agt.indexOf('gecko')!=-1);var bmi_firefox=(agt.indexOf('firefox')!=-1);var bmi_safari=(agt.indexOf('applewebkit')!=-1);var bmi_ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1));var bmi_ie3=(bmi_ie&&(is_major<4));var bmi_ie4=(bmi_ie&&(is_major==4)&&(agt.indexOf("msie 4")!=-1));var bmi_ie4up=(bmi_ie&&(is_major>=4));var bmi_ie5=(bmi_ie&&(is_major==4)&&(agt.indexOf("msie 5.0")!=-1));var bmi_ie5_5=(bmi_ie&&(is_major==4)&&(agt.indexOf("msie 5.5")!=-1));var bmi_ie5up=(bmi_ie&&!bmi_ie3&&!bmi_ie4);var bmi_ie5_5up=(bmi_ie&&!bmi_ie3&&!bmi_ie4&&!bmi_ie5);var bmi_ie6=(bmi_ie&&(is_major==4)&&(agt.indexOf("msie 6.")!=-1));var bmi_ie6up=(bmi_ie&&!bmi_ie3&&!bmi_ie4&&!bmi_ie5&&!bmi_ie5_5);var bmi_opera=(agt.indexOf("opera")!=-1);var bmi_opera2=(agt.indexOf("opera 2")!=-1||agt.indexOf("opera/2")!=-1);var bmi_opera3=(agt.indexOf("opera 3")!=-1||agt.indexOf("opera/3")!=-1);var bmi_opera4=(agt.indexOf("opera 4")!=-1||agt.indexOf("opera/4")!=-1);var bmi_opera5=(agt.indexOf("opera 5")!=-1||agt.indexOf("opera/5")!=-1);var bmi_opera5up=(bmi_opera&&!bmi_opera2&&!bmi_opera3&&!bmi_opera4);function bmi_checkAccess(win){bmi_frameNotAllowed=0;window.bmioldOnError=window.onerror;window.onerror=null;try{var l=win.location.href;}
  2. catch(e){bmi_frameNotAllowed=1;}
  3. if(bmi_frameNotAllowed==1){window.onerror=window.bmioldOnError;return false;}
  4. else{window.onerror=window.bmioldOnError;return true;}}
  5. function bmi_ImageElement(el){if(!el)
  6. return 0;var str=new String(el.tagName);if(str.match("IMG")){return 1;}
  7. if(str.match("INPUT")){if(el.type&&bmi_checkInputType(el.type)){return 1;}
  8. return 0;}
  9. if(str.match("OBJECT")){if(el.type&&bmi_checkMIMEType(el.type)){el.bmi_objTag=1;return 1;}}
  10. if(str.match("EMBED")){if(el.type&&bmi_checkMIMEType(el.type)){return 1;}}
  11. if(str.match("AREA")||str.match("A")){var p=el.parentNode;if(p&&(p.tagName=="MAP")&&(p.bmi_imgObj!=null)){el.bmi_mapImage=p.bmi_imgObj;p.bmi_imgObj.bmi_areaEl=el;return 1;}}
  12. return 0;}
  13. function bmi_resetTitle(el){if(!el)
  14. return;if(el.bmi_touched!=1)
  15. return;el.title="";if(el.bmi_oldTitle){el.title=el.bmi_oldTitle;if(el.bmi_oldAlt){el.alt=el.bmi_oldAlt;}}
  16. else if(el.bmi_oldAlt){el.alt=el.bmi_oldAlt;if(bmi_ie)
  17. el.title=el.alt;}
  18. if(el.bmi_gotOriginal){if(el.bmi_orig_mouseout){el.onmouseout=el.bmi_orig_mouseout;}}}
  19. function bmi_checkElement(el){var pwindow=null;if(el.bmi_gotOriginal)
  20. return;if(el.bmi_mapImage){if(el.bmi_mapImage.bmi_gotOriginal==1){el.bmi_gotOriginal=1;if(el.bmi_touched)
  21. bmi_resetTitle(el);return;}}
  22. if(el.bmi_touched!=1){bmi_setElementTitle(el);if(el.onmouseout){el.bmi_orig_mouseout=el.onmouseout;el.onmouseout=bmi_safeMouseOutEvents;}
  23. else{el.onmouseout=bmi_safeMouseOutEvents;}}
  24. else{el.title=el.bmi_title;el.alt=el.bmi_alt;}
  25. if(el.bmi_mapImage)
  26. bmi_imageObjSelected=el.bmi_mapImage;else
  27. bmi_imageObjSelected=el;if(bmi_ie||bmi_opera)
  28. pwindow=document.parentWindow;else if(bmi_nsonly||is_gecko)
  29. pwindow=document.defaultView;else
  30. pwindow=null;if(pwindow&&(pwindow!=pwindow.parent)){pwindow.focus();el.bmi_changedFocus=1;}
  31. return;}
  32. function bmi_setElementTitle(el){var tmpAlt="";if(el.alt){tmpAlt=el.alt;el.bmi_oldAlt=el.alt;el.bmi_alt="";el.alt="";}
  33. if(el.title){el.bmi_oldTitle=el.title;el.title=el.title+"";}
  34. else{el.title=tmpAlt+"";}
  35. if(bmi_firefox){el.title=el.title+bmi_toolTipSeperator+bmi_ffx_op_toolTip;el.bmi_touched=1;el.bmi_title=el.title;}
  36. else if(bmi_opera||bmi_safari){el.title=bmi_ffx_op_toolTip;el.bmi_touched=1;el.bmi_title=el.title;}
  37. else{el.title=el.title+bmi_toolTipSeperator+bmi_toolTip;el.bmi_touched=1;el.bmi_title=el.title;}
  38. return;}
  39. function bmi_checkInputType(type){if(!type)
  40. return 0;if(type.match("image")||type.match("Image")){return 1;}
  41. return 0;}
  42. function bmi_checkMIMEType(type){var typeStr=new String(type);var find=/image\//gi;if(typeStr.search(find)!=-1)
  43. return 1;return 0;}
  44. function bmi_mouseOver(e){bmi_imageObjSelected=null;var obj;if(document.bmi_onmouseover_original!=null)
  45. document.bmi_onmouseover_original(e);if(bmi_ie||bmi_opera){var e=window.event;obj=e.srcElement;}
  46. else{obj=e.target;}
  47. if(obj.bmi_gotOriginal)
  48. return;if(bmi_ImageElement(obj)){bmi_checkElement(obj);}
  49. return;}
  50. function bmi_safeMouseOutEvents(e){var obj;if(bmi_ie||bmi_opera){e=window.event;obj=e.srcElement;}
  51. else{obj=e.target;}
  52. bmi_resetTitle(obj);if(obj.bmi_changedFocus==1){var pwindow=null;if(bmi_ie||bmi_opera)
  53. pwindow=document.parentWindow;else if(bmi_nsonly||is_gecko)
  54. pwindow=document.defaultView;else
  55. pwindow=null;if(pwindow){pwindow.top.focus();obj.bmi_changedFocus=0;}}
  56. if(obj.bmi_orig_mouseout){obj.bmi_orig_mouseout();}}
  57. function bmi_updateImageSrc(src)
  58. {var found=0;var find=/\?/g;var editUrl;var editIndex;var editProto;var bmiSignIndex;var bmiSign;srcString=new String(src);if(srcString.search(find)!=-1)
  59. {found=1;srcString=srcString.concat("&"+bmi_concatStr+"=1");}
  60. else
  61. {var i=srcString.lastIndexOf("/");var newStr=srcString.substring(i+1);srcString=srcString.concat("/"+bmi_concatStr+"/"+newStr);}
  62. if(bmi_htmlEdit){editIndex=srcString.indexOf("://");if(editIndex!=-1){editProto=srcString.substring(0,editIndex+3);editUrl=srcString.substring(editIndex+3);editIndex=editUrl.indexOf("/");if(editIndex!=-1){editUrl=editUrl.substring(editIndex+1);bmiSignIndex=editUrl.indexOf("/");if(bmiSignIndex!=-1){bmiSign =editUrl.substring(0,bmiSignIndex);if(bmiSign=="bmi"){editUrl=editUrl.substring(bmiSignIndex+1);srcString=editProto+editUrl;}}}}}
  63. return(srcString);}
  64. function bmi_replaceImages(array){if(!array)
  65. return;for(var i=0;i<array.length;i++){if(array[i].bmi_gotOriginal){continue;}
  66. if(array[i].bmi_objTag){array[i].data=bmi_updateImageSrc(array[i].data);}
  67. else{array[i].src=bmi_updateImageSrc(array[i].src);}
  68. array[i].bmi_gotOriginal=1;if(array[i].bmi_touched){bmi_resetTitle(array[i]);}}
  69. return;}
  70. function bmi_replaceInputImages(array){if(!array)
  71. return;for(var i=0;i<array.length;i++){if(array[i].bmi_gotOriginal){continue;}
  72. if(array[i].type&&bmi_checkInputType(array[i].type)){array[i].src=bmi_updateImageSrc(array[i].src);array[i].bmi_gotOriginal=1;if(array[i].bmi_touched){bmi_resetTitle(array[i]);}}}
  73. return;}
  74. function bmi_NSlayers(){if(document!=null){if(!document.layers){bmi_replaceImages(document.tags.IMG);bmi_replaceInputImages(document.tags.INPUT);return;}
  75. for(var i=0;i<document.layers.length;i++){bmi_NSlayers(document.layers[i].document);bmi_replaceImages(document.layers[i].document.tags.IMG);bmi_replaceInputImages(document.layers[i].document.tags.INPUT);}}
  76. return;}
  77. function bmi_downloadAllHandler(){if((true==bmi_checkAccess(parent))&&(parent.location.href!=self.location.href)){var newparent=parent;do{newparent=newparent.parent;if((false==bmi_checkAccess(newparent.parent))||(newparent.parent.location.href==newparent.location.href)){break;}}while(newparent);//
  78. var numFrames=newparent.frames.length;var index=0;var frame;for(;index<newparent.frames.length;index++){frame=newparent.frames[index];if(false==bmi_checkAccess(frame.window)){continue;}
  79. if(frame.window.bmi_reDownloadAllImages){frame.window.bmi_reDownloadAllImages();}}
  80. return;}
  81. bmi_reDownloadAllImages();}
  82. function bmi_reDownloadAllImages(){var imgArray;var inputArray;var backgroundArray;var numFrames=window.frames.length;var index=0;var frame;for(;index<numFrames;index++){frame=window.frames[index];if(false==bmi_checkAccess(frame.window)){continue;}
  83. if(frame.window.bmi_reDownloadAllImages){frame.window.bmi_reDownloadAllImages();}}
  84. if((bmi_ie5up||bmi_ns6up||bmi_opera5up||bmi_firefox)){imgArray=document.getElementsByTagName("IMG");inputArray=document.getElementsByTagName("INPUT");bmi_replaceImages(imgArray);bmi_replaceInputImages(inputArray);}
  85. else if(bmi_ns&&(bmi_ns4||bmi_ns3)){var imgArray;var docLayers;docLayers=document.layers;if(docLayers&&docLayers.length){for(var layi=0;layi<0;layi++){imgArray=docLayers[layi].document.images;bmi_replaceImages(imgArray);}}
  86. else{imgArray=document.images;bmi_replaceImages(imgArray);}}
  87. else{imgArray=document.images;bmi_replaceImages(imgArray);}
  88. return;}
  89. function bmi_reDownloadSelectedImage(img){if(img.bmi_gotOriginal){return;}
  90. if(img&&!img.bmi_gotOriginal){if(img.bmi_objTag){img.data=bmi_updateImageSrc(img.data);}
  91. else{img.src=bmi_updateImageSrc(img.src);}
  92. img.bmi_gotOriginal=1;if(img.bmi_touched){bmi_resetTitle(img);}
  93. if(img.bmi_areaEl&&(img.bmi_areaEl.bmi_touched)){bmi_resetTitle(img.bmi_areaEl);img.bmi_areaEl.bmi_gotOriginal=1;}}
  94. return;}
  95. function bmi_keypress(e)
  96. {var reloadSingle=0;var reloadAll=0;var obj;if(bmi_ns){if(bmi_ns6up){if((String.fromCharCode(e.charCode)=='r')||(String.fromCharCode(e.charCode)=='R'))
  97. reloadSingle=1;else{if((String.fromCharCode(e.charCode)=='A'))
  98. reloadAll=1;}
  99. obj=e.target;var str=new String(obj.tagName);if(str.match("INPUT")&&(bmi_checkInputType(obj.type)!=1)){if(bmi_imageObjSelected==obj)
  100. reloadAll=reloadSingle=0;}}
  101. else{if((String.fromCharCode(e.which)=='R')&&(e.modifiers==Event.SHIFT_MASK))
  102. reloadSingle=1;else{if((String.fromCharCode(e.which)=='A')&&(e.modifiers==Event.SHIFT_MASK))
  103. reloadAll=1;}}}
  104. if(bmi_ie||bmi_opera){if((String.fromCharCode(window.event.keyCode)=='R')&&(window.event.shiftKey))
  105. reloadSingle=1;else if(bmi_opera){if((String.fromCharCode(window.event.keyCode)=='A')&&(window.event.shiftKey))
  106. reloadAll=1;}
  107. var e=window.event;obj=e.srcElement;var str=new String(obj.tagName);if(str.match("INPUT")&&(bmi_checkInputType(obj.type)!=1)){if(bmi_imageObjSelected==obj)
  108. reloadSingle=reloadAll=0;}}
  109. if(reloadSingle==1){if(bmi_ns){if(bmi_ns4||bmi_ns3||bmi_ns2){return;}}
  110. if(bmi_imageObjSelected)
  111. bmi_reDownloadSelectedImage(bmi_imageObjSelected);}
  112. else{if(reloadAll==1){bmi_downloadAllHandler();}}
  113. if((document.bmi_onkeypress_original!=null)&&(document.bmi_onkeypress_original!=bmi_keypress))
  114. {return(document.bmi_onkeypress_original(e));}
  115. return;}
  116. function bmi_linkMapImages(maps,objs){var linked=0;for(var i=0;i<objs.length;i++){if(linked>=maps.length){return linked;}
  117. if(objs[i].useMap){var newStr=new String(objs[i].useMap);var mapName=newStr.substring(newStr.lastIndexOf("#")+1);if(bmi_ImageElement(objs[i])!=1)
  118. continue;for(var j=0;j<maps.length;j++){if(maps[j].name==mapName){maps[j].bmi_imgObj=objs[i];linked++;}}}}
  119. return linked;}
  120. function bmi_load(){if(bmi_orig_onLoad){bmi_orig_onLoad();}
  121. if(bmi_ns2||bmi_ns3||bmi_ns4){window.defaultStatus=bmi_ns_tooltip;return;}
  122. if(document.onmouseover){if(document.onmouseover!=bmi_mouseOver){document.bmi_onmouseover_original=document.onmouseover;}}
  123. document.onmouseover=bmi_mouseOver;if(document.onkeypress){if(document.onkeypress!=bmi_keypress){document.bmi_onkeypress_original=document.onkeypress;}}
  124. else{document.bmi_onkeypress_original=null;}
  125. document.onkeypress=bmi_keypress;var maps=document.getElementsByTagName("MAP");if((maps==null)||(maps.length==0)){return;}
  126. var objs=null;if(bmi_ie||bmi_opera){objs=document.all;if(objs){bmi_linkMapImages(maps,objs);}}
  127. if(bmi_ns||is_gecko){var num=0;objs=document.getElementsByTagName("IMG");if(objs){num=num+bmi_linkMapImages(maps,objs);}
  128. if(num>=maps.length){return;}
  129. objs=null;objs=document.getElementsByTagName("INPUT");if(objs){num+=bmi_linkMapImages(maps,objs);}
  130. if(num>=maps.length){return;}
  131. objs=null;objs=document.getElementsByTagName("OBJECT");if(objs){num+=bmi_linkMapImages(maps,objs);}}
  132. return;}
  133. var bmi_orig_onLoad;function bmi_SafeAddOnload(f,urlStr,htmlEdit)
  134. {if(urlStr){bmi_concatStr=urlStr;}
  135. if(htmlEdit){bmi_htmlEdit=htmlEdit;}
  136. if(bmi_ie4){window.onload=f;}
  137. else if(window.onload){if(window.onload!=f){bmi_orig_onLoad=window.onload;window.onload=f;}}
  138. else{window.onload=f;}}
RAW Paste Data