PageSourceSearch

https://beautysociety.com/wp-content/plugins/beautysociety-wrapper…utysociety-rewards-directive.js?ver=6.0.133

js beautysociety.com collected 2026-10-01 12:35:38 UTC 3,900 bytes, 88 lines download raw bytes

1(function() {
2    'use strict';
3
4    const app = angular.module('app');
5
6    app.directive('beautisocietyRewards', function($timeout) {
7        return {
8            restrict: 'E',
9            replace: true,
10            scope: {
11                rewards: '='
12            },
13            templateUrl: beautysocietyDirectivePluginRelativeUrl + '/assets/views/common/beautysociety-rewards-directive.html',
14            controller: function ($scope) {
15                $scope.uid = Date.now();
16                $scope.swiper = null;
17                $scope.activeIndex = 0;
18
19                $scope.prevSlide = (swiper) => {
20                    if (!swiper) return;
21                    swiper.slidePrev();
22                    $scope.$evalAsync(() => {
23                        $scope.activeIndex = swiper.realIndex % $scope.rewards.length;
24                    });
25                };
26
27                $scope.nextSlide = (swiper) => {
28                    if (!swiper) return;
29                    swiper.slideNext();
30                    $scope.$evalAsync(() => {
31                        $scope.activeIndex = swiper.realIndex % $scope.rewards.length;
32                    });
33                };
34
35                $scope.slideTo = (swiper, index) => {
36                    if (!swiper) return;
37                    $scope.$evalAsync(() => {
38                        swiper.slideToLoop(index % $scope.rewards.length, 300);
39                        $scope.activeIndex = index % $scope.rewards.length;
40                    });
41                };
42            },
43            link: function(scope, element, attrs) {
44                scope.$watch('rewards', function(newVal) {
45                    if (scope.swiper) {
46                        scope.swiper.destroy(true, true);
47                        scope.swiper = null;
48                    }
49
50                    if (newVal && newVal.length > 0) {
51                        $timeout(function() {
52                            const selector = '.beautysociety-view-cart-sidebar-promo-box-swiper-bottom-' + scope.uid;
53                            const swiperEl = element[0].querySelector(selector);
54
55                            if (swiperEl && typeof Swiper !== 'undefined') {
56                                try {
57                                    scope.swiper = new Swiper(swiperEl, {
58                                        direction: 'horizontal',
59                                        loop: true,
60                                        resizeObserver: false,
61                                        on: {
62                                            slideChange: function () {
63                                                scope.$evalAsync(() => {
64                                                    scope.activeIndex = this.realIndex % scope.rewards.length;
65                                                });
66                                            },
67                                            init: function() {
68                                                this.slideTo(0, 0);
69                                                scope.$evalAsync(() => {
70                                                    scope.activeIndex = 0;
71                                                });
72                                            }
73                                        },
74                                        slidesPerView: 1,
75                                        spaceBetween: 30,
76                                        autoplay: false
77                                    });
78                                } catch (e) {
79                                    console.warn('Swiper init failed:', e);
80                                }
81                            }
82                        }, 100);
83                    }
84                });
85            }
86        };
87    });
88})();

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.