diff --git a/README.md b/README.md index 5ec55c4..0184b58 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,35 @@ -# friendica-comment -Show comments from friendica in your blog +## friendica-comment# + +Script shows comments from your friendica server in your (static website) blog. Possible replacement for disqus. + +## Requirements ## + +# CORS # +[CORS] (http://enable-cors.org) (Cross Site Scripting) must be activated: +in .htaccess: + Header add Access-Control-Allow-Origin "*" + Header add Access-Control-Allow-Methods: "GET" + +In apache module headers must be activated: + a2enmod headers + +# Friendica # + +RSS of your blog must be in your contacts and configured as 'remote_self' (articles are shown in your public friendica timeline). + +# Blog # +In blog html: + +friendica_domain must be set + + +Name of the blog entry is in

article

+ +Placeholder for comments:
+ +## TODO ## +* connection to friendica via https +* CSS for ,
,
+ diff --git a/friendica_comments.js b/friendica_comments.js new file mode 100644 index 0000000..1277f46 --- /dev/null +++ b/friendica_comments.js @@ -0,0 +1,49 @@ +var article = document.getElementsByTagName("article")[0].innerHTML; +var article_name= article.substring(article.indexOf('')); +var search = friendica_domain + "/search?search=" + article_name.replace(/ /gi,'+'); +var http, http2 = null; +var ergebnis = ""; + +http = new XMLHttpRequest(); +if (http !== null) { + http.open("GET", search, true); + http.onreadystatechange = SearchFriendica; + http.send(null); +} + +function SearchFriendica() { + if (http.readyState == 4 && http.status==200) { + var SearchResult= http.responseText; + var start = SearchResult.indexOf('