Compare commits
No commits in common. "master" and "v2.1" have entirely different histories.
53
repliq.html
Normal file → Executable file
53
repliq.html
Normal file → Executable file
|
@ -18,7 +18,7 @@
|
|||
display: inline-block;
|
||||
width: auto;
|
||||
min-width: 250px;
|
||||
text-align: left;
|
||||
text-align: center;
|
||||
}
|
||||
.output-container {
|
||||
margin-top: 20px;
|
||||
|
@ -46,10 +46,10 @@
|
|||
<body>
|
||||
<h2>RépliQ - Générateur de bannière e-mail</h2>
|
||||
<label for="action">Demander une :</label>
|
||||
<select id="action" onchange="toggleOptions()">
|
||||
<option value="Réponse">Réponse</option>
|
||||
<select id="action" onchange="toggleConvenienceOption()">
|
||||
<option value="Action">Action</option>
|
||||
<option value="Lecture">Lecture</option>
|
||||
<option value="Réponse">Réponse</option>
|
||||
</select>
|
||||
<br><br>
|
||||
<label for="date">Date limite :</label>
|
||||
|
@ -58,9 +58,6 @@
|
|||
<div id="convenienceOption" style="display: none;">
|
||||
<input type="checkbox" id="convenience"> À votre convenance
|
||||
</div>
|
||||
<div id="requiredOption" style="display: none;">
|
||||
<input type="checkbox" id="required"> Requise (au lieu de "souhaitée")
|
||||
</div>
|
||||
<br><br>
|
||||
<button onclick="generateBanner()">Générer</button>
|
||||
<button onclick="setASAP()">ASAP</button>
|
||||
|
@ -73,24 +70,29 @@
|
|||
<div id="hiddenContainer"></div>
|
||||
|
||||
<script>
|
||||
function toggleOptions() {
|
||||
function toggleConvenienceOption() {
|
||||
const action = document.getElementById("action").value;
|
||||
document.getElementById("convenienceOption").style.display = action === "Lecture" ? "block" : "none";
|
||||
document.getElementById("requiredOption").style.display = action === "Action" ? "block" : "none";
|
||||
document.getElementById("convenience").checked = false;
|
||||
document.getElementById("required").checked = false;
|
||||
const convenienceOption = document.getElementById("convenienceOption");
|
||||
const dateInput = document.getElementById("date");
|
||||
const convenienceCheckbox = document.getElementById("convenience");
|
||||
|
||||
if (action === "Lecture") {
|
||||
convenienceOption.style.display = "block";
|
||||
} else {
|
||||
convenienceOption.style.display = "none";
|
||||
convenienceCheckbox.checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
function generateBanner() {
|
||||
const action = document.getElementById("action").value;
|
||||
const dateInput = document.getElementById("date").value;
|
||||
const convenienceChecked = document.getElementById("convenience").checked;
|
||||
const requiredChecked = document.getElementById("required").checked;
|
||||
const resultDiv = document.getElementById("result");
|
||||
const copyButton = document.getElementById("copyButton");
|
||||
const hiddenContainer = document.getElementById("hiddenContainer");
|
||||
const convenienceCheckbox = document.getElementById("convenience").checked;
|
||||
|
||||
if (!dateInput && !convenienceChecked) {
|
||||
if (!dateInput && !convenienceCheckbox) {
|
||||
alert("Veuillez sélectionner une date ou cocher 'À votre convenance'.");
|
||||
return;
|
||||
}
|
||||
|
@ -99,8 +101,8 @@
|
|||
let bgColor = "#A8E6A3";
|
||||
let textColor = "#206A1E";
|
||||
|
||||
if (convenienceChecked) {
|
||||
message = "Lecture à votre convenance. Aucune réponse requise.";
|
||||
if (convenienceCheckbox) {
|
||||
message = "Lecture à votre convenance.";
|
||||
} else {
|
||||
const selectedDate = new Date(dateInput);
|
||||
const formattedDate = selectedDate.toLocaleDateString("fr-FR");
|
||||
|
@ -108,17 +110,15 @@
|
|||
const diffTime = selectedDate - today;
|
||||
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||
|
||||
let verb = requiredChecked ? "requise" : "souhaitée";
|
||||
message = `${action} ${verb} avant le ${formattedDate}.`;
|
||||
|
||||
message = `${action} souhaitée avant le ${formattedDate}.`;
|
||||
if (diffDays <= 3) {
|
||||
bgColor = "#FFD580";
|
||||
textColor = "#A65E00";
|
||||
}
|
||||
}
|
||||
|
||||
if (action === "Lecture" && !convenienceChecked) {
|
||||
message += " Aucune réponse requise.";
|
||||
if (action === "Lecture") {
|
||||
message += " Inutile de répondre.";
|
||||
}
|
||||
|
||||
resultDiv.style.backgroundColor = bgColor;
|
||||
|
@ -127,25 +127,22 @@
|
|||
resultDiv.style.display = "block";
|
||||
copyButton.style.display = "inline-block";
|
||||
|
||||
hiddenContainer.innerHTML = `<div style='background-color: ${bgColor}; color: ${textColor}; padding: 10px; font-weight: bold; border-radius: 5px; display: inline-block; text-align: left;'>${message}</div>`;
|
||||
hiddenContainer.innerHTML = `<div style='background-color: ${bgColor}; color: ${textColor}; padding: 10px; font-weight: bold; border-radius: 5px; display: inline-block; text-align: left;'>${message.replace("\n", "<br>")}</div>`;
|
||||
}
|
||||
|
||||
function setASAP() {
|
||||
const action = document.getElementById("action").value;
|
||||
const requiredChecked = document.getElementById("required").checked;
|
||||
const verb = requiredChecked ? "requise" : "souhaitée";
|
||||
|
||||
const resultDiv = document.getElementById("result");
|
||||
const copyButton = document.getElementById("copyButton");
|
||||
const hiddenContainer = document.getElementById("hiddenContainer");
|
||||
|
||||
resultDiv.style.backgroundColor = "#FFA8A8";
|
||||
resultDiv.style.color = "#8B0000";
|
||||
resultDiv.textContent = `${action} ${verb} dès que possible`;
|
||||
resultDiv.textContent = `${action} souhaitée dès que possible`;
|
||||
resultDiv.style.display = "block";
|
||||
copyButton.style.display = "inline-block";
|
||||
|
||||
hiddenContainer.innerHTML = `<div style='background-color: #FFA8A8; color: #8B0000; padding: 10px; font-weight: bold; border-radius: 5px; display: inline-block; text-align: left;'>${action} ${verb} dès que possible</div>`;
|
||||
hiddenContainer.innerHTML = `<div style='background-color: #FFA8A8; color: #8B0000; padding: 10px; font-weight: bold; border-radius: 5px; display: inline-block; text-align: left;'>${action} souhaitée dès que possible</div>`;
|
||||
}
|
||||
|
||||
function copyFormattedBanner() {
|
||||
|
@ -160,4 +157,4 @@
|
|||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue
Block a user