A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

79 líneas
2.1KB

  1. import GlobalEvents from "/app/js/common/EventCaller.js";
  2. function UnselectTab(tabname, tabid, el){
  3. el.classList.remove("tab-selected");
  4. var d = document.querySelectorAll("[fortabs='" + tabname + "'][tabid='" + tabid + "']");
  5. for (let i=0; i < d.length; i++){
  6. d[i].classList.add("hidden");
  7. }
  8. }
  9. function SelectTab(tabname, tabid, el){
  10. if (!el.classList.contains("tab-selected"))
  11. el.classList.add("tab-selected");
  12. var d = document.querySelectorAll("[fortabs='" + tabname + "'][tabid='" + tabid + "']");
  13. for (let i=0; i < d.length; i++){
  14. d[i].classList.remove("hidden");
  15. }
  16. }
  17. function GenTABListener(tabname, tabid, lil){
  18. return function(e){
  19. // TODO: FIX ME!!
  20. var sel = lil.querySelector("li.tab-selected");
  21. if (sel){
  22. var oldtabid = sel.getAttribute("tabid");
  23. UnselectTab(tabname, oldtabid, sel);
  24. }
  25. sel = lil.querySelector("li[tabid='" + tabid + "']");
  26. if (sel){
  27. SelectTab(tabname, tabid, sel);
  28. }
  29. }
  30. }
  31. function HideAllTABContent(tabname){
  32. var d = document.querySelectorAll("[fortabs='" + tabname + "']");
  33. for (let i=0; i < d.length; i++){
  34. d[i].classList.add("hidden");
  35. }
  36. }
  37. class Tabs{
  38. constructor(){}
  39. initialize(){
  40. var tabs = document.querySelectorAll("ul[tabs]");
  41. for (let i=0; i < tabs.length; i++){
  42. var selectionMade = false;
  43. var tabname = tabs[i].getAttribute("tabs");
  44. HideAllTABContent(tabname);
  45. var li = tabs[i].querySelectorAll("li[tabid]");
  46. for (let j=0; j < li.length; j++){
  47. var tabid = li[j].getAttribute("tabid");
  48. var a = li[j].querySelector("a");
  49. a.addEventListener("click", GenTABListener(tabname, tabid, li));
  50. if (li[j].classList.contains("tab-selected")){
  51. if (selectionMade){
  52. UnselectTab(tabname, tabid, li[j]);
  53. } else {
  54. SelectTab(tabname, tabid, li[j]);
  55. selectionMade = true;
  56. }
  57. }
  58. }
  59. if (selectionMade == false){
  60. var tabid = li[0].getAttribute("tabid");
  61. SelectTab(tabname, tabid, li[0]);
  62. }
  63. }
  64. }
  65. }
  66. const instance = new Tabs();
  67. export default instance;