Ignore:
Timestamp:
Jan 12, 2011, 3:22:40 PM (13 years ago)
Author:
cljosse
Message:

[Autosize][beta] compatibility whith piwishack


File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/js/jquery.dimensions.js

    r8588 r8627  
    1919    */
    2020    jQuery.each(['Height', 'Width'],
    21             function (i, name) {
    22                 jQuery.fn['inner' + name] = function () {
    23                     if (!this[0]) return;
    24                     var torl = name == 'Height' ? 'Top' : 'Left',
    25                         borr = name == 'Height' ? 'Bottom' : 'Right';
    26                     return this.is(':visible') ? this[0]['client' + name] : num(this, name.toLowerCase()) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
    27                 };
    28 
    29                 jQuery.fn['outer' + name] = function (options) {
    30                     if (!this[0]) return;
    31                     var torl = name == 'Height' ? 'Top' : 'Left',
    32                         borr = name == 'Height' ? 'Bottom' : 'Right';
    33                     options = options || false;
    34                     options = jQuery.extend({ margin: options });
    35 
    36                     var val = this.is(':visible') ? this[0]['offset' + name] :
    37                         num(this,
    38                         name.toLowerCase()) +
    39                         num(this, 'border' + torl + 'Width') +
    40                         num(this, 'border' + borr + 'Width') +
    41                         num(this, 'padding' + torl) +
    42                         num(this, 'padding' + borr)
    43 
    44                         ;
    45                     return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
    46                 };
    47             });
     21        function (i, name) {
     22            jQuery.fn['inner' + name] = function () {
     23                if (!this[0]) return;
     24                var torl = name == 'Height' ? 'Top' : 'Left',
     25                    borr = name == 'Height' ? 'Bottom' : 'Right';
     26                return this.is(':visible') ? this[0]['client' + name] : num(this, name.toLowerCase()) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
     27            };
     28
     29            jQuery.fn['outer' + name] = function (options) {
     30                if (!this[0]) return;
     31                var torl = name == 'Height' ? 'Top' : 'Left',
     32                    borr = name == 'Height' ? 'Bottom' : 'Right';
     33                options = options || false;
     34                options = jQuery.extend({ margin: options });
     35
     36                var val = this.is(':visible') ? this[0]['offset' + name] :
     37                    num(this,
     38                    name.toLowerCase()) +
     39                    num(this, 'border' + torl + 'Width') +
     40                    num(this, 'border' + borr + 'Width') +
     41                    num(this, 'padding' + torl) +
     42                    num(this, 'padding' + borr)
     43
     44                    ;
     45                return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
     46            };
     47        });
    4848    /*
    4949    *
    5050    */
    5151    jQuery.each(['Left', 'Top'],
    52       function (i, name) {
    53           jQuery.fn['scroll' + name] = function (val) {
    54               if (!this[0]) return;
    55               return val != undefined ? this.each(function () {
    56                   this == window || this == document ? window.scrollTo(name == 'Left' ? val : $(window)['scrollLeft'](),
    57            name == 'Top' ? val : $(window)['scrollTop']()) : this['scroll' + name] = val;
    58               }) : this[0] == window || this[0] == document ? self[(name == 'Left' ? 'pageXOffset' : 'pageYOffset')] || jQuery.boxModel && document.documentElement['scroll' + name] || document.body['scroll' + name] : this[0]['scroll' + name];
    59           };
    60 
    61       });
     52    function (i, name) {
     53        jQuery.fn['scroll' + name] = function (val) {
     54            if (!this[0]) return;
     55            return val != undefined ? this.each(function () {
     56                this == window || this == document ? window.scrollTo(name == 'Left' ? val : $(window)['scrollLeft'](),
     57        name == 'Top' ? val : $(window)['scrollTop']()) : this['scroll' + name] = val;
     58            }) : this[0] == window || this[0] == document ? self[(name == 'Left' ? 'pageXOffset' : 'pageYOffset')] || jQuery.boxModel && document.documentElement['scroll' + name] || document.body['scroll' + name] : this[0]['scroll' + name];
     59        };
     60
     61    });
    6262    jQuery.fn.extend({
    6363
     
    106106                if (elem.nodeName) nodeName = elem.nodeName;
    107107
    108                
     108
    109109                if (elem == window) {
    110110
Note: See TracChangeset for help on using the changeset viewer.