// Required for Meteor package, the use of window prevents export by Meteor (function(window){
if(window.Package){ Materialize = {}; } else { window.Materialize = {}; }
})(window);
/*
* raf.js * https://github.com/ngryman/raf.js * * original requestAnimationFrame polyfill by Erik Möller * inspired from paul_irish gist and post * * Copyright (c) 2013 ngryman * Licensed under the MIT license. */
(function(window) {
var lastTime = 0, vendors = ['webkit', 'moz'], requestAnimationFrame = window.requestAnimationFrame, cancelAnimationFrame = window.cancelAnimationFrame, i = vendors.length; // try to un-prefix existing raf while (--i >= 0 && !requestAnimationFrame) { requestAnimationFrame = window[vendors[i] + 'RequestAnimationFrame']; cancelAnimationFrame = window[vendors[i] + 'CancelRequestAnimationFrame']; } // polyfill with setTimeout fallback // heavily inspired from @darius gist mod: https://gist.github.com/paulirish/1579671#comment-837945 if (!requestAnimationFrame || !cancelAnimationFrame) { requestAnimationFrame = function(callback) { var now = +Date.now(), nextTime = Math.max(lastTime + 16, now); return setTimeout(function() { callback(lastTime = nextTime); }, nextTime - now); }; cancelAnimationFrame = clearTimeout; } // export to window window.requestAnimationFrame = requestAnimationFrame; window.cancelAnimationFrame = cancelAnimationFrame;
}(window));
// Unique ID Materialize.guid = (function() {
function s4() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } return function() { return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); };
})();
/**
* Escapes hash from special characters * @param {string} hash String returned from this.hash * @returns {string} */
Materialize.escapeHash = function(hash) {
return hash.replace( /(:|\.|\[|\]|,|=)/g, "\\$1" );
};
Materialize.elementOrParentIsFixed = function(element) {
var $element = $(element); var $checkElements = $element.add($element.parents()); var isFixed = false; $checkElements.each(function(){ if ($(this).css("position") === "fixed") { isFixed = true; return false; } }); return isFixed;
};
// Velocity has conflicts when loaded with jQuery, this will check for it // First, check if in noConflict mode var Vel; if (jQuery) {
Vel = jQuery.Velocity;
} else if ($) {
Vel = $.Velocity;
} else {
Vel = Velocity;
}