Difference between revisions of "Widget:Homepage"

From LINKS Community Center
Jump to: navigation, search
(35 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<noinclude>Second version of the LINKS Community Center homepage.<br><strong style="color: red;">Do not modify!</strong></noinclude>
 
<noinclude>Second version of the LINKS Community Center homepage.<br><strong style="color: red;">Do not modify!</strong></noinclude>
 
<includeonly><style>
 
<includeonly><style>
 +
        :root {
 +
            --compass-color: #C31980;
 +
            --handbook-color: #C2902D;
 +
            --safe-color: #80C319;
 +
        }
 
         #hp-wrapper {
 
         #hp-wrapper {
 
             --hp-border: 1px solid rgba(0, 0, 0, .5);
 
             --hp-border: 1px solid rgba(0, 0, 0, .5);
Line 113: Line 118:
  
 
         @media screen and (min-width: 992px) {
 
         @media screen and (min-width: 992px) {
             #hp-heading { padding: 3em; margin-bottom: 8em; }
+
             #hp-heading { padding: 3em; margin-bottom: 4em; }
 
             #hp-heading h1 { font-size: 5em; }
 
             #hp-heading h1 { font-size: 5em; }
 
             #hp-heading .hp-lead { max-width: 50%; font-size: 2em; }
 
             #hp-heading .hp-lead { max-width: 50%; font-size: 2em; }
Line 136: Line 141:
 
             #hp-resources {border-right: 0 none; }
 
             #hp-resources {border-right: 0 none; }
 
             #hp-changes { border-top: var(--hp-border); }
 
             #hp-changes { border-top: var(--hp-border); }
 +
        }
 +
 +
        /* SNIPPETS */
 +
        #snippets {
 +
            display: grid;
 +
            grid-template-columns: repeat(3, 1fr);
 +
            gap: 1em;
 +
            margin: 4em 0;
 +
        }
 +
        .snippet {
 +
            display: block;
 +
            text-decoration: none !important;
 +
            color: transparent;
 +
            background-color: transparent;
 +
            perspective: 1000px;
 +
            height: 7em;
 +
        }
 +
        .snippet .snippet-inner {
 +
            position: relative;
 +
            width: 100%;
 +
            height: 100%;
 +
            transition: transform 500ms;
 +
            transform-style: preserve-3d;
 +
        }
 +
        .snippet:hover .snippet-inner {
 +
            transform: rotateY(180deg);
 +
        }
 +
        .snippet-header, .snippet-body {
 +
            position: absolute;
 +
            width: 100%;
 +
            height: 100%;
 +
            padding: 1em;
 +
            border: 2px solid;
 +
            border-radius: 5px;
 +
            display: flex;
 +
            align-items: center;
 +
            justify-content: center;
 +
            text-align: center;
 +
            -webkit-backface-visibility: hidden; /* Safari */
 +
            backface-visibility: hidden;
 +
        }
 +
        .snippet-header {
 +
            color: #fff;
 +
        }
 +
        .snippet-body {
 +
            transform: rotateY(180deg);
 +
        }
 +
 +
        .snippet.TL .snippet-body { color: var(--links-blue); }
 +
 +
        .snippet.GL .snippet-body { color: var(--links-orange); }
 +
 +
        .snippet.UCL .snippet-body { color: var(--links-cyan); }
 +
 +
        .snippet.ICH .snippet-body { color: var(--handbook-color); }
 +
 +
        .snippet.FS .snippet-body { color: var(--safe-color); }
 +
 +
        .snippet.RW .snippet-body { color: var(--links-grey); }
 +
 +
        .snippet.TL .snippet-header {
 +
            background-color: var(--links-blue);
 +
            border-color: var(--links-blue);
 +
        }
 +
 +
        .snippet.GL .snippet-header {
 +
            background-color: var(--links-orange);
 +
            border-color: var(--links-orange);
 +
        }
 +
 +
        .snippet.UCL .snippet-header {
 +
            background-color: var(--links-cyan);
 +
            border-color: var(--links-cyan);
 +
        }
 +
 +
        .snippet.RW .snippet-header {
 +
            background-color: var(--links-grey);
 +
            border-color: var(--links-grey);
 +
        }
 +
 +
        .snippet.ICH .snippet-header {
 +
            background-color: var(--handbook-color);
 +
            border-color: var(--handbook-color);
 +
        }
 +
 +
        .snippet.FS .snippet-header {
 +
            background-color: var(--safe-color);
 +
            border-color: var(--safe-color);
 
         }
 
         }
 
     </style>
 
     </style>
Line 149: Line 242:
 
     <div id="hp-wrapper">
 
     <div id="hp-wrapper">
 
         <div id="hp-heading">
 
         <div id="hp-heading">
             <h1>
+
             <h1 translate="no">
 
                 <span>LINKS</span>
 
                 <span>LINKS</span>
 
                 <span>Community</span>
 
                 <span>Community</span>
Line 173: Line 266:
  
 
         <div id="hp-main">
 
         <div id="hp-main">
 +
            <div id="snippets"></div>
 +
 
             <form class="hp-search form-inline w-100" onsubmit="search(event)">
 
             <form class="hp-search form-inline w-100" onsubmit="search(event)">
 
                 <input id="hp-search-input" class="form-control form-control-lg flex-grow-1" type="text"
 
                 <input id="hp-search-input" class="form-control form-control-lg flex-grow-1" type="text"
Line 312: Line 407:
 
             </div>
 
             </div>
 
         </div>
 
         </div>
 
        <!--kie: comment out until it is available.-->
 
        <!-- <div class="hp-compass cyan">
 
            <div class="d-flex align-items-center">
 
                <div class="hp-area-icon">
 
                    <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" overflow="hidden" viewBox="0 0 96 96"><defs><clipPath id="c"><path d="M199 603h96v96h-96z"/></clipPath></defs><g clip-path="url(#c)" transform="translate(-199 -603)"><path d="m277.516 645.583 2.136.654c-2.126-14.416-13.438-25.741-27.852-27.884l.691 2.143a31.072 31.072 0 0 1 25.025 25.087ZM214.36 646.146l2.14-.646a31.07 31.07 0 0 1 25.02-25l.655-2.139c-14.368 2.147-25.652 13.42-27.815 27.785ZM241.386 681.481a31.073 31.073 0 0 1-24.87-24.881l-2.151-.7a33.075 33.075 0 0 0 27.679 27.727ZM279.654 655.746l-2.141.691a31.072 31.072 0 0 1-25.032 25.068l-.691 2.143c14.424-2.14 25.744-13.475 27.864-27.902Z"/><path d="m274.8 647.888-15.134-4.924 4.837-9.38-9.431 4.806-4.872-15.208-2-6.2-1.2-3.9-1.3 4-1.9 6.2-4.784 15.134-9.416-4.832 4.82 9.429-15.12 4.776-6.3 1.9-4 1.3 4 1.3 6.1 2 15.248 4.8-4.848 9.405 9.386-4.947L243.7 678.8l1.9 6.2 1.3 4 1.3-4 2-6.2 4.9-15.3 9.4 4.9-4.828-9.351 15.028-4.859 6.2-2 4-1.3-3.9-1.1Zm-.714 4.4-15.341 4.954-2.01-3.893a9.925 9.925 0 0 1-.951 2.519l4.045 7.832-7.723-4.027a9.93 9.93 0 0 1-2.361 1.027l3.555 1.854-5 15.629-1.382 4.283-1.308-4.271-4.925-15.595 3.594-1.894a9.95 9.95 0 0 1-2.36-1.017l-7.73 4.074 4.051-7.863a9.91 9.91 0 0 1-.959-2.505l-2 3.885-15.557-4.89-4.194-1.375 4.37-1.315 15.441-4.877 1.967 3.847a9.938 9.938 0 0 1 .981-2.475l-4.088-8 8.016 4.113a9.958 9.958 0 0 1 2.523-.953l-3.92-2.013 4.894-15.474 1.27-4.148 1.316 4.072 4.966 15.518-4.011 2.044a9.922 9.922 0 0 1 2.53.955l8.1-4.125-4.147 8.043c.433.78.76 1.614.971 2.481l2.033-3.943 15.475 5.035 3.883 1.192Z"/><path d="M247 644.088a7 7 0 1 0 7 7 7.009 7.009 0 0 0-7-7Zm0 12a5 5 0 1 1 5-5 5.007 5.007 0 0 1-5 5.003Z"/></g></svg>
 
                </div>
 
                <div class="hp-area-text">
 
                    <h2>Want to be guided?</h2>
 
                    <p>
 
                        Try the compass!
 
                    </p>
 
                </div>
 
            </div>
 
        </div> -->
 
  
 
         <div id="hp-recent" class="container-fluid">
 
         <div id="hp-recent" class="container-fluid">
Line 342: Line 422:
 
                 </div>
 
                 </div>
 
             </div>
 
             </div>
         </div></div></includeonly>
+
         </div></div>
 +
 
 +
        <script>
 +
            const maxAmount = 6;    // maximum number of snippets
 +
            const snippets = [
 +
                {
 +
                    "title": "Are you overwhelmed by too many social media technologies?",
 +
                    "body": "Visit our Technologies Library to find the technology you need.",
 +
                    "action": "/index.php/List_of_Disaster_Community_Technologies",
 +
                    "product": "TL",
 +
                },
 +
                {
 +
                    "title": "Do you want to be prepared when disaster strikes?",
 +
                    "body": "Learn from many use cases about social media and crowdsourcing.",
 +
                    "action": "/index.php/List_of_Use_Cases",
 +
                    "product": "UCL",
 +
                },
 +
                {
 +
                    "title": "How to protect children during disaster?",
 +
                    "body": "Child friendly disaster risk reduction.",
 +
                    "action": "/index.php/Feel_Safe",
 +
                    "product": "FS",
 +
                },
 +
                {
 +
                    "title": "Be successful with your social media engagement!",
 +
                    "body": "Find a plan in our library and develop your own strategy!",
 +
                    "action": "/index.php/List_of_Guidelines?do=JTdCJTIyZmlsdGVyJTIyJTNBJTdCJTIyQ292ZXJzJTIwVGhlbWF0aWMlMjIlM0ElN0IlMjJDcmlzaXMlMjBjb21tdW5pY2F0aW9uJTIyJTNBdHJ1ZSUyQyUyMlNvY2lhbCUyME1lZGlhJTIwU3RyYXRlZ3klMjIlM0F0cnVlJTdEJTdEJTdE",
 +
                    "product": "GL",
 +
                },
 +
                {
 +
                    "title": "Do you know how to engage with vulnerable groups?",
 +
                    "body": "In this helpful guide we walk you through a few actions that can be taken.",
 +
                    "action": "/index.php/Including_Citizens_Handbook#making_information_accessible",
 +
                    "product": "ICH",
 +
                },
 +
                {
 +
                    "title": "Want to advance your organization’s use of social media?",
 +
                    "body": "Try the Resilience Wheel.",
 +
                    "action": "/index.php/Resilience_Wheel",
 +
                    "product": "RW",
 +
                },
 +
                {
 +
                    "title": "Do you struggle with managing volunteers in disasters?",
 +
                    "body": "Take part in the course on mobilizing volunteers.",
 +
                    "action": "/index.php/Including_Citizens_Handbook#mobilizing_volunteers",
 +
                    "product": "ICH",
 +
                },
 +
            ];
 +
            const container = document.getElementById('snippets');
 +
   
 +
            // Fisher-Yates shuffling algorithm
 +
            const shuffleArray = (array) => {
 +
                for (let i = array.length - 1; i > 0; i--) {
 +
                    const j = Math.floor(Math.random() * (i + 1));
 +
                    [array[i], array[j]] = [array[j], array[i]];
 +
                }
 +
                return array;
 +
            };
 +
   
 +
            const indices = Array.from({ length: snippets.length }, (_, index) => index);
 +
   
 +
            // Array of randomly selected snippets (by index)
 +
            // TODO: Make sure there is at least one snippet per product.
 +
            let selection = shuffleArray(indices);
 +
            if (selection.length > maxAmount) selection = selection.slice(0, maxAmount);
 +
   
 +
            for (const index of selection) {
 +
                const snippet = snippets[index];
 +
                let el = '<a class="snippet ' + snippet.product + '" href="' + snippet.action + '">';
 +
                    el += '<div class="snippet-inner">';
 +
                    el += '<div class="snippet-header">' + snippet.title + '</div>';
 +
                    el += '<div class="snippet-body">' + snippet.body + '</div>';
 +
                    el += '</div></a>';
 +
                container.innerHTML += el;
 +
            }
 +
        </script>
 +
</includeonly>

Revision as of 14:36, 10 January 2024

Second version of the LINKS Community Center homepage.
Do not modify!