reformat javascript with consistent indent

Change-Id: Idc70d6959b3708bc3b5893dffeaebd9950016ab6
This commit is contained in:
Brad Fitzpatrick 2012-12-01 10:55:22 -08:00
parent 2f072dfc20
commit 7ebc09ef25
1 changed files with 64 additions and 64 deletions

View File

@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -23,75 +23,75 @@ var selSetter = {}; // numeric index -> func(selected) setter
var currentlySelected = {}; // currently selected index -> true
function divFromResult(searchRes, i) {
var result = searchRes.recent[i];
var br = searchRes[result.blobref];
var divperm = document.createElement("div");
var setSelected = function(selected) {
divperm.isSelected = selected;
if (selected) {
lastSelIndex = i;
currentlySelected[i] = true;
divperm.attributes.class.value = "camli-ui-thumb selected";
} else {
delete currentlySelected[selected];
lastSelIndex = -1;
divperm.attributes.class.value = "camli-ui-thumb";
}
};
selSetter[i] = setSelected;
divperm.addEventListener("mousedown", function(e) {
if (e.shiftKey) {
e.preventDefault(); // prevent browser range selection
}
});
divperm.addEventListener("click", function(e) {
if (e.ctrlKey) {
setSelected(!divperm.isSelected);
return;
}
if (e.shiftKey) {
if (lastSelIndex < 0) {
return;
}
var from = lastSelIndex;
var to = i;
if (to < from) {
from = i;
to = lastSelIndex;
}
for (var j = from; j <= to; j++) {
selSetter[j](true);
}
return;
}
for (var j in currentlySelected) {
if (j != i) {
selSetter[j](false);
}
}
setSelected(!divperm.isSelected);
});
var alink = document.createElement("a");
alink.href = "./?p=" + br.blobRef;
var img = document.createElement("img");
img.src = br.thumbnailSrc;
img.height = br.thumbnailHeight;
img.width = br.thumbnailWidth;
alink.appendChild(img);
divperm.appendChild(alink);
var title = document.createElement("p");
setTextContent(title, camliBlobTitle(br.blobRef, searchRes));
title.className = 'camli-ui-thumbtitle';
divperm.appendChild(title);
divperm.className = 'camli-ui-thumb';
return divperm;
var result = searchRes.recent[i];
var br = searchRes[result.blobref];
var divperm = document.createElement("div");
var setSelected = function(selected) {
divperm.isSelected = selected;
if (selected) {
lastSelIndex = i;
currentlySelected[i] = true;
divperm.attributes.class.value = "camli-ui-thumb selected";
} else {
delete currentlySelected[selected];
lastSelIndex = -1;
divperm.attributes.class.value = "camli-ui-thumb";
}
};
selSetter[i] = setSelected;
divperm.addEventListener("mousedown", function(e) {
if (e.shiftKey) {
e.preventDefault(); // prevent browser range selection
}
});
divperm.addEventListener("click", function(e) {
if (e.ctrlKey) {
setSelected(!divperm.isSelected);
return;
}
if (e.shiftKey) {
if (lastSelIndex < 0) {
return;
}
var from = lastSelIndex;
var to = i;
if (to < from) {
from = i;
to = lastSelIndex;
}
for (var j = from; j <= to; j++) {
selSetter[j](true);
}
return;
}
for (var j in currentlySelected) {
if (j != i) {
selSetter[j](false);
}
}
setSelected(!divperm.isSelected);
});
var alink = document.createElement("a");
alink.href = "./?p=" + br.blobRef;
var img = document.createElement("img");
img.src = br.thumbnailSrc;
img.height = br.thumbnailHeight;
img.width = br.thumbnailWidth;
alink.appendChild(img);
divperm.appendChild(alink);
var title = document.createElement("p");
setTextContent(title, camliBlobTitle(br.blobRef, searchRes));
title.className = 'camli-ui-thumbtitle';
divperm.appendChild(title);
divperm.className = 'camli-ui-thumb';
return divperm;
}
function indexBuildRecentlyUpdatedPermanodes(searchRes) {
var divrecent = document.getElementById("recent");
divrecent.innerHTML = "";
for (var i = 0; i < searchRes.recent.length; i++) {
divrecent.appendChild(divFromResult(searchRes, i));
divrecent.appendChild(divFromResult(searchRes, i));
}
}