Browse Source

Updated menu to use custom JS instead of jquery and boostrap to save some space, and updated cache expiration time.

pull/4/head
jrtechs 5 years ago
parent
commit
52ed77edf6
8 changed files with 111 additions and 30 deletions
  1. +61
    -0
      css/minified.css
  2. +1
    -1
      img/image.js
  3. +45
    -12
      includes/footer.html
  4. +3
    -16
      includes/header.html
  5. +1
    -1
      includes/includes.js
  6. +0
    -0
      js/bootstrap.min.js
  7. +0
    -0
      js/highlight.min.js
  8. +0
    -0
      js/jquery.min.js

+ 61
- 0
css/minified.css
File diff suppressed because it is too large
View File


+ 1
- 1
img/image.js View File

@ -10,7 +10,7 @@ module.exports=
main: function(result, fileName, cache)
{
//result.contentType = 'image/png';
result.writeHead(200, {'Content-Type': 'image/png', 'Cache-Control': 'max-age=3600'});
result.writeHead(200, {'Content-Type': 'image/png', 'Cache-Control': 'public, max-age=604800'});
var img = cache.get(fileName);
if(img == null)

+ 45
- 12
includes/footer.html View File

@ -54,24 +54,57 @@
</div>
</footer>
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script>
var e = document.querySelector(".navbar-toggler");
var t = document.querySelector(".navbar-collapse");
var a = e.getAttribute("aria-expanded");
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
function getMaxHeight(t)
{
// Source: http://n12v.com/css-transition-to-from-auto/
var prevHeight = t.style.height;
t.style.height = 'auto';
var maxHeight = getComputedStyle(t).height;
t.style.height = prevHeight;
t.offsetHeight; // force repaint
return maxHeight;
}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-51392711-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
e.onclick = function()
{
if (a == "false")
{
t.classList.remove('collapse');
e.setAttribute('aria-expanded', true);
t.style.height = getMaxHeight(t);
}
else
{
t.classList.remove("collapse");
t.classList.remove("in");
e.setAttribute("aria-expanded", false);
t.style.height = getComputedStyle(t).height;
t.offsetHeight,t.style.height="0px";
t.classList.remove('collapsing');
t.classList.add('collapse');
gtag('config', 'UA-51392711-1');
// Check whether the element is unhidden
if (t.style.height !== '0px') {
t.classList.add('in');
t.style.height = 'auto';
}
}
a = e.getAttribute("aria-expanded");
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>

+ 3
- 16
includes/header.html View File

@ -8,24 +8,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">-->
<link rel="stylesheet" href="/css/bootstrap.css" media="screen">
<link rel="stylesheet" href="/css/minified.css" media="screen">
<meta name="description" content="Blog of Jeffery Russell, featuring technical guides, and projects.">
<meta name="author" content="Jeffery Russell">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<link rel="stylesheet"
href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.12.0/build/styles/default.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<style>
html, body, h1, h2, h3, h4, h5, h6 {
font-family: 'Open Sans', sans-serif;
@ -35,6 +23,7 @@
</head>
<body>
<div class="navbar navbar-expand-lg navbar-dark fixed-top bg-primary" id="mainNav">
<div class="container">
<a class="navbar-brand" href="#">Jrtechs</a>
@ -47,9 +36,6 @@
<li class="nav-item active">
<a class="nav-link" href="https://jrtechs.net">Home <span class="sr-only">(current)</span></a>
</li>
<!--<li class="nav-item">-->
<!--<a class="nav-link" href="https://jrtechs.net/categories">Categories</a>-->
<!--</li>-->
<li class="nav-item">
<a class="nav-link" href="https://jrtechs.me/#contact">Contact</a>
</li>
@ -69,5 +55,6 @@
</div>
</div>
<br><br><br><br><br>
<div class="container">
<div class="row">

+ 1
- 1
includes/includes.js View File

@ -43,7 +43,7 @@ module.exports =
*/
sendCSS: function(result, path, cache)
{
result.writeHead(200, {'Content-Type': 'text/css', 'Cache-Control': 'max-age=3600'});
result.writeHead(200, {'Content-Type': 'text/css', 'Cache-Control': 'public, max-age=604800'});
var css = cache.get(path);

+ 0
- 0
js/bootstrap.min.js View File


+ 0
- 0
js/highlight.min.js View File


+ 0
- 0
js/jquery.min.js View File


Loading…
Cancel
Save