PageSourceSearch

https://gall.dcinside.com/_js/gallery_right_login.js?260911

js dcinside.com collected 2026-10-01 10:28:51 UTC 9,618 bytes, 283 lines download raw bytes

1/*
2 * 갤러리 우측 로그인 박스 스크립트
3 * 2018.02.05 - jhcho
4 * 
5 */
6
7/*
8 * 알림 리스트
9 */
10
11//알림 목록 레이어 열기/닫기
12var alarmList = function(toggleElm, toggleClass, type) {
13	//console.log(toggleElm)
14	//console.log(toggleClass)
15	//console.log(type)
16	var chk_view = 'N';
17	//console.log($('#alarmList').css('position'))
18	//console.log($('#alarmList').css('display'))
19	if(type == 'H'){
20		if($('#alarmList').css('position') != 'fixed' && $('#alarmList').css('display') == 'block') chk_view = 'Y';
21		$('#alarmList').css({'top':'50%','left':'50%','margin-left':'-210px','margin-top':'-118px','right':'','position':'fixed'});
22		$('#alarmConf').css({'top':'50%','left':'50%','margin-left':'-210px','margin-top':'-118px','right':'','position':'fixed'});
23	}else if(type == 'G'){
24		if($('#alarmList').css('position') != 'fixed' && $('#alarmList').css('display') == 'block') chk_view = 'Y';
25	}else if(type == 'W'){
26		if($('#alarmList').css('position') == 'fixed' && $('#alarmList').css('display') == 'block') chk_view = 'Y';
27		$('#alarmList').css({'top':'145px','left':'','margin-left':'','margin-top':'','right':'-1px','position':''});
28		$('#alarmConf').css({'top':'145px','left':'','margin-left':'','margin-top':'','right':'-1px','position':''});
29	}else{
30		if($('#alarmList').css('position') == 'fixed' && $('#alarmList').css('display') == 'block') chk_view = 'Y';
31		$('#alarmList').css({'top':'79px','left':'','margin-left':'','margin-top':'','right':'-1px','position':''});
32		$('#alarmConf').css({'top':'79px','left':'','margin-left':'','margin-top':'','right':'-1px','position':''});
33	}
34	//console.log(chk_view)
35 if($('#alarmList').css('display') == 'none') {
36	 login_box_layer_close();
37 	
38 	$('#alarmList').show();
39 	
40	$(toggleElm).removeClass(toggleClass);
41	
42	if(typeof(alarmClearNew) == 'function') {
43		alarmClearNew();	// alarm_polling.js
44	}
45 }
46 else {
47	 if(chk_view == 'N'){
48		 alarmListClose();
49		 alarmConfClose();
50	 }
51 }
52};
53
54//알림 목록 레이어 닫기
55var alarmListClose = function() {
56	$('#alarmList').hide();
57};
58
59///////////////////////////////////////////////////////////////////////////////
60
61/*
62 * 알림 설정
63 */
64
65// 알림 설정 레이어 열기/닫기
66var alarmConf = function() {
67    if($('#alarmConf').css('display') == 'none') {
68    	login_box_layer_close();
69    	$('#alarmConf').show();
70    }
71    else {
72    	alarmConfClose();
73    }
74};
75
76// 알림 on/off
77var alarmConfToggle = function(type) {
78	if($('#alarmConf .'+type+' button').hasClass('on')){
79		$('#alarmConf .'+type+' button').removeClass('on');
80		$('#alarmConf .'+type+' .blind').text('off');
81	}else{
82		$('#alarmConf .'+type+' button').addClass('on');
83		$('#alarmConf .'+type+' .blind').text('on');
84	}
85	var popup = $('#alarmConf .popup button').hasClass('on');
86	var reply = $('#alarmConf .reply button').hasClass('on');
87	var reReply = $('#alarmConf .reReply button').hasClass('on');
88	var pum = $('#alarmConf .pum button').hasClass('on');
89    var rtbest = $('#alarmConf .rtbest button').hasClass('on');
90	
91	if(type == 'popup' && popup){
92		$('#alarmConf .setting_onoff button').addClass('on');
93		$('#alarmConf .setting_onoff .blind').text('on');
94	}else if(type == 'popup' && !popup){
95		$('#alarmConf .setting_onoff button').removeClass('on');
96		$('#alarmConf .setting_onoff .blind').text('off');
97	}else if(type =='reply' || type =='reReply' || type =='pum' || type =='rtbest'){
98		if((reply || reReply || pum || rtbest) && !popup){
99			$('#alarmConf .popup button').addClass('on');
100			$('#alarmConf .popup .blind').text('on')
101		}else if(!reply && !reReply && !pum && !rtbest && popup){
102			$('#alarmConf .popup button').removeClass('on');
103			$('#alarmConf .popup .blind').text('off')
104		}
105	}
106}
107
108// 알림 설정 레이어 닫기
109var alarmConfClose = function() {
110	$('#alarmConf').hide();
111};
112
113// [실베알림] 수정4 여기부터 (2026-09-14 추가) : 알림 설정 켬/끔을 GA4 로도 보낸다
114//   서버 셀별 집계와 같은 시점·같은 조건에서 보낸다. 대신 GA 는 차단기에 막혀 숫자가 더 적게 잡힌다.
115//   바뀌었는지는 「화면이 그려질 때의 값」과 비교한다. 서버는 쿠키로 비교하므로 탭을 여러 개 열어 두면
116//   어긋날 수 있는데, 판정의 원본은 어디까지나 서버 집계다.
117var rtb_conf_prev = null;
118
119$(function() {
120    var $rtb = $('#alarmConf .setting_onoff.rtbest button');
121
122    if($rtb.length) {
123        rtb_conf_prev = $rtb.hasClass('on') ? 1 : 0;
124    }
125});
126// [실베알림] 수정4 여기까지
127
128// 알림 설정 저장
129var alarmConfUpdate = function() {
130	var conf = new Object;
131	var csrf_token = get_cookie('ci_c');
132	
133	$('#alarmConf .setting_onoff > button').each(function() {
134		var status = $(this).hasClass('on') ? 1 : 0;
135
136		conf[$(this).attr('data-id')] = status;
137	});
138	
139	if(Object.keys(conf).length > 0) {
140		$.ajax({
141			url: "//gall.dcinside.com/ajax/alarm_ajax/conf_update?jsoncallback=?",
142			type : "GET",
143			cache: false,
144		    async: false,
145		    dataType: 'json',
146            data : (function() {
147                var d = { ci_t : csrf_token, conf : conf };
148                if(typeof rtb_get === 'function' && typeof RTB_K_CELL !== 'undefined') {
149                    var rtb_cell = rtb_get(RTB_K_CELL);
150                    if(rtb_cell) {
151                        d.rtb_cell = rtb_cell;
152                        d.rtb_gt   = (typeof _GALLERY_TYPE_ !== 'undefined' && _GALLERY_TYPE_) ? _GALLERY_TYPE_ : '';
153                    }
154                }
155                return d;
156            })(),
157			success: function(res) {
158				if(res === '0000') {
159                    if(typeof rtb_ga === 'function' && rtb_conf_prev !== null && typeof conf.rtbest !== 'undefined' && conf.rtbest !== rtb_conf_prev) {
160                        rtb_ga(conf.rtbest ? 'rtb_alarm_on' : 'rtb_alarm_off');
161                        rtb_conf_prev = conf.rtbest;
162                    }
163					alert('적용되었습니다.');
164					alarmConfClose();
165				}
166				else {
167					alert('일시적인 오류로 저장되지 않았습니다.');
168				}
169			}
170		});
171	}
172};
173
174// 우측 로그인박스 내 레이어 팝업 전체 닫기 (화살표 닫힘으로 변경 포함)
175var login_box_layer_close = function() {
176	if($('.login_box .pop_wrap, .login_wrap .pop_wrap').length > 0){
177		$('.login_box .pop_wrap, .login_wrap .pop_wrap').hide();
178		$('#my_favorite').hide();
179		$('#alarmList').hide();
180		$('.login_box .icon_favorites').addClass('hide');
181		$('.login_box .icon_admin').addClass('hide');
182	}else{
183		$('#top .dchead .pop_wrap').hide();
184	}
185}
186
187//실베 배지 설정 저장
188var bestconConfToggle = function(elm) {
189    
190    var confirm_msg = ($(elm).hasClass('on'))?'실베 갤러콘을 사용 중지하시겠습니까?':'실베 갤러콘을 사용하시겠습니까?';
191    
192    if(!confirm(confirm_msg)) {
193        return false;
194    }
195    var conf = new Object;
196    var csrf_token = get_cookie('ci_c');
197    var status = 0;
198    
199    $('#bestConConf .setting_onoff > button').each(function() {
200        status = $(this).hasClass('on') ? 0 : 1;
201
202        conf[$(this).attr('data-id')] = status;
203    });
204    
205    
206    
207    if(Object.keys(conf).length > 0) {
208        $.ajax({
209            url: "//gall.dcinside.com/ajax/gallercon_ajax/conf_update?jsoncallback=?",
210            type : "GET",
211            cache: false,
212            async: false,
213            dataType: 'json',
214            data : {
215                ci_t : csrf_token,
216                conf : conf
217            },
218            success: function(res) {
219                if(res === '0000') {
220                    var alet_msg = (!status)?'실베 갤러콘이 미적용되었습니다.':'실베 갤러콘이 적용되었습니다.';
221                    if(!status) {
222                        $(elm).removeClass('on');
223                        $('.blind', elm).text('off');
224                    } else {
225                        $(elm).addClass('on');
226                        $('.blind', elm).text('on');
227                    }
228                    
229                    alert(alet_msg);
230                    
231                }
232                else {
233                    if(res === '0001') {
234                        alert('하루 변경 횟수가 초과되었습니다.');
235                    }else {
236                        alert('일시적인 오류로 저장되지 않았습니다.');
237                    }
238                }
239            }
240        });
241    }
242}
243
244
245//실베 배지 설정 레이어 열기/닫기
246var bestconConf = function() {
247    if($('#bestConMsg').css('display') != 'none') {
248        bestconMsgClose();
249    }
250    if($('#bestConConf').css('display') == 'none') {
251        login_box_layer_close();
252        $('#bestConConf').show();
253    }
254    else {
255        bestconConfClose();
256    }
257};
258
259//실베 배지 설정 레이어 닫기
260var bestconConfClose = function(cookie) {
261    if(cookie) set_cookie('bestcon_msg', "Y", 168, "dcinside.com");
262    $('#bestConConf').hide();
263}
264
265var bestconMsgClose = function() {
266    set_cookie('bestcon_msg', "Y", 168, "dcinside.com");
267    $('#bestConMsg').hide();
268}
269// [실베알림] 여기부터 
270$(function() {
271    var $box = $('#alarmConf .rtbest_box');
272    if($box.length < 1 || $box.attr('data-ab-end') === '1') {
273        return;
274    }
275
276    try {
277        if(localStorage.getItem('rtb_cell') === 'Z') {
278            $box.remove();
279        }
280    } catch(e) {}
281});
282
283// [실베알림] 여기까지

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.