1/** 2 * Magento 3 * 4 * NOTICE OF LICENSE 5 * 6 * This source file is subject to the Academic Free License (AFL 3.0) 7 * that is bundled with this package in the file LICENSE_AFL.txt. 8 * It is also available through the world-wide-web at this URL: 9 * http://opensource.org/licenses/afl-3.0.php 10 * If you did not receive a copy of the license and are unable to 11 * obtain it through the world-wide-web, please send an email 12 * to [email protected] so we can send you a copy immediately. 13 * 14 * DISCLAIMER 15 * 16 * Do not edit or add to this file if you wish to upgrade Magento to newer 17 * versions in the future. If you wish to customize Magento for your 18 * needs please refer to http://www.magento.com for more information. 19 * 20 * @category design 21 * @package rwd_default 22 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 23 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 24 */ 25 26var ConfigurableSwatchesList = { 27 swatchesByProduct: {}, 28 29 init: function() 30 { 31 var that = this; 32 $j('.configurable-swatch-list li').each(function() { 33 that.initSwatch(this); 34 var $swatch = $j(this); 35 if ($swatch.hasClass('filter-match')) { 36 that.handleSwatchSelect($swatch); 37 } 38 }); 39 }, 40 41 initSwatch: function(swatch) 42 { 43 var that = this; 44 var $swatch = $j(swatch); 45 var productId; 46 $j($swatch).hover(function() { 47 /** 48 * 49 * - Preview the stock status 50 **/ 51 var swatchUl = $swatch.parent(); 52 swatchUl.find('.x').each(function(){ 53 $j(this).show(); 54 $j(this).closest('li').addClass('not-available'); 55 }); 56 }); 57 if (productId = $swatch.data('product-id')) { 58 if (typeof(this.swatchesByProduct[productId]) == 'undefined') { 59 this.swatchesByProduct[productId] = []; 60 } 61 this.swatchesByProduct[productId].push($swatch); 62 63 $swatch.find('a').on('click', function(e) { 64 e.preventDefault(); 65 that.handleSwatchSelect($swatch); 66 }); 67 } 68 }, 69 70 handleSwatchSelect: function($swatch) 71 { 72 var productId = $swatch.data('product-id'); 73 var label; 74 if (label = $swatch.data('option-label')) { 75 ConfigurableMediaImages.swapListImageByOption(productId, label); 76 } 77 78 $j.each(this.swatchesByProduct[productId], function(key, $productSwatch) { 79 $productSwatch.removeClass('selected'); 80 }); 81 82 $swatch.addClass('selected'); 83 } 84}; 85 86$j(document).on('configurable-media-images-init', function(){ 87 ConfigurableSwatchesList.init(); 88});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.