Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.86 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>Saper dla pana Mendeli</title>
  9. <link href="https://fonts.googleapis.com/css?family=Henny+Penny&display=swap" rel="stylesheet">
  10.  
  11. <style>
  12. * {
  13. font-family: "henny penny";
  14. -moz-user-select: none;
  15. user-select: none;
  16. }
  17.  
  18. #wysdiv {
  19. float: left;
  20. margin-left: 40%;
  21. margin-top: 5%;
  22. margin-bottom: 15px;
  23. -moz-user-select: none;
  24. user-select: none;
  25. }
  26.  
  27. #szerdiv {
  28. float: left;
  29. margin-left: 40%;
  30. margin-bottom: 15px;
  31. -moz-user-select: none;
  32. user-select: none;
  33. }
  34.  
  35. #bombdiv {
  36. float: left;
  37. margin-left: 40%;
  38. margin-bottom: 15px;
  39. -moz-user-select: none;
  40. user-select: none;
  41. }
  42.  
  43. #container {
  44. clear: both;
  45. float: left;
  46. margin-left: 45%;
  47. }
  48.  
  49. #plansza {
  50. float: left;
  51. margin-top: 2%;
  52. margin-left: 40%;
  53. clear: both;
  54. width: 100%;
  55.  
  56. }
  57.  
  58. #ilebomb {
  59. margin-top: 10px;
  60. }
  61.  
  62. .komorka {
  63. width: 10px;
  64. height: 10px;
  65. padding: 10px;
  66. border: 1px solid black;
  67. float: left;
  68. background-color: gray;
  69. color: grey;
  70. text-align: center;
  71. -moz-user-select: none;
  72. user-select: none;
  73. }
  74.  
  75. .nic {
  76. width: 10px;
  77. height: 10px;
  78. padding: 10px;
  79. border: 1px solid black;
  80. float: left;
  81. background-color: gray;
  82. color: grey;
  83. text-align: center;
  84. -moz-user-select: none;
  85. user-select: none;
  86. }
  87.  
  88. #rzad {
  89. width: 100%;
  90. height: 32px;
  91. clear: both;
  92. }
  93.  
  94. .bomba {
  95. width: 10px;
  96. height: 10px;
  97. padding: 10px;
  98. border: 1px solid black;
  99. float: left;
  100. background-color: gray;
  101. color: grey;
  102. text-align: center;
  103. -moz-user-select: none;
  104. user-select: none;
  105. background: url(tlo.png) grey;
  106. }
  107.  
  108. .disabled {
  109. pointer-events: none;
  110. }
  111. </style>
  112. </head>
  113.  
  114.  
  115. <body>
  116. <script>
  117. var div = document.createElement("div")
  118. var wysdiv = document.createElement("div")
  119. var szerdiv = document.createElement("div")
  120. var bombdiv = document.createElement("div") //Tworzymy tutaj wszystkie elementy na strone, ktre na końcu dokumentu przypiszemy konkretnym elementom html (takim jak body czy umieścimy je w jakimś divie)
  121. var ilebomb = document.createElement("div")
  122. var plansza = document.createElement("div")
  123. var p = document.createElement("p")
  124. var wys = document.createElement("input")
  125. var szer = document.createElement("input")
  126. var bomb = document.createElement("input")
  127. var iloscbomb = 0
  128. var n = 0
  129. var wygranko = 0
  130. var u = 0
  131. var l = 0
  132. var v = 0
  133. var klik = 0
  134. var pierwszyklik = false
  135. var licznikbomb = 0
  136. var wymaganailosc = true
  137. var list = Array()
  138. var list2 = Array()
  139.  
  140.  
  141. p.id = "czolgi"
  142. div.id = "container"
  143. wys.id = "wys"
  144. szer.id = "szer" //Ustalamy tutaj id wcześniej stworzonych elementów
  145. bomb.id = "bomb"
  146. bombdiv.id = "bombdiv"
  147. wysdiv.id = "wysdiv"
  148. szerdiv.id = "szerdiv"
  149. ilebomb.id = "ilebomb"
  150. plansza.id = "plansza"
  151.  
  152. wysdiv.append("Podaj Wysokość: ")
  153. szerdiv.append("Podaj szerokość: ") //Ddodajemy tutaj zawartość do utworzonych wcześniej divów aby zawierały tekst który potrzebujemy
  154. bombdiv.append("Podaj ilość bomb: ")
  155.  
  156.  
  157.  
  158. wys.setAttribute("type", "text")
  159. szer.setAttribute("type", "text") //Ustalamy atrybuty utworzonych wcześniej "inputów"
  160. bomb.setAttribute("type", "text")
  161.  
  162.  
  163.  
  164.  
  165.  
  166. function shuffle(array) {
  167. var currentIndex = array.length, temporaryValue, randomIndex;
  168.  
  169. // While there remain elements to shuffle...
  170. while (0 !== currentIndex) {
  171.  
  172. // Pick a remaining element...
  173. randomIndex = Math.floor(Math.random() * currentIndex); //Funkcja ta pozwoli nam losowo rozłozyć elementy w tabli później w kodzie
  174. currentIndex -= 1;
  175.  
  176. // And swap it with the current element.
  177. temporaryValue = array[currentIndex];
  178. array[currentIndex] = array[randomIndex];
  179. array[randomIndex] = temporaryValue;
  180. }
  181.  
  182. return array;
  183. }
  184.  
  185. plansza.addEventListener('contextmenu', function (evt) {
  186. evt.preventDefault();
  187. }, false);
  188.  
  189. wys.oninput = function () { //
  190. var that = this //
  191. var aaa = setInterval(function () { //
  192. if (isNaN(that.value)) { //
  193. that.value = "" //
  194. clearInterval(aaa) //
  195. } //
  196. else { //
  197. clearInterval(aaa) //
  198. } //
  199. }, 1000) //
  200.  
  201. } //
  202. szer.oninput = function () { //
  203. var that = this //
  204. var aaa = setInterval(function () { //
  205. if (isNaN(that.value)) { //
  206. that.value = "" //
  207. clearInterval(aaa) // W tym miejscu mamy funkcje które sprawdzają czy w nasze inputy wprowadzmy liczby, w przeciwnym wypadku po sekundzie czyszczą pole
  208. } //
  209. else { //
  210. clearInterval(aaa) //
  211. } //
  212. }, 1000) //
  213.  
  214. } //
  215. bomb.oninput = function () { //
  216. var that = this //
  217. var aaa = setInterval(function () { //
  218. if (isNaN(that.value)) { //
  219. that.value = "" //
  220. clearInterval(aaa) //
  221. } //
  222. else { //
  223. clearInterval(aaa) //
  224. } //
  225. }, 1000) //
  226.  
  227. } //
  228.  
  229. var sek = 0
  230. var button = document.createElement("button");
  231. button.innerHTML = "GENERUJ";
  232.  
  233.  
  234. button.onclick = function () {
  235. p.innerHTML = "Czas 0 sek"
  236. var pole = wys.value * szer.value
  237. var ttt = setInterval(function () {
  238. sek++ //Wprowadzamy odliczanie
  239. p.innerHTML = "Czas " + sek + " sek"
  240. }, 1000)
  241. if (bomb.value == "" || wys.value == "" || szer.value == "" || bomb.value > pole || bomb.value == 0) { //Tutaj ustalamy działanie przycisku generuj - w tej konkretnej linijce funkcja sprawdzająca czy wszystkie dane są wprowadzone
  242. alert("Podaj poprawne watości")
  243. clearInterval(ttt)
  244. }
  245. else {
  246. container.className = "disabled"
  247. var bomby = setInterval(function () {
  248.  
  249. ile = bomb.value - licznikbomb //licznik bomb
  250.  
  251. ilebomb.innerHTML = "Zostało " + ile + " bomb"
  252. }, 1)
  253.  
  254.  
  255. function rekurencja(rekurencja) {
  256.  
  257. var to = this.id
  258. var tot = to.split("komorka");
  259. parseInt(tot)
  260. console.log(tot)
  261.  
  262. //document.getElementById(nnadlewo).click()
  263. //document.getElementById(nnad).click()
  264. //document.getElementById(nnadprawo).click()
  265. //document.getElementById(ooboklewo).click()
  266. //document.getElementById("komorka"+to).click()
  267. //document.getElementById(oobokprawo).click()
  268. //document.getElementById(ppodlewo).click()
  269. //document.getElementById(ppod).click()
  270. //document.getElementById(ppodprawo).click()
  271.  
  272. //document.getElementById("komorka" + 3).click()
  273. //document.getElementById("komorka" + n).click()
  274. //console.log(to)
  275. }
  276.  
  277. function klikanie(klikanie) {
  278. if (klik == 0 || klik == 3) {
  279. klik = 2
  280. this.style.backgroundColor = "white" //Funkcja klikania się komórek planszy
  281. this.style.color = "Black"
  282. this.style.backgroundImage = "url('nic.png')";
  283. this.style.fontSize = "15px"
  284. wygranko++
  285. if (wygranko == pole - bomb.value) {
  286. alert("Wygrales")
  287. clearInterval(ttt)
  288. licznikbomb = bomb.value
  289. plansza.className = "disabled"
  290. var style = document.createElement('style');
  291. style.innerHTML = `
  292. .komorka {
  293. color: Black;
  294. background-color: White !important;
  295. background: url(nic.png) !important;
  296. }
  297. .nic {
  298. color: Black;
  299. background-color: White !important;
  300. background: url(nic.png) !important;
  301. }
  302. .bomba {
  303. color: Black;
  304. background-color: gray;
  305. background: url(bomba.png), gray !important;
  306. }
  307. `;
  308. document.head.appendChild(style);
  309. }
  310. this.setAttribute("oncontextmenu", "return false;")
  311. }
  312. }
  313.  
  314.  
  315. function klikaniebomba(klikaniebomba) {
  316. if (klik == 0 || klik == 3) {
  317. klik = 2
  318. plansza.className = "disabled"
  319. v = 0
  320. licznikbomb = bomb.value
  321. var style = document.createElement('style');
  322. style.innerHTML = `
  323. .bomba {
  324. color: Black;
  325. background-color: gray;
  326. background: url(bomba.png), gray !important;
  327. }
  328. `;
  329. document.head.appendChild(style); //Funkcja klikania bomby
  330. clearInterval(ttt)
  331.  
  332. var aaa = confirm("Przegrales, aby rozpocząć od nowa kliknij przycisk 'ok'")
  333.  
  334. if (aaa == true) {
  335. location.reload();
  336. }
  337. if (aaa == false) {
  338. /*var style = document.createElement('style');
  339. style.innerHTML = `
  340. .komorka {
  341. color: Black;
  342. background-color: White !important;
  343. background: url(nic.png) !important;
  344. }
  345. .nic {
  346. color: Black;
  347. background-color: White !important;
  348. background: url(nic.png) !important;
  349. }
  350. `;
  351. document.head.appendChild(style);*/
  352. }
  353. }
  354. }
  355.  
  356. for (i = 0; i < pole; i++) {
  357. l++
  358. list.push(l)
  359. }
  360. list = shuffle(list)
  361. for (i = 0; i < bomb.value; i++) {
  362. var liczba = list.slice(i, i + 1) //Tutaj ustalamy w których komórkach będą bomby
  363. list2.push(liczba)
  364. }
  365. list2.sort(function (a, b) { return a - b }); //i sortujemy roznąco
  366.  
  367. var pod = szer.value
  368. var podlewo = pod - 1
  369. var podprawo = pod
  370. podprawo++
  371. //potrzebne liczniki do liczb na planszy
  372. var nad = 0 - szer.value
  373. var nadlewo = nad - 1
  374. var nadprawo = nad
  375. nadprawo++
  376.  
  377. var obokprawo = 1
  378. var oboklewo = -1
  379.  
  380. for (i = 0; i < wys.value; i++) {
  381.  
  382. var rzad = document.createElement("div")
  383. rzad.id = "rzad"
  384. plansza.appendChild(rzad) //Generowanie się komórek i rzędów planszy
  385. for (k = 0; k < szer.value; k++) {
  386.  
  387. parseInt(n)
  388. parseInt(pod)
  389. parseInt(podlewo)
  390. parseInt(podprawo)
  391. parseInt(nad)
  392. parseInt(nadlewo)
  393. parseInt(nadprawo)
  394. parseInt(obokprawo)
  395. parseInt(oboklewo)
  396.  
  397. n++
  398. pod++
  399. podlewo++
  400. podprawo++
  401. nad++
  402. nadlewo++
  403. nadprawo++
  404. obokprawo++
  405. oboklewo++
  406.  
  407.  
  408. var wyss = wys.value
  409. var lewakrawedz = (pole - szer.value) + 2
  410. var dolnakrawedz = (pole - szer.value) + 1
  411.  
  412. komorka = document.createElement("div")
  413. komorka.id = "komorka" + n
  414. //komorka.className = "komorka"
  415.  
  416. rzad.appendChild(komorka)
  417. if (szer.value == 1) {
  418. if (n == 1) { //
  419. v = 0
  420. for (c = 0; c < list2.length; c++) { //
  421. if (pod == list2[c]) { //
  422. v++ //
  423. } //
  424. }
  425. }
  426. if (n > 1 && n < pole) {
  427. v = 0
  428. for (c = 0; c < list2.length; c++) { //
  429. if (nad == list2[c]) { //
  430. v++ //
  431. } //
  432. }
  433. for (c = 0; c < list2.length; c++) { //
  434. if (pod == list2[c]) { //
  435. v++ //
  436. } //
  437. }
  438. }
  439. if (n == pole) { //
  440. v = 0
  441. for (c = 0; c < list2.length; c++) { //
  442. if (nad == list2[c]) { //
  443. v++ //
  444. } //
  445. }
  446. //
  447. }
  448.  
  449. }
  450. if (szer.value != 1) {
  451. v = 0
  452. if (n > 1 && n < szer.value) { //
  453. //
  454. for (c = 0; c < list2.length; c++) { //
  455. if (oboklewo == list2[c]) { //
  456. v++ //
  457. } //
  458. } //
  459. for (c = 0; c < list2.length; c++) { //
  460. if (obokprawo == list2[c]) { //
  461. v++ //
  462. } //
  463. } //
  464. for (c = 0; c < list2.length; c++) { //
  465. if (podlewo == list2[c]) { //
  466. v++ // gorna krawedz bez rogow (fixed?)
  467. } //
  468. } //
  469. for (c = 0; c < list2.length; c++) { //
  470. if (pod == list2[c]) { //
  471. v++ //
  472. } //
  473. } //
  474. for (c = 0; c < list2.length; c++) { //
  475. if (podprawo == list2[c]) { //
  476. v++ //
  477. } //
  478. } //
  479. } //
  480.  
  481. if (((n - 1) % szer.value) == 0 && n < lewakrawedz) { //lewa krawedz
  482.  
  483. v = 0
  484.  
  485. for (c = 0; c < list2.length; c++) {
  486. if (nad == list2[c]) {
  487. v++
  488. }
  489. }
  490. for (c = 0; c < list2.length; c++) {
  491. if (nadprawo == list2[c]) {
  492. v++
  493. }
  494. }
  495. for (c = 0; c < list2.length; c++) {
  496. if (obokprawo == list2[c]) {
  497. v++
  498. }
  499. }
  500. for (c = 0; c < list2.length; c++) {
  501. if (pod == list2[c]) {
  502. v++
  503. }
  504. }
  505. for (c = 0; c < list2.length; c++) {
  506. if (podprawo == list2[c]) {
  507. v++
  508. }
  509. }
  510.  
  511. }
  512.  
  513. if (n > szer.value && n % szer.value == 0 && n < pole) { //prawa krawedz bez rogow
  514.  
  515. v = 0
  516.  
  517. for (c = 0; c < list2.length; c++) {
  518. if (nadlewo == list2[c]) {
  519. v++
  520. }
  521. }
  522. for (c = 0; c < list2.length; c++) {
  523. if (nad == list2[c]) {
  524. v++
  525. }
  526. }
  527. for (c = 0; c < list2.length; c++) {
  528. if (oboklewo == list2[c]) {
  529. v++
  530. }
  531. }
  532. for (c = 0; c < list2.length; c++) {
  533. if (podlewo == list2[c]) {
  534. v++
  535. }
  536. }
  537. for (c = 0; c < list2.length; c++) {
  538. if (pod == list2[c]) {
  539. v++
  540. }
  541. }
  542.  
  543. }
  544.  
  545. if (n > dolnakrawedz && n < pole) { //dolna krawedz bez rogow
  546.  
  547. v = 0
  548.  
  549. for (c = 0; c < list2.length; c++) {
  550. if (nadlewo == list2[c]) {
  551. v++
  552. }
  553. }
  554. for (c = 0; c < list2.length; c++) {
  555. if (nad == list2[c]) {
  556. v++
  557. }
  558. }
  559. for (c = 0; c < list2.length; c++) {
  560. if (nadprawo == list2[c]) {
  561. v++
  562. }
  563. }
  564. for (c = 0; c < list2.length; c++) {
  565. if (oboklewo == list2[c]) {
  566. v++
  567. }
  568. }
  569. for (c = 0; c < list2.length; c++) {
  570. if (obokprawo == list2[c]) {
  571. v++
  572. }
  573. }
  574. }
  575.  
  576. if (n == 1) { //lewy gorny rog (fixed?)
  577.  
  578. v = 0
  579.  
  580. for (c = 0; c < list2.length; c++) {
  581. if (n + 1 == list2[c]) {
  582. v++
  583. }
  584. }
  585. for (c = 0; c < list2.length; c++) {
  586. if (pod == list2[c]) {
  587. v++
  588. }
  589. }
  590. for (c = 0; c < list2.length; c++) {
  591. if (podprawo == list2[c]) {
  592. v++
  593. }
  594. }
  595. }
  596.  
  597. if (n == szer.value) { //prawy gorny rog (fixed?)
  598.  
  599. v = 0
  600.  
  601. for (c = 0; c < list2.length; c++) {
  602. if (n - 1 == list2[c]) {
  603. v++
  604. }
  605. }
  606. for (c = 0; c < list2.length; c++) {
  607. if (podlewo == list2[c]) {
  608. v++
  609. }
  610. }
  611. for (c = 0; c < list2.length; c++) {
  612. if (pod == list2[c]) {
  613. v++
  614. }
  615. }
  616. }
  617.  
  618. if (n == dolnakrawedz) { //lewy dolny rog
  619.  
  620. v = 0
  621.  
  622. for (c = 0; c < list2.length; c++) {
  623. if (nad == list2[c]) {
  624. v++
  625. }
  626. }
  627. for (c = 0; c < list2.length; c++) {
  628. if (nadprawo == list2[c]) {
  629. v++
  630. }
  631. }
  632. for (c = 0; c < list2.length; c++) {
  633. if (obokprawo == list2[c]) {
  634. v++
  635. }
  636. }
  637. }
  638.  
  639. if (n == pole) { //prawy dolny rog
  640.  
  641. v = 0
  642.  
  643. for (c = 0; c < list2.length; c++) {
  644. if (nadlewo == list2[c]) {
  645. v++
  646. }
  647. }
  648. for (c = 0; c < list2.length; c++) {
  649. if (nad == list2[c]) {
  650. v++
  651. }
  652. }
  653. for (c = 0; c < list2.length; c++) {
  654. if (oboklewo == list2[c]) {
  655. v++
  656. }
  657. }
  658. }
  659.  
  660. if (n > szer.value && (n - 1) % szer.value != 0 && n % szer.value != 0 && n < dolnakrawedz) { //srodek
  661.  
  662. v = 0
  663.  
  664. for (c = 0; c < list2.length; c++) {
  665. if (nadlewo == list2[c]) {
  666. v++
  667. }
  668. }
  669. for (c = 0; c < list2.length; c++) {
  670. if (nad == list2[c]) {
  671. v++
  672. }
  673. }
  674. for (c = 0; c < list2.length; c++) {
  675. if (nadprawo == list2[c]) {
  676. v++
  677. }
  678. }
  679. for (c = 0; c < list2.length; c++) {
  680. if (oboklewo == list2[c]) {
  681. v++
  682. }
  683. }
  684. for (c = 0; c < list2.length; c++) {
  685. if (obokprawo == list2[c]) {
  686. v++
  687. }
  688. }
  689. for (c = 0; c < list2.length; c++) {
  690. if (podlewo == list2[c]) {
  691. v++
  692. }
  693. }
  694. for (c = 0; c < list2.length; c++) {
  695. if (pod == list2[c]) {
  696. v++
  697. }
  698. }
  699. for (c = 0; c < list2.length; c++) {
  700. if (podprawo == list2[c]) {
  701. v++
  702. }
  703. }
  704.  
  705.  
  706. }
  707. }
  708.  
  709. if (n != list2[u]) {
  710.  
  711. komorka.style.color = "grey"
  712.  
  713. if (v == 0) {
  714. komorka.className = "nic"
  715. komorka.innerHTML = "0"
  716. komorka.addEventListener('click', (rekurencja), { once: true });
  717. }
  718. if (v != 0) {
  719. komorka.className = "komorka"
  720. komorka.innerHTML = v
  721. }
  722.  
  723.  
  724.  
  725.  
  726. komorka.onmouseenter = function () {
  727. if (this.style.color == "yellow") {
  728. klik = 1
  729. }
  730. if (this.style.color == "red") {
  731. klik = 2
  732. }
  733. if (this.style.color == "grey") {
  734. klik = 0
  735. }
  736. if (this.style.color == "black") {
  737. klik = 2
  738. }
  739. }
  740.  
  741. komorka.oncontextmenu = function (rklikanie) {
  742.  
  743. klik++
  744.  
  745. if (klik == 1) {
  746. console.log(klik)
  747. this.style.backgroundColor = "grey" //Funkcja klikania się komórek planszy
  748. this.style.color = "yellow"
  749. this.style.backgroundImage = "url('flaga.png')";
  750. this.style.fontSize = "0px"
  751. pierwszyklik = true
  752. licznikbomb++
  753. }
  754.  
  755. if (klik == 2) {
  756. console.log(klik)
  757. this.style.backgroundColor = "grey" //Funkcja klikania się komórek planszy
  758. this.style.color = "red"
  759. this.style.backgroundImage = "url('pytajnik.png')";
  760. this.style.fontSize = "0px"
  761. pierwszyklik = false
  762. licznikbomb--
  763. }
  764.  
  765. if (klik == 3) {
  766. console.log(klik)
  767. this.style.backgroundColor = "grey" //Funkcja klikania się komórek planszy
  768. this.style.color = "grey"
  769. this.style.backgroundImage = "url('nic.png')";
  770. this.style.fontSize = "0px"
  771. pierwszyklik = false
  772. klik = 0
  773. }
  774. }
  775. komorka.onmouseleave = function () {
  776. klik = 0
  777. }
  778. komorka.addEventListener('click', (klikanie), { once: false }); //implementacja funkcji klikania sie komorek planszy
  779. }
  780.  
  781. if (n == list2[u]) {
  782.  
  783. komorka.style.color = "grey"
  784.  
  785. komorka.innerHTML = ""
  786.  
  787. u++
  788.  
  789. v = 0
  790.  
  791. komorka.className = "bomba"
  792.  
  793.  
  794.  
  795.  
  796. komorka.onmouseenter = function () {
  797. if (this.style.color == "yellow") {
  798. klik = 1
  799. }
  800. if (this.style.color == "red") {
  801. klik = 2
  802. }
  803. if (this.style.color == "grey") {
  804. klik = 0
  805. }
  806. if (this.style.color == "black") {
  807. klik = 2
  808. }
  809. }
  810.  
  811. komorka.oncontextmenu = function (rklikanie) {
  812. klik++
  813. if (klik == 1) {
  814. console.log(klik)
  815. this.style.backgroundColor = "grey" //Funkcja klikania się komórek planszy
  816. this.style.color = "yellow"
  817. this.style.backgroundImage = "url('flaga.png')";
  818. this.style.fontSize = "0px"
  819. pierwszyklik = true
  820. licznikbomb++
  821. }
  822. if (klik == 2) {
  823. console.log(klik)
  824. this.style.backgroundColor = "grey" //Funkcja klikania się komórek planszy
  825. this.style.color = "red"
  826. this.style.backgroundImage = "url('pytajnik.png')";
  827. this.style.fontSize = "0px"
  828. pierwszyklik = false
  829. licznikbomb--
  830. }
  831. if (klik == 3) {
  832. console.log(klik)
  833. this.style.backgroundColor = "grey" //Funkcja klikania się komórek planszy
  834. this.style.color = "grey"
  835. this.style.backgroundImage = "url('nic.png')";
  836. this.style.fontSize = "0px"
  837. pierwszyklik = false
  838. klik = 0
  839. }
  840. v = 0
  841.  
  842. }
  843.  
  844. komorka.onmouseleave = function () {
  845. klik = 0
  846. }
  847. komorka.addEventListener('click', (klikaniebomba), { once: false }); //implementacja funkcji klikania sie komorek planszy
  848. }
  849. }
  850. }
  851. list2 = 0
  852. }
  853.  
  854. }
  855.  
  856. div.appendChild(button);
  857. document.body.appendChild(wysdiv);
  858. document.body.appendChild(szerdiv);
  859. document.body.appendChild(bombdiv);
  860. document.body.appendChild(div); //Dodajemy wszystkie stworzsone wcześniej elementy do konkretnych miejsc na stronie w przeciwnym wypadku nie będzie ich nigdzie
  861. container.appendChild(ilebomb);
  862. document.body.appendChild(plansza);
  863. div.appendChild(p);
  864. wysdiv.appendChild(wys);
  865. szerdiv.appendChild(szer);
  866. bombdiv.appendChild(bomb);
  867. </script>
  868. </body>
  869.  
  870. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement