diff --git a/README.md b/README.md index 4671ef6..a814e0f 100644 --- a/README.md +++ b/README.md @@ -83,9 +83,11 @@ If you want to create your own custom theme, you can modify the `themeMap` objec ### v1.3.6 +- [Feature] Unix & ISO time stamp converter addedin popup - [Improvement] load time was decreased by optimizing the extension runtime. - [BugFix] Events includes further minor UI tweaks and consistent bit order - [Release] Adding Release on github to quickly get binary via github. +- [BugFix] Toolbar will not be compromised with Super Easy extension. ### v1.3.5 diff --git a/Whatsnew/data.js b/Whatsnew/data.js index 1b95d01..870f2f8 100644 --- a/Whatsnew/data.js +++ b/Whatsnew/data.js @@ -6,6 +6,9 @@ const data_updates = { bugFixes: [ + { + description: "Toolbar will not be compromised with Super Easy extension", + }, { description: "Events includes further minor UI tweaks and consistent bit order", }, @@ -17,6 +20,9 @@ const data_updates = { }, ], features: [ + { + description: "Unix & ISO time stamp converter addedin popup", + }, { description: "Adding Release on github to quickly get binary via github.", }, diff --git a/bin/Dark CPI Extension.zip b/bin/Dark CPI Extension.zip index 224cf6c..a5a2d95 100644 Binary files a/bin/Dark CPI Extension.zip and b/bin/Dark CPI Extension.zip differ diff --git a/docs/readme/README.md b/docs/readme/README.md index 4671ef6..a814e0f 100644 --- a/docs/readme/README.md +++ b/docs/readme/README.md @@ -83,9 +83,11 @@ If you want to create your own custom theme, you can modify the `themeMap` objec ### v1.3.6 +- [Feature] Unix & ISO time stamp converter addedin popup - [Improvement] load time was decreased by optimizing the extension runtime. - [BugFix] Events includes further minor UI tweaks and consistent bit order - [Release] Adding Release on github to quickly get binary via github. +- [BugFix] Toolbar will not be compromised with Super Easy extension. ### v1.3.5 diff --git a/host/CPI/content/content.css b/host/CPI/content/content.css index 1a4e4a7..4240e03 100644 --- a/host/CPI/content/content.css +++ b/host/CPI/content/content.css @@ -49,6 +49,12 @@ html:is([data-cpi-dark='sap_horizon_dark'], [data-cpi-dark='sap_horizon']) .sapU margin-right: 0.5rem; } +.modToolbar > ul > li { + margin-right: 0.75rem; + margin-left: 0.75rem; + padding-top: 0.5rem; +} + .cpiBadgeIndicator { position: absolute; top: 0; diff --git a/popup/popup.css b/popup/popup.css index 112cccd..165aa8c 100644 --- a/popup/popup.css +++ b/popup/popup.css @@ -46,13 +46,18 @@ main h1 { body { font-family: Arial, sans-serif; text-align: center; - width: max-content; max-height: 800px; margin: 0; background-color: var(--bg-color); color: var(--text-color); } +span#output-text { + white-space: pre-wrap; + white-space-collapse: break-spaces; + text-wrap: pretty; +} + .darkcpiglobal .navbar { justify-content: space-between; } @@ -70,6 +75,10 @@ main:not(:has(div[role='alert'])) { } } +.stat-value { + font-size: large !important; +} + .alert.alert-error { border-radius: 0px; font-size: medium; @@ -96,8 +105,11 @@ main:not(:has(div[role='alert'])) { .alert { grid-auto-flow: column; - grid-template-columns: auto minmax(auto, 1fr); + /* grid-template-columns: auto minmax(auto, 1fr); */ justify-items: start; text-align: start; + span { + color: var(--text-color); + } } } diff --git a/popup/popup.html b/popup/popup.html index a6229f9..2b99344 100644 --- a/popup/popup.html +++ b/popup/popup.html @@ -34,9 +34,41 @@

Application: - - - +
Live Time
+
+
+
UTC Time
+
+
+
+
Local Time
+
+
+
+ +
+
Time Converter
+
+ +
+
+
+
+ +
+
+
+ + + + + + \ No newline at end of file diff --git a/popup/popup.js b/popup/popup.js index f40bae9..ebd163a 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -3,7 +3,7 @@ function populateOptions(vartheme) { document.getElementById("options").innerHTML = Object.keys(vartheme) .map((key) => { - return ``; + return ``; }) .join(""); } @@ -114,13 +114,13 @@ async function main() { } else { } console.log("Host:", internalHostname); - const buttons = document.querySelectorAll(".btn-sm"); + const buttons = document.querySelectorAll(".btn-themes"); const activetheme = document.querySelector(".activetheme"); const activeapp = document.querySelector(".activeapp"); let theme = (await getProperty("SapDarkCPITheme")) || 0; console.log("Theme:", theme); const selectedButton = document.querySelector(`.btn-sm[data-value="${theme}"]`); - + document.querySelector(".darkcpiglobal").setAttribute("data-theme", (await getProperty("SapDarkCPITheme")) === "1" ? "dark" : "light"); if (selectedButton) { selectedButton.classList.add("active"); activetheme.textContent = selectedButton.textContent; @@ -146,6 +146,7 @@ async function main() { } else if (selectedValue === "2") { document.body.classList.add("old-theme"); } + document.querySelector(".darkcpiglobal").setAttribute("data-theme", (await getProperty("SapDarkCPITheme")) === "1" ? "dark" : "light"); }); }); } diff --git a/popup/time-convert.js b/popup/time-convert.js new file mode 100644 index 0000000..b53b23b --- /dev/null +++ b/popup/time-convert.js @@ -0,0 +1,79 @@ +"use strict"; + +function updateTime() { + const localTime = new Date(); + const utcTime = new Date(localTime.toISOString()); + + document.getElementById("local-time").innerText = localTime.toLocaleString().toUpperCase(); + document.getElementById("utc-time").innerText = utcTime.toLocaleString("en-US", { timeZone: "UTC" }); +} + +function convertTimestamp() { + const input = document.getElementById("time-input").value.trim(); + const outputTextElement = document.getElementById("output-text"); + const localTimeDisplay = document.getElementById("local-time"); + const utcTimeDisplay = document.getElementById("utc-time"); + if (!input) { + outputTextElement.innerText = ""; + updateTime(); + return; + } + + let date; + let timeType = "Error"; + // Check if the input is a valid Unix timestamp (e.g., all digits). + if (/^\d+$/.test(input)) { + const unixTimestamp = parseInt(input, 10); + date = new Date(unixTimestamp * 1000); // Convert to milliseconds. + outputTextElement.innerText = `${date.toISOString()}`; + timeType = "ISO"; + } + // Check if the input is a valid ISO string. + else if (!isNaN(Date.parse(input))) { + date = new Date(input); + const unixTimestamp = Math.floor(date.getTime() / 1000); + timeType = "Unix"; + outputTextElement.innerText = `${unixTimestamp}`; + } else { + showToast("Invalid Unix or ISO timestamp", "error"); + return; + } + document.getElementById("time-type").innerHTML = timeType; + // Display the local time and UTC time derived from the date. + localTimeDisplay.innerText = date.toLocaleString(); + utcTimeDisplay.innerText = date.toLocaleString("en-US", { timeZone: "UTC" }); +} + +// Copy the output to clipboard when the icon is clicked. +document.getElementById("copy-icon").addEventListener("click", function () { + const outputText = document.getElementById("output-text").innerText; + + if (outputText) { + navigator.clipboard + .writeText(outputText) + .then(() => { + showToast("Copied Stamp"); + }) + .catch(() => { + showToast("Failed to Copy", "error"); + }); + } +}); + +// Function to show the toast message +function showToast(message, type = "success", toast = document.getElementById("toast")) { + toast.querySelector("span").innerText = message; + toast.style.display = "block"; + toast.querySelector(".alert").classList = "alert alert-" + type; + // Hide the toast after 3 seconds + setTimeout(() => { + toast.style.display = "none"; + console.log("closed"); + }, 3000); +} + +// Add event listener for input change. +document.getElementById("time-input").addEventListener("input", convertTimestamp); + +// Update the time every second. +setInterval(updateTime, 1000);