removed a little duplication
This commit is contained in:
parent
1e04937fab
commit
12b91ab1ec
1 changed files with 28 additions and 16 deletions
|
|
@ -97,15 +97,19 @@ $(function() {
|
||||||
$.getJSON('album/photos.json', function(data, textStatus) {
|
$.getJSON('album/photos.json', function(data, textStatus) {
|
||||||
|
|
||||||
$("#name").html(data.name);
|
$("#name").html(data.name);
|
||||||
|
|
||||||
|
var thmb = 250;
|
||||||
|
var picSize = 800;
|
||||||
|
var movieSize = 640;
|
||||||
|
|
||||||
$.each(data.contents, function(idx, entry) {
|
$.each(data.contents, function(idx, entry) {
|
||||||
|
|
||||||
var dim = scale(entry.width, entry.height, 250);
|
var dim = scale(entry.width, entry.height, thmb);
|
||||||
|
|
||||||
var gridDiv = $("<div class=\"grid\">\n"
|
var gridDiv = $("<div class=\"grid\">\n"
|
||||||
+ " <span class=\"name\">" + entry.name + "</span><br/>\n"
|
+ " <span class=\"name\">" + entry.name + "</span><br/>\n"
|
||||||
+ " <div class=\"imgborder\"><a class=\"ss\" id=\"ent" + idx + "\" href=\"album" + entry.path + "?size=800\" title=\"" + entry.name + "\">"
|
+ " <div class=\"imgborder\"><a class=\"ss\" id=\"ent" + idx + "\" href=\"album" + entry.path + "?size=" + picSize + "\" title=\"" + entry.name + "\">"
|
||||||
+ "<img class=\"picture\" src=\"album" + (entry.type == "movie" ? entry.path + ".frame" : entry.path) + "?size=250\" border=\"0\" width=\"" + dim.w + "\" height=\"" + dim.h + "\"/></a></div>\n"
|
+ "<img class=\"picture\" src=\"album" + (entry.type == "movie" ? entry.path + ".frame" : entry.path) + "?size=" + thmb + "\" border=\"0\" width=\"" + dim.w + "\" height=\"" + dim.h + "\"/></a></div>\n"
|
||||||
+ "<p id=\"" + entry.name + "\" class=\"caption\"></p>\n"
|
+ "<p id=\"" + entry.name + "\" class=\"caption\"></p>\n"
|
||||||
+ "</div>\n");
|
+ "</div>\n");
|
||||||
gridDiv.appendTo('body');
|
gridDiv.appendTo('body');
|
||||||
|
|
@ -116,7 +120,9 @@ $(function() {
|
||||||
|
|
||||||
switch (entry.type) {
|
switch (entry.type) {
|
||||||
case "movie":
|
case "movie":
|
||||||
$("#ent" + idx).attr("rel", "album").attr("href", "/album" + entry.path + ".movie?size=640").fancybox({
|
var size = scale(entry.width, entry.height, movieSize);
|
||||||
|
var href = "album" + escape(entry.path) + ".movie?size=" + movieSize;
|
||||||
|
$("#ent" + idx).attr("rel", "album").attr("href", href).fancybox({
|
||||||
'titlePosition' : 'inside',
|
'titlePosition' : 'inside',
|
||||||
'transitionIn' : 'elastic',
|
'transitionIn' : 'elastic',
|
||||||
'transitionOut' : 'elastic',
|
'transitionOut' : 'elastic',
|
||||||
|
|
@ -125,28 +131,34 @@ $(function() {
|
||||||
'titleFormat' : formatTitle,
|
'titleFormat' : formatTitle,
|
||||||
'padding' : 0,
|
'padding' : 0,
|
||||||
'href' : "assets/flowplayer/flowplayer-3.0.3.swf",
|
'href' : "assets/flowplayer/flowplayer-3.0.3.swf",
|
||||||
'width' : entry.width,
|
'width' : size.w,
|
||||||
'height' : entry.height,
|
'height' : size.h,
|
||||||
'type' : 'swf',
|
'type' : 'swf',
|
||||||
'swf' : {
|
'swf' : {
|
||||||
'allowfullscreen' : 'true',
|
'allowfullscreen' : 'true',
|
||||||
'wmode' : 'transparent',
|
'wmode' : 'transparent',
|
||||||
'flashvars':
|
'flashvars':
|
||||||
"config={ 'clip': { 'url': '/album" + escape(entry.path) + ".movie?size=640' },\
|
"config={\
|
||||||
'controls': {\
|
'clip': {\
|
||||||
'url': 'assets/flowplayer/flowplayer.controls-3.0.3.swf',\
|
'url': '" + href + "'\
|
||||||
'backgroundColor': 'transparent', 'progressColor': 'transparent', 'bufferColor': 'transparent',\
|
},\
|
||||||
'play':true,\
|
'plugins': {\
|
||||||
'fullscreen':true,\
|
'controls': {\
|
||||||
'autoHide': 'always'\
|
'url': 'assets/flowplayer/flowplayer.controls-3.0.3.swf',\
|
||||||
}\
|
'backgroundColor': 'transparent',\
|
||||||
|
'progressColor': 'transparent',\
|
||||||
|
'bufferColor': 'transparent',\
|
||||||
|
'play':true,\
|
||||||
|
'fullscreen':true,\
|
||||||
|
'autoHide': 'always'\
|
||||||
|
}\
|
||||||
}\
|
}\
|
||||||
}"
|
}"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "image":
|
case "image":
|
||||||
var largeDim = scale(entry.width, entry.height, 800);
|
var largeDim = scale(entry.width, entry.height, picSize);
|
||||||
$("#ent" + idx).attr("rel", "album").fancybox({
|
$("#ent" + idx).attr("rel", "album").fancybox({
|
||||||
'titlePosition' : 'inside',
|
'titlePosition' : 'inside',
|
||||||
'transitionIn' : 'elastic',
|
'transitionIn' : 'elastic',
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue