Merge branch 'master' of ssh://aha/home/gitroot/album

This commit is contained in:
Erik Forkalsrud 2011-02-05 22:13:34 -08:00
commit 6b0082c685
3 changed files with 219 additions and 3 deletions

View file

@ -3,7 +3,7 @@
<groupId>org.forkalsrud</groupId> <groupId>org.forkalsrud</groupId>
<artifactId>album</artifactId> <artifactId>album</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>0.24-SNAPSHOT</version> <version>0.25-SNAPSHOT</version>
<name>Photo Album</name> <name>Photo Album</name>
<url>http://forkalsrud.org:8080/</url> <url>http://forkalsrud.org:8080/</url>
<developers> <developers>

View file

@ -80,8 +80,17 @@ $(document).ready(function() {
var captionElement = document.getElementById(title); var captionElement = document.getElementById(title);
return captionElement.innerHTML; return captionElement.innerHTML;
} }
var selectedImg = window.location.search;
$("a.ss").fancybox({ var selectedPos;
if (/^\?focus=/.test(selectedImg)) {
selectedImg = selectedImg.substring('?focus='.length);
$("a.ss").each(function(index) {
if (selectedImg == $(this).attr("title")) {
selectedPos = index;
}
});
}
var gallery = $("a.ss").fancybox({
'titlePosition' : 'inside', 'titlePosition' : 'inside',
'transitionIn' : 'elastic', 'transitionIn' : 'elastic',
'transitionOut' : 'elastic', 'transitionOut' : 'elastic',
@ -89,6 +98,9 @@ $(document).ready(function() {
'easingOut' : 'easeOutQuad', 'easingOut' : 'easeOutQuad',
'titleFormat' : formatTitle 'titleFormat' : formatTitle
}); });
if (selectedPos) {
$(gallery[selectedPos]).trigger('click');
}
}) })
</script> </script>
</head> </head>

View file

@ -0,0 +1,204 @@
/**
* Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com)
*
* Dual licensed under the MIT and GPL licenses.
* This basically means you can use this code however you want for
* free, but don't claim to have written it yourself!
* Donations always accepted: http://www.JavascriptToolbox.com/donate/
*
* Please do not link to the .js files on javascripttoolbox.com from
* your site. Copy the files locally to your server instead.
*
*/
var Dumper = (function(){
// "Private"
var maxIterations = 1000;
var maxDepth = -1; // Max depth that Dumper will traverse in object
var iterations = 0;
var indent = 1;
var indentText = " ";
var newline = "\n";
var object = null; // Keeps track of the root object passed in
var properties = null; // Holds properties of top-level object to traverse - others are ignored
function args(a,index) {
var myargs = new Array();
for (var i=index; i<a.length; i++) {
myargs[myargs.length] = a[i];
}
return myargs;
};
function pad(len) {
var ret = "";
for (var i=0; i<len; i++) {
ret += indentText;
}
return ret;
};
function string(o) {
var level = 1;
var indentLevel = indent;
var ret = "";
if (arguments.length>1 && typeof(arguments[1])=="number") {
level = arguments[1];
indentLevel = arguments[2];
if (o == object) {
return "[original object]";
}
}
else {
iterations = 0;
object = o;
// If a list of properties are passed in
if (arguments.length>1) {
var list = arguments;
var listIndex = 1;
if (typeof(arguments[1])=="object") {
list = arguments[1];
listIndex = 0;
}
for (var i=listIndex; i<list.length; i++) {
if (properties == null) { properties = new Object(); }
properties[list[i]]=1;
}
}
}
if (iterations++>maxIterations) { return "[Max Iterations Reached]"; } // Just in case, so the script doesn't hang
if (maxDepth != -1 && level > (maxDepth+1)) {
return "...";
}
// undefined
if (typeof(o)=="undefined") {
return "[undefined]";
}
// NULL
if (o==null) {
return "[null]";
}
// DOM Object
if (o==window) {
return "[window]";
}
if (o==window.document) {
return "[document]";
}
// FUNCTION
if (typeof(o)=="function") {
return "[function]";
}
// BOOLEAN
if (typeof(o)=="boolean") {
return (o)?"true":"false";
}
// STRING
if (typeof(o)=="string") {
return "'" + o + "'";
}
// NUMBER
if (typeof(o)=="number") {
return o;
}
if (typeof(o)=="object") {
if (typeof(o.length)=="number" ) {
// ARRAY
if (maxDepth != -1 && level > maxDepth) {
return "[ ... ]";
}
ret = "[";
for (var i=0; i<o.length;i++) {
if (i>0) {
ret += "," + newline + pad(indentLevel);
}
else {
ret += newline + pad(indentLevel);
}
ret += string(o[i],level+1,indentLevel-0+indent);
}
if (i > 0) {
ret += newline + pad(indentLevel-indent);
}
ret += "]";
return ret;
}
else {
// OBJECT
if (maxDepth != -1 && level > maxDepth) {
return "{ ... }";
}
ret = "{";
var count = 0;
for (i in o) {
if (o==object && properties!=null && properties[i]!=1) {
// do nothing with this node
}
else {
if (typeof(o[i]) != "unknown") {
var processAttribute = true;
// Check if this is a DOM object, and if so, if we have to limit properties to look at
if (o.ownerDocument|| o.tagName || (o.nodeType && o.nodeName)) {
processAttribute = false;
if (i=="tagName" || i=="nodeName" || i=="nodeType" || i=="id" || i=="className") {
processAttribute = true;
}
}
if (processAttribute) {
if (count++>0) {
ret += "," + newline + pad(indentLevel);
}
else {
ret += newline + pad(indentLevel);
}
ret += "'" + i + "' => " + string(o[i],level+1,indentLevel-0+i.length+6+indent);
}
}
}
}
if (count > 0) {
ret += newline + pad(indentLevel-indent);
}
ret += "}";
return ret;
}
}
};
string.popup = function(o) {
var w = window.open("about:blank");
w.document.open();
w.document.writeln("<HTML><BODY><PRE>");
w.document.writeln(string(o,args(arguments,1)));
w.document.writeln("</PRE></BODY></HTML>");
w.document.close();
};
string.alert = function(o) {
alert(string(o,args(arguments,1)));
};
string.write = function(o) {
var argumentsIndex = 1;
var d = document;
if (arguments.length>1 && arguments[1]==window.document) {
d = arguments[1];
argumentsIndex = 2;
}
var temp = indentText;
indentText = "&nbsp;";
d.write(string(o,args(arguments,argumentsIndex)));
indentText = temp;
};
string.setMaxIterations = function(i) {
maxIterations = i;
};
string.setMaxDepth = function(i) {
maxDepth = i;
};
string.$VERSION = 1.0;
return string;
})();