WorkerJS_CloudFlare_ImageBed/cloudflare-page/Tools-TGPH.html

102 lines
3.7 KiB
HTML
Raw Normal View History

2024-03-27 14:24:59 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>URL Transformer</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.min.css">
<style>
.container {
margin-top: 50px;
}
2024-03-27 14:29:29 +08:00
.url-item {
2024-03-27 14:24:59 +08:00
margin-top: 10px;
border: 1px solid #ccc;
padding: 10px;
border-radius: 5px;
2024-03-27 14:29:29 +08:00
background-color: #f9f9f9;
display: flex;
align-items: center;
2024-03-27 14:24:59 +08:00
}
2024-03-27 14:29:29 +08:00
.copy-button {
margin-right: 10px;
background-color: #17a2b8; /* Bootstrap info color */
border-color: #17a2b8; /* Bootstrap info color */
2024-03-27 14:24:59 +08:00
}
2024-03-27 14:29:29 +08:00
.copy-button:hover {
background-color: #138496; /* Darker shade */
border-color: #117a8b; /* Darker shade */
}
.input-group-prepend {
margin-right: 10px;
2024-03-27 14:24:59 +08:00
}
</style>
</head>
<body>
<div class="container">
<h2>URL Transformer</h2>
2024-03-27 14:29:29 +08:00
<div class="input-group mb-3">
<div class="input-group-prepend">
<button class="btn btn-outline-secondary" type="button" id="pasteUrl">粘贴URL</button>
</div>
2024-03-27 14:24:59 +08:00
<input type="text" class="form-control" id="inputUrl" placeholder="输入原始URL">
2024-03-27 14:29:29 +08:00
<div class="input-group-append">
<button class="btn btn-primary" onclick="transformUrl()">转换URL</button>
</div>
2024-03-27 14:24:59 +08:00
</div>
2024-03-27 14:29:29 +08:00
<div id="urlList"></div>
2024-03-27 14:24:59 +08:00
</div>
<script>
2024-03-27 14:29:29 +08:00
document.getElementById('pasteUrl').addEventListener('click', function() {
navigator.clipboard.readText().then(text => document.getElementById('inputUrl').value = text);
});
2024-03-27 14:24:59 +08:00
function transformUrl() {
const originalUrl = document.getElementById('inputUrl').value;
const fileName = originalUrl.match(/\/file\/(.+)$/)[1]; // 提取文件名
const prefixes = [
'https://telegraph.cachefly.net/file/',
'https://i0.wp.com/telegra.ph/file/',
'https://i1.wp.com/telegraph.cachefly.net/file/',
'https://i2.wp.com/im.gurl.eu.org/file/',
'https://i3.wp.com/missuo.ru/file/',
'https://image.baidu.com/search/down?url=https://i3.wp.com/missuo.ru/file/',
'https://images.weserv.nl/?url=https://missuo.ru/file/',
'https://pic1.xuehuaimg.com/proxy/https://i0.wp.com/missuo.ru/file/',
'https://im.gurl.eu.org/file/',
'https://img1.131213.xyz/file/',
'https://missuo.ru/file/'
];
let transformedUrls = prefixes.map(prefix => `${prefix}${fileName}`);
displayUrls(transformedUrls);
}
function displayUrls(urls) {
const urlList = document.getElementById('urlList');
urlList.innerHTML = ''; // 清空之前的结果
urls.forEach(url => {
2024-03-27 14:29:29 +08:00
const urlItem = document.createElement('div');
urlItem.className = 'url-item';
const copyBtn = document.createElement('button');
copyBtn.className = 'btn btn-info copy-button';
copyBtn.textContent = '复制URL';
copyBtn.onclick = function() { navigator.clipboard.writeText(url); };
const urlText = document.createElement('span');
urlText.textContent = url;
urlItem.appendChild(copyBtn);
urlItem.appendChild(urlText);
urlList.appendChild(urlItem);
2024-03-27 14:24:59 +08:00
});
}
</script>
</body>
</html>