// Copyright (C) 2010-2019 Jacob Barkdull
// Under the terms of the GNU Affero General Public License.
// This program source code has been minified.
//
// Unminified version:
// https://freakspot.net/hashover-next/api/count-link.php?unminified

"use strict";function HashOverCountLink(settings){var countLinks=document.getElementsByClassName('hashover-count-link');if(!settings||settings.constructor!==Object){settings={}}for(var i=0,il=countLinks.length;i<il;i++){this.getCommentCount(countLinks[i],settings)}};var HashOverConstructor=HashOverCountLink;HashOverConstructor.cfgQueries=function(value,name,queries){name=name||[];queries=queries||[];if(typeof(value)!=='object'){var matrix='['+name.join('][')+']';var value=encodeURIComponent(value);queries.push('cfg'+matrix+'='+value);return}for(var key in value){HashOverConstructor.cfgQueries(value[key],name.concat(key),queries)}return queries};HashOverCountLink.prototype.getCommentCount=function(link,settings){var hashover=this;var queries=['url='+encodeURIComponent(link.href)];var requestPath=HashOverCountLink.backendPath+'/count-link-ajax.php';var cfgQueries=HashOverCountLink.cfgQueries(settings);queries=queries.concat(cfgQueries);this.ajax('POST',requestPath,queries,function(json){if(json['link-text']!==undefined){link.textContent=json['link-text']}},true)};HashOverConstructor.script=(function(){var loaderScript=document.getElementById('hashover-loader');var scripts=document.getElementsByTagName('script');var currentScript=document.currentScript||loaderScript;return currentScript||scripts[scripts.length-1]})();HashOverConstructor.rootPath=(function(){var scriptSrc=HashOverConstructor.script.getAttribute('src');var root=scriptSrc.replace(/\/[^\/]*\/?$/,'');return root})();HashOverConstructor.backendPath=(function(){return HashOverConstructor.rootPath+'/backend'})();HashOverConstructor.jsonp=[function(json){alert(json.message);}];HashOverConstructor.prototype.jsonp=function(method,path,data,callback,async){var source=this.constructor.toString();var constructor=source.match(/function(\w+)/)[1];this.constructor.jsonp.push(callback);data.push('jsonp='+(this.constructor.jsonp.length-1));data.push('jsonp_object='+constructor||'HashOver');var script=document.createElement('script');script.src=path+'?'+data.join('&');script.async=async;document.body.appendChild(script)};HashOverConstructor.prototype.ajax=function(method,path,data,callback,async){var hashover=this;var args=arguments;var onSuccess=function(){var json=JSON.parse(this.responseText);callback.apply(this,[ json ])};var onError=function(){hashover.jsonp.apply(hashover,args);hashover.ajax=hashover.jsonp};if('withCredentials' in new XMLHttpRequest()){var xhr=new XMLHttpRequest();xhr.onreadystatechange=function(){if(this.readyState!==4){return}if(this.status===200){return onSuccess.apply(this)}if(this.status===0){return onError()}};xhr.open(method,path,async);xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');xhr.withCredentials=true;xhr.send(data.join('&'));return}if(typeof(XDomainRequest)!=='undefined'){var xdr=new XDomainRequest();xdr.open(method,path);xdr.onload=onSuccess;xdr.onerror=onError;setTimeout(xdr.send,0);return}onError()};HashOverConstructor.onReady=function(callback){var state=document.readyState;if(state==='interactive'||state==='complete'){callback()}else{document.addEventListener('DOMContentLoaded',function(){callback()},false)}};HashOverCountLink.onReady(function(){window.hashoverCountLink=new HashOverCountLink()});

/*

	HashOver Statistics

	Execution Time     : 0.58413 ms
	Script Memory Peak : 0.42 MiB
	System Memory Peak : 2 MiB

*/