PageSourceSearch

https://acessibilidadenotrabalho.org/id_a11y/assets/js/acessivel.js

js acessibilidadenotrabalho.org collected 2026-10-07 10:46:14 UTC 26,826 bytes, 727 lines download raw bytes

1/**
2 * @file ToolSet de elemenentos para acessibilidade
3 * @author Rogério Chiavegatti <[email protected]>
4 * @version 1.0.3
5 * @copyright Iguale Digital Acessibilidade
6 */
7
8// Define Global Object acessibleAssets
9/** @global */
10
11// html toolbar
12var htmlToolBar;
13var htmlFooterLogos;
14var barColorSet;
15
16var cdnLocation = "/id_a11y"
17var lnkAcessibilidade = "/id_a11y/info/acessibilidade.html";
18var lnk_libras = "http://www.vlibras.gov.br";
19var lnk_devsite = "https://igualedigital.com.br";
20
21var mainNavigationID = "#menu1";
22var mainContentID = "#content"; // Define the main content page container eg: body #container, #main-contet, etc..
23var mainFooterID = "#footer";
24
25
26var contrastFiles = "/id_a11y/assets/css/contraste/";
27
28if(!window.acessibleAssets){
29	window.acessibleAssets = {};
30}
31
32if(!window.acessibleDialog){
33	window.acessibleDialog = {};
34}
35
36if(!window.acessibleFocus){
37	window.acessibleFocus = {};
38}
39
40var $ = jQuery.noConflict();
41
42/** 
43* @function  Object Cria uma lista para selos de certificação de código semântico e conformidade.
44* @method validatorsItens
45* @param {string} element - Elemento HTML ao qual será associada a lista de selos de acessibilidade
46* @param {string} position - Posição da lista de selos, "after" ou "before". Referente ao elemento associado.
47* @param {bool} typeElements - Tipo de lista exibida False - exibe os selos (w3c HTML5,w3c CSS3,WCAG totalvalidator)
48* @return {bool} true
49*/
50
51acessibleAssets.validatorsItens = function(element,position,typeElements){
52
53	var URL_site = window.location.href;
54
55	htmlFooterLogos = "";
56	htmlFooterLogos = htmlFooterLogos +"";
57	
58	htmlFooterLogos = htmlFooterLogos +"<ul class=\"acessibility-certifications-list\">";
59	if (typeElements){
60	htmlFooterLogos = htmlFooterLogos +"<li>";
61	htmlFooterLogos = htmlFooterLogos +"<a href=\"http://validator.w3.org/check?uri="+URL_site+"\"  target=\"_blank\">";
62	htmlFooterLogos = htmlFooterLogos +"<img src=\""+cdnLocation +"/a11y/assets/selo-html5.png\"  alt=\"Selo do validador online da W3C para HTML5 - Um retângulo dividido em duas partes: À esquerda um fundo branco com a abreviação W3C. à direita o logotipo do HMTL 5 em laranja sobre um fundo amarelo. Este selo significa que o código HTML desta página não contém erros.\" title=\"Selo do validador W3C para HTML5 - HTML5 Válido, sem erros.\">";
63	htmlFooterLogos = htmlFooterLogos +"</a>";
64	htmlFooterLogos = htmlFooterLogos +"</li>";
65	htmlFooterLogos = htmlFooterLogos +"<li>";
66	htmlFooterLogos = htmlFooterLogos +"<a href=\"http://jigsaw.w3.org/css-validator/check/referer\" target=\"_blank\">";
67	htmlFooterLogos = htmlFooterLogos +"<img src=\""+cdnLocation +"/a11y/assets/selo-css.png\" alt=\"Selo do validador online da W3C para CSS - Um retângulo dividido em duas partes: à esquerda um fundo branco com a abreviação W3C. À dreita as letras CSS escritas em preto sobre um fundo amarelo. Este selo significa que o código CSS desta página não contém erros.\" title=\"Selo do validador W3C para CSS - CSS válido, sem erros.\">";
68	htmlFooterLogos = htmlFooterLogos +"</a>";
69	htmlFooterLogos = htmlFooterLogos +"</li>";
70	htmlFooterLogos = htmlFooterLogos +"<li>";
71	htmlFooterLogos = htmlFooterLogos +"<img src=\""+cdnLocation +"/a11y/assets/selo-wcag2.png\" alt=\"Selo do software TotalValidatorPro para WCAG - Um retângulo dividido em duas partes: À esquerda sobre um fundo branco está o logotipo representativo do software Total Validator Pro. À direta sobre um fundo azul claro está escrito WCAG 2.0 AA. Este selo significa que esta página atende aos critérios básicos de acessibilidade para pessoas com necessidades especiais.\" title=\"Selo do software Total Validator Pro - Este site atende as diretrizes de acessibilidade WCAG 2.0 AA\">";
72	htmlFooterLogos = htmlFooterLogos +"</li>";
73	}else{
74		htmlFooterLogos = htmlFooterLogos +"<li>";
75		htmlFooterLogos = htmlFooterLogos +"<a href=\"https://igualedigital.com.br/a11y_monitor/?u="+URL_site+"\"  target=\"_blank\">";
76		htmlFooterLogos = htmlFooterLogos +"<img src=\""+cdnLocation +"/a11y/assets/selo-iguale-ace
76ssivel.png\" alt=\"Selo Iguale de validação de acessibilidade  - Um retângulo dividido em duas partes: À esquerda sobre um fundo branco está o logotipo representativo da acessibilidade. À direta sobre um fundo azul claro está o logo da Iguale Digital. Este selo significa que este site sofreu modificações para melhorar sua acessibilidade.\" title=\"Selo de acessibilidade Iguale Digital - Este site atende as diretrizes de acessibilidade WCAG e foi desenvolvido com base nas diretrizes da W3C\">";
77		htmlFooterLogos = htmlFooterLogos +"</a>";
78		htmlFooterLogos = htmlFooterLogos +"</li>";
79	}
80	htmlFooterLogos = htmlFooterLogos +"</ul>";
81	
82
83	if(position == 'after'){
84		$(htmlFooterLogos).insertAfter('.footer-pageinfo');
85	}else{
86		$(htmlFooterLogos).insertBefore(element);	
87	}
88
89	return true;
90}
91
92acessibleAssets.acessibleToolBar = function(){
93
94	htmlToolBar = "";
95	htmlToolBar = htmlToolBar +"";
96
97	htmlToolBar = htmlToolBar +"<nav id=\"acessivel_toolbar\" class=\"acessivel_navbar\">";
98	htmlToolBar = htmlToolBar +"<ul>";
99	htmlToolBar = htmlToolBar +"<li><a id=\"acc-go-to-main-content\" href=\" "+mainContentID+" \" aria-label=\"Atalho para acesso direto ao conteúdo principal\" title=\"Ir para o conteúdo principal\"> Ir para o conteúdo <small>[1]</small></a></li>";
100	htmlToolBar = htmlToolBar +"<li><a id=\"acc-go-to-main-nav\" href=\" "+mainNavigationID+"\" aria-label=\"Atalho para acesso direto ao menu principal\" title=\"Ir para o menu principal\"> Ir para o menu <small>[2]</small></a></li>";
101	htmlToolBar = htmlToolBar +"<li>Tamanho do texto: <a id=\"acc-increase-font-size\" href=\"#\"  aria-label=\"Aumentar o tamanho do texto\" title=\"Aumentar o tamanho do texto\"><strong>A +</strong></a> | <a id=\"acc-normalize-font-size\" href=\"#\" aria-label=\"Retornar o tamanho do texto ao padrão normal\" title=\"Reduzir ou normalizar o tamanho do texto\"><strong>A</strong></a></li>";
102	htmlToolBar = htmlToolBar +"<li class=\"menu-item-has-children\" id=\"ida11y_submenu1\"><a id=\"acc-contrast-toogle\" href=\"#\" aria-haspopup=\"true\" data-highContrast=\"false\" aria-label=\"Exibir as opções de Alto Contraste\" title=\"Exibir as opções de alto contraste\"><i class=\"fa fa-adjust\" aria-hidden=\"true\" ></i> <span id=\"txtContrast\"> Contraste</span></a>";
103	
104	htmlToolBar = htmlToolBar +"<ul class=\"sub-menu-a11y\" id=\"ida11y_contrastItens\">";
105	htmlToolBar = htmlToolBar +"<li><a href=\"#\" title=\"Preto, branco e amarelo\" data-constrastTo=\"hc_blackYellow\"><span lang=\"pt-br\">Preto, branco e amarelo<span></span></span></a></li>";
106	htmlToolBar = htmlToolBar +"<li><a href=\"#\" title=\"Contraste aumentado\" data-constrastTo=\"hc_highContrast\"><span lang=\"pt-br\">Contraste aumentado<span></span></span></a></li>";
107	htmlToolBar = htmlToolBar +"<li><a href=\"#\" title=\"Monocromático\" data-constrastTo=\"hc_mono\"><span lang=\"pt-br\">Monocromático<span></span></span></a></li>";
108	htmlToolBar = htmlToolBar +"<li><a href=\"#\" title=\"Escala de cinza invertida\" data-constrastTo=\"hc_grayScale\"><span lang=\"pt-br\">Escala de cinza invertida<span></span></span></a></li>";
109	htmlToolBar = htmlToolBar +"<li><a href=\"#\" title=\"Cor invertida\" data-constrastTo=\"hc_inverse\"><span lang=\"pt-br\">Cor invertida<span></span></span></a></li>";
110	htmlToolBar = htmlToolBar +"<li><a href=\"#\" title=\"Cores originais\" data-constrastTo=\"hc_normal\"><span lang=\"pt-br\">Cores originais<span></span></span></a></li>";
111
112	htmlToolBar = htmlToolBar +"</ul>";
113	htmlToolBar = htmlToolBar +"</li>";
114
115	htmlToolBar = htmlToolBar +"<li id=\"acessibilityLibrasElement\"><a href=\""+lnk_libras+"\" target=\"_blank\"  \" id=\"acessibilityLibrasElement\" aria-label=\"Este site é acessível em LIBRAS.\" title=\"Este site é acessível em LIBRAS.\"><i class=\"fa fa-sign-language\" aria-hidden=\"true\"></i> LIBRAS</a></li>";
116	htmlToolBar = htmlToolBar +"<li id=\"acessibilityInfoBlock\"><a href=\""+lnkAcessibilidade+"\" target=\"_blank\"  \" id=\"accessibilityInfo_\" aria-label=\"Informações sobre a acessibilidade deste site.\" title=\"Informações sobre a acessibilidade deste site.\"><i class=\"fab fa-accessible-icon\" aria-hidden=\"true\"></i> Acessibilidade</a></li>";
117	htmlToolBar = htmlToolBar +"<li id=\"developmentByBlock\" class=\"ida11y_mlast\"><a href=\"#\" id=\"developmentBy\"  aria-label=\"Barra de recursos acessíveis. Desenvolvida pela Iguale Digital.\" title=\"Visite e conheça a igualedigital.com.br\"><i id=\"icon-equals\" class=\"icon-equal\" aria-hidden=\"true\"></i></a> </li>";
118	htmlToolBar = htmlToolBar +"</ul>";
119	htmlToolBar = htmlToolBar +"</nav>";
120	htmlToolBar = htmlToolBar +"</div>";
121
122	return htmlToolBar;
123}
124
125acessibleAssets.setcolor = function(arg){
126		
127	switch (arg) {
128		case 2:
129			$('#acessivel_toolbar').addClass('toolbar-colorset2');
130			$("#icon-equals").removeClass().addClass("icon-equal2");
131			break;
132		case 3:
133			$('#acessivel_toolbar').addClass('toolbar-colorset3');
134			$("#icon-equals").removeClass().addClass("icon-equal3");
135			break;
136	}
137
138	return;
139}
140
141// Scroll page to top;
142acessibleAssets.scrollToTopPage = function(arg){
143
144		//console.log('scroll page to top:',arg);
145
146	if (!arg || $(window).width() <= 360){
147		return false;
148	}
149
150	htmlTscroll = "";
151	htmlTscroll = htmlTscroll +"";
152	htmlTscroll = htmlTscroll +" <a id=\"acc-scroll-to-top\" href=\"#\" class=\"acc-scrollToTop\" aria-label=\"Atalho para o topo da página.\">Ir para o topo da página</a>";
153	$('body').append(htmlTscroll);
154
155	var tr_gototop         = $("#acc-scroll-to-top");
156	var tr_gototop_visible = false;
157
158	// Scroll page to top
159	$(window).scroll(function(){
160
161		if ($(this).scrollTop() > 120 && $(window).width() > 360 && tr_gototop_visible == false) {
162			
163			//Toggle Scroll top Fade in
164			tr_gototop.stop();
165			tr_gototop.css({'display':'block'});
166			tr_gototop.animate({'opacity':'1'});
167
168			tr_gototop_visible = true;
169		
170		} else if ($(this).scrollTop() < 120 && tr_gototop_visible == true) {
171		
172			//Toggle Scroll top Fade out
173			tr_gototop.stop();
174			tr_gototop.css({'opacity':'1','display':'block'});
175			tr_gototop.animate({'opacity':'0'}, function(){
176
177				$(this).css({'display':'none'});
178
179			});
180
181			
182			tr_gototop_visible = false;
183		}
184	});
185	
186	//Click event to scroll to top
187	tr_gototop.click(function(){
188		$('html, body').animate({scrollTop : 0},800);
189		return false;
190	});
191
192}
193
194acessibleAssets.mapAndFix = function(){
195
196	//1.Place no script tag on html.
197	var html_noscript = "<noscript>Seu navegador não tem suporte para JavaScript!</noscript>";
198	$(document.body).append(html_noscript);
199
200	//2.map images alt and title whitout description.
201	$("body img").each(function(){
202		var $this = $(this);
203		if (!$this.attr('alt')){
204		  $this.attr('alt','Esta imagem não contém uma descrição.');
205		  $this.attr('title','Imagem sem descrição.\nPara soluções em acessibilidade entre em contato\[email protected]');
206		}
207	 });
208
209
210	
211	return;
212	
213};
214
215acessibleAssets.acessibilize = function(toolbar,appendBarTo,colorOptions){
216
217	// active element focus
218	//	acessibleFocus.elementFocus();
219
220	barColorSet = colorOptions;
221
222    // Check if is mobile device
223	function ismobile(){
224		if(/android|webos|iphone|blackberry|opera mini|Windows Phone|iemobile|WPDesktop|XBLWP7/i.test(navigator.userAgent.toLowerCase())) {
225			return false; // if true hide bar on mobile...
226				}else{
227			return false;
228		}
229	}
230
231
232    // if is mobile device detectect dont create accessibleToolBar accessible toolbar.
233	//console.log('é mobile:',ismobile());
234
235    if(!ismobile()){
236    //console.log("Criar a barra de acessibilidade.");
237
238	// Load acessible toolBar
239	if (toolbar){
240		
241		var html_acessible_bar = acessibleAssets.acessibleToolBar();
242		
243		if(!appendBarTo){
244			appendBarTo = "body";
245
246		}
247		$(appendBarTo).prepend(html_acessible_bar);
248		acessibleAssets.setcolor(barColorSet);
249	}
250
251	 
252    }else{
253		//console.log("MOBILE :: não criar a barra");
254		return false;
255	}	
256	
257  	// console.log("Go to main content - click!");
258    // instance of Acessibile dialog box. (dependence)
259    
260
261    // triggers
262    var tr_goMainContent = $("#acc-go-to-main-content");
263    var tr_goMainNav = $("#acc-go-to-main-nav");
264    var tr_increase_font_size = $("#acc-increase-font-size");
265    var tr_normalize_font_size = $("#acc-normalize-font-size");
266	var tr_contrast_toogle = $("#acc-contrast-toogle");
267	var tr_barcredits = $("#developmentBy");
268	var tr_iconEquals = $("#icon-equals");
269	var tr_smenu1 = $("#ida11y_submenu1");
270
271	var tr_hc_changer = $("#ida11y_contrastItens");
272
273	tr_hc_changer.find("a").click(function(e) {
274		acessibleAssets.highContrast($(this).attr("data-constrastTo"));
275		//console.log('constrate to:',$(this).attr("data-constrastTo"));
276	})
277
278
279
280    // vars and tag arrays
281	var maxFontResize = 1;
282	var nfontResize = 0;
283    var arr_taglist = ['h1','h2','h3','h4','h5','h6','p','a','li','th','td'];
284
285
286    // Go to main content page
287    tr_goMainContent.click(function(e){
288        //console.log("Go to main content page.");
289      e.preventDefault();
290       var hash = this.hash;
291     //  console.log(hash);
292        $('html, body').animate({
293         scrollTop: $(hash).offset().top
294      }, 0, function(){
295   
296        // Add hash (#) to URL when done scrolling (default click behavior)
297        window.location.hash = hash;
298       // console.log("main content position.");
299      });
300
301	});
302
303    // Go to main navigation in page
304    tr_goMainNav.click(function(e){
305       // console.log("Go to main navigation menu.");
306         e.preventDefault();
307       var hash = this.hash;
308      // console.log(hash);
309        $('html, body').animate({
310        scrollTop: $(hash).offset().top
311      }, 0, function(){
312   
313        // Add hash (#) to URL when done scrolling (default click behavior)
314        window.location.hash = hash;
315      //  console.log("main navegation position.");
316      });
317    });
318
319    //Increase 2x or 3x font-size
320    tr_increase_font_size.click(function(){
321		//console.log("Increase font-size.");
322		var alrt_message = "Para aumentar ou reduzir a fonte, utilize os atalhos nativos do seu navegador.\n\n No windows Control+ (para aumentar) e Control- (para diminuir) \n No macOS (safari) cmd+ (para aumentar) e cmd- (para diminuir)";
323		alert(alrt_message);
324		return;
325	});
326
327    //normalize font-size
328    tr_normalize_font_size.click(function(){
329
330		var alrt_message = "Para aumentar ou reduzir a fonte, utilize os atalhos nativos do seu navegador.\n\n No windows Control+ (para aumentar) e Control- (para diminuir) \n No macOS (safari) cmd+ (para aumentar) e cmd- (para diminuir)";
331		alert(alrt_message);
332		return;
333
334    });
335	
336	
337		
338	acessibleAssets.checkHighContrast = function(){
339			
340			
341			var hc = Cookies.get('accessible_highContrast'); // => 'value'
342			//console.log('Cookies hc',hc);
343			
344
345			if (hc == "hc_normal" || hc == "undefined" || hc == "no" || hc == null ) {
346         		acessibleAssets.highContrast('normal');
347		 } else {
348         	 acessibleAssets.highContrast(hc);
349		 }
350		 return;
351	}
352
353	acessibleAssets.highContrast = function(arg){
354
355		// remove algumas tags do filtro.
356		removerTags = ['img'];
357		removerTags.forEach(function(e,i) {
358			$('body').find(e).addClass('ida11y_nfilter');
359		});
360		
361            switch (arg) {
362                case "hc_normal":
363					setContrast();
364					Cookies.set('accessible_highContrast', 'no', { expires: 7, path: '/' });
365					break;
366				case "hc_blackYellow":
367					setContrast(), $("head").append('<link id="ida11y-highContrast" rel="stylesheet" type="text/css" href=" '+contrastFiles+'ida11y_contraste-preto-amarelo.css" />');
368					$('body').find('img').addClass('ida11y_nfilter');
369					Cookies.set('accessible_highContrast', 'hc_blackYellow', { expires: 7, path: '/' });
370					break;
371                case "hc_highContrast":
372					setContrast(), $("head").append('<link id="ida11y-highContrast" rel="stylesheet" type="text/css" href="'+contrastFiles+'ida11y_contraste-high-contraste.css" />');
373					Cookies.set('accessible_highContrast', arg, { expires: 7, path: '/' });
374                    break;
375                case "hc_mono":
376					setContrast(), $("head").append('<link id="ida11y-highContrast" rel="stylesheet" type="text/css" href="'+contrastFiles+'ida11y_contraste-monocromatico.css" />');
377					Cookies.set('accessible_highContrast', arg, { expires: 7, path: '/' });
378                    break;
379                case "hc_grayScale":
380					setContrast(), $("head").append('<link id="ida11y-highContrast" rel="stylesheet" type="text/css" href="'+contrastFiles+'ida11y_contraste-gray-scale.css" />');
381					Cookies.set('accessible_highContrast', arg, { expires: 7, path: '/' });
382                    break;
383                case "hc_inverse":
384					setContrast(), $("head").append('<link id="ida11y-highContrast" rel="stylesheet" type="text/css" href="'+contrastFiles+'ida11y_contraste-inverse-color.css" />');
385					Cookies.set('accessible_highContrast', arg, { expires: 7, path: '/' });
386                    break;
387             
388			
389			}
390		
391	
392		
393		function setContrast() {
394			$('link[id^="ida11y-"]').remove();
395			$('body').find('img').removeClass('ida11y_nfilter');
396		}
397
398	return;
399	}
400
401	tr_smenu1.focusin(function() {
402		$(".sub-menu-a11y").css("display", "flex");
403		$(".sub-menu-a11y").css("flex-direction", "column");
404		acessibleAssets.constrastHtmlToogle(true);
405	//	console.log('contrast_focus_in');
406	//	$(mainContentID).css("z-index", -100);
407		
408	})
409
410	  tr_smenu1.bind("mouseenter",
411	  function() { 
412		  $(".sub-menu-a11y").css("display", "flex");
413		  $(".sub-menu-a11y").css("flex-direction", "column");
414		  acessibleAssets.constrastHtmlToogle(true);
415		 // console.log('contrast_focus_in');
416		//  $(mainContentID).css("z-index", -100);
417		});
418  
419  
420		$("#ida11y_submenu1 li").last().focusout(function() { 
421			$(".sub-menu-a11y").css("display", "none");
422			acessibleAssets.constrastHtmlToogle(false);
423			//console.log('contrast_focus_out');
424			//$(mainContentID).css("z-index", 'auto');
425		  });
426
427		$('#ida11y_submenu1').last().bind("mouseleave",
428		function() { 
429		  $(".sub-menu-a11y").css("display", "none");
430		  acessibleAssets.constrastHtmlToogle(false);
431		  //console.log('contrast_focus_out');
432		  //$(mainContentID).css("z-index", 'auto');
433		  });
434
435	  $(window).click(function() {
436		$(".sub-menu-a11y").css("display", "none");
437		acessibleAssets.constrastHtmlToogle(false);
438		//console.log('submenu constrast off');
439		//$(mainContentID).css("z-index", -100);	
440		});
441		
442		$('#ida11y_submenu1').click(function(event){
443			e.preventDefault();
444			event.stopPropagation();
445			acessibleAssets.constrastHtmlToogle(false);
446			//console.log('submenu constrast on');
447			
448			//$(mainContentID).css("z-index", 'auto');
449			
450		});
451
452
453		acessibleAssets.constrastHtmlToogle = function(arg){
454
455
456
457			if (arg) {
458				
459
460				$('#acessivel_toolbar').nextAll().find('*').css("z-index", 'auto');
461				$('#wrapper').addClass("zd-element");
462				$('#zd2').addClass("zd-element");
463			}else{
464				$('#acessivel_toolbar').nextAll().find('*').css("z-index", '');
465				$('#wrapper').removeClass("zd-element");
466				$('#zd2').addClass("zd-element");
467			}
468
469			return false;
470		}
471
472
473		// Verificar o alto contraste
474		//console.log("verificar alto contraste");
475		acessibleAssets.checkHighContrast();
476
477	// click on development info
478	 tr_barcredits.click(function(){
479		 //alert(this.attr("alt"));
480		  alert("Barra de recursos acessíveis. Desenvolvida pela Iguale Digital.");
481		 // window.open('https://www.igualedigital.com.br', '_blank');
482		  return;
483	 });
484
485
486}
487
488/*! track-focus v 1.0.0 | Author: Jeremy Fields [[email protected]], 2015 | License: MIT */
489// inspired by: http://irama.org/pkg/keyboard-focus-0.3/jquery.keyboard-focus.js
490document.addEventListener("DOMContentLoaded", function(event) { 
491	
492	(function(body) {
493		
494
495		var usingMouse;
496
497		var preFocus = function(event) {
498			usingMouse = (event.type === 'mousedown');
499		};
500
501		var addFocus = function(event) {
502			if (usingMouse)
503				event.target.classList.add('focus--mouse');
504		};
505
506		var removeFocus = function(event) {
507			event.target.classList.remove('focus--mouse');
508		};
509
510		var bindEvents = function() {
511		//	body.addEventListener('keydown', preFocus);
512		//	body.addEventListener('mousedown', preFocus);
513		//	body.addEventListener('focusin', addFocus);
514		//	body.addEventListener('focusout', removeFocus);
515		};
516
517		bindEvents();
518
519	})(document.body);
520
521
522	/*
523 * jQuery Hotkey Plugin
524 * Copyright 2013, Realdanielbyrne
525 * Licensed under the MIT 
526 */
527
528(function ($) {
529
530
531
532    $.fn.hotKey = function (options, callback) {
533
534        var $self = this; // preserve the calling context 
535        
536        var keys = {
537            
538            "backspace":8,"tab":9, "return":13, "pause":19,
539            "capslock":20, "esc":27, "space":32, "pageup":33, "pagedown":34, "end":35, "home":36,
540            "left":37, "up":38, "right":39, "down":40, "insert":45, "del":46,
541            "num0":96, "num1":97, "num2":98, "num3":99, "num4":100, "num5":101, "num6":102, "num7":103,
542            "num8":104, "num9":105, "num*":106, "num+":107, "num-":109, "num.":110, "num/":111,
543            "f1":112, "f2":113, "f3":114, "f4":115, "f5":116, "f6":117,"f7":118,"f8":119,
544            "f9":120, "f10":121, "f11":122,"f12":123, "numlock":144, "scroll":145, ";":186, "/":191,
545            "\\":220, "'":222,"0":48,"1":49,"2":50,"3":51,"4":52,"5":53,"6":54,"7":55,"8":56,"9":57
546        };
547
548        var modifiers = { 'alt': 'alt', 'ctrl': 'ctrl', 'shift': 'shift' };
549
550
551        for (var i = 65; i < 91; i++) {
552            keys[String.fromCharCode(i).toLowerCase()] = i;
553        }
554
555        return this.each(function () {
556            
557            var cb, hotKeyCode = 0, modifier = "",
558                settings = $.extend({
559                // These are the defaults.
560                key: "",
561                modifier: ""
562            }, options);
563
564            // parameter checking
565            if ((settings.key === "") ||
566                (typeof settings.key !== "string"))
567                return;
568
569            settings.key = settings.key.toLowerCase();
570
571            // check to make sure keymodifer is handled
572            if ((settings.modifier !== "") && (typeof settings.modifier === "string")) {
573                modifier = (modifiers[settings.modifier.toLowerCase()]) ? modifiers[settings.modifier.toLowerCase()] : 0;
574                if (!modifier)
575                    return;
576            }
577
578            // check for existance of callback function
579            cb = callback;
580            if (Object.prototype.toString.call(cb) != '[object Function]')
581                return;
582            
583
584            // check to see if key is in captureable keys array
585            hotKeyCode = (keys[settings.key]) ? keys[settings.key] : 0;
586            if (!hotKeyCode)
587                return;
588            
589
590            
591            /* The event registration method */
592            $self.keydown(function (event) {
593
594                var keyCode = (event.which) ? event.which : event.keyCode;    // keycode attached to event
595
596                // check for alt Key combinations
597                if (((modifier == 'alt') && event.altKey) ||
598                ((modifier == 'ctrl') && event.ctrlKey) ||
599                ((modifier == 'shift') && event.shiftKey) ||
600                (modifier === ""))
601                {
602                    checkAndExecute(this);
603                }
604                
605               /*  This function handles checking the typed character against the registered hotkey
606                *  and then then if there is a match calling the registered callback.            
607                */
608                function checkAndExecute(self) {
609                    if (keyCode == hotKeyCode) {
610                        cb.apply(self, arguments); // call callback
611                        event.preventDefault();
612                        event.stopPropagation();
613                        event.stopImmediatePropagation();
614                    }
615                }
616            });
617        });
618    };
619
620
621})(jQuery);
622
623// Go to main content (alt+1)
624$('html').hotKey({ key: '1', modifier: 'alt' }, function () {
625	goToContent(mainContentID);
626});
627$('html').hotKey({ key: 'num1', modifier: 'alt' }, function () {
628	goToContent(mainContentID);
629});
630
631// Go to main menu (alt+2)
632$('html').hotKey({ key: '2', modifier: 'alt' }, function () {
633	goToContent(mainNavigationID);
634	
635});
636$('html').hotKey({ key: 'num2', modifier: 'alt' }, function () {
637	goToContent(mainNavigationID);
638	
639	
640	
641});
642
643// Go to footer page (alt+3)
644$('html').hotKey({ key: '3', modifier: 'alt' }, function () {
645
646	goToContent(mainFooterID);
647   
648});
649$('html').hotKey({ key: 'num3', modifier: 'alt' }, function () {
650
651	goToContent(mainFooterID);
652   
653});
654
655// Go to top of page (alt+4)
656$('html').hotKey({ key: '4', modifier: 'alt'}, function () {
657
658	goToContent('acessivel_toolbar');
659   
660});
661$('html').hotKey({ key: 'num4', modifier: 'alt'}, function () {
662
663	goToContent('acessivel_toolbar');
664   
665});
666
667// Show / hide acessible tool bar (alt+b)
668$('html').hotKey({ key: '5', modifier: 'alt' }, function () {
669	$('#acessivel_toolbar').slideToggle('slow');
670	 goToContent('acessivel_toolbar');
671});
672$('html').hotKey({ key: 'num5', modifier: 'alt'}, function () {
673
674	$('#acessivel_toolbar').slideToggle('slow');
675	goToContent('acessivel_toolbar');
676   
677});
678
679// Acess acessbility statment page (alt+6)
680$('html').hotKey({ key: '6', modifier: 'alt'}, function () {
681
682	
683	window.location.href = lnkAcessibilidade;
684   
685});
686$('html').hotKey({ key: 'num6', modifier: 'alt'}, function () {
687
688	window.location.href = lnkAcessibilidade;
689   
690});
691
692// Iguale Digital web site (alt+7)
693$('html').hotKey({ key: '7', modifier: 'alt'}, function () {
694
695	goURLByConfirm(lnk_devsite);
696   
697});
698$('html').hotKey({ key: 'num7', modifier: 'alt'}, function () {
699	goURLByConfirm(lnk_devsite);
700   
701});
702
703function goURLByConfirm(togo){
704	if (confirm('Você agora irá acessar um link externo, tudo bem?')) {
705		window.location.href=togo;
706	  }
707	  return false;
708}
709
710function goToContent(hash) {
711	
712	console.log('hash is:'+hash);
713	location.hash = hash;
714	return false;
715
716	item = "#"+ hash;
717	if ($(item).length){
718		location.hash = item;
719	}else{
720		location.hash = hash;
721	}
722	return;
723	//location.hash = "#" + hash;
724}
725
726		
727})

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.