Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/magento/module-reports/view/frontend/web/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-reports/view/frontend/web/js/recently-viewed.js
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @api
 */
define([
    'jquery',
    'jquery-ui-modules/widget'
], function ($) {
    'use strict';

    $.widget('mage.recentlyViewedProducts', {
        options: {
            localStorageKey: 'recently-viewed-products',
            productBlock: '#widget_viewed_item',
            viewedContainer: 'ol'
        },

        /**
         * Bind events to the appropriate handlers.
         * @private
         */
        _create: function () {
            var productHtml = $(this.options.productBlock).html(),
                productSku = $(this.options.productBlock).data('sku'),
                products = JSON.parse(window.localStorage.getItem(this.options.localStorageKey)),
                productsLength, maximum, showed, index;

            if (products) {
                productsLength = products.sku.length;
                maximum = $(this.element).data('count');
                showed = 0;

                for (index = 0; index <= productsLength; index++) {
                    if (products.sku[index] == productSku || showed >= maximum) { //eslint-disable-line
                        products.sku.splice(index, 1);
                        products.html.splice(index, 1);
                    } else {
                        $(this.element).find(this.options.viewedContainer).append(products.html[index]);
                        $(this.element).show();
                        showed++;
                    }
                }
                $(this.element).find(this.options.productBlock).show();
            } else {
                products = {};
                products.sku = [];
                products.html = [];
            }
            products.sku.unshift(productSku);
            products.html.unshift(productHtml);
            window.localStorage.setItem(this.options.localStorageKey, JSON.stringify(products));
        }
    });

    return $.mage.recentlyViewedProducts;
});

Spamworldpro Mini