Skip to content
Snippets Groups Projects
Commit 7db19d2a authored by Fabian Kongelf's avatar Fabian Kongelf
Browse files

Delete header-copy.html

parent a86352b5
Branches
No related tags found
No related merge requests found
<header class="site-header">
<div class="navbar" id="navbar">
<article>
<div class="hamburger" onclick="hamburger_open(this)">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</div>
</article>
<article class="breadcrumb">
<p><a href="{{ site.baseurl }}/">{{ site.title }}</a></p>
</article>
<article class="links">
<!-- insert links to folder content -->
<ul>
{% assign sorted_pages = site.posts | sort:"order" %} <!-- Retrieve array of all posts and sort them by "order" variable -->
{% for counter in (0..{{sorted_pages.size}}) %} <!-- for 0 .. end of array -->
{% if page.order == sorted_pages[counter].order %} <!-- if index is current post -->
{% assign priveous = counter | minus: 1 %} <!-- priveous post in index -1 -->
{% assign next = counter | plus: 1 %} <!-- next post is index + 1 -->
{% if next == sorted_pages.size %} <!-- unless if you have reached end of array -->
{% assign next = 0 %} <!-- next post should be pointing to the first index -->
{% endif %}
{% endif %}
{% endfor %}
{% if sorted_pages[next] == null %} <!-- in the case next is out of bounds -->
{% assign next = 0 %} <!-- point to first post -->
{% endif %}
{% if sorted_pages[priveous] == null %} <!-- in the case priveous is out of bounds -->
{% assign priveous = {{sorted_pages.size}} %} <!-- point to last post -->
{% endif %}
<!-- Link to priveous post -->
<li>
<a href="{{sorted_pages[priveous].url | prepend: site.baseurl}}">{{sorted_pages[priveous].slug}}</a>
</li>
<!-- Link to next post -->
<li>
<a href="{{sorted_pages[next].url | prepend: site.baseurl}}">{{sorted_pages[next].slug}}</a>
</li>
</ul>
</article>
<article class="ntnu-logo">
<a href="{{ site.baseurl }}/">
<div id="logo-blaa">{% include icon-ntnu-uslagord.html %}</div>
</a>
<a href="{{ site.baseurl }}/">
<div id="logo-svart-inv" style="display: none">{% include icon-ntnu-uslagord-svart.html %}</div>
</a>
</article>
</div>
<article id="hamburger-content" class="hamburger-content">
<div>
<h2 class="navbar-heading">All categories in site</h2> <!-- slett meg -->
</div>
<div>
{% for category in site.categories %}
<article>
{% if category[1].size == 1 %}
<ul>
<li class="cat-element">
<a class="post-link" href="{{ category[1][0].url | prepend: site.baseurl }}">{{ category | first }}</a>
</li>
{% else %}
<h3 id="{{ category[0] | slugify }}" class="cat-header">
<a class="post-link" href="#">{{ category | first }}</a>
</h3>
<ul>
{% for post in category[1] %}
<li class="cat-element">
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</li>
{% endfor %}
{% endif %}
</ul></article>
{% endfor %}
</div>
<div>
<article>
<h2 class="navbar-heading">All files related to the current post</h2> <!-- Dynamisk henting av alle IKKE markdown filer i samme directory som page -->
{% assign filename = page.path | split: "/" | last %} <!-- hent denne post sitt navn, for eks compendia -->
{% assign path = page.path | remove: filename | remove: "_posts/" %} <!-- fjern filnavn og _posts fra filsti, for eks /emne/.. istedenfor _posts/emne/compendia -->
<ul>
{% if path !=""%} <!-- Sjekk om "path" er tom, dersom tom er post i toppen av _posts folderen -->
{% for file in site.static_files %} <!-- se gjennom alle filer som ikke markdowm -->
{% if file.path contains path %} <!-- Dersom filen er i samme folder som post -->
{% if file.extname == '.png' or file.extname == '.PNG' or file.extname == '.pdf' or file.extname == '.PDF' or file.extname == '.jpg' or file.extname == '.JPG' or file.extname == '.jpeg' or file.extname == '.JPEG' %} <!-- Hent ut de type filer du vil linke til -->
{% assign filePath = site.baseurl | append: file.path | remove: "_posts" %} <!-- lag fullverdig filsti -->
<li class="cat-element">
<a href="{{ file.basename}}{{file.extname}}">{{file.basename}} </a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</ul>
</article>
</div>
</article>
</header>
<script>
var prevBackgroundColor;
var prevBorderColor;
function hamburger_open(x) {
x.classList.toggle("change");
y = document.getElementById("hamburger-content");
z = document.getElementById("navbar");
logoBlaa = document.getElementById("logo-blaa");
logoSvartInv = document.getElementById("logo-svart-inv");
if (x.classList.contains("change")) {
prevBackgroundColor = window.getComputedStyle(z, null).getPropertyValue('background-color');
prevBorderColor = window.getComputedStyle(z, null).getPropertyValue('border-color');
y.style.height = "100vh";
z.style.background = "rgba(28,28,28,1)";
z.style.border = "none";
logoBlaa.style.display = "none";
logoSvartInv.style.display = "block";
setTimeout(() => { y.style.overflow = "auto"; }, 250);
} else {
y.style.height = "0vh";
y.style.overflow = "hidden";
setTimeout(() => {
z.style.background = prevBackgroundColor;
z.style.borderBottom = "1px solid";
z.style.borderColor = prevBorderColor
logoBlaa.style.display = "block";
logoSvartInv.style.display = "none";
}, 400);
}
}
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment