Skip to content

Commit

Permalink
Update INICIO.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fl2on authored Jul 10, 2024
1 parent 20a0082 commit 4e28a20
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions js/INICIO.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ document.getElementById("calculateButton").addEventListener("click", function()

if (expression && variable) {
const result = math.derivative(expression, variable).toString();

// Display the result
document.getElementById("output").innerHTML = result;

// Add to history
const historyItem = document.createElement("li");
historyItem.innerHTML = `Expresión: ${expression} <br> Variable: ${variable} <br> Resultado: ${result}`;
document.getElementById("historyList").prepend(historyItem);

// Scroll the new history item into view
historyItem.scrollIntoView({ behavior: 'smooth', block: 'end' });

// Render MathJax
MathJax.typeset();
}
});
Expand All @@ -33,6 +27,7 @@ document.getElementById("toggleHistoryButton").addEventListener("click", functio
document.getElementById("clearHistoryButton").addEventListener("click", function() {
document.getElementById("historyList").innerHTML = '';
});

// Mostrar la barra lateral
const history = document.getElementById("history");
history.style.display = "block";
Expand All @@ -48,13 +43,12 @@ historyItem.innerHTML = `Expresión: \[${expression}\] <br> Variable: \[${variab
document.getElementById("historyList").prepend(historyItem);
window.MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)'], ['\\[', '\\]']], // Puedes añadir otros delimitadores aquí
inlineMath: [['$', '$'], ['\\(', '\\)'], ['\\[', '\\]']],
tags: 'ams'
},
startup: {
ready: function() {
MathJax.startup.defaultReady();
// Tu código existente aquí
}
}
};

0 comments on commit 4e28a20

Please sign in to comment.