Skip to:
Content

BuddyPress.org

Changeset 11373


Ignore:
Timestamp:
01/04/2017 08:45:50 PM (9 years ago)
Author:
slaffik
Message:

Messages: Upgrade jquery bgiframe.

WordPress 4.2 (our minimal version we support) has jQuery 1.11.2. jquery.bgiframe v3.0.1 (current latest) says it needs jQuery >= 1.2.6.

Props wpdennis.
Fixes #7339.

Location:
trunk/src/bp-messages/js/autocomplete
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/js/autocomplete/jquery.bgiframe.js

    r9819 r11373  
    1 /*! Copyright (c) 2010 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).
    33 *
    4  * Version 2.1.2
     4 * Version 3.0.1
     5 *
     6 * Requires jQuery >= 1.2.6
    57 */
    68
    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);
    831
    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        }
    3137
    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;"/>');
    3440
    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            });
    3855
    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 2010, Brandon Aaron (http://brandonaaron.net/)
    2  
     1Copyright 2013, Brandon Aaron (http://brandonaaron.net/)
     2
    33Permission is hereby granted, free of charge, to any person obtaining
    44a copy of this software and associated documentation files (the
     
    88permit persons to whom the Software is furnished to do so, subject to
    99the following conditions:
    10  
     10
    1111The above copyright notice and this permission notice shall be
    1212included in all copies or substantial portions of the Software.
    13  
     13
    1414THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    1515EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Note: See TracChangeset for help on using the changeset viewer.