Update main video ID.
[gnupg-doc.git] / web / share / campaign / campaign.js
index 2f4bdce..4190bb9 100644 (file)
@@ -58,12 +58,13 @@ $(document).ready(function() {
   for (let idx = 0; idx < vals.length; ++idx) {
     let value = vals[idx];
     $(".amount-btn-" + value.toString()).attr("href", "#");
-    $(".amount-btn-" + value.toString()).on("click", function() {
+    $(".amount-btn-" + value.toString()).on("click", function(event) {
       $("#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);
+      event.preventDefault();
     });
   }
 });
@@ -86,6 +87,28 @@ function get_param_from_url(name) {
 
 /* Defer loading Youtube iframe until the user clicks on the video.  */
 $(document).ready(function() {
+
+    let YTID = { "main": "wNHhkntqklg",
+                "thenmozhi": "2V-6JdTsIns",
+                "sze": "tKPMof5ptc0",
+                "sheera": "zwPaVA4vhDM",
+                "seanus": "H6iO_MkOICM",
+                "noah": "neibFsqgxgw",
+                "michael": "w4PY1ihLm0w",
+                "matt": "MWxhdPw9I8c",
+                "lisa": "Vd8sz5X-1og",
+                "john": "xdVHQhWrIro",
+                "jason": "RtvlfTiSEMc",
+                "geoffrey": "Y4yat43CvEc",
+                "daniel": "coFFCJlMRjk",
+                "cindy": "kPSEYvmFLWY",
+                "benjamin": "mnVsS_kuwqo",
+                "arthur": "Js_OqRLm9F4",
+                "andrew": "DXiU9wewjn4",
+                "andre": "sYXQxEPpnvA",
+                "alex": "5FtL5hAcxk4"
+              };
+
     /* For the video preview, we use this for devices without hover events.  */
     if ("ontouchstart" in document.documentElement) {
        $("body").addClass("touch");
@@ -107,11 +130,15 @@ $(document).ready(function() {
     /* Click handler for all videos.  */
     $(".camp-video").one("click", function() {
        let yt_id = $(this).data("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) {
            extra_parms = "&list=" + yt_list;
        }
+       if (screen.width < 768) {
+           extra_parms = extra_parms + "&cc_load_policy=1"
+       }
        $(this).html('<iframe class="embed-responsive-item" allowfullscreen src="https://www.youtube.com/embed/'
                     + yt_id + '?autoplay=1&modestbranding=1&rel=0' + extra_parms + '"></iframe>');
     });