campaign: Change video of the day to Jason Reich.
[gnupg-doc.git] / web / share / campaign / campaign.js
index e540012..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();
     });
   }
@@ -88,25 +88,30 @@ 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": "2V-6JdTsIns",
-                "sze": "tKPMof5ptc0",
+                "thenmozhi": "sQMj332dgIE",
+                "sze": "OpeFuKRYGVA",
                 "sheera": "zwPaVA4vhDM",
                 "seanus": "H6iO_MkOICM",
                 "noah": "neibFsqgxgw",
                 "michael": "w4PY1ihLm0w",
-                "matt": "MWxhdPw9I8c",
+                "matt": "5MCGTd8pOG4",
                 "lisa": "Vd8sz5X-1og",
                 "john": "xdVHQhWrIro",
-                "jason": "RtvlfTiSEMc",
+                "jason": "oQvP9SXm-ek",
                 "geoffrey": "Y4yat43CvEc",
                 "daniel": "coFFCJlMRjk",
-                "cindy": "kPSEYvmFLWY",
+                "cindy": "IdCiJMc3q80",
                 "benjamin": "atFz16nInIs",
                 "arthur": "Js_OqRLm9F4",
                 "andrew": "DXiU9wewjn4",
                 "andre": "bcNLlWqZ9d0",
-                "alex": "1OMJWpdl0DA"
+                "alex": "1OMJWpdl0DA",
+                 "ksenia": "Qqg3_a72aEw",
+                 "rysiek": "6DqfWz-KHSI"
               };
 
     /* For the video preview, we use this for devices without hover events.  */
@@ -116,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:
@@ -129,7 +139,11 @@ $(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 = "";