Skip to content

Commit

Permalink
update text message and check redirect link
Browse files Browse the repository at this point in the history
  • Loading branch information
Lifailon authored Jun 3, 2024
1 parent 100c42b commit cefa155
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,41 @@
<meta http-equiv="refresh" content="0;url=magnet:?xt=urn:btih:ACED2A5FF8B266EF40B76BFCF6B9E76BF19BFD9F">
-->
<script>
// Функция перенаправления
function redirectToMagnet(hashValue) {
window.location.href = "magnet:?xt=urn:btih:" + hashValue;
}
// Перенаправление при загрузке страницы
window.onload = function() {
var hashValue = window.location.hash.substr(1);
var hashValue = window.location.hash.substr(1)
var messageElement = document.getElementById("message")
if (hashValue) {
redirectToMagnet(hashValue);
if (hashValue.startsWith("magnet:?xt=urn:btih:")) {
window.location.href = hashValue
}
else {
window.location.href = "magnet:?xt=urn:btih:" + hashValue
}
}
else {
messageElement.innerHTML = "For redirect to the default torrent client, pass the info hash or magnet link in the address bar after the # symbol"
}
};
// Обновление ссылки и перенаправление при изменении хэша
}
window.onhashchange = function() {
var hashValue = window.location.hash.substr(1);
var redirectLink = document.getElementById('redirectLink');
var hashValue = window.location.hash.substr(1)
var messageElement = document.getElementById("message")
if (hashValue) {
redirectLink.href = "magnet:?xt=urn:btih:" + hashValue;
redirectToMagnet(hashValue);
if (hashValue.startsWith("magnet:?xt=urn:btih:")) {
window.location.href = hashValue
}
else {
window.location.href = "magnet:?xt=urn:btih:" + hashValue
}
}
};
else {
messageElement.innerHTML = "For redirect to the default torrent client, pass the info hash or magnet link in the address bar after the # symbol"
}
}
</script>
</head>
<body>
Если вы не были автоматически перенаправлены, <a id="redirectLink" href="#">нажмите здесь</a>.
<div id="message">
If you were not automatically redirected, <a id="redirectLink" href="#">click here</a>.
</div>
</body>
</html>

0 comments on commit cefa155

Please sign in to comment.