diff options
author | Thedro Neely <thedroneely@gmail.com> | 2024-01-06 19:16:12 -0500 |
---|---|---|
committer | Thedro Neely <thedroneely@gmail.com> | 2024-01-06 19:16:12 -0500 |
commit | b0feb62a0bbb5987fe37ab8bc26503c3dd812d84 (patch) | |
tree | 9d3cb03bb57cc909cc55a114b2680d6f84d3e439 | |
parent | 6d745f1e8c7b870524e01ee7a4886db38634e2ae (diff) | |
download | thedroneely.com-b0feb62a0bbb5987fe37ab8bc26503c3dd812d84.tar.gz thedroneely.com-b0feb62a0bbb5987fe37ab8bc26503c3dd812d84.tar.bz2 thedroneely.com-b0feb62a0bbb5987fe37ab8bc26503c3dd812d84.zip |
public/js/app: Remove CSP violations
6 files changed, 28 insertions, 9 deletions
diff --git a/generators/hugo/themes/tdro/layouts/_default/_markup/render-image.html b/generators/hugo/themes/tdro/layouts/_default/_markup/render-image.html index 1b524ac..c08b69a 100644 --- a/generators/hugo/themes/tdro/layouts/_default/_markup/render-image.html +++ b/generators/hugo/themes/tdro/layouts/_default/_markup/render-image.html @@ -29,8 +29,10 @@ {{- /* This comment removes trailing newlines. */ -}} <figure> - <a href="{{ $source }}" onclick="return false;"> - <img data-image-zoom + <a href="{{ $source }}"> + <img + loading="lazy" + data-image-zoom="" src="{{ $source }}" alt="{{ $.Text | htmlUnescape }}" title="{{ $.Text | htmlUnescape }}" diff --git a/generators/hugo/themes/tdro/layouts/partials/article-webrings.html b/generators/hugo/themes/tdro/layouts/partials/article-webrings.html index 5f0a11a..ad75095 100644 --- a/generators/hugo/themes/tdro/layouts/partials/article-webrings.html +++ b/generators/hugo/themes/tdro/layouts/partials/article-webrings.html @@ -11,7 +11,7 @@ </a> </button-anchor> {{ "## Web Ring" | markdownify }} + {{- partial $include . -}} </section> - {{- partial $include . -}} </article-webring> {{- end -}} diff --git a/generators/hugo/themes/tdro/layouts/shortcodes/image.html b/generators/hugo/themes/tdro/layouts/shortcodes/image.html index 3b211ff..eb3c1d1 100644 --- a/generators/hugo/themes/tdro/layouts/shortcodes/image.html +++ b/generators/hugo/themes/tdro/layouts/shortcodes/image.html @@ -2,8 +2,10 @@ {{- $image := imageConfig $imageFile -}} <figure> - <a href="{{ .Get `source` }}" onclick="return false;"> - <img data-image-zoom + <a href="{{ .Get `source` }}"> + <img + loading="lazy" + data-image-zoom="" src="{{ .Get `source` }}" alt="{{ .Get `title` }}" title="{{ .Get `title` }}" diff --git a/generators/hugo/themes/tdro/layouts/shortcodes/marginimage.html b/generators/hugo/themes/tdro/layouts/shortcodes/marginimage.html index d69966f..e90c390 100644 --- a/generators/hugo/themes/tdro/layouts/shortcodes/marginimage.html +++ b/generators/hugo/themes/tdro/layouts/shortcodes/marginimage.html @@ -10,8 +10,10 @@ <label for="{{ $id }}" title="{{ .Inner | replaceRE "\n" " " | markdownify }}"><span>{{ $mark | markdownify }}</span></label> <input type="checkbox" id="{{ $id }}" name="toggle"> <margin-note title="{{ $mark }}" image {{ $set }}> - <a href="{{ $source }}" onclick="return false;"> - <img data-image-zoom + <a href="{{ $source }}"> + <img + loading="lazy" + data-image-zoom="" src="{{ $source }}" title="{{ $title }}" width="{{ $image.Width }}" diff --git a/generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html b/generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html index a2574d5..0e18a56 100644 --- a/generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html +++ b/generators/hugo/themes/tdro/layouts/shortcodes/sideimage.html @@ -10,8 +10,10 @@ <label for="{{ $id }}" title="{{ .Inner | replaceRE "\n" " " | markdownify }}"><span>{{ $mark | markdownify }}</span></label> <input type="checkbox" id="{{ $id }}" name="toggle"> <side-note title="{{ $mark }}" image {{ $set }}> - <a href="{{ $source }}" onclick="return false;"> - <img data-image-zoom + <a href="{{ $source }}"> + <img + loading="lazy" + data-image-zoom="" src="{{ $source }}" title="{{ $title }}" width="{{ $image.Width }}" diff --git a/public/js/app.js b/public/js/app.js index 0d540ce..d26d3e8 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -43,6 +43,17 @@ self.addEventListener('DOMContentLoaded', function() { localStorage['pager'] = JSON.stringify(pager); })(); + (function() { + var imageAnchors = document.querySelectorAll("a"); + for(var i = 0; i < imageAnchors.length; i++){ + if (imageAnchors[i].firstElementChild) { + if (imageAnchors[i].firstElementChild.tagName === "IMG") { + imageAnchors[i].removeAttribute("href"); + } + } + } + })(); + /** * Scroll events */ |