#!/usr/bin/env zsh # # WebNomad, your slick and static website publisher # # Copyright (C) 2012-2014 Denis Roio # # This source code is free software; you can redistribute it and/or # modify it under the terms of the GNU Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This source code is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # Please refer to the GNU Public License for more details. # # You should have received a copy of the GNU Public License along with # this source code; if not, write to: # Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. includejs+=(jquery.min.js) includejs+=(blueimp-gallery.min.js) includecss+=(blueimp-gallery.min.css) render_gallery() { render_header # close with gallery specific styles cat <
EOF # don't forget the navbar cat tmpl/navbar.html cat < EOF # put a notice for non-javascript browsers cat <

 

Javascript missing. You either have JavaScript turned off or your browser doesn't support JavaScript. This website mostly consists of image galleries and needs JavaScript.
EOF # if a file was specified as argument, include it { test -r "$1" } && { cat "$1" | render_html } # generate the gallery's javascript dst_js="temp-${RANDOM}-gallery.js" cat < ${destination}/js/${dst_js} var slides= []; EOF # parse gallery entries pics=`grep -v '^#'` for p in ${(f)pics}; do file=${p[(ws: :)1]} desc=`print $p | awk '{ for(c=2;c<=NF;c++) printf("%s ",$c) }'` cat << EOF >> ${destination}/js/$dst_js slides.push({ href: '${file}', title: '${desc}' }); EOF done cat <> ${destination}/js/$dst_js function shuffle(array) { var m = array.length, t, i; // While there remain elements to shuffle… while (m) { // Pick a remaining element… i = Math.floor(Math.random() * m--); // And swap it with the current element. t = array[m]; array[m] = array[i]; array[i] = t; } return array; } slides = shuffle(slides); blueimp.Gallery(slides, { container: '#blueimp-gallery', carousel: true, fullscreen: true, closeOnEscape: true, closeOnSwipeUpOrDown: true, startSlideshow: true, slideshowInterval: 4500, }); EOF # closeOnSlideClick: true, # not really needed # includejs+=(js/blueimp-helper.js) # includejs+=(js/blueimp-gallery-indicator.js) # includejs+=(js/blueimp-gallery-fullscreen.js) # includejs+=(js/jquery.blueimp-gallery.min.js) includejs+=($dst_js) render_footer }