PageSourceSearch

https://cdn.byline.network/wp-content/plugins/pavo-social-sharing/…/assets/js/pavo_social_sharing.js?ver=2.0.0

js byline.network collected 2026-10-02 02:39:03 UTC 17,440 bytes, 518 lines download raw bytes

1//공통 script 처리
2jQuery(function($) {
3	$( document ).ready(function() {
4		Kakao.init(PavoSocialParams.KAKAO_API_VALUE);
5
6		//태블릿 기기인지 판단한다.
7		var isTablet = window.matchMedia("only screen and (min-device-width: 768px)");
8		isTablet = isTablet.matches;
9
10		if($(".social_share").length > 0) {
11			if (PavoSocialParams.MOBILE_SHARE_BUTTON_POS == "float" && PavoSocialParams.IS_MOBILE == true && isTablet == false) {
12				$( window ).bind( "resize", function() {
13						setMaxWidth();
14						displaySocialButton();
15				});
16
17				$( window ).scroll(function() {
18					isTablet = window.matchMedia("only screen and (min-device-width: 768px)");
19					isTablet = isTablet.matches;
20
21					if(!isTablet) {
22						displaySocialButton();
23					}
24				});
25
26
27			}else{
28				//PC 버전이거나 태블릿 기기이고 소셜버튼 위치 옵션값이 top일때
29				if(PavoSocialParams.SOCIAL_SHARE_BUTTON_POS == "top") {
30					$("#pavo_contents").css("clear", "both");
31					$("#pavo_contents").css("padding-top", "8px");
32				} else if(PavoSocialParams.SOCIAL_SHARE_BUTTON_POS == "bottom") {
33					$("#pavo_contents").css("clear", "both");
34					$(".social_share").after("<br/>");
35				}
36			}
37
38			$(".social_share").on("click", "a", function(){
39			});
40		}
41
42
43		//클릭시 count 업데이트
44		$(".social_share").on("click", "a.pvss", function(e){
45			post_id = $(this).data('pid');
46			var className = $(this).attr('class');
47			className = className.replace("pvss ","");
48			console.log(className);
49
50			// e.preventDefault();
51
52			$.ajax({
53				type: 'POST',
54				url: PavoSocialParams.ajax_url,
55				data: {
56					"action"		: "pavo_click_count",
57					"postId" 		: post_id,
58					"provider" 	: className,
59				},
60				dataType: "json",
61				error : function(error) {
62						alert('오류가 발생했습니다.');
63				},
64				success: function(data){
65
66				}
67
68			});
69
70
71		});
72
73
74
75
76
77
78/*
79
80		if($(".social_share").length > 0) {
81
82			if (PavoSocialParams.MOBILE_SHARE_BUTTON_POS == "float" && PavoSocialParams.IS_MOBILE == true && isTablet == false) {
83
84				setMaxWidth();
85
86				$("#pavo_contents").before($(".social_share"));
87				$(".social_share").css("position", "fixed");
88
89				displaySocialButton();
90
91				$( window ).scroll(function() {
92					isTablet = window.matchMedia("only screen and (min-device-width: 768px)");
93					isTablet = isTablet.matches;
94
95					if(!isTablet) {
96						displaySocialButton();
97					}
98				});
99			} else {
100				//PC 버전이거나 태블릿 기기이고 소셜버튼 위치 옵션값이 top일때
101				if(PavoSocialParams.SOCIAL_SHARE_BUTTON_POS == "top") {
102					$("#pavo_contents").css("clear", "both");
103					$("#pavo_contents").css("padding-top", "8px");
104				} else if(PavoSocialParams.SOCIAL_SHARE_BUTTON_POS == "bottom") {
105					$("#pavo_contents").css("clear", "both");
106					$(".social_share").after("<br/>");
107				}
108			}
109
110			$( window ).bind( "resize", function() {
111				isTablet = window.matchMedia("only screen and (min-device-width: 768px)");
112				isTablet = isTablet.matches;
113
114				if(isTablet) {
115					$(".social_share").removeAttr('style');
116					$("#pavo_contents").removeAttr('style');
117
118					$(".social_share").css("z-index", "20");
119					$(".social_share").css("height", PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE + "px");
120
121					$("#pavo_social_sharing").parent().css("margin-bottom", "0px");
122
123					$(".social_share > a > img").css( "width", PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE + "px" );
124					$(".social_share > a > img").css( "height", PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE + "px" );
125
126					if(PavoSocialParams.SOCIAL_SHARE_BUTTON_POS == "top") {
127						$("#pavo_contents").before($(".social_share"));
128						$("#pavo_contents").css("clear", "both");
129						$("#pavo_contents").css("padding-top", "8px");
130
131					} else if(PavoSocialParams.SOCIAL_SHARE_BUTTON_POS == "bottom") {
132						$("#pavo_contents").after($(".social_share"));
133						$("#pavo_contents").css("clear", "both");
134						$(".social_share").after("<br/>");
135					}
136				} else {
137					if (PavoSocialParams.MOBILE_SHARE_BUTTON_POS == "float" && PavoSocialParams.IS_MOBILE == true) {
138						setMaxWidth();
139						displaySocialButton();
140					}
141				}
142			});
143		}
144		*/
145
146  });
147
148	displaySocialButton = function ( ) {
149
150		var screenwidth = $( window ).width();
151		var screenheight = $( window ).height();
152		var cnt = $(".social_share > a").size();
153		// var top = $("#pavo_social_sharing").position().top;
154		var top = $("#pavo_social_sharing").offset().top;
155		var height = $("#pavo_social_sharing").outerHeight(true);
156
157		if($("#wpadminbar").length > 0 ){
158			screenheight = screenheight - $("#wpadminbar").height();
159		}
160
161		//가로모드이고 현재 사용자 스크롤 화면이 본문보다 위에 있을 경우에는 fixed 속성을 제거해준다.
162		if(window.innerWidth > window.innerHeight) {
163
164			if($(this).scrollTop() < top) {
165				$(".social_share").css("position", "");
166			} else {
167
168
169
170				if(height - screenheight > 0) {
171					$(".social_share").css("position", "fixed");
172					$(".social_share").css("right", (screenwidth - $("#pavo_social_sharing").width())/2+"px");
173				}
174			}
175		}
176
177		//2. 사용자가 스크롤한 영역이 본문 영역일 경우 아이콘 보여줌.
178		if($(this).scrollTop() <= top + height) {
179			$(".social_share > a").css("display", "block");
180		}
181
182		//3. 세로모드일때 스크롤 범위에 따라 소셜 버튼을 본문 하단에 위치시켜준다.
183		//3-1. 스크롤 범위가 본문 하단일 경우에는 social share div를 pavo_contents 밑에 붙여준다.
184		if(window.innerWidth < window.innerHeight) {
185			var bottom = top + height + $('.social_share').height();
186
187			if($("#wpadminbar").length > 0 ){
188				bottom += $("#wpadminbar").height();
189			}
190
191			if(height - screenheight > 0) {
192				var icon_height = $(".social_share").height();
193				var add_height = icon_height;
194				if( $("#wpadminbar").length > 0 ){
195					add_height += ( $("#wpadminbar").height() * 2 );
196				}
197				if($(this).scrollTop() >( top - add_height ) && (bottom - $(this).scrollTop()) < (screenheight + add_height) ) {
198					//fixed, bottom 0px 속성 제거하고 소셜공유아이콘을 본문 하단에 ë
198¶™ì¸ë‹¤.
199					$(".social_share").removeAttr('style');
200
201					$(".social_share").css("z-index", "20");
202					$("#pavo_contents").after($(".social_share"));
203
204					//소셜아이콘 사용갯수가 6개 이하일때는 width, height 고정
205					if(cnt >= 5) {
206						$("#pavo_social_sharing").parent().css("margin-bottom", screenheight/cnt+"px");
207					} else {
208						$("#pavo_social_sharing").parent().css("margin-bottom", screenheight/PavoSocialParams.SOCIAL_OPTION_COUNT+"px");
209					}
210					$("#pavo_social_sharing").css("margin-bottom", "0px" );
211				} else {
212					//소셜공유아이콘을 화면 하단에 fix시킨다.
213					$("#pavo_contents").before($(".social_share"));
214
215					$(".social_share").css("position", "fixed");
216					$(".social_share").css("bottom", "0px");
217
218					$("#pavo_contents").css("margin-bottom", "0px");
219					$("#pavo_social_sharing").css("margin-bottom", icon_height + "px" );
220				}
221			} else {
222				$(".social_share").removeAttr('style');
223
224				$(".social_share").css("z-index", "20");
225				$("#pavo_contents").after($(".social_share"));
226
227				//소셜아이콘 사용갯수가 6개 이하일때는 width, height 고정
228				if(cnt >= 6) {
229					$("#pavo_social_sharing").parent().css("margin-bottom", screenheight/cnt+"px");
230				} else {
231					$("#pavo_social_sharing").parent().css("margin-bottom", screenheight/PavoSocialParams.SOCIAL_OPTION_COUNT+"px");
232				}
233			}
234		} else if(window.innerWidth > window.innerHeight) {
235			//3. 가로모드일때 스크롤 범위에 따라 소셜 버튼을 본문 하단에 위치시켜준다.
236			//3-1. 스크롤 범위가 본문 하단일 경우에는 social share div를 fixed 속성을 해제시키고 pavo_contents 옆에 붙여준다.
237			var bottom = top + height;
238			var social_area_height = $(".social_share > a > img").outerHeight(true)*cnt;
239			//if(height - screenheight > 0) {
240			//본문 길이가 소셜아이콘 크기보다 작을 경우에 처리
241			if($("#pavo_contents").height() < social_area_height) {
242				$("#pavo_contents").after($(".social_share"));
243				$("#pavo_social_sharing").parent().css("margin-bottom", screenheight/cnt+"px");
244			} else {
245				if($(this).scrollTop() > top && (bottom - ($(this).scrollTop() - ((screenheight - social_area_height)*2) + (screenheight - social_area_height )) ) < screenheight  ) {
246					if(height - screenheight > 0) {
247						//fixed, bottom 0px 속성 제거하고 소셜공유아이콘을 본문 하단에 붙인다.
248						$(".social_share").removeAttr('style');
249
250						$(".social_share").css("z-index", "20");
251
252						//1-1. social_share_div의 크기 조절 - 가로
253						var icon_size = screenheight/PavoSocialParams.SOCIAL_OPTION_COUNT;
254						if( icon_size >  PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE ){
255							icon_size = Number(PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE);
256						}
257
258						$(".social_share").css("width", icon_size+"px");
259
260						var iconheight = 0;
261						if(cnt >= 6) {
262							iconheight = (screenheight/cnt )-5;
263						} else {
264							iconheight = icon_size;
265						}
266						var socialmargintop = height - (iconheight * cnt);
267
268						$(".social_share").css("margin-top", socialmargintop+"px");
269						$(".social_share").css("float", "right");
270					}
271				} else {
272					$(".social_share").css("margin-top", "");
273					if($(this).scrollTop() < top) {
274						$(".social_share").css("position", "");
275					} else {
276						$(".social_share").css("position", "fixed");
277
278						if($("#wpadminbar").length > 0 ){
279							$(".social_share").css("top", $("#wpadminbar").height());
280						}else{
281							$(".social_share").css("top", "0px");
282						}
283						$(".social_share").css("right", (screenwidth - $("#pavo_social_sharing").width())/2+"px");
284					}
285				}
286			}
287			//}
288		}
289	}
290
291
292	setMaxWidth = function ( ) {
293
294		var maxwidth = $(".social_share").parent().width();
295		var maxheight = $(".social_share").parent().height();
296		var cnt = $(".social_share > a").size();
297
298		var screenwidth = $( window ).width();
299		var screenheight = $( window ).height();
300		if($("#wpadminbar").length > 0 ){
301			screenheight = screenheight - $("#wpadminbar").height();
302		}
303
304		var top = $("#pavo_social_sharing").position().top;
305		var height = $("#pavo_social_sharing").outerHeight(true);
306
307
308		//가로 모드, 세로 모드 분기
309		if(window.innerWidth > window.innerHeight) {
310			//가로 모드일 경우에
311			//모바일기기이고 하단 고정 옵선을 사용할 경우에 social_share div 안의 img 아이콘 크기 조절
312			if (PavoSocialParams.MOBILE_SHARE_BUTTON_POS == "float" && PavoSocialParams.IS_MOBILE == true) {
313				$(".social_share").removeAttr('style');
314
315				$(".social_share").css("position", "fixed");
316				$(".social_share").css("z-index", "20");
317				$(".social_share").css("top", "0px");
318
319				$("#pavo_contents").before($(".social_share"));
320
321				//1. social_share div 안의 img 아이콘 크기 조절 - 소셜 아이콘 갯수가 6개 이상일때
322				if(cnt >= 6) {
323					$(".social_share > a > img").css( "width", (( screenheight/cnt )-5) + "px" );
324					$(".social_share > a > img").css( "height", (( screenheight/cnt )-5) + "px" );
325				} else {
326					var icon_size =  screenheight/PavoSocialParams.SOCIAL_OPTION_COUNT;
327					if( icon_size >  PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE ){
328						icon_size = Number(PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE);
329					}
330					$(".social_share > a > img").css( "width", icon_size + "px" );
331					$(".social_share > a > img").css( "height", icon_size + "px" );
332				}
333
334				//본문 길이가 소셜아이콘의 높이보다 작을 경우에는 본문 하단에 ë
334¶™ì—¬ì¤€ë‹¤.
335				if($("#pavo_contents").height() < $(".social_share > a > img").height()*cnt) {
336
337					$("#pavo_contents").after($(".social_share"));
338					$(".social_share").removeAttr('style');
339
340					$(".social_share").css("z-index", "20");
341					$(".social_share").css("width", "100%");
342
343					$("#pavo_contents").css("padding-right", "0px");
344				} else {
345					////////////소셜아이콘 갯수가 6개 이상일때
346					//4. 본문 div right padding
347					if(cnt >= 6) {
348						//1-1. social_share_div의 크기 조절 - 가로
349						var icon_size =  screenheight/PavoSocialParams.SOCIAL_OPTION_COUNT;
350						if( icon_size >  PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE ){
351							icon_size = Number(PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE);
352						}
353						$(".social_share").css("width", icon_size + "px");
354						$(".social_share a img").css("height", icon_size + "px");
355						//1-2. social_share_div의 크기 조절 - 세로
356						//$(".social_share").css("height", height + "px");
357						$("#pavo_contents").css("padding-right", icon_size+10+"px");
358					}
358 else { //소셜 아이콘 갯수가 6개 이하일 경우
359						//1-1. social_share_div의 크기 조절 - 가로
360						var icon_size =  screenheight/PavoSocialParams.SOCIAL_OPTION_COUNT;
361						if( icon_size >  PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE ){
362							icon_size = Number(PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE);
363						}
364						$(".social_share").css("width", icon_size+"px");
365						//1-2. social_share_div의 크기 조절 - 세로
366						//$(".social_share").css("height", height + "px");
367
368						$("#pavo_contents").css("padding-right", icon_size+"px");
369					}
370
371					$(".social_share").css("float", "right");
372					$(".social_share").css("right", "0px");
373				}
374			}
375		} else if (window.innerWidth < window.innerHeight) {
376			//세로 모드일 경우에
377			//모바일기기이고 하단 고정 옵션을 사용할 경우에
378			if (PavoSocialParams.MOBILE_SHARE_BUTTON_POS == "float" && PavoSocialParams.IS_MOBILE == true) {
379				$(".social_share").removeAttr('style');
380
381				$(".social_share").css("position", "fixed");
382				$(".social_share").css("z-index", "999");
383				$(".social_share").css("bottom", "0px");
384				$(".social_share").css("width", "100%");
385
386				$("#pavo_contents").css("padding-right", "0px");
387
388				//소셜 아이콘 갯수가 6개 이상일때
389				if(cnt >= 5) {
390					$(".social_share > a > img").css( "width", (( maxwidth/cnt )- 4) + "px" );
391					$(".social_share > a > img").css( "height", (( maxwidth/cnt )- 4) + "px" );
392				} else {
393					var icon_size =  maxwidth/PavoSocialParams.SOCIAL_OPTION_COUNT;
394					if( icon_size >  PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE ){
395						icon_size = Number(PavoSocialParams.SOCIAL_SHARE_BUTTON_SIZE);
396					}
397					$(".social_share > a > img").css( "width", icon_size + "px" );
398					$(".social_share > a > img").css( "height", icon_size + "px" );
399				}
400			}
401		}
402	}
403
404	sendStoryLink = function ( postUrl , post_id ) {
405		if(PavoSocialParams.IS_MOBILE){
406			$.ajax({
407	          type: 'POST',
408	          url: PavoSocialParams.ajax_url,
409	          data: {
410	            "action": "pavo_sharing_kakao",
411	            "postId" : post_id,
412	          },
413	          dataType: "json",
414	  				error : function(error) {
415	  		        alert('오류가 발생했습니다.');
416	  		    },
417	          success: function(data){
418							var thumbnail = '';
419  						if(data.thumbnail && data.thumbnail[0]) {
420  							thumbnail = data.thumbnail[0];
421  						}
422							Kakao.Story.open({
423							    url: postUrl,
424							    text: PavoSocialParams.SITE_NAME + ' 에서 공유된 글입니다.',
425							    urlInfo: {
426							        title: PavoSocialParams.SITE_NAME,
427							        name: data.desc,
428							        images: [thumbnail]
429							    }
430							});
431						}
432			});
433		}else{
434			Kakao.Story.share({
435  			url: postUrl,
436  			text: PavoSocialParams.SITE_NAME + ' 에서 공유된 글입니다.'
437  		});
438		}
439
440  }
441
442  sendTalkLink = function ( post_id ) {
443  	$.ajax({
444          type: 'POST',
445          url: PavoSocialParams.ajax_url,
446          data: {
447            "action": "pavo_sharing_kakao",
448            "postId" : post_id,
449          },
450          dataType: "json",
451  				error : function(error) {
452  		        alert('오류가 발생했습니다.');
453  		    },
454          success: function(data){
455							var thumbnail = '';
456							var thumbnail_width = 0;
457							var thumbnail_height = 0;
458							if(data.thumbnail && data.thumbnail[0]) {
459								thumbnail = data.thumbnail[0];
460								thumbnail_width = data.thumbnail[1];
461								thumbnail_height = data.thumbnail[2];
462							}
463  						Kakao.Link.sendDefault({
464								objectType: 'feed',
465								content: {
466									title: data.title,
467									description: data.desc,
468									imageUrl: thumbnail,
469									imageWidth: thumbnail_width,
470    							imageHeight: thumbnail_height,
471									link: {
472										mobileWebUrl: data.post_url,
473										webUrl: data.post_url
474									}
475								},
476								buttons: [
477									{
478										title: PavoSocialParams.KAKAO_BTN_TEXT,
479										link: {
480											mobileWebUrl: data.post_url,
481											webUrl: data.post_url
482										}
483									}
484								]
485  						});
486          }
487      });
488  }
489
490	function nospaces(t) {
491	  	if(t.value.match(/\s/g)){
492	    	t.value=t.value.replace(/\s/g,'');
493	  	}
494	}
495
496	function showKakaoHelpDiv() {
497		if($("#kakao_api_help").css("display") == "none")
498			$("#kakao_api_help").show();
499		else if($("#kakao_api_help").css("display") == "block")
500			$("#kakao_api_help").hide();
501	}
502
503	var clipboard = new ClipboardJS('.social_share .clipboard');
504
505	clipboard.on('success', function(e) {
506		if(window.clipboardData != undefined ){
507			window.clipboardData.setData('text', e.text);
508		}
509		alert('클립보드에 복사되었습니다.');
510	});
511
512	clipboard.on('error', function(e) {
513			alert('클립보드에 복사에 실패하였습니다..');
514	});
515
516
517
518});

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.