PageSourceSearch

https://www.kisa.or.kr/resource/kor/js/pagination.js

js kisa.or.kr collected 2026-09-24 08:27:36 UTC 3,817 bytes, 110 lines download raw bytes

1$(function() {
2	renderPagination(currentPage); //페이지네이션 그리는 함수
3	
4	$("#pagination a").click(function (e) {
5		var page = $(this).attr("name");
6		search(page);
7	});
8});
9
10function renderPagination(currentPage) {
11	var totalPage;
12	if (totalNum != 0) {
13		totalPage = Math.ceil(totalNum / pageSize);
14	} else {
15		totalPage = 1; // default total page
16	}
17	
18	$("#totalPage").text(totalPage); // 전체 페이지수
19	$("#currentPage").text(currentPage); // 현재 페이지 / 전체 페이지
20	
21	if (totalNum <= pageSize) return;
22	
23	var pageGroup = Math.ceil(currentPage / pageScale);
24	var last = pageGroup * pageScale;
25	
26	if (last > totalPage) last = totalPage;
27	
28	var first = last - (pageScale - 1) <= 0 ? 1 : last - (pageScale - 1);
29	var next = last + 1;
30	var prev = first - 1;
31	var fragmentPage = document.createDocumentFragment();
32	
33	if (prev > 0) {
34		var allprev = document.createElement("a");
35		allprev.setAttribute('href', '#js-bottom');
36		allprev.setAttribute('id', 'allprev');
37		allprev.setAttribute('class', 'btn first');
38		allprev.setAttribute('name', 1);
39		allprev.setAttribute('title', '첫 페이지');
40		var blindSpanFirst = document.createElement("span");
41		blindSpanFirst.setAttribute('class', 'blind');
42		var blindTextFirst = document.createTextNode('첫 페이지');
43		blindSpanFirst.appendChild(blindTextFirst);
44		allprev.appendChild(blindSpanFirst);
45		
46		var prev = document.createElement("a");
47		prev.setAttribute('href', '#js-bottom');
48		prev.setAttribute('id', 'prev');
49		prev.setAttribute('class', 'btn prev');
50		prev.setAttribute('name', first - 1);
51		prev.setAttribute('title', '이전 페이지');
52		var blindSpanPrev = document.createElement("span");
53		blindSpanPrev.setAttribute('class', 'blind');
54		var blindTextPrev = document.createTextNode('이전 페이지');
55		blindSpanPrev.appendChild(blindTextPrev);
56		prev.appendChild(blindSpanPrev);
57		
58		fragmentPage.appendChild(allprev);
59		fragmentPage.appendChild(prev);
60	}
61	
62	for (var i = first; i <= last; i++) {
63		var aTag = document.createElement("a");
64		var textNode = document.createTextNode(i);
65		aTag.setAttribute('href', '#js-bottom');
66		aTag.setAttribute('id', 'page-' + i);
67		aTag.setAttribute('data-num', i);
68		aTag.setAttribute('name', i);
69		aTag.appendChild(textNode);
70		fragmentPage.appendChild(aTag);
71	}
72	
73	if (last < totalPage) {
74		var allend = document.createElement("a");
75		allend.setAttribute('href', '#js-bottom');
76		allend.setAttribute('id', 'allnext');
77		allend.setAttribute('class', 'btn next');
78		allend.setAttribute('name', last + 1);
79		allend.setAttribute('title', '다음 페이지');
80		var blindSpanNext = document.createElement("span");
81		blindSpanNext.setAttribute('class', 'blind');
82		var blindTextNext = document.createTextNode('다음 페이지');
83		blindSpanNext.appendChild(blindTextNext);
84		allend.appendChild(blindSpanNext);
85		
86		var end = document.createElement("a");
87		end.setAttribute('href', '#js-program-detail-bottom');
88		end.setAttribute('id', 'next');
89		end.setAttribute('class', 'btn last');
90		end.setAttribute('name', totalPage);
91		end.setAttribute('title', '마지막 페이지');
92		var blindSpanLast = document.createElement("span");
93		blindSpanLast.setAttribute('class', 'blind');
94		var blindTextLast = document.createTextNode('마지막 페이지');
95		blindSpanLast.appendChild(blindTextLast);
96		end.appendChild(blindSpanLast);
97		
98		fragmentPage.appendChild(allend);
99		fragmentPage.appendChild(end);
100	}
101	
102	document.getElementById('pagination').appendChild(fragmentPage);
103	$("#page-" + currentPage).addClass('on');
104	$("#page-" + currentPage).attr('title','현재 페이지');
105}
106
107function search(page) {
108	$('#searchFm')[0].page.value = page;
109	$('#searchFm').submit();
110}

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.