From 588f781b527a7b1df543f498ebc669c8bcafee39 Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Sun, 3 Nov 2024 23:55:11 +0100 Subject: [PATCH 1/2] Move bunch of javascript variables from global scope to local scope in magnifier.js file. --- lib/web/magnifier/magnifier.js | 143 ++++++++++++++++----------------- 1 file changed, 71 insertions(+), 72 deletions(-) diff --git a/lib/web/magnifier/magnifier.js b/lib/web/magnifier/magnifier.js index 8b525b2e047b8..d15de7ddc372b 100644 --- a/lib/web/magnifier/magnifier.js +++ b/lib/web/magnifier/magnifier.js @@ -24,78 +24,77 @@ $thumb, that = this, largeWrapper = options.largeWrapper || '.magnifier-preview', - $magnifierPreview = $(largeWrapper); - - curThumb = null, - magnifierOptions = { - x: 0, - y: 0, - w: 0, - h: 0, - lensW: 0, - lensH: 0, - lensBgX: 0, - lensBgY: 0, - largeW: 0, - largeH: 0, - largeL: 0, - largeT: 0, - zoom: 2, - zoomMin: 1.1, - zoomMax: 5, - mode: 'outside', - eventType: 'click', - status: 0, - zoomAttached: false, - zoomable: customUserOptions.zoomable !== undefined ? - customUserOptions.zoomable - : false, - onthumbenter: customUserOptions.onthumbenter !== undefined ? - customUserOptions.onthumbenter - : null, - onthumbmove: customUserOptions.onthumbmove !== undefined ? - customUserOptions.onthumbmove - : null, - onthumbleave: customUserOptions.onthumbleave !== undefined ? - customUserOptions.onthumbleave - : null, - onzoom: customUserOptions.onzoom !== undefined ? - customUserOptions.onzoom - : null - }, - pos = { - t: 0, - l: 0, - x: 0, - y: 0 - }, - gId = 0, - status = 0, - curIdx = '', - curLens = null, - curLarge = null, - lensbg = customUserOptions.bg !== undefined ? - customUserOptions.lensbg - : true, - gZoom = customUserOptions.zoom !== undefined ? - customUserOptions.zoom - : magnifierOptions.zoom, - gZoomMin = customUserOptions.zoomMin !== undefined ? - customUserOptions.zoomMin - : magnifierOptions.zoomMin, - gZoomMax = customUserOptions.zoomMax !== undefined ? - customUserOptions.zoomMax - : magnifierOptions.zoomMax, - gMode = customUserOptions.mode || magnifierOptions.mode, - gEventType = customUserOptions.eventType || magnifierOptions.eventType, - data = {}, - inBounds = false, - isOverThumb = false, - rate = 1, - paddingX = 0, - paddingY = 0, - enabled = true, - showWrapper = true; + $magnifierPreview = $(largeWrapper), + curThumb = null, + magnifierOptions = { + x: 0, + y: 0, + w: 0, + h: 0, + lensW: 0, + lensH: 0, + lensBgX: 0, + lensBgY: 0, + largeW: 0, + largeH: 0, + largeL: 0, + largeT: 0, + zoom: 2, + zoomMin: 1.1, + zoomMax: 5, + mode: 'outside', + eventType: 'click', + status: 0, + zoomAttached: false, + zoomable: customUserOptions.zoomable !== undefined ? + customUserOptions.zoomable + : false, + onthumbenter: customUserOptions.onthumbenter !== undefined ? + customUserOptions.onthumbenter + : null, + onthumbmove: customUserOptions.onthumbmove !== undefined ? + customUserOptions.onthumbmove + : null, + onthumbleave: customUserOptions.onthumbleave !== undefined ? + customUserOptions.onthumbleave + : null, + onzoom: customUserOptions.onzoom !== undefined ? + customUserOptions.onzoom + : null + }, + pos = { + t: 0, + l: 0, + x: 0, + y: 0 + }, + gId = 0, + status = 0, + curIdx = '', + curLens = null, + curLarge = null, + lensbg = customUserOptions.bg !== undefined ? + customUserOptions.lensbg + : true, + gZoom = customUserOptions.zoom !== undefined ? + customUserOptions.zoom + : magnifierOptions.zoom, + gZoomMin = customUserOptions.zoomMin !== undefined ? + customUserOptions.zoomMin + : magnifierOptions.zoomMin, + gZoomMax = customUserOptions.zoomMax !== undefined ? + customUserOptions.zoomMax + : magnifierOptions.zoomMax, + gMode = customUserOptions.mode || magnifierOptions.mode, + gEventType = customUserOptions.eventType || magnifierOptions.eventType, + data = {}, + inBounds = false, + isOverThumb = false, + rate = 1, + paddingX = 0, + paddingY = 0, + enabled = true, + showWrapper = true; var MagnifyCls = { magnifyHidden: 'magnify-hidden', From 7883272474f4d28e0efc9c9568be60dc17ed038e Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Sun, 3 Nov 2024 23:56:37 +0100 Subject: [PATCH 2/2] Fixed static tests. --- lib/web/magnifier/magnifier.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/web/magnifier/magnifier.js b/lib/web/magnifier/magnifier.js index d15de7ddc372b..e75138ecd2f69 100644 --- a/lib/web/magnifier/magnifier.js +++ b/lib/web/magnifier/magnifier.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2015 Adobe + * All Rights Reserved. */ (function ($) {