PageSourceSearch

https://www.sqcf.org/js/newest_post.js?1724647066

js sqcf.org collected 2026-09-24 10:12:08 UTC 8,248 bytes, 234 lines download raw bytes

1var NEWEST_POST = function(){
2
3	var mode;
4
5  /**
6   * 구매평 또는 문의 URL로 리다이렉트, 현재 예약에서만 사용됨
7   * moveReviewUrl 등의 이름이 맞을 듯 하나 고객 커스텀 코드로 사용될 가능성을 고려하여 함수명 유지
8   * @param type
9   * @param prod_url
10   * @param idx
11   */
12	var getReviewUrl = function(type,prod_url,idx){
13		if(type == 'shop_review'){
14			location.href = prod_url+'#prod_detail_review!/'+idx;
15		}else{
16			location.href = prod_url+'#prod_detail_qna!/'+idx;
17		}
18	};
19
20	//bmode 구해서 변수에 셋팅
21	var setParameterByName = function(name){
22		name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
23
24		var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
25			results = regex.exec(location.search);
26
27		mode = null === results ? "" : decodeURIComponent(results[1].replace(/\+/g, " "))
28	};
29
30	var newestClickLike = function(post_code, like_token_key, like_token){
31		event.stopPropagation();
32
33		if(mode === 'view'){ //게시글 본문과 같은 페이지에 있으면 갱신버튼을 본문 좋아요 버튼으로 셋팅
34			post_like_reaction.init('post', post_code, $('#view_like_btn_' + post_code), $('#view_like_count_' + post_code));
35		}else{
36			post_like_reaction.init('post', post_code, $('#like_btn_' + post_code), $('#like_count_' + post_code));
37		}
38		post_like_reaction.checkLikeToken(like_token_key, like_token, post_code);
39		post_like_reaction.toggleLike();
40	};
41
42  var viewReviewPostDetail = function(idx){
43    $(function(){
44      $.ajax({
45        type : 'POST',
46        data : {idx : idx},
47        url : ('/ajax/review_post_detail_view.cm'),
48        dataType : 'json',
49        async : false,
50        cache : false,
51        success : function(res){
52          if(res.msg === 'SUCCESS'){
53            $.cocoaDialog.open({
54              type : 'prod_detail review', custom_popup : res.html, width : 800});
55            if(history.replaceState && history.pushState){
56              // 모달 히스토리 커스텀(IE 10 이상)
57              var current_url = location.href.indexOf('#') === -1 ? location.href : location.href.substr(0, location.href.indexOf('#'));
58              var back_url = document.referrer.indexOf('#') === -1 ? document.referrer : document.referrer.substr(0, document.referrer.indexOf('#'));
59              history.pushState(null, null, current_url);
60              history.replaceState(null, null, current_url + "#prod_detail_review!/" + res.idx);
61            }else{
62              location.hash = "prod_detail_review!/" + res.idx;
63            }
64            $(window).off('hashchange').on('hashchange',function(){
65              var hash_qna_spilt = location.hash.split('!/')[1];
66              if(!hash_qna_spilt){
67                $.cocoaDialog.close();
68              }else{
69                var hash_spilt_tab = location.hash.split('!/')[0];
70                if(hash_spilt_tab === '#prod_detail_review'){
71                  viewReviewPostDetail(hash_qna_spilt);
72                }else if(hash_spilt_tab === '#prod_detail_qna'){
73                  viewQnaPostDetail(hash_qna_spilt);
74                }
75              }
76            });
77            $('.modal_prod_detail').off('hidden.bs.modal').on('hidden.bs.modal', function (e) {
78              removeReviewHash();
79            });
80          }else{
81            alert(res.msg);
82          }
83        }
84      });
85    });
86  };
87
88  var removeReviewHash = function(){
89    $(window).off('hashchange');
90    $('html').toggleClass('modal-scroll-control', false);
91    var hash_review_spilt = location.hash.split('!/')[1];
92    if(hash_review_spilt){
93      if(history.replaceState && history.pushState){
94        history.back();
95      }else{
96        location.href = '#prod_detail_review';
97      }
98    }
99  };
100
101  var viewQnaPostDetail = function(idx){
102    $(function(){
103      $.ajax({
104        type : 'POST',
105        data : {idx : idx},
106        url : ('/ajax/qna_post_detail_view.cm'),
107        dataType : 'json',
108        async : false,
109        cache : false,
110        success : function(res){
111          if(res.msg === 'SUCCESS'){
112            $.cocoaDialog.open({
113              type : 'prod_detail review', custom_popup : res.html, width : 800});
114            if(history.replaceState && history.pushState){
115              // 모달 히스토리 커스텀(IE 10 이상)
116              var current_url = location.href.indexOf('#') === -1 ? location.href : location.href.substr(0, location.href.indexOf('#'));
117              var back_url = document.referrer.indexOf('#') === -1 ? document.referrer : document.referrer.substr(0, document.referrer.indexOf('#'));
118              history.pushState(null, null, current_url);
119              history.replaceState(null, null, current_url + "#prod_detail_qna!/" + res.idx);
120            }else{
121              location.hash = "prod_detail_qna!!/" + res.idx;
122            }
123            $(window).off('hashchange').on('hashchange',function(){
124              var hash_qna_spilt = location.hash.split('!/')[1];
125              if(!hash_qna_spilt){
126                $.cocoaDialog.close();
127              }else{
128                var hash_spilt_tab = location.hash.split('!/')[0];
129                if(hash_spilt_tab === '#prod_detail_review'){
130                  viewReviewPostDetail(hash_qna_spilt);
131                }else if(hash_spilt_tab === '#prod_detail_qna'){
132                  viewQnaPostDetail(hash_qna_spilt);
133                }
134              }
135            });
136            $('.modal_prod_detail').off('hidden.bs.modal').on('hidden.bs.modal', function (e) {
137              removeQnaHash();
138            });
139          }else{
140            alert(res.msg);
141          }
142        }
143      });
144    });
145  };
146
147	var viewQnaPostPassword = function(idx, code){
148		var pw = prompt(LOCALIZE.설명_작성시등록하신비밀번호를입력해주세요());
149		if(pw == null) return false;
150		if(!pw) return alert(LOCALIZE.설명_작성시등록하신비밀번호를입력해주세요());
151		CheckSecret(code, pw, function () {
152			NEWEST_POST.viewQnaPostDetail(idx);
153		});
154	};
155
156	var CheckSecret = function(code, secret_pass, callback) {
157		$.ajax({
158			type: 'post',
159			data: { code: code, secret_pass: secret_pass, type: 'qna' },
160			url: '/ajax/check_review_pass.cm',
161			dataType: 'json',
162			success: function (result) {
163				if (result.msg == 'SUCCESS') {
164					if (typeof callback == 'function')
165						callback();
166				} else {
167					alert(result.msg);
168				}
169			}
170		});
171	};
172
173  var removeQnaHash = function(){
174    $(window).off('hashchange');
175    $('html').toggleClass('modal-scroll-control', false);
176    var hash_qna_spilt = location.hash.split('!/')[1];
177    if(hash_qna_spilt){
178      if(history.replaceState && history.pushState){
179        history.back();
180      }else{
181        location.href = '#prod_detail_qna';
182      }
183    }
184  };
185  
186  var alertNoSale = function(){
187    $.cocoaDialog.open({
188      type: 'site_alert',
189      custom_popup: `
190        <div class="layer_pop">
191            <div class="container-fluid">
192                <p class="tw-text-center tw-mb-0">
193                    ${getLocalizeString('설명_상품페이지이동불가안내', '', '해당 상품 페이지로 이동할 수 없습니다.')}
194                </p>
195            </div>
196            <div class="btn-group-justified">
197                <a href="javascript:" class="btn" onclick="$('.modal_site_alert').modal('hide');">${getLocalizeString('버튼_확인', '', '확인')}</a>
198            </div>
199        </div>`
200    }, function(){
201      $('.modal_site_alert').css('z-index', 100002);
202    });
203  }
204
205	return {
206		'getReviewUrl' : function(type,prod_url,idx){
207			return getReviewUrl(type,prod_url,idx);
208		},
209		'setParameterByName' : function(name){
210			setParameterByName(name);
211		},
212		'newestClickLike' : function(post_code, like_token_key, like_token){
213			newestClickLike(post_code, like_token_key, like_token);
214		},
215    'viewReviewPostDetail' : function(idx){
216      viewReviewPostDetail(idx);
217    },
218    'removeReviewHash' : function(){
219      removeReviewHash();
220    },
221    'viewQnaPostDetail' : function(idx){
222      viewQnaPostDetail(idx);
223    },
224		'viewQnaPostPassword' : function(idx, code){
225			viewQnaPostPassword(idx, code);
226		},
227    'removeQnaHash' : function(){
228      removeQnaHash();
229    },
230    'alertNoSale' : function(){
231      alertNoSale();
232    }
233	}
234}();

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.