PageSourceSearch

https://www.shihang.org/etc/designs/wbr/clientlibs/js/new-header.js

js shihang.org collected 2026-10-02 06:35:48 UTC 6,068 bytes, 183 lines download raw bytes

1      $(document).ready(function () {
2
3
4         $(window).resize(function () {
5            NavigationDesktopOpen();
6         });
7
8         NavigationDesktopOpen();
9
10
11         $('.nav-hamburger').click(function () {
12            var nav = $('.nav-hamburger button');
13            if (nav.attr("aria-expanded") === "true") {
14               $('#nav').attr("aria-expanded", "true");
15                $('body').css('overflow','hidden');
16            }
17            else if (nav.attr("aria-expanded") === "false") {
18               $('#nav').attr("aria-expanded", "false");
19                 $('body').css('overflow','');
20            }
21         });
22
23      });
24
25      function NavigationDesktopOpen() {
26
27         if ($(window).width() >= 1024) {
28
29                $('.nav-menu-column.left').show();
30                    $('.nav-menu-column.right').show();
31            $(".nav-menu-column.left ul").each(function () {
32               $(".nav-menu-column.left ul li").hover(function () {
33                  $(this).addClass("selected").siblings().removeClass("selected");
34                  var index = $(this).index();
35                  $(".nav-menu-column.right #submenu_" + index + "").show().siblings().hide();
36               });
37            });
38
39
40
41         }
42         else {
43            $(".nav-menu-column.left ul li").off('hover mouseenter mouseleave');
44              $('.nav-menu-column.left').show(); 
45              $('.nav-menu-column.right').hide();
46
47            $(".nav-menu-column.left ul").each(function () {
48               $(".nav-menu-column.left ul li").click(function () {
49                  var appendText = $(this).find('a').text();
50                  $('.nav-menu-column.left').hide();
51                          $('.nav-menu-column.right').show();
52                  $(this).addClass("selected").siblings().removeClass("selected");
53                  var index = $(this).index();
54                  $(".nav-menu-column.right #submenu_" + index + "").addClass("active").siblings().removeClass("active");
55                  $(".nav-menu-column.right #submenu_" + index + "").show().siblings().hide();
56                    $('.nav-menu-overlay-back').show();
57                    $('.submenu-main-title a').text("");
58                  $('.submenu-main-title a').append(appendText);
59                  $('.submenu-main-title').show();
60               });
61            });
62
63            $(".nav-menu-overlay-back").click(function () {
64               $('.nav-menu-column.left').show();
65               $('.nav-menu-overlay-back').hide();
66                $('.submenu-main-title a').text("");
67                 $('.submenu-main-title').hide();
68               $(".nav-menu-column.right .submenu").hide();
69
70            });
71     }
72   }
73
74function loadElements() {
75var menu = document.querySelector(".country-list");
76if(menu) {
77   menu.querySelector(".country-list li").removeAttribute("style");
78}
79const search_country = document.getElementById('search-country');
80document.addEventListener('keyup', function() {
81   var b = search_country.value.length;
82   if (b > 0) {
83       if (!document.querySelector(".country-list").classList.contains("show-tt-menu")) {
84           document.querySelector(".country-list").classList.add("show-tt-menu")
85       }
86   } else {
87       document.querySelector(".country-list").classList.remove("show-tt-menu")
88   }
89   return true
90});
91
92var eventList = ["keydown", "keyup", "keypress"];
93for(event of eventList) {
94       var searchCountry = document.querySelector("#search-country")
95           if(searchCountry) {
96               searchCountry.addEventListener(event, function(c) {
97                   var b = c.keyCode || c.which;
98                   if (c.keyCode == 13) {
99                       c.preventDefault();
100                       return false
101                   }
102               });
103           }
104}
105}
106loadElements();    
107
108
109$("#search-country").focus(function(){
110       $(this).siblings().addClass('show');
111
112  }).blur(function(){
113       $(this).siblings().removeClass('show');
114  })
115
116
117
118window.filter = function(element) {
119
120  }
121
122
123function filterElements() {
124   const search_country = document.getElementById('search-country');
125   //console.log(search_country, 'search_country')
126   if(search_country) {
127       document.querySelector("#search-country").addEventListener('keyup', function(c) {
128           var value = search_country.value; 
129           document.querySelectorAll(".browse-country .country-list li a").forEach(function(e) {
130
131               var length = value.length
132               var substring = e.textContent.toLowerCase().substring(0, length);
133               var newvalue = value.toLowerCase();
134               //console.log(value, 'dups', substring, e.parentElement);
135               if (newvalue == substring) {
136                   e.parentElement.style.display='block';
137               } else {
138                   e.parentElement.style.display='none';
139               }
140           });
141       });
142   }
143
144var eventLists = ["keydown", "keyup", "keypress"];
145for(event of eventLists) {
146   var searchCountry = document.querySelector("#search-country")
147       if(searchCountry) {
148           searchCountry.addEventListener(event, function(c) {
149           //console.log(c.keyCode, 'tes', c.which);
150           var b =  c.which || c.keyCode || 0;
151           if (c.keyCode == 13) {
152               c.preventDefault();
153               return false
154           }
155              });
156       }
157   }
158}
159
160filterElements();
161
162function clearField(field) {
163if (field.value == field.defaultValue)
164   field.value = '';
165}
166
167function submit_search_form() { 
168
169    var global_qvalue = document.getElementById('search-input').value;
170
171    if(global_qvalue==""){
172        global_qvalue = document.getElementById('mobile-globalsearch').value;
173    }
174   
175    if(global_qvalue==""){
176        return false;
177    }
178    document.getElementById("globalsearchId").action = "https://www.worldbank.org/en/search" + "?q=" + global_qvalue;
179    document.getElementById("global_search").value = global_qvalue;
180    document.getElementById("globalsearchId").submit();
181    return false;
182}
183// global search header

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.