CVI
booklet.js 1.3 simulates an authentic looking album or book presenting photos, images and pictures of all sizes and with any aspect ratio. Includes covering, navigation, information, linking and auto generated visual table of contents. Supports realtime filters in conjunction with the cvi_filter library (inc. tiltshift a.k.a. miniature fake filter). It also allows you to build interactive applications through the various user commands. It uses unobtrusive javascript to keep your code clean.

It works in all the major browsers: Mozilla Firefox 2+, Safari 2+, Chrome 4+, IE 6+ and Opera 9+. On older browsers, it'll degrade and your visitors won't notice a thing.

Demonstration


Click to see what booklet.js can do.
calendar
Calendar (top-down)
missing
Missing (no cover)
sunrise
Sunrise (double page)
mixed
Mixed (features)

Images used are copyrighted and are used for demonstration only.

Setting Up

Download the Booklet archive and include the following files (consider the order) into your webpage.

// only if you want to use the stackblur image filter [Algorithm by Mario Klingemann]
<script type="text/javascript" src="cvi_stackblur.js"></script>
// only if you want to use image filters
<script type="text/javascript" src="cvi_filter_lib.js"></script>
// if you want to use language translations [de|el|en|es|fr|it|ja|ko|nl|pt|ru|zh]
<script type="text/javascript" src="booklet_lang.js"></script>
// this one is mandatory
<script type="text/javascript" src="booklet.js"></script>

Using It

To add a booklet object, just execute the function "booklet.add( element, { options } );" to a block-level element.

Usage

Set defaults
booklet.defaultCallback       = ""; //STR function name
booklet.defaultLanguage       = null; //OBJ e.g. [language format]
booklet.defaultImagearray     = null; //OBJ [data format]
booklet.defaultMainwidth      = 600; //INT 280|180-n (px width)
booklet.defaultMainheight     = 400; //INT 180|280-n (px height)
booklet.defaultShade          = 50; //INT 1-100 (% opacity)
booklet.defaultShadow         = 50; //INT 1-100 (% opacity)
booklet.defaultDoublepage     = false; //BOOLEAN 1 image fills 2 pages
booklet.defaultCalendarmode   = false; //BOOLEAN Top 2 Bottom instead of Left 2 Right
booklet.defaultTopdownshadow  = false; //BOOLEAN instead of leftTop to RightBottom
booklet.defaultForcecaption   = false; //BOOLEAN use the filename if caption is missing
booklet.defaultForceimginfo   = false; //BOOLEAN append image dimensions and used filters to comment
booklet.defaultAutoplay       = false; //BOOLEAN set automode to on|off
booklet.defaultVerbose        = false; //BOOLEAN console output is more chatty (warnings)
booklet.defaultBuffered       = false; //BOOLEAN set render buffer to on|off
booklet.defaultNoshadow       = false; //BOOLEAN set shadow to on|off
booklet.defaultNocover        = false; //BOOLEAN set cover to on|off
booklet.defaultNopanel        = false; //BOOLEAN lock the navigation panel
booklet.defaultNoradius       = false; //BOOLEAN set cover radius to on|off
booklet.defaultNotoc          = false; //BOOLEAN toc equals table of contents
booklet.defaultTocfirst       = false; //BOOLEAN startup with Table Of Contents
booklet.defaultToctooltip     = false; //BOOLEAN tooltip instead of overlay text
booklet.defaultPoweroftwo     = 4; //INT 2x2 | 3x3 | 4x4 ... TOC thumbs per page
booklet.defaultPagecolor      = '#f8f8f8'; //STR '#000000'-'#ffffff'
booklet.defaultCovercolor     = '#808080'; //STR '#000000'-'#ffffff'
booklet.defaultSelectorcolor  = '#000000'; //STR '#000000'-'#ffffff'
booklet.defaultCovertexture   = ''; //STR (image source)
booklet.defaultTextureopacity = 100; //FLT 1-100 (% opacity)
booklet.defaultInfobgopacity  = 50; //FLT 1-100 (% opacity)
booklet.defaultLayeropacity   = 50; //FLT 1-100 (% opacity)
booklet.defaultLayercolor     = '#ffffff'; //STR '#000000'-'#ffffff'
booklet.defaultInfobgcolor    = '#000000'; //STR '#000000'-'#ffffff'
booklet.defaultInfotxcolor    = '#ffffff'; //STR '#000000'-'#ffffff'
booklet.defaultImprintheader  = ""; //STR
booklet.defaultImprintbody    = ""; //STR
booklet.defaultImprintfooter  = ""; //STR
booklet.defaultNotrans        = false; //BOOLEAN no transposing from Mfgcolor to Mftcolor
booklet.defaultMeter          = false; //BOOLEAN show delay meter while auto playing
booklet.defaultMfgcolor       = '#008000'; //STR meter foreground color
booklet.defaultMftcolor       = '#ff0000'; //STR meter foreground destination color
booklet.defaultMbgcolor       = '#ffffff'; //STR meter background color
booklet.defaultMopacity       = 0.5; //FLOAT 0.1-1.0 meter opacity
booklet.defaultMsize          = 32; //INT 24-min(width,height) meter dimension
booklet.defaultMposx          = 10; //INT 0-(width-msize) meter position x
booklet.defaultMposy          = 10; //INT 0-(height-msize) meter position y
*** depends on: cvi_filter_lib.js (syntax at: filter.netzgesta.de) ***
booklet.defaultFilter         = null; //OBJ e.g. [{f:'grayscale'},{f:'emboss', s:1}...]
booklet.defaultFiltertoc      = false; //BOOLEAN filter also the thumbnails
booklet.defaultForceglobal    = false; //BOOLEAN force global filter over local filter
**********************************************************************
booklet.defaultAnimsteps      = 0; //INT 0-n equals anim steps (0 == use pxperstep value)
booklet.defaultPxperstep      = 16; //INT 1-n equals pixel per step
booklet.defaultFramedelay     = 33; //INT 20-50 equals milli seconds (1/1000)
booklet.defaultPlaydelay      = 0; //INT 0-n equals seconds
booklet.defaultLoadtimeout    = 3; //INT 1-60 equals seconds
booklet.defaultButtonsize     = 32; //INT 24|32|40|48|56|64 (px)
booklet.defaultButtonradius   = 100; //FLT 0.001-100 (% of half size)
booklet.defaultButtonfgcolor  = '#ffffff'; //STR (text) hex color declaration '#000000'-'#ffffff'
booklet.defaultButtonbgcolor  = '#000000'; //STR (background) hex color declaration '#000000'-'#ffffff'
booklet.defaultOverlayimage   = "images/logo.png"; //STR (text) background-image
booklet.defaultOverlaystyle   = "font-weight:bold; font-size:14px; color:grey;"; //STR (text) style sheet declaration e.g. "color: black;" or style sheet classes e.g. "overlay text"
booklet.defaultOverlayoptions = {color:'white', opacity:0.5}; //OBJ default values [overlay syntax]
booklet.defaultBusyoptions    = {color:'#000000', size:100, type:'o'}; //OBJ default values [busy syntax]
overlay syntax:
color   : 'white' //STR css color declaration e.g. 'black' or '#000000' or 'rgb(0,0,0)'
opacity : 0.5 //FLT 0.001 - 1.0
busy syntax:
color   : '#000' //STR '#000000' - '#ffffff' or '#000' - '#fff'
size    : 32 //INT 16 - 512 (pixel)
type    : 'tube' //STR 'circle|oval|polygon|rectangle|tube' or 'c|o|p|r|t'
iradius : 8 //INT 6 - 254 (pixel)
weight  : 3 //INT 1 - 254 (pixel)
count   : 12 //INT 5 - 36 (rays)
speed   : 96 //INT 30 - 1000 (millisec)
minopac : 0.25 //FLT 0.0 - 0.5 (opacity)
language format:
lang.overlaytext = "loading images...";
lang.playbutton  = "play/pause";
lang.nextbutton  = "next";
lang.prevbutton  = "previous";
lang.firstbutton = "first";
lang.lastbutton  = "last";
lang.fwardbutton = "5x forward";
lang.bwardbutton = "5x backward";
lang.menubutton  = "back to contents";
lang.listbutton  = "imprint/epilog";
lang.tablebutton = "table of contents";
data format:
data = [{
source   : 'path/file.jpg', //STR mandatory image path & file (minimum dimension 64x64)
imgshift : 0.5, //FLT optional image shift value (0==top|left, 0.5==center, 1==bottom|right)
delay    : null, //FLT optional delay value (seconds)
caption  : '', //STR optional caption
comment  : '', //STR optional comment (inc. html-tags)
title    : '', //STR optional tooltip
link     : '', //STR optional URL (js-function by "javascript:...")
target   : '_self', //STR optional target ('_self'|'_blank'|'...')
filter   : [{f:'grayscale'},{f:'emboss', s:1}...], //OBJ optional (depends on cvi_filter_lib.js)
}, {source: 'image.jpg'}]

Add booklet
booklet.add(element[, options]);
element == block-level element
options       e.g. {mainwidth: 180, mainheight: 280, ...}
cover

Cover oriented Options

shade          : 50, //INT 1-100 (% opacity)
shadow         : 50, //INT 1-100 (% opacity)
covercolor     : '#808080', //STR '#000000'-'#ffffff'
covertexture   : '', //STR (image source)
textureopacity : 100, //FLT 1-100 (% opacity)
topdownshadow  : false, //BOOLEAN instead of leftTop to RightBottom
noshadow       : false, //BOOLEAN set shadow to on|off
nocover        : false, //BOOLEAN set cover to on|off
noradius       : false, //BOOLEAN set cover radius to on|off
busy

Busy-panel oriented Options

overlayimage   : "images/logo.png", //STR (text) background-image
overlaystyle   : "font-weight:bold; font-size:14px; color:grey;", //STR (text) style sheet declaration e.g. "color: black;" or style sheet classes e.g. "overlay text"
overlayoptions : {color:'white', opacity:0.5}, //OBJ default values [overlay syntax]
busyoptions    : {color:'#000000', size:100, type:'o'}, //OBJ default values [busy syntax]
general

Pages oriented Options

callback       : "", //STR function name
language       : null, //OBJ e.g. [language format]
imagearray     : null, //OBJ [data format]
mainwidth      : 600, //INT 280|180-n (px width)
mainheight     : 400, //INT 180|280-n (px height)
doublepage     : false, //BOOLEAN 1 image fills 2 pages
calendarmode   : false, //BOOLEAN Top-2-Bottom instead of Left-2-Right
autoplay       : false, //BOOLEAN set automode to on|off
verbose        : false, //BOOLEAN console output is more chatty (warnings)
buffered       : false, //BOOLEAN set render buffer to on|off
nopanel        : false, //BOOLEAN lock the navigation panel
animsteps      : 0, //INT 0-n equals anim steps (0 == use pxperstep value)
pxperstep      : 16, //INT 1-n equals pixel per step
framedelay     : 33, //INT 20-50 equals milli seconds (1/1000)
playdelay      : 0, //INT 0-n equals seconds
loadtimeout    : 3, //INT 1-60 equals seconds
pagecolor      : '#f8f8f8', //STR '#000000'-'#ffffff'
filter

Filter oriented Options

filter         : null, //OBJ e.g. [{f:'grayscale'},{f:'emboss', s:1}...]
filtertoc      : false, //BOOLEAN filter also the thumbnails
forceglobal    : false, //BOOLEAN force global filter over local filter
*** depends on: cvi_filter_lib.js (syntax at: filter.netzgesta.de) ***

toc

TOC oriented Options

notoc          : false, //BOOLEAN toc equals Table of contents
poweroftwo     : 4, //INT 2x2 | 3x3 | 4x4 ... toc thumbs per page
tocfirst       : false, //BOOLEAN startup with Table Of Contents
toctooltip     : false, //BOOLEAN tooltip instead of overlay text
selectorcolor  : '#000000', //STR '#000000'-'#ffffff'
layeropacity   : 50, //FLT 1-100 (% opacity)
layercolor     : '#ffffff', //STR '#000000'-'#ffffff'
info

Info-panel oriented Options

forcecaption   : false, //BOOLEAN use the filename if caption is missing
forceimginfo   : false, //BOOLEAN append image dimensions and used filters to comment
infobgopacity  : 50, //FLT 1-100 (% opacity)
infobgcolor    : '#000000', //STR '#000000'-'#ffffff'
infotxcolor    : '#ffffff', //STR '#000000'-'#ffffff'
imprintheader  : "", //STR
imprintbody    : "", //STR
imprintfooter  : "", //STR
ctrl

Ctrl-panel oriented Options

buttonsize     : 32, //INT 24|32|40|48|56|64 (px)
buttonradius   : 100, //FLT 0.001-100 (% of half size)
buttonfgcolor  : '#ffffff', //STR (text) hex color declaration '#000000'-'#ffffff'
buttonbgcolor  : '#000000', //STR (background) hex color declaration '#000000'-'#ffffff'
meter

Meter oriented Options

notrans        : false, //BOOLEAN no transposing from Mfgcolor to Mftcolor
meter          : false, //BOOLEAN show delay meter while auto playing
mfgcolor       : '#008000', //STR meter foreground color
mftcolor       : '#ff0000', //STR meter foreground destination color
mbgcolor       : '#ffffff', //STR meter background color
mopacity       : 0.5, //FLOAT 0.1-1.0 meter opacity
msize          : 32, //INT 24-min(width,height) meter dimension
mposx          : 10, //INT 0-(width-msize) meter position x
mposy          : 10, //INT 0-(height-msize) meter position y

Load imagearray
booklet.data(element, imagearray [, options]);
element    == block-level element
imagearray == OBJECT [data format]
options       e.g. {framedelay: 40, nopanel: false, ...}
callback       : "", //STR function name
language       : null, //OBJ e.g. [language format]
forcecaption   : false, //BOOLEAN use the filename if caption is missing
forceimginfo   : false, //BOOLEAN append image dimensions and used filters to comment
filter         : null, //OBJ e.g. [{f:'grayscale'},{f:'emboss', s:1}...]
filtertoc      : false, //BOOLEAN filter also the thumbnails
tocfirst       : false, //BOOLEAN startup with Table Of Contents
forceglobal    : false, //BOOLEAN force global filter over local filter
autoplay       : false, //BOOLEAN set automode to on|off
verbose        : false, //BOOLEAN console output is more chatty (warnings)
buffered       : false, //BOOLEAN set render buffer to on|off
nopanel        : false, //BOOLEAN lock the navigation panel
toctooltip     : false, //BOOLEAN tooltip instead of overlay text
imprintheader  : "", //STR
imprintbody    : "", //STR
imprintfooter  : "", //STR
notrans        : false, //BOOLEAN no transposing from Mfgcolor to Mftcolor
meter          : false, //BOOLEAN show delay meter while auto playing
mfgcolor       : '#008000', //STR meter foreground color
mftcolor       : '#ff0000', //STR meter foreground destination color
mbgcolor       : '#ffffff', //STR meter background color
mopacity       : 0.5, //FLOAT 0.1-1.0 meter opacity
msize          : 32, //INT 24-min(width,height) meter dimension
mposx          : 10, //INT 0-(width-msize) meter position x
mposy          : 10, //INT 0-(height-msize) meter position y
animsteps      : 0, //INT 0-n equals anim steps (0 == use pxperstep value)
pxperstep      : 16, //INT 1-n equals pixel per step
framedelay     : 33, //INT 20-50 equals milli seconds (1/1000)
playdelay      : 0, //INT 0-n equals seconds
loadtimeout    : 3, //INT 1-60 equals seconds

Remote control
booklet.play(element); (start playing)
booklet.stop(element); (stop playing)
booklet.first(element); (show first image)
booklet.prev(element); (show previous image)
booklet.show(element, image_number); (show this image)
booklet.next(element); (show next image)
booklet.last(element); (show last image)

Get some informations
FLOAT   = booklet.version;
STRING  = booklet.released;
BOOLEAN = booklet.canvas();
BOL|INT|STR = booklet.get(element, ['setup'|'blocked'|'curling'|'playing'|'current'|'total'|'viewmode'|'origin'|'imginfo', image_number] );
setup    == BOOLEAN uninitialized
blocked  == BOOLEAN unaccessible
curling  == BOOLEAN transition in action
playing  == BOOLEAN autoplay in action
current  == INTEGER current image number (starting with zero)
total    == INTEGER no. of all images
viewmode == STRING matches "image" or "toc"
origin   == STRING location protocol & host
imginfo  == OBJECT [name|source|abs_url|diff_origin|filter|width|height]

Set some values
booklet.set(element, ['playdelay'|'nopanel'], value);
playdelay == INTEGER 0 - n seconds
nopanel == BOOLEAN true | false

Remove booklet
booklet.remove(image, value);
value == BOOLEAN (fade out)

Examples
booklet.add(document.getElementById('my_div'));
if(typeof $=='undefined') {function $(v) {return(document.getElementById(v));}}
if(booklet.canvas()) {booklet.add($('my_div'));} else {alert('Sorry jurassic-guy!');}
booklet.add($('my_div'), {mainwidth:800, mainheight:600});
booklet.set($('my_div'),'nopanel',false);
<button type="button" onclick="booklet.set($('my_div'),'play',true);"> > </button>
<button type="button" onclick="booklet.set($('my_div'),'stop',true);"> || </button>
alert(booklet.get($('my_div'),'current'));
alert('booklet: '+booklet.version+' ('+booklet.released+')');
booklet.show($('my_div'),52);
booklet.data($('my_div'),my_options);
booklet.remove($('my_div'),true);

Support libs

You'll get access to additional features by the following support libraries (not a part of distribution):

Why use Javascript booklet?

In old browsers, the script degrades and your visitors will notice the fallback content.

Download

Please read the license before you download booklet.js 1.3

F.A.Q.

Please read the Frequently Asked Questions before you contact the author.

Restrictions

Generally: The larger the canvas area the higher the needed cpu/gpu power.

The concept behind booklet (lots of mouse-over events) makes it not very useable on mouseless platforms. Nevertheless a nasty webkit bug (iOS only) prevents booklet to view images in the correct manner. On the other hand, it runs well on Android.

There are multiple mouseover-areas, fading panels in and out!
mouseover-areas

At initial release of booklet.js, Internet Explorer 9 was not available as a final release (beta only). So it's canvas implementation was not completed at this stage (missing Composite Operation), and a few bugs had to be eliminated. That are the reasons why the tiltshift filter is broken, and why some mouse-over elements do not fade softly!

Due to a bunch of reasons the Internet Explorer 6/7/8 version is missing a lot of features. No table of contents. No filters. No button inverting. No soft fading. Page turn is just a fake.

If you want to use filters with images from other origins, you need a simple proxy to outsmart the security mechanism. This is because of the Same origin policy. SOLUTION: use a proxy like "imgproxy.php?url=" as a prefix in path (imgproxy.php is open source and part of the distribution)!

History

Version 1.3

Version 1.2 Version 1.1 Version 1.0

Contact

Please leave any comments at this contact formular.

License

booklet.js is distributed under the Netzgestade Non-commercial Software License Agreement.
License permits free of charge use on non-commercial and private web sites only under special conditions (as described in the license). This license equals neither "open source" nor "public domain". There are also Commercial Software Licenses available.

YOU AGREE TO ALL CONDITIONS OF THIS LICENCE AGREEMENT CONCERNING THE USE OF THE SOFTWARE BY ACCEPTING THIS LICENCE.
IF YOU DO NOT AGREE TO ALL CONDITIONS OF THIS AGREEMENT, YOU SHALL NOT INSTALL THE SOFTWARE, OR USE IT IN OTHER WAYS.

Other Projects

booklet.netzgesta.de © 2024 by Christian Effenberger :: Imprint feed   twitter   facebook   myspace   delicious   digg   reddit   magnoliacom   newsvine   furl   google   yahoo   blinklist   mister-wong