mirror of
https://github.com/leoherzog/TorrentParts.git
synced 2026-01-24 04:08:04 -08:00
Add Dynamic Torrent File Download Tooltip
This commit is contained in:
@@ -37905,10 +37905,11 @@ var files = document.getElementById('filesBody');
|
|||||||
var getFiles = document.getElementById('getFiles');
|
var getFiles = document.getElementById('getFiles');
|
||||||
var copyURL = document.getElementById('copyURL');
|
var copyURL = document.getElementById('copyURL');
|
||||||
var copyMagnet = document.getElementById('copyMagnet');
|
var copyMagnet = document.getElementById('copyMagnet');
|
||||||
|
var downloadTorrentWrapper = document.getElementById('downloadTorrentWrapper');
|
||||||
var downloadTorrent = document.getElementById('downloadTorrent');
|
var downloadTorrent = document.getElementById('downloadTorrent');
|
||||||
var copyURLTooltip = tippy(copyURL, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Copy torrent.parts link to clipboard"});
|
var copyURLTooltip = tippy(copyURL, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Copy torrent.parts link to clipboard"});
|
||||||
var copyMagnetTooltip = tippy(copyMagnet, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Copy Magnet link to clipboard"});
|
var copyMagnetTooltip = tippy(copyMagnet, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Copy Magnet link to clipboard"});
|
||||||
var downloadTorrentTooltip = tippy(downloadTorrent, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Download Torrent file"});
|
var downloadTorrentTooltip = tippy(downloadTorrentWrapper, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Download Torrent file"});
|
||||||
var parsed;
|
var parsed;
|
||||||
var client = new WebTorrent();
|
var client = new WebTorrent();
|
||||||
var notyf = new Notyf({
|
var notyf = new Notyf({
|
||||||
@@ -38141,6 +38142,7 @@ function display() {
|
|||||||
files.appendChild(createFileRow(icon, file.name, file.length));
|
files.appendChild(createFileRow(icon, file.name, file.length));
|
||||||
}
|
}
|
||||||
files.appendChild(createFileRow('folder-tree', '', parsed.length));
|
files.appendChild(createFileRow('folder-tree', '', parsed.length));
|
||||||
|
downloadTorrentTooltip.setContent('Download Torrent file');
|
||||||
downloadTorrent.addEventListener('click', saveTorrent);
|
downloadTorrent.addEventListener('click', saveTorrent);
|
||||||
downloadTorrent.disabled = false;
|
downloadTorrent.disabled = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -38151,6 +38153,7 @@ function display() {
|
|||||||
getFiles.style.display = "block";
|
getFiles.style.display = "block";
|
||||||
files.innerHTML = '<input type="text" placeholder="Not included in the URL/File provided" aria-label="Files information not included in the URL/File provided" disabled>';
|
files.innerHTML = '<input type="text" placeholder="Not included in the URL/File provided" aria-label="Files information not included in the URL/File provided" disabled>';
|
||||||
}
|
}
|
||||||
|
downloadTorrentTooltip.setContent('Files metadata is required to generate Torrent file. Try fetching files list from WebTorrent.');
|
||||||
downloadTorrent.removeEventListener('click', saveTorrent);
|
downloadTorrent.removeEventListener('click', saveTorrent);
|
||||||
downloadTorrent.disabled = true;
|
downloadTorrent.disabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
2
bundle.min.js
vendored
2
bundle.min.js
vendored
File diff suppressed because one or more lines are too long
18
index.html
18
index.html
@@ -77,15 +77,21 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div id="share">
|
<div id="share">
|
||||||
|
<div>
|
||||||
<button id="copyURL" aria-label="Copy this torrent.parts link to the clipboard">
|
<button id="copyURL" aria-label="Copy this torrent.parts link to the clipboard">
|
||||||
<span class="fas fa-share-alt fa-2x" data-fa-transform="left-1"></span>
|
<span class="fas fa-share-alt fa-2x" data-fa-transform="left-1"></span>
|
||||||
</button>
|
</button>
|
||||||
<button id="copyMagnet" aria-label="Copy this Magnet URL to the clipboard">
|
</div>
|
||||||
<span class="fas fa-magnet fa-2x" data-fa-transform="down-1"></span>
|
<div>
|
||||||
</button>
|
<button id="copyMagnet" aria-label="Copy this Magnet URL to the clipboard">
|
||||||
<button id="downloadTorrent" aria-label="Download this as a Torrent file">
|
<span class="fas fa-magnet fa-2x" data-fa-transform="down-1"></span>
|
||||||
<span class="fas fa-file-download fa-2x"></span>
|
</button>
|
||||||
</button>
|
</div>
|
||||||
|
<div id="downloadTorrentWrapper">
|
||||||
|
<button id="downloadTorrent" aria-label="Download this as a Torrent file">
|
||||||
|
<span class="fas fa-file-download fa-2x"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="property">
|
<div class="property">
|
||||||
|
|||||||
5
parse.js
5
parse.js
@@ -27,10 +27,11 @@ var files = document.getElementById('filesBody');
|
|||||||
var getFiles = document.getElementById('getFiles');
|
var getFiles = document.getElementById('getFiles');
|
||||||
var copyURL = document.getElementById('copyURL');
|
var copyURL = document.getElementById('copyURL');
|
||||||
var copyMagnet = document.getElementById('copyMagnet');
|
var copyMagnet = document.getElementById('copyMagnet');
|
||||||
|
var downloadTorrentWrapper = document.getElementById('downloadTorrentWrapper');
|
||||||
var downloadTorrent = document.getElementById('downloadTorrent');
|
var downloadTorrent = document.getElementById('downloadTorrent');
|
||||||
var copyURLTooltip = tippy(copyURL, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Copy torrent.parts link to clipboard"});
|
var copyURLTooltip = tippy(copyURL, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Copy torrent.parts link to clipboard"});
|
||||||
var copyMagnetTooltip = tippy(copyMagnet, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Copy Magnet link to clipboard"});
|
var copyMagnetTooltip = tippy(copyMagnet, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Copy Magnet link to clipboard"});
|
||||||
var downloadTorrentTooltip = tippy(downloadTorrent, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Download Torrent file"});
|
var downloadTorrentTooltip = tippy(downloadTorrentWrapper, {"theme": "torrent-parts", "animation": "shift-away-subtle", "content": "Download Torrent file"});
|
||||||
var parsed;
|
var parsed;
|
||||||
var client = new WebTorrent();
|
var client = new WebTorrent();
|
||||||
var notyf = new Notyf({
|
var notyf = new Notyf({
|
||||||
@@ -263,6 +264,7 @@ function display() {
|
|||||||
files.appendChild(createFileRow(icon, file.name, file.length));
|
files.appendChild(createFileRow(icon, file.name, file.length));
|
||||||
}
|
}
|
||||||
files.appendChild(createFileRow('folder-tree', '', parsed.length));
|
files.appendChild(createFileRow('folder-tree', '', parsed.length));
|
||||||
|
downloadTorrentTooltip.setContent('Download Torrent file');
|
||||||
downloadTorrent.addEventListener('click', saveTorrent);
|
downloadTorrent.addEventListener('click', saveTorrent);
|
||||||
downloadTorrent.disabled = false;
|
downloadTorrent.disabled = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -273,6 +275,7 @@ function display() {
|
|||||||
getFiles.style.display = "block";
|
getFiles.style.display = "block";
|
||||||
files.innerHTML = '<input type="text" placeholder="Not included in the URL/File provided" aria-label="Files information not included in the URL/File provided" disabled>';
|
files.innerHTML = '<input type="text" placeholder="Not included in the URL/File provided" aria-label="Files information not included in the URL/File provided" disabled>';
|
||||||
}
|
}
|
||||||
|
downloadTorrentTooltip.setContent('Files metadata is required to generate Torrent file. Try fetching files list from WebTorrent.');
|
||||||
downloadTorrent.removeEventListener('click', saveTorrent);
|
downloadTorrent.removeEventListener('click', saveTorrent);
|
||||||
downloadTorrent.disabled = true;
|
downloadTorrent.disabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user