{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_body_inner %}
{{ parent() }}
{% if trustedshops.tsId %}
{# Trusted Shops Trustbadge - Start #}
{% if trustedshops.tsTrustbadgeExpertMode %}
{{ trustedshops.tsExpertTrustbadeCode|replace({'%tsid%': trustedshops.tsId})|raw }}
{% else %}
<script type="text/javascript">
(function () {
var _tsid = '{{ trustedshops.tsId|escape('js') }}';
_tsConfig = {
'yOffset': '{{ trustedshops.tsTrustbadgeOffsetY|escape('js')|default('0') }}', /* offset from page bottom */
'variant': '{{ trustedshops.tsTrustbadgeVariant|escape('js')|default('default') }}', /* reviews, default, custom, custom_reviews */
'customElementId': '', /* required for variants custom and custom_reviews */
'trustcardDirection': '', /* for custom variants: topRight, topLeft, bottomRight, bottomLeft */
'customBadgeWidth': '', /* for custom variants: 40 - 90 (in pixels) */
'customBadgeHeight': '', /* for custom variants: 40 - 90 (in pixels) */
'disableResponsive': 'false', /* deactivate responsive behaviour */
{% if trustedshops.tsTrustbadgeVariant == 'hide' %}
'disableTrustbadge': 'true', /* deactivate Trustbadge® */
{% else %}
'disableTrustbadge': 'false', /* deactivate Trustbadge® */
{% endif %}
'responsive': {
'variant': '', /* floating, custom */
'customElementId': '' /* required for variant custom */
}
};
var _ts = document.createElement('script');
_ts.type = 'text/javascript';
_ts.charset = 'utf-8';
_ts.async = true;
_ts.src = '//widgets.trustedshops.com/js/' + _tsid + '.js';
var __ts = document.getElementsByTagName('script')[0];
__ts.parentNode.insertBefore(_ts, __ts);
})();
</script>
{% endif %}
{# Trusted Shops Trustbadge - End #}
{% endif %}
{% endblock %}
{% block base_body_script %}
{{ parent() }}
{# Trusted Shops jQuery Selector - Start #}
<script type="text/javascript">
(function() {
const reviewStickerElementSelector = ".ts-rating.testimonial";
const productRatingStarsElementSelector = ".ts-rating.productreviewsSummary";
const productReviewsElementSelector = ".ts-rating.productreviews";
const reviewStickerParentSelector = "{% if trustedshops.tsReviewStickerExpertMode %}{{ trustedshops.tsExpertReviewStickerJquerySelector|escape('js') }}{% endif %}";
const productRatingStarsParentSelector = "{% if trustedshops.tsProductRatingStarsExpertMode %}{{ trustedshops.tsExpertProductRatingStarsJquerySelector|escape('js') }}{% endif %}";
const productReviewsParentSelector = "{% if trustedshops.tsProductReviewsTabExpertMode %}{{ trustedshops.tsExpertProductReviewsTabJquerySelector|escape('js') }}{% endif %}";
const onJqueryLoaded = function( $ ) {
const waitForElement = function( selector, callback ) {
const elementChecker = window.setInterval( function() {
if( $( selector ).length ) {
window.clearInterval( elementChecker );
callback.call( $( selector ) );
}
}, 10 );
};
if( reviewStickerParentSelector ) {
waitForElement( reviewStickerElementSelector, function() {
$( reviewStickerParentSelector ).append( this );
});
}
if( productRatingStarsParentSelector ) {
waitForElement( productRatingStarsElementSelector, function() {
$( productRatingStarsParentSelector ).append( this );
});
}
if( productReviewsParentSelector ) {
waitForElement( productReviewsElementSelector, function() {
$( productReviewsParentSelector ).append( this );
});
}
};
window.onload = function() {
const jqueryChecker = window.setInterval( function() {
if( window.jQuery )
{
window.clearInterval( jqueryChecker );
onJqueryLoaded( window.jQuery );
}
}, 100 );
};
})();
</script>
{# Trusted Shops jQuery Selector - End #}
{% endblock %}