diff options
author | luxagraf <sng@luxagraf> | 2021-02-22 21:35:30 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf> | 2021-02-22 21:35:30 -0500 |
commit | efd6d7bdd06187d99f8c586b5c3c68c3df6794c9 (patch) | |
tree | bc5185d0f2090e98545ee64ede73826151f28f53 /app/posts | |
parent | 4b8dc2a75ab713a1ae680438fb8b3171e878024e (diff) |
testing CSP javascript fix
Diffstat (limited to 'app/posts')
-rw-r--r-- | app/posts/templates/posts/jrnl_detail.html | 74 |
1 files changed, 5 insertions, 69 deletions
diff --git a/app/posts/templates/posts/jrnl_detail.html b/app/posts/templates/posts/jrnl_detail.html index d4bdb5f..e192c70 100644 --- a/app/posts/templates/posts/jrnl_detail.html +++ b/app/posts/templates/posts/jrnl_detail.html @@ -162,77 +162,13 @@ </main> {% endblock %} {% block js %} +<script src="/media/js/leaflet-master/leaflet-mod.js"></script> +<script src="/media/js/detail.js"></script> <script> document.addEventListener("DOMContentLoaded", function(event) { - var leaflet = document.createElement('script'); - leaflet.src = "/media/js/leaflet-master/leaflet-mod.js"; - document.body.appendChild(leaflet); - var lightbox = document.createElement('script'); - lightbox.src = "/media/js/lightbox.js"; - document.body.appendChild(lightbox); - leaflet.onload = function(){ - var detail = document.createElement('script'); - detail.src = "/media/js/detail.min.js"; - document.body.appendChild(detail); - {% with object.get_template_name_display as t %}{%if t == "single" or t == "single-dark" %} - detail.onload = function(){ - createMap(); - var open = false; - } - {%endif%}{%endwith%} - } - {%comment%} - lightbox.onload = function() { - var opts= { - //nextOnClick: false, - captions: true, - onload: function(){ - var im = document.getElementById("jslghtbx-contentwrapper"); - var link = im.appendChild(document.createElement('a')) - link.href = im.firstChild.src; - link.innerHTML= "open "; - link.target = "_blank"; - link.setAttribute('class', 'p-link'); - im.appendChild(link); - } - }; - var lightbox = new Lightbox(); - lightbox.load(opts); - } - {%endcomment%} - {% if object.enable_comments %} -{% get_comment_count for object as comment_count %} -{%if comment_count > 0 %} - //delay loading of gravatar images using noscript data-hash attribute - dataattr = document.getElementsByClassName("datahashloader"); - for(var i=0; i<dataattr.length; i++) { - var c = dataattr[i].parentNode; - var img = document.createElement("img"); - img.src = 'https://images.luxagraf.net/gravcache/' + dataattr[i].getAttribute('data-hash') + '.jpg'; - img.className += "comment-card-image"; - img.alt = "gravatar icon"; - c.insertBefore(img, c.childNodes[3]); - } -{%endif%} -{%endif%} -{% if object.has_video %} -var tester = document.getElementsByClassName("vidauto"); -var wrapper = document.getElementById('wrapper'); -var dist = 100; - -window.onscroll = function() { - for (var i=0; i<tester.length; i++) { - checkVisible(tester[i]) ? tester[i].play() : tester[i].pause(); - } -}; - -function checkVisible(elm) { - var rect = elm.getBoundingClientRect(); - var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight); - return !(rect.bottom < 0 || rect.top - viewHeight >= 0); -} -{%endif%} - + createMap(); + var open = false; + loadGravatar(); }); </script> {%endblock%} |