main.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "use strict";
  2. let ringo_save_data = '';
  3. let ringo_open = 0;
  4. let ringo_menu_list = [
  5. 'recent_cel',
  6. 'other_cel',
  7. 'user_cel',
  8. 'add_cel'
  9. ];
  10. function ringo_opening(data) {
  11. let element = [data];
  12. for(let for_a in ringo_menu_list) {
  13. if(ringo_menu_list[for_a] + '_in' !== data) {
  14. element.push(ringo_menu_list[for_a] + '_in');
  15. }
  16. }
  17. if((document.getElementById(element[0]).style.display === 'none' && ringo_open === 0) || ringo_save_data !== data) {
  18. document.getElementById(element[0]).style.display = 'block';
  19. for(let for_a in element) {
  20. if(for_a !== '0') {
  21. if(document.getElementById(element[for_a]) !== null) {
  22. document.getElementById(element[for_a]).style.display = 'none';
  23. }
  24. }
  25. }
  26. ringo_open = 1;
  27. ringo_save_data = data;
  28. setTimeout(function() { ringo_open = 2; }, 100);
  29. } else {
  30. document.getElementById(element[0]).style.display = 'none';
  31. ringo_open = 0
  32. }
  33. }
  34. document.addEventListener("click", function() {
  35. let cel_list = [];
  36. for(let for_a in ringo_menu_list) {
  37. cel_list.push(document.getElementById(ringo_menu_list[for_a]));
  38. }
  39. if(ringo_save_data !== '' && ringo_open === 2) {
  40. document.getElementById(ringo_save_data).style.display = 'none';
  41. setTimeout(function() { ringo_open = 0; }, 100);
  42. }
  43. });