[www-doc] [Git][VideoLAN.org/websites][master] Add sponsors carousel

Jean-Baptiste Kempf gitlab at videolan.org
Tue Jun 7 17:54:47 CEST 2016


Jean-Baptiste Kempf pushed to branch master at VideoLAN organization / websites


Commits:
6a703f4f by David Loiret at 2016-06-07T17:53:43+02:00
Add sponsors carousel

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

- - - - -


6 changed files:

- + www.videolan.org/images/partners/google-2015.png
- www.videolan.org/include/header.php
- + www.videolan.org/include/sponsors.php
- www.videolan.org/index.php
- www.videolan.org/js/slick-init.js
- www.videolan.org/style/slick-theme.scss


Changes:

=====================================
www.videolan.org/images/partners/google-2015.png
=====================================
Binary files /dev/null and b/www.videolan.org/images/partners/google-2015.png differ


=====================================
www.videolan.org/include/header.php
=====================================
--- a/www.videolan.org/include/header.php
+++ b/www.videolan.org/include/header.php
@@ -1,5 +1,6 @@
 <?php
 require_once($_SERVER["DOCUMENT_ROOT"]."/include/include.php");
+require_once($_SERVER["DOCUMENT_ROOT"]."/include/sponsors.php");
 
 function getLocaleFromLanguage( $language )
 {
@@ -271,7 +272,7 @@ function start_head( $title,
 }
 
 /* Actual start of the body */
-function start_body( $body_color, $language, $b_show_donate = true, $nobanner, $alternate_lang, $new_design_class )
+function start_body( $body_color, $language, $b_show_donate = true, $nobanner, $alternate_lang, $new_design_class, $show_sponsors_carousel )
 {
     echo "<body class='$new_design_class'>";
     echo "<div id='bodyInner' class='$body_color'>";
@@ -290,6 +291,21 @@ function start_body( $body_color, $language, $b_show_donate = true, $nobanner, $
                 <?php
                 echo 'VideoLAN, '. _('a project and a').' <a href="//www.videolan.org/videolan/" class="noUnderline">'._('non-profit organization').'.</a> ';?>
         </div>
+        <?php if ($show_sponsors_carousel) {
+            $sponsorsDir = isDeveloper() ? '' : '//images.videolan.org/';
+            $sponsorsDir .= 'images/partners/';
+            $sponsors = getSponsors();
+            shuffle($sponsors);
+            ?>
+            <div id="sponsors-carousel">
+                <?php foreach($sponsors as $sponsor) {
+                    echo '<a target="_blank" href="' . $sponsor["link"] .'">' .
+                    '<img src="' . $sponsorsDir . $sponsor["imgSrc"] . '">' .
+                    '</a>';
+                }
+                ?>
+            </div>
+        <?php } ?>
     </div>
 <?php
 }
@@ -300,20 +316,21 @@ function start_body( $body_color, $language, $b_show_donate = true, $nobanner, $
 
 /* Default configuration options taken from the file */
 if(!isset($language) || $language == "" ) { $language = "en"; }
-if(!isset($additional_css)) $additional_css = array();
-if(!isset($additional_js))  $additional_js  = array();
-if(!isset($additional_meta)) $additional_meta = array();
-if(!isset($alternate_lang)) $alternate_lang = array();
-if(!isset($body_onload))    $body_onload    = "";
-if(!isset($body_onunload))  $body_onunload  = "";
-if(!isset($body_color))     $body_color     = "orange";
-if(!isset($nobanner))       $nobanner       = false;
-if(!isset($show_donate))    $show_donate    = true;
-if(!isset($new_design))     $new_design     = false;
+if(!isset($additional_css))         $additional_css = array();
+if(!isset($additional_js))          $additional_js  = array();
+if(!isset($additional_meta))        $additional_meta = array();
+if(!isset($alternate_lang))         $alternate_lang = array();
+if(!isset($body_onload))            $body_onload    = "";
+if(!isset($body_onunload))          $body_onunload  = "";
+if(!isset($body_color))             $body_color     = "orange";
+if(!isset($nobanner))               $nobanner       = false;
+if(!isset($show_donate))            $show_donate    = true;
+if(!isset($new_design))             $new_design     = false;
+if(!isset($show_sponsors_carousel)) $show_sponsors_carousel = false;
 
 $new_design_class = $new_design ? 'new-design' : '';
 /* render the page */
 start_head( preg_replace( "/<[^>]*>/", "" , $title ), $body_color, $language,
            $additional_css, $additional_js, $additional_meta, $alternate_lang, $body_onload, $body_onunload, $new_design );
-start_body( $body_color, $language, $show_donate, $nobanner, $alternate_lang, $new_design_class );
+start_body( $body_color, $language, $show_donate, $nobanner, $alternate_lang, $new_design_class, $show_sponsors_carousel );
 ?>


=====================================
www.videolan.org/include/sponsors.php
=====================================
--- /dev/null
+++ b/www.videolan.org/include/sponsors.php
@@ -0,0 +1,66 @@
+<?php
+
+$SPONSORS = array(
+    array(
+        "imgSrc"    => "ab.png",
+        "link"      => "https://www.hpe.com"
+    ),
+    array(
+        "imgSrc"    => "anevia.jpg",
+        "link"      => "http://www.anevia-group.com"
+    ),
+    array (
+        "imgSrc"    => "april_logo.png",
+        "link"      => "https://www.april.org/"
+    ),
+    array (
+        "imgSrc"    => "att.gif",
+        "link"      => "https://www.att.com/"
+    ),
+    array (
+        "imgSrc"    => "criteo.png",
+        "link"      => "http://www.criteo.com"
+    ),
+    array (
+        "imgSrc"    => "epitech.jpg",
+        "link"      => "http://www.epitech.eu"
+    ),
+    array (
+        "imgSrc"    => "free.gif",
+        "link"      => "https://www.free.fr/"
+    ),
+    array (
+        "imgSrc"    => "gandi.png",
+        "link"      => "https://gandi.net"
+    ),
+    array (
+        "imgSrc"    => "google-2015.png",
+        "link"      => "https://google.com"
+    ),
+    array (
+        "imgSrc"    => "hpinvent.gif",
+        "link"      => "http://www.hp.com/"
+    ),
+    array (
+        "imgSrc"    => "puget.jpg",
+        "link"      => "https://www.pugetsystems.com"
+    ),
+    array (
+        "imgSrc"    => "videolabs.png",
+        "link"      => "https://videolabs.io"
+    ),
+    array (
+        "imgSrc"    => "wdlogo.jpg",
+        "link"      => "http://www.wdc.com/"
+    ),
+    array (
+        "imgSrc"    => "zf.jpg",
+        "link"      => "http://www.zf.com/"
+    )
+);
+
+function getSponsors() {
+    global $SPONSORS;
+    return $SPONSORS;
+}
+?>


=====================================
www.videolan.org/index.php
=====================================
--- a/www.videolan.org/index.php
+++ b/www.videolan.org/index.php
@@ -6,6 +6,7 @@ $body_color = "blue";
 $new_design = true;
 $additional_js = array("/js/slick-init.js", "/js/slick.min.js");
 $additional_css = array("/style/slick.min.css");
+$show_sponsors_carousel = true;
 
 require($_SERVER["DOCUMENT_ROOT"] . "/include/language.php");
 require($_SERVER["DOCUMENT_ROOT"] . "/include/header.php");


=====================================
www.videolan.org/js/slick-init.js
=====================================
--- a/www.videolan.org/js/slick-init.js
+++ b/www.videolan.org/js/slick-init.js
@@ -30,4 +30,13 @@ $(document).ready(function() {
             }
         }]
     });
+
+    $('#sponsors-carousel').slick({
+        slidesToShow: 1,
+        slidesToScroll: 1,
+        autoplay: true,
+        autoplaySpeed: 3000,
+        infinite: true,
+        arrows: false
+    });
 });


=====================================
www.videolan.org/style/slick-theme.scss
=====================================
--- a/www.videolan.org/style/slick-theme.scss
+++ b/www.videolan.org/style/slick-theme.scss
@@ -107,3 +107,38 @@ $bg-color-hover: rgba(0, 0, 0, 0.4);
 #header-carousel .screenshot2.slick-slide {
     display: block;
 }
+
+#sponsors-carousel {
+    position: absolute;
+    display: inline-block;
+    text-align: center;
+    right: 15px;
+    top: 0;
+    max-width: 150px;
+}
+
+#sponsors-carousel a {
+    display: inline-block;
+    vertical-align: middle;
+}
+
+#sponsors-carousel .slick-slide img {
+    display: inline-block;
+    width: auto;
+    max-height: 36px;
+}
+
+ at media only screen and (max-width : 480px) {
+    #sponsors-carousel {
+        display: none;
+    }
+}
+
+#sponsors-carousel a {
+    display: none;
+    background: #fff;
+}
+
+#sponsors-carousel a.slick-slide {
+    display: block;
+}



View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/commit/6a703f4faf40041bcdaea9036a063f1a927b9847
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/www-doc/attachments/20160607/17619e41/attachment.html>


More information about the www-doc mailing list