PageSourceSearch

https://cdnn.1prime.ru//js/libs/ria.cells.js

js 1prime.ru collected 2026-09-24 08:26:52 UTC 13,746 bytes, 361 lines download raw bytes

1/**
2* Скрипты блоков на главной
3* */
4
5var riaCells = function(){
6    /** Блок карусель на главной с главной новостью */
7    var carouselLargeCell = $(".cell-carousel-l .cell-carousel-l__item-set");
8    carouselLargeCell.theinCarousel({
9        itemWidth: 233,
10        between: 16,
11        outside: 0,
12        navText: ['<i>'+ria.getIcon('icon-left_single')+'</i>', '<i>'+ria.getIcon('icon-right_single')+'</i>'],
13        navContainer: carouselLargeCell.siblings('.cell-carousel-l__main'),
14        motionType : 'scroll',
15        responsive: {
16            925: {
17                motionType : 'transform',
18                sticked: true,
19                slideBy: 3
20            }
21        }
22    });
23
24    /** Блок карусель на главной */
25    var carouselCell = $(".cell-carousel .cell-carousel__item-set");
26    carouselCell.theinCarousel({
27        itemWidth: 233,
28        between: 16,
29        outside: 0,
30        navText : ['<i>'+ria.getIcon('icon-left_single')+'</i>', '<i>'+ria.getIcon('icon-right_single')+'</i>'],
31        motionType : 'scroll',
32        responsive: {
33            925: {
34                motionType : 'transform',
35                sticked: true,
36                slideBy: 3
37            }
38        }
39    });
40
41    /** Блок фотолента на главной */
42    var carouselPhoto = $( ".cell-photo .cell-photo__item-set" );
43    carouselPhoto.on( 'changed.the-in-carousel', function(event, data) {
44        data.plugin.$el.parents('.cell-photo:first').find('.cell-photo__outer-set').css('left', -( (data.plugin._current.active - 1)  * 100 )+'%' );
45        data.plugin.$el.parents('.cell-photo:first').find('.cell-photo__desc-counter').html(`${data.plugin._current.active} / ${data.plugin._current.itemsLength}`)
46    });
47    carouselPhoto.theinCarousel({
48        navText : [ria.getIcon('icon-left_single'), ria.getIcon('icon-right_single')],
49        motionType : 'transform',
50        sticked: true,
51        elasticEnds: true,
52        outside: 16,
53        responsive: {
54            0: {
55                itemWidth: '75%',
56                between: 16
57            },
58            480: {
59                itemWidth: '80%',
60                between: 16,
61            },
62            768: {
63                itemWidth: '85%',
64                between: 16
65            },
66            925: {
67                motionType : 'transform',
68                elasticEnds: false,
69                items: 1,
70                between: 0,
71                outside: 0
72            }
73        }
74    });
75
76
77    /** Блок перетяжка супертегов на главной */
78    var carouselExtension = $(".cell-extension.m-title:not(.m-border) .cell-extension__list");
79    carouselExtension.theinCarousel({
80        nestedItemSelector: '.cell-extension__item',
81        navText : [ria.getIcon('icon-left_single'), ria.getIcon('icon-right_single')],
82        motionType: 'scroll',
83        itemAutoWidth: true,
84        outside: 16,
85        between: 24,
86        scaling: true,
87        responsive: {
88            768: {
89                outside: 16
90            },
91            925: {
92                motionType: 'transform',
93                outsideLeft: 16,
94                outsideRight: 16
95            }
96        }
97    });
98
99    var carouselExtension = $(".cell-extension:not(.m-title):not(.m-border) .cell-extension__list");
100    carouselExtension.theinCarousel({
101        nestedItemSelector: '.cell-extension__item',
102        navText : [ria.getIcon('icon-left_single'), ria.getIcon('icon-right_single')],
103        motionType: 'scroll',
104        lessCenter: true,
105        itemAutoWidth: true,
106        outside: 16,
107        between: 24,
108        scaling: true,
109        responsive: {
110            768: {
111                outside: 16
112            },
113            925: {
114                motionType: 'transform',
115                outsideLeft: 16,
116                outsideRight: 16
117            }
118        }
119    });
120
121    var carouselExtension = $(".cell-extension.m-border .cell-extension__list");
122    carouselExtension.theinCarousel({
123        nestedItemSelector: '.cell-extension__item',
124        navText : [ria.getIcon('icon-left_single'), ria.getIcon('icon-right_single')],
125        motionType: 'scroll',
126        itemAutoWidth: true,
127        outside: 16,
128        between: 12,
129        stretch: true,
130        scaling: true,
131        responsive: {
132            768: {
133                outside: 16
134            },
135            925: {
136                motionType: 'transform',
137                outsideLeft: 16,
138                outsideRight: 16
139            }
140        }
141    });
142
143    /** Блок календарь событий */
144    $(".cell-calendar").each(function(){
145        var $this = $(this);
146        $this.initCalendarCarousel = function(){
147            $this.find( ".cell-calendar__item-set" ).theinCarousel({
148                nav : false,
149                motionType : 'scroll',
150                stretch: true,
151                outside: 5,
152                responsive: {
153                    0: {
154                        itemWidth: 275
155                    },
156                    480: {
157                        itemWidth: 295,
158                        outside: 5
159                    },
160                    768: {
161                        itemWidth: 295,
162                        outside: 15
163                    },
164                    925: {
165                        itemWidth: 295,
166                        outside: 0,
167                        deactivate: true
168                    }
169                }
170            });
171        };
172        $this.loadingCalendarData = function( url, changeSort ){
173            if ( !url ) return false;
174            var $loader = $('.cell-calendar__loader', $this ),
175                $place = $('.cell-calendar__place', $this ),
176                animateDuration = 500,
177                fadeDuration = 250;
178            if ( changeSort ){
179                if ( url.indexOf( "sort=asc" ) != -1 ){
180                    url = url.replace( "sort=asc", "sort=desc" );
181                } else {
182                    url = url.replace( "sort=desc", "sort=asc" );
183                }
184            }
185            $.ajax({
186				 url: url,
187				 beforeSend: function() {
188                     $this.addClass( 'm-loading' );
189                     $loader.fadeIn( fadeDuration );
190				 }
191            }).done( function( data ) {
192                $place.animate({
193                    opacity: 0
194                }, animateDuration , function(){
195                    $place.empty().append( $( data ) );
196                    // $this.initCalendarCarousel();
197                    $place.animate({
198                        opacity: 1
199                    }, animateDuration );
200                    $loader.fadeOut( fadeDuration );
201                    if ( changeSort ){
202                        var dirButton = $( '.js-change-order', $this );
203                        dirButton.toggleClass( 'm-desc', !dirButton.hasClass( 'm-desc' ) );
204                    }
205                    $this.removeClass( 'm-loading' );
206                    var $timeline = $( '.cell-calendar__timeline', $this ),
207                        listSid = $timeline.data( 'list-sid' ) || 'event';
208                    $( '.js-export-link', $this ).attr( 'href' , '/services/' + listSid + '/export.ics?article_type=event&date_start=' + $timeline.data( 'current-date' ) + '&date=' +$timeline.data( 'current-year' ) + '1231')
209                });
210            }).fail(function() {
211                $loader.fadeOut( fadeDuration );
212                $this.removeClass( 'm-loading' );
213            })
214        };
215        // $this.initCalendarCarousel();
216        $this.on( "click", ".form__btn.m-dir", function( e ){
217            e.preventDefault();
218            var url = $( '.cell-calendar__timeline', $this ).data('current-url');
219            if ( !$this.hasClass( 'm-loading' ) && url ) $this.loadingCalendarData( url, true );
220        });
221        $this.on( "click", ".cell-calendar__nav-prev, .cell-calendar__nav-next, .cell-calendar__timeline-item a", function( e ){
222            e.preventDefault();
223            var url = $( this ).data('url');
224            if ( !$this.hasClass( 'm-loading' ) && url ) $this.loadingCalendarData( url );
225        });
226        $this.one( "click", ".cell-calendar__timeline-calendar", function() {
227            if ( !$(".date-range").length ) {
228                $('body').append(`
229                    <div class="date-range">
230                        <div class="date-range-scroll">
231                            <div class="date-range-calendar"></div>
232                        </div>
233                        <div class="date-range__close">
234                            ${ria.getIcon('icon-close')}
235                        </div>
236                    </div>`);
237                cellCalendar.datepicker($this);
238            }
239            setTimeout(function() {
240                $this.find( ".cell-calendar__timeline-calendar" ).trigger('click');
241            }, 100);
242        });
243    });
244
245    $( ".cell-video[ data-player ]" ).each( function(){
246        var _this = this;
247        $( _this ).on( 'click', '.cell-video__link', function( e ){
248            // console.log( _this )
249            e.preventDefault();
250            $( _this ).find( '.cell-video__player' ).show()
251                      .find( 'video' )[0].play();
252            videoPlayerSize( $( _this ) );
253        });
254    });
255
256};
257
258
259
260
261var cellCalendar = {
262    datepicker: function( cell ) {
263        var months_count = 13,
264            month_height = 192,
265            months_max = Math.ceil( moment().diff(moment( '2000-09-01' ), 'months', true) );
266            last_sel = false,
267            scroll_el = $('.date-range-scroll'),
268            calendar_selector= '.date-range-calendar';
269
270        scroll_el.theinScroll();
271
272        cellCalendar.datepickerInit( calendar_selector, [ moment().toDate(), moment().toDate() ], months_count );
273        month_height = $('.pmu-instance').height() || month_height;
274
275        $(".cell-calendar").on('click', '.cell-calendar__timeline-calendar', function(e) {
276            e.stopPropagation();
277
278            if (document.documentElement.clientWidth < 925) {
279                $('html').addClass('modal-tags');
280                ria.disablePageScroll(true);
281            } else {
282                $('.date-range').css({'top': $('.cell-calendar__timeline-calendar').offset().top + 45, 'left': $('.cell-calendar__timeline-calendar').offset().left - $('.date-range').outerWidth() + $('.cell-calendar__timeline-calendar').outerWidth() });
283            }
284            $('.date-range').addClass('active');
285
286            $(document).on('click.hidedaterange', function() {
287                $('html').removeClass('modal-tags');
288                ria.disablePageScroll(false);
289                $('.date-range').removeClass('active');
290                $(document).off('click.hidedaterange');
291            });
292        });
293
294        $( calendar_selector ).on('pickmeup-change', function (e) {
295            last_sel = $( calendar_selector )[0].__pickmeup.options.lastSel;
296
297            if (!last_sel) {
298                var current = moment( e.detail.date ),
299                    start = moment( e.detail.date[0] ),
300                    end = moment( e.detail.date[1] );
301
302                $('html').removeClass('modal-tags');
303                ria.disablePageScroll(false);
304                $('.date-range').removeClass('active');
305               /* var sort = (start.toDate() > new Date) ? 'asc': 'desc';*/
306                var sort = $(".form__btn.m-dir", cell).hasClass('m-desc') ? 'desc': 'asc';
307                var list_sid = cell.find(".cell-calendar__timeline").attr('data-current-url');
308                list_sid = list_sid.substr(list_sid.indexOf('list_sid='));
309                list_sid = list_sid.split('&')[0];
310                var url = '/services/event/?date_start=' + current.format('YYYYMMDD') + '&day_count=200&sort=' + sort + '&' + list_sid;
311
312                $(".form__btn.m-dir", cell).toggleClass( 'm-desc', sort == 'desc' );
313                cell.loadingCalendarData( url );
314            }
315        });
316
317        scroll_el.trigger('add-scrolling-trigger.the-in-scroll', [ {
318            name: 'calendar_prev',
319            position: month_height * 2,
320            sign: '<'
321        } ]);
322
323        scroll_el.on('calendar_prev.the-in-scroll', function(e, data) {
324            if (months_count <= months_max) {
325                cellCalendar.datepickerInit( calendar_selector, pickmeup( calendar_selector ).get_date(), months_count );
326
327                scroll_el.data('theinScroll').$box.css({'-webkit-overflow-scrolling': 'auto'});
328                scroll_el.data('theinScroll').$box.scrollTop( month_height * 14 );
329                scroll_el.data('theinScroll').$box.css({'-webkit-overflow-scrolling': 'touch'});
330
331                if ( months_count == months_max) {
332                    ++months_count;
333                } else {
334                    months_count = months_count + 12 < months_max ? months_count + 12 : months_max;
335                }
336            } else {
337                scroll_el.off('calendar_prev.the-in-scroll');
338            }
339        });
340
341        setTimeout(function() {
342            var h = scroll_el.find('.pmu-selected').parent().position().top;
343            scroll_el.data('theinScroll').$box.scrollTop( h );
344        }, 200);
345    },
346    datepickerInit: function(selector, dates, months_count) {
347        pickmeup( selector ).destroy();
348        pickmeup(selector, {
349            flat: true,
350            date: dates,
351           /* mode: 'range',*/  // выбор промежутка
352            calendars: months_count,
353            min: moment( '2010-09-01' ).toDate(),
354            max: moment().add(5, 'months').toDate()
355        });
356        $( calendar_selector )[0].__pickmeup.options.lastSel = last_sel;
357    }
358}
359
360
361

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.