window.onload = function () { var url = window.location.pathname, file = url.split('/')[url.split('/').length - 1].substring(0,5); if (file == 'entry') { add_shares(url); } }; function add_shares (url) { var section = document.getElementsByTagName('section')[0], script = document.createElement('script'); script.type = 'text/javascript'; script.src = '/hashover/comments.php'; section.appendChild(script); }