1/* 2 * [y] hybris Platform 3 * 4 * Copyright (c) 2000-2016 SAP SE or an SAP affiliate company. 5 * All rights reserved. 6 * 7 * This software is the confidential and proprietary information of SAP 8 * ("Confidential Information"). You shall not disclose such Confidential 9 * Information and shall use it only in accordance with the terms of the 10 * license agreement you entered into with SAP. 11 */ 12ACC.ratingstars = { 13 14 _autoload: [ 15 ["bindRatingStars", $(".js-ratingCalc").length > 0], 16 ["bindRatingStarsSet", $(".js-ratingCalcSet").length > 0] 17 ], 18 19 bindRatingStars: function(){ 20 21 $(".js-ratingCalc").each(function(){ 22 var rating = $(this).data("rating"); 23 $(this).find(".js-greenStars").width($(this).width() * ( parseFloat(rating.rating, 10) / rating.total )) 24 }) 25 }, 26 bindRatingStarsSet: function(){ 27 $('.js-writeReviewStars').on({ 28 mouseleave: function mouseleave(){ 29 clearReviewState(); 30 var sV = (parseFloat( $(".js-ratingSetInput").val(), 10)) * 2; 31 (typeof sV === "number" && !isNaN(sV) )? setReviewState(sV) : clearReviewState(); 32 } 33 }); 34 var ratingIcons = $('.js-writeReviewStars .js-ratingIcon'); 35 var setReviewState = function(index){ 36 ratingIcons.slice(0, parseFloat(index,10) ).addClass('active'); 37 }; 38 var clearReviewState = function(){ 39 ratingIcons.removeClass('active'); 40 }; 41 ratingIcons.on({ 42 mouseenter: function mouseenter(){ 43 clearReviewState(); 44 setReviewState( $(this).index()+1 ); 45 }, 46 mouseleave: function mouseleave(){ 47 $(this).removeClass('active'); 48 }, 49 click: function click(){ 50 $(".js-ratingSetInput").val( ($(this).index() + 1) /2); 51 } 52 }); 53 54 } 55 56};
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.