Set up bundling and move blog JS to JS file.
This commit is contained in:
parent
1b13e22bce
commit
a375a4356a
6 changed files with 15 additions and 11 deletions
|
@ -1,29 +0,0 @@
|
|||
<script type="text/javascript">
|
||||
function adornImage(image, append) {
|
||||
var parent = image.parentNode;
|
||||
parent.removeChild(image);
|
||||
image.className = "blog-post__image-container--image";
|
||||
|
||||
var tagLine = document.createElement("span");
|
||||
tagLine.className = "blog-post__image-container--tagline";
|
||||
tagLine.innerText = image.getAttribute("alt");
|
||||
|
||||
var container = document.createElement("div");
|
||||
container.className = "blog-post__image-container";
|
||||
container.appendChild(image);
|
||||
container.appendChild(tagLine);
|
||||
|
||||
var containerContainer = document.createElement("div");
|
||||
containerContainer.className = "blog-post__image-container--container";
|
||||
containerContainer.appendChild(container);
|
||||
|
||||
if (append)
|
||||
parent.appendChild(containerContainer);
|
||||
else
|
||||
parent.prepend(containerContainer);
|
||||
}
|
||||
|
||||
|
||||
document.querySelectorAll("p>img:only-child,p>img:first-child").forEach(image => adornImage(image, false));
|
||||
document.querySelectorAll("p>img:last-child").forEach(image => adornImage(image, true));
|
||||
</script>
|
|
@ -5,6 +5,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] | Robware</title>
|
||||
<link href="/css/style.css" rel="stylesheet" defer/>
|
||||
<script type="text/javascript" src="/js/javascript.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue