]> git.ardis.lu - static-encrypt/commitdiff
Replace comment placeholder with actual element
authorArdis Lu <ardisglu@gmail.com>
Wed, 22 Feb 2023 05:28:26 +0000 (21:28 -0800)
committerArdis Lu <ardisglu@gmail.com>
Wed, 22 Feb 2023 05:28:26 +0000 (21:28 -0800)
Some web hosts will auto-minify HTML and strip out comments

index.html
template.html

index b7efeccfbed3f3f862f13dad43c6f4a1777be85b..09c3525e0bd06faabf265d2b942c9561743088fe 100644 (file)
     document.querySelector('#download').addEventListener('click', e => {
       const encrypted = document.querySelector('#ciphertext').textContent;
       const scriptInjection = `<script>const content = '${encrypted}'; ${decrypt.toString()}<\/script>`;
-      const output = template.replace('<!-- SCRIPT INJECTION -->', scriptInjection);
+      const output = template.replace('<div>SCRIPT INJECTION</div>', scriptInjection);
       downloadHtml(output, `${Date.now()}.html`);
     })
   </script>
index 4ca08fabb6454f1f74c5c38d9ca6d94f1af65510..182347c8b65f449c0523f75ccef3c76f2ee21d40 100644 (file)
@@ -24,7 +24,7 @@
     </form>
   </main>
 
-  <!-- SCRIPT INJECTION -->
+  <div>SCRIPT INJECTION</div>
   <script>
     document.querySelector('form').addEventListener('submit', async e => {
       e.preventDefault();
This page took 0.037979 seconds and 4 git commands to generate.