98 lines
3.7 KiB
JavaScript
98 lines
3.7 KiB
JavaScript
/*! imajs v0.0.7 | (c) C.I.R.C.E.'s & affini | https://ima.circex.org/LICENSE.md */
|
|
/* === LICENZA = LICENSE ===
|
|
* This file is released under license Against DRM 2.0 - We do not like DRM
|
|
*
|
|
* The license guarantees the rights to: reproduce, distribute, publish, perform, broadcast, modify, elaborate, transcribe, translate, lend, rent and sell the content.
|
|
* It prohibits to use the content, when distributed togeher with Digital Rights Management mechanisms.
|
|
* For more information on DRM see https://www.defectivebydesign.org/what_is_drm_digital_restrictions_management
|
|
*
|
|
* Every re-distribution, sharing, modification has to maintain the same conditions, mentioning the original authors
|
|
* Read the full license at https://web.archive.org/web/20170327160245/http://www.freecreations.org/Against_DRM2.html
|
|
* or in the file called LICENSE.md that comes together with this file.
|
|
*
|
|
* The original authors of this piece of code can be contacted, supported, etc. by email: info at circe dot org
|
|
*
|
|
* Please keep the following (C) notice, if you are working on this file.
|
|
* [Original work] Copyright (C) [2019] [C.I.R.C.E.'s & affini https://circex.org]
|
|
*
|
|
* === "The method is content" = "Il metodo e' contenuto" ===
|
|
*/
|
|
|
|
$( document ).ready(function() {
|
|
|
|
/* height fix for the content */
|
|
var margT = $('#content').outerHeight(true) - $('#content').outerHeight();
|
|
$('#content').css('min-height',$(window).height()-($('.footer').outerHeight()+margT));
|
|
pathh=window.location.href;
|
|
prevh='';nexth='';
|
|
current=window.location.pathname.split('storie/')[1];
|
|
current2=window.location.pathname.split('stories/')[1];
|
|
if (!current&&!current2){
|
|
$('nav.navbar').addClass('fixed');
|
|
$('#table-of-contents').show();
|
|
}
|
|
else{
|
|
current=current||current2;
|
|
rel='../'+current;
|
|
|
|
/* <> nesting indice <> */
|
|
cur=$("nav.navbar a[href='"+rel+"'");
|
|
// console.log(cur);
|
|
cur.addClass('currense');
|
|
cur.parents('nav.navbar ul li').addClass('currense uncollapse');
|
|
cur.parent().siblings('ul li:not(:has(ul))').addClass('uncollapse');
|
|
cur.parent().find('ul li').addClass('uncollapse');
|
|
|
|
$('nav.navbar > ul > li > a').click(function(){
|
|
// event.preventDefault();
|
|
$('nav.navbar ul li').removeClass('uncollapse');
|
|
$(this).parent().find('ul li').addClass('uncollapse');
|
|
$(this).addClass('uncollapse');
|
|
});
|
|
/* <> fine nesting indice <> */
|
|
|
|
|
|
/* <> navigazione in fondo al content <> */
|
|
if( current.indexOf('index') != -1 ){
|
|
$('nav.navbar').addClass('fixed');
|
|
nexth=cur.next().find('a').first().attr('href');
|
|
prevh=cur.parent().prev().find('a').last().attr('href');
|
|
}else{
|
|
if(!cur.parent().is(':first-child')){
|
|
prevh=cur.parent().prev().children('a').attr('href');
|
|
}else{
|
|
prevh=cur.parents('li:has(ul)').children('a').attr('href');
|
|
}
|
|
if(!cur.parent().is(':last-child')){
|
|
nexth=cur.parent().next().children('a').attr('href');
|
|
}else{
|
|
nexth=cur.parents('li:has(ul)').next().children('a').attr('href');
|
|
}
|
|
}
|
|
}
|
|
|
|
if(prevh){
|
|
var prev = $('<a />').addClass('prev prevnext').html('↜').attr('href',prevh);
|
|
$('#content').append(prev);
|
|
}
|
|
if(nexth){
|
|
var next = $('<a />').addClass('next prevnext').html('↝').attr('href',nexth);
|
|
$('#content').append(next);
|
|
}
|
|
|
|
if ( ( pathh.indexOf('storie') == -1 ) && ( ( pathh.indexOf('index.html') != -1 ) || ( pathh.indexOf('html') == -1 ) ) ){
|
|
nexth=$("nav.navbar a:first-of-type").attr('href');
|
|
var next = $('<a />').addClass('prevnext pvhome').html('↝').attr('href',nexth);
|
|
$('#content .figure:last-of-type').before(next);
|
|
}
|
|
|
|
|
|
/* <> fine navigazione in fondo al content <> */
|
|
|
|
|
|
$('.navigation-bar .indice').click(
|
|
function() {
|
|
$('nav.navbar').toggleClass('fixxed');
|
|
});
|
|
|
|
});
|