first commit
This commit is contained in:
135
application/views/web/comm/share_box_inc.php
Executable file
135
application/views/web/comm/share_box_inc.php
Executable file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
// $title = str_replace("'", "\\'", $title);
|
||||
// $title = str_replace('"', '\\"', $title);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<input type="hidden" name="share_content" id="share_content" value="<?php echo mb_substr(getMetaDescription($content), 0, 100)?>">
|
||||
<input type="hidden" name="share_title" id="share_title" value="<?php echo addslashes($title)?>">
|
||||
<input type="hidden" name="share_copy_url" id="share_copy_url" value="<?=CROSSMAP_URL?>">
|
||||
<input type="hidden" name="share_img_url" id="share_img_url" value="<?php echo imgSrc($main_img) ?>">
|
||||
<div class="popup_share" id="share_box" style="display:none;">
|
||||
<p class="s_close"><a href="javascript:change_toggle('share_box');"><img src="/img/web/img_x.gif"></a></p>
|
||||
<ul>
|
||||
<li><a href="javascript:share_facebook();" class="fb-xfbml-parse-ignore"><img src="/img/web/img_fb.jpg" alt="페이스북"><br>페이스북</a></li>
|
||||
<li><a href="javascript:share_twitter();"><img src="/img/web/img_tw.jpg" alt="트위터"><br>트위터</a></li>
|
||||
<li><a href="javascript:share_kakao();" ><img src="/img/web/img_kk.jpg" alt="카카오톡 "><br>카카오톡</a></li>
|
||||
<li><a href="javascript:share_naver();"><img src="/img/web/img_na.jpg" alt="네이버"><br>네이버</a></li>
|
||||
</ul>
|
||||
<ul style="padding-top:10px; clear:both;">
|
||||
<li><a href="javascript:share_kakaostory();"><img src="/img/web/img_ks.jpg" alt="카카오스토리"><br>카카오스토리 </a></li>
|
||||
<li><a href="javascript:share_band();"><img src="/img/web/img_bd.jpg" alt="밴드"><br>밴드</a></li>
|
||||
<li><a href="javascript:bookmark()"><img src="/img/web/img_bm.jpg" alt="북마크"><br>북마크</a></li>
|
||||
</ul>
|
||||
<div class="s_share">
|
||||
<input type="text" class="s_window" id="copy_url" value="<?=CROSSMAP_URL?>">
|
||||
<button type="button" class="s_src_sumit" onclick="copy_url();">URL복사</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 카카오톡 공유하기 -->
|
||||
<script src="//developers.kakao.com/sdk/js/kakao.min.js"></script>
|
||||
<script type='text/javascript'>
|
||||
// 레이어 이외의 공간 클릭시 close
|
||||
$(document).mouseup(function (e){
|
||||
var container = $("#share_box");
|
||||
if( container.has(e.target).length === 0) container.hide();
|
||||
|
||||
});
|
||||
|
||||
Kakao.init('6ff83d5220e4182ba5f996b2cf6dd52c');
|
||||
function share_kakao() {
|
||||
Kakao.Link.sendDefault({
|
||||
objectType: 'feed',
|
||||
content: {
|
||||
title: $("#share_title").val(),
|
||||
imageUrl: $("#share_img_url").val(),
|
||||
link: {
|
||||
mobileWebUrl: $("#share_copy_url").val(),
|
||||
webUrl: $("#share_copy_url").val()
|
||||
}
|
||||
},
|
||||
buttons: [{
|
||||
title: '웹으로 보기',
|
||||
link: {
|
||||
mobileWebUrl: $("#share_copy_url").val(),
|
||||
webUrl: $("#share_copy_url").val()
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
function share_facebook() {
|
||||
var share_url = $("#share_copy_url").val();
|
||||
var url = encodeURI(share_url);
|
||||
window.open("http://www.facebook.com/sharer/sharer.php?u="+url, "", "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function share_band(){
|
||||
var share_title = $("#share_title").val()+'\n' +$("#share_copy_url").val();
|
||||
var url = encodeURIComponent($("#share_copy_url").val());
|
||||
var text = encodeURI(share_title);
|
||||
window.open("http://band.us/plugin/share?body=" + text + "&route=" + url, "", "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes");
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 카카오톡 스토리 공유하기
|
||||
function share_kakaostory() {
|
||||
var share_url = $("#share_copy_url").val();
|
||||
var share_title = $("#share_title").val()+'\n' +$("#share_copy_url").val();
|
||||
Kakao.Story.share({
|
||||
url: share_url,
|
||||
text: share_title,
|
||||
});
|
||||
}
|
||||
|
||||
// 네이버공유하기
|
||||
function share_naver() {
|
||||
var share_url = $("#share_copy_url").val();
|
||||
var share_title = $("#share_title").val();
|
||||
var url = encodeURI(encodeURIComponent(share_url));
|
||||
var title = encodeURI(share_title);
|
||||
var shareURL = "http://share.naver.com/web/shareView.nhn?url=" + url + "&title=" + title;
|
||||
window.open(shareURL, "", "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes");
|
||||
}
|
||||
|
||||
// 트위터 공유하기
|
||||
function share_twitter() {
|
||||
var share_url = $("#share_copy_url").val();
|
||||
var share_title = $("#share_title").val();
|
||||
|
||||
var url = share_url;
|
||||
var text = encodeURI(share_title);
|
||||
window.open("https://twitter.com/intent/tweet?text=" + text + "&url=" + url, "", "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
// 주소복사
|
||||
function copy_url(){
|
||||
var copyText = document.getElementById("copy_url");
|
||||
copyText.select();
|
||||
document.execCommand("Copy");
|
||||
alert ("주소가 복사되었습니다.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(".share_btn").unbind("click");
|
||||
$('.share_btn').click(function(e) {
|
||||
$("#share_box").toggle();
|
||||
var popH = $(this).offset().top;
|
||||
$('.popup_share').css('left','55%');
|
||||
$('.popup_share').css('top',popH+'px');
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user