1//Get the button 2var mybutton = document.getElementById("myBtn"); 3// When the user scrolls down 20px from the top of the document, show the button 4window.onscroll = function() {scrollFunction()}; 5function scrollFunction() { 6 if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { 7 mybutton.style.display = "block"; 8 } else { 9 mybutton.style.display = "none"; 10 } 11} 12// When the user clicks on the button, scroll to the top of the document 13function topFunction() { 14 document.body.scrollTop = 0; 15 document.documentElement.scrollTop = 0; 16} 17 18 19 $(document).ready(function() { 20 // Setup the a11y nav 21 $('.nav').setup_navigation(); 22 23 // RWD Nav Pattern 24 $('body').addClass('js'); 25 var $menu = $('#menu'), 26 $menulink = $('.menu-link'), 27 $menuTrigger = $('.has-subnav > a'); 28 29 $menulink.click(function(e) { 30 e.preventDefault(); 31 $menulink.toggleClass('active'); 32 $menu.toggleClass('active'); 33 }); 34 35 $menuTrigger.click(function(e) { 36 e.preventDefault(); 37 var $this = $(this); 38 $this.toggleClass('active').next('ul').toggleClass('active'); 39 }); 40 }); 41 /* 42 $(function(){ 43 $('.nav').setup_navigation(); 44 }); 45 */ 46 var keyCodeMap = { 47 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", 59:";", 48 65:"a", 66:"b", 67:"c", 68:"d", 69:"e", 70:"f", 71:"g", 72:"h", 73:"i", 74:"j", 75:"k", 76:"l", 49 77:"m", 78:"n", 79:"o", 80:"p", 81:"q", 82:"r", 83:"s", 84:"t", 85:"u", 86:"v", 87:"w", 88:"x", 89:"y", 90:"z", 50 96:"0", 97:"1", 98:"2", 99:"3", 100:"4", 101:"5", 102:"6", 103:"7", 104:"8", 105:"9" 51 } 52 53 $.fn.setup_navigation = function(settings) { 54 55 settings = jQuery.extend({ 56 menuHoverClass: 'show-menu', 57 }, settings); 58 59 // Add ARIA role to menubar and menu items 60 $(this).attr('role', 'menubar').find('li').attr('role', 'menuitem'); 61 62 var top_level_links = $(this).find('> li > a'); 63 64 // Added by Terrill: (removed temporarily: doesn't fix the JAWS problem after all) 65 // Add tabindex="0" to all top-level links 66 // Without at least one of these, JAWS doesn't read widget as a menu, despite all the other ARIA 67 //$(top_level_links).attr('tabindex','0'); 68 69 // Set tabIndex to -1 so that top_level_links can't receive focus until menu is open 70 $(top_level_links).next('ul') 71 .attr('data-test','true') 72 .attr({ 'aria-hidden': 'true', 'role': 'menu' }) 73 .find('a') 74 .attr('tabIndex',-1); 75 76 // Adding aria-haspopup for appropriate items 77 $(top_level_links).each(function(){ 78 if($(this).next('ul').length > 0) 79 $(this).parent('li').attr('aria-haspopup', 'true'); 80 }); 81 82 $(top_level_links).hover(function(){ 83 $(this).closest('ul') 84 .attr('aria-hidden', 'false') 85 .find('.'+settings.menuHoverClass) 86 .attr('aria-hidden', 'true') 87 .removeClass(settings.menuHoverClass) 88 .find('a') 89 .attr('tabIndex',-1); 90 $(this).next('ul') 91 .attr('aria-hidden', 'false') 92 .addClass(settings.menuHoverClass) 93 .find('a').attr('tabIndex',0); 94 }); 95 96 $(top_level_links).focus(function(){ 97 $(this).closest('ul') 98 // Removed by Terrill 99 // The following was adding aria-hidden="false" to root ul since menu is never hidden 100 // and seemed to be causing flakiness in JAWS (needs more testing) 101 // .attr('aria-hidden', 'false') 102 .find('.'+settings.menuHoverClass) 103 .attr('aria-hidden', 'true') 104 .removeClass(settings.menuHoverClass) 105 .find('a') 106 .attr('tabIndex',-1); 107 108 $(this).next('ul') 109 .attr('aria-hidden', 'false') 110 .addClass(settings.menuHoverClass) 111 .find('a').attr('tabIndex',0); 112 }); 113 114 // Bind arrow keys for navigation 115 $(top_level_links).keydown(function(e){ 116 if(e.keyCode == 37) { 117 e.preventDefault(); 118 // This is the first item 119 if($(this).parent('li').prev('li').length == 0) { 120 $(this).parents('ul').find('> li').last().find('a').first().focus(); 121 } else { 122 $(this).parent('li').prev('li').find('a').first().focus(); 123 } 124 } else if(e.keyCode == 38) { 125 e.preventDefault(); 126 if($(this).parent('li').find('ul').length > 0) { 127 $(this).parent('li').find('ul') 128 .attr('aria-hidden', 'false') 129 .addClass(settings.menuHoverClass) 130 .find('a').attr('tabIndex',0) 131 .last().focus(); 132 } 133 } else if(e.keyCode == 39) { 134 e.preventDefault(); 135 // This is the last item 136 if($(this).parent('li').next('li').length == 0) { 137 $(this).parents('ul').find('> li').first().find('a').first().focus(); 138 } else { 139 $(this).parent('li').next('li').find('a').first().focus(); 140 } 141 } else if(e.keyCode == 40) { 142 e.preventDefault(); 143 if($(this).parent('li').find('ul').length > 0) { 144 $(this).parent('li').find('ul') 145 .attr('aria-hidden', 'false') 146 .addClass(settings.menuHoverClass) 147 .find('a').attr('tabIndex',0) 148 .first().focus(); 149 } 150 } else if(e.keyCode == 13 || e.keyCode == 32) { 151 // If submenu is hidden, open it 152 e.preventDefault(); 153 $(this).parent('li').find('ul[aria-hidden=true]') 154 .attr('aria-hidden', 'false') 155 .addClass(settings.menuHoverClass) 156 .find('a').attr('tabIndex',0) 157 .first().focus(); 158 } else if(e.keyCode == 27) { 159 e.preventDefault(); 160 $('.'+settings.menuHoverClass) 161 .attr('aria-hidden', 'true') 162 .removeClass(settings.menuHoverClass) 163 .find('a') 164 .attr('tabIndex',-1); 165 } else { 166 $(this).parent('li').find('ul[aria-hidden=false] a').each(function(){ 167 if($(this).text().substring(0,1).toLowerCase() == keyCodeMap[e.keyCode]) { 168 $(this).focus(); 169 return false; 170 } 171 });
172 } 173 }); 174 175 176 var links = $(top_level_links).parent('li').find('ul').find('a'); 177 $(links).keydown(function(e){ 178 if(e.keyCode == 38) { 179 e.preventDefault(); 180 // This is the first item 181 if($(this).parent('li').prev('li').length == 0) { 182 $(this).parents('ul').parents('li').find('a').first().focus(); 183 } else { 184 $(this).parent('li').prev('li').find('a').first().focus(); 185 } 186 } else if(e.keyCode == 40) { 187 e.preventDefault(); 188 if($(this).parent('li').next('li').length == 0) { 189 $(this).parents('ul').parents('li').find('a').first().focus(); 190 } else { 191 $(this).parent('li').next('li').find('a').first().focus(); 192 } 193 } else if(e.keyCode == 27 || e.keyCode == 37) { 194 e.preventDefault(); 195 $(this) 196 .parents('ul').first() 197 .prev('a').focus() 198 .parents('ul').first().find('.'+settings.menuHoverClass) 199 .attr('aria-hidden', 'true') 200 .removeClass(settings.menuHoverClass) 201 .find('a') 202 .attr('tabIndex',-1); 203 } else if(e.keyCode == 32) { 204 e.preventDefault(); 205 window.location = $(this).attr('href'); 206 } else { 207 var found = false; 208 $(this).parent('li').nextAll('li').find('a').each(function(){ 209 if($(this).text().substring(0,1).toLowerCase() == keyCodeMap[e.keyCode]) { 210 $(this).focus(); 211 found = true; 212 return false; 213 } 214 }); 215 216 if(!found) { 217 $(this).parent('li').prevAll('li').find('a').each(function(){ 218 if($(this).text().substring(0,1).toLowerCase() == keyCodeMap[e.keyCode]) { 219 $(this).focus(); 220 return false; 221 } 222 }); 223 } 224 } 225 }); 226 227 228 // Hide menu if click or focus occurs outside of navigation 229 $(this).find('a').last().keydown(function(e){ 230 if(e.keyCode == 9) { 231 // If the user tabs out of the navigation hide all menus 232 $('.'+settings.menuHoverClass) 233 .attr('aria-hidden', 'true') 234 .removeClass(settings.menuHoverClass) 235 .find('a') 236 .attr('tabIndex',-1); 237 } 238 }); 239 240 $(document).click(function(){ $('.'+settings.menuHoverClass).attr('aria-hidden', 'true').removeClass(settings.menuHoverClass).find('a').attr('tabIndex',-1); }); 241 242 $(this).click(function(e){ 243 e.stopPropagation(); 244 }); 245 } 246 247 /*---- Mob menu script ----*/ 248 $(document).ready(function(){ 249 $(".menu-slide").click(function(){ 250 $("#menu").animate({ 251 width: "toggle" 252 }); 253 }); 254 $(".closes").click(function(){ 255 $("#menu").animate({ 256 width: "toggle" 257 }); 258 }); 259 260 $(".has-sub-opt").click(function(){ 261 $(this).find("ul.level-2").slideToggle(300); 262 $(this).find(".arrow").toggleClass("arrowdown arrowup"); 263 }); 264 265 266 }); 267 268function OpenPopupForPrint(file) 269{ 270 win = window.open(file,'Popup','width=800,height=650,scrollbars=1,resizable=1'); 271 WindowXPosition(800,650,win); 272} 273 274$(document).ready(function(){ 275 ExternalLinks() 276}); 277 278function extractHostname(url) { 279 var hostname; 280 //find & remove protocol (http, ftp, etc.) and get hostname 281 282 if (url.indexOf("//") > -1) { 283 hostname = url.split('/')[2]; 284 } 285 else { 286 hostname = url.split('/')[0]; 287 } 288 289 //find & remove port number 290 hostname = hostname.split(':')[0]; 291 //find & remove "?" 292 hostname = hostname.split('?')[0]; 293 294 return hostname; 295} 296 297function ExternalLinks() 298{ 299 300 var exemptURL = ['eassemblygoa.gov.in', 'www.youtube.com', 'static.gladns.in']; 301 $("a").each(function() { 302 var $a = jQuery(this); 303 var href = this.href; 304 305 // strip the host name down, removing subdomains or www 306 var host = window.location.host.replace(/^(([^\/]+?\.)*)([^\.]{4,})((\.[a-z]{1,4})*)$/, '$3$4'); 307 //var hrefIncludes = this.href.includes('eassemblygoa.gov.in'); 308 //alert(this.href); 309 var hrefIncludes = exemptURL.includes(extractHostname(this.href)); 310 //alert(hrefIncludes); 311 312 var exempted = 'N'; 313 if(hrefIncludes == true) exempted = 'Y'; 314 315 if (this.href != null && !$a.is(".exempt") && exempted=='N') { 316 if ((this.href.match(/^http/)) && (!this.href.match(host)) && (!this.href.match(/^javascript/))) { 317 318 $a.attr('onClick',"GetExternalLinkPopUp('"+this.href+"');"); 319 $a.removeAttr("href"); 320 $a.removeAttr("target"); 321 $a.css("cursor","pointer"); 322 //$a.attr('onClick','hiii'); 323 } 324 } 325 });
326} 327 328function GetExternalLinkPopUp(href) 329{ 330 const item = document.getElementById('EXTERNAL_MODAL'); 331 console.log(item) 332 //$('#externalModalCenter').click(); 333 document.getElementById('externalModalCenter').classList.add("in"); 334 document.body.classList.add("modal-open"); 335 document.getElementById('externalModalCenter').style.display = 'block'; 336 const backdrop = document.createElement("div"); 337 backdrop.className = "modal-backdrop fade in"; 338 document.body.appendChild(backdrop); 339 $('#EXTERNAL_LINK').html('<a target="_self" href="' + href + '" id="external_link_html">' + href + '</a>'); 340} 341 342var setTimeOut; 343$(document).on('shown.bs.modal', '#externalModalCenter', function (e) { 344 var href = $('#external_link_html').html(); 345 if(href!='') 346 { 347 redirect_path = 'document.location="' + href + '"'; 348 setTimeOut = setTimeout(function(){ eval(redirect_path) }, 8000); 349 } 350}); 351 352function CloseExternalLinkPopUp() 353{ 354 clearTimeout(setTimeOut); 355 document.getElementById('externalModalCenter').style.display = 'none'; 356 document.getElementById('externalModalCenter').classList.remove("in"); 357 document.body.classList.remove("modal-open"); 358 const backdrop = document.querySelector('.modal-backdrop'); 359 if (backdrop) { 360 backdrop.remove(); 361 } 362 363 //$("#CloseModal").click( 364 //if($("#CloseModal").click()) { 365 // $("#externalModalCenter").modal('hide'); 366 //} 367 $('#EXTERNAL_LINK').html(''); 368} 369 370function PrintDisplayedPage2() 371{ 372 document.getElementById('printButton').style.display = "none"; 373 window.print(); 374 document.getElementById('printButton').style.display = "block"; 375} 376 377/*function PrintDisplayedPage(id,aID,pID) 378{ 379 var aContent = document.getElementById(aID); 380 var pContent = document.getElementById(pID); 381 382 383 var prtContent = document.getElementById(id); 384 var WinPrint = window.open('', '', 'left=0,top=0,width=800,height=900,toolbar=0,scrollbars=0,status=0');
385 WinPrint.document.write('<h3>'+aContent.innerHTML+'<h3>'); 386 WinPrint.document.write('<h3>'+pContent.innerHTML+'<h3>'); 387 WinPrint.document.write('<hr style="height:2px; width:100%; border-width:0; color:black; background-color:black"'); 388 WinPrint.document.write(prtContent.innerHTML); 389 WinPrint.document.close(); 390 WinPrint.focus(); 391 WinPrint.print(); 392 WinPrint.close(); 393}*/ 394 395function PrintDisplayedPage(id,aID,pID) 396{ 397 var aContent = document.getElementById(aID); 398 var pContent = document.getElementById(pID); 399 var prtContent = document.getElementById(id); 400 var WinPrint = window.open('', '', 'left=0,top=0,width=800,height=900,toolbar=0,scrollbars=0,status=0'); 401 402 WinPrint.document.write('<h3 style="font: 600 22px/29px Fira Sans, sans-serif;letter-spacing: normal;text-align: left;color: #3C3C3C; padding: 3px 0 5px 0;position: relative;">'+aContent.innerHTML+'</h3>'); 403 WinPrint.document.write('<h3 style="font: 600 22px/29px Fira Sans, sans-serif;letter-spacing: normal;text-align: left;color: #3C3C3C; padding: 3px 0 5px 0;position: relative;">'+pContent.innerHTML+'</h3>');
404 WinPrint.document.write('<hr style="height:2px; width:100%; border-width:0; color:black; background-color:black"'); 405 WinPrint.document.write('<link rel="stylesheet" href="print_style.css" media="print" /> '); 406 WinPrint.document.write('<span style="color: #6F6E6E;font: 400 15px/20px Fira Sans, sans-serif;padding: 10px 0;">'); 407 WinPrint.document.write('<p style="font: 600 22px/29px Fira Sans, sans-serif;letter-spacing: normal;text-align: left;color: red; padding: 3px 0 5px 0;position: relative;">'); 408 WinPrint.document.write(prtContent.innerHTML); 409 WinPrint.document.write('</p>'); 410 WinPrint.document.write('</span>'); 411 WinPrint.document.close(); 412 WinPrint.focus(); 413 WinPrint.print(); 414 WinPrint.close(); 415}
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.