A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

79 行
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;