drop.chapril.org-firefoxsend/app/templates/expireInfo/index.js

43 lines
1013 B
JavaScript
Raw Normal View History

2018-07-31 20:09:18 +02:00
const html = require('choo/html');
const raw = require('choo/html/raw');
const selectbox = require('../selectbox');
2018-08-08 20:07:09 +02:00
const timeLimitText = require('../timeLimitText');
2018-07-31 20:09:18 +02:00
module.exports = function(state) {
const el = html`<div> ${raw(
state.translate('frontPageExpireInfo', {
downloadCount: '<select id=dlCount></select>',
2018-08-08 20:07:09 +02:00
timespan: '<select id=timespan></select>'
2018-07-31 20:09:18 +02:00
})
)}
</div>`;
const dlCountSelect = el.querySelector('#dlCount');
el.replaceChild(
selectbox(
state.downloadCount || 1,
[1, 2, 3, 4, 5, 20],
num => state.translate('downloadCount', { num }),
value => {
state.downloadCount = value;
}
),
dlCountSelect
);
const timeSelect = el.querySelector('#timespan');
el.replaceChild(
2018-08-08 20:07:09 +02:00
selectbox(
state.timeLimit || 86400,
[300, 3600, 86400, 604800, 1209600],
num => timeLimitText(state.translate, num),
value => {
state.timeLimit = value;
}
),
2018-07-31 20:09:18 +02:00
timeSelect
);
return el;
};