';
break;
case "fortunenews":
html = '
' +
'
';
break;
case "onecutnews":
html = '
';
break;
}
$(xml).find("article").each(function (i, e) {
if ($(e).find("title").text() == "") return true;
switch (type) {
case "breakingnews":
html +=
'
';
case "fortunenews":
if (num == 1) {
slideDisplay = 'style="display:none;"';
}
html +=
'
';
num++;
slideDisplay = '';
break;
case "onecutnews":
html +=
'
' +
'한 컷' + $(e).find("title").text() + '
' +
'';
break;
}
});
switch (type) {
case "breakingnews":
case "fortunenews":
html += '
';
break;
case "onecutnews":
html += '
';
break;
}
$("#divBreakingNews").html(html);
$("#divBreakingNews").show();
} catch (e) {
$("#divBreakingNews").hide();
}
},
error: function () {
$("#divBreakingNews").hide();
}
})
).then(function () {
if ($("div.slide", $("div#fortune_news_wrap")).length > 0) {
$('.fortune_news .slide_wrap').slick({
arrows: false,
vertical: true,
autoplay: true,
autoplaySpeed: 3000,
});
$("div.slide", $("div#fortune_news_wrap")).show();
}
});
}
initNewsletter();
$(function () {
myPage();
autoSearchKeywordDisplay();
onLoadAd();
//genBreakingNews();
//genRightEditorial();
//genHeaderWeather();
//genRankingNews();
//genNewsAS();
//genLatestJpodEpisod();
//weeklySeriesArticle();
//genSectionNews();
//2020총선
//fnVoteOpenLocationSel("search_loc1");//선거삭제
//fnVoteOpenBirye('birye_party27');//선거삭제
//선거삭제
/*$('.container_election2020 .counting_joongang .hd.tab a').click(function (e) {
e.preventDefault();
var activeTab = $(this).attr('data-tab');
var activeParents = $(this).parents('.counting_joongang');
$(activeParents).find('.hd.tab a').removeClass('active');
$(activeParents).find('.tabcontent').removeClass('active');
$(this).addClass('active');
$(activeParents).find('#' + activeTab).addClass('active');
if (activeTab == "tab3") {
fnVoteOpenLocationSel("search_loc1");
}
if (activeTab == "tab4") {
fnVoteOpenBirye('birye_party27');
}
});*/
if (/mac/.test(navigator.userAgent.toLowerCase())) {
$("body").addClass("mac");
}
setLiveNews();
setBreakingNews();
$("input[name=txtMicrobrandID]").each(function (index, item) {
fnMicrobrandBtn($(item).val());
});
var params = $.deparam(location.search.toLocaleLowerCase().replace('?', ''));
if (window.location.host.toLowerCase().indexOf('joongang.joins.com') > - 1 && params.ignorerefresh != 'y' && $('#ifr_vod').length == 0) {
var refreshTimer = 5 * 60 * 1000;
joongang_timeout = setTimeout(function () {
location.reload()
}, refreshTimer);
}
$('#searchKeyword').on('keyup', function (e) {
$('.autocomplete').show();
var keyword = $('#searchKeyword').val() || '',
keyCode = utils.getKeyCode(e);
if (keyCode == 13)
search(keyword);
});
$('#searchKeyword').on('click', function (e) {
$('.autocomplete').show();
});
$('#btnSearch').click(function () {
search($('#searchKeyword').val());
});
var stickyNav = function () {
var scrollTop = $(window).scrollTop();
var stickyNavTop = $('.header').offset().top;
if (scrollTop >= stickyNavTop && scrollTop >= 60) {
$('body').addClass('sticky');
$('.layer_jmnet').hide();
$('.jmnet').removeClass('jmnet_open');
} else {
$('body').removeClass('sticky');
$('.header .search_form').removeClass('search_form_on');
}
};
stickyNav();
$(window).scroll(function () {
stickyNav();
});
$('.btn_navbar').click(function (e) {
e.preventDefault();
var $body = $('body');
var $self = $(this);
var obj = '#mega_menu';
$body.addClass('layer_open');
$(obj).attr('tabindex', '0').show().focus();
$(obj).find('.btn_close').click(function (e) {
e.preventDefault();
$body.removeClass('layer_open');
$(obj).hide();
$self.focus();
$(this).off('click');
});
setMegamenuIcon();
});
$('.family_site a').click(function (e) {
e.preventDefault();
var $self = $(this);
var obj = '#layer_jmnet';
$(obj).attr('tabindex', '0').show().focus();
$(obj).find('.btn_close').click(function (e) {
e.preventDefault();
$(obj).hide();
$self.focus();
$(this).off('click');
});
});
$('.header .btn_search').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
$('.header .search_form').addClass('search_form_on');
$(document).one('click', function closeMenu(e) {
if ($('.header .search_form').has(e.target).length === 0) {
$('.header .search_form').removeClass('search_form_on');
} else {
$(document).one('click', closeMenu);
}
});
$('#searchKeyword').focus();
$('.autocomplete').hide();
});
$('.header .btn_logout').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
$('.header .layer_logout').addClass('layer_logout_on');
$(document).one('click', function closeMenu(e) {
if ($('.header .layer_logout').has(e.target).length === 0) {
$('.header .layer_logout').removeClass('layer_logout_on');
} else {
$(document).one('click', closeMenu);
}
});
});
$(window).on('load', function () {
$('.content').mCustomScrollbar();
});
$('#mega_menu').scroll(function () {
setMegamenuIcon();
});
setMegamenuIcon();
accessibleMenu();
var $peopleSearch = $('#search_word');
$peopleSearch.on('focusin', function () {
$peopleSearch.prev().hide();
}).on('focusout', function () {
var keyword = $peopleSearch.val() || '';
if (keyword.isEmpty()) {
$peopleSearch.prev().show();
} else {
$peopleSearch.prev().hide();
}
});
$peopleSearch.on('keyup', function (e) {
var keyword = $peopleSearch.val() || '',
keyCode = utils.getKeyCode(e);
if (keyCode == 13) {
utils.peopleSearch(keyword);
}
});
$peopleSearch.next().on('click', function () {
var keyword = $peopleSearch.val() || '';
if (keyword) {
utils.peopleSearch(keyword);
}
});
$('.btn_search_area').click(function (e) {
e.preventDefault();
var $self = $(this);
var obj = '#layer_search_area';
$(obj).attr('tabindex', '0').focus();
$(".layer_search_area").fadeToggle(500);
$(obj).find('.btn_close').click(function () {
$(obj).fadeOut(500);
$self.focus();
$(this).off('click');
});
return false;
});
$(document).on('click scroll', function (e) {
if ($("#layer_search_area").css("display") == "block") {
if (!$('#layer_search_area').has(e.target).length) {
$(".layer_search_area").stop().fadeOut(500);
}
}
});
});
// 대괄호 영역 내용 전부 제거
String.prototype.ReplaceSquarebrackets = function () {
return this.replace(/\[.*\]/gi, '').replace(/\[.*\#93;/gi, '');
}
String.prototype.RenderString = function () {
return this.ReplaceAll(/"/, '"').ReplaceAll('', '').ReplaceAll('', '');
};
String.prototype.ReplaceAll = function (target, replacement) {
return this.split(target).join(replacement);
};
String.prototype.ImageResize = function (target, replacement) {
return this.split(target).join(replacement);
};
String.prototype.RenderIrPath = function (options) {
return String.Format("{0}?u={1}&{2}", utils.config('irPath'), this, options);
};
String.prototype.ReplacePdsImageSize = function (replacement) {
return this.replace(utils.config('pdsPath'), '').replace('.tn_120.jpg', '').replace('.tn_250.jpg', '').replace('.tn_350.jpg', '') + (typeof replacement != 'undefined' ? replacement : '') ;
};
String.Format = function () {
var s = arguments[0];
for (var i = 1; i < arguments.length; i++) {
var regEx = new RegExp("\\{" + (i - 1) + "\\}", "gm");
s = s.replace(regEx, arguments[i]);
}
return s;
}
function isEmpty (value) {
if (value == "" || value == null || value == undefined || (value != null && typeof value == "object" && !Object.keys(value).length))
return true
else
return false
};
//선거삭제
/*function fnVoteOpenLocationSel(search_loc) {
var searchloc = "";
if (search_loc != "search_loc0") {
searchloc = search_loc;
}
var url = utils.config("apiPath") + "/pagecall/?u=" + utils.config('webPcPath') + "/election2020/main/voteopenlocationhome?searchloc=" + searchloc;
try {
$.when(
$.ajax({
type: "GET"
, url: url
, async: false
, dataType: "HTML"
, success: function (res) {
if (res !== undefined && res !== null && res !== "") {
if ($("#divVoteOpenLocation").hasClass("slick-initialized")) {
$("#divVoteOpenLocation").slick('unslick');
$("#divVoteOpenLocation").unbind();
}
$("#divVoteOpenLocation").html(res);
}
}
})
).then(function () {
clearTimeout(homeVoteOpenTimer);
$("#ulVoteOpenLocation").children().removeClass();
$("#li_" + search_loc).addClass("on");
var item_length = $('.graph_wrap').length - 1;
if (item_length == 0) {
$(".column_wide .slide_wrap").slick({
arrows: true,
dots: false,
infinite: false,
speed: 300,
slidesToShow: 1,
slidesToScroll: 1,
dotsClass: 'custom_paging',
fade: true,
customPaging: function (slider, i) {
return '
' + (i + 1) + '';
}
})
//선거삭제
//homeVoteOpenTimer = setTimeout(function () {
// if (search_loc != undefined && search_loc != "") {
// var numSearchLoc = Number(search_loc.replace("search_loc", "")) + 1;
// if (numSearchLoc == 8) {
// numSearchLoc = 1;
// }
// var nextSearchLoc = "search_loc" + String(numSearchLoc);
// }
// fnVoteOpenLocationSel(nextSearchLoc);
// //fnVoteOpenLocationSel(search_loc);
//}, 10000);
} else {
$(".column_wide .slide_wrap").slick({
arrows: true,
dots: false,
infinite: false,
speed: 300,
slidesToShow: 1,
slidesToScroll: 1,
dotsClass: 'custom_paging',
fade: true,
autoplay: true,
autoplaySpeed: 10000,
customPaging: function (slider, i) {
return '
' + (i + 1) + '';
}
}).on('afterChange', function (event, slide, index) {
event.stopPropagation();
event.preventDefault();
if (item_length == index) {
//선거삭제
//homeVoteOpenTimer = setTimeout(function () {
// if (search_loc !== undefined && search_loc !== "") {
// var numSearchLoc = Number(search_loc.replace("search_loc", "")) + 1;
// if (numSearchLoc == 8) {
// numSearchLoc = 1;
// }
// var nextSearchLoc = "search_loc" + String(numSearchLoc);
// }
// fnVoteOpenLocationSel(nextSearchLoc);
// //fnVoteOpenLocationSel(search_loc);
//}, 10000);
};
});
}
});
} catch (e) { }
}*/
//선거삭제
/*function fnVoteOpenBirye(id) {
$("#ulVoteOpenBirye").children().removeClass();
$("#li_" + id).addClass("on");
$("#div_birye_party27").hide();
$("#div_birye_party4").hide();
$("#div_birye_party5").hide();
$("#div_birye_party7").hide();
$("#div_birye_party10").hide();
$("#div_birye_party3").hide();
$("#div_birye_party27").slick("unslick");
$("#div_birye_party4").slick("unslick");
$("#div_birye_party5").slick("unslick");
$("#div_birye_party7").slick("unslick");
$("#div_birye_party10").slick("unslick");
$("#div_birye_party3").slick("unslick");
$("#div_" + id).show();
$("#div_" + id).slick({
arrows: true,
dots: false,
infinite: false,
speed: 300,
slidesToShow: 1,
slidesToScroll: 1,
dotsClass: 'custom_paging',
fade: true,
customPaging: function (slider, i) {
return '
' + (i + 1) + '';
}
});
}*/