PageSourceSearch

https://www.domainedecice.com/wp-content/themes/diadao-theme/assets/js/diadao-theme.js?v=1791277093

js domainedecice.com collected 2026-10-06 08:58:51 UTC 8,006 bytes, 215 lines download raw bytes

1(function( $ ) {
2    'use strict';
3
4    var m_debug = true;
5
6    /************************************************************************************/
7    /* DOM elements
8    /************************************************************************************/
9
10    var m_body = $(document).find( 'body' );
11    var m_bookingPanel = m_body.find( '#diadao-snippet-booking' );
12
13    var m_menuBgContainer = null;
14    var m_menuBgDefault = null;
15    var m_menuBookingButton = null;
16
17    /************************************************************************************/
18    /* Start
19    /************************************************************************************/
20
21    $(initialize);
22
23    /************************************************************************************/
24    /* Functions
25    /************************************************************************************/
26
27    function initialize()
28    {
29        if( m_debug ) console.log( "*theme* init start" );
30
31        if( m_bookingPanel.length > 0 )
32        {
33            init_booking_panel();
34        }
35
36        m_menuBgContainer = $(document).find( 'body.device-desktop header#diadao-header #diadao-mainmenu .bg-menu-dynamic' );
37        if( m_menuBgContainer.length > 0 )
38        {
39            init_menu_bg();
40        }
41
42        init_dates_fields();
43
44        /*
45        if( !m_body.hasClass( 'is-administrator' ) )
46        {
47            if( $(document).find( 'a#diadao-booking-open' ).length > 0 )
48            {
49                m_menuBookingButton = $(document).find( 'a#diadao-booking-open' );
50
51                m_menuBookingButton.removeAttr( 'data-action' );
52                m_menuBookingButton.removeAttr( 'data-snippet' );
53                m_menuBookingButton.removeAttr( 'data-id' );
54                m_menuBookingButton.attr( 'href', 'https://be.synxis.com/?chain=5460&currency=EUR&hotel=55567&level=hotel&locale=fr-FR' );
55                m_menuBookingButton.attr( 'target', '_blank' );
56            }
57        }
58        */
59        
60    }
61
62    function init_menu_bg()
63    {
64        if( m_menuBgContainer.length > 0 )
65        {
66            if( m_debug ) console.log( "*theme* init bg menu dynamic" );
67
68            m_menuBgDefault = null;
69            if( m_menuBgContainer.find( '.active' ).length > 0 )
70            {
71                m_menuBgDefault = m_menuBgContainer.find( '.active' );
72            }
73            else if( m_menuBgContainer.find( '.slug-default' ).length > 0 )
74            {
75                m_menuBgDefault = m_menuBgContainer.find( '.slug-default' );
76            }
77
78            if( m_menuBgDefault.length > 0 )
79            {
80                m_menuBgDefault.addClass( 'active' );
81
82                $(document).on( 'mouseover', 'body.device-desktop header#diadao-header #diadao-mainmenu .container-menu-1 ul#header-menu li', function() {
83                    if( 
84                        $(this).data('id') !== undefined 
85                        && $(this).data('slug') !== undefined 
86                    )
87                    {
88                        var t_itemId = $(this).data('id');
89                        var t_itemSlug = $(this).data('slug');
90
91                        var t_menuBgHover = m_menuBgContainer.find('.menu-item-' + t_itemId);
92                        if( t_menuBgHover.length == 0 )
93                        {
94                            t_menuBgHover = m_menuBgContainer.find('.slug-' + t_itemSlug);
95                            if( t_menuBgHover.length == 0 )
96                            {
97                                t_menuBgHover = m_menuBgDefault;
98                            }
99                        }
100
101                        if( !t_menuBgHover.hasClass( 'active' ) )
102                        {
103                            m_menuBgContainer.find( '.active').removeClass( 'active' );
104                            t_menuBgHover.addClass( 'active' );
105                        }
106                    }
107                } );
108            }
109        }
110    }
111
112    function init_booking_panel()
113    {
114        var t_panel = m_bookingPanel.find( '.diadao-booking-tabs .diadao-booking-tab.active' );
115        var t_container = m_bookingPanel.find( '.diadao-snippet-panel' );
116
117        if( t_panel.length > 0 && t_container.length > 0 && t_panel.data('bookingpanel') !== undefined )
118        {
119            var t_tab = t_panel.data('bookingpanel');
120            t_container.attr('data-bookingpanel', t_tab);
121        }
122    }
123
124    function init_dates_fields()
125    {
126        $(document).find( '.gfield_date_day input[type="number"]' ).each( function() {
127            $(this).attr( 'maxlength', 2 ).addClass( 'diadao-number-maxlength-check' );
128        } );
129        $(document).find( '.gfield_date_month input[type="number"]' ).each( function() {
130            $(this).attr( 'maxlength', 2 ).addClass( 'diadao-number-maxlength-check' );
131        } );
132        $(document).find( '.gfield_date_year input[type="number"]' ).each( function() {
133            $(this).attr( 'maxlength', 4 ).addClass( 'diadao-number-maxlength-check' );
134        } );
135
136        $(document).on( 'keyup', 'input.diadao-number-maxlength-check', function(e) {
137            if( $(this).attr( 'maxlength' ) !== undefined )
138            {
139                if( $(this).hasClass( 'has-max-length' ) )
140                {
141                    if( e.keyCode != 8 && e.keyCode != 46 )
142                    {
143                        e.preventDefault();
144                    }
145                }
146                
147                var t_maxLength = parseInt( $(this).attr( 'maxlength' ) );
148                var t_currentLength = t_maxLength - $(this).val().length;
149
150                if( m_debug ) console.log( "-> diadao number max len : ", e.keyCode, $(this).val(), t_maxLength, t_
150currentLength );
151
152                if( t_currentLength == 0 )
153                {
154                    $(this).addClass( 'has-max-length' );
155                }
156                else
157                {
158                    $(this).removeClass( 'has-max-length' );
159                }
160            }
161        } );
162
163        $(document).on( 'keydown', 'input.diadao-number-maxlength-check', function(e) {
164            if( m_debug ) console.log( e.keyCode, $(this).hasClass( 'has-max-length' ) );
165            if( $(this).hasClass( 'has-max-length' ) )
166            {
167                if( e.keyCode != 8 && e.keyCode != 46 )
168                {
169                    e.preventDefault();
170                }
171            }
172        } );
173    }
174
175    $(document).on('click', '#gform_submit_button_1', function(e){
176        $(this).addClass('is-submitting');
177    });
178
179    $(document).on( 'click', '#diadao-snippet-booking ul.ul-booking-menu li a.has-tab', function( e ) {
180        e.preventDefault();
181
182        if( !$(this).parent().hasClass( 'active' ) )
183        {
184            var t_button = $(this).parent();
185            var t_tab = $(this).parent().data( 'bookingpanel' );
186
187            if( 
188                t_tab !== undefined 
189                && t_tab !== null 
190            )
191            {
192                var t_panel = m_bookingPanel.find( '.diadao-booking-tabs .diadao-booking-tab[data-bookingpanel="' + t_tab + '"]' );
193                var t_image = m_bookingPanel.find( '.diadao-booking-panel-bg[data-bookingpanel="' + t_tab + '"]' );
194                var t_container = m_bookingPanel.find( '.diadao-snippet-panel' );
195
196                if( t_panel.length > 0 )
197                {
198                    t_container.attr('data-bookingpanel', t_tab);
199
200                    if( t_image.length > 0 )
201                    {
202                        t_image.parent().find( '.active').removeClass( 'active' );
203                        t_image.addClass( 'active' );
204                    }
205
206                    t_button.parent().find( 'li.active' ).removeClass( 'active' );
207                    t_button.addClass( 'active' );
208                    t_panel.parent().find( '.diadao-booking-tab.active' ).removeClass( 'active' );
209                    t_panel.addClass( 'active' );
210                }
211            }
212        }
213    } );
214
215})( 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.