penguinmod-packager / index.html
soiz's picture
Update index.html
4bc0050 verified
<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>PenguinMod Packager - Convert PenguinMod projects to HTML, EXE, and more</title><meta name="description" content="Converts PenguinMod projects into HTML files, zip archives, or executable programs for Windows, macOS, and Linux."><style>body[p4-splash-theme="dark"]:not([p4-loaded]) {
background-color: #111;
color-scheme: dark;
}
.input-for-remembering-project-file {
display: none;
}</style></head><body><noscript>This page requires JavaScript.</noscript><input type="file" class="input-for-remembering-project-file" autocomplete="on"><div id="app"></div>
<script>(async function() {
if (typeof window.showSaveFilePicker !== 'function') {
alert('このブラウザは showSaveFilePicker をサポートしていません。最新のGoogle Chromeなどをご利用ください。');
return;
}
const handleBlobLinks = (link) => {
link.addEventListener('click', async (event) => {
event.preventDefault(); // デフォルトのリンク動作をキャンセル
const blobUrl = link.href;
try {
const response = await fetch(blobUrl);
if (!response.ok) throw new Error(`HTTPエラー: ${response.status}`);
const blob = await response.blob();
// ファイル保存ダイアログを表示
const opts = {
suggestedName: 'file.html', // 固定ファイル名
types: [
{
description: 'HTML File',
accept: { 'text/html': ['.html'] },
},
],
};
const handle = await window.showSaveFilePicker(opts);
const writable = await handle.createWritable();
await writable.write(blob);
await writable.close();
alert('ファイルが保存されました!');
} catch (error) {
console.error('エラーが発生しました:', error);
alert(
`ファイルのダウンロード中にエラーが発生しました: ${error.message}\n` +
`固定ファイル名: file.html`
);
}
});
};
const processLinks = () => {
const links = document.querySelectorAll('a[href^="blob:"]');
for (const link of links) {
if (!link.hasAttribute('data-blob-processed')) {
link.setAttribute('data-blob-processed', 'true'); // 重複処理を防ぐ
handleBlobLinks(link);
}
}
};
// 初回処理
processLinks();
// DOMの変化を監視
const observer = new MutationObserver(() => {
processLinks(); // DOM変化時に再度リンクを処理
});
observer.observe(document.body, { childList: true, subtree: true });
alert('Blobリンクの監視を開始しました!');
})();
</script>
<script>(function() {
// This logic is only for the "splash" screen.
// It's used to prevent a momentary white screen while the page is loading in dark mode.
var theme = 'system';
try {
var local = localStorage.getItem('P4.theme')
if (typeof local === 'string') theme = local;
} catch (e) { /* ignore */ }
if (theme === 'system') theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
document.body.setAttribute('p4-splash-theme', theme);
})();</script><script src="js/p4.9db73d9b3beb136093b5.js"></script><script defer src="https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon='{"rayId":"8e6681576b9bd429","version":"2024.10.5","r":1,"token":"329f722c06034bc58b8b2eea66ca477e","serverTiming":{"name":{"cfExtPri":true,"cfL4":true,"cfSpeedBrain":true,"cfCacheStatus":true}}}' crossorigin="anonymous"></script>
</body></html>