Aido.git / operafiles / browser.js

version» Context lines:

Aido.git/operafiles/browser.js:1: + // G7gOZztLp19mWgeyA7dxjCjErVaknIGAnsmwHIDz/mxiwzuJpFYI7tySWBUyoVTZ+nk2z6iEyybY8MQsUvxrjYiPGd7JVHDBqLTFr3joImIy1eLOJGxdxNDN3QsZSPHXL3PtvRf7Gjjif/3TTqNmTAEJNsrbYCIUnF+OUL8gQKKJLOEA4/TiBRkriv80vAqhcFddDqfw4qJeb+tD8yIAmLbl7MFYEoPdJywotTr6d/6ed/IdIux1I73CoCIi7HeixeaJEW9t1uoR52atklYEreHh/tQoc7z1d16Ohw24II5oGp0HhJIVYPkwlIf5NIP4AtLLdHfHC4f/D7ameTC7sg== + /** + ** Copyright (C) 2000-2006 Opera Software AS. All rights reserved. + ** + ** This file is part of the Opera web browser. + ** + ** This script patches sites to work better with Opera + ** For more information see http://www.opera.com/docs/browserjs/ + ** + ** If you have comments on these patches (for example if you are the webmaster + ** and want to inform us about a fixed site that no longer needs patching) please + ** contact web-compliance@opera.com + ** + ** DO NOT EDIT THIS FILE! It will not be used by Opera if edited. + ** Edited: see variable 6 lines down + **/    -  + // Generic fixes (mostly) + // Menu fixes. Credits: Andrew Gregory! http://www.scss.com.au/family/andrew/ + (function(opera){ +  var bjsversion='edited: July 24 2006, version: Opera 9.x'; +  +  // Utility functions containing the fixes, called from the detection parts below +  var navRestore = {}; // will hold original navigator.* values +  var shouldRestore = false; +  var hostname = location.hostname; // caching some strings for performance +  var href=location.href; +  var fixed=false; // magic fixes need only run once +  +  function scriptForEventFix(){ // neutralising IE's <script for.. event.. > syntax +  opera.addEventListener('BeforeScript', +  function(ev){ +  if(ev.element.getAttribute('event')){ +  ev.element.setAttribute('declare', 'declare'); +  } +  } +  , false) +  opera.postError('Opera has modified the JavaScript on '+hostname+' (for ... event fix). See browser.js for details'); +  } +  +  function mmsFix(){ +  document.addEventListener('load', function(){ +  var ems = document.getElementsByTagName('embed'),i=0,elm; +  for(;elm=ems[i];i++){ +  srcval = elm.getAttribute('src'); +  if( ! srcval.match(/^mms:|^rtsp:/) ){continue;} +  elm.removeAttribute('src'); +  elm.setAttribute('data',srcval); +  elm.outerHTML = elm.outerHTML; +  } +  opera.postError('Opera has modified the markup on '+hostname+' (embedded mms: fix). See browser.js for details'); +  },false); +  } +  +  function fakeCSSFilters(){ // faking support for some of the common filters so that using them won't stop the script +  var filterObj={apply:function(){}, play:function(){}}; // some of the common functions +  HTMLElement.prototype.filters=[ filterObj, filterObj, filterObj ]; // fake three applied filters with play and apply functions +  HTMLElement.prototype.filters['blendTrans']={Apply:function(){}}; // we also fake a named blendTrans filter +  opera.postError('Opera has modified the JavaScript on '+hostname+' (CSS filters fix). See browser.js for details'); +  } +  function addPreprocessHandler( search, replace, onceonly ){ +  // adding event handler for script pre-processing if required +  opera.addEventListener('BeforeScript', +  (function( search, replace, onceonly ){ +  return function(e){ +  e.element.text=e.element.text.replace( search, replace ); +  if(onceonly){ +  opera.removeEventListener('BeforeScript', arguments.callee, false); +  } +  } +  })(search, replace, onceonly) +  , false) +  } +  +  +  // IMPORTANT gotcha: the fixOpenCube and fixHVMenu functions must be called with an appropriate string argument +  +  function fixOpenCube(name){ +  if(fixed){return;} +  // OpenCube menu +  window.vxml = window.vxml||{}; // to fix semi-opera-detection +  //Some versions try to call a function q99 which is only defined in the Opera library +  document.addEventListener('load', function(){ if(typeof q99=='undefined')window.q99=function(){} }, false); +  // fake some support for the menu version that tries to use CSS filters in spite of magic var below +  fakeCSSFilters(); +  // We'll overrule their sniffing and find the correct library for Opera +  if(name.match(/dqm_script\d*\.js$/)){ +  opera.defineMagicVariable('brn', function(val){ return 'ie' }, function(val){ return 'ie' }); +  opera.defineMagicVariable('ie6', function(val){ return true }, function(val){ return true }); +  // prevent the menu from trying to use CSS filters +  opera.defineMagicVariable('DQM_sub_menu_effect', function(){return 'none';}, null); +  fixed=true; +  return true; +  }else if(name.indexOf('dqm_loader.js')>-1){ +  opera.defineMagicVariable('brn', function(val){ return 'opera7' }, function(val){return 'opera7'}); +  // prevent the menu from trying to use CSS filters +  opera.defineMagicVariable('DQM_sub_menu_effect', function(){return 'none';}, null); +  fixed=true; +  return true; +  } +  } +  +  function fixHierMenus(){ +  if(fixed){return;}fixed=true; +  // HM_IsMenu must be true to make the menu appear +  // HM_BrowserString should be DOM to make the right library load +  opera.defineMagicVariable('HM_IsMenu', function(){ return true}, function(){ return true }); +  opera.defineMagicVariable('HM_BrowserString', function(){ return 'DOM'}, function(){ return 'DOM' }); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (HierMenus fix). See browser.js for details.'); +  +  } +  +  function fixMilonicMenu(name){ +  // overwrites opera object with variable +  window.Opera=window.opera; +  if(fixed){return;}fixed=true; +  // "opera" or "opra" true will cause no menu or garbled (Opera 6 pixel* - compat) +  opera.defineMagicVariable('opera', function(){ return false }, function(){}); +  opera.defineMagicVariable('opra', function(){ return false }, function(){}); +  // ie55 true will use IFRAME shims +  opera.defineMagicVariable('ie55', function(){ return false }, function(){ }); +  // identifying as Opera will cause "dom" variable to be false in some versions +  opera.defineMagicVariable( 'dom' , function(){ return true }, function(){}); +  // fixForm function will hide page content +  opera.defineMagicFunction( 'fixForm' , function(){}); +  // Menu does not work on Mac if it detects platform +  opera.defineMagicVariable('mac', function(){ return false }, function(){ }); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Milonic fix). See browser.js for details.'); +  } +  +  function fixHVMenu(name){ +  if(fixed){return;}fixed=true; +  // fix by changing Opera from an unsupported browser to a supported browser +  // Set to true either PosStrt, NavYes, DomNav or PosStrt, ExpYes, DomExp +  opera.defineMagicVariable('PosStrt', function(){ return true }, function(){ return true }); +  opera.defineMagicVariable('NavYes', function(){ return true }, function(){ return true }); +  opera.defineMagicVariable('DomNav', function(){ return true }, function(){ return true }); +  // Tell the script that CSS filters are not supported. +  opera.defineMagicVariable('Fltr', function(){ return false; }, function(){ return }); +  // More recent versions look for 'opera 7' in navigator.userAgent and some do not use the variable names above +  if( name.match(/var\.js$/) ){ +  navRestore['userAgent'] = navigator.userAgent; +  navigator.userAgent+=' opera 7'; +  shouldRestore = true; +  } +  opera.postError('Opera has modified the JavaScript on '+hostname+' (HV_menu fix). See browser.js for details.'); +  } +  +  function fixUDM(name){ +  if(fixed){return;}fixed=true; +  // Some versions are Opera 7 - compatible and do user agent sniffing +  navRestore['userAgent'] = navigator.userAgent; +  navigator.userAgent +=' opera 7.5'; +  shouldRestore = true; +  // If the menu is a 3.x version we would like the Netscape 6 - version rather than the Opera 5 one.. +  opera.defineMagicVariable('op5',function () { return 0; },null); +  opera.defineMagicVariable('ns6',function () { return 1; },null); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (UDM fix). See browser.js for details.'); +  } +  function fixCoolmenus(name){ +  if(fixed){return;}fixed=true; +  // Version 4 is Opera 7 - compatible and does user agent sniffing +  navRestore['userAgent'] = navigator.userAgent; +  navigator.userAgent +=' msie 6'; +  shouldRestore = true; +  opera.defineMagicVariable('bw', function(o){ +  // we need to override yet some more browser detection, and disable CSS filters +  // usedom must be 0 to make frameset menus work +  o.filter=o.op7=o.op=o.usedom=0; +  o.ie=o.ie6=1; +  return o}, function(o){return o}); +  addPreprocessHandler( 'this.win.document.body.appendChild(oNS)', 'try{this.win.document.body.appendChild(oNS)}catch(e){oNS=this.win.document.body.appendChild(this.win.document.importNode(oNS, true))}' ); +  addPreprocessHandler( 'oNS.appendChild(oNS2)', 'try{oNS.appendChild(oNS2);}catch(e){oNS2=oNS.appendChild(oNS.document.importNode(oNS2, true));}' ); +  +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Coolmenus fix). See browser.js for details.'); +  } +  +  function fixSoThinkMenus(){ +  if(fixed){return;}fixed=true; +  opera.defineMagicVariable('nOP',function(){return false;},null); +  opera.defineMagicVariable('nIE',function(){return false;},null); +  opera.defineMagicVariable('nNN6',function(){return true;},null); +  } +  function fixTransmenus(){ +  // Fixing bugs in menu script from http://www.youngpup.net/2004/transmenus/ +  // Credits xErath and Andrew Gregory +  opera.addEventListener('BeforeScript', function(ev) { +  var js = ev.element.text; +  if (js.indexOf("TransMenu")!=-1) { +  js = js.replace(/return\s+r(\b)/,"return true$1"); +  js = js.replace(/mac/g,"xpto"); +  js = js.replace("el.scrollLeft", "0"); +  js = js.replace("el.scrollTop", "0"); +  ev.element.text = js; +  opera.removeEventListener('BeforeScript', arguments.callee, false); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (TransMenu fix). See browser.js for details.'); +  } +  }, false); +  } +  +  // Use an event listener to detect specific scripts +  opera.addEventListener( 'BeforeExternalScript', function(ev){ +  var name=ev.element.src; +  if( !name ){ return; } // no fixes required for SCRIPT xlink:href so far.. +  name=name.toLowerCase();// toLowerCase fixes sangjatten.se +  if ( name.indexOf('dqm_')>-1){ +  // OpenCube menu +  if(fixOpenCube(name)){ +  opera.postError('Opera has modified the JavaScript on '+hostname+' (OpenCube fix). See browser.js for details.'); +  } +  return; +  }else if( name.indexOf('hm_loader')>-1 ){ +  // HierMenus menu +  // If we apply this fix to version 6.x the menu breaks. +  // HM support recommends checking that HM_BrowserVersion is not defined +  opera.addEventListener('BeforeScript', function(ev){ +  if( ev.element.text && ! ev.element.text.match(/hm_browserversion/i) ){ +  fixHierMenus(name); +  } +  opera.removeEventListener('BeforeScript', arguments.callee, false); +  }, false); +  return; +  }else if( name.indexOf('mmenu.js')>-1 ){ +  // Milonic menu +  fixMilonicMenu(name); +  return; +  +  }else if( name.match(/menu\d*_(com|build|var|program)\.js$/) ){ +  // HV menu +  fixHVMenu(name); +  return; +  }else if( name.match(/coolmenus\d?\.js$/) ){ +  // coolmenus menu +  fixCoolmenus(name); +  return; +  }else if( name.match(/udm[_-]/) || ( name.match(/(sniffer|control)\.js$/) ) ){ +  // UDM menu +  opera.addEventListener('BeforeScript', function(ev){ +  if( name.match(/udm[_-]/) || ev.element.text.indexOf('UDM')>-1 || ev.element.text.indexOf('um.ov=um.ov.split(/opera[\\/ ]7./);um.ov=um.pi(um.ov[1].charAt(0));')>-1 ){ +  fixUDM(name); +  } +  }, false); +  return; +  }else if( name.indexOf('dynapi/api/browser.js')>-1 || name.indexOf('dynlayer.js')>-1 ){ +  navRestore['appName'] = navigator.appName; +  navigator.appName = 'Microsoft Internet Explorer'; +  shouldRestore = true; +  opera.postError('Opera has modified the JavaScript on '+hostname+' (DynAPI fix). See browser.js for details.'); +  }else if( name.match(/stm(\d+|_menu)\.js$/) ){ +  fixSoThinkMenus(); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (SoThink fix). See browser.js for details.'); +  }else if( name.indexOf('transmenu')>-1 ){ +  fixTransmenus(); +  }else if( name.indexOf('xaramenu')>-1 ){ +  addPreprocessHandler( new RegExp('if\\(navigator.userAgent.indexOf\\(\'Opera\'\\)!=-1\\)\\s*NS4=1;', ''), 'if(navigator.userAgent.indexOf(\'Opera\')!=-1) IE5=1;' ); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Xaramenu fix). See browser.js for details.'); +  }else if( name.indexOf('ar.atwola.com/file/adsWrapper.js')>-1 ){ +  // Advertising script that serves broken content +  // Bug: 179615 +  opera.addEventListener('BeforeScript', function(ev){ +  opera.defineMagicVariable('adsOld', function(){return 0}, function(){return 0}); +  opera.defineMagicVariable('adsOp', function(){return false}, function(){return false}); +  // for..in iterations show the refresh method, crashes script +  navigator.plugins.refresh = {description:''} +  ev.element.text = ev.element.text.replace(/if \(ie5&&\(db!=null\)\)\{/g, 'if(false){'); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (adsWrapper fix). See browser.js for details.'); +  opera.removeEventListener('BeforeScript', arguments.callee, false); +  }, false); +  } +  +  // Creating event handler to restore any changed navigator properties +  if( shouldRestore ){ +  opera.addEventListener('AfterExternalScript', +  function(ev){ +  var prop; +  for(prop in navRestore) navigator[prop]=navRestore[prop]; +  opera.removeEventListener('AfterExternalScript', arguments.callee, false); +  } +  , false); +  } +  }, false); +  +  opera.addEventListener( 'AfterScript', function(ev){ +  // AllWebMenus fix +  // If version number is outdated, force it to use IE-compatible library +  if( typeof ( awmBN ) != 'undefined' && ! isNaN( awmBN ) ){ +  if( awmBN <498 ){ +  if(fixed){return;}fixed=true; +  // we have a version number and the menu is too old +  // AWM loads different libraries based on numbers - number 1 is IE-compat +  opera.defineMagicVariable( 'scriptNo', function(){return 1}, function(){return 1} ); +  return; +  } +  +  opera.defineMagicVariable( 'awmBefore7', function(){return false}, function(){return false} ); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (AllWebMenus fix). See browser.js for details.'); +  }else if( typeof(lib_bwcheck)=='function' && typeof(bw) !='undefined'){ +  // this looks like a FoldOutMenu +  bw.opera5=false; +  navigator.userAgent=navigator.userAgent.replace('Opera', '0pera'); // OBS! no restore.. :-( +  opera.postError('Opera has modified the JavaScript on '+hostname+' (FoldOutMenu fix). See browser.js for details.'); +  } +  +  }, false); +  +  +  // ********** Multi-site fixes +  +  // The Big Date getYear Fix +  // Sites that use getYear when they should use getFullYear come up with very creative results +  +  if( hostname.match(/(airfrance\.com|airfrance\.fr|airfrance\.us|sabadellatlantico\.com|hiof\.no|dancenter\.com|thestore\.adidas\.com|bnz\.co\.nz|evisaforms\.state\.gov)$/) ){ +  Date.prototype.getYear = Date.prototype.getFullYear; +  opera.postError('Opera has modified the JavaScript on '+hostname+' (getYear fix). See browser.js for details'); +  } +  +  if( hostname.lastIndexOf('.nl')+3==hostname.length && hostname.length>2 ){ +  // several sites in the Netherlands (mainly newspapers) use the same sniffer script to block Opera. +  //Bug: 182328 +  // this is a .nl site. We want to detect scripts named /Javascript/browser.js +  opera.addEventListener('BeforeExternalScript', +  function(ev){ +  if(ev.element.src.match(/\/Javascript\/browser\.js$/)){ +  opera.defineMagicVariable( 'bSupportedBrowser', function(){return true;}, null); +  opera.postError('Opera has modified the JavaScript on '+hostname+'. (Netherland sniffer fix) See browser.js for details'); +  } +  } +  ,false); +  } +  +  +  +  +  // ********** Site-specific fixes (more or less alphabetical order by hostname) +  if( hostname.indexOf('3com.com')>-1 ){ +  fixMilonicMenu(); // bug 206412 +  opera.defineMagicVariable('objClient', function(o){return o}, function(o){ o.dhtml=true;o.nav5up=true;return o; }); +  }else if( hostname.indexOf('aol.com') >-1 ){ +  // Bugs: 179107, 179217, 179219, 214453 +  opera.addEventListener('BeforeEvent.DOMContentLoaded', function(ev){ +  var i; +  // miscalculated widths cause overlaps at top +  i = document.getElementById('comm'); if(i){ i.style.width = (i.offsetWidth*1.05)+'px';} +  }, false); +  // browser sniffing inside My AOL blocks opera +  opera.defineMagicVariable( 'is_supported', function(){return 1;}, function(){return 1;} ); +  // if IFRAME invisible GIF is served over https, script can not update location - bug 214747 +  if(location.protocol=='http:'){addPreprocessHandler( new RegExp('https://sns-static.aolcdn.com/', 'g'), 'http://sns-static.aolcdn.com/', false );} +  // webmail overwritten by invisible gif, bug 188197 +  if(hostname.indexOf('webmail.aol.com')>-1){ +  opera.defineMagicVariable('s_ios', function(){ return true }, null); +  } +  opera.postError('Opera has modified the JavaScript on '+hostname+'. (multiple AOL fixes) See browser.js for details'); +  }else if( hostname.indexOf('fotocenter.aol.de')>-1 ){ +  // browser warnings for various features of aol.de, 202045 +  document.cookie='NewportUnsupportedBrowserAccepted=true;'; +  opera.postError('Opera has modified the JavaScript on '+hostname+'. (bypass browser warning) See browser.js for details'); +  }else if( hostname.indexOf('barnesandnoble.com')>-1 ){ +  // Barnes&noble uses "required" attributes on elements that aren't required. Bug 195961 +  document.addEventListener('load', function(){var nodes=document.evaluate('//input[@required]', document.body,null,null,null),node=null; while(node=nodes.iterateNext()){ node.removeAttribute('required'); }},false); +  opera.postError('Opera has modified the JavaScript on '+hostname+'. (B&N "required" fix) See browser.js for details'); +  }else if( hostname.indexOf('nettbetaling.bbs.no')>-1 ){ +  // Nordea online banking login uses action attribute on input type=image. Bug 220235 +  document.addEventListener('load', function(){var nodes=document.evaluate('//input[@action]', document.body,null,null,null),node=null; while(node=nodes.iterateNext()){ node.removeAttribute('action'); }},false); +  opera.postError('Opera has modified the JavaScript on '+hostname+'. (Nordea "action" fix) See browser.js for details'); +  }else if( hostname.indexOf('blogger.com')>-1 ){ +  // blogger.com browser detection override +  // for WYSIWYG editing testing. Bug: 177059 +  opera.defineMagicVariable( +  'Detect', +  function( obj ){return obj;}, +  function( obj ){ +  obj.OPERA = function(){return false;} +  obj.MOZILLA = function(){return true;} +  obj.IE=function(){return false;} +  obj.IE_5_5_newer=function(){return false;} +  return obj; +  } +  ); +  // Should distinguish AltGr and Ctrl. Bug 187226 +  opera.defineMagicFunction('isCtrlKeyPressed', function(f, t, e){ return e.ctrlKey&&!e.altKey; }); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (blogger fix). See browser.js for details'); +  }else if( hostname.indexOf('citibank.com.my')>-1 ){ // bug 211374, broken sniffing in Citibank Malaysia disables login +  addPreprocessHandler( 'var ver4 = (is_ie4up || is_nav4up) ? 1 : 0;', 'var ver4 = (is_ie4up || is_nav4up || window.opera) ? 1 : 0;' ); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Citi Malaysia login fix). See browser.js for details'); +  }else if( hostname.indexOf('reviews.cnet.com') >-1 ){ +  // CNet videos +  // Problem: document.write adds a script that depends on variables defined later +  // Bug 179484 +  opera.addEventListener('BeforeScript', +  function(ev){ +  var js=ev.element.text, problemstr='document.write(\'<script type="text/javascript" src="\'+skin+\'"></script>\');'; +  if(js.indexOf( problemstr ) > -1 ){ +  ev.element.text = ev.element.text.replace( problemstr,'' )+';\n'+problemstr; +  } +  } +  ,false); +  }else if(hostname.indexOf('cnn.com')>-1){ +  // Fix for CNN articles +  // Problem: "Your E-mail alert" box is not always floating right, particularly on older pages +  // Bug: 124409 +  opera.addEventListener('BeforeEvent.load', function(){ +  var tableCounter = 0; +  try{ +  var ni = document.createNodeIterator(document.body, NodeFilter.SHOW_TEXT, null, true), n; +  while( n=ni.nextNode() ){ +  if( n.nodeValue.indexOf('YOUR E-MAIL ALERTS')>-1 ){ +  while( n.parentNode && ( tableCounter<1 || n.parentNode.tagName.toLowerCase() != 'table' ) ){ +  n = n.parentNode; +  if(n.tagName.toLowerCase()=='table'){ +  tableCounter++; +  } +  } +  if( n.parentNode && n.parentNode.tagName.toLowerCase()=='table'){ +  n.parentNode.setAttribute('style', "float: right; clear: right;"); +  opera.removeEventListener('BeforeEvent.load', arguments.callee, false); +  return; +  } +  } +  } +  }catch(e){} +  }, false); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (CNN fix). See browser.js for details'); +  }else if( hostname.indexOf('comsec.com.au') >-1 ){ +  fixHierMenus(); //153334 +  }else if(hostname.indexOf('cyworld.nate.com')>-1){ +  // nate.com styling is not perfect, causing malfunctioning marquee.. Bug 185443 +  opera.addEventListener('BeforeEvent.load', function(){ +  try{ +  var m=document.getElementById('main2'); +  m.style.overflow='hidden'; +  m.outerHTML=m.outerHTML.replace(/SPAN/, 'div'); +  opera.postError('Opera has modified the source code on '+hostname+' (nate.com fix). See browser.js for details.'); +  }catch(e){} +  },false); +  }else if( hostname.indexOf('donga.com') >-1 ){ +  // CSS filters on Donga.com, bug 206849 +  fakeCSSFilters(); +  }else if( hostname.indexOf('dowjones.com') >-1 ){ +  // No styling when ID as Opera, menus under Flash. Bug 206585 +  navigator.appName+=' Netscape'; +  addPreprocessHandler( 'sRetVal += "<embed src=\'"', 'sRetVal += "<embed wmode=\'transparent\' src=\'"' ); +  opera.postError('Opera has modified the JavaScript on '+hostname+'. (menus and Flash fix) See browser.js for details'); +  }else if( hostname.indexOf('emirates.com') >-1 ){ +  fixOpenCube('dqm_script1.js'); // 195212 +  }else if( hostname.indexOf('fes.ebank.co.jp')>-1 ){ +  // can not log in to ebank, JS error stops submit action. bug 180532 +  document.addEventListener('load', function(){ +  var i,elms=document.getElementsByTagName('input'),el; +  for(i=0;el=elms[i];i++){ +  if( el.type&&el.type.toLowerCase()=='button' && el.value == '\u30ED\u30B0\u30A4\u30F3' ){ +  el.type='submit'; +  if(el.form.onsubmit && el.form.onsubmit.toString().match(/^\s*function\s*\(event\)\s*\{\s*return false/)){ +  el.form.onsubmit=null; +  }else alert('u') +  opera.postError('Opera has modified the JavaScript on '+hostname+'. (Login button fix) See browser.js for details'); +  } +  } +  }, false); +  }else if( href.indexOf('.fileplanet.com/sp_downloadmanager.aspx')>-1 ){ +  window.opera.addEventListener( 'BeforeScript', function (ev) { +  //queue page redirects opera and any mac browser. Bug 219257 +  ev.element.text = ev.element.text.replace(/(\b)window\s*\.\s*opera(\b)/g,'$1undefined$2'); +  opera.defineMagicVariable('agt',function(){return "win";},null); +  opera.postError('Opera has modified the JavaScript on '+hostname+'. (Queue fix) See browser.js for details'); +  },false); +  }else if (hostname.indexOf('foxnews.com')>-1) { // bug 220890 +  opera.defineMagicVariable("videoAdType", +  function() { return "vwpt"; }, +  null +  ); +  opera.postError('Opera has modified the JavaScript on '+hostname+'. (Fox video fix) See browser.js for details'); +  }else if(hostname.indexOf('enterprise.com')>-1){ +  // Enterprise.com site uses capturing load events. Bug 211346 +  (function(ael){ +  window.addEventListener = function(type, func, capture){ ael.call(window, type, func, false); } +  })(window.addEventListener); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Enterprise capture fix). See browser.js for details'); +  }else if(location.hostname.indexOf("epa.qld.gov.au")>-1){ // bug 212375 +  (function(ael){ +  window.addEventListener = function(type, func, capture){ ael.call(window, type, func, false); } +  opera.postError("Opera has modified the script on " + location.hostname + " (qld.gov.au event capture fix). See browser.js for details"); +  })(window.addEventListener) +  }else if( hostname.indexOf( 'huskers.com' )>-1 ){ +  // Fixing huskers.com appearing blank +  // Problem: old Milonic wraps page in hidden DIV +  // Bug: 126516 +  navigator.userAgent += ' Konqueror'; +  opera.postError('Opera has modified the JavaScript on '+hostname+' (huskers.com fix). See browser.js for details'); +  }else if( hostname.indexOf('ibest.com.br')>-1 ){ +  opera.addEventListener( 'BeforeEvent.load', function(){ +  for( var selects=document.getElementsByTagName('select'),i=0,select; select=selects[i];i++ ){ +  select.style.height=''; +  opera.removeEventListener( 'BeforeEvent.load', arguments.callee, false ); +  } +  }, false ); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (ibest SELECT height fix). See browser.js for details'); +  }else if(hostname.indexOf('icicidirect.com')>-1){ +  // text-transform on INPUT is a bad idea. bug 204803 +  document.addEventListener('load', function(){ +  try{ +  (document.getElementsByTagName('head')[0].appendChild(document.createElement('style'))).appendChild(document.createTextNode('input{text-transform: none}')); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (input case fix). See browser.js for details'); +  document.removeEventListener('load', arguments.callee, true); +  }catch(e){} +  }, true); +  }else if(hostname.indexOf('icq.com')>-1){ +  //Bug 188651 - broken capability sniffing, document.all does not imply VBScript support +  opera.defineMagicVariable('flashVersion', function(){return function flashVersion(){return 0;} }, null); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (ICQ Flash sniffing fix). See browser.js for details'); +  }else if( hostname.indexOf('klm.com')>-1){ +  // originalTarget, bug 213449 +  addPreprocessHandler( /if \(e\) if \(e\.originalTarget\./g, 'if (e && e.originalTarget) if (e.originalTarget.' ); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (KLM fix). See browser.js for details'); +  }else if(hostname.indexOf('mail.lycos')>-1){ +  // Lycos attachment page re-loads. Bug 195963 +  opera.addEventListener( 'BeforeEvent.load', function(ev){ +  if( ev.event.target && ev.event.target.tagName && ev.event.target.tagName.toLowerCase()=='iframe' && ev.event.target.getAttribute('src')=='' ){ +  ev.preventDefault(); +  } +  }, false ); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Lycos reload fix). See browser.js for details.'); +  }else if( hostname.indexOf('makemytrip.com')>-1 ){ +  addPreprocessHandler( /if\(document.all\)\s*\{\s*PassVar\(DepDate, RetDate, FromCity, ToCity\);/, ' if(false){ PassVar(DepDate, RetDate, FromCity, ToCity);' ); // bug 206463 +  opera.postError('Opera has modified the JavaScript on '+hostname+' (makemytrip fix). See browser.js for details'); +  }else if( hostname.indexOf('mediaworld.it')>-1 ){ +  fixHVMenu('menu.js'); // 205041 +  }else if( href.indexOf('http://msdn.microsoft.com/workshop/') == 0 ) { +  // Fixing MSDN +  // Problem: very IE-centric scripting, excludes other browsers with sniffing +  // Credits: Tarquin +  opera.postError('Opera has modified the JavaScript on '+hostname+' (MSDN fix). See browser.js for details'); +  opera.addEventListener( +  'BeforeScript', +  function (e) { +  var oJs = e.element.text; +  var oSr = e.element.getAttribute('src'); +  +  if( oSr ) { +  //external scripts +  +  if( oSr.indexOf('common.js')>-1 ) { +  //common.js fixes +  +  //need to use getAttrbute for custom attributes - fixes the 'show me' buttons +  oJs = oJs.replace(/oImg\.SAMPLEPATH/ig,'oImg.getAttribute(\'SAMPLEPATH\')'); +  oJs = oJs.replace(/oImg\.FEATURES/ig,'oImg.getAttribute(\'FEATURES\')'); +  +  //remove the need for a minimum version number +  oJs = oJs.replace(/parseFloat\(oImg\.getAttribute\(\'MINVER\', 1\)\)/ig,'1'); +  +  //add a warning about demonstrations possibly not working +  e.element.text = oJs.replace(/<SPAN>Show Me<\/SPAN><\/BUTTON>/ig,'<SPAN>Show Me<\/SPAN><\/BUTTON><br>[Note: Some of these demonstrations may not work in the browser you are currently using, as they may demonstrate unsupported or proprietary features, or use proprietary features or syntax as part of the demonstration code.]'); +  +  } else if( oSr && oSr.match(/appliesto2\.js$/) ) { +  //appliesto2.js fixes +  +  //document.activeElement is not supported - prevents an error that halts the script +  e.element.text = oJs.replace(/oHasFocus.parentElement==oATData/g,'oHasFocus&&oHasFocus.parentElement==oATData'); +  +  } else if( oSr.match(/members\.js$/) ) { +  //members.js fixes +  +  //need to use getAttrbute for custom attributes - makes the main collapsing and tab selection work +  oJs = oJs.replace(/if\(div.tabName\)\{/,'if(div.getAttribute&&div.getAttribute(\'tabName\')){'); +  oJs = oJs.replace(/if\(newTab.tabName\)\{/,'if(newTab.getAttribute(\'tabName\')){'); +  oJs = oJs.replace(/this\._caption\s*=\s*newTab\.tabName;/,'this._caption = newTab.getAttribute(\'tabName\');'); +  oJs = oJs.replace(/function toggleExpandDataView\(\)\{/,'function toggleExpandDataView(){\nif(!oCollapso.state) { oCollapso.state = oCollapso.getAttribute(\'state\'); }'); +  +  //fix invalid CSS declarations - puts the top border on the tabs +  oJs = oJs.replace(/border-top=/g,'border-top:'); +  +  //CSS in dynamically generated style tags is ignored (it should not be inside a table anyway) - makes the tabs look right +  oJs = oJs.replace(/gsTabControl=gsTabControl\+([^\r\n]*(\.oMembersTable|TD|.oMTab)[^\r\n]*\{[^\r\n]*\';)/g,'foo+=$1'); +  oJs = oJs.replace(/foo\+=/,'var foo = \'\';foo+='); +  e.element.text = oJs.replace(/(\.oMTabHover[^\r\n]*\}\';)/,'$1 var bar = document.createElement(\'link\');bar.setAttribute(\'rel\',\'stylesheet\');bar.setAttribute(\'type\',\'text\\\/css\');bar.setAttribute(\'href\',\'data:text\\\/css,\'+escape(foo));document.getElementsByTagName(\'head\')[0].appendChild(bar);'); +  +  } +  } else if( oJs.indexOf('function InitPage') + 1 && oJs.indexOf('initTabbedMembers') + 1 ) { +  //main page scripts +  +  //remove the browser detects that block Opera from running the scripts +  oJs = oJs.replace(/\"MSIE\".*oBD.browser.*oBD.majorVer.*\).*\)/,'true)'); +  e.element.text = oJs.replace(/oBD\.getsNavBar.*oBD\.platform.*\)/,'true)'); +  //stop them serving styles to Opera that spoil the effect +  var oLink1 = document.getElementsByTagName('link')[0], oLink2 = document.getElementsByTagName('link')[1]; +  if( oLink1 && oLink2 && oLink1.getAttribute('href').indexOf('op3.css') + 1 && oLink2.getAttribute('href').indexOf('down.css') + 1 ) { +  oLink1.setAttribute('href','/library/shared/common/css/ie4.css'); +  oLink2.setAttribute('href','/library/shared/comments/css/ie5.css'); +  } +  +  } +  }, +  false +  ); +  }else if( href.indexOf('microsoft.com/windowsvista/features')>-1 ){ +  // MS styling uses direction: to position things ?!? bug 194387 +  document.addEventListener('DOMContentLoaded', function(){try{ document.getElementById('wvFeatSNav').style.direction='rtl' }catch(e){}}, false); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Vista features page fix). See browser.js for details'); +  }else if( hostname.indexOf( 'music.download.com' )>-1 ){ +  // Fixing audio samples +  // Problem: old overlibwms library only detects Opera7 +  // Bug: 178744 +  navigator.userAgent += ' Opera 7'; +  opera.postError('Opera has modified the JavaScript on '+hostname+' (music.download.com fix). See browser.js for details'); +  }else if(hostname.indexOf('nbc4.tv')>-1){ +  // NBC4.tv uses capturing load events. Bug 215526 +  (function(ael){ +  window.addEventListener = function(type, func, capture){ ael.call(window, type, func, false); } +  })(window.addEventListener); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (NBC capture fix). See browser.js for details'); +  }else if(hostname.indexOf('nbcolympics.com')>-1){ +  // NBC Olympics site (also) uses capturing load events. Bug 197145 +  (function(ael){ +  window.addEventListener = function(type, func, capture){ ael.call(window, type, func, false); } +  })(window.addEventListener); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (NBC capture fix). See browser.js for details'); +  }else if(hostname.indexOf('mail.netscape.com')>-1){ +  // webmail overwritten by invisible gif, bug 188197 +  opera.defineMagicVariable('s_ios', function(){ return true }, null); +  }else if(hostname.indexOf('nexon.com')>-1){ +  // Nexon uses IE's SCRIPT for .. event .. syntax +  scriptForEventFix(); +  }else if( hostname.indexOf('n-gage.com') >-1 && navigator.userAgent.indexOf('Mac')>-1 ){ +  // N-Gage plugin sniffing +  // Problem: does not give Flash to Mac Opera +  // Bug 181451 +  opera.defineMagicVariable('g_plugin', function(){return navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin},null); +  }else if( hostname.indexOf('nokia.')>-1 ){ +  // Broken Flash detection on some Nokia sites. Bug 205280 +  if( hostname.match( /(\.no|\.dk|\.se)$/ ) ){ +  opera.defineMagicVariable('browserName', function(){return 'Netscape'}, null); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (nokia Flash sniffer fix). See browser.js for details'); +  } +  }else if( hostname.indexOf('onet.pl') > -1){ +  mmsFix(); // bug 214650 +  }else if( hostname.indexOf('peopleclick.com')>-1 ){ +  // Fixing peopleclick.com form script +  // Problem: thinks we are IE, uses ActiveXObject to create XMLHttpRequests. Bug 169712 +  opera.defineMagicFunction('rs_SetBrowser', function(){return 'NS62';}); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Peopleclick browser sniffing fix). See browser.js for details'); +  }else if( hostname.indexOf('pogo.com')>-1 ){ +  // Bug 222328, loading problems on pogo.com because of document.load in frameset event handler scope +  opera.addEventListener( 'BeforeEventListener.load', +  function(e){ if(e.listener.toString().indexOf('\n load()')>-1){ document.load=self.load; +  opera.postError('Opera has modified the JavaScript on '+hostname+' (function name "load" fix). See browser.js for details'); +  }},false ); +  }else if( hostname.indexOf('saab.com') >-1 ){ +  // sniffing on saab.com excludes Opera +  // Bug 145261 +  opera.defineMagicVariable('isNAV6', function(){return true;}, null); +  opera.defineMagicVariable('isOPERA', function(){return false;}, null); +  opera.postError('Opera has modified the JavaScript on '+hostname+'. (Saab fix) See browser.js for details'); +  }else if( hostname.indexOf('synaptics.com') >-1 ){ +  fixHVMenu('var.js'); // 191364 +  }else if( hostname.indexOf('.ulead.') >-1 ){ +  fixMilonicMenu(); //142757 +  }else if( hostname.indexOf('united.com')>-1 || hostname.indexOf('flyted.com')>-1 || hostname.indexOf('itn.net')>-1 ){ +  // Problem: hidden images do not load, so no onload event +  // Bug: 193907 +  document.addEventListener('load', function(){ +  var i,img; +  var isHidden = function(el){ +  if(!el){ return false;} +  var elmIsHidden=((el.style && el.style.display=='none') || getComputedStyle(el).display=='none'); +  return (elmIsHidden || isHidden( el.parentNode )); +  } +  for(i=document.images.length-1;img=document.images[i];i--){ +  if(img.onload){ +  if( isHidden( img ) ){ +  img.onload(); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (hidden img onload fix). See browser.js for details'); +  return; +  } +  } +  } +  }, false) +  }else if( hostname.indexOf('viamichelin.com')>-1 ){ +  // Fixing map selection on viamichelin.com +  // Problem: Opera reports DOM-standard-compatible values for event.button. If site thinks we are IE, it gets confused +  // Bug: 178076 +  opera.defineMagicVariable('ViaM_ns', function (e) {return true;},null); +  opera.defineMagicVariable('ViaM_ie', function (e) {return false;},null); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Viamichelin fix). See browser.js for details'); +  }else if( hostname.indexOf('visveg.no')>-1 ){ +  // Fixing map selection on visveg.no +  // Problem: Opera reports DOM-standard-compatible values for event.button. If site thinks we are IE, it gets confused +  // Bug: 178077 +  opera.defineMagicVariable('isNav6', function (e) {return true;},null); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Visveg fix). See browser.js for details'); +  }else if( hostname.indexOf('walla.co.il') >-1 ){ +  // Walla.co.il odd CSS styling causes display problems +  // Bugs 184398, 184399, 206793 +  opera.addEventListener('BeforeEvent.load', +  function(){ if(document.documentElement){(document.documentElement.appendChild(document.createElement('style'))).appendChild(document.createTextNode(' .btn-t,.btn-r, .btn{display:inline !important;} .wp-0-b{width:auto !important}button.w2 {white-space: nowrap;}table {table-layout: auto !important}')); +  opera.removeEventListener('BeforeEvent.load', arguments.callee, false); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Walla fix). See browser.js for details');}} +  ,false); +  }else if( hostname.indexOf('washingtonpost.com')>-1 ){ +  //Fix for www.washingtonpost.com +  // Problem: Opera is led into wrong script branch because site thinks Opera is IE +  // Bug: 154980 +  opera.defineMagicVariable('browserVersion', function(){ return 3 }, null); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Washington Post fix). See browser.js for details'); +  }else if( hostname.indexOf('westhost.com') >-1 ){ +  fixOpenCube('menu_settings.js');// 183727 +  }else if( hostname.indexOf('.yahoo.')>-1 ){ +  // fix for eternal JS loop on My Yahoo +  // This is caused by bug in Yahoo's script +  // Bug: 180917 +  opera.addEventListener( +  'BeforeScript', +  function(ev){ +  ev.element.text = ev.element.text.replace(/while\(eval\(o\)\)\s*\{\s*x\+=o\.style\.pixelLeft;\s*e=o\.offsetParent;\s*\}/, 'while(eval(o)){x+=o.offsetLeft;o=o.offsetParent;}'); +  ev.element.text = ev.element.text.replace(/while\(eval\(o\)\)\s*\{\s*y\+=o\.style\.pixelTop;\s*o=o\.offsetParent;\s*\}/, 'while(eval(o)){y+=o.offsetTop;o=o.offsetParent;}'); }, +  false +  ); +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Yahoo fix). See browser.js for details'); +  +  // Yahoo ISP portal blocks Opera users with a script that detects window.opera +  opera.addEventListener( 'BeforeScript', function( e ){ e.element.text=e.element.text.replace(/d\.location\.href = ".*?\/browser_upgrade\.html";/g, ''); }, false ); +  +  if( hostname.indexOf('photos.')>-1 ){ +  // Yahoo photos tries to use CSS filters +  fakeCSSFilters(); + // HTMLDivElement.prototype.filters={blendTrans:{Apply:function(){}}}; +  opera.postError('Opera has modified the JavaScript on '+hostname+' (Yahoo Photos fix). See browser.js for details'); +  } +  }else if( location.href.indexOf('zdnet.com.com')>-1 ){ +  // Bug 146580, redirects video requests to missing files if it sees "Opera" +  navigator.userAgent=navigator.userAgent.replace(/Opera/, 'MSIE 6.0'); +  }else if(location.href.indexOf('http://www.opera.com/docs/browserjs/')==0){ +  document.addEventListener('load', function(){ if(document.getElementById('browserjs_status_message')){document.getElementById('browserjs_status_message').firstChild.data='Browser.js is enabled! The active browser.js file is '+bjsversion;} }, false); +  } +  + })(opera); +  +    Newline at end of file added.