From 0eb75d87f5b32899b9dd5308ea7516c21f8d7f67 Mon Sep 17 00:00:00 2001 From: Stephanie Vilayphiou Date: Tue, 15 Oct 2019 16:03:02 +0200 Subject: [PATCH] Added a link to a pad to style together at the same time --- .../aesthetic-programming/static/js/styles.js | 29 +++++++++++++++++++ .../templates/archives.html | 17 ----------- .../aesthetic-programming/templates/page.html | 25 ++++++++++++++-- 3 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 pelican/theme/aesthetic-programming/static/js/styles.js delete mode 100644 pelican/theme/aesthetic-programming/templates/archives.html diff --git a/pelican/theme/aesthetic-programming/static/js/styles.js b/pelican/theme/aesthetic-programming/static/js/styles.js new file mode 100644 index 0000000..26f478e --- /dev/null +++ b/pelican/theme/aesthetic-programming/static/js/styles.js @@ -0,0 +1,29 @@ +function loadEtherStyle(url, interval) { + function load(url) { + fetch(url) + .then(function(r) { return r.text()}) + .then(function (styles) { + var el = document.createElement('style'); + el.appendChild(document.createTextNode(styles)); + el.setAttribute('data-type', 'etherstyle'); + document.head.appendChild(el); + window.requestAnimationFrame(function () { + var styles = document.querySelectorAll('[data-type="etherstyle"]'); + for (var i=0;i<(styles.length-1);i++) { + styles[i].remove(); + } + }); + }); + } + + load(url); + var urlParameters = new URLSearchParams(window.location.search), + reload = urlParameters.get('reload'); + if (reload == 'reload') { + window.setInterval(function () { load(url); }, interval); + } +} + +(function () { + loadEtherStyle('http://pads.osp.kitchen/p/aesthetic-programming.css/export/txt/', 7500); +})(); diff --git a/pelican/theme/aesthetic-programming/templates/archives.html b/pelican/theme/aesthetic-programming/templates/archives.html deleted file mode 100644 index 44d24e6..0000000 --- a/pelican/theme/aesthetic-programming/templates/archives.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - {{ SITENAME }} - - - - - - {% for page in pages %} - {{ page.content }} - {% endfor %} - - \ No newline at end of file diff --git a/pelican/theme/aesthetic-programming/templates/page.html b/pelican/theme/aesthetic-programming/templates/page.html index b320c13..538b827 100644 --- a/pelican/theme/aesthetic-programming/templates/page.html +++ b/pelican/theme/aesthetic-programming/templates/page.html @@ -7,10 +7,29 @@ {{ SITENAME }} - + + + + + + {{ page.content }} - \ No newline at end of file + -- GitLab