Code de l'iframe.html plus standard

pull/132/head
mama 2018-01-10 12:00:44 +01:00
parent f69b5522d4
commit aceb28718e
3 changed files with 19 additions and 16 deletions

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1">
<title>Intégrateur numéro 1</title>
<title>Intégrateur numéro 10</title>
</head>
<style>
#en-tête {
@ -24,8 +24,8 @@
<p>Calculez votre salaire !</p>
</section>
<section id="module">
<script id="script-simulateur-embauche" src="dist/simulateur.js" data-couleur="#333"></script>
<script id="script-simulateur-embauche" src="dist/simulateur.js" data-couleur="#333"></script><!-- Exemples de couleur : #1F4382 - #3570B8 - #4A89DC - #4A9DED-->
</section>
<!-- #1F4382 - #3570B8 - #4A89DC - #4A9DED-->
</body>
</html>

View File

@ -15,16 +15,17 @@
<body>
<div id="js" />
<script type="text/javascript">
var couleur =
window.location.search
.substring(1) //get rid of "?" in querystring
.split("=")[1],
scriptBeginning = '<script type="text/javascript" src="dist/bundle.js" couleur="#'
scriptEnd = '"><\/script>'
// Example colours : #1F4382 - #3570B8 - #4A89DC - #4A9DED
document.write(scriptBeginning + couleur + scriptEnd)
</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.5/iframeResizer.contentWindow.min.js"></script>
var couleur = window.location.search
.substring(1) //get rid of "?" in querystring
.split('=')[1]
var scriptEl = document.createElement('script')
scriptEl.setAttribute('type', 'text/javascript')
scriptEl.setAttribute('src', 'dist/bundle.js')
scriptEl.setAttribute('couleur', '#' + couleur)
document.body.appendChild(scriptEl)
</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.15/iframeResizer.contentWindow.min.js"></script>
<script src="https://use.fontawesome.com/1da10bbdec.js"></script>
</body>
</html>

View File

@ -4,7 +4,9 @@ let script = document.getElementById('script-simulateur-embauche'),
src = script.getAttribute('src')
document.write(`
<iframe id="SGMAPembauche" src="${src.split('dist')[0]}iframe.html?couleur=${couleur}" width="100%" style="border: none;" scrolling="no"></iframe>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.5/iframeResizer.min.js"></script>
<script type="text/javascript">iFrameResize(null, '#SGMAPembauche')</script>
<iframe id="simulateurEmbauche" src="${
src.split('dist')[0]
}iframe.html?couleur=${couleur}" style="border: none; width: 100%" scrolling="no"></iframe>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.15/iframeResizer.min.js"></script>
<script type="text/javascript">iFrameResize(null, '#simulateurEmbauche')</script>
`)