A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

67 lines
1.4KB

  1. import EventWindow from "/app/js/ui/EventWindow.js";
  2. class Modal{
  3. constructor(){
  4. this.__currentModalEl = null;
  5. this.__initialized = false;
  6. EventWindow.listen("onclick", (function(event){
  7. if (event.target === this.__currentModalEl){
  8. this.close_modal();
  9. }
  10. }).bind(this));
  11. }
  12. get currentModalElement(){
  13. return this.__currentModalEl;
  14. }
  15. open_modal_by_id(idname){
  16. if (this.__initialized === true && this.__currentModalEl === null){
  17. var el = document.getElementById(idname);
  18. if (el){
  19. return this.open_modal_element(el);
  20. }
  21. }
  22. return this;
  23. }
  24. open_modal_element(el){
  25. if (this.__initialized === true, this.__currentModalEl === null && el.classList.contains("modal")){
  26. el.classList.add("modal-visible");
  27. this.__currentModalEl = el;
  28. }
  29. return this;
  30. }
  31. close_modal(){
  32. if (this.__currentModalEl !== null){
  33. this.__currentModalEl.classList.remove("modal-visible");
  34. }
  35. return this;
  36. }
  37. initialize_btn_element(el){
  38. if (this.__initialized === true){
  39. if (el.hasAttribute("data-modal-open")){
  40. } else if (el.hasAttribute("data-modal-close")){
  41. } else if (el.hasAttribute("data-modal-toggle")){
  42. }
  43. }
  44. return this;
  45. }
  46. initialize(){
  47. ;
  48. }
  49. }
  50. const instance = new Modal();
  51. Object.freeze(instance);
  52. export default instance;