Skip to content

Commit

Permalink
RWD: removed modernizr.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed Sep 27, 2024
1 parent e60ec99 commit 208190a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
1 change: 0 additions & 1 deletion app/design/frontend/rwd/default/layout/page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<block type="page/js_cookie" name="js_cookies" template="page/js/cookie.phtml"/>

<!-- Add vendor dependencies -->
<action method="addItem"><type>skin_js</type><name>js/lib/modernizr.custom.min.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/app.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/lib/jquery.cycle2.min.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/slideshow.js</name></action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
}

if (this._copyElement.checked) {
if (this.copyShippingToBilling_allowScrollTo && Modernizr.mq && Modernizr.mq("only screen and (max-width: 767px)")) {
if (this.copyShippingToBilling_allowScrollTo && window.matchMedia("only screen and (max-width: 767px)").matches) {
$('shipping-address').scrollTo();
}
} else {
Expand Down
15 changes: 5 additions & 10 deletions public/skin/frontend/rwd/default/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Varien.searchForm.prototype.blur = function (event) {
* to determine the user's preferred pointer type.
*
* - getPointer() returns the last used pointer type, or, if the user has
* not yet interacted with the site, falls back to a Modernizr test.
* not yet interacted with the site, falls back to a test.
*
* - The mouse-detected event is triggered on the window object when the user
* is using a mouse pointer input, or has switched from touch to mouse input.
Expand Down Expand Up @@ -132,21 +132,20 @@ var PointerManager = {

/**
* If called before init(), get best guess of input pointer type
* using Modernizr test.
* If called after init(), get current pointer in use.
*/
getPointer: function() {
// On iOS devices, always default to touch, as this.lastTouchType will intermittently return 'mouse' if
// multiple touches are triggered in rapid succession in Safari on iOS
if(Modernizr.ios) {
if(navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
return this.TOUCH_POINTER_TYPE;
}

if(this.lastTouchType) {
return this.lastTouchType;
}

return Modernizr.touch ? this.TOUCH_POINTER_TYPE : this.MOUSE_POINTER_TYPE;
return ('ontouchstart' in window || navigator.maxTouchPoints > 0) ? this.TOUCH_POINTER_TYPE : this.MOUSE_POINTER_TYPE;
},

setPointerEventLock: function() {
Expand Down Expand Up @@ -303,7 +302,7 @@ var MenuManager = {
* @returns {boolean}
*/
useSmallScreenBehavior: function() {
return Modernizr.mq("screen and (max-width:" + bp.medium + "px)");
return window.matchMedia("screen and (max-width:" + bp.medium + "px)").matches;
},

/**
Expand Down Expand Up @@ -658,10 +657,6 @@ $j(document).ready(function () {
var d = $j(document);
var body = $j('body');

Modernizr.addTest('ios', function () {
return navigator.userAgent.match(/(iPad|iPhone|iPod)/g);
});

//initialize pointer abstraction manager
PointerManager.init();

Expand Down Expand Up @@ -1157,7 +1152,7 @@ var ProductMediaManager = {
// Don't use zoom on devices where touch has been used
PointerManager.getPointer() == PointerManager.TOUCH_POINTER_TYPE
// Don't use zoom when screen is small, or else zoom window shows outside body
|| Modernizr.mq("screen and (max-width:" + bp.medium + "px)")
|| window.matchMedia("screen and (max-width:" + bp.medium + "px)").matches
) {
return; // zoom not enabled
}
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion public/skin/frontend/rwd/default/js/opcheckout_rwd.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Checkout.prototype.gotoSection = function (section, reloadProgressBlock) {
this.accordion.openSection('opc-' + section);

// Scroll viewport to top of checkout steps for smaller viewports
if (Modernizr.mq('(max-width: ' + bp.xsmall + 'px)')) {
if (window.matchMedia('(max-width: ' + bp.xsmall + 'px)').matches) {
$j('html,body').animate({scrollTop: $j('#checkoutSteps').offset().top}, 800);
}

Expand Down

0 comments on commit 208190a

Please sign in to comment.