-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bloque le chargement automatique des iframes
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(function() { | ||
// Part of this script is hard-coded into the HTML code for performance reasons. | ||
// It can be found at the bottom of template/base.html | ||
|
||
for (const placeholder of document.querySelectorAll('.iframe-placeholder')) { | ||
const message = document.createElement('p') | ||
message.innerHTML = "Attention, ce contenu provient d'une source externe !" | ||
const button = document.createElement('button') | ||
button.innerHTML = 'Charger le contenu' | ||
button.addEventListener('click', function(e) { | ||
const placeholder = e.target.parentElement | ||
const index = placeholder.dataset.iframeIndex | ||
placeholder.outerHTML = window.iframeStash[index] | ||
}) | ||
|
||
placeholder.appendChild(message) | ||
placeholder.appendChild(button) | ||
} | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters