vendor: 3,024 bytes, lines 1-101
1/*! Copyright 2012, Ben Lin (http://dreamerslab.com/) 2 * Licensed under the MIT License (LICENSE.txt). 3 * 4 * Version: 1.0.16 5 * 6 * Requires: jQuery >= 1.2.3 7 */ 8;( function ( $ ){ 9 $.fn.addBack = $.fn.addBack || $.fn.andSelf; 10 11 $.fn.extend({ 12 13 actual : function ( method, options ){ 14 // check if the jQuery method exist 15 if( !this[ method ]){ 16 throw '$.actual => The jQuery method "' + method + '" you called does not exist'; 17 } 18 19 var defaults = { 20 absolute : false, 21 clone : false, 22 includeMargin : false 23 }; 24 25 var configs = $.extend( defaults, options ); 26 27 var $target = this.eq( 0 ); 28 var fix, restore; 29 30 if( configs.clone === true ){ 31 fix = function (){ 32 var style = 'position: absolute !important; top: -1000 !important; '; 33 34 // this is useful with css3pie 35 $target = $target. 36 clone(). 37 attr( 'style', style ). 38 appendTo( 'body' ); 39 }; 40 41 restore = function (){ 42 // remove DOM element after getting the width 43 $target.remove(); 44 }; 45 }else{ 46 var tmp = []; 47 var style = ''; 48 var $hidden; 49 50 fix = function (){ 51 // get all hidden parents 52 $hidden = $target.parents().addBack().filter( ':hidden' ); 53 style += 'visibility: hidden !important; display: block !important; '; 54 55 if( configs.absolute === true ) style += 'position: absolute !important; '; 56 57 // save the origin style props 58 // set the hidden el css to be got the actual value later 59 $hidden.each( function (){ 60 // Save original style. If no style was set, attr() returns undefined 61 var $this = $( this ); 62 var thisStyle = $this.attr( 'style' ); 63 64 tmp.push( thisStyle ); 65 // Retain as much of the original style as possible, if there is one 66 $this.attr( 'style', thisStyle ? thisStyle + ';' + style : style ); 67 }); 68 }; 69 70 restore = function (){ 71 // restore origin style values 72 $hidden.each( function ( i ){ 73 var $this = $( this ); 74 var _tmp = tmp[ i ]; 75 76 if( _tmp === undefined ){ 77 $this.removeAttr( 'style' ); 78 }else{ 79 $this.attr( 'style', _tmp ); 80 } 81 }); 82 }; 83 } 84 85 fix(); 86 // get the actual value with user specific methed 87 // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc 88 // configs.includeMargin only works for 'outerWidth' and 'outerHeight' 89 var actual = /(outer)/.test( method ) ? 90 $target[ method ]( configs.includeMargin ) : 91 $target[ method ](); 92 93 restore(); 94 // IMPORTANT, this plugin only return the value of the first element 95 return actual; 96 } 97 }); 98})( jQuery ); 99 100 101
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.