| /* |
| Copyright (c) 2007 Paul Bakaus, http://paulbakaus.com/ |
| |
| Permission is hereby granted, free of charge, to any person obtaining |
| a copy of this software and associated documentation files (the |
| "Software"), to deal in the Software without restriction, including |
| without limitation the rights to use, copy, modify, merge, publish, |
| distribute, sublicense, and/or sell copies of the Software, and to |
| permit persons to whom the Software is furnished to do so, subject to |
| the following conditions: |
| |
| The above copyright notice and this permission notice shall be |
| included in all copies or substantial portions of the Software. |
| |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| */ |
| |
| jQuery(function(){if(!jQuery.browser.msie)return;if(Number(jQuery.browser.version)>=9)return;if(Transformie.stylesheets)
|
| Transformie.parseStylesheets();if(Transformie.inlineCSS){jQuery(Transformie.inlineCSS===true?'*':Transformie.inlineCSS).each(function(){if(Transformie.resolveCSSKey(this.style))
|
| Transformie.refreshMatrix(this,Transformie.resolveCSSKey(this.style));});}
|
| if(Transformie.trackChangesFor){Transformie.bindChangeEvent(Transformie.trackChangesFor);}});var Transformie={inlineCSS:"*",stylesheets:true,trackChangesFor:"*",toRadian:function(value){if(value.indexOf("deg")!=-1){return parseInt(value,10)*(Math.PI*2/360);}else if(value.indexOf("grad")!=-1){return parseInt(value,10)*(Math.PI/200);}else{return parseInt(value,10);}},bindChangeEvent:function(query){jQuery(query).unbind('propertychange').bind('propertychange',function(e){if(e.originalEvent.propertyName=='style.webkitTransform'||e.originalEvent.propertyName=='style.transform')
|
| Transformie.refreshMatrix(this,Transformie.resolveCSSKey(this.style));});},resolveCSSKey:function(style){return style['-webkit-transform']||style['webkit-transform']||style['transform']||style.webkitTransform;},parseStylesheets:function(){for(var i=0;i<document.styleSheets.length;i++){for(var j=0;j<document.styleSheets[i].rules.length;j++){if(Transformie.resolveCSSKey(document.styleSheets[i].rules[j].style))
|
| Transformie.refreshMatrix(document.styleSheets[i].rules[j].selectorText,Transformie.resolveCSSKey(document.styleSheets[i].rules[j].style));};};},refreshMatrix:function(selector,ruleValue){var functions=ruleValue.match(/[A-z]+\([^\)]+/g)||[];var matrices=[];for(var k=0;k<functions.length;k++){var func=functions[k].split('(')[0],value=functions[k].split('(')[1];switch(func){case'matrix':var values=value.split(',');matrices.push($M([[values[0],values[2],0],[values[1],values[3],0],[0,0,1]]));break;case'rotate':var a=Transformie.toRadian(value);matrices.push($M([[Math.cos(a),-Math.sin(a),0],[Math.sin(a),Math.cos(a),0],[0,0,1]]));break;case'scale':matrices.push($M([[value,0,0],[0,value,0],[0,0,1]]));break;case'scaleX':matrices.push($M([[value,0,0],[0,1,0],[0,0,1]]));break;case'scaleY':matrices.push($M([[1,0,0],[0,value,0],[0,0,1]]));break;case'skew':var a=Transformie.toRadian(value);matrices.push($M([[1,0,0],[Math.tan(a),1,0],[0,0,1]]));case'skewX':var a=Transformie.toRadian(value);matrices.push($M([[1,Math.tan(a),0],[0,1,0],[0,0,1]]));break;case'skewY':var a=Transformie.toRadian(value);matrices.push($M([[1,0,0],[Math.tan(a),1,0],[0,0,1]]));break;};};if(!matrices.length)
|
| return;var matrix=matrices[0];for(var k=0;k<matrices.length;k++){if(matrices[k+1])matrix=matrices[k].x(matrices[k+1]);};jQuery(selector).each(function(){if(!this.filters["DXImageTransform.Microsoft.Matrix"]){this.style.filter=(this.style.filter?'':' ')+"progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand')";Transformie.bindChangeEvent(this);}
|
| jQuery.extend(this.filters["DXImageTransform.Microsoft.Matrix"],{M11:matrix.elements[0][0],M12:matrix.elements[0][1],M21:matrix.elements[1][0],M22:matrix.elements[1][1]});});}}; |