PageSourceSearch

https://www.ses.org.hk/wp-content/themes/hello-elementor-child/assets/js/main.js?ver=3.1

js ses.org.hk collected 2026-09-24 20:27:08 UTC 19,917 bytes, 486 lines download raw bytes

1;
2(function($) {
3
4    $(document).ready(function() {
5	
6            if ($('.ses-hide').length) {
7
8                $('.ses-hide').each(function() {
9                    id = $(this).attr('aria-labelledby');
10                    $('#' + id).hide();
11                })
12            }
13//         $('#knowledgeHub').after('<a href="https://ses.websitedevsystem.com/knowledge-hub/" class="custom-element">Knowledge Hub</a>');
14
15        $(window).on('load', function() {
16			
17			$('.e-n-tabs-heading').css('opacity', 1);
18
19            // Back to top Button
20            $(window).scroll(function() {
21                if ($(this).scrollTop() > 300) {
22                    $('#ses-back-to-top').addClass('active');
23                } else {
24                    $('#ses-back-to-top').removeClass('active');
25                }
26            });
27
28            $('#ses-back-to-top').click(function() {
29                $('html, body').animate({ scrollTop: 0 }, 360);
30                return false;
31            });
32
33            // Popup Main Menu
34            jQuery(document).on('elementor/popup/show', (event, id, instance) => {
35                if (id === 194) {
36                    var href = $('.custom-element').attr('href');
37                    var window_href = window.location.href;
38                    if (window_href == href) {
39                        $('.custom-element').addClass('active');
40                    } else {
41                        $('.custom-element').removeClass('active');
42                    }
43                    var selector = $('.dropdown-subyear li.elementor-icon-list-item');
44                    var url = window.location.href;
45                    $(selector).each(function() {
46                        if ($(this).find('a').attr('href') === url) {
47                            $(selector).removeClass('active');
48                            $(this).removeClass('active').addClass('active');
49                        }
50                    });
51                }
52            });
53
54            // Custom Mega Menu
55            var selector = $('.dropdown-subyear li.elementor-icon-list-item');
56            var url = window.location.href;
57            $(selector).each(function() {
58                if ($(this).find('a').attr('href') === url) {
59                    $(selector).removeClass('active');
60                    $(this).removeClass('active').addClass('active');
61                }
62            });
63
64            // Accordion Knowledge Hub
65            const accordionItemHeaders = document.querySelectorAll(".accordion-header");
66            accordionItemHeaders.forEach(accordionItemHeader => {
67                accordionItemHeader.addEventListener("click", event => {
68                    event.preventDefault();
69                    accordionItemHeader.classList.toggle("active");
70                    const accordionItemBody = accordionItemHeader.nextElementSibling;
71                    if (accordionItemHeader.classList.contains("active")) {
72                        accordionItemBody.style.maxHeight = accordionItemBody.scrollHeight + "px";
73                    } else {
74                        accordionItemBody.style.maxHeight = 0;
75                    }
76                });
77            });
78
79            // Knowledge Hub Filter
80            $('#knowledge-hub-filter').submit(function(e) {
81                e.preventDefault();
82
83                var articleArr = [];
84                var strategicArr = [];
85                var tagArr = [];
86                var kh_wrapper = $('.knowledge-hub-lists');
87
88                $("#article-types input[type=checkbox]:checked").each(function() {
89                    articleArr.push($(this).val());
90                });
91
92                $("#strategic-focuses input[type=checkbox]:checked").each(function() {
93                    strategicArr.push($(this).val());
94                });
95
96                $("#knowledge-tag input[type=checkbox]:checked").each(function() {
97                    tagArr.push($(this).val());
98                });
99
100                if (articleArr.length == 0 && strategicArr.length == 0 && tagArr.length == 0) {
101                    articleArr = '';
102                    strategicArr = '';
103                    tagArr = '';
104                }
105                console.log(articleArr);
106                console.log(strategicArr);
107                console.log(tagArr);
108
109                $.ajax({
110                    url: ajaxurl,
111                    type: "post",
112                    data: {
113                        action: "load_knowledge_hub",
114                        articleValue: articleArr,
115                        strategicValue: strategicArr,
116                        tagValue: tagArr,
117                    },
118                    success: function(response) {
119                        kh_wrapper.html(response);
120                    },
121                    complete: function(jqXHR, textStatus, errorThrown) {},
122                });
123            })
124
125            // Partners Filter
126            $('#partner-filter').submit(function(e) {
127                e.preventDefault();
128
129                var yearArr = [];
130                var pe_wrapper = $('.partner-lists .elementor-loop-container');
131                $("#partner-events input[type=checkbox]:checked").each(function() {
132                    yearArr.push($(this).val());
133                });
134
135                if (yearArr.length == 0) {
136                    yearArr = '';
137                }
138
139                $.ajax({
140                    url: ajaxurl,
141                    type: "post",
142                    data: {
143                        action: "load_partner_event",
144                        yearValue: yearArr,
145                    },
146                    success: function(response) {
147                        if (response) {
148                            pe_wrapper.html(response);
149                        }
150                    },
151                    complete: function(jqXHR, textStatus, errorThrown) {},
152                });
153            })
154
155            $("#media-events input[type=checkbox]").on('change', function() {
156                $('#media-filter').submit();
157            });
158
159            // Partners Filter
160            $('#media-filter').submit(function(e) {
161                e.preventDefault();
162
163                var yearArr = [];
164                var md_wrapper = $('.media-lists .elementor-loop-container');
165                $("#media-events input[type=checkbox]:checked").each(function() {
166                    yearArr.push($(this).val());
167                });
168
169                if (yearArr.length == 0) {
170                    yearArr = '';
171                }
172
173                $.ajax({
174                    url: ajaxurl,
175                    type: "post",
176                    data: {
177                        action: "load_media_resources",
178                        yearValue: yearArr,
179                    },
180                    success: function(response) {
181                        md_wrapper.html(response);
182                    },
183                    complete: function(jqXHR, textStatus, errorThrown) {},
184                });
185            })
186
187            // Back to prev page
188            $("#back-button").click(function(e) {
189                e.preventDefault();
190				if  (document.referrer){
191					window.history.back();
192				} else {
193					window.location.href = "https://www.ses.org.hk/";
194				}
195                
196            });
197
198            // Agenda tab
199            agenda_elem = $('#agenda_hash');
200
201            $('#tabs-nav li').click(function(e) {
202                e.preventDefault();
203                $(this).siblings().removeClass('active');
204                $(this).addClass('active');
205
206
207                $('.tab-content').removeClass('active');
208                var activeTab = $(this).find('a').attr('href');
209
210                window.location.hash = activeTab;
211
212                $('.wpml-ls-item a').each(function() {
213                    href = $(this).attr('href');
214                    var url_ob = new URL(href);
215
216                    url_ob.hash = activeTab;
217
218                    this.href = url_ob;
219                })
220
221                elem = $(this).closest('.session-container').find(activeTab + '_hash');
222                elem.addClass('active');
223
224                elem.find('.tab-term-style').eq(0).trigger('click');
225
226                scrollTop = agenda_elem.offset().top + agenda_elem.outerHeight() - 10 - $('#main-header').outerHeight();
227
228                jQuery('html, body').animate({ scrollTop: scrollTop });
229                return false;
230            });
231
232            var selector_tab = $('#tabs-nav li');
233            var window_hash = window.location.hash;
234            $(selector_tab).each(function() {
235                if (window_hash === $(this).find('a').attr('href')) {
236                    $(this).trigger('click');
237
238
239                    if (history.state && history.state.track) {
240                        console.log('isset');
241                        track_active =  history.state.track;
242                        console.log('track_active', track_active);
243                        console.log('elem', $(window_hash+'_hash').find('.tab-term-style[data-track="'+track_active+'"]'));
244                        setTimeout(function(){
245                            $(window_hash+'_hash').find('.tab-term-style[data-track="'+track_active+'"]').trigger('click');
246                        }, 500);
247                    }
248                }
249            })
250
251            // Track sort Tab
252            $('#tabs-term li').click(function(e) {
253                e.preventDefault();
254                $(this).siblings().removeClass('active');
255                $(this).addClass('active');
256
257                track = $(this).data('track');
258
259                if (track) {
260                    // Now push something on the stack
261                    history.pushState({ track: track }, "pushState Track filter");
262                }
263
264                // Now state has a value.
265
266                sess_wr = $(this).closest('.tab-list').find('.tab-lists-accordion');
267
268
269                if (track == "all") {
270                    sess_wr.find('> div').removeClass('hide');
271                } else {
272                    sess_wr.find('> div').addClass('hide');
273                    sess_wr.find('> div.track-' + track).removeClass('hide');
274                }
275
276                return false;
277            });
278
279            // Session Accordion
280            if (window.innerWidth >= 768) {
281                $('.acc__panel').addClass('active');
282                $('.acc__title').addClass('active');
283            }
284
285            $('.button-accordion').click(function(e) {
286                var dropDown = $(this).closest('.acc__card').find('.acc__panel');
287                var dropDownTitle = $(this).closest('.acc__card').find('.acc__title');
288                dropDown.toggleClass('active');
289                dropDownTitle.toggleClass('active');
290
291                if ($(this).hasClass('active')) {
292                    $(this).removeClass('active');
293                } else {
294                    $(this).closest('.acc').find('.acc__title.active').removeClass('active');
295                    $(this).addClass('active');
296                }
297            });
298
299            $('.button-control-expand').click(function(e) {
300                e.preventDefault();
301                $(this).addClass('active');
302                $('.button-control-collapse').removeClass('active');
303                $('.acc__panel').addClass('active');
304                $('.acc__title').addClass('active');
305            })
306
307            $('.button-control-collapse').click(function(e) {
308                e.preventDefault();
309                $(this).addClass('active');
310                $('.button-control-expand').removeClass('active');
311                $('.acc__panel').removeClass('active');
312                $('.acc__title').removeClass('active');
313            })
314
315            // Custom Style Add to Calendar Button
316            var hosts = document.querySelectorAll('.add-to-calendar');
317
318            hosts.forEach(host => {
319                var style = document.createElement('style');
320                style.innerHTML = '.atcb-saved .atcb-checkmark{ top: 0 !important; right: 5px !important} .atcb-list-wrapper.atcb-dropdown { top: 39px !important;} .atcb-list.atcb-generated-button:not(.atcb-modal) .atcb-list-item:first-child{ margin-top: 0; padding-top: 5px !important; } .atcb-list-item:hover{ background-color: var(--clr-purple-blue) !important; color: white !important;} .atcb-list-item{ background-color: white !important; padding: 5px 20px !important; white-space:nowrap !important;} .atcb-list-wrapper.atcb-dropdown {--list-shadow: 2px 2px 6px 0 rgba(0,0,0,0.15)} .atcb-list-wrapper{padding: 0 15px !important;}#atcb-reference {display: none !important;} #atcb-bgoverlay { background-color: transparent; backdrop-filter: unset;} .atcb-button { background-color: white; border: 1px solid #222; border-radius: 50px; font-size: 14px; font-weight: 400; color: #222; margin: 0; padding: 7px 30px; box-shadow: none; border-radius: 50px;} .atcb-button.atcb-active { background-color: var(--clr-purple-blue) !important; color: white !important; border-color:var(--clr-purple-blue) !important; } @media screen and (max-width: 768px){.atcb-list-item{padding: 5px 10px !important; white-space:nowrap !important; font-size: 12px !important;}}'
321                host.shadowRoot.appendChild(style);
322            })
323
324            // Track popup
325            $('.button-style').click(function(e) {
326                e.preventDefault();
327                var text = $(this).closest('.session-meta').find('.term-content').clone();
328                jQuery(document).on('elementor/popup/show', () => {
329                    $('.track-popup').html(text);
330                });
331            })
332
333            // Anchor link
334            var headerCta = $('#agenda-list a');
335            if (window.innerWidth <= 768) {
336                var headerCta = $('#agenda-list-mobile a');
337            }
338
339            $(headerCta).click(function() {
340                var attrItem = jQuery(this).attr('href');
341                var hash = attrItem.substring(attrItem.indexOf('#'));
342                var menuHeight = jQuery(".main-header").outerHeight();
343                jQuery([document.documentElement, document.body]).animate({
344                    scrollTop: jQuery(hash + '_hash').offset().top - menuHeight
345                }, 500);
346                $(hash + '_hash').trigger('click');
347            })
348
349            $('.button-registration a').click(function() {
350                var attrItem = jQuery(this).attr('href');
351                var hash = attrItem.substring(attrItem.indexOf('#'));
352                var menuHeight = jQuery(".main-header").outerHeight();
353                jQuery([document.documentElement, document.body]).animate({
354                    scrollTop: jQuery(hash + '_hash').offset().top - menuHeight
355                }, 500);
356                $(hash + '_hash').trigger('click');
357            })
358
359            if (window.location.hash) {
360                var menuHeight = jQuery(".main-header").outerHeight();
361                if ((window.location.hash + '_hash').length) {
362                    jQuery('html, body').animate({
363                        scrollTop: jQuery(window.location.hash + '_hash').offset().top - menuHeight - 100
364                    }, 500);
365                }
366            }
367
368            if (ses_curr_tab) {
369                $('#' + ses_curr_tab + '_hash').trigger('click');
370            }
371
372
373            // Click tab push hash to url
374            $('.ses-page-tab .e-n-tab-title').click(function(e) {
375                var id = $(this).attr('id');
376                var hash = id.split('_')[0];
377                url = permalink + hash;
378                history.pushState("", "", url);
379                
380                $('.wpml-ls-item a').each(function() {
381                    curr_url = this.href;
382                    curr_url = curr_url.substring(0, curr_url.lastIndexOf('/'));
383                    this.href = curr_url + "/" + hash;
384
385                })
386
387                // window.location.hash = '#' + hash;
388                e.preventDefault();
389            })
390
391            var swiperTarget = $('.sponsors-slider .e-n-carousel');
392            if (swiperTarget.length) {
393                play_btn = $('.play-pause.play');
394                pause_btn = $('.play-pause.pause');
395                play_btn.hide();
396                var swiperInstance = swiperTarget.data('swiper');
397                pause_btn.click(function() {
398                    $(this).hide();
399                    play_btn.show();
400                    swiperInstance.autoplay.stop();
401                })
402
403                play_btn.click(function() {
404                    $(this).hide();
405                    pause_btn.show();
406                    swiperInstance.autoplay.start();
407                })
408
409            }
410
411            // Tabs Scroll button
412            var selectorElementTerm = $('#tabs-term');
413
414            if (selectorElementTerm.length) {
415
416                // if (selectorElementTerm) {
417                //     var elementWidth = selectorElementTerm.innerWidth();
418                //     var elementScrollWidth = selectorElementTerm[0].scrollWidth;
419                //     if (elementScrollWidth > elementWidth) {
420                //         $('.button-scroll-next').addClass('show');
421                //     }
422                // }
423
424                var lastScrollLeft = 0;
425                var btnScrollRight = $('.button-scroll-next');
426                var btnScrollLeft = $('.button-scroll-prev');
427
428                selectorElementTerm.scroll(function() {
429                    var elementScrollLeft = $(this).scrollLeft();
430                    var maxScrollLeft = this.scrollWidth - this.clientWidth;;
431
432                    if (elementScrollLeft  >= maxScrollLeft) {
433                        btnScrollRight.removeClass('show');
434                    } else {
435                        btnScrollRight.addClass('show');
436                    }
437
438                    if (elementScrollLeft > 0) {
439                        btnScrollLeft.addClass('show');
440                    } else {
441                        btnScrollLeft.removeClass('show');
442                    }
443                });
444
445                // // Date Scroll button
446                // var selectorElementNav = $('#tabs-nav');
447                // if (selectorElementNav) {
448                //     var elementWidth = selectorElementNav.innerWidth();
449                //     var elementScrollWidth = selectorElementNav[0].scrollWidth;
450                //     if (elementScrollWidth > elementWidth) {
451                //         $('.nav-button-scroll-next').addClass('show');
452                //     }
453                // }
454
455                // var lastScrollLeft = 0;
456                // selectorElementNav.scroll(function() {
457                //     var elementScrollLeft = $(this).scrollLeft();
458                //     var btnScrollRight = $('.nav-button-scroll-next');
459                //     var btnScrollLeft = $('.nav-button-scroll-prev');
460                //     var scrollWidth = $(this)[0].scrollWidth;
461                //     var elementWidth = $(this).outerWidth();
462
463                //     if (scrollWidth - elementScrollLeft == elementWidth) {
464                //         $('.nav-button-scroll-next').removeClass('show');
465                //     } else {
466                //         $('.nav-button-scroll-next').addClass('show');
467                //     }
468
469                //     if (elementScrollLeft > 0) {
470                //         lastScrollLeft = elementScrollLeft;
471                //         btnScrollLeft.addClass('show');
472                //         btnScrollLeft.css({ left: elementScrollLeft });
473                //         btnScrollRight.css({ right: -elementScrollLeft });
474                //     } else {
475                //         btnScrollLeft.removeClass('show');
476                //         btnScrollLeft.css({ left: 0 });
477                //         btnScrollRight.css({ right: 0 });
478                //     }
479                // });
480
481            }
482
483        })
484    })
485
486})(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.