Skip to content

Commit

Permalink
Toggle table display by clicking header (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainMaestro authored Feb 23, 2017
1 parent 2675924 commit d87d073
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
var body = document.createElement('tbody');

header.textContent = 'Dependencies (' + config.name + ')';
header.title = 'Toggle ' + config.name + ' table display';
header.onclick = toggleTable;
header.style.display = 'none';
table.style.display = 'none';
tableHeaders.forEach(addTableHeader);
Expand All @@ -26,6 +28,10 @@
tableHeader.textContent = header;
table.appendChild(tableHeader);
}

function toggleTable() {
table.style.display = table.style.display == 'block' ? 'none' : 'block';
}
}

function addDependencies(body, deps, registry, dev) {
Expand Down Expand Up @@ -82,9 +88,11 @@
data[2].children[0].textContent = latestVersion;
data[3].textContent = description;
var table = this.parentNode.parentNode;
var header = table.previousSibling;

table.style.display = 'block';
table.previousSibling.style.display = 'block';
header.style.display = 'block';
header.style.cursor = 'pointer';
}

window.display = display;
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Package Hub",
"version": "0.3.0",
"version": "0.4.0",
"manifest_version": 2,
"description": "Display dependencies for many package managers on GitHub",
"author": "Ezinwa Okpoechi",
Expand Down

0 comments on commit d87d073

Please sign in to comment.