PageSourceSearch

https://www.epbooks.gr/wp-content/plugins/yith-woocommerce-badge-m…/assets/js/force-badge-positioning.js

js epbooks.gr collected 2026-10-02 07:20:33 UTC 1,603 bytes, 48 lines download raw bytes

1/* global yithWcbmForceBadgePositioning */
2
3jQuery( function ($) {
4	var $clonedBadgeContainer = $( '<div id="yith-wcbm-cloned-badges"></div>' ),
5		$badges               = $( '.yith-wcbm-badge' ),
6		cloneBadges           = function () {
7			$clonedBadgeContainer.html( '' );
8			$badges.each( function (index, badge) {
9				var $badge    = $( badge ),
10					position  = $badge.show().offset(),
11					transform = $badge.data( 'transform' ),
12					css       = {
13						top      : position.top,
14						left     : position.left,
15						right    : 'auto',
16						margin   : '0',
17						bottom   : 'auto',
18						position : 'absolute',
19						transform: undefined !== transform ? transform.replace( /translate.+?\)/m, 'translate(0,0)' ) : '',
20						'z-index': 50,
21					},
22					$clone    = $badge.clone();
23				if ( $badge.hasClass( 'yith-wcbm-badge-show-if-variation' ) && ! $badge.hasClass( 'yith-wcbm-badge-show-if-variation--visible' ) ) {
24					$badge.hide();
25					return;
26				}
27				$clone.css( css );
28				$clonedBadgeContainer.append( $clone );
29				$badge.hide();
30			} );
31		},
32		safeCloneBadges       = function () {
33			cloneBadges();
34			setTimeout( cloneBadges, 200 );
35		};
36	$( 'body' ).append( $clonedBadgeContainer );
37	setTimeout( cloneBadges, yithWcbmForceBadgePositioning.timeout );
38
39	$( window ).on( 'resize', safeCloneBadges );
40
41	/**
42	 * Proteo Integration
43	 */
44	if ( $( 'body' ).is( '.yith-wcbm-theme-yith-proteo' ) || 'yes' === yithWcbmForceBadgePositioning.onMobileScroll && 'yes' === yithWcbmForceBadgePositioning.isMobile ) {
45		$( document ).on( 'scroll translated.owl.carousel', safeCloneBadges );
46	}
47
48} );

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.