Blog: Re-order hideOverlay to be re-used
This commit is contained in:
@@ -14,6 +14,22 @@ script(type="text/javascript").
|
|||||||
|
|
||||||
ProjectUtils.setProjectAttributes({isProject: false});
|
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 %}
|
{% if node %}
|
||||||
ProjectUtils.setProjectAttributes({
|
ProjectUtils.setProjectAttributes({
|
||||||
nodeId: '{{node._id}}',
|
nodeId: '{{node._id}}',
|
||||||
@@ -38,8 +54,6 @@ script(type="text/javascript").
|
|||||||
|
|
||||||
|
|
||||||
// If we are im preview mode, update the image source
|
// If we are im preview mode, update the image source
|
||||||
var page_overlay = document.getElementById('page-overlay');
|
|
||||||
|
|
||||||
if (page_overlay.classList.contains('active')) {
|
if (page_overlay.classList.contains('active')) {
|
||||||
var node_preview = document.getElementById('node-preview');
|
var node_preview = document.getElementById('node-preview');
|
||||||
|
|
||||||
@@ -80,20 +94,6 @@ script(type="text/javascript").
|
|||||||
|
|
||||||
{% endif %}
|
{% 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){
|
function navigateTree(prev){
|
||||||
var tree = $('#project_tree').jstree(true);
|
var tree = $('#project_tree').jstree(true);
|
||||||
var curr = tree.get_selected(false);
|
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 %}
|
| {% block footer_scripts %}
|
||||||
include ../_scripts
|
include ../_scripts
|
||||||
script.
|
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 */
|
/* 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){
|
$('.blog_index-item .item-content a img').on('click', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@@ -142,7 +130,6 @@ script.
|
|||||||
var src = $(this).attr('src');
|
var src = $(this).attr('src');
|
||||||
|
|
||||||
if (href.match("jpg$") || href.match("png$") || href.match("gif$")) {
|
if (href.match("jpg$") || href.match("png$") || href.match("gif$")) {
|
||||||
var page_overlay = document.getElementById('page-overlay');
|
|
||||||
$(page_overlay)
|
$(page_overlay)
|
||||||
.addClass('active')
|
.addClass('active')
|
||||||
.html('<img src="' + src + '"/>');
|
.html('<img src="' + src + '"/>');
|
||||||
@@ -150,4 +137,5 @@ script.
|
|||||||
window.location.href = href;
|
window.location.href = href;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
| {% endblock %}
|
| {% endblock %}
|
||||||
|
@@ -90,6 +90,25 @@
|
|||||||
| {% block footer_scripts %}
|
| {% block footer_scripts %}
|
||||||
|
|
||||||
include ../_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 %}
|
| {% endblock %}
|
||||||
|
@@ -94,17 +94,6 @@ script.
|
|||||||
});
|
});
|
||||||
{% endif %}
|
{% 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 */
|
/* Expand images when their link points to a jpg/png/gif */
|
||||||
/* TODO: De-duplicate code from blog index */
|
/* TODO: De-duplicate code from blog index */
|
||||||
$('.blog_index-item .item-content a img').on('click', function(e){
|
$('.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 %}
|
| {% block footer_scripts %}
|
||||||
|
|
||||||
include ../_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 %}
|
| {% endblock %}
|
||||||
|
Reference in New Issue
Block a user