PageSourceSearch

https://mkt-static.bitly.com/static/1789049297/pages/wp-content/th…/JointsWP-CSS-master/assets/scripts/wpml.js

js bitly.com collected 2026-09-24 06:27:14 UTC 2,047 bytes, 47 lines download raw bytes

1
2jQuery(document).ready(function ($) {
3        if ($('.mega-menu').length > 0) {
4            $('.mega-menu').after('<div class="nav-lang-switcher"></div>');
5            $('#icl_lang_sel_widget-4').appendTo('.nav-lang-switcher').fadeIn();
6            $('#icl_lang_sel_widget-4').addClass('wpml-loaded');
7            
8            // Add aria-labels for accessibility
9            $('#icl_lang_sel_widget-4').attr('aria-label', 'Language switcher');
10            $('#icl_lang_sel_widget-4 .wpml-ls-current-language > a').attr('aria-label', 'Current language. Click to open language options');
11            $('#icl_lang_sel_widget-4 .wpml-ls-sub-menu').attr('aria-label', 'Available languages');
12            $('#icl_lang_sel_widget-4 .wpml-ls-sub-menu a').each(function() {
13                var langText = $(this).text().trim();
14                $(this).attr('aria-label', 'Switch to ' + langText);
15            });
16        } 
17
18        // WPML footer links fix.
19        var currentLangItem = $('.wpml-ls-current-language');
20        
21        if (!currentLangItem.length) return;
22        
23        // Get language code from class (e.g., wpml-ls-item-de → 'de')
24        var classList = currentLangItem.attr('class');
25        var langMatch = classList.match(/wpml-ls-item-([a-z]{2})/);
26        if (!langMatch || !langMatch[1]) return;
27        
28        var lang = langMatch[1];
29        
30        // Process each footer link with wpml-fix
31        $('a.wpml-fix').each(function() {
32            var $link = $(this);
33            var href = $link.attr('href');
34        
35            if (!href || href.includes('/' + lang + '/')) return;
36        
37            if (href.includes('/pages/')) {
38            // Live environment: insert lang after /pages/
39            href = href.replace(/(\/pages\/)/, '$1' + lang + '/');
40            } else {
41            // Staging or Local: insert lang after domain part
42            href = href.replace(/(\/\/[^\/]+\/)/, '$1' + lang + '/');
43            }
44        
45            $link.attr('href', href);
46        });
47}); // end document ready

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.