PageSourceSearch

https://www.happycampus.com/js/knowhowTalkNotify.js?jsVer=20260921.1

js happycampus.com collected 2026-09-24 09:09:01 UTC 5,001 bytes, 240 lines download raw bytes

1var KnowhowTalkNotify = {
2	/**
3	 * 알림 레이어 팝업 html
4	 * @type {jQuery}
5	 */
6	$notify: null,
7	/**
8	 * 팝업 노출 상태
9	 * @type {boolean}
10	 */
11	visibleFlag: false,
12	/**
13	 * 알림 레이어 기본 위치
14	 * @var {number}
15	 */
16	notifyDefaultPos: 0,
17	/**
18	 * 알림 레이어 노출 위치
19	 * @type {number}
20	 */
21	notifyShowPos: 20,
22	/**
23	 * 알림 체크 타이머
24	 * @type {number|null}
25	 */
26	notifyCheckTimer: null,
27	/**
28	 * 마지막 메시지 번호
29	 * @type {number}
30	 */
31	lastChattingSeq: 0,
32	/**
33	 * initialize
34	 */
35	init: function () {
36		//set vars: notify html
37		this.$notify = $('#knowhowTalkNotify');
38
39		//set vars: 레이어 기본 위치 설정
40		var notifyDefaultPos = (this.$notify.height() + 5) * -1;
41		this.notifyDefaultPos = notifyDefaultPos;
42		this.$notify.css('bottom', notifyDefaultPos + 'px');
43
44		//알림 체크 타이머 설정
45		this.setNotifyCheckTimer();
46	},
47	/**
48	 * 로그인 후 첫번째 알림 체크
49	 */
50	checkNotifyAfterLogin: function () {
51		var objNotify = this;
52		var $notify = objNotify.$notify;
53
54		$.ajax({
55			url: '/knowhowTalk/checkNotify',
56			type: 'get',
57			data: {checkType: 'pcAfterLogin'},
58			dataType: 'json',
59			async: false,
60			success: function (json) {
61				if (!json.result) {
62					return false;
63				}
64
65				var totalSenderCount = json.data.totalSenderCount;
66				var lastChattingSeq = json.data.lastChattingSeq;
67
68				if (!totalSenderCount) {
69					return false;
70				}
71				if (objNotify.lastChattingSeq == lastChattingSeq) {
72					return false;
73				}
74
75				objNotify.lastChattingSeq = lastChattingSeq;
76				$notify.find('#knowhowTalkNotifyMsg').html(json.data.html);
77				objNotify.show();
78				return true;
79			}
80		});
81	},
82	/**
83	 * 알림 체크
84	 * @returns {boolean}
85	 */
86	checkNotify: function () {
87		var objNotify = this;
88		var $notify = objNotify.$notify;
89		var retVal = false;
90
91		$.ajax({
92			url: '/knowhowTalk/checkNotify',
93			type: 'get',
94			data: {checkType: 'pc'},
95			dataType: 'json',
96			async: false,
97			success: function (json) {
98				if (!json.result) {
99					objNotify.unsetNotifyCheckTimer();
100					retVal = false;
101					return false;
102				}
103
104				var totalSenderCount = json.data.totalSenderCount;
105				var lastChattingSeq = json.data.lastChattingSeq;
106
107				if (!totalSenderCount) {
108					retVal = false;
109					return false;
110				}
111				if (objNotify.lastChattingSeq == lastChattingSeq) {
112					retVal = false;
113					return false;
114				}
115
116				objNotify.lastChattingSeq = lastChattingSeq;
117				objNotify.hide(false);
118				$notify.find('#knowhowTalkNotifyMsg').html(json.data.html);
119				retVal = true;
120				return true;
121			},
122			error:function(){
123				retVal = false;
124				return false;
125			}
126		});
127
128		return retVal;
129	},
130	/**
131	 * 알림 체크 타이머 설정
132	 */
133	setNotifyCheckTimer: function () {
134		var objNotify = this;
135
136		objNotify.notifyCheckTimer = setInterval(function () {
137			if (objNotify.checkNotify()) {
138				objNotify.show();
139			}
140		}, 10000);
141	},
142	/**
143	 * 알림 체크 타이머 해제
144	 */
145	unsetNotifyCheckTimer: function () {
146		var objNotify = this;
147
148		if (objNotify.notifyCheckTimer > 0) {
149			clearInterval(objNotify.notifyCheckTimer);
150		}
151	},
152	/**
153	 * 알림 노출
154	 * @param {boolean} [animate=true] 애니메이션 적용 여부
155	 */
156	show: function (animate) {
157		//set param default value
158		if (typeof animate == 'undefined') {
159			animate = true;
160		}
161
162		//set vars: notify 객체
163		var objNotify = this;
164
165		//알림이 숨겨진 상태일때만 노출 처리
166		if (!objNotify.visibleFlag) {
167			//set vars: html, layer position
168			var $notify = objNotify.$notify;
169			var bottomPos = objNotify.notifyShowPos;
170
171			objNotify.hideHelp();
172
173			$notify.show();
174
175			if (animate) {
176				$notify.animate(
177					{bottom: bottomPos + 'px'},
178					1000,
179					function () {
180						$notify.stop(true);
181						objNotify.visibleFlag = true;
182					}
183				);
184			} else {
185				$notify.css('bottom', bottomPos + 'px');
186				objNotify.visibleFlag = true;
187			}
188		}
189	},
190	/**
191	 * 알림 숨김
192	 * @param {boolean} [animate=true] 애니메이션 적용 여부
193	 */
194	hide: function (animate) {
195		//set param default value
196		if (typeof animate == 'undefined') {
197			animate = true;
198		}
199
200		//set vars: notify 객체
201		var objNotify = this;
202
203		//알림이 노출된 상태일때만 숨김 처리
204		if (objNotify.visibleFlag) {
205			//set vars: html, layer position
206			var $notify = objNotify.$notify;
207			var bottomPos = objNotify.notifyDefaultPos;
208
209			if (animate) {
210				$notify.animate(
211					{bottom: bottomPos + 'px'},
212					500,
213					function () {
214						$notify.hide();
215						$notify.stop(true);
216						objNotify.visibleFlag = false;
217					}
218				);
219			} else {
220				$notify.hide();
221				$notify.css('bottom', bottomPos + 'px');
222				objNotify.visibleFlag = false;
223			}
224		}
225	},
226	/**
227	 * 알림 안내 노출
228	 */
229	showHelp: function () {
230		var $notify = this.$notify;
231		$notify.find('#knowhowTalkNotifyHelp').show();
232	},
233	/**
234	 * 알림 안내 숨김
235	 */
236	hideHelp: function () {
237		var $notify = this.$notify;
238		$notify.find('#knowhowTalkNotifyHelp').hide();
239	}
240};

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.