aboutsummaryrefslogtreecommitdiff
path: root/static/js/manage.js
blob: 10898d09885e0b8a9dbe507767b025f9b1e65a68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function addtime(e) {
  e.preventDefault();
  document.getElementById("seconds").value = this.dataset.secs;
}

function pvw(e) {
  prev = document.getElementById("prev_desc");
  prev.innerHTML = desc.value;
  prev.style.display = "block";
  prev.addEventListener("input", function() { desc.value = prev.innerHTML; });
}

document.addEventListener("DOMContentLoaded", function(e) {
  var list = document.getElementById("timelist");
  if (list) {
    var secs = document.getElementById("timelist").getElementsByTagName("a");
    for(var i=0;i<secs.length;i++) secs[i].addEventListener("click", addtime);
  }

  desc = document.getElementById("brd_desc");
  if (desc) desc.addEventListener("input", pvw);
});