‘); $(‘#stamped-badge-2 .stamped-badge-stars’, obj).append(eleRating); var classNameWidget = ‘#stamped-reviews-widget[data-widget-type=”site-badge”]’; var style = ”; if (styleColorText) { style += classNameWidget + ‘ ‘ + ‘.stamped-style-color-text { color:’ + styleColorText + ‘ !important; }’; } if (styleColorStar) { style += classNameWidget + ‘ ‘ + ‘.stamped-style-color-star i { color:’ + styleColorStar + ‘ !important; }’; } if (styleSizeStar) { style += classNameWidget + ‘ ‘ + ‘.stamped-style-size-star i:before { font-size:’ + styleSizeStar + ‘px !important; }’; } if (style) { $(obj).append(”); } } if (totalAll) { var _text = numberWithCommas(totalAll); $(‘[id=”stamped-badge-total”]’, obj).html(_text); if (data.totalAll < 10) { $('[id="stamped-badge-total"]').attr('x', 80); } else if (data.totalAll >= 10 && data.totalAll <= 99) { $('[id="stamped-badge-total"]').attr('x', 67); } else if (data.totalAll >= 1000 && data.totalAll < 10000) { $('[id="stamped-badge-total"]').attr('x', 45); } else if (data.totalAll >= 10000) { $(‘[id=”stamped-badge-count-color”]’).attr(‘font-size’, 33); $(‘[id=”stamped-badge-total”]’).attr(‘x’, 42); } if (data.totalAll < 200) { $('#badge-1').show(); } else if (data.totalAll >= 200 && data.totalAll <= 499) { $('#badge-2').show(); } else if (data.totalAll >= 500) { $(‘#badge-3’).show(); } $(‘#stamped-badge-2, #stamped-badge-3’, obj).attr(‘data-rating’, truncate(data.ratingAll, 1)); } if (height) { $(‘#stamped-badge-3’, obj).height(height); } if (title) { $(‘[id=”stamped-badge-title”]’, obj).text(title).css(‘font-size’, titleSize + ‘px’); if (badgeType == ‘minimal’) { $(‘[id=”stamped-badge-total”]’, obj).css(‘font-size’, titleSize + ‘px’); } } if (colorRibbon) { $(‘[id=”stamped-badge-ribbon-foreground”], [id=”stamped-badge-ribbon-background”]’, obj).attr(‘fill’, colorRibbon); } if (colorOuter) { $(‘[id=”stamped-badge-outer”], [id=”stamped-badge-border”]’, obj).attr(‘fill’, colorOuter); } if (colorInner) { $(‘[id=”stamped-badge-inner”], #stamped-badge-inner use[fill]’, obj).attr(‘fill’, colorInner); } if (styleColorText) { $(‘[id=”stamped-badge-count-color”]’, obj).attr(‘fill’, styleColorText); } if (styleColorStar) { $(‘[id=”stamped-badge-stars-color”]’, obj).attr(‘fill’, styleColorStar); } try { StampedFn.triggerEvent(‘stamped:widget:site-badge:loaded’); } catch (ex) { } } function truncate(num, places) { return Math.trunc(num * Math.pow(10, places)) / Math.pow(10, places); } function numberWithCommas(x) { return x.toString().replace(/B(?=(d{3})+(?!d))/g, “,”); } return { init: init } }(window, document));

Source

Leave a Reply

Your email address will not be published. Required fields are marked *