js/foundation/foundation.js in zurb-foundation-4.3.1 vs js/foundation/foundation.js in zurb-foundation-4.3.2
- old
+ new
@@ -36,10 +36,14 @@
Dual MIT/BSD license
https://github.com/paulirish/matchMedia.js
*/
+ $('head').append('<meta class="foundation-mq-small">');
+ $('head').append('<meta class="foundation-mq-medium">');
+ $('head').append('<meta class="foundation-mq-large">');
+
window.matchMedia = window.matchMedia || (function( doc, undefined ) {
"use strict";
var bool,
@@ -164,14 +168,22 @@
};
window.Foundation = {
name : 'Foundation',
- version : '4.3.1',
+ version : '4.3.2',
cache : {},
+ media_queries : {
+ small : $('.foundation-mq-small').css('font-family').replace(/\'/g, ''),
+ medium : $('.foundation-mq-medium').css('font-family').replace(/\'/g, ''),
+ large : $('.foundation-mq-large').css('font-family').replace(/\'/g, '')
+ },
+
+ stylesheet : $('<style></style>').appendTo('head')[0].sheet,
+
init : function (scope, libraries, method, options, response, /* internal */ nc) {
var library_arr,
args = [scope, method, options, response],
responses = [],
nc = nc || false;
@@ -383,9 +395,21 @@
for (var key in obj) {
if (hasOwnProperty.call(obj, key)) return false;
}
return true;
+ },
+
+ addCustomRule : function(rule, media) {
+ if(media === undefined) {
+ Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);
+ } else {
+ var query = Foundation.media_queries[media];
+ if(query !== undefined) {
+ Foundation.stylesheet.insertRule('@media ' +
+ Foundation.media_queries[media] + '{ ' + rule + ' }');
+ }
+ }
}
},
fix_outer : function (lib) {
lib.outerHeight = function (el, bool) {