8d4d24be22066c27b2faa03b7e5ead3f303ddf93 max Wed Nov 16 00:31:50 2016 -0800 CIRM: making our menubar work with newer jquery versions needed for D3 diff --git src/hg/js/jquery.plugins.js src/hg/js/jquery.plugins.js index 54f683b..9a14a52 100644 --- src/hg/js/jquery.plugins.js +++ src/hg/js/jquery.plugins.js @@ -299,32 +299,72 @@ Drupal.theme.prototype = { /** * Formats text for emphasized display in a placeholder inside a sentence. * * @param str * The text to format (plain-text). * @return * The formatted text (html). */ placeholder: function(str) { return '' + Drupal.checkPlain(str) + ''; } }; +/* ********************** */ +/* This code adds the object browser to jQuery */ +/* It allows using newer Jquery versions with our old version of bgiframe. */ +/* copied from http://stackoverflow.com/questions/14798403/typeerror-browser-is-undefined */ +/* Max 2016: It seems that bgiframe is only needed for MSIE6 support, so it is possible we could remove + * bgiframe (and this code) entirely, but bgiframe is used even in our own code, so I'm waiting with this */ + +if (typeof jQuery.browser == 'undefined') { + var matched, browser; + + jQuery.uaMatch = function( ua ) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+)/.exec( ua ) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || + /(msie) ([\w.]+)/.exec( ua ) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + matched = jQuery.uaMatch( navigator.userAgent ); + browser = {}; + if ( matched.browser ) { + browser[ matched.browser ] = true; + browser.version = matched.version; + } + // Chrome is Webkit, but Webkit is also Safari. + if ( browser.chrome ) { + browser.webkit = true; + } else if ( browser.webkit ) { + browser.safari = true; + } + jQuery.browser = browser; + /* END OF BROWSER OBJECT */ +} /* bgiframe v2.1 * Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net) * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * * $LastChangedDate: 2007-06-19 20:25:28 -0500 (Tue, 19 Jun 2007) $ * $Rev: 2111 $ * * Version 2.1 */ (function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='