fix share btn
This commit is contained in:
@@ -193,6 +193,16 @@ domains.forEach((domain: any) => {
|
||||
</div>
|
||||
|
||||
<script define:vars={{ toolsData: tools, domainAgnosticSoftware, domainAgnosticTools }}>
|
||||
// Ensure isToolHosted is available
|
||||
if (!window.isToolHosted) {
|
||||
window.isToolHosted = function(tool) {
|
||||
return tool.projectUrl !== undefined &&
|
||||
tool.projectUrl !== null &&
|
||||
tool.projectUrl !== "" &&
|
||||
tool.projectUrl.trim() !== "";
|
||||
};
|
||||
}
|
||||
|
||||
function getSelectedPhase() {
|
||||
const activePhaseChip = document.querySelector('.phase-chip.active');
|
||||
return activePhaseChip ? activePhaseChip.getAttribute('data-phase') : '';
|
||||
@@ -216,9 +226,7 @@ domains.forEach((domain: any) => {
|
||||
|
||||
if (selectedDomain) {
|
||||
const domainRow = matrixTable.querySelector(`tr[data-domain="${selectedDomain}"]`);
|
||||
if (domainRow) {
|
||||
domainRow.classList.add('highlight-row');
|
||||
}
|
||||
if (domainRow) domainRow.classList.add('highlight-row');
|
||||
}
|
||||
|
||||
if (selectedPhase) {
|
||||
@@ -231,9 +239,7 @@ domains.forEach((domain: any) => {
|
||||
const columnIndex = phaseIndex + 1;
|
||||
matrixTable.querySelectorAll(`tr`).forEach(row => {
|
||||
const cell = row.children[columnIndex];
|
||||
if (cell) {
|
||||
cell.classList.add('highlight-column');
|
||||
}
|
||||
if (cell) cell.classList.add('highlight-column');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -267,9 +273,7 @@ domains.forEach((domain: any) => {
|
||||
const params = new URLSearchParams();
|
||||
params.set('tool', toolSlug);
|
||||
params.set('view', view);
|
||||
if (modal) {
|
||||
params.set('modal', modal);
|
||||
}
|
||||
if (modal) params.set('modal', modal);
|
||||
return `${baseUrl}?${params.toString()}`;
|
||||
}
|
||||
|
||||
@@ -301,7 +305,7 @@ domains.forEach((domain: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
window.showShareDialog = function(shareButton) {
|
||||
function showShareDialog(shareButton) {
|
||||
const toolName = shareButton.getAttribute('data-tool-name');
|
||||
const context = shareButton.getAttribute('data-context');
|
||||
|
||||
@@ -438,16 +442,11 @@ domains.forEach((domain: any) => {
|
||||
copyToClipboard(url, btn);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
window.toggleDomainAgnosticSection = toggleDomainAgnosticSection;
|
||||
|
||||
window.showToolDetails = function(toolName, modalType = 'primary') {
|
||||
function showToolDetails(toolName, modalType = 'primary') {
|
||||
const tool = toolsData.find(t => t.name === toolName);
|
||||
if (!tool) {
|
||||
console.error('Tool not found:', toolName);
|
||||
return;
|
||||
}
|
||||
if (!tool) return;
|
||||
|
||||
const isMethod = tool.type === 'method';
|
||||
const isConcept = tool.type === 'concept';
|
||||
@@ -462,10 +461,7 @@ domains.forEach((domain: any) => {
|
||||
};
|
||||
|
||||
for (const [key, element] of Object.entries(elements)) {
|
||||
if (!element) {
|
||||
console.error(`Element not found: tool-${key}-${modalType}`);
|
||||
return;
|
||||
}
|
||||
if (!element) return;
|
||||
}
|
||||
|
||||
const iconHtml = tool.icon ? `<span class="mr-3 text-xl">${tool.icon}</span>` : '';
|
||||
@@ -709,9 +705,9 @@ domains.forEach((domain: any) => {
|
||||
if (primaryActive && secondaryActive) {
|
||||
document.body.classList.add('modals-side-by-side');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
window.hideToolDetails = function(modalType = 'both') {
|
||||
function hideToolDetails(modalType = 'both') {
|
||||
const overlay = document.getElementById('modal-overlay');
|
||||
const primaryModal = document.getElementById('tool-details-primary');
|
||||
const secondaryModal = document.getElementById('tool-details-secondary');
|
||||
@@ -763,11 +759,22 @@ domains.forEach((domain: any) => {
|
||||
} else {
|
||||
document.body.classList.remove('modals-side-by-side');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
window.hideAllToolDetails = function() {
|
||||
window.hideToolDetails('both');
|
||||
};
|
||||
function hideAllToolDetails() {
|
||||
hideToolDetails('both');
|
||||
}
|
||||
|
||||
// Register all functions globally
|
||||
window.showToolDetails = showToolDetails;
|
||||
window.hideToolDetails = hideToolDetails;
|
||||
window.hideAllToolDetails = hideAllToolDetails;
|
||||
window.toggleDomainAgnosticSection = toggleDomainAgnosticSection;
|
||||
window.showShareDialog = showShareDialog;
|
||||
|
||||
// Register matrix-prefixed versions for delegation
|
||||
window.matrixShowToolDetails = showToolDetails;
|
||||
window.matrixHideToolDetails = hideToolDetails;
|
||||
|
||||
window.addEventListener('viewChanged', (event) => {
|
||||
const view = event.detail;
|
||||
@@ -798,13 +805,6 @@ domains.forEach((domain: any) => {
|
||||
const domainAgnosticPhaseIds = domainAgnosticSoftware.map(section => section.id);
|
||||
const isDomainAgnosticPhase = domainAgnosticPhaseIds.includes(selectedPhase);
|
||||
|
||||
domainAgnosticSoftware.forEach(sectionData => {
|
||||
const section = document.getElementById(`domain-agnostic-section-${sectionData.id}`);
|
||||
const container = document.getElementById(`domain-agnostic-tools-${sectionData.id}`);
|
||||
|
||||
if (!section || !container) return;
|
||||
});
|
||||
|
||||
if (!isDomainAgnosticPhase) {
|
||||
document.getElementById('dfir-matrix-section').style.display = 'block';
|
||||
|
||||
@@ -813,9 +813,7 @@ domains.forEach((domain: any) => {
|
||||
});
|
||||
|
||||
filtered.forEach(tool => {
|
||||
if (tool.type === 'concept') {
|
||||
return;
|
||||
}
|
||||
if (tool.type === 'concept') return;
|
||||
|
||||
const isMethod = tool.type === 'method';
|
||||
const hasValidProjectUrl = window.isToolHosted(tool);
|
||||
|
||||
Reference in New Issue
Block a user