Skip to content

Commit

Permalink
Fix bug in web ui download queue buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
justin025 committed Jan 27, 2025
1 parent 1dc3d0a commit 40d788d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
10 changes: 0 additions & 10 deletions src/onthespot/resources/web/download_queue.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,6 @@
return false;
}

function createButton(iconSrc, altText, onClickHandler, url = '') {
return `
<button class="download-action-button" onclick="${onClickHandler}">
<a href=${url}>
<img src="${iconSrc}" alt="${altText}">
</a>
</button>
`;
}

function updateStatusMessage() {
const tableBody = document.getElementById('download-queue-table');
const totalCount = tableBody.rows.length;
Expand Down
14 changes: 3 additions & 11 deletions src/onthespot/resources/web/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,9 @@
serviceNameSpan.className = 'hide-on-mobile';
serviceNameSpan.textContent = formatServiceName(item.item_service);

const copyButton = `
<button class="download-action-button hide-on-mobile" onclick="copyToClipboard('${item.item_url}')">
<img src="icons/link.png" alt="Copy">
</button>
`;

const downloadButton = `
<button class="download-action-button" onclick="handleDownload('${item.item_url}')">
<img src="icons/download.png" alt="Download">
</button>
`;
const copyButton = createButton('icons/link.png', 'Copy Link', `copyToClipboard('${item.item_url}')`, `${item.item_url}`);
const downloadButton = createButton('icons/download.png', 'Download', `handleDownload('${item.item_url}')`);


const row = document.createElement('tr');

Expand Down
18 changes: 18 additions & 0 deletions src/onthespot/resources/web/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,21 @@ function formatServiceName(serviceName) {

return formattedServiceName;
}

function createButton(iconSrc, altText, onClickHandler, url = null) {
if (url) {
return `
<button class="download-action-button" onclick="${onClickHandler}">
<a href="${url}" onclick="event.preventDefault();">
<img src="${iconSrc}" alt="${altText}">
</a>
</button>
`;
} else {
return `
<button class="download-action-button" onclick="${onClickHandler}">
<img src="${iconSrc}" alt="${altText}">
</button>
`;
}
}

0 comments on commit 40d788d

Please sign in to comment.