chromeextension/popup.html
2024-05-13 22:51:32 +02:00

40 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Popup</title>
<style>
/* Add your CSS styles here */
</style>
</head>
<body style="width: 300px;">
<p>Last Call URL Date: <span id="lastCallDate"></span></p>
<p>Result: <span id="result"></span></p>
<br />
<button id="callURLBtn">Call URL</button>
<script>
chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
if (message.type === 'updatePopup') {
document.getElementById('lastCallDate').textContent = response.date;
document.getElementById('result').textContent = response.result;
}
});
document.addEventListener('DOMContentLoaded', function () {
// Get last call URL date and result
chrome.runtime.sendMessage({ type: 'getLastCallInfo' }, function (response) {
document.getElementById('lastCallDate').textContent = response.date;
document.getElementById('result').textContent = response.result;
});
// Add event listener to call URL button
document.getElementById('callURLBtn').addEventListener('click', function () {
chrome.runtime.sendMessage({ type: 'callURLManually' });
});
});
</script>
</body>
</html>