Архитектурный шаблон "Мрак в моделях" на нескольких языках и платформах
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Память | Memory</title>
  5. </head>
  6. <body>
  7. </body>
  8. <script src="../shared/javaScript.js"></script>
  9. <script src="platform.js"></script>
  10. <script>
  11. var items = []
  12. // Section16Buttons.
  13. for (var i = 0; i < 16; i++) {
  14. let item = document.createElement("div")
  15. document.body.appendChild(item)
  16. items.push(item)
  17. item.id = `${i}`
  18. }
  19. // SectionGrid.
  20. var M = {
  21. itemsCount: items.length
  22. };
  23. let positions = memoryItemPositions(M);
  24. for (var id in positions) {
  25. var p = positions[id]
  26. var item = items[id];
  27. item.style.left = `${p.x}px`
  28. item.style.top = `${p.y}px`
  29. item.style.width = `${memorySide()}px`
  30. item.style.height = `${memorySide()}px`
  31. item.style.position = "absolute"
  32. item.style.background = "blue"
  33. }
  34. let groups = memoryGroups(M);
  35. /**/console.log("ИГР groups:", groups);
  36. // SectionSelection.
  37. for (let id in items) {
  38. var item = items[id]
  39. item.onclick = function() {
  40. let group = groups[id];
  41. console.log("ИГР select id/group:", id, group)
  42. }
  43. }
  44. </script>
  45. </html>