Optimized website

Server-side rendering for syntax highlighting and DOM tree optimizations.
This commit is contained in:
Angelos Chalaris
2018-01-04 00:01:11 +02:00
parent 3fc20d131b
commit e12edb4bd6
9 changed files with 1316 additions and 1328 deletions

View File

@ -4,6 +4,5 @@
</footer>
</main>
</div>
<script src="prism.js"></script>
</body>
</html>

View File

@ -30,28 +30,8 @@
})
}
function loader() {
clipboard();
exampleMaker();
registerClickListener();
}
function clipboard() {
// const snippets = document.querySelectorAll(":not(label) + pre");
// snippets.forEach(snippet => {
// const button = document.createElement("button");
// button.className = 'primary clipboard-copy';
// button.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clipboard"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect></svg>&nbsp;Copy to clipboard';
// snippet.parentElement.appendChild(button);
// });
}
function exampleMaker() {
// const examples = document.querySelectorAll("pre + pre");
// examples.forEach(el => {
// let label = document.createElement('label');
// label.className = 'collapse';
// label.innerHTML = 'Show examples';
// el.parentNode.insertBefore(label, el);
// });
}
function registerClickListener() {
document.addEventListener('click', function (event) {
if ( event.target.classList.contains('collapse') ) {