From ea346a785dc1b3f7c156f6fc33da634e1f1a627b Mon Sep 17 00:00:00 2001 From: Chris Schlaeger Date: Tue, 12 Aug 2014 21:56:44 +0200 Subject: Adding jquery, flot and openlayers to be included with the GEM. --- .../openlayers/lib/OpenLayers/Util/vendorPrefix.js | 131 +++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 misc/openlayers/lib/OpenLayers/Util/vendorPrefix.js (limited to 'misc/openlayers/lib/OpenLayers/Util') diff --git a/misc/openlayers/lib/OpenLayers/Util/vendorPrefix.js b/misc/openlayers/lib/OpenLayers/Util/vendorPrefix.js new file mode 100644 index 0000000..89286d7 --- /dev/null +++ b/misc/openlayers/lib/OpenLayers/Util/vendorPrefix.js @@ -0,0 +1,131 @@ +/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the 2-clause BSD license. + * See license.txt in the OpenLayers distribution or repository for the + * full text of the license. */ + +/** + * @requires OpenLayers/SingleFile.js + */ + +OpenLayers.Util = OpenLayers.Util || {}; +/** + * Namespace: OpenLayers.Util.vendorPrefix + * A collection of utility functions to detect vendor prefixed features + */ +OpenLayers.Util.vendorPrefix = (function() { + "use strict"; + + var VENDOR_PREFIXES = ["", "O", "ms", "Moz", "Webkit"], + divStyle = document.createElement("div").style, + cssCache = {}, + jsCache = {}; + + + /** + * Function: domToCss + * Converts a upper camel case DOM style property name to a CSS property + * i.e. transformOrigin -> transform-origin + * or WebkitTransformOrigin -> -webkit-transform-origin + * + * Parameters: + * prefixedDom - {String} The property to convert + * + * Returns: + * {String} The CSS property + */ + function domToCss(prefixedDom) { + if (!prefixedDom) { return null; } + return prefixedDom. + replace(/([A-Z])/g, function(c) { return "-" + c.toLowerCase(); }). + replace(/^ms-/, "-ms-"); + } + + /** + * APIMethod: css + * Detect which property is used for a CSS property + * + * Parameters: + * property - {String} The standard (unprefixed) CSS property name + * + * Returns: + * {String} The standard CSS property, prefixed property or null if not + * supported + */ + function css(property) { + if (cssCache[property] === undefined) { + var domProperty = property. + replace(/(-[\s\S])/g, function(c) { return c.charAt(1).toUpperCase(); }); + var prefixedDom = style(domProperty); + cssCache[property] = domToCss(prefixedDom); + } + return cssCache[property]; + } + + /** + * APIMethod: js + * Detect which property is used for a JS property/method + * + * Parameters: + * obj - {Object} The object to test on + * property - {String} The standard (unprefixed) JS property name + * + * Returns: + * {String} The standard JS property, prefixed property or null if not + * supported + */ + function js(obj, property) { + if (jsCache[property] === undefined) { + var tmpProp, + i = 0, + l = VENDOR_PREFIXES.length, + prefix, + isStyleObj = (typeof obj.cssText !== "undefined"); + + jsCache[property] = null; + for(; i