vendor/store.shopware.com/trustedshops/src/Resources/views/storefront/base.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/base.html.twig' %}
  2. {% block base_body_inner %}
  3.     {{ parent() }}
  4.     {% if trustedshops.tsId %}
  5.         {# Trusted Shops Trustbadge - Start #}
  6.         {% if trustedshops.tsTrustbadgeExpertMode %}
  7.             {{ trustedshops.tsExpertTrustbadeCode|replace({'%tsid%': trustedshops.tsId})|raw }}
  8.         {% else %}
  9.             <script type="text/javascript">
  10.                 (function () {
  11.                     var _tsid = '{{ trustedshops.tsId|escape('js') }}';
  12.                     _tsConfig = {
  13.                         'yOffset': '{{ trustedshops.tsTrustbadgeOffsetY|escape('js')|default('0') }}', /* offset from page bottom */
  14.                         'variant': '{{ trustedshops.tsTrustbadgeVariant|escape('js')|default('default') }}', /* reviews, default, custom, custom_reviews */
  15.                         'customElementId': '', /* required for variants custom and custom_reviews */
  16.                         'trustcardDirection': '', /* for custom variants: topRight, topLeft, bottomRight, bottomLeft */
  17.                         'customBadgeWidth': '', /* for custom variants: 40 - 90 (in pixels) */
  18.                         'customBadgeHeight': '', /* for custom variants: 40 - 90 (in pixels) */
  19.                         'disableResponsive': 'false', /* deactivate responsive behaviour */
  20.                         {% if trustedshops.tsTrustbadgeVariant == 'hide' %}
  21.                         'disableTrustbadge': 'true', /* deactivate Trustbadge® */
  22.                         {% else %}
  23.                         'disableTrustbadge': 'false', /* deactivate Trustbadge® */
  24.                         {% endif %}
  25.                         'responsive': {
  26.                             'variant': '', /* floating, custom */
  27.                             'customElementId': '' /* required for variant custom */
  28.                         }
  29.                     };
  30.                     var _ts = document.createElement('script');
  31.                     _ts.type = 'text/javascript';
  32.                     _ts.charset = 'utf-8';
  33.                     _ts.async = true;
  34.                     _ts.src = '//widgets.trustedshops.com/js/' + _tsid + '.js';
  35.                     var __ts = document.getElementsByTagName('script')[0];
  36.                     __ts.parentNode.insertBefore(_ts, __ts);
  37.                 })();
  38.             </script>
  39.         {% endif %}
  40.         {# Trusted Shops Trustbadge - End #}
  41.     {% endif %}
  42. {% endblock %}
  43. {% block base_body_script %}
  44.     {{ parent() }}
  45.     {# Trusted Shops jQuery Selector - Start #}
  46.     <script type="text/javascript">
  47.         (function() {
  48.             const reviewStickerElementSelector = ".ts-rating.testimonial";
  49.             const productRatingStarsElementSelector = ".ts-rating.productreviewsSummary";
  50.             const productReviewsElementSelector = ".ts-rating.productreviews";
  51.             const reviewStickerParentSelector = "{% if trustedshops.tsReviewStickerExpertMode %}{{ trustedshops.tsExpertReviewStickerJquerySelector|escape('js') }}{% endif %}";
  52.             const productRatingStarsParentSelector = "{% if trustedshops.tsProductRatingStarsExpertMode %}{{ trustedshops.tsExpertProductRatingStarsJquerySelector|escape('js') }}{% endif %}";
  53.             const productReviewsParentSelector = "{% if trustedshops.tsProductReviewsTabExpertMode %}{{ trustedshops.tsExpertProductReviewsTabJquerySelector|escape('js') }}{% endif %}";
  54.             const onJqueryLoaded = function( $ ) {
  55.                 const waitForElement = function( selector, callback ) {
  56.                     const elementChecker = window.setInterval( function() {
  57.                         if( $( selector ).length ) {
  58.                             window.clearInterval( elementChecker );
  59.                             callback.call( $( selector ) );
  60.                         }
  61.                     }, 10 );
  62.                 };
  63.                 if( reviewStickerParentSelector ) {
  64.                     waitForElement( reviewStickerElementSelector, function() {
  65.                         $( reviewStickerParentSelector ).append( this );
  66.                     });
  67.                 }
  68.                 if( productRatingStarsParentSelector ) {
  69.                     waitForElement( productRatingStarsElementSelector, function() {
  70.                         $( productRatingStarsParentSelector ).append( this );
  71.                     });
  72.                 }
  73.                 if( productReviewsParentSelector ) {
  74.                     waitForElement( productReviewsElementSelector, function() {
  75.                         $( productReviewsParentSelector ).append( this );
  76.                     });
  77.                 }
  78.             };
  79.             window.onload = function() {
  80.                 const jqueryChecker = window.setInterval( function() {
  81.                     if( window.jQuery )
  82.                     {
  83.                         window.clearInterval( jqueryChecker );
  84.                         onJqueryLoaded( window.jQuery );
  85.                     }
  86.                 }, 100 );
  87.             };
  88.         })();
  89.     </script>
  90.     {# Trusted Shops jQuery Selector - End #}
  91. {% endblock %}