File size: 2,786 Bytes
2905eba
 
 
 
 
 
5590292
2905eba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <% const {APP_NAME} = require('../packager/brand.js'); %>
    <title><%= APP_NAME %> - Convert S4S 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>
    <!-- This element needs to exist in the HTML for some browsers to autocomplete it. -->
    <input type="file" class="input-for-remembering-project-file" autocomplete="on">
    <div id="app"></div>
    <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);
      })();
      (function () {
  function updateDownloadAttribute(a) {
    if (a.hasAttribute('download')) {
      const value = a.getAttribute('download');
      if (value && value.endsWith('.html')) {
        a.setAttribute('download', value + '.txt');
      }
    }
  }

  // 初期に存在するaタグに対して変換処理
  document.querySelectorAll('a[download]').forEach(updateDownloadAttribute);

  // DOMの変更を監視して新しいaタグが追加されたら処理
  const observer = new MutationObserver((mutationsList) => {
    for (const mutation of mutationsList) {
      if (mutation.type === 'childList') {
        mutation.addedNodes.forEach((node) => {
          if (node.nodeType === Node.ELEMENT_NODE) {
            if (node.tagName === 'A') {
              updateDownloadAttribute(node);
            } else {
              node.querySelectorAll?.('a[download]').forEach(updateDownloadAttribute);
            }
          }
        });
      } else if (mutation.type === 'attributes' && mutation.target.tagName === 'A') {
        updateDownloadAttribute(mutation.target);
      }
    }
  });

  observer.observe(document.body, {
    childList: true,
    subtree: true,
    attributes: true,
    attributeFilter: ['download']
  });
})();

    </script>
  </body>
</html>