1/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net) 2 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 3 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 4 * 5 * $LastChangedDate: 2007-03-19 10:02:41 -0500 (Mon, 19 Mar 2007) $ 6 * $Rev: 1546 $ 7 */ 8 9(function($){ 10 11/** 12 * The bgiframe is chainable and applies the iframe hack to get 13 * around zIndex issues in IE6. It will only apply itself in IE 14 * and adds a class to the iframe called 'bgiframe'. The iframe 15 * is appeneded as the first child of the matched element(s) 16 * with a tabIndex and zIndex of -1. 17 * 18 * By default the plugin will take borders, sized with pixel units, 19 * into account. If a different unit is used for the border's width, 20 * then you will need to use the top and left settings as explained below. 21 * 22 * NOTICE: This plugin has been reported to cause perfromance problems 23 * when used on elements that change properties (like width, height and 24 * opacity) a lot in IE6. Most of these problems have been caused by 25 * the expressions used to calculate the elements width, height and 26 * borders. Some have reported it is due to the opacity filter. All 27 * these settings can be changed if needed as explained below. 28 * 29 * @example $('div').bgiframe(); 30 * @before <div><p>Paragraph</p></div> 31 * @result <div><iframe class="bgiframe".../><p>Paragraph</p></div> 32 * 33 * @param Map settings Optional settings to configure the iframe. 34 * @option String|Number top The iframe must be offset to the top 35 * by the width of the top border. This should be a negative 36 * number representing the border-top-width. If a number is 37 * is used here, pixels will be assumed. Otherwise, be sure 38 * to specify a unit. An expression could also be used. 39 * By default the value is "auto" which will use an expression 40 * to get the border-top-width if it is in pixels. 41 * @option String|Number left The iframe must be offset to the left 42 * by the width of the left border. This should be a negative 43 * number representing the border-left-width. If a number is 44 * is used here, pixels will be assumed. Otherwise, be sure 45 * to specify a unit. An expression could also be used. 46 * By default the value is "auto" which will use an expression 47 * to get the border-left-width if it is in pixels. 48 * @option String|Number width This is the width of the iframe. If 49 * a number is used here, pixels will be assume. Otherwise, be sure 50 * to specify a unit. An experssion could also be used. 51 * By default the value is "auto" which will use an experssion 52 * to get the offsetWidth. 53 * @option String|Number height This is the height of the iframe. If 54 * a number is used here, pixels will be assume. Otherwise, be sure 55 * to specify a unit. An experssion could also be used. 56 * By default the value is "auto" which will use an experssion 57 * to get the offsetHeight. 58 * @option Boolean opacity This is a boolean representing whether or not 59 * to use opacity. If set to true, the opacity of 0 is applied. If 60 * set to false, the opacity filter is not applied. Default: true. 61 * @option String src This setting is provided so that one could change 62 * the src of the iframe to whatever they need. 63 * Default: "javascript:false;" 64 * 65 * @name bgiframe 66 * @type jQuery 67 * @cat Plugins/bgiframe 68 * @author Brandon Aaron ([email protected] || http://brandonaaron.net) 69 */ 70$.fn.bgIframe = jQuery.fn.bgiframe = function(s) { 71 // This is only for IE6 72 if ( !($.browser.msie && typeof XMLHttpRequest == 'function') ) return this; 73 s = $.extend({ 74 top : 'auto', // auto == .currentStyle.borderTopWidth 75 left : 'auto', // auto == .currentStyle.borderLeftWidth 76 width : 'auto', // auto == offsetWidth 77 height : 'auto', // auto == offsetHeight 78 opacity : true, 79 src : 'javascript:false;' 80 }, s || {}); 81 var prop = function(n){return n&&n.constructor==Number?n+'px':n;}, 82 html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+ 83 'style="display:block;position:absolute;z-index:-1;'+
84 (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+ 85 'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+ 86 'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+ 87 'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+ 88 'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+ 89 '"/>'; 90 return this.each(function() { 91 if ( !$('iframe.bgiframe', this)[0] ) 92 this.insertBefore( document.createElement(html), this.firstChild ); 93 }); 94}; 95 96})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.