Skip to content

Commit

Permalink
Merge branch 'unclechu-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
hgoebl committed Jul 16, 2014
2 parents a7332cb + 7e59fdf commit da397b4
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions generate/mobile-detect.template.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*global module:false, define:false*/

(function (exports, undefined) {
(function (define, undefined) {
define(function () {
'use strict';

var mobileDetectRules = {/*rules*/};
Expand Down Expand Up @@ -540,12 +541,9 @@
}
};

exports(MobileDetect);

})(function (data, undefined) {

// environment-dependent
if (typeof window !== 'undefined' && window.screen && window.screen.width) {
data.isPhoneSized = function (maxPhoneWidth) {
MobileDetect.isPhoneSized = function (maxPhoneWidth) {
if (maxPhoneWidth < 0) {
return undefined;
}
Expand All @@ -556,22 +554,20 @@
return cssPixelWidth <= maxPhoneWidth;
};
} else {
data.isPhoneSized = function () {};
MobileDetect.isPhoneSized = function () {};
}

if (typeof module !== 'undefined' && module.exports) {

module.exports = data;

} else if (typeof define === 'function' && define.amd) {

define(function () { return data; });

return MobileDetect;
}); // end of call of define()
})((function (undefined) {
if (typeof define === 'function' && define.amd) {
return define;
} else if (typeof module !== 'undefined' && module.exports) {
return function (factory) { module.exports = factory(); };
} else if (typeof window !== 'undefined') {

window.MobileDetect = data;

return function (factory) { window.MobileDetect = factory(); };
} else {
throw new Error('unknown environment'); // please file a bug if you get this error!
// please file a bug if you get this error!
throw new Error('unknown environment');
}
});
})());

0 comments on commit da397b4

Please sign in to comment.