1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
var WebDeveloper = WebDeveloper || {};
WebDeveloper.Generated = WebDeveloper.Generated || {};
// Initializes the page with data
WebDeveloper.Generated.initialize = function(data, locale)
{
var anchorDescription = null;
var anchorInformation = locale.anchorInformation;
var anchors = null;
var anchorsLength = null;
var content = document.getElementById("content");
var contentDocument = null;
var documents = data.documents;
var list = null;
var listElement = null;
var url = null;
WebDeveloper.Generated.emptyContent();
WebDeveloper.Generated.localizeHeader(locale);
WebDeveloper.Generated.setPageTitle(anchorInformation, data, locale);
// Loop through the documents
for(var i = 0, l = documents.length; i < l; i++)
{
anchorDescription = locale.anchors.toLowerCase();
contentDocument = documents[i];
anchors = contentDocument.anchors;
anchorsLength = anchors.length;
url = contentDocument.url;
// If there is only one anchor
if(anchorsLength == 1)
{
anchorDescription = locale.anchor.toLowerCase();
}
WebDeveloper.Generated.addDocument(url, i, anchorDescription, anchorsLength);
// If there are anchors
if(anchorsLength > 0)
{
list = document.createElement("ol");
listElement = $(list);
// Loop through the anchors
for(var j = 0; j < anchorsLength; j++)
{
listElement.append(ich.anchor({ "anchor": anchors[j], "url": url }));
}
content.appendChild(list);
}
WebDeveloper.Generated.addSeparator();
}
WebDeveloper.Generated.initializeCommonElements();
};
|