web: Better votd handling.
authorMarcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de>
Wed, 7 Jun 2017 09:28:33 +0000 (11:28 +0200)
committerMarcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de>
Wed, 7 Jun 2017 09:52:37 +0000 (11:52 +0200)
web/donate/index.de.org
web/donate/index.fr.org
web/donate/index.ja.org
web/donate/index.org
web/share/campaign/campaign.js
web/share/campaign/img/thumbs/votd.jpg [new file with mode: 0644]

index c7a1ed6..8ad986a 100644 (file)
@@ -213,9 +213,9 @@ href="/cgi-bin/procdonate.cgi?mode=preset&lang=de"
          <div class="row">
            <div class="col-lg-10 col-lg-offset-0">
              <div class="embed-responsive embed-responsive-16by9 camp-video"
-                  data-embed="andre,alex,benjamin"
+                  data-embed="votd"
                    data-embed-list="PLjX3x3GHoOWKs-VCjFBu_Yk5l1-l9mJzi">
-               <img src="/share/campaign/img/thumbs/andre.jpg">
+               <img src="/share/campaign/img/thumbs/votd.jpg">
                <div class="play-button"></div>
                <div class="video-text">Klicken um das Video zu starten
                  <noscript><br />
index d370bc2..3cae60b 100644 (file)
          <div class="row">
            <div class="col-lg-10 col-lg-offset-0">
              <div class="embed-responsive embed-responsive-16by9 camp-video"
-                  data-embed="benjamin,alex,andre"
+                  data-embed="votd"
                    data-embed-list="PLjX3x3GHoOWKs-VCjFBu_Yk5l1-l9mJzi">
-               <img src="/share/campaign/img/thumbs/benjamin.jpg">
+               <img src="/share/campaign/img/thumbs/votd.jpg">
                <div class="play-button"></div>
                <div class="video-text">Cliquez pour lancer la vidéo
                   <noscript><br />
index 7e5547b..cce9aa2 100644 (file)
          <div class="row">
            <div class="col-lg-10 col-lg-offset-0">
              <div class="embed-responsive embed-responsive-16by9 camp-video"
-                  data-embed="alex,andre,benjamin"
+                  data-embed="votd"
                    data-embed-list="PLjX3x3GHoOWKs-VCjFBu_Yk5l1-l9mJzi">
-               <img src="/share/campaign/img/thumbs/qmuXUVg9Mjo.jpg">
+               <img src="/share/campaign/img/thumbs/votd.jpg">
                <div class="play-button"></div>
                <div class="video-text">クリックして動画をスタート
                   <noscript><br />
index cc957d7..193c963 100644 (file)
          <div class="row">
            <div class="col-lg-10 col-lg-offset-0">
              <div class="embed-responsive embed-responsive-16by9 camp-video"
-                  data-embed="alex,andre,benjamin"
+                  data-embed="votd"
                    data-embed-list="PLjX3x3GHoOWKs-VCjFBu_Yk5l1-l9mJzi">
-               <img src="/share/campaign/img/thumbs/alex.jpg">
+               <img src="/share/campaign/img/thumbs/votd.jpg">
                <div class="play-button"></div>
                <div class="video-text">Click to start the video
                   <noscript><br />
index f158b5f..6cecf8b 100644 (file)
@@ -88,8 +88,11 @@ 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 = "thenmozhi,alex,andre,benjamin";
+
     let YTID = { "main": "wNHhkntqklg",
-                "thenmozhi": "2V-6JdTsIns",
+                "thenmozhi": "sQMj332dgIE",
                 "sze": "tKPMof5ptc0",
                 "sheera": "zwPaVA4vhDM",
                 "seanus": "H6iO_MkOICM",
@@ -116,12 +119,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 +137,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 = "";
diff --git a/web/share/campaign/img/thumbs/votd.jpg b/web/share/campaign/img/thumbs/votd.jpg
new file mode 100644 (file)
index 0000000..049e477
Binary files /dev/null and b/web/share/campaign/img/thumbs/votd.jpg differ