function specialCharCheck(event) {
var keyCode = event.keyCode;
// 허용할 기능 키: 백스페이스(8), 탭(9), 엔터(13), 스페이스바(32), 화살표 키(37-40) 등
if (keyCode == 8 || keyCode == 9 || keyCode == 13 || (keyCode >= 35 && keyCode <= 40) || keyCode == 46) {
return true;
}
var key = event.key;
var regex = /^[a-zA-Z0-9\uAC00-\uD7A3\s._+~@!\-]$/;
var allowed = regex.test(key);
if (!allowed) {
event.preventDefault(); // 기본 이벤트 동작(문자 입력)을 막습니다.
return false;
}
return true;
}
function keyCheckblur(thisone) {
thisone.value = thisone.value.replace("'","");
}
function getCookie( name )
{
var nameOfCookie = name + "=";
var x = 0;
while ( x <= document.cookie.length )
{
var y = (x+nameOfCookie.length);
if ( document.cookie.substring( x, y ) == nameOfCookie ) {
if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
endOfCookie = document.cookie.length;
return unescape( document.cookie.substring( y, endOfCookie ) );
}
x = document.cookie.indexOf( " ", x ) + 1;
if ( x == 0 )
break;
}
return "";
}
function bonClick() {
//$('#t').val(""); //본디스크회원때문에
//$("#t").css('background-image', 'none');
//$("#t").css("color","black");
//$('#t').css("font-size", '12px');
}
$(function(){
var searchKeyword = getParameterByName('searchKeyword');
var searchWord = getParameterByName('searchWord');
if (searchKeyword != "content_id") {
if (searchWord!="" && searchWord!="fujrtu") {
$("#searchWord").val(searchWord);
$("#searchWord").css("background-image", "none");
$("#searchKeyword").val(searchKeyword);
}
}
$('.filesh>ul>li>a').mouseover(function() {
$('.filesh>ul>li').removeClass('on');
$(this).closest('li').addClass('on');
});
//네비:전체카테고리 idsplay
$(".allmnBtn").click(function(){
if($('#allbox').css('display')=='block'){
$('.filesh>ul>li').removeClass('on');
$(this).removeClass('open');
$('#allbox').hide();
}else{
$(this).addClass('open');
$('#allbox').show();
}
});
$('#joinclub').focus(function(){
if ($('#allbox').css('display') != 'none') {
$('#joinclub').removeClass('open');
$('.allmnBtn>img').attr('src','/images/images_re/common/mtop_mn_all.gif');
$('#allbox').hide();
}
});
$('.filesh a').focus(function(){
if($('#allbox').css('display')!='none'){
$('.allmnBtn>img').attr('src','/images/images_re/common/mtop_mn_all.gif');
$('#allbox').hide();
}
});
$(".club").click(function(){
if(getCookie("uid")){
if(listload == 0)
{
$('#joinclub').addClass('open');
setTimeout(function() {myListLoad1('club', $('.lst.myJoiner')); }, 1);
}else{
if ($('.lst').css('display')!='block') {
$('#joinclub').addClass('open');
//$('#clublist').show();
} else {
$('#joinclub').removeClass('open');
}
$(".lst").slideToggle('fast');
}
}else{
//alert("로그인이 필요합니다");
location.href = "https://member.pdpop.com/login/index_re.html";
return;
}
});
});
document.write(" ");
document.write(" ");
document.write(" ");
document.write(" ");
//document.write(" ");
document.write(" ");
document.write(" ");
document.write(" ");
document.write(" ");
document.write(" ");
document.write("");
document.write("
");
document.write("
");
document.write("
피디팝 사용하기. ");
document.write("
");
document.write(" ");
document.write(" 클럽 ");
document.write(" AI채팅 ");
document.write(" 커뮤니티 ");
document.write(" TV방송 편성표 ");
document.write(" ");
document.write(" ");
document.write("
");
document.write(" ");
document.write(" NEW 피디팝 ");
document.write(" 출석체크 ");
document.write(" 무료운세 ");
document.write(" 이벤트 ");
document.write(" 무료충전소 ");
document.write(" 요금충전 ");
document.write(" ");
document.write(" ");
document.write("
");
document.write("
");
document.write("");
document.write("");
document.write(" ");
document.write(" ");
document.write(" ");
document.write(" ");
document.write(" ");
var listload = 0;
function myListLoad1(target, obj){
if (document.location.href.indexOf("https") != '-1') {
var url = "//www.pdpop.com/login/load_club.php";
}else {
var url = "//www.pdpop.com/login/load_club.php";
}
var target_name = "클럽";
var make_url = "https://jjanghard.pdpop.com/club/make_re.php";
if(!getCookie("uid")) return;
var ancestor=$("#joinclub");
var mdivPLayer=document.createElement("div");
$.getJSON(url+'?callback=?','uid='+getCookie("uid"),
function(jdata){
var mHtml='';
var jc=0;
mHtml +="
가입한 클럽리스트 "
if(jdata.length == 0){
mHtml +="
피디팝 클럽만들기 "
}else{
mHtml +="
";
for(i in jdata){
if(target == "club" && jdata[i]!=""){
if(jdata[i].length>13){
jdata[i]=jdata[i].substring(0,10)+"...";
}
mHtml+="- "+jdata[i]+" ";
jc++;
}else{
return;
}
}
mHtml +="";
}
$(mdivPLayer).css("display","none").attr({"id":"clublist","class":"lst"}).insertAfter(ancestor);
$(mdivPLayer).html(mHtml);
$(mdivPLayer).slideToggle('fast')
}
);
listload++;
}
//가입 클럽 로딩
function myListLoad(target, obj)
{
if(getCookie("uid")){
if(listload == 0)
{
//var scriptLink = document.createElement("script");
//scriptLink.language = "javascript";
//scriptLink.src = "/images/script/jquery-1.7.1.min.js";
//scriptLink.type = 'text/javascript';
//scriptLink.async = true;
//document.body.appendChild(scriptLink);
setTimeout(function() {myListLoad1(target, obj); }, 1);
}else{
//myListLoad1(target, obj);
/*
*클릭과 중복으로 주석처리
if($(".myJoiner").css('display') == 'block'){
$(".myJoiner").hide();
return;
}else{
$(".myJoiner").slideToggle('fast');
}
*/
}
return;
}else{
alert("로그인이 필요합니다");
return;
}
}
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
//--- 검색어관련 script
window.addEventListener('pageshow', function () {
callRecommentSearchWord(); // 추천검색어 ajax LOAD
setTimeout(callSearchWordHistory, 500); // 내검색어 ajax LOAD
//--- 레이어 open
var searchWordObj = document.getElementById('searchWord');
searchWordObj.addEventListener('click', function() {
document.getElementById('suggest_layer').style.display = 'block';
});
//-- 닫기버튼 레이어 close
var searchLayoutCloseBtn = document.getElementById('searchLayoutCloseBtn');
searchLayoutCloseBtn.addEventListener('click', searchLayerClose);
//-- 외부 클릭 시 레이어 close
var suggest_layer = document.getElementById('suggest_layer');
document.addEventListener('click', function(e) {
if (suggest_layer.style.display == 'block' && !suggest_layer.contains(e.target) && !searchWordObj.contains(e.target)) {
suggest_layer.style.display = 'none';
}
});
var dropdown = document.getElementsByClassName('dropdown');
for (var i = 0; i < dropdown.length; i++) dropdown[i].addEventListener('click',searchLayerClose);
//dropdown.forEach((selboxObj) => selboxObj.addEventListener('click', searchLayerClose));
//--- 탭선택
var suggestTab = document.querySelectorAll('.tab_suggest > ul > li');
for (var index = 0; index < suggestTab.length; index++) tabClick(index);
function tabClick(index) {
suggestTab[index].addEventListener("click", function() {
tabSelect(index);
});
}
// 탭 초기화
if (getCookie('uid')) {
tabSelect(0);
} else {
tabSelect(1);
}
});
function tabSelect(index)
{
var suggestTab = document.querySelectorAll('.tab_suggest > ul > li');
for (var tabIdx = 0; tabIdx < suggestTab.length; tabIdx++) {
suggestTab[tabIdx].classList.remove('on');
}
suggestTab[index].classList.add('on');
var contents = document.querySelectorAll('.list_suggest');
for (var contentIdx = 0; contentIdx < contents.length; contentIdx++) {
contents[contentIdx].style.display = 'none';
}
contents[index].style.display = '';
var clearSearchWordBtn = document.getElementById('clearSearchWordBtn');
var recent_keyword = document.getElementById('recent_keyword');
if (index == 1) {
clearSearchWordBtn.style.display = 'none';
recent_keyword.style.display = 'none';
} else {
clearSearchWordBtn.style.display = 'block';
recent_keyword.style.display = 'block';
}
}
//--- 검색어 레이어 닫기
function searchLayerClose()
{
var searchLayer = document.getElementById('suggest_layer');
if (searchLayer.style.display != 'none') searchLayer.style.display = 'none';
}
function showEmptySearchWordText()
{
if (!getCookie('uid')) return;
if (getCookie('searchWordHistoryOff') == 1) return;
if (getCookie('searchWordHistory')) return;
document.getElementById('emptySearchWordText').style.display = 'block';
document.getElementById('searchWordHistoryUl').style.display = 'none';
return;
}
// 추천검색어 내검색어 cookie load
function callSearchWordHistory()
{
if (!getCookie('uid')) return; // 비로그인시 표시되지않음
var resultData = getCookie('searchWordHistory');
if (!resultData) {
showEmptySearchWordText();
return;
}
resultData = decodeURI(resultData).split('|');
if (!resultData[0]) return;
var searchWordHistoryUl = document.getElementById('searchWordHistoryUl');
searchWordHistoryUl.innerHTML = '';
for (var index = 0; index < resultData.length; index++) searchWordHistoryUl.insertAdjacentHTML('beforeend', searchHistoryTemplate(resultData[index]));
}
// 추천검색어 ajax call
function callRecommentSearchWord()
{
var PUBLIC_KEY = '3902ea0e6307df5c35d8f01bd7f775f57e7d04c115c60fee224034decf58e6fb';
var RAND_KEY = '8831298';
$.ajax({
url: "//www.pdpop.com/API.php/getRecommendSearchWord",
method: 'GET',
dataType: 'json',
headers: {
'PUBLIC-KEY': PUBLIC_KEY,
'RAND-KEY': RAND_KEY
}, xhrFields: {
withCredentials: true // ★ 쿠키 포함
},
success: function (resultData) {
if (!resultData) return;
var recommendSearchWordUl = document.getElementById('recommendSearchWord');
recommendSearchWordUl.innerHTML = '';
for (var index = 0; index < resultData.length; index++) recommendSearchWordUl.insertAdjacentHTML('beforeend', recommendTemplate(resultData[index]));
}
});
}
// 추천검색어 li 생성 Template
function recommendTemplate(row)
{
var searchUrl = "//bbs.pdpop.com/board_re.php?mode=list&searchKeyword=content_id&searchWord=" + row.content_id;
var listRow = '';
listRow += "";
listRow += " " + row.search_word + " ";
if (row.saleIcon) {
listRow += " ";
}
listRow += " ";
listRow += " ";
return listRow;
}
// 내검색어 li 생성 Template
var searchHistoryNum = 0;
function searchHistoryTemplate(searchWord)
{
var searchUrl = "//bbs.pdpop.com/board_re.php?mode=list&code=&searchKeyword=bbs_subject&searchWord=" + encodeURIComponent(searchWord)+ "&hash=" + Math.floor(Math.random() * 100000000);
var listRow = '';
listRow += "";
listRow += " " + searchWord + " ";
listRow += " 삭제 ";
listRow += " ";
searchHistoryNum++;
return listRow;
}
// 검색기록 삭제
function deleteSearchWord(searchHistoryNum)
{
document.getElementById("searchWordLi-" + searchHistoryNum).style.display = 'none';
var selectObj = document.getElementById("searchWord-" + searchHistoryNum);
var searchWordHistoryArray = decodeURI(getCookie('searchWordHistory')).split('|');
var deleteWord = selectObj.innerText;
var newSearchWord = searchWordHistoryArray.filter(function (item, index, array) {
return deleteWord != item;
});
notice_setCookie('searchWordHistory', encodeURI(newSearchWord.join('|')), 30); // 요소 삭제 후 다시 쿠키 셋팅
if (!newSearchWord.join('|')) showEmptySearchWordText();
return;
}
// 검색기록 전체삭제
function clearSearchWord()
{
notice_setCookie('searchWordHistory', '', 30);
var searchWordHistoryUl = document.getElementById('searchWordHistoryUl');
searchWordHistoryUl.innerHTML = ''; // 자식노드 전체 지움
showEmptySearchWordText();
}
// 검색 자동저장 스위치 동작에 따른 proc
function setSearchWordHistorySwitch(switchNode)
{
var noneLoginSearchWordText = document.getElementById('noneLoginSearchWordText');
var searchWordHistoryOffText = document.getElementById('searchWordHistoryOffText');
var searchWordHistorySwitchText = document.getElementById('searchWordHistorySwitchText');
var searchWordHistoryUl = document.getElementById('searchWordHistoryUl');
var noticeText = document.querySelectorAll('.kwd_info');
for (var index=0; index < noticeText.length; index++) noticeText[index].style.display = 'none';
if (!getCookie('uid')) {
noneLoginSearchWordText.style.display = '';
}
if (switchNode.checked) {
notice_setCookie('searchWordHistoryOff', 0, 30);
if (getCookie('uid')) {
searchWordHistoryUl.style.display = '';
}
searchWordHistorySwitchText.innerText = '검색 자동저장 끄기';
} else {
notice_setCookie('searchWordHistoryOff', 1, 30);
if (getCookie('uid')) {
searchWordHistoryOffText.style.display = '';
searchWordHistoryUl.style.display = 'none';
}
searchWordHistorySwitchText.innerText = '검색 자동저장 켜기';
}
showEmptySearchWordText();
return;
}
// 검색어관련 script end
function redirectMobile()
{
if (navigator.userAgent.match(/iPad/) == null && navigator.userAgent.match(/iPhone|Mobile|UP.Browser|Android|BlackBerry|Windows CE|Nokia|webOS|Opera Mini|SonyEricsson|opera mobi|Windows Phone|IEMobile|POLARIS/) != null) {
var key = 'todo';
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^]*)");
var qs = regex.exec(window.location.href);
if (!qs || qs[1] != 'pc') {
location.replace("https://m.pdpop.com/_renew");
}
}
}