PageSourceSearch

https://nl.go.kr/resource/common/jquery_plugin/validation/accessability.js

js nl.go.kr collected 2026-10-02 10:22:26 UTC 3,734 bytes, 105 lines download raw bytes

1/*--
2    웹접근성 체크, [email protected]
3    Copyright (C) 2018, harangi
4	All rights reserved.
5
6    Redistribution and use in source and binary forms, with or without
7    modification, are permitted provided that the following conditions are
8    met:
9
10        * Redistributions of source code must retain the above copyright
11        notice, this list of conditions and the following disclaimer.
12        * Redistributions in binary form must reproduce the above copyright
13        notice, this list of conditions and the following disclaimer in the
14        documentation and/or other materials provided with the distribution.
15        * Neither the name of the <ORGANIZATION> nor the names of its
16        contributors may be used to endorse or promote products derived from
17        this software without specific prior written permission.
18
19    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
23    OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31--*/
32function checkAccessability(title,target) {
33	var result = true;
34
35	/*
36	이미지 alt 체크
37	콘텐츠내에 이미지 요소를 모두 찾아 alt 속성 존재여부와 속성값이 존재하는지 확인
38	*/
39	$("#" + target + " img").each(function(index, item){
40//		console.log(index + " alt : " + $(this).attr("alt"));
41		var isAlt = $(this).is('[alt]');//boolean
42		if (!isAlt && result) {
43			result = false;
44			alert("["+title+"] "+(index+1)+"번째 이미지 alt 속성이 존재하지 않습니다.");
45		}
46
47		if (result) {
48			var altTxt = $(this).attr("alt");
49			if (!altTxt || altTxt == "") {
50				result = false;
51				alert("["+title+"] "+(index+1)+"번째 이미지 alt 속성값이 비어있습니다.");
52			}
53		}
54	});
55
56//	result = true;
57	/*
58	테이블 summary, caption 체크
59	*/
60	$("#" + target + " table").each(function(index, item){
61		/*
62		콘텐츠내에 테이블 요소를 모두 찾아 summary 속성 존재여부와 속성값 체크
63		*/
64		var summary = true;
65//		console.log(index + " summary : " + $(this).attr("summary"));
66		var isSummary = $(this).is('[summary]');//boolean
67		if (!isSummary && summary) {
68			summary = false;
69//			alert((index+1)+"번째 표에 summary 속성이 존재하지 않습니다.");
70		}
71
72		if (summary) {
73			var summaryTxt = $(this).attr("summary");
74			if (!summaryTxt || summaryTxt == "") {
75				summary = false;
76//				alert((index+1)+"번째 표에 summary 속성값이 비어있습니다.");
77			}
78		}
79
80		/*
81		caption 요소 존재여부와 요소값 확인
82		*/
83		var caption = true;
84		var isCaption = $(this).find("caption").length;
85//		console.log(index + " caption : " + isCaption);
86		if (isCaption == 0 && caption) {
87			caption = false;
88		}
89
90		if (caption) {
91			var captionTxt = $(this).find("caption").text();
92//			console.log(index + " caption : " + captionTxt);
93			if (!captionTxt || captionTxt == "") {
94				caption = false;
95			}
96		}
97
98		if (result && (!summary && !caption)) {
99			result = false;
100			alert("["+title+"] "+(index+1)+"번째 표에 summary 와 caption 값이 존재하지 않습니다.");
101		}
102	});
103
104	return result;
105}

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.