Skip to content

Commit

Permalink
var
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-blackson committed Jul 27, 2023
1 parent 195e4b2 commit 918faaf
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 2 deletions.
95 changes: 95 additions & 0 deletions admin/index_m.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<script type="text/javascript" src="../../lib/js/materialize.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
<script type="text/javascript" src="words.js"></script>
<script src="https://momentjs.com/downloads/moment.min.js"></script>


<style>
Expand All @@ -24,6 +25,7 @@
<!-- you have to define 2 functions in the global scope: -->
<script type="text/javascript">
var setup = [];
var countdownData = [];

// the function loadSettings has to exist ...
function save(callback) {
Expand Down Expand Up @@ -59,6 +61,10 @@
});
onChange(false);

if (M) M.updateTextFields();

loadSetup()
//const done1 = await loadSetup();

$('#addCountdown').on('click', function () {
let CountdownName = $('#CountName').val();
Expand Down Expand Up @@ -97,6 +103,49 @@

});
}
function loadSetup() {

console.log('Start loadSetup')

socket.emit('getObjectView', 'system', 'state', { startkey: 'countdown.' + instance + '.setup', endkey: 'countdown.' + instance + '.setup' + '.\u9999', include_docs: true }, function (err, _setup) {

//console.log('Return of all setups : ' + JSON.stringify(_setup));
for (const i in _setup.rows) {
getState(_setup.rows[i].id , (err, state) => {
var countName = _setup.rows[i].id.replace('countdown.' + instance + '.setup.','');
var countdownDate = state.val
var countdownTime = countdownDate.slice(11, 11 + 5)
var dateMomentObject = moment(countdownDate, "DD.MM.YYYY");
var localDate = moment(dateMomentObject).local().format('YYYY-MM-DD')

var countUp = false
var SearchForCycle = countdownDate.indexOf('#')
if (SearchForCycle != -1){
countUp = true
countdownDate = countdownDate.replace('#','');
}
var repeatCycle = ""
SearchForCycle = countdownDate.indexOf('+')
if (SearchForCycle != -1){
repeatCycle = countdownDate.slice((SearchForCycle+1), countdownDate.length)
countdownDate = countdownDate.slice(0,SearchForCycle)
}

countdownData.push(
{
countdownName: countName,
countdownDate: localDate,
countdownTime: countdownTime,
countdownCountUp: countUp,
countdownRepeatCycle: repeatCycle
}
);
values2table('countdownData', countdownData);
});
}
});

}
</script>
<style>
.m .select-wrapper+label {
Expand All @@ -111,6 +160,7 @@
<ul class="tabs">
<li class="tab col s2"><a href="#tab-settings" class="translate active">settings</a></li>
<li class="tab col s2"><a href="#tab-addcountdown" class="translate">addCountdown</a></li>
<li class="tab col s2"><a href="#tab-newHome" class="translate">newHome</a></li>
</ul>
</div>

Expand Down Expand Up @@ -213,6 +263,51 @@
</div>

</div>
<div id="tab-newHome" class="col s12 page">
<div class="row">
<div class="input-field col s3">
<img src="countdown.png" class="logo">
</div>
</div>
<div class="row">








</div>
<div class="col s10" id="countdownData">
<div class="row s10 left">
<a class="waves-effect waves-light btn table-button-add translate">add countdown</a>
</div>
<div class="table-values-div">
<table class="table-values">
<thead>
<tr>
<th data-name="countdownName" class="translate city" data-style="text-align: left">Countdown name
</th>
<th data-name="countdownDate" class="translate lati" data-type="date" data-style="text-align: left">Date
</th>
<th data-name="countdownTime" class="translate lati" data-type="time" data-style="text-align: left">Time
</th>
<th data-name="countdownRepeatCycle" class="translate lati" data-style="text-align: left">RepeatCycle
</th>
</th>
<th data-name="countdownCountUp" data-type="checkbox" class="translate lati" data-style="text-align: left">CountUp
</th>


<th data-buttons="delete" class="translate delete">delete</th>
</tr>
</thead>
</table>
</div>
</div>

</div>
</div>
</div>
</body>
Expand Down
15 changes: 14 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
{
"common": {
"name": "countdown",
"version": "2.1.0",
"version": "2.2.0",
"news": {
"2.2.0": {
"en": "Added ability to maintain, adjust and delete countdowns in adapter settings",
"de": "Zusätzliche Fähigkeit, Countdowns in Adaptereinstellungen zu pflegen, anzupassen und zu löschen",
"ru": "Добавлена возможность поддерживать, регулировать и удалять отсчеты в настройках адаптера",
"pt": "Adicionado capacidade de manter, ajustar e excluir contagem regressiva em configurações do adaptador",
"nl": "Vermogen toegevoegd om te handhaven en aftellen in adapter settings",
"fr": "Capacité supplémentaire de maintenir, régler et supprimer les compteurs dans les réglages d'adaptateur",
"it": "Aggiunta la capacità di mantenere, regolare ed eliminare i conto alla rovescia nelle impostazioni dell'adattatore",
"es": "Posibilidad agregada de mantener, ajustar y eliminar recuentos en la configuración del adaptador",
"pl": "Zdolność do utrzymania, dostosowywania i usuwania liczb w ustawieniach adapterów",
"uk": "Додано можливість підтримки, налаштування та видалення відліків у налаштуваннях адаптера",
"zh-cn": "增加在适应环境中保持、调整和删除计值的能力"
},
"2.1.0": {
"en": "Ability to use the countdown \"backwards\" - e.g. for calculating age of a baby",
"de": "Fähigkeit, den Countdown rückwärts zu verwenden - z.B. zur Berechnung des Alters eines Babys",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.countdown",
"version": "2.1.0",
"version": "2.2.0",
"description": "Countdown",
"main": "main.js",
"repository": {
Expand Down

0 comments on commit 918faaf

Please sign in to comment.