Skip to content

Commit

Permalink
Update text
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlee85 committed Jul 8, 2024
1 parent 288fab9 commit 57c5afc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
9 changes: 1 addition & 8 deletions examples/polyfill_io-replace/public/assets/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,10 @@ document.addEventListener('DOMContentLoaded', (event) => {
codeBlock.className =
'code-block bg-gray-900 text-gray-100 p-4 rounded mt-4 overflow-x-auto text-sm';

const explanationParagraph = document.createElement('p');
explanationParagraph.className = 'mt-4 text-base text-gray-600';
explanationParagraph.textContent =
'The code block below shows the current HTML document source after the edge function has processed it:';

const lastParagraph = document.querySelector('body p:last-of-type');
if (lastParagraph) {
lastParagraph.insertAdjacentElement('afterend', explanationParagraph);
explanationParagraph.insertAdjacentElement('afterend', codeBlock);
lastParagraph.insertAdjacentElement('afterend', codeBlock);
} else {
document.body.appendChild(explanationParagraph);
document.body.appendChild(codeBlock);
}

Expand Down
21 changes: 12 additions & 9 deletions examples/polyfill_io-replace/public/polyfill.io.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sample Page with Polyfill.io</title>

<!-- Polyfill assets -->
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
<script src="http://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="//polyfill.io/v3/polyfill.min.js?features=Array.prototype.includes"></script>

<script src="/assets/main.js"></script>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css"
rel="stylesheet"
Expand All @@ -29,16 +36,12 @@ <h1 class="text-2xl font-bold mb-4 text-blue-500">Hello, World!</h1>
<p class="mb-4 text-base text-gray-600">
This page uses an edge function to replace script references from
polyfill.io to cdnjs.cloudflare.com for enhanced security and
performance.
performance. The code block below shows the current HTML document source
after the edge function has processed it.
<a href="/polyfill.io-usage" class="text-blue-500"
>View the original source code.</a
>
</p>
<script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
<script src="http://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="//polyfill.io/v3/polyfill.min.js?features=Array.prototype.includes"></script>
<script>
// Sample JavaScript code
console.log('Sample JavaScript code running...');
</script>
<script src="/assets/main.js"></script>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/prism.min.js"></script>
</body>
Expand Down

0 comments on commit 57c5afc

Please sign in to comment.