diff --git a/demonstration.html b/demonstration.html index 4827065..285be76 100644 --- a/demonstration.html +++ b/demonstration.html @@ -490,6 +490,8 @@ items:contentGalleryMLN, //paginationMaxItemsPerPage:3, paginationMaxLinesPerPage:1, +// paginationDots : true, +paginationVisiblePages: 4, thumbnailHoverEffect:'imageInvisible,imageScale150', viewerDisplayLogo:true, useTags:false, @@ -497,7 +499,6 @@ breadcrumbAutoHideTopLevel:true, maxItemsPerLine:5, locationHash: false, - paginationDots : true, itemsBaseURL:'demonstration/' }); diff --git a/jquery.nanogallery.js b/jquery.nanogallery.js index dcaac35..151e849 100644 --- a/jquery.nanogallery.js +++ b/jquery.nanogallery.js @@ -24,6 +24,12 @@ nanoGALLERY v5.9.2beta release notes. +##### New options +- **paginationVisiblePages**: maximum visible pages. + *integer; Default: 10* +- nanoPhotosProvider now supports options `albumList`, `whiteList`, `blackList`, `album` + +##### Misc - spanish translation (thanks to eae710 - https://github.com/eae710) **Visit nanoGALLERY homepage for usage details: [http://nanogallery.brisbois.fr](http://www.nanogallery.brisbois.fr/)** @@ -113,6 +119,7 @@ nanoGALLERY v5.9.2beta release notes. keepSelection: false, jsonCharset: 'Latin', jsonProvider: '', paginationMaxLinesPerPage : 0, paginationDots : false, paginationSwipe : true, + paginationVisiblePages : 10, maxWidth : 0, viewer : 'internal', viewerFullscreen: false, @@ -1402,7 +1409,7 @@ nanoGALLERY v5.9.2beta release notes. // CUSTOM STORAGE case 'json': - NGAddItem(G.i18nTranslations.breadcrumbHome, '', '', '', '', 'album', '', '0', '-1' ); + NGAddItem(G.i18nTranslations.breadcrumbHome, '', '', '', '', 'album', '', G.O.album.length > 0 ? encodeURIComponent(G.O.album) : '0', '-1' ); JsonProcessItems(0,true,-1,false); break; @@ -1600,6 +1607,7 @@ nanoGALLERY v5.9.2beta release notes. // open URL if( G.I[n].destinationURL !== undefined && G.I[n].destinationURL.length >0 ) { window.location = G.I[n].destinationURL; + //window.open(G.I[n].destinationURL, '_blank'); return; } @@ -2032,7 +2040,7 @@ nanoGALLERY v5.9.2beta release notes. if( G.O.whiteList != '' ) { G.whiteList=G.O.whiteList.toUpperCase().split('|'); } if( G.O.albumList != '' ) { G.albumList=G.O.albumList.toUpperCase().split('|'); } - if( G.O.kind == 'picasa' || G.O.kind == 'flickr' ) { + if( G.O.kind == 'picasa' || G.O.kind == 'flickr' || G.O.kind == 'json' ) { G.O.displayBreadcrumb=true; } // flickr @@ -3158,6 +3166,7 @@ nanoGALLERY v5.9.2beta release notes. } var url = G.O.jsonProvider + '?albumID='+encodeURIComponent(G.I[albumIdx].GetID()); +console.log(url); PreloaderShow(); jQuery.ajaxSetup({ cache: false }); @@ -3246,48 +3255,56 @@ nanoGALLERY v5.9.2beta release notes. if( description === undefined ) { description=''; } var destinationURL=''; - - var albumID=0; - if( item.albumID !== undefined ) { - albumID=(item.albumID); - foundAlbumID=true; + + var kind='image'; + if( item.kind !== undefined && item.kind.length>0 ) { + kind=item.kind; } + var ID=null; if( item.ID !== undefined ) { ID=(item.ID); } - var kind='image'; - if( item.kind !== undefined && item.kind.length>0 ) { - kind=item.kind; + var ok=true; + if( kind == 'album' ) { + if( !CheckAlbumName(title, ID) ) { ok=false; } } - var newItem=NGAddItem(title, thumbsrc, src, description, destinationURL, kind, '', ID, albumID ); - // thumbnail image size - var tw=item.imgtWidth; - var th=item.imgtHeight; + if( ok ) { + var albumID=0; + if( item.albumID !== undefined ) { + albumID=(item.albumID); + foundAlbumID=true; + } - newItem.thumbs = { - url: { l1 : { xs:thumbsrc, sm:thumbsrc, me:thumbsrc, la:thumbsrc, xl:thumbsrc }, lN : { xs:thumbsrc, sm:thumbsrc, me:thumbsrc, la:thumbsrc, xl:thumbsrc } }, - width: { l1 : { xs:tw, sm:tw, me:tw, la:tw, xl:tw }, lN : { xs:tw, sm:tw, me:tw, la:tw, xl:tw } }, - height: { l1 : { xs:th, sm:th, me:th, la:th, xl:th }, lN : { xs:th, sm:th, me:th, la:th, xl:th } } - }; + var newItem=NGAddItem(title, thumbsrc, src, description, destinationURL, kind, '', ID, albumID ); + // thumbnail image size + var tw=item.imgtWidth; + var th=item.imgtHeight; - if( typeof G.O.fnProcessData == 'function' ) { - G.O.fnProcessData(newItem, 'api', null); - } + newItem.thumbs = { + url: { l1 : { xs:thumbsrc, sm:thumbsrc, me:thumbsrc, la:thumbsrc, xl:thumbsrc }, lN : { xs:thumbsrc, sm:thumbsrc, me:thumbsrc, la:thumbsrc, xl:thumbsrc } }, + width: { l1 : { xs:tw, sm:tw, me:tw, la:tw, xl:tw }, lN : { xs:tw, sm:tw, me:tw, la:tw, xl:tw } }, + height: { l1 : { xs:th, sm:th, me:th, la:th, xl:th }, lN : { xs:th, sm:th, me:th, la:th, xl:th } } + }; - if( kind == 'image' ) { - newItem.imageNumber=nb; - nb++; - if( nb >= G.maxAlbums ) { - return false; + if( typeof G.O.fnProcessData == 'function' ) { + G.O.fnProcessData(newItem, 'api', null); + } + + if( kind == 'image' ) { + newItem.imageNumber=nb; + nb++; + if( nb >= G.maxAlbums ) { + return false; + } } } }); if( foundAlbumID ) { - G.O.displayBreadcrumb=true; + // G.O.displayBreadcrumb=true; } G.I[albumIdx].contentIsLoaded=true; @@ -4103,7 +4120,8 @@ nanoGALLERY v5.9.2beta release notes. // check album name - blackList/whiteList function CheckAlbumName( title, ID) { var s=title.toUpperCase(); - + ID=ID.toUpperCase(); + if( G.albumList !== null ) { for( var j=0; j 0 && G.tn.settings.getH() != 'auto' && G.tn.settings.getW() != 'auto' ) { + // number of pages n2=Math.ceil(G.I[albumIdx].contentLength/(G.pgMaxLinesPerPage*G.pgMaxNbThumbnailsPerRow)); } + + var vp=G.O.paginationVisiblePages; + // no previous/next - if( G.O.paginationDots ) { - firstPage=0; - } - else { - if( pageNumber >= 5 ) { - firstPage=pageNumber-5; - if( n2 > pageNumber+6 ) { - n2=pageNumber+6; + if( !G.O.paginationDots ) { + if( pageNumber >= (vp/2) ) { + firstPage=pageNumber-(vp/2)+1; + if( n2 > pageNumber+(G.O.paginationVisiblePages/2)+1 ) { + n2=pageNumber+(G.O.paginationVisiblePages/2)+1; } } else { - if( n2 > 10 ) { - n2=10; + if( n2 > G.O.paginationVisiblePages ) { + n2=G.O.paginationVisiblePages; } } } @@ -5268,6 +5287,7 @@ nanoGALLERY v5.9.2beta release notes. onComplete(albumIdx, pageNumber); return; } + var item=G.I[idx]; if( item.albumID == G.I[albumIdx].GetID() ) { currentCounter++;