From c2f9a03019299cef65c4b1534986a199f23bc646 Mon Sep 17 00:00:00 2001 From: JSYOO Date: Wed, 10 Nov 2021 17:40:48 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=8A=A4=20=EC=B6=A9=EB=8F=8C=20?= =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/nlib/nlib.properties | 13 +++ src/main/webapp/js/nlib.js | 127 +++++++++++++++++++++++- 2 files changed, 136 insertions(+), 4 deletions(-) diff --git a/src/main/resources/nlib/nlib.properties b/src/main/resources/nlib/nlib.properties index b6c12738..f6228476 100644 --- a/src/main/resources/nlib/nlib.properties +++ b/src/main/resources/nlib/nlib.properties @@ -185,3 +185,16 @@ thumbnail.image.url.small = /images/thumbnail/noimage-s.jpg thumbnail.image.url.middle = /images/thumbnail/noimage-m.jpg thumbnail.image.url.big = /images/thumbnail/noimage-b.jpg + +# \ub2e8\ucd95URL +# \uac1c\ubc1c +shorturl.api = https://local-dev.nculture.org/yourls-api.php?signature=d48a5ab90c +# \uc6b4\uc601 +#shorturl.api = https://local.nculture.org/yourls-api.php?signature=6882eb3237 + + +#\uc6d0\ubb38\ubcf4\uae30 (PDF) +# \uac1c\ubc1c +pdf.uri = https://port-dev.nculture.org/npdfView.do?npdf=I +# \uc6b4\uc601 +#pdf.uri = https://port-dev.nculture.org/npdfView.do?npdf= diff --git a/src/main/webapp/js/nlib.js b/src/main/webapp/js/nlib.js index fe534803..2455330d 100644 --- a/src/main/webapp/js/nlib.js +++ b/src/main/webapp/js/nlib.js @@ -9,7 +9,7 @@ var CONTEXT_PATH = ""; // 팝업으로 비밀번호를 입력받아서 콜백함수에 전달한다. -function fn_promptPassword(msg, placeholder, callbackFucName) { +function fn_promptPassword(msg, placeholder, callbackFucName) { var options = "top=200, left=200, width=300, height=200, status=no, menubar=no, toolbar=yes, resizable=no"; var thePrompt = window.open("", "_NLIB_POMPT_PASSWORD", options); var theHTML = "" + placeholder + ""; @@ -265,7 +265,38 @@ function risDownload(risId){ document.risDownloadForm.action="/ris/risDownload.do"; document.risDownloadForm.submit(); } - +function fn_changeInterestBtn(masterId,onOff){ + if(onOff == "on") + { + $.ajax({ + type: "POST", + url: "/interest/insertInterest.ajax", + async: false, + data: {"masterId" : masterId} + }).done(function(result){ + alert(result); + $(".favorit").removeAttr("onclick"); + $(".favorit").attr("onclick","fn_changeInterestBtn('" + masterId + "','off')"); + }); + } + if(onOff == "off") + { + var masterIdArray = []; + masterIdArray.push(masterId); + $.ajax({ + url : "/interest/deleteInterests.ajax", + type : "POST", + async: false, + data : {"masterIdList" : masterIdArray}, + success : function(){ + alert("선택하신 관심자료가 삭제되었습니다."); + $(".favorit").removeAttr("onclick"); + $(".favorit").attr("onclick","fn_changeInterestBtn('" + masterId + "','on')"); + },error : function(){ + } + }); + } +} function fn_changeInterest(masterId,onOff){ var html=""; @@ -389,10 +420,98 @@ function fn_formatDateStr(yyyymmdd, defVal) { return defVal; } -function docView(interfaceId){ +function docView(uri,interfaceId){ var openNewWindow = window.open("about:blank"); - openNewWindow.location.href = "https://port-dev.nculture.org/npdfView.do?npdf=I"+interfaceId; + openNewWindow.location.href = uri + interfaceId; } +function snsShare(snsType, url) { + var url,name,specs,changedUrl,title; + if(document.title.indexOf("|") > -1){ + title = encodeURIComponent($.trim(document.title.split("|")[1])); + }else{ + title = encodeURIComponent($.trim(document.title)); + } + if(url != ''){ + changedUrl = encodeURIComponent(url); + } + + if(snsType == '1'){ + url = 'https://www.facebook.com/sharer/sharer.php?u=' +changedUrl+'&t='+title; + name = 'facebooksharedialog'; + specs = "menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600"; + }else if(snsType == '2'){ + url = 'https://twitter.com/intent/tweet?text=[%EA%B3%B5%EC%9C%A0]%20' + title+'&url='+changedUrl; + name = 'twittersharedialog'; + specs = "menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600"; + }else if(snsType == '3'){ + url = 'http://blog.naver.com/openapi/share?url=' +changedUrl+'&title='+title; + name = 'naversharedialog'; + specs = "menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600"; + }else if(snsType == '4'){ + url = 'https://story.kakao.com/s/share?url='+changedUrl; + name = 'kakaostorysharedialog'; + specs = "menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600"; + } + window.open(url, name, specs); +} + +$( document ).on('click' , 'button.share', function (e) { + //e.preventDefault(); + var tUrl = $(this).attr('data-cUrl'); + $('#div_pop-sharing img').attr('data-cUrl',tUrl); // url 모두 맵핑 + if(tUrl != null && tUrl != ''){ + /*if(tUrl.indexOf(location.host) == -1){ + tUrl = location.protocol + '//' + location.host + tUrl; + }*/ + getShortUrlData(tUrl); + } +}); +$( document ) +.on('click', '#div_pop-sharing img.sns-pop', function(e) { + e.preventDefault(); + snsShare($(this).attr('data-sType'),$(this).attr('data-cUrl')); +}) +.on('click', '#div_pop-sharing button.btn-close-pop', function(e) { + e.preventDefault(); + $(this).find('img').attr('data-cUrl',''); +}) +.on('click', '#div_pop-sharing button.btn-white', function(e) { + e.preventDefault(); + $('#p_link-copy').select(); //복사할 텍스트를 선택 + document.execCommand("copy") //클립보드 복사 실행 + alert('단축 URL이 복사되었습니다.') +}); + +function getShortUrlData(url) { + $.ajax({ + method: 'GET', + url: '/search/shorturl-data.do', + data: {url: url}, + dataType: 'json', + cache: false + }) + .done(function( data ) { + var urlData = data + if(urlData != null && urlData != ""){ + $('#p_link-copy').val(urlData); + qrcodeMake(urlData); + } else { + qrcodeMake(url); + } + }); +} + +//QR코드 +function qrcodeMake(url) { + $("#qrcode").empty(); + var qrcode = new QRCode(document.getElementById("qrcode"), { + colorDark : "#000000", + colorLight : "#ffffff", + correctLevel : QRCode.CorrectLevel.H + }); + qrcode.makeCode(url); +} + function gfn_openNewWindow(rul) { var win = window.open(rul, "_blank");