aboutsummaryrefslogtreecommitdiffstats
path: root/sdv/pdf/site/scripts/actions.js
blob: 464c57f37666e84bf1342048f73c5932a99cab6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// expand-arrow button
function toggleClass(element, classname){
  element.classList.toggle(classname)
}

// Add button
function duplicate(button){
  if (button.previousElementSibling.hasAttribute('name') && 
      button.previousElementSibling.getAttribute('name') != null)
  {
      newdiv = button.previousElementSibling.cloneNode(true);
      if (!newdiv.lastElementChild.classList.contains('del-button')){
        del ='<div class="del-button" onclick="remove(this)"></div>'
        newdiv.innerHTML += del;
      }
      button.parentNode.insertBefore(newdiv, button)
  }
}

// Delete Button
function remove(button){
  button.parentNode.parentNode.removeChild(button.parentNode);
}