-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathindex.html
More file actions
169 lines (157 loc) · 5.07 KB
/
Copy pathindex.html
File metadata and controls
169 lines (157 loc) · 5.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE html>
<html lang="zh_CN">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>BT种子转磁性链接 | 磁性链接转BT种子</title>
<meta name="description" content="Torrent to Magnet online converter">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="//cdn.jsdelivr.net/gh/cdnjs/cdnjs/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet" media="screen" />
<link href="//cdn.jsdelivr.net/gh/cdnjs/cdnjs/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen" />
<style>
html,
body {
height: 100%;
}
#body {
min-height: 100%;
height: auto !important;
height: 100%;
}
#footer {
height: 60px;
background-color: #f5f5f5;
margin-top: -60px;
}
#container {
margin-top: 60px;
padding-bottom: 60px;
}
@media (max-width: 767px) {
#footer {
margin-left: -20px;
margin-right: -20px;
padding-left: 20px;
padding-right: 20px;
}
}
#footer .credit {
margin: 20px 0;
}
</style>
<script src="js/bencode.js" type="text/javascript"></script>
<script src="js/converter.js" type="text/javascript"></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a href="https://dock.eu.org" class="brand">Hello World</a>
<ul class="nav pull-right">
<li><a href="#">关于</a></li>
</ul>
</div>
</div>
</div>
<div id="body">
<div class="container">
<div id="container">
<div class="row">
<div class="span8 offset2">
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#torrent2magnet" data-tab="torrent2magnet">种子转磁链</a></li>
<li><a href="#magnet2torrent" data-tab="magnet2torrent">磁链转种子</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="torrent2magnet">
<form>
<input id="file_upload" name="file_upload" type="file" multiple="false" />
</form>
<div class="info"></div>
</div>
<div class="tab-pane" id="magnet2torrent">
<form class="form-search">
<input type="text" id="magnet" name="magnet" class="span6" placeholder="type magnet link here" />
<input type="button" class="btn btn-primary" id="submit" name="submit" value="submit" />
</form>
<div class="info"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<div id="copyright" class="container">
<p class="muted credit">Copyright © <a href="https://github.com/messycode" target="_blank">messycode</a>, All Rights Reserved,Power by <a href="https://twitter.github.io/bootstrap/" target="_blank">bootstrap</a>,Design by <a href="https://9527.eu.org" target="_blank">likebeta</a></p>
</div>
</div>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
// Tab switching
const tabLinks = document.querySelectorAll('.nav-tabs a[data-tab]');
tabLinks.forEach(function(link) {
link.addEventListener('click', function(e) {
e.preventDefault();
// Remove active class from all tabs
tabLinks.forEach(function(l) {
l.parentElement.classList.remove('active');
});
// Add active class to clicked tab
this.parentElement.classList.add('active');
// Hide all panes
document.querySelectorAll('.tab-pane').forEach(function(pane) {
pane.classList.remove('active');
});
// Show target pane
const targetId = this.getAttribute('data-tab');
document.getElementById(targetId).classList.add('active');
});
});
// Handle file selection for torrent to magnet conversion
const fileUpload = document.getElementById('file_upload');
if (fileUpload) {
fileUpload.addEventListener('change', function() {
const file = this.files[0];
if (!file) return;
// Convert torrent to magnet
Torrent2Magnet.convert(file, function(result) {
// Show result
const resultDiv = document.querySelector('#torrent2magnet .info');
let strHtml = 'The file ' + file.name + ' is invalid! ';
if (result.result) {
strHtml = '<a href="' + result.url + '" target="_blank">' + result.url;
}
resultDiv.innerHTML = '<div class="alert"><button type="button" class="close">×</button>' + strHtml + '</div>';
});
});
}
// Handle magnet to torrent conversion
const submitBtn = document.getElementById('submit');
if (submitBtn) {
submitBtn.addEventListener('click', function() {
const magnetUrl = document.getElementById('magnet').value;
const result = magnet2torrent(magnetUrl);
const divResult = document.querySelector('#magnet2torrent .info');
let strHtml = 'The url ' + magnetUrl + ' is invalid! ';
if (result.result) {
strHtml = '<a href="' + result.url + '">' + result.url;
}
divResult.innerHTML = '<div class="alert"><button type="button" class="close">×</button>' + strHtml + '</div>';
});
}
// Alert close buttons
document.addEventListener('click', function(e) {
if (e.target.classList.contains('close')) {
const alert = e.target.closest('.alert');
if (alert) {
alert.remove();
}
}
});
});
</script>
</body>
</html>