Cut back on string concatenation when building up the DOM
This commit is contained in:
parent
9dd452fe36
commit
e9bcb1b664
1 changed files with 18 additions and 6 deletions
|
|
@ -91,13 +91,25 @@ $(function() {
|
||||||
href = "/photo/album" + encUri(entry.path) + "?size=" + picSize;
|
href = "/photo/album" + encUri(entry.path) + "?size=" + picSize;
|
||||||
poster = "/photo/album" + encUri(entry.path);
|
poster = "/photo/album" + encUri(entry.path);
|
||||||
}
|
}
|
||||||
var gridDiv = $("<div class=\"grid\">\n"
|
var imgTag = $("<img/>");
|
||||||
+ " <span class=\"name\">" + entry.name + "</span><br/>\n"
|
imgTag.addClass(entry.type + "pic")
|
||||||
+ " <div class=\"imgborder\"><a class=\"ss\" id=\"ent" + idx + "\" href=\"" + href + "\" title=\"" + entry.name + "\">"
|
.attr("src", poster + "?size=" + thmb)
|
||||||
+ "<img class=\"" + entry.type + "pic\" src=\"" + poster + "?size=" + thmb + "\" border=\"0\" width=\"" + dim.w + "\" height=\"" + dim.h + "\"/></a></div>\n"
|
.attr("width", dim.w)
|
||||||
+ "</div>\n");
|
.attr("height", dim.h)
|
||||||
|
.attr("border", "0");
|
||||||
|
var anchor = $("<a/>");
|
||||||
|
anchor.addClass("ss")
|
||||||
|
.attr("id", "ent" + idx)
|
||||||
|
.attr("href", href)
|
||||||
|
.attr("title", entry.name)
|
||||||
|
anchor.append(imgTag);
|
||||||
|
|
||||||
var captionP = $("<p class=\"caption\"></p>\n");
|
|
||||||
|
var gridDiv = $("<div></div>").addClass("grid");
|
||||||
|
|
||||||
|
gridDiv.append($("<span></span>").addClass("name").text(entry.name), "<br>\n", $("<div class=\"imgborder\"></div>").append(anchor))
|
||||||
|
|
||||||
|
var captionP = $("<p></p>").addClass("caption");
|
||||||
captionP.attr("id", entry.name);
|
captionP.attr("id", entry.name);
|
||||||
if (entry.caption) {
|
if (entry.caption) {
|
||||||
captionP.text(entry.caption);
|
captionP.text(entry.caption);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue