PageSourceSearch

http://www.grandculture.net/Content/Script/common.js

js grandculture.net collected 2026-09-24 18:19:02 UTC 11,684 bytes, 314 lines download raw bytes

1
2/* 브라우저 확인
3--------------------------------------------------*/
4var BrowserDetect = {
5    init: function () {
6        this.browser = this.searchString(this.dataBrowser) || "Other";
7        this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown";
8    },
9    searchString: function (data) {
10        for (var i = 0; i < data.length; i++) {
11            var dataString = data[i].string;
12            this.versionSearchString = data[i].subString;
13
14            if (dataString.indexOf(data[i].subString) !== -1) {
15                return data[i].identity;
16            }
17        }
18    },
19    searchVersion: function (dataString) {
20        var index = dataString.indexOf(this.versionSearchString);
21        if (index === -1) {
22            return;
23        }
24
25        var rv = dataString.indexOf("rv:");
26        if (this.versionSearchString === "Trident" && rv !== -1) {
27            return parseFloat(dataString.substring(rv + 3));
28        } else {
29            return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
30        }
31    },
32
33    dataBrowser: [
34        { string: navigator.userAgent, subString: "Edge", identity: "MS Edge" },
35        { string: navigator.userAgent, subString: "MSIE", identity: "Explorer" },
36        { string: navigator.userAgent, subString: "Trident", identity: "Explorer" },
37        { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" },
38        { string: navigator.userAgent, subString: "Opera", identity: "Opera" },
39        { string: navigator.userAgent, subString: "OPR", identity: "Opera" },
40        { string: navigator.userAgent, subString: "Chrome", identity: "Chrome" },
41        { string: navigator.userAgent, subString: "Safari", identity: "Safari" }
42    ]
43};
44
45
46/* 윈도우 팝업
47--------------------------------------------------*/
48function popupChron(local, item, lang)  // 전자연표
49{
50    var url = 'http://chron.grandculture.net/?local=' + local + '&item=' + encodeURI(item) + '&lang=' + lang + '&v=2';  // 프레임웍 버전 파라미터 추가
51    popup(url, 'chron', 1000, 712, 100, 100, 1, 1);
52}
53function popupGis(local, item, lang)    // 전자지도
54{
55    var url = 'http://map1.grandculture.net/?local=' + local + '&name=' + encodeURI(item) + '&lang=' + lang;
56    popup(url, 'map', 980, 600, 100, 100, 1);
57}
58function viewOriginImg(el)  // 원본 이미지 팝업
59{
60    popup('/' + $(el).data('local') + '/popup/multimedia/' + $(el).data('id'), 'mediaPop', 10, 10, 1, 1);
61}
62
63
64/* 파일 다운로드
65--------------------------------------------------*/
66function downloadKOGL(link) // 공공누리 다운로드
67{
68    $('#emptyWin')[0].src = '/' + $(link).data('local') + '/Post/Contents/DownloadKOGL?id=' + $(link).data('id') + '&ext=' + $(link).data('ext');
69}
70function downloadXML(link)  // XML 원문 다운로드
71{
72    $('#emptyWin')[0].src = '/' + $(link).data('local') + '/Post/Contents/DownloadXML?id=' + $(link).data('id');
73}
74
75
76/* 마을이야기
77--------------------------------------------------*/
78function townstory(localname, town, url, width, height) // old : vill
79{
80    var popWidth = width || 900;
81    var popHeight = height || 700;
82
83    var name = 'townstory'
84    if (url) {
85        popup(url, name, popWidth, popHeight, null, null, 1, 1);
86    }
87    else if (localname) {
88        if (town) {
89            popup("http://story.grandculture.net/service/TownStory.aspx?NAME_AREA=" + localname + "&NAME_TOWN=" + town, name, popWidth, popHeight, null, null, 1, 1);
90        }
91        else {
92            popup("http://story.grandculture.net/service/TownMain.aspx?NAME_AREA=" + localname, name, popWidth, popHeight, null, null, 1, 1);
93        }
94
95    }
96    else {
97        alert("대상 지역 정보 또는 URL 정보가 필요합니다.");
98    }
99}
100
101/* 복사 시 출처정보 삽입
102--------------------------------------------------*/
103function addSource()
104{
105    var selection = window.getSelection();
106    var sourceInfo = '<br /><br />[출처] 한국학중앙연구원 - 향토문화전자대전';
107    var copytext = selection + sourceInfo;
108    var newdiv = document.createElement('div');
109
110    newdiv.style.position = 'absolute';
111    newdiv.style.left = '-99999px';
112
113    document.body.appendChild(newdiv);
114    newdiv.innerHTML = copytext;
115    selection.selectAllChildren(newdiv);
116
117    window.setTimeout(function () {
118        document.body.removeChild(newdiv);
119    }, 100);
120}
121
122/* 통합검색
123--------------------------------------------------*/
124function mainSearch(e)  // 통합검색
125{
126    e.preventDefault();
127    var form = e.target;
128
129    if (form.input_keyword.value.length < 1) {
130        alert('검색어를 입력하여 주십시요!');
131        form.input_keyword.focus();
132    }
133    else {
134        var collection = form.collection.value.length > 0 ? "&collection=" + form.collection.value : "";
135        form.keyword.value = $.trim(form.input_keyword.value.replace(/["']/g, ' '));    // 질의어 인용부호 제거
136        searchLog(form.local.value, form.keyword.value);
137
138        window.location = "/" + form.local.value + "/search?keyword=" + encodeURI(form.keyword.value) + collection;
139    }
140}
141function mainSearchKeyword(keyword)    // 통합검색 : 검색어 지정
142{
143    if (keyword.length < 1) {
144        alert('검색어를 입력하여 주십시요!');
145    }
146    else {
147        var form = document.getElementById("searchForm");
148        keyword = $.trim(keyword.replace(/["']/g, ' '));    // 질의어 인용부호 제거
149        searchLog(form.local.value, keyword);
150
151        if (form.local.value == '') {
152            window.location = "/search?keyword=" + encodeURI(keyword);
153        } else {
154            window.location = "/" + form.local.value + "/search?keyword=" + encodeURI(keyword);
155        }
156    }
157}
158
159function mainSearchKeywordForm(keyword, hashtag, collection, page, pagesize, facet, sort)    // 통합검색 : 검색어 지정
160{
161    if ($.trim(keyword).length < 1) {
162        alert('검색어를 입력하여 주십시오.');
163    }
164    else {
165        var form = document.getElementById("searchForm");
166        keyword = $.trim(keyword.replace(/["']/g, ' '));    // 질의어 인용부호 제거
167        searchLog(form.local.value, keyword);
168
169        form.keyword.value = keyword;
170        form.hashtag.value = (hashtag == null || typeof hashtag == undefined) ? '' : hashtag;
171        form.collection.value = (collection == null || typeof collection == undefined) ? '' : collection;
172        form.page.value = (page == null || typeof page == undefined) ? '' : page;
173        form.pageSize.value = (pagesize == null || typeof pagesize == undefined) ? '' : pagesize;
174        form.facet.value = (facet == null || typeof facet == undefined) ? '' : facet;
175        form.sort.value = (sort == null || typeof sort == undefined) ? '' : sort;
176
177        form.submit();
178    }
179}
180
181function mainSearchKeywordHashTag(keyword, hashtag)    // 통합검색 : 키워드 해쉬태그 검색
182{
183    if (keyword.length < 1) {
184        alert('검색어를 입력하여 주십시요!');
185    }
186    else if (hashtag.length < 1) {
187        alert('해쉬태그를 확인하세요!');
188    }
189    else {
190        var form = document.getElementById("searchForm");
191        keyword = $.trim(keyword.replace(/["']/g, ' '));    // 질의어 인용부호 제거
192        searchLog(form.local.value, keyword);
193
194        if (form.local.value == '') {
195            window.location = "/search?keyword=" + encodeURI(keyword) + "&hashtag=" + encodeURI(hashtag);
196        } else {
197            window.location = "/" + form.local.value + "/search?keyword=" + encodeURI(keyword) + "&hashtag=" + encodeURI(hashtag);
198        }
199    }
200}
201
202function mainSearchKeywordHashTagForm(keyword, hashtag)    // 통합검색 : 키워드 해쉬태그 검색
203{
204    if (keyword.length < 1) {
205        alert('검색어를 입력하여 주십시요!');
206    }
207    else if (hashtag.length < 1) {
208        alert('해쉬태그를 확인하세요!');
209    }
210    else {
211        var form = document.getElementById("searchForm");
212        keyword = $.trim(keyword.replace(/["']/g, ' '));    // 질의어 인용부호 제거
213        searchLog(form.local.value, keyword);
214
215        form.keyword.value = keyword;
216        form.hashtag.value = hashtag;
217        form.collection.value = '';
218        form.page.value = '';
219        form.pageSize.value = '';
220        form.facet.value = '';
221        form.sort.value = '';
222
223        form.submit();
224    }
225}
226
227function mainSearchSubInput(e)    // 통합검색 : 검색어 지정
228{
229    if (e.keyCode == 13) {
230        if ($(e.target).hasClass('action-search-form')) {
231            mainSearchKeywordForm(e.target.value);
232        } else {
233            mainSearchKeyword(e.target.value);
234        }
235    }
236}
237function searchLog(localName, requestKeyword)
238{
239    if (localName == '') {
240        return;
241    }
242
243    var keyword = requestKeyword.toLowerCase();
244
245    // 검색어에 연산자와 관련된 내용이 있으면, 이를 검색어 로그에 기록하지 않음 - 기관요청 [2009.11.23]
246    if (keyword.indexOf(' and ') >= 0 || keyword.indexOf(' or ') >= 0 || keyword.indexOf('&') >= 0 || keyword.indexOf('|') >= 0) {
247        return;
248    }
249
250    $.ajax({
251        url: '/' + localName + '/Post/Contents/WriteSearchLog',
252        async: false,
253        data: { 'keyword': $.trim(keyword) }
254    });
255}
256
257
258/* 게시판 검색
259--------------------------------------------------*/
260function boardSearch(e)
261{
262    e.preventDefault();
263    var form = e.target;
264
265    if (form.input_keyword.value.length < 1) {
266        alert('검색어를 입력하여 주십시요!');
267        form.input_keyword.focus();
268    }
269    else {
270        var category = form.category ? "&category=" + form.category.value : "";
271        form.keyword.value = $.trim(form.input_keyword.value.replace(/["']/g, ' '));    // 질의어 인용부호 제거
272        window.location = form.action + "?search=" + encodeURI(form.keyword.value) + "&searchType=" + form.searchType.value + category;
273    }
274}
275
276
277
278$(document).ready(function () {
279
280    BrowserDetect.init();
281
282    var searchForm = document.getElementById("searchForm");
283    if (searchForm && searchForm.addEventListener) {
284        searchForm.addEventListener("submit", mainSearch, false);
285    }
286    else if (searchForm && searchForm.attachEvent) {
287        searchForm.attachEvent("onsubmit", mainSearch, false);
288    }
289
290    var searchSubInput = document.getElementById("search-sub-input");
291    if (searchSubInput && searchSubInput.addEventListener) {
292        searchSubInput.addEventListener("keydown", mainSearchSubInput, false);
293    }
294    else if (searchSubInput && searchSubInput.attachEvent) {
295        searchSubInput.attachEvent("onkeydown", mainSearchSubInput, false);
296    }
297
298    var searchSubInput2 = document.getElementById("input-sw");
299    if (searchSubInput2 && searchSubInput2.addEventListener) {
300        searchSubInput2.addEventListener("keydown", mainSearchSubInput, false);
301    }
302    else if (searchSubInput2 && searchSubInput2.attachEvent) {
303        searchSubInput2.attachEvent("onkeydown", mainSearchSubInput, false);
304    }
305
306    var boardForm = document.getElementById("boardSearchForm");
307    if (boardForm && boardForm.addEventListener) {
308        boardForm.addEventListener("submit", boardSearch, false);
309    }
310    else if (boardForm && boardForm.attachEvent) {
311        boardForm.attachEvent("onsubmit", boardSearch, false);
312    }
313
314});

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.