mirror of
https://github.com/leoherzog/TorrentParts.git
synced 2026-01-24 04:08:04 -08:00
Add Example Buttons and Tweak Placeholders
This commit is contained in:
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
|||||||
Copyright 2020 Leo Herzog
|
Copyright © 2020 Leo Herzog
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ This project wouldn't be possible without the fantastic work of:
|
|||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2020 Leo Herzog
|
Copyright © 2020 Leo Herzog
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
@@ -37,8 +37,6 @@ The above copyright notice and this permission notice shall be included in all c
|
|||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
- - - -
|
|
||||||
|
|
||||||
## About Me
|
## About Me
|
||||||
|
|
||||||
<a href="https://herzog.tech/" target="_blank">
|
<a href="https://herzog.tech/" target="_blank">
|
||||||
|
|||||||
28
bundle.js
28
bundle.js
@@ -37884,6 +37884,10 @@ const mime = require('mime-types');
|
|||||||
const WebTorrent = require('webtorrent');
|
const WebTorrent = require('webtorrent');
|
||||||
const tippy = require('tippy.js').default;
|
const tippy = require('tippy.js').default;
|
||||||
|
|
||||||
|
var examples = document.getElementById('examples');
|
||||||
|
var example1 = document.getElementById('example1');
|
||||||
|
var example2 = document.getElementById('example2');
|
||||||
|
var example3 = document.getElementById('example3');
|
||||||
var properties = document.getElementById('properties');
|
var properties = document.getElementById('properties');
|
||||||
var originalSourceIcon = document.getElementById('originalSourceIcon');
|
var originalSourceIcon = document.getElementById('originalSourceIcon');
|
||||||
var source;
|
var source;
|
||||||
@@ -37973,6 +37977,26 @@ function start() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
example1.addEventListener('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
notyf.success("Parsing Ubuntu 20.04 Magnet URL");
|
||||||
|
parse("magnet:?xt=urn:btih:9fc20b9e98ea98b4a35e6223041a5ef94ea27809&dn=ubuntu-20.04-desktop-amd64.iso&tr=https%3A%2F%2Ftorrent.ubuntu.com%2Fannounce&tr=https%3A%2F%2Fipv6.torrent.ubuntu.com%2Fannounce");
|
||||||
|
});
|
||||||
|
|
||||||
|
example2.addEventListener('click', async function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
notyf.success("Fetching and Parsing “The WIRED CD” Torrent File...");
|
||||||
|
parseRemote("https://webtorrent.io/torrents/wired-cd.torrent");
|
||||||
|
});
|
||||||
|
|
||||||
|
example3.addEventListener('click', async function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
notyf.success("Parsing Jack Johnson Archive.org Torrent File");
|
||||||
|
let response = await fetch("jj2008-06-14.mk4_archive.torrent");
|
||||||
|
let arrayBuffer = await response.arrayBuffer();
|
||||||
|
parse(Buffer.from(arrayBuffer));
|
||||||
|
});
|
||||||
|
|
||||||
let copyurl = new clipboard('#copyURL');
|
let copyurl = new clipboard('#copyURL');
|
||||||
copyurl.on('success', function(e) {
|
copyurl.on('success', function(e) {
|
||||||
notyf.success('Copied site URL to clipboard!');
|
notyf.success('Copied site URL to clipboard!');
|
||||||
@@ -38054,7 +38078,7 @@ function parse(toLoad) {
|
|||||||
function parseRemote(toLoad) {
|
function parseRemote(toLoad) {
|
||||||
parser.remote(toLoad, function(err, result) {
|
parser.remote(toLoad, function(err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
notyf.error('Problem remotely fetching file or parsing result');
|
notyf.error('Problem remotely fetching that file or parsing result');
|
||||||
console.warn(err);
|
console.warn(err);
|
||||||
resetProperties();
|
resetProperties();
|
||||||
return;
|
return;
|
||||||
@@ -38161,6 +38185,7 @@ function display() {
|
|||||||
copyURL.setAttribute('data-clipboard-text', window.location.origin + "#" + parser.toMagnetURI(parsed));
|
copyURL.setAttribute('data-clipboard-text', window.location.origin + "#" + parser.toMagnetURI(parsed));
|
||||||
copyMagnet.setAttribute('data-clipboard-text', parser.toMagnetURI(parsed));
|
copyMagnet.setAttribute('data-clipboard-text', parser.toMagnetURI(parsed));
|
||||||
|
|
||||||
|
examples.style.display = 'none';
|
||||||
properties.style.display = 'flex';
|
properties.style.display = 'flex';
|
||||||
|
|
||||||
window.location.hash = parser.toMagnetURI(parsed);
|
window.location.hash = parser.toMagnetURI(parsed);
|
||||||
@@ -38250,6 +38275,7 @@ function propertyChange(e) {
|
|||||||
function resetProperties() {
|
function resetProperties() {
|
||||||
document.getElementById('magnet').value = "";
|
document.getElementById('magnet').value = "";
|
||||||
document.getElementById('torrent').value = "";
|
document.getElementById('torrent').value = "";
|
||||||
|
examples.style.display = 'flex';
|
||||||
properties.style.display = 'none';
|
properties.style.display = 'none';
|
||||||
name.value = "";
|
name.value = "";
|
||||||
created.value = "";
|
created.value = "";
|
||||||
|
|||||||
2
bundle.min.js
vendored
2
bundle.min.js
vendored
File diff suppressed because one or more lines are too long
13
index.html
13
index.html
@@ -59,10 +59,12 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div id="startButtons">
|
<div id="startButtons">
|
||||||
<input id="magnet" type="text" placeholder="Enter Magnet URL" aria-label="Enter Magnet URL and press enter" />
|
|
||||||
|
<input id="magnet" type="text" placeholder="Enter URL" aria-label="Enter URL and press enter" />
|
||||||
<label for="magnet" class="sr-only">
|
<label for="magnet" class="sr-only">
|
||||||
Enter Magnet link and press enter
|
Enter URL and press enter
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input id="torrent" type="file" aria-label="Select Torrent file" />
|
<input id="torrent" type="file" aria-label="Select Torrent file" />
|
||||||
<label for="torrent">
|
<label for="torrent">
|
||||||
<span class="fas fa-cloud-upload" aria-hidden="true"></span> Select Torrent File
|
<span class="fas fa-cloud-upload" aria-hidden="true"></span> Select Torrent File
|
||||||
@@ -70,6 +72,13 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="examples">
|
||||||
|
<div>...or, try some examples!</div>
|
||||||
|
<button id="example1" aria-label="Load Magnet Example"><span class="fal fa-magnet" aria-hidden="true"></span> Magnet URL</button>
|
||||||
|
<button id="example2" aria-label="Load URL to Torrent File Example"><span class="fal fa-link" aria-hidden="true"></span> URL to Torrent File</button>
|
||||||
|
<button id="example3" aria-label="Load Torrent File Example"><span class="fal fa-file-alt" aria-hidden="true"></span> Torrent File</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="properties" style="display:none">
|
<div id="properties" style="display:none">
|
||||||
|
|
||||||
<button id="reset" aria-label="Reset the page">
|
<button id="reset" aria-label="Reset the page">
|
||||||
|
|||||||
114
jj2008-06-14.mk4_archive.torrent
Normal file
114
jj2008-06-14.mk4_archive.torrent
Normal file
File diff suppressed because one or more lines are too long
28
parse.js
28
parse.js
@@ -6,6 +6,10 @@ const mime = require('mime-types');
|
|||||||
const WebTorrent = require('webtorrent');
|
const WebTorrent = require('webtorrent');
|
||||||
const tippy = require('tippy.js').default;
|
const tippy = require('tippy.js').default;
|
||||||
|
|
||||||
|
var examples = document.getElementById('examples');
|
||||||
|
var example1 = document.getElementById('example1');
|
||||||
|
var example2 = document.getElementById('example2');
|
||||||
|
var example3 = document.getElementById('example3');
|
||||||
var properties = document.getElementById('properties');
|
var properties = document.getElementById('properties');
|
||||||
var originalSourceIcon = document.getElementById('originalSourceIcon');
|
var originalSourceIcon = document.getElementById('originalSourceIcon');
|
||||||
var source;
|
var source;
|
||||||
@@ -95,6 +99,26 @@ function start() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
example1.addEventListener('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
notyf.success("Parsing Ubuntu 20.04 Magnet URL");
|
||||||
|
parse("magnet:?xt=urn:btih:9fc20b9e98ea98b4a35e6223041a5ef94ea27809&dn=ubuntu-20.04-desktop-amd64.iso&tr=https%3A%2F%2Ftorrent.ubuntu.com%2Fannounce&tr=https%3A%2F%2Fipv6.torrent.ubuntu.com%2Fannounce");
|
||||||
|
});
|
||||||
|
|
||||||
|
example2.addEventListener('click', async function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
notyf.success("Fetching and Parsing “The WIRED CD” Torrent File...");
|
||||||
|
parseRemote("https://webtorrent.io/torrents/wired-cd.torrent");
|
||||||
|
});
|
||||||
|
|
||||||
|
example3.addEventListener('click', async function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
notyf.success("Parsing Jack Johnson Archive.org Torrent File");
|
||||||
|
let response = await fetch("jj2008-06-14.mk4_archive.torrent");
|
||||||
|
let arrayBuffer = await response.arrayBuffer();
|
||||||
|
parse(Buffer.from(arrayBuffer));
|
||||||
|
});
|
||||||
|
|
||||||
let copyurl = new clipboard('#copyURL');
|
let copyurl = new clipboard('#copyURL');
|
||||||
copyurl.on('success', function(e) {
|
copyurl.on('success', function(e) {
|
||||||
notyf.success('Copied site URL to clipboard!');
|
notyf.success('Copied site URL to clipboard!');
|
||||||
@@ -176,7 +200,7 @@ function parse(toLoad) {
|
|||||||
function parseRemote(toLoad) {
|
function parseRemote(toLoad) {
|
||||||
parser.remote(toLoad, function(err, result) {
|
parser.remote(toLoad, function(err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
notyf.error('Problem remotely fetching file or parsing result');
|
notyf.error('Problem remotely fetching that file or parsing result');
|
||||||
console.warn(err);
|
console.warn(err);
|
||||||
resetProperties();
|
resetProperties();
|
||||||
return;
|
return;
|
||||||
@@ -283,6 +307,7 @@ function display() {
|
|||||||
copyURL.setAttribute('data-clipboard-text', window.location.origin + "#" + parser.toMagnetURI(parsed));
|
copyURL.setAttribute('data-clipboard-text', window.location.origin + "#" + parser.toMagnetURI(parsed));
|
||||||
copyMagnet.setAttribute('data-clipboard-text', parser.toMagnetURI(parsed));
|
copyMagnet.setAttribute('data-clipboard-text', parser.toMagnetURI(parsed));
|
||||||
|
|
||||||
|
examples.style.display = 'none';
|
||||||
properties.style.display = 'flex';
|
properties.style.display = 'flex';
|
||||||
|
|
||||||
window.location.hash = parser.toMagnetURI(parsed);
|
window.location.hash = parser.toMagnetURI(parsed);
|
||||||
@@ -372,6 +397,7 @@ function propertyChange(e) {
|
|||||||
function resetProperties() {
|
function resetProperties() {
|
||||||
document.getElementById('magnet').value = "";
|
document.getElementById('magnet').value = "";
|
||||||
document.getElementById('torrent').value = "";
|
document.getElementById('torrent').value = "";
|
||||||
|
examples.style.display = 'flex';
|
||||||
properties.style.display = 'none';
|
properties.style.display = 'none';
|
||||||
name.value = "";
|
name.value = "";
|
||||||
created.value = "";
|
created.value = "";
|
||||||
|
|||||||
21
style.css
21
style.css
@@ -140,7 +140,7 @@ footer > a {
|
|||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
}
|
}
|
||||||
|
|
||||||
#startButtons > * {
|
#startButtons > *, #examples > button {
|
||||||
width: 440px;
|
width: 440px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
@@ -166,6 +166,23 @@ label[for="torrent"] {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#examples {
|
||||||
|
width: 100%;
|
||||||
|
height: 180px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
#examples > button {
|
||||||
|
background: var(--light-blue);
|
||||||
|
width: 440px;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 22px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
#properties {
|
#properties {
|
||||||
position: relative;
|
position: relative;
|
||||||
max-width: 960px;
|
max-width: 960px;
|
||||||
@@ -338,7 +355,7 @@ input {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#announce > * > *, #urlList > * > *, #addTracker, #addWebseed {
|
#announce > * > *, #urlList > * > *, #addTracker, #addWebseed, #examples > button {
|
||||||
width: 80vw;
|
width: 80vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user