mirror of
https://github.com/jlengrand/fortnoxovertime.git
synced 2026-03-10 08:21:17 +00:00
Button click now retrieves data from the input
This commit is contained in:
@@ -11,6 +11,6 @@ img {
|
||||
height: 75px;
|
||||
}
|
||||
|
||||
.overtimeValue {
|
||||
#overtimeValue {
|
||||
display:inline;
|
||||
}
|
||||
@@ -3,11 +3,11 @@
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="integration.css">
|
||||
<title>FortNox Overtime summary</title>
|
||||
<script src="integration.js"></script>
|
||||
<script type="text/javascript" src="integration.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class= "titleBar">
|
||||
<h2>SpaceMetric Overtime</h2>
|
||||
<h1>SpaceMetric Overtime</h1>
|
||||
</div>
|
||||
<div class="mainContent">
|
||||
<div>Total overtime:
|
||||
@@ -16,5 +16,10 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings">
|
||||
<h2>Advanced</h2>
|
||||
Change Overtime value: <input type="number" name="hours" id="alterHours">
|
||||
<input type="button" value="Ok" id="submitButton">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -8,17 +8,45 @@ function writeOvertime(result){
|
||||
}
|
||||
|
||||
var overtimeElement = document.getElementById("overtimeValue");
|
||||
alert(overtimeElement.innerHTML);
|
||||
overtimeElement.innerHTML = overtime;
|
||||
}
|
||||
|
||||
function showOvertime(){
|
||||
alert("showOvertime");
|
||||
chrome.storage.sync.get("overtime", writeOvertime);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
/**
|
||||
* This method is called when the user wants to change its overtime value.
|
||||
*/
|
||||
function alterOvertime(){
|
||||
var hours = document.getElementById("alterHours").value;
|
||||
console.log(hours);
|
||||
|
||||
// chrome.storage.sync.get("overtime", function(result, hours){
|
||||
|
||||
// var overtime = result["overtime"];
|
||||
|
||||
// var pair = new Object();
|
||||
// pair["overtime"] = overtime + hours;
|
||||
|
||||
// chrome.storage.sync.set(pair);
|
||||
|
||||
// });
|
||||
|
||||
//document.getElementById("overtimeValue").innerHTML = "plouf";
|
||||
|
||||
showOvertime();
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
//adding element to the button
|
||||
button = document.getElementById("submitButton");
|
||||
button.onclick = alterOvertime;
|
||||
|
||||
showOvertime();
|
||||
|
||||
});
|
||||
|
||||
// Will update whenever a change to the storage is made
|
||||
|
||||
Reference in New Issue
Block a user