diff --git a/src/manifest.json b/src/manifest.json index 3c96d66..9dc3838 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Trolling with love", - "version": "1.0.6", + "version": "1.0.7", "description": "Replaces certain images during your web browsing", "icons": { diff --git a/src/options.html b/src/options.html index 7adf687..2f9b2f0 100644 --- a/src/options.html +++ b/src/options.html @@ -5,6 +5,11 @@
+

+ + +

+

-

-

- - + Test text +

diff --git a/src/options.js b/src/options.js index 144bf04..3627dcb 100644 --- a/src/options.js +++ b/src/options.js @@ -33,12 +33,31 @@ function saveOptions(e) { // Set values from storage categorySelect.value = result.category || categoriesNames[0].value; - //categorySelect.value = result.category || Settings.CategoryEnum.Cage; - //document.querySelector("#category").value = result.category || Categories.Cage document.querySelector("#percentage").value = result.percentage || 1; document.querySelector("#increase").checked = result.increase ? true : false; document.querySelector("#name").value = result.name || "A Friend"; + + const increaseDescElement = document.getElementById('increase_desc'); + + // Check if result.increase is a valid date and not null + if (result.increase && !isNaN(Date.parse(result.increase))) { + const increaseDate = new Date(result.increase); + const currentDate = new Date(); + + // Calculate the number of days (n) between the increase date and the current date + const timeDiff = Math.abs(currentDate - increaseDate); + const n = Math.ceil(timeDiff / (1000 * 3600 * 24)); // Convert milliseconds to days + + // Placeholder values for x and p, these should be calculated based on your logic + const x = 1; // Function to calculate the daily increase percentage + const p = result.percentage * n; // Function to calculate the current probability + + // Update the element with the description + increaseDescElement.innerHTML = `The probability has been increasing by ${x}% every day for ${n} days and is now ${p}%`; + } else { + increaseDescElement.innerHTML = ''; + } } function onError(error) {