var rootElem = document.getElementById('InplyCommentBox'); rootElem = (rootElem == null)? document.getElementById('inplyCommentBox') : rootElem; if (!rootElem){ console.log("The root element is not found"); }else{ function load(script, target, callback){ if (script == undefined) { if(callback) callback(); return; } //var iframe = document.getElementById("inply-iframe"); //var target = iframe.contentWindow.document.getElementsByTagName(target)[0]; var target = document.getElementsByTagName(target)[0]; //var str = '<'+'script src="'+script+'" type="text/javascript"><' + '/script>'; //str = str.replace('/','\/'); var scr = document.createElement('script'); scr.setAttribute('src', script); scr.setAttribute('type', 'text/javascript'); target.appendChild(scr); if(callback) callback(); } function loadStyle(style){ var head = document.getElementsByTagName('head')[0]; var link = document.createElement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = style; link.media = 'all'; head.appendChild(link); } var InplyChatBox = { id: "", template: "", initialize: function(document, rootElem){ var cElem = document.createElement('frame-wrapper'); cElem.setAttribute('href', 'https://inply.net/Comment/EmbedBox?ClientId=a6fa2ca7-613b-4e8d-80fa-e2f83b59ab3b&ResouceId=b9f8deda-fa49-4a73-9796-9bccbd389b53&Language=ko'); cElem.setAttribute('ClientId', 'a6fa2ca7-613b-4e8d-80fa-e2f83b59ab3b'); cElem.setAttribute('Language', 'ko'); if (rootElem.append){ rootElem.append(cElem) }else{ //IE Eviroment rootElem.appendChild(cElem); } } } loadStyle('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'); loadStyle('https://inply.net/ClientApps/dist/inply.framewrapper.css'); InplyChatBox.initialize(document, rootElem); load('https://inply.net/ClientApps/dist/vendor.js', 'head', function(){ window.setTimeout(function(){ load('https://inply.net/ClientApps/dist/framewrapper-client.js','body'); },3000); }); }