Changeset 11373
- Timestamp:
- 01/04/2017 08:45:50 PM (9 years ago)
- Location:
- trunk/src/bp-messages/js/autocomplete
- Files:
-
- 2 edited
-
jquery.bgiframe.js (modified) (1 diff)
-
license.bgiframe.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/js/autocomplete/jquery.bgiframe.js
r9819 r11373 1 /*! Copyright (c) 201 0 Brandon Aaron (http://brandonaaron.net)2 * Licensed under the MIT License ( license.bgiframe.txt).1 /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh) 2 * Licensed under the MIT License (LICENSE.txt). 3 3 * 4 * Version 2.1.2 4 * Version 3.0.1 5 * 6 * Requires jQuery >= 1.2.6 5 7 */ 6 8 7 (function($){ 9 (function (factory) { 10 if (typeof define === 'function' && define.amd) { 11 // AMD. Register as an anonymous module. 12 define(['jquery'], factory); 13 } else if (typeof exports === 'object') { 14 // Node/CommonJS style for Browserify 15 module.exports = factory; 16 } else { 17 // Browser globals 18 factory(jQuery); 19 } 20 }(function ($) { 21 $.fn.bgiframe = function(s) { 22 s = $.extend({ 23 top : 'auto', // auto == borderTopWidth 24 left : 'auto', // auto == borderLeftWidth 25 width : 'auto', // auto == offsetWidth 26 height : 'auto', // auto == offsetHeight 27 opacity : true, 28 src : 'javascript:false;', 29 conditional : /MSIE 6\.0/.test(navigator.userAgent) // expresion or function. return false to prevent iframe insertion 30 }, s); 8 31 9 $.fn.bgiframe = ($.browser.msie && /msie 6\.0/i.test(navigator.userAgent) ? function(s) { 10 s = $.extend({ 11 top : 'auto', // auto == .currentStyle.borderTopWidth 12 left : 'auto', // auto == .currentStyle.borderLeftWidth 13 width : 'auto', // auto == offsetWidth 14 height : 'auto', // auto == offsetHeight 15 opacity : true, 16 src : 'javascript:false;' 17 }, s); 18 var html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+ 19 'style="display:block;position:absolute;z-index:-1;'+ 20 (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+ 21 'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+ 22 'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+ 23 'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+ 24 'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+ 25 '"/>'; 26 return this.each(function() { 27 if ( $(this).children('iframe.bgiframe').length === 0 ) 28 this.insertBefore( document.createElement(html), this.firstChild ); 29 }); 30 } : function() { return this; }); 32 // wrap conditional in a function if it isn't already 33 if (!$.isFunction(s.conditional)) { 34 var condition = s.conditional; 35 s.conditional = function() { return condition; }; 36 } 31 37 32 // old alias 33 $.fn.bgIframe = $.fn.bgiframe;38 var $iframe = $('<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+ 39 'style="display:block;position:absolute;z-index:-1;"/>'); 34 40 35 function prop(n) { 36 return n && n.constructor === Number ? n + 'px' : n; 37 } 41 return this.each(function() { 42 var $this = $(this); 43 if ( s.conditional(this) === false ) { return; } 44 var existing = $this.children('iframe.bgiframe'); 45 var $el = existing.length === 0 ? $iframe.clone() : existing; 46 $el.css({ 47 'top': s.top == 'auto' ? 48 ((parseInt($this.css('borderTopWidth'),10)||0)*-1)+'px' : prop(s.top), 49 'left': s.left == 'auto' ? 50 ((parseInt($this.css('borderLeftWidth'),10)||0)*-1)+'px' : prop(s.left), 51 'width': s.width == 'auto' ? (this.offsetWidth + 'px') : prop(s.width), 52 'height': s.height == 'auto' ? (this.offsetHeight + 'px') : prop(s.height), 53 'opacity': s.opacity === true ? 0 : undefined 54 }); 38 55 39 })(jQuery); 56 if ( existing.length === 0 ) { 57 $this.prepend($el); 58 } 59 }); 60 }; 61 62 // old alias 63 $.fn.bgIframe = $.fn.bgiframe; 64 65 function prop(n) { 66 return n && n.constructor === Number ? n + 'px' : n; 67 } 68 69 })); -
trunk/src/bp-messages/js/autocomplete/license.bgiframe.txt
r9819 r11373 1 Copyright 201 0, Brandon Aaron (http://brandonaaron.net/)2 1 Copyright 2013, Brandon Aaron (http://brandonaaron.net/) 2 3 3 Permission is hereby granted, free of charge, to any person obtaining 4 4 a copy of this software and associated documentation files (the … … 8 8 permit persons to whom the Software is furnished to do so, subject to 9 9 the following conditions: 10 10 11 11 The above copyright notice and this permission notice shall be 12 12 included in all copies or substantial portions of the Software. 13 13 14 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 15 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Note: See TracChangeset
for help on using the changeset viewer.