<body>
<main>
<h1>L'interMEDIAire</h1>
<h2>Generator xml</h2>
<form action="#">
<textarea class="links">https://tools.lintermediaire.be/run2-seo
https://codepen.io/lintermediaire/pen/WNzQVyj</textarea>
<button class="js_submit">Envoyer</button>
<button class="light js_reset">Reset</button>
</form>
<code class="result"></code>
</main>
</body>
/*COULEURS*/
$noir: rgba(0,0,0,1);
$noirfonce: rgba(29,31,32,1);
$noiropaque: rgba(29,31,32,.9);
$rose: rgba(152,38,114,1);
$bleu: rgba(128,155,189,1);
$blanc: rgba(255,255,255,1);
$gris: rgba(55,55,55,1);
$gris2: rgba(255,255,255,.8);
$gris3: rgba(204,204,204,1);
$padding: 20px 10px;
/*TOUS LES ELEMENTS*/
*,*:after,*:before {
box-sizing: border-box;
box-sizing: border-box;
box-sizing: border-box;
}
body {
margin: 0px auto;
padding: $padding;
max-width: 640px;
background: $noir;
font-size: 1em;
}
main {
padding: calc(24px);
background: $noirfonce;
}
a, button {
display: inline-block;
margin-bottom: 24px;
width: 123px;
height: 40px;
color: $blanc;
background: $rose;
text-decoration: none;
&.light {
background: $gris;
}
&:hover,
&:active {
cursor: pointer;
}
}
h1 {
font-size: 1.4em;
color: $bleu;
}
h2 {
margin-top: 15px;
width: 100%;
color: $rose;
}
h1,h2,h3 {
font-family: 'Inconsolata', monospace;
}
textarea {
margin-bottom: 24px;
padding: 12px;
width: 100%;
height: 210px;
color: $blanc;
background: $noir;
line-height: 1.6em;
}
code {
color: $blanc;
}
/*www.lintermediaire.be*/
View Compiled
const $result = $('body .result'),
$button = $('body .js_submit'),
$links = $('body .links');
$('.js_reset').click('on', function(e) {
e.preventDefault()
$result.text(" ")
$links.val(" ")
$button.attr('disabled', false)
})
function dateSitemap(date) {
var month = date.getUTCMonth() + 1,
day = date.getUTCDate(),
year = date.getUTCFullYear(),
hours = date.getUTCHours() + 2,
minutes = date.getUTCMinutes(),
seconds = date.getUTCSeconds();
if(month<9) {
month = '0'+month
}
else {
month = month
}
if(day<9) {
day = '0'+day;
}
else {
day = day;
}
var sitemapMaj = year+'-'+month+'-'+day+'T'+hours+':'+minutes+':'+seconds;
return sitemapMaj;
}
$button.click('on', function(e) {
e.preventDefault()
var linksVal = $links.val(),
links = linksVal.split("\n"),
xml = '<?xml version="1.0" encoding="UTF-8"?>\r<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\r';
if(linksVal.length > 0) {
$(links).each(function(i, value) {
if(value) {
xml += '\n<url>\r<loc>' + value + '</loc>\r<lastmod>'+dateSitemap(new Date())+'</lastmod>\r</url>\n'
}
})
xml += "\r</urlset>"
$button.attr('disabled', true)
$links.val("").val(xml)
}
})
This Pen doesn't use any external CSS resources.