Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #12

Merged
merged 1 commit into from
Mar 28, 2025
Merged

test #12

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion tools-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h1 class="page-title">MCP Tools - Table View</h1>
<a href="/tools.html" class="btn btn-secondary"><i class="fas fa-th-large"></i> Card View</a>
<span class="active"><i class="fas fa-table"></i> Table View</span>
</div>

<table class="server-table">
<thead>
<tr>
Expand All @@ -27,6 +27,7 @@ <h1 class="page-title">MCP Tools - Table View</h1>
<th>Category</th>
<th>Language</th>
<th>Tags</th>
<th>Stars</th>
<th>Links</th>
<th>Added</th>
</tr>
Expand All @@ -45,6 +46,9 @@ <h1 class="page-title">MCP Tools - Table View</h1>
<span class="tag-small">{{ tag }}</span>
{% endfor %}
</td>
<td class="server-stars" data-github-url="{{ tool.github_url }}">
<span class="star-count"><i class="fas fa-star"></i> <span class="star-number"></span></span>
</td>
<td class="server-links">
<a href="{{ tool.github_url }}" class="btn-small" target="_blank" rel="noopener">
<i class="fab fa-github"></i>
Expand All @@ -59,6 +63,7 @@ <h1 class="page-title">MCP Tools - Table View</h1>
</section>

<style>
/* ... (Your existing CSS) ... */
.server-table-container {
background-color: white;
border-radius: var(--border-radius);
Expand Down Expand Up @@ -204,6 +209,18 @@ <h1 class="page-title">MCP Tools - Table View</h1>
font-size: 0.7rem;
color: var(--color-secondary);
}

.server-stars {
text-align: center;
white-space: nowrap;
}

.star-count {
display: inline-flex;
align-items: center;
gap: 0.2rem;
color: #ffc107;
}

.server-links {
display: flex;
Expand Down Expand Up @@ -250,6 +267,10 @@ <h1 class="page-title">MCP Tools - Table View</h1>
.server-table td:nth-child(2) {
display: none;
}
.server-table th:nth-child(6),
.server-table td:nth-child(6) {
display: none;
}
}

@media (max-width: 576px) {
Expand All @@ -263,3 +284,39 @@ <h1 class="page-title">MCP Tools - Table View</h1>
}
}
</style>

<script>
document.addEventListener('DOMContentLoaded', () => {
const starCells = document.querySelectorAll('.server-stars');

starCells.forEach(cell => {
const githubUrl = cell.dataset.githubUrl;
const starNumberSpan = cell.querySelector('.star-number');

if (githubUrl) {
fetch(`https://api.github.com/repos/${getRepoPath(githubUrl)}`)
.then(response => {
if (!response.ok) {
throw new Error(`GitHub API request failed for ${githubUrl}`);
}
return response.json();
})
.then(data => {
starNumberSpan.textContent = data.stargazers_count;
})
.catch(error => {
console.error(error);
starNumberSpan.textContent = 'N/A';
});
} else {
starNumberSpan.textContent = 'N/A';
}
});
});

function getRepoPath(githubUrl) {
const url = new URL(githubUrl);
const pathParts = url.pathname.split('/').filter(part => part);
return `${pathParts[0]}/${pathParts[1]}`;
}
</script>
Loading