From 6acf84473dc6113dadd74f3560c08a9d3feb6176 Mon Sep 17 00:00:00 2001 From: desandro Date: Sun, 3 Oct 2010 20:44:05 -0400 Subject: [PATCH] Bring in getStyleProperty, base miniModernizr off of it; also some convienences --- jquery.molequul.js | 114 +++++++++++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 45 deletions(-) diff --git a/jquery.molequul.js b/jquery.molequul.js index 3904e45..b2b1a24 100755 --- a/jquery.molequul.js +++ b/jquery.molequul.js @@ -5,71 +5,70 @@ **************************************************/ (function($){ + // ========================= getStyleProperty by kangax =============================== + + var getStyleProperty = (function(){ + + var prefixes = ['Moz', 'Webkit', 'Khtml', 'O', 'Ms']; + + function getStyleProperty(propName, element) { + element = element || document.documentElement; + var style = element.style, + prefixed; + + // test standard property first + if (typeof style[propName] == 'string') return propName; + + // capitalize + propName = propName.charAt(0).toUpperCase() + propName.slice(1); + + // test vendor specific properties + for (var i=0, l=prefixes.length; i element. docElement.className += ' ' + classes.join( ' ' ); - - var Modernizr = miniModernizr; + + window.Modernizr = miniModernizr; } - - // position convience method - // for now, we'll only use transforms in Chrome and Safari - // In Opera, transform removes all text anti-aliasing, crippling legibility - // in FF, you cannot transition transforms in < 4.0 - var usingTransforms = Modernizr.csstransforms && $.browser.webkit; + // convienence vars + var transformFnUtils = { + translate : { + getFn : { + '2d' : function ( position ) { + return 'translate(' + position.x + 'px, ' + position.y + 'px)'; + }, + '3d' : function ( position ) { + return 'translate3d(' + position.x + 'px, ' + position.y + 'px, 0)'; + } + }, + regex : /translate(3d)?\([\s\d\-\.,px]+\)/ + }, + scale : { + getFn : { + '2d' : function ( scale ) { + return 'scale(' + scale + ')'; + }, + '3d' : function ( scale ) { + return 'scale3d(' + scale + ', ' + scale + ', 1)'; + } + }, + regex : /scale(3d)?\([\s\d\-\.,px]+\)/ + } + }, + // for now, we'll only use transforms in Chrome and Safari + // In Opera, transform removes all text anti-aliasing, crippling legibility + // in FF, you cannot transition transforms in < 4.0 + usingTransforms = Modernizr.csstransforms && $.browser.webkit, + dimensions = Modernizr.csstransforms3d ? '3d' : '2d', + transformProp = getStyleProperty('transform'); // ========================= smartresize ===============================