summaryrefslogtreecommitdiff
path: root/src/data/templates
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2017-07-12 06:35:41 -0400
committerKjetil Orbekk <kjetil.orbekk@gmail.com>2017-07-12 11:38:25 -0400
commitf177dcb7b98300634fdef408150a83e9f476d66d (patch)
treeacc38470b061a3ff1bec8440d1957226dbfb22e6 /src/data/templates
parent80f1ddbe1e80682edd2d85b797a4d90ae4fc6f10 (diff)
add: Voting function
Diffstat (limited to 'src/data/templates')
-rw-r--r--src/data/templates/quotes.hbs15
-rw-r--r--src/data/templates/vote.hbs3
2 files changed, 16 insertions, 2 deletions
diff --git a/src/data/templates/quotes.hbs b/src/data/templates/quotes.hbs
index 0e38d22..45fa711 100644
--- a/src/data/templates/quotes.hbs
+++ b/src/data/templates/quotes.hbs
@@ -31,6 +31,18 @@
-moz-user-select: text;
}
</style>
+ <script type="text/javascript">
+ function vote(id, value) {
+ var http = new XMLHttpRequest();
+ http.open("GET","/vote?id="+id+"&vote="+value);
+ http.onreadystatechange=function() {
+ if(http.readyState==4) {
+ document.getElementById("v"+id).innerHTML = http.responseText;
+ }
+ }
+ http.send(null);
+ }
+ </script>
</head>
<body>
@@ -59,8 +71,7 @@ Dato: {{date}}, Score:
<a href="javascript:vote({{id}},2)">2</a>
<a href="javascript:vote({{id}},3)">3</a>
<a href="javascript:vote({{id}},4)">4</a>
- <a href="javascript:vote({{id}},5)">5</a>
- </font></span>,
+ <a href="javascript:vote({{id}},5)">5</a></font></span>,
<form method="post" style="display: inline;"action="http://www.vidarholen.net/contents/rage/index.php"><input type="hidden" name="irc" value="{{content}}"/><input type="submit" class="ragebutton" value="Rage it"/></form><br>
<br> <br>
diff --git a/src/data/templates/vote.hbs b/src/data/templates/vote.hbs
new file mode 100644
index 0000000..135fa2f
--- /dev/null
+++ b/src/data/templates/vote.hbs
@@ -0,0 +1,3 @@
+{{#with quote}}
+{{score}} (fra {{votes}})
+{{/with}}