/** * disqus-here * @version v0.0.1 - 2014-04-17 * @link https://github.com/lukasz-zak/disqus-here * @author Łukasz Żak <> * @license MIT License, http://www.opensource.org/licenses/MIT */ "use strict";angular.module("disqusHere",[]).directive("disqusHere",["$window",function(a){return{restrict:"E",scope:{shortname:"@",identifier:"@",title:"@",url:"@",categoryId:"@",disableMobile:"@",onReady:"&",displayComments:"="},template:'
',link:function(b){var c=!1,d="embedDisqusScript";b.$watch("displayComments",function(e){angular.isDefined(e)||(e="true"),a.disqus_shortname=b.shortname,a.disqus_identifier=b.identifier,a.disqus_title=b.title,a.disqus_url=b.url,a.disqus_category_id=b.categoryId,a.disqus_disable_mobile=b.disableMobile,a.disqus_config=function(){this.callbacks.onReady=[b.onReady]};var f=document.getElementById("embedDisqusScript");if(e&&null===f){var g=document.createElement("script");g.type="text/javascript",g.id=d,g.async=!0,g.src="//"+b.shortname+".disqus.com/embed.js",g.addEventListener("load",function(){c=!0});var h=document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0];h.appendChild(g)}else e&&null!==f&&a.DISQUS.reset({reload:!0,config:function(){this.page.identifier=a.disqus_identifier,this.page.url=a.disqus_url}})})}}}]);