Skip to content

Commit

Permalink
v5.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris-B committed Mar 23, 2015
1 parent d600c7d commit 1327b45
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 182 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
node_modules
TODO.txt
css/nanogallery_pinch.css
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nanogallery",
"version": "5.5.3",
"version": "5.5.4",
"homepage": "http://nanogallery.brisbois.fr",
"authors": [
"Christophe Brisbois"
Expand Down
12 changes: 11 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
nanoGALLERY - jQuery plugin
===========

ChangeLog
ChangeLog
------

v5.5.4
------

##### New API method
- **displayItem**: display an item (album or image).
`$('#yourElement').nanoGallery('displayItem', 'itemID');`
itemID syntax to display an album: 'albumID'
itemID syntax to display an image: 'albumID/imageID'


v5.5.3
------

Expand Down
57 changes: 29 additions & 28 deletions demonstration.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,35 +263,36 @@
// ##################################################################################################################
// ##### Sample3 - Picasa/Google+ #####
// ##################################################################################################################
jQuery("#nanoGallery3").nanoGallery({
thumbnailL1Width:'140C XS100 SM100', thumbnailL1Height:'140C XS100 SM100',
thumbnailWidth:'auto', thumbnailHeight:'200 XS80 SM150 LA250 XL290',

userID: '111186676244625461692',
//userID:'103482106723589181634', // --> Cyrilic
kind: 'picasa',
//maxItemsPerLine:3,
//album: '5851968929721015169?authkey=CJSlhdKSgoiXtgE',
//album: '5851968929721015169&authkey=Gv1sRgCJSlhdKSgoiXtgE',
//album:'5856259539659194001',
//openOnStart : '5856259539659194001',
//openOnStart : '5856259539659194001/5856259543749603346',
viewerFullscreen: true,
photoSorting: 'random',
locationHash: false,
blackList:'none',
albumSorting: 'random',
colorScheme: myColorScheme,
galleryFullpageButton: true,
thumbnailLabel:{ display:false},
thumbnailL1Label:{title:'%filenameNoExt', itemsCount:'title', display:true},
viewerDisplayLogo: true,
photoSorting: 'titleDesc',
thumbnailHoverEffect:[{'name':'imageScale150', 'duration':500}],
thumbnailL1HoverEffect:[{'name':'labelOpacity50','duration':300, 'delay':500},{'name':'imageScaleIn80', 'duration':500}]
//thumbnailHoverEffect: [{'name':'imageScaleIn80','duration':300},{'name':'borderLighter'}]
});
jQuery('#btnPicasaOpen').on('click', function() {
jQuery("#nanoGallery3").nanoGallery({
thumbnailL1Width:'140C XS100 SM100', thumbnailL1Height:'140C XS100 SM100',
thumbnailWidth:'auto', thumbnailHeight:'200 XS80 SM150 LA250 XL290',

userID: '111186676244625461692',
//userID:'103482106723589181634', // --> Cyrilic
kind: 'picasa',
//maxItemsPerLine:3,
//album: '5851968929721015169?authkey=CJSlhdKSgoiXtgE',
//album: '5851968929721015169&authkey=Gv1sRgCJSlhdKSgoiXtgE',
//album:'5856259539659194001',
//openOnStart : '5856259539659194001',
openOnStart : '5856259539659194001/5856259543749603346',
viewerFullscreen: true,
photoSorting: 'random',
locationHash: false,
blackList:'none',
albumSorting: 'random',
colorScheme: myColorScheme,
galleryFullpageButton: true,
thumbnailLabel:{ display:false},
thumbnailL1Label:{title:'%filenameNoExt', itemsCount:'title', display:true},
viewerDisplayLogo: true,
photoSorting: 'titleDesc',
thumbnailHoverEffect:[{'name':'imageScale150', 'duration':500}],
thumbnailL1HoverEffect:[{'name':'labelOpacity50','duration':300, 'delay':500},{'name':'imageScaleIn80', 'duration':500}]
//thumbnailHoverEffect: [{'name':'imageScaleIn80','duration':300},{'name':'borderLighter'}]
});
jQuery("#nanoGallery3").nanoGallery('displayItem','5856259539659194001/5856259543749603346');
});


Expand Down
12 changes: 6 additions & 6 deletions dist/jquery.nanogallery.min.js

Large diffs are not rendered by default.

195 changes: 86 additions & 109 deletions jquery.nanogallery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* @preserve nanoGALLERY v5.5.3
* @preserve nanoGALLERY v5.5.4
* Plugin for jQuery by Christophe Brisbois
* Demo: http://nanogallery.brisbois.fr
* Sources: https://github.com/Kris-B/nanoGALLERY
Expand All @@ -22,10 +22,13 @@

/*
nanoGALLERY v5.5.3 release notes.
nanoGALLERY v5.5.4 release notes.
##### Misc
- bugfix - Flickr image size L (1024 pixels) ignored
##### New API method
- **displayItem**: display an item (album or image).
`$('#yourElement').nanoGallery('displayItem', 'itemID');`
itemID syntax to display an album: 'albumID'
itemID syntax to display an image: 'albumID/imageID'
**Visit nanoGALLERY homepage for usage details: [http://nanogallery.brisbois.fr](http://www.nanogallery.brisbois.fr/)**
Expand Down Expand Up @@ -53,9 +56,7 @@ nanoGALLERY v5.5.3 release notes.
_this.init = function(){
_this.options = $.extend(true, {},$.nanoGallery.defaultOptions, options);
// Initialization code
//_this.$e.data('nanoGallery', new nanoGALLERY());
_this.nG= new nanoGALLERY();
// _this.$e.data('nanoGallery').n().Initiate(_this.e, _this.options );
_this.nG.Initiate(_this.e, _this.options );
};

Expand Down Expand Up @@ -158,12 +159,12 @@ nanoGALLERY v5.5.3 release notes.

switch(args){
case 'reload':
//ReloadAlbum();
$(this).data('nanoGallery').nG.ReloadAlbum();
// $(this).data('nanoGallery').ReloadJson();
return $(this);
break;
case 'getSelectedItems':
return $(this).data('nanoGallery').nG.GetSelectedItems();
break;
case 'selectItems':
$(this).data('nanoGallery').nG.SetSelectedItems(option);
break;
Expand All @@ -177,12 +178,16 @@ nanoGALLERY v5.5.3 release notes.
break;
case 'getSelectMode':
return $(this).data('nanoGallery').nG.GetSelectMode();
break;
case 'getItem':
return $(this).data('nanoGallery').nG.GetItem(option);
break;
case 'getItems':
return $(this).data('nanoGallery').nG.GetItems();
break;
case 'getItemsIndex':
return $(this).data('nanoGallery').nG.GetItemsIndex(option);
break;
case 'option':
if(typeof value === 'undefined'){
return $(this).data('nanoGallery').nG.Get(option);
Expand All @@ -194,6 +199,9 @@ nanoGALLERY v5.5.3 release notes.
$(this).data('nanoGallery').nG.$E.base.text('');
$(this).removeData();
break;
case 'displayItem':
$(this).data('nanoGallery').nG.displayItem(option);
break;
}
return $(this);

Expand Down Expand Up @@ -256,6 +264,14 @@ nanoGALLERY v5.5.3 release notes.
}

};

// Display one item
// itemID syntax:
// - albumID --> display one album
// - albumID/imageID --> display one image
this.displayItem = function( itemID ){
return OpenItem( false, itemID, true );
};

/**
* Get an item by its index
Expand Down Expand Up @@ -442,14 +458,8 @@ nanoGALLERY v5.5.3 release notes.
}
return G.tnHE;
},
styleFTitle: '',
styleITitle: '',
styleDesc: '',
styleLabelImage: '',
styleL1FTitle: '',
styleL1ITitle: '',
styleL1Desc: '',
styleL1LabelImage: ''
styleFTitle: '', styleITitle: '', styleDesc: '', styleLabelImage: '',
styleL1FTitle: '', styleL1ITitle: '', styleL1Desc: '', styleL1LabelImage: ''
};
G.tnHE = []; // Thumbnail hover effects
G.tnL1HE = []; // Thumbnail hover effects - Level 1
Expand Down Expand Up @@ -2178,62 +2188,12 @@ nanoGALLERY v5.5.3 release notes.

// special use case -> openOnStart can be processed like location hash, only once (on start)
if( G.O.openOnStart != '' ) {
var albumID=null,
imageID=null,
p=G.O.openOnStart.indexOf('/'),
albumIdx=-1,
imageIdx=-1,
l=G.I.length;

if( p > 0 ) {
albumID=G.O.openOnStart.substring(0,p);
imageID=G.O.openOnStart.substring(p+1);
for(var i=0; i<l; i++ ) {
if( G.I[i].kind == 'image' && G.I[i].GetID() == imageID ) {
imageIdx=i;
break;
}
}
}
else {
albumID=G.O.openOnStart;
}
for(var i=0; i<l; i++ ) {
if( G.I[i].kind == 'album' && G.I[i].GetID() == albumID ) {
albumIdx=i;
break;
}
}

var ID=G.O.openOnStart;
G.O.openOnStart='';

if( imageID !== null ) {
// process IMAGE
G.albumIdxToOpenOnViewerClose=albumIdx;
if( G.O.kind == '' ) {
DisplayImage(imageIdx);
}
else {
if( imageIdx == -1 ) {
OpenAlbum(albumIdx,false,imageID,false);
}
else {
DisplayImage(imageIdx);
}
}
return true;

}
else {
// process ALBUM
OpenAlbum(albumIdx,false,-1,false);
return true;
}
return OpenItem( false, ID, true );
}


// standard use case -> location hash processing

if( !G.O.locationHash ) { return false; }

var albumID=null,
Expand All @@ -2253,60 +2213,77 @@ nanoGALLERY v5.5.3 release notes.
}

if( hash.indexOf(curGal) == 0 ) {
var s=hash.substring(curGal.length),
p=s.indexOf('/'),
albumIdx=-1,
imageIdx=-1,
l=G.I.length;

if( p > 0 ) {
albumID=s.substring(0,p);
imageID=s.substring(p+1);
for(var i=0; i<l; i++ ) {
if( G.I[i].kind == 'image' && G.I[i].GetID() == imageID ) {
imageIdx=i;
break;
}
}
}
else {
albumID=s;
}
var ID=hash.substring(curGal.length);
return OpenItem( isTriggeredByEvent, ID, !isTriggeredByEvent );
}

//return {albumID:albID, imageID:imgID};
}

function OpenItem( isTriggeredByEvent, ID, openAlbumOnViewerClose ) {
var albumID=null,
imageID=null,
p=ID.indexOf('/'),
albumIdx=-1,
imageIdx=-1,
l=G.I.length;

if( p > 0 ) {
albumID=ID.substring(0,p);
imageID=ID.substring(p+1);
for(var i=0; i<l; i++ ) {
if( G.I[i].kind == 'album' && G.I[i].GetID() == albumID ) {
albumIdx=i;
if( G.I[i].kind == 'image' && G.I[i].GetID() == imageID ) {
imageIdx=i;
break;
}
}
}
else {
albumID=ID;
}
for(var i=0; i<l; i++ ) {
if( G.I[i].kind == 'album' && G.I[i].GetID() == albumID ) {
albumIdx=i;
break;
}
}

if( imageID !== null ) {
// process IMAGE
if( !isTriggeredByEvent ) {
if( imageID !== null ) {
// process IMAGE
// if( !isTriggeredByEvent ) {
if( openAlbumOnViewerClose ) {
G.albumIdxToOpenOnViewerClose=albumIdx;
}
if( G.O.kind == '' ) {
DisplayImage(imageIdx);
}
if( G.O.kind == '' ) {
DisplayImage(imageIdx);
}
else {
if( imageIdx == -1 ) {
// first load the album
if( G.O.viewerFullscreen ) {
// activate fullscreen before ajax call, because it can be done only on user interaction
ngscreenfull.request();
}
OpenAlbum(albumIdx,false,imageID,isTriggeredByEvent);
}
else {
if( imageIdx == -1 ) {
OpenAlbum(albumIdx,false,imageID,isTriggeredByEvent);
}
else {
DisplayImage(imageIdx);
}
// album is already loaded
DisplayImage(imageIdx);
}
return true;

}
else {
// process ALBUM
OpenAlbum(albumIdx,false,-1,isTriggeredByEvent);
return true;
}
return true;

}
else {
// process ALBUM
OpenAlbum(albumIdx,false,-1,isTriggeredByEvent);
return true;
}

//return {albumID:albID, imageID:imgID};
}





// build a dummy thumbnail to get different sizes and to cache them
Expand Down
Loading

0 comments on commit 1327b45

Please sign in to comment.