PageSourceSearch

https://www.qooq.com/sites/all/themes/qooq/js/modal-tutorial.js?qmgln2

js qooq.com collected 2026-10-02 11:43:09 UTC 20,430 bytes, 325 lines download raw bytes

1
2(function($) {
3	Drupal.behaviors.qooq_modal_tutorial = {
4		attach: function(context, settings) {
5                var $js__modal_tutorial = $('.js__modal_tutorial').length ? $('.js__modal_tutorial') : false;
6                var $js__modal_tutorial_slide = $('.js__modal-tutorial-slide').length ? $('.js__modal-tutorial-slide') : false;
7                var $js__modal_tutorial_slide_close = $('.js__modal-tutorial-slide-close').length ? $('.js__modal-tutorial-slide-close') : false;
8                var $modalTutorialSlide = $('#modalTutorialSlide').length ? $('#modalTutorialSlide') : false;
9                var $modalTutorial = $('#modalTutorial').length ? $('#modalTutorial') : false;
10                var $modalTutorialDialog = $modalTutorialSlide ? $modalTutorialSlide.find('.modal-dialog') : false;
11                var width_modalTutorialSlide = $modalTutorialSlide ? $modalTutorialSlide.find('.modal-dialog').width() : false;
12                var $carousel_tutorial = $('#carousel-tutorial').length ? $('#carousel-tutorial') : false;
13                var $block_superfish_1 = $('#block-superfish-1').length ? $('#block-superfish-1') : false; 
14                var is_safari = $('body').hasClass('safari');
15
16                var $menu_superfish_first_item = $block_superfish_1 ? $block_superfish_1.find('.menu > .menuparent.sf-item-1') : false;
17                var margin_item_menu = 20;
18                var cookie_tutorial = $.cookie('tutorial');
19
20                function _init_first_position_modal($modalTutorialDialog, width_modalTutorialSlide, margin_item_menu) {
21                    $menu_superfish_first_item.find('> ul').removeClass('sf-hidden');
22                    // $menu_superfish_first_item.find('> a').addClass('active');
23                    var pos_first_item = $menu_superfish_first_item.offset().left;
24                    var pos_left = parseInt(pos_first_item - width_modalTutorialSlide - margin_item_menu, 10);
25
26                    $menu_superfish_first_item.find('> ul').addClass('sf-hidden');
27                    if (pos_left<0) {
28                        $modalTutorialDialog.css('width', parseInt(width_modalTutorialSlide + pos_left - 10, 10));
29                        pos_left = 10;
30                    } 
31                    $modalTutorialDialog.css('left', pos_left);
32                    
33                    // $menu_superfish_first_item.trigger('mouseover');
34                }
35                if ($menu_superfish_first_item) {
36                    _init_first_position_modal($modalTutorialDialog, width_modalTutorialSlide, margin_item_menu);
37                    // var pos_first_item = $menu_superfish_first_item.offset().left;
38                    // $modalTutorialDialog.css('left', parseInt(pos_first_item - width_modalTutorialSlide - margin_item_menu, 10));
39                }
40                if ($js__modal_tutorial) {
41                    if ($('body').hasClass('desktop') && $('body').hasClass('page-home-connect') && cookie_tutorial!=1) {
42                        setTimeout(function(){ $js__modal_tutorial.trigger('click')}, 100);
43                        $.cookie('tutorial', 1, {
44                            expires : 3650, // Expires in 10 years
45                            path    : '/', 
46                         });
47                    }
48                    $js__modal_tutorial.on('click', function(e) {
49                        $(this).addClass('active');
50                    });
51                }
52                if ($js__modal_tutorial_slide_close) {
53                    $js__modal_tutorial_slide_close.on('click', function(e) {
54                        $js__modal_tutorial.removeClass('active');
55                    });
56                }
57                if ($js__modal_tutorial_slide) {
58                    $js__modal_tutorial_slide.on('click', function(e) {
59                        _init_first_position_modal($modalTutorialDialog, width_modalTutorialSlide, margin_item_menu);
60                        $js__modal_tutorial.removeClass('active');
61                        $('#header').addClass('backdrop');
62                        $modalTutorialSlide.find('.pagination-carousel >
62 span').text('1');
63                        $modalTutorialDialog.find('.modal-footer .c-btn-prev').addClass('hidden');
64                        if ($carousel_tutorial) {
65                            $carousel_tutorial.carousel(0);
66                            $modalTutorialDialog.find('.modal-footer').find('.c-btn-next').removeClass('hidden');
67                            $modalTutorialDialog.find('.modal-footer').find('.c-btn-profil').addClass('hidden');
68
69                            // console.log($block_superfish_1.find('.menu > .menuparent.sf-item-1').attr('id'));
70                            
71                            // var el = $block_superfish_1.find('.menu > .menuparent.sf-item-1').get(0);                            
72                            // triggerEvent(el, 'mouseover');
73                            // $block_superfish_1.find('.menu > .menuparent.sf-item-1 > a').addClass('active');
74                            // $block_superfish_1.find('.menu > .menuparent.sf-item-1').trigger('mouseover');
75                            setTimeout(function(){
76                                $block_superfish_1.find('.menu > .menuparent.sf-item-1').addClass('sfHover').find('> ul').removeClass('sf-hidden').fadeIn();
77                            }, 500); 
78                        }
79                    });
80                    $carousel_tutorial.bind('slid.bs.carousel', function (e) {
81                        var currentItem = $(e.target).find('.carousel-inner > .item.active');
82                        var currentIndex = $(e.target).find('.carousel-inner .item').index(currentItem);
83                        currentIndex = parseInt(currentIndex, 10) + 1;
84                        var $current_block_superfish = $block_superfish_1.find('.menu > li.menuparent.sf-item-'+currentIndex);   
85                        // $current_block_superfish.find('> ul').addClass('sf-hidden');              
86                        var pos_left_current_block = $current_block_superfish.length ? $current_block_superfish.offset().left : 0;
87                        var pos_left = parseInt(pos_left_current_block - width_modalTutorialSlide - margin_item_menu, 10);
88
89                        // 
90                        if (currentIndex>1) {
91                            $modalTutorialDialog.removeAttr('style');
92                        }
93
94                        if (pos_left<0) {
95                            $modalTutorialDialog.css('width', parseInt(width_modalTutorialSlide + pos_left - 10, 10));
96                            pos_left = 10;
97                        } else {
98                            $modalTutorialDialog.removeAttr('style');
99                        }
100                        $modalTutorialDialog.attr('data-slide', currentIndex).css('left', pos_left);
101                        // console.log('currentIndex='+currentIndex);
102                        // console.log('pos_left='+pos_left);
103                        // $current_block_superfish.trigger('mouseover');
104                        
105                    });
106                    $modalTutorialDialog.find('.modal-footer > .c-btn').on('click', function(evt) {
107                        var $modal_dialog = $(this).closest('.modal-dialog');
108                        var currentIndex = $modal_dialog.attr('data-slide');
109                        var $parent_modal_footer = $(this).closest('.modal-footer');
110                        
111                        if ($(this).hasClass('c-btn-prev')) {
112                            currentIndex = parseInt(currentIndex, 10) - 1;
113                        }
114                        if ($(this).hasClass('c-btn-next')) {
115                            currentIndex = parseInt(currentIndex, 10) + 1;
116                        }
117                        if (currentIndex>1) {
118                            $modalTutorialDialog.find('.modal-footer .c-btn-prev').removeClass('hidden');
119                        } else {
120                            $modalTutorialDialog.find('.modal-footer .c-btn-prev').addClass('hidden');
121                        }
122                        if (currentIndex<1) {
123                            currentIndex = 1;
124                        }
125                        if (currentIndex>4) {
126                            currentIndex = 1;
127                        }
128
129                        if (currentIndex==4) {
130                            // $parent_modal_footer.find('.c-btn-prev').addClass('hidden');
131                            $parent_modal_footer.find('.c-btn-next').addClass('hidden');
132                            $parent_modal_footer.find('.c-btn-profil').removeClass('hidden');
133                            $parent_modal_footer.addClass('last');
134
135                        } else {
136                            // $parent_modal_footer.find('.c-btn-prev').removeClass('hidden');
137                            $parent_modal_footer.find('.c-btn-next').removeClass('hidden');
138                            $parent_modal_footer.find('.c-btn-profil').addClass('hidden');
139                            $parent_modal_footer.removeClass('last');
140                        }
141                        var $current_block_superfish = $block_superfish_1.find('.menu > li.menuparent.sf-item-'+currentIndex);
142                        $modalTutorialSlide.find('.pagination-carousel >
142 span').text(currentIndex);
143                        // console.log($(this).attr('class'));
144                        if (!$(this).hasClass('c-btn-profil')) {                       
145                            setTimeout(function(){
146                                $block_superfish_1.find('.menu > .menuparent').removeClass('sfHover').find('> ul').addClass('sf-hidden');
147                                $current_block_superfish.addClass('sfHover').find('> ul').removeClass('sf-hidden').fadeIn();
148                                // $current_block_superfish.trigger('mouseover');
149                            }, 750);
150                        } else {
151                            // $parent_modal_footer.find('.c-btn-prev').removeClass('hidden');
152                            $parent_modal_footer.find('.c-btn-next').removeClass('hidden');
153                            $(this).addClass('hidden');
154                            $parent_modal_footer.removeClass('last');
155                            Drupal.behaviors.qooq_culinary_profile.OpenCulinaryProfile();
156                            $block_superfish_1.find('.menu > .menuparent').removeClass('sfHover').find('> ul').addClass('sf-hidden');
157                            // $block_superfish_1.find('.menu > .menuparent').trigger('mouseout');
158                        }
159                    });
160                }
161
162                if ($modalTutorial) {
163                    $modalTutorial.on('hidden.bs.modal', function (e) {
164                        $js__modal_tutorial.removeClass('active').off();
165                    });
166                }
167                if ($modalTutorialSlide) {
168                    $modalTutorialSlide.on('hidden.bs.modal', function (e) {
169                        $js__modal_tutorial.removeClass('active');
170                        $('#header').removeClass('backdrop');
171                        $block_superfish_1.find('.menu > .menuparent').removeClass('sfHover').find('> ul').addClass('sf-hidden');
172                        // $block_superfish_1.find('.menu > .menuparent').trigger('mouseout');
173                    });
174                }
175
176                // Mobile
177                var $block_button_mobile = $('#block-block-2').length ? $('#block-block-2') : false;
178                var $carousel_tutorial_mobile = $('#carousel-tutorial-mobile').length ? $('#carousel-tutorial-mobile') : false;
179                var $js__modal_tutorial_mobile_slide = $('.js__modal-tutorial-mobile-slide').length ? $('.js__modal-tutorial-mobile-slide') : false;
180                var $js__modal_tutorial_mobile = ($block_button_mobile && $block_button_mobile.find('.js__modal_tutorial_mobile').length) ? $block_button_mobile.find('.js__modal_tutorial_mobile') : false;
181                var $block_superfish_2 = $('#block-superfish-2').length ? $('#block-superfish-2') : false;
182                
183                var $modalTutorialMobileSlide = $('#modalTutorialMobileSlide').length ? $('#modalTutorialMobileSlide') : false;
184                var $modalTutorialMobileDialog = $modalTutorialMobileSlide ? $modalTutorialMobileSlide.find('.modal-dialog') : false;
185
186                if ($block_button_mobile) {
187                    $block_button_mobile.appendTo($block_superfish_2.find('ul#superfish-2-accordion')).wrap('<li class="block-tutorial"></li>');
188                }
189                if ($js__modal_tutorial_mobile) {
190                    $js__modal_tutorial_mobile.on('click', function(e) {
191                        $block_superfish_2.find('#superfish-2-toggle').trigger('click');
192                    });
193                }
194
195                if ($js__modal_tutorial_mobile_slide) {
196                    $js__modal_tutorial_mobile_slide.on('click', function(e) {
197                        $js__modal_tutorial_mobile_slide.removeClass('active');
198                        $modalTutorialMobileSlide.find('.pagination-carousel > span').text('1');
199                        $modalTutorialMobileDialog.find('.modal-footer .c-btn-prev').addClass('hidden');                        
200                        $modalTutorialMobileDialog.find('.modal-footer .c-btn-next').removeClass('hidden');
201                        $modalTutorialMobileDialog.find('.modal-footer .c-btn-profil').addClass('hidden');
202                        if ($carousel_tutorial_mobile) {
203                            $carousel_tutorial_mobile.carousel(0);
204                        }
205                    });
206                }
207                if ($carousel_tutorial_mobile) {
208                    $carousel_tutorial_mobile.bind('slid.bs.carousel', function (e) {
209                        var currentItem = $(e.target).find('.carousel-inner > .item.active');
210                        var currentIndex = $(e.target).find('.carousel-inner .item').index(currentItem);
211                        currentIndex = parseInt(currentIndex, 10) + 1;
212                        $modalTutorialMobileDialog.attr('data-slide', currentIndex);
213                    });
214                }
215                if ($modalTutorialMobileDialog) {
216                    $modalTutorialMobileDialog.find('.modal-footer > .c-btn').on('click', function(evt) {
217                        var $parent_modal_footer = $(this).closest('.modal-footer');
218                        var $modal_dialog = $(this).closest('.modal-dialog');
219                        var currentIndex = $modal_dialog.attr('data-slide');
220                        if ($(this).hasClass('c-btn-prev')) {
221                            currentIndex = parseInt(currentIndex, 10) - 1;
222                        }
223                        if ($(this).hasClass('c-btn-next')) {
224                            currentIndex = parseInt(currentIndex, 10) + 1;
225                        }
226                        
227                        if (currentIndex<1) {
228                            currentIndex = 1;
229                        }
230                        if (currentIndex>4) {
231                            currentIndex = 1;
232                        }
233                        if (currentIndex==4) {
234                            $parent_modal_footer.find('.c-btn-prev').addClass('hidden');
235                            $parent_modal_footer.find('.c-btn-next').addClass('hidden');
236                            $parent_modal_footer.find('.c-btn-profil').removeClass('hidden');
237                            $parent_modal_footer.addClass('last');
238                        } else if (currentIndex>1 && currentIndex<4) {
239                            $parent_modal_footer.find('.c-btn-prev').removeClass('hidden');
240                            $parent_modal_footer.find('.c-btn-next').removeClass('hidden');
241                            $parent_modal_footer.find('.c-btn-profil').addClass('hidden');
242                            $parent_modal_footer.removeClass('last');
243                        } else {
244                            $parent_modal_footer.find('.c-btn-prev').addClass('hidden');
245                            $parent_modal_footer.find('.c-btn-next').removeClass('hidden');
246                            $parent_modal_footer.find('.c-btn-profil').addClass('hidden');
247                            $parent_modal_footer.removeClass('last');
248                        }
249                        $modalTutorialMobileSlide.find('.pagination-carousel > span').text(currentIndex);
250                        if ($(this).hasClass('c-btn-profil')) {
251                            $parent_modal_footer.find('.c-btn-prev').removeClass('hidden');
252                            $parent_modal_footer.find('.c-btn-next').removeClass('hidden');
253                            $(this).addClass('hidden');
254                            $parent_modal_footer.removeClass('last');
255                            Drupal.behaviors.qooq_culinary_profile.OpenCulinaryProfile();
256                        }
257                    });
258                }
259                if ($carousel_tutorial_mobile) {
260                    $carousel_tutorial_mobile.on("touchstart", function(event){
261                        var xClick = event.originalEvent.touches[0].pageX;
262                        
263                        var $parent_modal_dialog = $(this).closest('.modal-dialog');
264                        
265                        $(this).one("touchmove", function(event){
266                            var currentIndex = $parent_modal_dialog.attr('data-sli
266de');
267                            var xMove = event.originalEvent.touches[0].pageX;
268                            if( Math.floor(xClick - xMove) > 5 ){
269                                // $(this).carousel('next');
270                                if (is_safari) {
271                                    var el = $modalTutorialMobileDialog.find('.modal-footer .c-btn-next').get(0);
272                                    triggerEvent(el, 'click');
273                                } else {
274                                    $modalTutorialMobileDialog.find('.modal-footer .c-btn-next').trigger('click');
275                                }
276                            }
277                            else if( Math.floor(xClick - xMove) < -5 ){
278                                // $(this).carousel('prev');
279                                if (is_safari) {
280                                    var el = $modalTutorialMobileDialog.find('.modal-footer .c-btn-prev').get(0);
281                                    triggerEvent(el, 'click');
282                                } else {
283                                    $modalTutorialMobileDialog.find('.modal-footer .c-btn-prev').trigger('click');
284                                }
285                            }
286                            if (currentIndex<2) {
287
288                            }
289                        });
290                        $carousel_tutorial_mobile.on("touchend", function(){
291                                $(this).off("touchmove");
292                        });
293                    });
294                }
295
296                function triggerEvent(element, event) {
297                    if(document.createEvent) {
298                        var evt = document.createEvent("MouseEvents");
299                        evt.initMouseEvent(event, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
300                        element.dispatchEvent(evt);
301                    }
302                    else {
303                        switch (event) {
304                          case 'mousedown':
305                            element.mousedown();
306                            break;
307                          case 'click':
308                            element.click();
309                            break;
310                          default:
311                            element.click();
312                        }
313                    }
314                }
315                $(document).ready(function(){
316                    if ($('#superfish-2-accordion').length) {
317                        $('#superfish-2-accordion').removeClass('hidden');
318                    }
319                    if ($block_button_mobile.length) {
320                        $block_button_mobile.find('.js__modal_tutorial_mobile').removeClass('hidden');
321                    }
322                });
323		} //attach
324	}; // behaviors
325}(jQuery));

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.