PageSourceSearch

https://www.e-inspot.com/lib/js/front/news.js?var=20261002090644

js e-inspot.com collected 2026-10-02 00:08:23 UTC 8,494 bytes, 288 lines download raw bytes

1/**
2 * news 처리
3 */
4
5var newsFunc = null;
6
7$(function() {
8	$.funcNews = function() {
9		var _this = this;
10		
11		this.opt = {
12			"nId":""
13			, "lastNId":""
14			, "recordCountPerPage": 6
15			, "searchType":""
16			, "searchText":""
17			, "orderBy":"show_date"
18			, "moreCnt":0
19		}
20
21		//리스트 화면 초기화
22		this.listInit = function() {
23			
24			$('#more_btn').on('click', function(e) {
25				
26				e.preventDefault();
27				
28				_this.getListMoreData();
29			})
30			
31			$(document).on('click', '#news_list .news-list a', function(e) {
32				
33				e.preventDefault();
34				
35				var linkUrl = $(this).closest('.news-list').attr('data-linkUrl');
36				var nId = $(this).closest('.news-list').attr('data-nId');
37
38				_this.goView(linkUrl, nId);
39			})
40			
41			_this.getListMoreData();
42		}
43		
44		//보기 화면 초기화
45		this.infoInit = function(nId) {
46			_this.opt.nId = nId;
47			
48			//목록버튼 클립이벤트
49			$('.view-nav-wrap .view-back a').on('click', function(e) {
50				e.preventDefault();
51				document.location.href = '/board/' + _this.opt.bbsCd + '/list/1';
52			})
53			
54			_this.getInfoData();
55		}
56		
57		//리스트 페이지 이동
58		this.goList = function(page) {
59			if (page == "" || page == null) {
60				page = 1;
61			}
62			document.location.href = "/news";
63		}
64		
65		//리스트 페이지 이동
66		this.goView = function(linkUrl, nId) {
67			$.cookie('c_searchType', _this.opt.searchType, {path:'/news'});
68			$.cookie('c_searchText', _this.opt.searchText, {path:'/news'});
69			$.cookie('c_scrollTop', $(document).scrollTop(), {path:'/news'});
70			$.cookie('c_nId', nId, {path:'/news'});
71			
72			//var orderBy = "postId";
73			$.cookie('c_orderBy', _this.opt.orderBy, {path:'/news'});
74			//$.cookie('c_page', _this.opt.page, {path:'/board/' + _this.opt.bbsCd});
75			//_this.opt.orderBy = orderBy;
76			
77			$.cookie('c_moreCnt', _this.opt.moreCnt, {path:'/news'});
78			
79			document.location.href = linkUrl + '?orderBy=' + _this.opt.orderBy;
80		}
81		
82		this.isLogin = function(){
83			if(mebrweb_user_id == null || mebrweb_user_id == ""){ 
84            	openPopup('loginPopup');
85				return false;
86          	}
87          	return true;
88		}
89		
90		//리스트 더보기 형태로 가져오기
91		this.getListMoreData = function() {
92			
93			var param = {
94				"recordCountPerPage":_this.opt.recordCountPerPage
95				, "lastNId": _this.opt.lastNId
96				, "orderBy":_this.opt.orderBy
97			}
98			
99			if ($.cookie('c_sort') != undefined) {
100			
101				$.removeCookie('c_sort', {path:'/news'});
102			}
103			
104			$.ajax({
105				url: '/api/v1/news/listMoreData',		// 요청 할 주소
106				async:true,							// false 일 경우 동기 요청으로 변경
107				type:'GET', 							// GET, PUT, DELETE
108				data: param,										// 전송할 데이터
109				dataType:'json',						// xml, json, script, html
110				beforeSend:function(jqXHR) {		// 서버 요청 전 호출 되는 함수 return false; 일 경우 요청 중단
111					//addLoading();
112				},	
113				success:function(jqXHR) {			// 요청 완료 시
114
115					var resultCode = jqXHR.header.code;
116					var resultMsg = jqXHR.header.message;
117					
118					var listMoreCnt = jqXHR.data.listMoreCnt;
119					
120					if (resultCode == "C000") {
121						
122						if (_this.opt.lastNId == '') {
123							$('#news_list .news-list').remove();
124						}
125						
126						$(jqXHR.data.newsList).each(function(idx) {
127							news = jqXHR.data.newsList[idx];
128							
129							thumbImg = _this.getFileData(news.lstFile, 'thumb');
130							
131							addRow  = '	<div class="news-list type0' + (idx + 1) % 3 + '" data-linkUrl="/news/info/' + news.nId + '" data-nId="'+ news.nId + '">';
132							addRow += '		<a href="#" class="row no-gutters" title="뉴스 뷰페이지로 이동">';
133							addRow += '			<div class="col-md-6">';
134							addRow += '				<p class="thumb"><img src="/common/imageShow/' + thumbImg.fileId + '" class="w-100" alt=""></p>';
135							addRow += '			</div>';
136							addRow += '			<div class="col-md-6 tit-wrap">';
137							addRow += '				<div class="tit">';
138							addRow += '					<p class="headline">' + news.title + '</p>';
139							addRow += '					<p class="date"><span></span>' + news.showDate + '</p>';
140							addRow += '				</div>';
141							addRow += '			</div>';
142							addRow += '			<span class="clearfix"></span>';
143							addRow += '			<p class="btn-arrow-right"><span></span></p>';
144							addRow += '		</a>';
145							addRow += '	</div>';
146							
147							$('#news_list').append(addRow);
148							_this.opt.lastNId = news.nId;
149						});
150						
151						if (listMoreCnt > jqXHR.data.newsList.length) {
152							$('#more_btn').show();
153						} else {
154							$('#more_btn').hide();
155						}
156						
157						_this.opt.moreCnt++;
158						
159						if ($.cookie('c_moreCnt') != undefined && parseInt($.cookie('c_moreCnt'), 10) > _this.opt.moreCnt) {
160							if ($.cookie('c_nId') != undefined && $('#news_list .news-list[data-nId="' + $.cookie('c_nId') + '"]').length < 1) {
161								$('#more_btn').click();
162								return;
163							}
164						} else {
165							$.removeCookie('c_moreCnt', {path:'/news'});
166						}
167						
168						if ($.cookie('c_scrollTop') != undefined) {
169							
170							$('html, body').animate({"scrollTop":$.cookie('c_scrollTop')});
171							
172							$.removeCookie('c_scrollTop', {path:'/news'});
173							$.removeCookie('c_recordCountPerPage', {path:'/news'});
174							$.removeCookie('c_nId', {path:'/news'});
175							
176							$.removeCookie('c_moreCnt', {path:'/news'});
177							
178						}
179						
180					} else {
181						customAlert({message: resultMsg, btn_txt1:"확인"});
182					}
183				},		
184				error:function(jqXHR) {					// 요청 실패.
185					
186				},		
187				complete:function(jqXHR) {				// 요청의 실패, 성공과 상관 없이 완료 될 경우 호출
188					//removeLoading();
189				}
190			});
191		}
192		
193		//게시물 정보 가져오기
194		this.getInfoData = function(mode = '') {
195
196			var param = {
197				"nId": _this.opt.nId
198				, "orderBy":$.cookie('c_orderBy')
199			}
200			
201			$.ajax({
202				url: '/api/v1/news/infoData',		// 요청 할 주소
203				async:true,							// false 일 경우 동기 요청으로 변경
204				type:'GET', 							// GET, PUT, DELETE
205				data: param,										// 전송할 데이터
206				dataType:'json',						// xml, json, script, html
207				beforeSend:function(jqXHR) {		// 서버 요청 전 호출 되는 함수 return false; 일 경우 요청 중단
208					//addLoading();
209				},	
210				success:function(jqXHR) {			// 요청 완료 시
211					
212					var resultCode = jqXHR.header.code;
213					var resultMsg = jqXHR.header.message;
214					
215					if (resultCode == "C000") {
216						
217						var newsInfo = jqXHR.data.newsInfo;
218							
219						var newsPrevNextInfo = jqXHR.data.newsPrevNextInfo;
220						
221						$('#title').html('<span></span>' + newsInfo.title.replace(/<br[^>]*>/gi," "));
222						$('#showDate').text(newsInfo.showDate);
223						
224						$('#contents').html(newsInfo.contents);
225						
226						var lstAtchFileVO = newsInfo.lstFile;
227						
228						/*
229						fileUploadFunc.setFilesInfoForView(bbsPostInfo.bbsId, lstAtchFileVO);
230						*/
231
232						if (newsPrevNextInfo != undefined) {
233							//이전글 버튼
234							$('.paging-wrap .prev .title').html(newsPrevNextInfo.prevTitle == "" ? '첫번째 게시물 입니다.':newsPrevNextInfo.prevTitle);
235							$('.paging-wrap .prev a').on('click', function(e) {
236								e.preventDefault();
237								
238								if (newsPrevNextInfo.prevNId == "") {
239									return;
240								} else {
241									document.location.href = '/news/info/' + newsPrevNextInfo.prevNId + '?orderBy=' + $.cookie('c_orderBy');
242								}
243							});
244							
245							//다음글 버튼
246							$('.paging-wrap .next .title').html(newsPrevNextInfo.nextTitle == "" ? '마지막 게시물 입니다.':newsPrevNextInfo.nextTitle);
247							$('.paging-wrap .next a').on('click', function(e) {
248								e.preventDefault();
249								
250								if (newsPrevNextInfo.nextNId == "") {
251									return;
252								} else {
253									document.location.href = '/news/info/' + newsPrevNextInfo.nextNId + '?orderBy=' + $.cookie('c_orderBy');
254								}
255							});
256						}
257					} else {
258						alert(resultMsg);
259					}
260				},		
261				error:function(jqXHR) {					// 요청 실패.
262					
263				},		
264				complete:function(jqXHR) {				// 요청의 실패, 성공과 상관 없이 완료 될 경우 호출
265					//removeLoading();
266				}
267			});
268		}
269		
270		this.getFileData = function(lstFile, fileKnd) {
271			var fileInfo = [];
272			if (lstFile != "") {
273				for (var i = 0 ; i < lstFile.length ; i++) {
274					if (lstFile[i].fileKnd == fileKnd) {
275						fileInfo.push(lstFile[i])
276					}
277				}
278				
279				if (fileInfo.length == 1) {
280					fileInfo = fileInfo[0];
281				}
282			}
283			
284			return fileInfo;
285		}
286	}
287});
288

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.