window.CLH_UTIL = window.CLH_UTIL || function(uuid){ var clh_related_div = document.getElementById('clh_related_container'); var thys = this; var text = '
'+ '
'+ '
'; this.getURL= function(){ var metas = document.getElementsByTagName('link'); var url; for (var i=0; i < metas.length; i++) { if (metas[i].getAttribute("rel") == "canonical") { url = metas[i].getAttribute("href"); if (!url.match(/^http(s?):/)) { url = window.location.origin + url; } break; } } return encodeURIComponent(url?url:window.location.href); }; var c_url = thys.getURL(); this.loadScript = function(src, async, cb){ var s = document.createElement('script'); s.type = "text/javascript"; s.src = src; s.async = !!async; if(s.addEventListener) { s.addEventListener('load', function (e) { cb && cb(); }, false); } else if(s.attachEvent) { s.attachEvent('load', function (e) { cb && cb(); }); } clh_related_div.appendChild(s); }; this.renderRelated = function(){ var contain; if(!!clh_related_div){ contain = clh_related_div; clh_related_div.innerHTML = text; thys.loadScript('https://player.cliphub.io/js/clh.js?v=1.1.16',false, function(){ thys.loadScript('https://player.cliphub.io/related?tid='+uuid+'&url='+c_url,true); }); }else{ document.write(text); document.write(''); document.write(''); contain = document.getElementById(uuid+'-wrapper'); } contain.parentNode.style.height = 'auto'; if(contain.parentNode.childElementCount == 1 && contain.parentNode.style.background !='#fff'){ contain.parentNode.style.background ='#fff'; } }; }; (new window.CLH_UTIL('related-5bab95fb26301')).renderRelated();