|
@@ -149,26 +149,22 @@ function createResult(codelet) { |
|
|
row = document.createElement("tr"); |
|
|
row = document.createElement("tr"); |
|
|
//Level 2 |
|
|
//Level 2 |
|
|
var displayInfo = document.createElement("div"), |
|
|
var displayInfo = document.createElement("div"), |
|
|
sidebar = document.createElement("td"), |
|
|
|
|
|
codeElt = document.createElement("td"), |
|
|
codeElt = document.createElement("td"), |
|
|
displayButton = document.createElement("td"), |
|
|
|
|
|
hiddenInfoContainer = document.createElement("td"), |
|
|
hiddenInfoContainer = document.createElement("td"), |
|
|
hiddenInfo = document.createElement("div"); |
|
|
hiddenInfo = document.createElement("div"); |
|
|
//Level 3 |
|
|
//Level 3 |
|
|
var title = document.createElement("span"), |
|
|
var title = document.createElement("span"), |
|
|
site = document.createElement("span"), |
|
|
site = document.createElement("span"), |
|
|
dateModified = document.createElement("span"), |
|
|
|
|
|
|
|
|
dateModified = document.createElement("div"), |
|
|
language = document.createElement("span"), |
|
|
language = document.createElement("span"), |
|
|
dateCreated = document.createElement("span"), |
|
|
|
|
|
|
|
|
dateCreated = document.createElement("div"), |
|
|
authors = document.createElement("div"); |
|
|
authors = document.createElement("div"); |
|
|
|
|
|
|
|
|
//Classes and ID's |
|
|
//Classes and ID's |
|
|
newDiv.classList.add('result'); |
|
|
newDiv.classList.add('result'); |
|
|
|
|
|
|
|
|
displayInfo.id = 'display-info'; |
|
|
displayInfo.id = 'display-info'; |
|
|
sidebar.id = 'sidebar'; |
|
|
|
|
|
codeElt.id = 'code'; |
|
|
codeElt.id = 'code'; |
|
|
displayButton.id = 'display-button'; |
|
|
|
|
|
hiddenInfo.id = 'hidden-info'; |
|
|
hiddenInfo.id = 'hidden-info'; |
|
|
|
|
|
|
|
|
title.id = 'title'; |
|
|
title.id = 'title'; |
|
@@ -183,20 +179,24 @@ function createResult(codelet) { |
|
|
+ codelet.filename + '</a>'; |
|
|
+ codelet.filename + '</a>'; |
|
|
site.innerHTML = 'on <a href="' + codelet.origin[1] + '">' + codelet.origin[0] +'</a>'; |
|
|
site.innerHTML = 'on <a href="' + codelet.origin[1] + '">' + codelet.origin[0] +'</a>'; |
|
|
language.innerHTML = codelet.language; |
|
|
language.innerHTML = codelet.language; |
|
|
dateModified.innerHTML = 'Last modified ' + codelet.date_modified; |
|
|
|
|
|
|
|
|
dateModified.innerHTML = 'Last modified: <span>' + codelet.date_modified + '</span>'; |
|
|
// Needs to be changed from int to string on the server |
|
|
// Needs to be changed from int to string on the server |
|
|
dateCreated.innerHTML = 'Created ' + codelet.date_created; |
|
|
|
|
|
authors.innerHTML = 'Authors: '; |
|
|
|
|
|
$.each(codelet.authors, function(i, a) { |
|
|
|
|
|
authors.innerHTML += '<a href=#>' + a + ' </a>'; |
|
|
|
|
|
|
|
|
dateCreated.innerHTML = 'Created: <span>' + codelet.date_created + '</span>'; |
|
|
|
|
|
|
|
|
|
|
|
var authorsHtml = 'Authors: <span>'; |
|
|
|
|
|
codelet.authors.forEach(function(a, i) { |
|
|
|
|
|
if (i == codelet.authors.length - 1) |
|
|
|
|
|
authorsHtml += '<a href=#>' + a + ' </a>'; |
|
|
|
|
|
else |
|
|
|
|
|
authorsHtml += '<a href=#>' + a + ' </a>, '; |
|
|
}); |
|
|
}); |
|
|
|
|
|
authors.innerHTML = authorsHtml; |
|
|
|
|
|
|
|
|
sidebar.innerHTML = ''; |
|
|
|
|
|
// Needs to be processed on the server |
|
|
// Needs to be processed on the server |
|
|
codeElt.innerHTML = '<div id=tablecontainer>' + codelet.html_code + '</div>'; |
|
|
codeElt.innerHTML = '<div id=tablecontainer>' + codelet.html_code + '</div>'; |
|
|
|
|
|
|
|
|
//Event binding |
|
|
//Event binding |
|
|
$(displayButton).hover(function(e) { |
|
|
|
|
|
|
|
|
$(newDiv).hover(function(e) { |
|
|
$(row).addClass('display-all'); |
|
|
$(row).addClass('display-all'); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@@ -213,10 +213,8 @@ function createResult(codelet) { |
|
|
|
|
|
|
|
|
hiddenInfoContainer.appendChild(hiddenInfo); |
|
|
hiddenInfoContainer.appendChild(hiddenInfo); |
|
|
|
|
|
|
|
|
row.appendChild(sidebar); |
|
|
|
|
|
row.appendChild(codeElt); |
|
|
row.appendChild(codeElt); |
|
|
row.appendChild(hiddenInfoContainer); |
|
|
row.appendChild(hiddenInfoContainer); |
|
|
row.appendChild(displayButton); |
|
|
|
|
|
table.appendChild(row); |
|
|
table.appendChild(row); |
|
|
|
|
|
|
|
|
displayInfo.appendChild(title); |
|
|
displayInfo.appendChild(title); |
|
|