Skip to content

Commit 1327b45

Browse files
committed
v5.5.4
1 parent d600c7d commit 1327b45

9 files changed

+166
-182
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
node_modules
1+
node_modules
2+
TODO.txt
3+
css/nanogallery_pinch.css

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nanogallery",
3-
"version": "5.5.3",
3+
"version": "5.5.4",
44
"homepage": "http://nanogallery.brisbois.fr",
55
"authors": [
66
"Christophe Brisbois"

changelog.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
nanoGALLERY - jQuery plugin
22
===========
33

4-
ChangeLog
4+
ChangeLog
55
------
66

7+
v5.5.4
8+
------
9+
10+
##### New API method
11+
- **displayItem**: display an item (album or image).
12+
`$('#yourElement').nanoGallery('displayItem', 'itemID');`
13+
itemID syntax to display an album: 'albumID'
14+
itemID syntax to display an image: 'albumID/imageID'
15+
16+
717
v5.5.3
818
------
919

demonstration.html

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -263,35 +263,36 @@
263263
// ##################################################################################################################
264264
// ##### Sample3 - Picasa/Google+ #####
265265
// ##################################################################################################################
266+
jQuery("#nanoGallery3").nanoGallery({
267+
thumbnailL1Width:'140C XS100 SM100', thumbnailL1Height:'140C XS100 SM100',
268+
thumbnailWidth:'auto', thumbnailHeight:'200 XS80 SM150 LA250 XL290',
269+
270+
userID: '111186676244625461692',
271+
//userID:'103482106723589181634', // --> Cyrilic
272+
kind: 'picasa',
273+
//maxItemsPerLine:3,
274+
//album: '5851968929721015169?authkey=CJSlhdKSgoiXtgE',
275+
//album: '5851968929721015169&authkey=Gv1sRgCJSlhdKSgoiXtgE',
276+
//album:'5856259539659194001',
277+
//openOnStart : '5856259539659194001',
278+
//openOnStart : '5856259539659194001/5856259543749603346',
279+
viewerFullscreen: true,
280+
photoSorting: 'random',
281+
locationHash: false,
282+
blackList:'none',
283+
albumSorting: 'random',
284+
colorScheme: myColorScheme,
285+
galleryFullpageButton: true,
286+
thumbnailLabel:{ display:false},
287+
thumbnailL1Label:{title:'%filenameNoExt', itemsCount:'title', display:true},
288+
viewerDisplayLogo: true,
289+
photoSorting: 'titleDesc',
290+
thumbnailHoverEffect:[{'name':'imageScale150', 'duration':500}],
291+
thumbnailL1HoverEffect:[{'name':'labelOpacity50','duration':300, 'delay':500},{'name':'imageScaleIn80', 'duration':500}]
292+
//thumbnailHoverEffect: [{'name':'imageScaleIn80','duration':300},{'name':'borderLighter'}]
293+
});
266294
jQuery('#btnPicasaOpen').on('click', function() {
267-
jQuery("#nanoGallery3").nanoGallery({
268-
thumbnailL1Width:'140C XS100 SM100', thumbnailL1Height:'140C XS100 SM100',
269-
thumbnailWidth:'auto', thumbnailHeight:'200 XS80 SM150 LA250 XL290',
270-
271-
userID: '111186676244625461692',
272-
//userID:'103482106723589181634', // --> Cyrilic
273-
kind: 'picasa',
274-
//maxItemsPerLine:3,
275-
//album: '5851968929721015169?authkey=CJSlhdKSgoiXtgE',
276-
//album: '5851968929721015169&authkey=Gv1sRgCJSlhdKSgoiXtgE',
277-
//album:'5856259539659194001',
278-
//openOnStart : '5856259539659194001',
279-
openOnStart : '5856259539659194001/5856259543749603346',
280-
viewerFullscreen: true,
281-
photoSorting: 'random',
282-
locationHash: false,
283-
blackList:'none',
284-
albumSorting: 'random',
285-
colorScheme: myColorScheme,
286-
galleryFullpageButton: true,
287-
thumbnailLabel:{ display:false},
288-
thumbnailL1Label:{title:'%filenameNoExt', itemsCount:'title', display:true},
289-
viewerDisplayLogo: true,
290-
photoSorting: 'titleDesc',
291-
thumbnailHoverEffect:[{'name':'imageScale150', 'duration':500}],
292-
thumbnailL1HoverEffect:[{'name':'labelOpacity50','duration':300, 'delay':500},{'name':'imageScaleIn80', 'duration':500}]
293-
//thumbnailHoverEffect: [{'name':'imageScaleIn80','duration':300},{'name':'borderLighter'}]
294-
});
295+
jQuery("#nanoGallery3").nanoGallery('displayItem','5856259539659194001/5856259543749603346');
295296
});
296297

297298

dist/jquery.nanogallery.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jquery.nanogallery.js

Lines changed: 86 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* @preserve nanoGALLERY v5.5.3
2+
* @preserve nanoGALLERY v5.5.4
33
* Plugin for jQuery by Christophe Brisbois
44
* Demo: http://nanogallery.brisbois.fr
55
* Sources: https://github.com/Kris-B/nanoGALLERY
@@ -22,10 +22,13 @@
2222

2323
/*
2424
25-
nanoGALLERY v5.5.3 release notes.
25+
nanoGALLERY v5.5.4 release notes.
2626
27-
##### Misc
28-
- bugfix - Flickr image size L (1024 pixels) ignored
27+
##### New API method
28+
- **displayItem**: display an item (album or image).
29+
`$('#yourElement').nanoGallery('displayItem', 'itemID');`
30+
itemID syntax to display an album: 'albumID'
31+
itemID syntax to display an image: 'albumID/imageID'
2932
3033
**Visit nanoGALLERY homepage for usage details: [http://nanogallery.brisbois.fr](http://www.nanogallery.brisbois.fr/)**
3134
@@ -53,9 +56,7 @@ nanoGALLERY v5.5.3 release notes.
5356
_this.init = function(){
5457
_this.options = $.extend(true, {},$.nanoGallery.defaultOptions, options);
5558
// Initialization code
56-
//_this.$e.data('nanoGallery', new nanoGALLERY());
5759
_this.nG= new nanoGALLERY();
58-
// _this.$e.data('nanoGallery').n().Initiate(_this.e, _this.options );
5960
_this.nG.Initiate(_this.e, _this.options );
6061
};
6162

@@ -158,12 +159,12 @@ nanoGALLERY v5.5.3 release notes.
158159

159160
switch(args){
160161
case 'reload':
161-
//ReloadAlbum();
162162
$(this).data('nanoGallery').nG.ReloadAlbum();
163-
// $(this).data('nanoGallery').ReloadJson();
164163
return $(this);
164+
break;
165165
case 'getSelectedItems':
166166
return $(this).data('nanoGallery').nG.GetSelectedItems();
167+
break;
167168
case 'selectItems':
168169
$(this).data('nanoGallery').nG.SetSelectedItems(option);
169170
break;
@@ -177,12 +178,16 @@ nanoGALLERY v5.5.3 release notes.
177178
break;
178179
case 'getSelectMode':
179180
return $(this).data('nanoGallery').nG.GetSelectMode();
181+
break;
180182
case 'getItem':
181183
return $(this).data('nanoGallery').nG.GetItem(option);
184+
break;
182185
case 'getItems':
183186
return $(this).data('nanoGallery').nG.GetItems();
187+
break;
184188
case 'getItemsIndex':
185189
return $(this).data('nanoGallery').nG.GetItemsIndex(option);
190+
break;
186191
case 'option':
187192
if(typeof value === 'undefined'){
188193
return $(this).data('nanoGallery').nG.Get(option);
@@ -194,6 +199,9 @@ nanoGALLERY v5.5.3 release notes.
194199
$(this).data('nanoGallery').nG.$E.base.text('');
195200
$(this).removeData();
196201
break;
202+
case 'displayItem':
203+
$(this).data('nanoGallery').nG.displayItem(option);
204+
break;
197205
}
198206
return $(this);
199207

@@ -256,6 +264,14 @@ nanoGALLERY v5.5.3 release notes.
256264
}
257265

258266
};
267+
268+
// Display one item
269+
// itemID syntax:
270+
// - albumID --> display one album
271+
// - albumID/imageID --> display one image
272+
this.displayItem = function( itemID ){
273+
return OpenItem( false, itemID, true );
274+
};
259275

260276
/**
261277
* Get an item by its index
@@ -442,14 +458,8 @@ nanoGALLERY v5.5.3 release notes.
442458
}
443459
return G.tnHE;
444460
},
445-
styleFTitle: '',
446-
styleITitle: '',
447-
styleDesc: '',
448-
styleLabelImage: '',
449-
styleL1FTitle: '',
450-
styleL1ITitle: '',
451-
styleL1Desc: '',
452-
styleL1LabelImage: ''
461+
styleFTitle: '', styleITitle: '', styleDesc: '', styleLabelImage: '',
462+
styleL1FTitle: '', styleL1ITitle: '', styleL1Desc: '', styleL1LabelImage: ''
453463
};
454464
G.tnHE = []; // Thumbnail hover effects
455465
G.tnL1HE = []; // Thumbnail hover effects - Level 1
@@ -2178,62 +2188,12 @@ nanoGALLERY v5.5.3 release notes.
21782188

21792189
// special use case -> openOnStart can be processed like location hash, only once (on start)
21802190
if( G.O.openOnStart != '' ) {
2181-
var albumID=null,
2182-
imageID=null,
2183-
p=G.O.openOnStart.indexOf('/'),
2184-
albumIdx=-1,
2185-
imageIdx=-1,
2186-
l=G.I.length;
2187-
2188-
if( p > 0 ) {
2189-
albumID=G.O.openOnStart.substring(0,p);
2190-
imageID=G.O.openOnStart.substring(p+1);
2191-
for(var i=0; i<l; i++ ) {
2192-
if( G.I[i].kind == 'image' && G.I[i].GetID() == imageID ) {
2193-
imageIdx=i;
2194-
break;
2195-
}
2196-
}
2197-
}
2198-
else {
2199-
albumID=G.O.openOnStart;
2200-
}
2201-
for(var i=0; i<l; i++ ) {
2202-
if( G.I[i].kind == 'album' && G.I[i].GetID() == albumID ) {
2203-
albumIdx=i;
2204-
break;
2205-
}
2206-
}
2207-
2191+
var ID=G.O.openOnStart;
22082192
G.O.openOnStart='';
2209-
2210-
if( imageID !== null ) {
2211-
// process IMAGE
2212-
G.albumIdxToOpenOnViewerClose=albumIdx;
2213-
if( G.O.kind == '' ) {
2214-
DisplayImage(imageIdx);
2215-
}
2216-
else {
2217-
if( imageIdx == -1 ) {
2218-
OpenAlbum(albumIdx,false,imageID,false);
2219-
}
2220-
else {
2221-
DisplayImage(imageIdx);
2222-
}
2223-
}
2224-
return true;
2225-
2226-
}
2227-
else {
2228-
// process ALBUM
2229-
OpenAlbum(albumIdx,false,-1,false);
2230-
return true;
2231-
}
2193+
return OpenItem( false, ID, true );
22322194
}
22332195

2234-
22352196
// standard use case -> location hash processing
2236-
22372197
if( !G.O.locationHash ) { return false; }
22382198

22392199
var albumID=null,
@@ -2253,60 +2213,77 @@ nanoGALLERY v5.5.3 release notes.
22532213
}
22542214

22552215
if( hash.indexOf(curGal) == 0 ) {
2256-
var s=hash.substring(curGal.length),
2257-
p=s.indexOf('/'),
2258-
albumIdx=-1,
2259-
imageIdx=-1,
2260-
l=G.I.length;
2261-
2262-
if( p > 0 ) {
2263-
albumID=s.substring(0,p);
2264-
imageID=s.substring(p+1);
2265-
for(var i=0; i<l; i++ ) {
2266-
if( G.I[i].kind == 'image' && G.I[i].GetID() == imageID ) {
2267-
imageIdx=i;
2268-
break;
2269-
}
2270-
}
2271-
}
2272-
else {
2273-
albumID=s;
2274-
}
2216+
var ID=hash.substring(curGal.length);
2217+
return OpenItem( isTriggeredByEvent, ID, !isTriggeredByEvent );
2218+
}
2219+
2220+
//return {albumID:albID, imageID:imgID};
2221+
}
2222+
2223+
function OpenItem( isTriggeredByEvent, ID, openAlbumOnViewerClose ) {
2224+
var albumID=null,
2225+
imageID=null,
2226+
p=ID.indexOf('/'),
2227+
albumIdx=-1,
2228+
imageIdx=-1,
2229+
l=G.I.length;
2230+
2231+
if( p > 0 ) {
2232+
albumID=ID.substring(0,p);
2233+
imageID=ID.substring(p+1);
22752234
for(var i=0; i<l; i++ ) {
2276-
if( G.I[i].kind == 'album' && G.I[i].GetID() == albumID ) {
2277-
albumIdx=i;
2235+
if( G.I[i].kind == 'image' && G.I[i].GetID() == imageID ) {
2236+
imageIdx=i;
22782237
break;
22792238
}
22802239
}
2240+
}
2241+
else {
2242+
albumID=ID;
2243+
}
2244+
for(var i=0; i<l; i++ ) {
2245+
if( G.I[i].kind == 'album' && G.I[i].GetID() == albumID ) {
2246+
albumIdx=i;
2247+
break;
2248+
}
2249+
}
22812250

2282-
if( imageID !== null ) {
2283-
// process IMAGE
2284-
if( !isTriggeredByEvent ) {
2251+
if( imageID !== null ) {
2252+
// process IMAGE
2253+
// if( !isTriggeredByEvent ) {
2254+
if( openAlbumOnViewerClose ) {
22852255
G.albumIdxToOpenOnViewerClose=albumIdx;
2286-
}
2287-
if( G.O.kind == '' ) {
2288-
DisplayImage(imageIdx);
2256+
}
2257+
if( G.O.kind == '' ) {
2258+
DisplayImage(imageIdx);
2259+
}
2260+
else {
2261+
if( imageIdx == -1 ) {
2262+
// first load the album
2263+
if( G.O.viewerFullscreen ) {
2264+
// activate fullscreen before ajax call, because it can be done only on user interaction
2265+
ngscreenfull.request();
2266+
}
2267+
OpenAlbum(albumIdx,false,imageID,isTriggeredByEvent);
22892268
}
22902269
else {
2291-
if( imageIdx == -1 ) {
2292-
OpenAlbum(albumIdx,false,imageID,isTriggeredByEvent);
2293-
}
2294-
else {
2295-
DisplayImage(imageIdx);
2296-
}
2270+
// album is already loaded
2271+
DisplayImage(imageIdx);
22972272
}
2298-
return true;
2299-
2300-
}
2301-
else {
2302-
// process ALBUM
2303-
OpenAlbum(albumIdx,false,-1,isTriggeredByEvent);
2304-
return true;
23052273
}
2274+
return true;
2275+
2276+
}
2277+
else {
2278+
// process ALBUM
2279+
OpenAlbum(albumIdx,false,-1,isTriggeredByEvent);
2280+
return true;
23062281
}
23072282

2308-
//return {albumID:albID, imageID:imgID};
23092283
}
2284+
2285+
2286+
23102287

23112288

23122289
// build a dummy thumbnail to get different sizes and to cache them

0 commit comments

Comments
 (0)