summaryrefslogtreecommitdiffstats
path: root/wiki/src/donate
diff options
context:
space:
mode:
authorsajolida <sajolida@pimienta.org>2016-09-11 18:30:01 +0000
committersajolida <sajolida@pimienta.org>2016-09-11 18:30:52 +0000
commit74eae0d3dc8459e85c887f6847f0443c44b05122 (patch)
treee05fbd882a57a1f604c1401dc9c9060a144c603a /wiki/src/donate
parent4361da88f3fd3bc5d8fd281cb85211b4a4b37ada (diff)
Randomize display of suggested tweets
So that stats that we can do on their popularity are not biased by their order.
Diffstat (limited to 'wiki/src/donate')
-rw-r--r--wiki/src/donate/thanks.html6
-rw-r--r--wiki/src/donate/thanks.js30
2 files changed, 36 insertions, 0 deletions
diff --git a/wiki/src/donate/thanks.html b/wiki/src/donate/thanks.html
index db20a4a..b28c7a4 100644
--- a/wiki/src/donate/thanks.html
+++ b/wiki/src/donate/thanks.html
@@ -1,6 +1,8 @@
[[!meta title="Thank you!"]]
[[!meta stylesheet="donate/thanks" rel="stylesheet" title=""]]
+[[!meta script="lib/js/jquery"]] <!-- https://code.jquery.com/jquery-1.9.1.min.js -->
+[[!meta script="thanks"]]
<div id="smiley">[[!img love.png link="no" class="smiley"]]</div>
@@ -12,6 +14,8 @@
It is great to show that you care about Internet freedom and encourage others to do the same!
+<div id="tweets">
+
<!-- Maximum Tweet length -->
<a href="https://twitter.com/intent/tweet?text=I+donate+to+@Tails_live+because+nobody+should+have+to+pay+to+be+safe+while+using+computers: https://tails.boum.org/donate#nobody" class="tweet">
@@ -31,3 +35,5 @@ It takes more than two to do the anonymity dance. Join me in donating to @Tails_
</a>
</div>
+
+</div>
diff --git a/wiki/src/donate/thanks.js b/wiki/src/donate/thanks.js
new file mode 100644
index 0000000..337c6cb
--- /dev/null
+++ b/wiki/src/donate/thanks.js
@@ -0,0 +1,30 @@
+$(document).ready(function(){
+
+ var list = document.getElementById("tweets");
+
+ function shuffle(items) {
+ var cached = items.slice(0), temp, i = cached.length, rand;
+ while(--i)
+ {
+ rand = Math.floor(i * Math.random());
+ temp = cached[rand];
+ cached[rand] = cached[i];
+ cached[i] = temp;
+ }
+ return cached;
+ }
+
+ function shuffleNodes() {
+ var nodes = list.children, i = 0;
+ nodes = Array.prototype.slice.call(nodes);
+ nodes = shuffle(nodes);
+ while(i < nodes.length)
+ {
+ list.appendChild(nodes[i]);
+ ++i;
+ }
+ }
+
+ shuffleNodes();
+
+});