diff --git a/src/templates/nodes/custom/blog/index.jade b/src/templates/nodes/custom/blog/index.jade index 718c84a4..79c05b63 100644 --- a/src/templates/nodes/custom/blog/index.jade +++ b/src/templates/nodes/custom/blog/index.jade @@ -133,4 +133,21 @@ script. } }); + /* Expand images when their link points to a jpg/png/gif */ + /* TODO: De-duplicate code from view post */ + $('.blog_index-item .item-content a img').on('click', function(e){ + e.preventDefault(); + + var href = $(this).parent().attr('href'); + var src = $(this).attr('src'); + + if (href.match("jpg$") || href.match("png$") || href.match("gif$")) { + var page_overlay = document.getElementById('page-overlay'); + $(page_overlay) + .addClass('active') + .html(''); + } else { + window.location.href = href; + } + }); | {% endblock %} diff --git a/src/templates/nodes/custom/post/view.jade b/src/templates/nodes/custom/post/view.jade index 77abd8ea..9b6d873c 100644 --- a/src/templates/nodes/custom/post/view.jade +++ b/src/templates/nodes/custom/post/view.jade @@ -105,4 +105,21 @@ script. } }); + /* Expand images when their link points to a jpg/png/gif */ + /* TODO: De-duplicate code from blog index */ + $('.blog_index-item .item-content a img').on('click', function(e){ + e.preventDefault(); + + var href = $(this).parent().attr('href'); + var src = $(this).attr('src'); + + if (href.match("jpg$") || href.match("png$") || href.match("gif$")) { + var page_overlay = document.getElementById('page-overlay'); + $(page_overlay) + .addClass('active') + .html(''); + } else { + window.location.href = href; + } + }); | {% endblock %}