новые иконки в OpenBoard
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
OpenBoard/resources/nonDistributed/Balance.wgt/js/lib/jquery-css-transform.js

112 lines
4.0 KiB

(function ($) {
// Monkey patch jQuery 1.3.1+ css() method to support CSS 'transform'
// property uniformly across Safari/Chrome/Webkit, Firefox 3.5+, IE 9+, and Opera 11+.
// 2009-2011 Zachary Johnson www.zachstronaut.com
// Updated 2011.05.04 (May the fourth be with you!)
function getTransformProperty(element)
{
// Try transform first for forward compatibility
// In some versions of IE9, it is critical for msTransform to be in
// this list before MozTranform.
var properties = ['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform'];
var p;
while (p = properties.shift())
{
if (typeof element.style[p] != 'undefined')
{
return p;
}
}
// Default to transform also
return 'transform';
}
var _propsObj = null;
var proxied = $.fn.css;
$.fn.css = function (arg, val)
{
// Temporary solution for current 1.6.x incompatibility, while
// preserving 1.3.x compatibility, until I can rewrite using CSS Hooks
if (_propsObj === null)
{
if (typeof $.cssProps != 'undefined')
{
_propsObj = $.cssProps;
}
else if (typeof $.props != 'undefined')
{
_propsObj = $.props;
}
else
{
_propsObj = {}
}
}
// Find the correct browser specific property and setup the mapping using
// $.props which is used internally by jQuery.attr() when setting CSS
// properties via either the css(name, value) or css(properties) method.
// The problem with doing this once outside of css() method is that you
// need a DOM node to find the right CSS property, and there is some risk
// that somebody would call the css() method before body has loaded or any
// DOM-is-ready events have fired.
if
(
typeof _propsObj['transform'] == 'undefined'
&&
(
arg == 'transform'
||
(
typeof arg == 'object'
&& typeof arg['transform'] != 'undefined'
)
)
)
{
_propsObj['transform'] = getTransformProperty(this.get(0));
}
// We force the property mapping here because jQuery.attr() does
// property mapping with jQuery.props when setting a CSS property,
// but curCSS() does *not* do property mapping when *getting* a
// CSS property. (It probably should since it manually does it
// for 'float' now anyway... but that'd require more testing.)
//
// But, only do the forced mapping if the correct CSS property
// is not 'transform' and is something else.
if (_propsObj['transform'] != 'transform')
{
// Call in form of css('transform' ...)
if (arg == 'transform')
{
arg = _propsObj['transform'];
// User wants to GET the transform CSS, and in jQuery 1.4.3
// calls to css() for transforms return a matrix rather than
// the actual string specified by the user... avoid that
// behavior and return the string by calling jQuery.style()
// directly
if (typeof val == 'undefined' && jQuery.style)
{
return jQuery.style(this.get(0), arg);
}
}
// Call in form of css({'transform': ...})
else if
(
typeof arg == 'object'
&& typeof arg['transform'] != 'undefined'
)
{
arg[_propsObj['transform']] = arg['transform'];
delete arg['transform'];
}
}
return proxied.apply(this, arguments);
};
})(jQuery);