JSFiddle - React, Tailwind, and code Playground

by toubia95

HTML

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Détails de l&#039;œuvre de cote: E673</title>
    <meta name="csrf-param" content="_csrf">
<meta name="csrf-token" content="UIs6KyH_8_8JBqaaLLXbKY2tpq8K87Y2sYvNikn50scX4mxyZYqhsTBAwO9Y44pxzNnXm2Cy1AHXubTCJMGgqQ==">

<link href="/assets/6cea4160/css/bootstrap.css" rel="stylesheet">
<link href="/css/site.css" rel="stylesheet">
<link href="/css/themes/spacelab/bootstrap.min.css" rel="stylesheet"></head>
<body>

<div class="wrap">
    <nav id="w1" class="navbar-inverse navbar-fixed-top navbar"><div class="container"><div class="navbar-header"><button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#w1-collapse"><span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span></button><a class="hidden-sm navbar-brand" href="/" title="v-1.0.55">Frantext-meta-editor</a></div><div id="w1-collapse" class="collapse navbar-collapse"><ul id="w2" class="navbar-nav navbar-right nav"><li class="active"><a href="/oeuvre/index">Œuvres</a></li>
<li><a href="/auteur/index">Auteurs</a></li>
<li><a href="/corpus/index">Corpus</a></li>
<li><a href="/pseudonyme/index">Gestion</a></li>
<li><a href="/utilisateur/index">Administration</a></li>
<li><form action="/site/logout" method="post">
<input type="hidden" name="_csrf" value="UIs6KyH_8_8JBqaaLLXbKY2tpq8K87Y2sYvNikn50scX4mxyZYqhsTBAwO9Y44pxzNnXm2Cy1AHXubTCJMGgqQ=="><button type="submit" class="btn btn-link logout">Déconnexion (Gilles Toubiana)</button></form></li></ul></div></div></nav>
    <div class="container">
        <div class="row">
            <div class="col-lg-10">
                <ul class="breadcrumb"><li><a href="/">Accueil</a></li>
<li><a href="/oeuvre/index">Œuvres</a></li>
<li class="active">Détails de l&#039;œuvre...

JavaScript

const trs = document.querySelectorAll('table tr');
let result = [];
for (let tr of trs) {
  let col1 = Array.from(tr.getElementsByTagName('th'))
    .map(tag => tag.innerText).toString()
    .replace(/[\s'/_]+/g, '_')
    .replace(/[éè]/g, 'e')
    .replace(/[à]/g, 'a');
  let col2 = Array.from(tr.getElementsByTagName('td'))
    .map(tag => tag.innerText).toString();

  result.push([col1, col2]);
}
r = Object.fromEntries(result.map(k => [k[0], k[1]]));
let excel = r.Cote + " | " +
  r.Auteurs + " | " +
  r.Titre_du_volume_de_l_edition_numerisee + " | " +
  r.Lieu_d_edition_de_l_edition_numerisee + " : " +
  r.Editeur_de_l_edition_numerisee + ", " +
  r.Annee_d_edition_numerisee + " | " +
  r.Annee;
console.log(r);
alert(excel);
console.log(window.location.href);
console.log(window.location.search.substring(1));
console.log(location.search.split("id=")[1]);