post.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. function switchMenu(obj) {
  2. var el = document.getElementById(obj);
  3. if ( el === null ) {
  4. console.log('no such element '+el);
  5. return;
  6. }
  7. if ( el.style.display != 'none' ) {
  8. el.style.display = 'none';
  9. } else {
  10. el.style.display = 'inline-block';
  11. }
  12. }
  13. function add2tags(id) {
  14. var select = document.getElementById( id + '-tags');
  15. var input = document.getElementById( id + '-customtag');
  16. var newOption = document.createElement('option');
  17. newOption.value = input.value;
  18. newOption.innerText = input.value;
  19. newOption.selected = true;
  20. select.appendChild(newOption);
  21. input.value= '';
  22. }
  23. function add2aliases(id) {
  24. var select = document.getElementById( id + '-alias');
  25. var input = document.getElementById( id + '-customalias');
  26. var newOption = document.createElement('option');
  27. newOption.value = input.value;
  28. newOption.innerText = input.value;
  29. newOption.selected = true;
  30. select.appendChild(newOption);
  31. input.value= '';
  32. }