summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2014-12-27 00:08:50 +0000
committerAaron Parecki <aaron@parecki.com>2014-12-27 00:08:50 +0000
commit87a76f495eb3126e6d3adb5bf675fdb41682a16d (patch)
tree79b37a3c90955787f28ec4578c7112a44e39c505 /public/js
parent89afcc13490b7f89ddd1301394acef34682d52b2 (diff)
parent875a9fd90944eef8bf94f24594c80b9433ec824d (diff)
Merge branch 'master' of github.com:aaronpk/IndiePost
Diffstat (limited to 'public/js')
-rw-r--r--public/js/fav.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/public/js/fav.js b/public/js/fav.js
new file mode 100644
index 0000000..4288329
--- /dev/null
+++ b/public/js/fav.js
@@ -0,0 +1,23 @@
+console.log("Favoriting with token: " + quill_token);
+
+var http = new XMLHttpRequest();
+var params = "like-of=" + encodeURIComponent(window.location) + "&token=" + quill_token;
+
+http.open("POST", "http://quill.dev/favorite", true);
+http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+
+http.onreadystatechange = function() {//Call a function when the state changes.
+ console.log(http);
+ if(http.readyState == 4 && http.status == 200) {
+ alert(http.responseText);
+ }
+}
+http.send(params);
+
+/*
+
+(function(){var el=document.createElement('input'); el.type="hidden"; el.id="quill_token"; el.value="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMjciLCJtZSI6Imh0dHA6XC9cL2Fhcm9ucGFyZWNraS5jb20iLCJjcmVhdGVkX2F0IjoxNDEwMTE3NTM5fQ.ifp1VIgCTz9NPtMTlTLPBXAGSxHwpGS5tLPhXGxrjNk"; document.body.appendChild(el); document.body.appendChild(document.createElement('script')).src='http://quill.dev/js/fav.js';})();
+
+(function(){document.body.appendChild(document.createElement('script')).src='http://quill.dev/favorite.js?url='+encodeURIComponent(window.location)+'&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMSIsIm1lIjoiaHR0cDpcL1wvcGsuZGV2XC8iLCJjcmVhdGVkX2F0IjoxNDE5MDM2NzAzfQ.AgJ5xyviiBzWOvQO0je0Bdi3BUpKJ4CLJnx8GIm-0OI';})();
+
+*/ \ No newline at end of file