Blog: Re-order hideOverlay to be re-used
This commit is contained in:
parent
350577033c
commit
85dba5e9e9
@ -14,6 +14,22 @@ script(type="text/javascript").
|
||||
|
||||
ProjectUtils.setProjectAttributes({isProject: false});
|
||||
|
||||
// Click anywhere in the page to hide the overlay
|
||||
var page_overlay = document.getElementById('page-overlay');
|
||||
|
||||
function hidePageOverlay() {
|
||||
$(page_overlay)
|
||||
.removeAttr('class')
|
||||
.html('');
|
||||
}
|
||||
|
||||
$(page_overlay).click(function(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
hidePageOverlay();
|
||||
});
|
||||
|
||||
{% if node %}
|
||||
ProjectUtils.setProjectAttributes({
|
||||
nodeId: '{{node._id}}',
|
||||
@ -38,8 +54,6 @@ script(type="text/javascript").
|
||||
|
||||
|
||||
// If we are im preview mode, update the image source
|
||||
var page_overlay = document.getElementById('page-overlay');
|
||||
|
||||
if (page_overlay.classList.contains('active')) {
|
||||
var node_preview = document.getElementById('node-preview');
|
||||
|
||||
@ -80,20 +94,6 @@ script(type="text/javascript").
|
||||
|
||||
{% endif %}
|
||||
|
||||
// Click anywhere in the page to hide the overlay
|
||||
function hidePageOverlay() {
|
||||
$(page_overlay)
|
||||
.removeAttr('class')
|
||||
.html('');
|
||||
}
|
||||
|
||||
$(page_overlay).click(function(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
hidePageOverlay();
|
||||
});
|
||||
|
||||
function navigateTree(prev){
|
||||
var tree = $('#project_tree').jstree(true);
|
||||
var curr = tree.get_selected(false);
|
||||
|
@ -122,19 +122,7 @@ link(href="{{ url_for('static_pillar', filename='assets/css/blog.css', v=2122016
|
||||
| {% block footer_scripts %}
|
||||
include ../_scripts
|
||||
script.
|
||||
var project_container = document.getElementById('project-container');
|
||||
|
||||
/* UI Stuff */
|
||||
$(window).on("load resize",function(){
|
||||
containerResizeY($(window).height());
|
||||
|
||||
if ($(window).width() > 480) {
|
||||
project_container.style.height = (window.innerHeight - project_container.offsetTop) + "px";
|
||||
}
|
||||
});
|
||||
|
||||
/* 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();
|
||||
|
||||
@ -142,7 +130,6 @@ script.
|
||||
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('<img src="' + src + '"/>');
|
||||
@ -150,4 +137,5 @@ script.
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
|
||||
| {% endblock %}
|
||||
|
@ -90,6 +90,25 @@
|
||||
| {% block footer_scripts %}
|
||||
|
||||
include ../_scripts
|
||||
script hopToTop(); // Display jump to top button
|
||||
script.
|
||||
hopToTop(); // Display jump to top button
|
||||
|
||||
/* Expand images when their link points to a jpg/png/gif */
|
||||
/* TODO: De-duplicate code from view post */
|
||||
var page_overlay = document.getElementById('page-overlay');
|
||||
$('.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$")) {
|
||||
$(page_overlay)
|
||||
.addClass('active')
|
||||
.html('<img src="' + src + '"/>');
|
||||
} else {
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
|
||||
| {% endblock %}
|
||||
|
@ -94,17 +94,6 @@ script.
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
var project_container = document.getElementById('project-container');
|
||||
|
||||
/* UI Stuff */
|
||||
$(window).on("load resize",function(){
|
||||
containerResizeY($(window).height());
|
||||
|
||||
if ($(window).width() > 480) {
|
||||
project_container.style.height = (window.innerHeight - project_container.offsetTop) + "px";
|
||||
}
|
||||
});
|
||||
|
||||
/* 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){
|
||||
|
@ -123,6 +123,24 @@ meta(name="twitter:description", content="{{ node.properties.content }}")
|
||||
| {% block footer_scripts %}
|
||||
|
||||
include ../_scripts
|
||||
script hopToTop(); // Display jump to top button
|
||||
script.
|
||||
hopToTop(); // Display jump to top button
|
||||
|
||||
/* Expand images when their link points to a jpg/png/gif */
|
||||
/* TODO: De-duplicate code from view post */
|
||||
var page_overlay = document.getElementById('page-overlay');
|
||||
$('.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$")) {
|
||||
$(page_overlay)
|
||||
.addClass('active')
|
||||
.html('<img src="' + src + '"/>');
|
||||
} else {
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
| {% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user