pbojinov
12/2/2013 - 3:05 AM

prefix css based on browser (webkit, moz, 0, ms) using hexflip's algorithm - https://github.com/dmotz/hexaflip/blob/master/hexaflip.js

prefix css based on browser (webkit, moz, 0, ms) using hexflip's algorithm - https://github.com/dmotz/hexaflip/blob/master/hexaflip.js

var $, baseName, className, css, cssClass, prefixList, prefixProp, prop, _i, _len, _ref;

baseName = 'hexaFlip';

className = baseName[0].toUpperCase() + baseName.slice(1);

prefixList = ['webkit', 'Moz', 'O', 'ms'];

prefixProp = function(prop) {
    var prefix, prefixed, _i, _len;
    if (document.body.style[prop.toLowerCase()] != null) {
        return prop.toLowerCase();
    }
    for (_i = 0, _len = prefixList.length; _i < _len; _i++) {
        prefix = prefixList[_i];
        prefixed = prefix + prop;
        if (document.body.style[prefixed] != null) {
            return prefixed;
        }
    }
    return false;
};

css = {};

_ref = ['Transform', 'Perspective']; //css classes that might need to be prefixed
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    prop = _ref[_i];
    css[prop.toLowerCase()] = prefixProp(prop);
}