From 208190a3453eb182cf9ca35a7e22291d130a4792 Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Fri, 27 Sep 2024 15:24:34 +0100 Subject: [PATCH] RWD: removed modernizr.js --- app/design/frontend/rwd/default/layout/page.xml | 1 - .../template/paypal/express/review/address.phtml | 2 +- public/skin/frontend/rwd/default/js/app.js | 15 +++++---------- .../rwd/default/js/lib/modernizr.custom.min.js | 4 ---- .../frontend/rwd/default/js/opcheckout_rwd.js | 2 +- 5 files changed, 7 insertions(+), 17 deletions(-) delete mode 100644 public/skin/frontend/rwd/default/js/lib/modernizr.custom.min.js diff --git a/app/design/frontend/rwd/default/layout/page.xml b/app/design/frontend/rwd/default/layout/page.xml index 97bae6c7a..839d1dcc1 100644 --- a/app/design/frontend/rwd/default/layout/page.xml +++ b/app/design/frontend/rwd/default/layout/page.xml @@ -34,7 +34,6 @@ - skin_jsjs/lib/modernizr.custom.min.js skin_jsjs/app.js skin_jsjs/lib/jquery.cycle2.min.js skin_jsjs/slideshow.js diff --git a/app/design/frontend/rwd/default/template/paypal/express/review/address.phtml b/app/design/frontend/rwd/default/template/paypal/express/review/address.phtml index a9a0a7961..6c13b655e 100644 --- a/app/design/frontend/rwd/default/template/paypal/express/review/address.phtml +++ b/app/design/frontend/rwd/default/template/paypal/express/review/address.phtml @@ -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 { diff --git a/public/skin/frontend/rwd/default/js/app.js b/public/skin/frontend/rwd/default/js/app.js index d1f24b6b8..ae5050eab 100644 --- a/public/skin/frontend/rwd/default/js/app.js +++ b/public/skin/frontend/rwd/default/js/app.js @@ -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. @@ -132,13 +132,12 @@ 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; } @@ -146,7 +145,7 @@ var PointerManager = { 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() { @@ -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; }, /** @@ -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(); @@ -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 } diff --git a/public/skin/frontend/rwd/default/js/lib/modernizr.custom.min.js b/public/skin/frontend/rwd/default/js/lib/modernizr.custom.min.js deleted file mode 100644 index 74e4236c7..000000000 --- a/public/skin/frontend/rwd/default/js/lib/modernizr.custom.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/* Modernizr 2.6.2 (Custom Build) | MIT & BSD - * Build: http://modernizr.com/download/#-localstorage-touch-shiv-mq-cssclasses-teststyles-prefixes-load - */ -;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(m.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={},o={},p={},q=[],r=q.slice,s,t=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},u=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return t("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=r.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(r.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(r.call(arguments)))};return e}),n.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:t(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},n.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}};for(var C in n)w(n,C)&&(s=C.toLowerCase(),e[s]=n[C](),q.push((e[s]?"":"no-")+s));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e.mq=u,e.testStyles=t,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+q.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f