campaign: Change video of the day to Jason Reich.
[gnupg-doc.git] / web / share / campaign / campaign.js
index 99d08fb..2c05d66 100644 (file)
@@ -62,8 +62,8 @@ $(document).ready(function() {
       $("#amountother").prop("value", value.toString());
       $("#currency option").prop("selected", false);
       $("#currency option[value='EUR']").prop("selected", true);
-      $("#recur option").prop("selected", false);
-      $("#recur option[value='12']").prop("selected", true);
+      //$("#recur option").prop("selected", false);
+      //$("#recur option[value='12']").prop("selected", true);
       event.preventDefault();
     });
   }
@@ -87,6 +87,33 @@ function get_param_from_url(name) {
 
 /* Defer loading Youtube iframe until the user clicks on the video.  */
 $(document).ready(function() {
+
+    // VOTD: Update VOTD here.
+    let VIDLIST = "jason,sze,rysiek,ksenia,cindy,matt,thenmozhi,alex,andre,benjamin";
+
+    let YTID = { "main": "wNHhkntqklg",
+                "thenmozhi": "sQMj332dgIE",
+                "sze": "OpeFuKRYGVA",
+                "sheera": "zwPaVA4vhDM",
+                "seanus": "H6iO_MkOICM",
+                "noah": "neibFsqgxgw",
+                "michael": "w4PY1ihLm0w",
+                "matt": "5MCGTd8pOG4",
+                "lisa": "Vd8sz5X-1og",
+                "john": "xdVHQhWrIro",
+                "jason": "oQvP9SXm-ek",
+                "geoffrey": "Y4yat43CvEc",
+                "daniel": "coFFCJlMRjk",
+                "cindy": "IdCiJMc3q80",
+                "benjamin": "atFz16nInIs",
+                "arthur": "Js_OqRLm9F4",
+                "andrew": "DXiU9wewjn4",
+                "andre": "bcNLlWqZ9d0",
+                "alex": "1OMJWpdl0DA",
+                 "ksenia": "Qqg3_a72aEw",
+                 "rysiek": "6DqfWz-KHSI"
+              };
+
     /* For the video preview, we use this for devices without hover events.  */
     if ("ontouchstart" in document.documentElement) {
        $("body").addClass("touch");
@@ -94,12 +121,17 @@ $(document).ready(function() {
 
     let wanted_yt_id = get_param_from_url('play');
     $(".camp-video").each(function() {
-       let yt_ids = $(this).data("embed").split(",");
+       let embed = $(this).data("embed");
+       if (embed != 'votd') {
+           return;
+       }
+       let yt_ids = VIDLIST.split(",");
        let yt_id_idx = yt_ids.indexOf(wanted_yt_id);
-       if (yt_id_idx != -1) {
-           $(this).data("embed", wanted_yt_id);
-           $(this).children("img").attr("src", "/share/campaign/img/thumbs/" + wanted_yt_id + ".jpg");
+       if (yt_id_idx == -1) {
+           wanted_yt_id = yt_ids[0];
        }
+       $(this).data("embed", wanted_yt_id);
+       $(this).children("img").attr("src", "/share/campaign/img/thumbs/" + wanted_yt_id + ".jpg");
     });
 
     /* To download the thumbs in share/campaign/img/thumbs:
@@ -107,7 +139,12 @@ $(document).ready(function() {
 
     /* Click handler for all videos.  */
     $(".camp-video").one("click", function() {
-       let yt_id = $(this).data("embed").split(",")[0];
+       let embed = $(this).data("embed");
+       if (embed == 'votd') {
+           embed = VIDLIST;
+       }
+       let yt_id = embed.split(",")[0];
+       yt_id = YTID[yt_id]; // What if key does not exist?
        let yt_list = $(this).data("embed-list");
        let extra_parms = "";
        if (yt_list) {
@@ -120,3 +157,16 @@ $(document).ready(function() {
                     + yt_id + '?autoplay=1&modestbranding=1&rel=0' + extra_parms + '"></iframe>');
     });
 });
+
+/* hide the note about recurring donations under the Paypal option.  */
+$(document).ready(function() {
+  $("#recur").change(function() {
+    console.log
+    if (this.value === "0") {
+      $("#paypal-note").hide();
+    }
+    else {
+      $("#paypal-note").show();
+    }
+  });
+});