var CoviEmbedHtml =
'
' +
'
' +
' ' +
'
' +
// '
' +
// '' +
// '' +
// '
' +
'
' +
' ' +
' ' +
'
' +
'
' +
'
' +
'
' +
// '' +
// '
' +
// '
' +
// '
' +
'';
var CoviNativeItemsMapping = {
// '+ad_identity': {
// 'native-element': 'covi_adidentity',
// value: 'AD',
// },
};
var CoviNativeElements = {
covi_player: {
className: 'covi_player',
},
covi_playback: {
className: 'covi_playback',
},
covi_playback_muteunmute: {
className: 'covi_playback_muteunmute',
eventFunc: 'onMuteUnmute',
},
'covi_playback_mute-img': {
className: 'covi_playback_mute-img',
src: 'mute_30x29.png',
},
'covi_playback_unmute-img': {
className: 'covi_playback_unmute-img',
src: 'unmute_28x28.png',
},
covi_playback_bi: {
className: 'covi_playback_bi',
eventFunc: 'onCoviBi',
},
'covi_playback_bi-img': {
className: 'covi_playback_bi-img',
src: 'covi_bi.png',
},
covi_playback_replay: {
className: 'covi_playback_replay',
eventFunc: 'onReplay',
},
'covi_playback_replay-img': {
className: 'covi_playback_replay-img',
src: 'replay_72x72.png',
},
// covi_playback_seek: {
// className: 'covi_playback_seek',
// eventFunc: 'onSeek',
// },
// covi_playback_currenttime: {
// className: 'covi_playback_currenttime',
// },
// covi_playback_durationtime: {
// className: 'covi_playback_durationtime',
// },
// covi_playback_adclose: {
// className: 'covi_playback_adclose',
// eventFunc: 'onAdClose',
// },
// 'covi_adidentity-container': {
// className: 'covi_adidentity-container',
// },
// covi_adidentity: {
// type: 'p',
// className: 'covi_adidentity',
// },
};
var CoviIndex = 0;
var CoviPlayers = new Array();
function createCoviMain() {
var coviElem = document.getElementsByClassName('covi')[CoviIndex];
if (!coviElem) {
return;
}
coviElem.setAttribute('covi-index', CoviIndex);
// 2022-10-11 comment out
/*if (isGalaxyS21()) {
runPassback(coviElem);
return;
}*/
var coviOpts = {
containerClassName: 'covi,' + CoviIndex,
style: 'hani_artcle_m',
type: 'prod',
pcode: 'hani_artcle_m',
category: 'news_hani',
videoPlayType: 'autoplay',
gender: '',
age: '',
idx: CoviIndex,
rootElem: coviElem,
certVendor: 'ias',
};
var coviEventHandler = function (event) {
switch (event) {
case 'PLAYER_VIDEO_PLAY':
break;
case 'PLAYER_VIDEO_PAUSE':
break;
case 'PLAYER_VIDEO_ENDED':
break;
case 'PLAYER_NO_ADS':
console.log('[covi] no ads');
coviElem.style.display = 'block';
coviElem.style.textAlign = 'center';
coviElem.style.width = '100%';
// coviElem.style.height = '100%';
// coviElem.style.backgroundColor = "#ffffff";
coviElem.style.backgroundColor = 'transparent';
runPassback(coviElem);
break;
}
};
var coviplayer = new CoviPlayer(coviOpts, coviEventHandler);
coviplayer.run();
CoviPlayers[CoviIndex] = coviplayer;
++CoviIndex;
}
function coviClickLandingButton(coviIndex) {
var coviplayer = CoviPlayers[coviIndex];
if (coviplayer) {
var landingUrl;
coviplayer.onClickLandingButton(function (url) {
landingUrl = url;
}, true);
var timer = window.setInterval(function () {
if (landingUrl !== 'undefined') {
window.clearInterval(timer);
var coviPopup = window.open(landingUrl, '_blank');
}
}, 200);
}
}
function createCovi() {
window.setTimeout(function () {
createCoviMain();
}, 500);
}
function checkCoviTag() {
var elem = document.querySelector('.covi');
if (elem) {
createCovi();
}
}
function coviAdClose() {
var coviElem = document.getElementsByClassName('covi')[0];
if (!coviElem) {
return;
}
var parent = coviElem.parentElement;
parent.removeChild(coviElem);
}
function runPassback(coviElem) {
var d = window.document;
try {
d = window.top.document;
} catch (e) {}
var adFrame = d.createElement('iframe');
adFrame.width = 300;
adFrame.height = 250;
adFrame.border = 0;
adFrame.style.border = '0';
adFrame.frameBorder = 0;
adFrame.scrolling = 'no';
adFrame.marginWidth = '0';
adFrame.marginHeight = '0';
adFrame.style = 'display: block; margin: 12px auto;';
coviElem.appendChild(adFrame);
adFrame.contentWindow.document.open('text/html');
//+ 2022-08-18 목
// 해당 스크립트 다이렉트로 적용
adFrame.contentWindow.document.write(``);
//- 2022-08-23 화 원복
//adFrame.contentWindow.document.write(``);
//adFrame.contentWindow.document.write(``);
adFrame.contentWindow.document.close();
//+20220823
var count = 0;
var timer = window.setInterval(function () {
var aswift_0_host = adFrame.contentWindow.document.getElementById('aswift_0_host');
if (aswift_0_host == null) {
coviElem.parentElement.style.backgroundColor = '#ffffff';
window.clearInterval(timer);
}
if (count == 4) {
window.clearInterval(timer);
}
count++;
}, 1500);
}
function isGalaxyS21() {
var userAgent = window.navigator.userAgent;
var isGalaxyS21 = false;
if (userAgent.indexOf('SM-G990') >= 0) {
isGalaxyS21 = true;
}
if (userAgent.indexOf('SM-G991') >= 0) {
isGalaxyS21 = true;
}
if (userAgent.indexOf('SM-G996') >= 0) {
isGalaxyS21 = true;
}
if (userAgent.indexOf('SM-G998') >= 0) {
isGalaxyS21 = true;
}
return isGalaxyS21;
}
checkCoviTag();