This commit is contained in:
√(noham)²
2024-02-02 17:30:33 +01:00
parent db40d79d6b
commit c6fe0fd263
10 changed files with 68 additions and 74 deletions

View File

@@ -1,20 +1,9 @@
// custom.js
document.addEventListener('DOMContentLoaded', function () {
// Get a reference to the form and the button
const form = document.getElementById('loginForm');
const saveButton = document.getElementById('saveButton');
// Add an event listener to the button click event
saveButton.addEventListener('click', function (event) {
// Prevent the default form submission
event.preventDefault();
// You can add your custom logic here
// For example, you can validate the form inputs and perform other actions
// If you want to submit the form via AJAX, you can do that here.
// For demonstration purposes, let's just log a message
console.log('Form submission prevented.');
});
});

View File

@@ -58,22 +58,4 @@
</body>
<script src="popup.js"></script>
<script src="custom.js"></script>
<!-- <script>
// Get a reference to the form and the button
const form = document.getElementById('loginForm');
const saveButton = document.getElementById('saveButton');
// Add an event listener to the button click event
saveButton.addEventListener('click', function (event) {
// Prevent the default form submission
event.preventDefault();
// You can add your custom logic here
// For example, you can validate the form inputs and perform other actions
// If you want to submit the form via AJAX, you can do that here.
// For demonstration purposes, let's just log a message
console.log('Form submission prevented.');
});
</script> -->
</html>

View File

@@ -3,7 +3,6 @@ document.addEventListener('DOMContentLoaded', function () {
const passwordInput = document.getElementById('password');
const saveButton = document.getElementById('saveButton');
// Charger les valeurs précédemment enregistrées depuis le stockage local
chrome.storage.local.get(['email', 'password'], function (data) {
if (data.email) {
emailInput.value = data.email;
@@ -13,14 +12,11 @@ document.addEventListener('DOMContentLoaded', function () {
}
});
// Enregistrer les valeurs lors du clic sur le bouton "Enregistrer"
saveButton.addEventListener('click', function () {
const email = emailInput.value;
const password = passwordInput.value;
// Enregistrer les valeurs dans le stockage local de l'extension
chrome.storage.local.set({ email, password }, function () {
// Fermer la fenêtre contextuelle après l'enregistrement
window.close();
});
});