diff options
author | luxagraf <sng@luxagraf.net> | 2018-10-25 19:04:21 +0000 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-10-25 19:04:21 +0000 |
commit | a68c37f0b766a59d75b28776ae52bfbc41e82192 (patch) | |
tree | 6d04dd1286711866de526d67f952a2446b4b595c /design/templates | |
parent | b8a86161167d8732ffff57f37cc99b85e16d5386 (diff) |
fixed a bug in lightbox js, used defered loading for scripts
Diffstat (limited to 'design/templates')
-rw-r--r-- | design/templates/details/entry.html | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/design/templates/details/entry.html b/design/templates/details/entry.html index eb9d83c..0cc550e 100644 --- a/design/templates/details/entry.html +++ b/design/templates/details/entry.html @@ -112,28 +112,38 @@ document.addEventListener("DOMContentLoaded", function(event) { var leaflet = document.createElement('script'); leaflet.src = "/media/js/leaflet-master/leaflet-mod.js"; document.body.appendChild(leaflet); - var detail = document.createElement('script'); - detail.src = "/media/js/detail.min.js"; - document.body.appendChild(detail); var lightbox = document.createElement('script'); lightbox.src = "/media/js/lightbox.js"; document.body.appendChild(lightbox); - - 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); + 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; } - }; - var lightbox = new Lightbox(); - lightbox.load(opts); + {%endif%}{%endwith%} + } + + 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); + } {% if object.enable_comments %} {% get_comment_count for object as comment_count %} {%if comment_count > 0 %} @@ -148,10 +158,6 @@ document.addEventListener("DOMContentLoaded", function(event) { } {%endif%} {%endif%} - {% with object.get_template_name_display as t %}{%if t == "single" or t == "single-dark" %} - createMap(); - var open = false; - {%endif%}{%endwith%} {% if object.has_video %} var tester = document.getElementsByClassName("vidauto"); var wrapper = document.getElementById('wrapper'); |