| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1c503a5 commit 6be1576
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,7 @@ | |||
| 7 | 7 | <!-- google fonts --> | |
| 8 | 8 | <link defer async href="https://fonts.googleapis.com/css?family=Fira+Sans|Sen:800&display=swap" rel="stylesheet"> | |
| 9 | 9 | <!-- stylesheet --> | |
| 10 | + <link defer async rel="stylesheet" href="{{ "/assets/tabs.css" | relative_url }}"> | ||
| 10 | 11 | <link defer async rel="stylesheet" href="{{ "/assets/style.css" | relative_url }}"> | |
| 11 | 12 | <link defer async rel="stylesheet" href="{{ "/assets/media.css" | relative_url }}"> | |
| 12 | 13 | <link defer async rel="stylesheet" href="{{ "/assets/github.css" | relative_url }}"> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,12 +22,55 @@ | |||
| 22 | 22 | {{ content }} | |
| 23 | 23 | </div> | |
| 24 | 24 | ||
| 25 | + <!-- TODO clean up this code a bit --> | ||
| 26 | + | ||
| 27 | + {% assign folders = "" | split: ", " %} | ||
| 25 | 28 | {% for image in site.static_files %} | |
| 26 | - {% if image.path contains 'benchmarks' %} | ||
| 27 | - <figure> | ||
| 28 | - <img src="{{ site.baseurl }}{{ image.path }}" alt="image" width="30%" /> | ||
| 29 | - <figcaption>{{ image.name }}</figcaption> | ||
| 30 | - </figure> | ||
| 29 | + {% if image.path contains 'criterion/' %} | ||
| 30 | + {% assign imagepath = image.path | split: "/" %} | ||
| 31 | + {% for subpath in imagepath %} | ||
| 32 | + {% if forloop.index0 == 3 %} | ||
| 33 | + {% assign folders = folders | append: pathName %} | ||
| 34 | + {% endif %} | ||
| 35 | + {% endfor %} | ||
| 31 | 36 | {% endif %} | |
| 32 | 37 | {% endfor %} | |
| 38 | + {% assign folders = folders | uniq %} | ||
| 39 | + | ||
| 40 | + <!-- {% assign folders = "" | split: ", " %} | ||
| 41 | + {% for folder in site.static_files %} | ||
| 42 | + {% if folder.path contains 'criterion/' %} | ||
| 43 | + {% assign temp = folder.path | split: 'criterion/' %} | ||
| 44 | + {% assign pathName = temp[1] | split: '/' | first %} | ||
| 45 | + {% assign pathName = pathName | split: ", " %} | ||
| 46 | + {% assign folders = folders | concat: pathName %} | ||
| 47 | + {% endif %} | ||
| 48 | + {% endfor%} | ||
| 49 | + {% assign folders = folders | uniq %} --> | ||
| 50 | + | ||
| 51 | + <!-- TODO check if the folders list is empty, if so, display corresponding message --> | ||
| 52 | + <!-- TODO add text that explains the violin plots --> | ||
| 53 | + | ||
| 54 | + <ul class="tab" data-tab="benchmarks"> | ||
| 55 | + {% for folder in folders %} | ||
| 56 | + <li {% if forloop.index==1 %} class="active" {% endif %}> | ||
| 57 | + <a href="">{{ folder }}</a> | ||
| 58 | + </li> | ||
| 59 | + {% endfor%} | ||
| 60 | + </ul> | ||
| 61 | + <ul class="tab-content" id="benchmarks"> | ||
| 62 | + {% for folder in folders %} | ||
| 63 | + <li {% if forloop.index==1 %} class="active" {% endif %}> | ||
| 64 | + <br> | ||
| 65 | + {% for image in site.static_files %} | ||
| 66 | + {% if image.path contains folder %} | ||
| 67 | + <figure> | ||
| 68 | + <img src="{{ site.baseurl }}{{ image.path }}" alt="image" width="50%" /> | ||
| 69 | + <figcaption>{{ image.name }}</figcaption> | ||
| 70 | + </figure> | ||
| 71 | + {% endif %} | ||
| 72 | + {% endfor%} | ||
| 73 | + </li> | ||
| 74 | + {% endfor%} | ||
| 75 | + </ul> | ||
| 33 | 76 | </div> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | {%- include footer.html -%} | |
| 17 | 17 | ||
| 18 | + <script src="{{ "/assets/js/tabs.js" | relative_url }}"></script> | ||
| 18 | 19 | </body> | |
| 19 | 20 | ||
| 20 | 21 | </html> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,43 @@ | |||
| 1 | + const removeActiveClasses = function (ulElement) { | ||
| 2 | + const lis = ulElement.querySelectorAll('li'); | ||
| 3 | + Array.prototype.forEach.call(lis, function(li) { | ||
| 4 | + li.classList.remove('active'); | ||
| 5 | + }); | ||
| 6 | + } | ||
| 7 | + | ||
| 8 | + const getChildPosition = function (element) { | ||
| 9 | + var parent = element.parentNode; | ||
| 10 | + var i = 0; | ||
| 11 | + for (var i = 0; i < parent.children.length; i++) { | ||
| 12 | + if (parent.children[i] === element) { | ||
| 13 | + return i; | ||
| 14 | + } | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + throw new Error('No parent found'); | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + window.addEventListener('load', function () { | ||
| 21 | + const tabLinks = document.querySelectorAll('ul.tab li a'); | ||
| 22 | + | ||
| 23 | + Array.prototype.forEach.call(tabLinks, function(link) { | ||
| 24 | + link.addEventListener('click', function (event) { | ||
| 25 | + event.preventDefault(); | ||
| 26 | + | ||
| 27 | + liTab = link.parentNode; | ||
| 28 | + ulTab = liTab.parentNode; | ||
| 29 | + position = getChildPosition(liTab); | ||
| 30 | + if (liTab.className.includes('active')) { | ||
| 31 | + return; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + removeActiveClasses(ulTab); | ||
| 35 | + tabContentId = ulTab.getAttribute('data-tab'); | ||
| 36 | + tabContentElement = document.getElementById(tabContentId); | ||
| 37 | + removeActiveClasses(tabContentElement); | ||
| 38 | + | ||
| 39 | + tabContentElement.querySelectorAll('li')[position].classList.add('active'); | ||
| 40 | + liTab.classList.add('active'); | ||
| 41 | + }, false); | ||
| 42 | + }); | ||
| 43 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,48 @@ | |||
| 1 | + .tab { | ||
| 2 | + display: flex; | ||
| 3 | + flex-wrap: wrap; | ||
| 4 | + margin-left: -20px; | ||
| 5 | + padding: 0; | ||
| 6 | + list-style: none; | ||
| 7 | + position: relative; | ||
| 8 | + } | ||
| 9 | + | ||
| 10 | + .tab > * { | ||
| 11 | + flex: none; | ||
| 12 | + padding-left: 20px; | ||
| 13 | + position: relative; | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + .tab > * > a { | ||
| 17 | + display: block; | ||
| 18 | + text-align: center; | ||
| 19 | + padding: 9px 20px; | ||
| 20 | + color: #999; | ||
| 21 | + border-bottom: 2px solid transparent; | ||
| 22 | + border-bottom-color: transparent; | ||
| 23 | + font-size: 12px; | ||
| 24 | + text-transform: uppercase; | ||
| 25 | + transition: color .1s ease-in-out; | ||
| 26 | + line-height: 20px; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + .tab > .active > a { | ||
| 30 | + color:#222; | ||
| 31 | + border-color: #1e87f0; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + .tab li a { | ||
| 35 | + text-decoration: none; | ||
| 36 | + cursor: pointer; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + .tab-content{ | ||
| 40 | + padding: 0; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + .tab-content li { | ||
| 44 | + display: none; | ||
| 45 | + } | ||
| 46 | + .tab-content li.active { | ||
| 47 | + display: initial; | ||
| 48 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments