roboratorium

tabliczka egzamin tikedupl

Oct 13th, 2026
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.10 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Egzamin Online - Tabliczka Mnożenia</title>
  7. <style>
  8. * {
  9. box-sizing: border-box;
  10. margin: 0;
  11. padding: 0;
  12. }
  13.  
  14. body {
  15. background-color: #ffffff;
  16. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  17. color: #1e293b;
  18. min-height: 100vh;
  19. display: flex;
  20. justify-content: center;
  21. align-items: flex-start;
  22. padding: 40px 16px;
  23. }
  24.  
  25. .app-card {
  26. width: 100%;
  27. max-width: 680px;
  28. display: flex;
  29. flex-direction: column;
  30. align-items: center;
  31. text-align: center;
  32. }
  33.  
  34. h1.title {
  35. font-size: 42px;
  36. font-weight: 800;
  37. color: #0b1f3a;
  38. margin-bottom: 24px;
  39. letter-spacing: -0.5px;
  40. }
  41.  
  42. .subtitle-msg {
  43. font-size: 18px;
  44. color: #1e293b;
  45. margin-bottom: 12px;
  46. font-weight: 400;
  47. line-height: 1.4;
  48. }
  49.  
  50. .subtitle-time {
  51. font-size: 18px;
  52. color: #1e293b;
  53. margin-bottom: 26px;
  54. font-weight: 400;
  55. }
  56.  
  57. /* Karta podsumowania (niebieskie akcenty) */
  58. .summary-card {
  59. width: 100%;
  60. background: #fbfcfd;
  61. border: 1px solid #e2e8f0;
  62. border-radius: 18px;
  63. padding: 22px 24px;
  64. display: flex;
  65. justify-content: space-evenly;
  66. align-items: center;
  67. margin-bottom: 28px;
  68. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  69. }
  70.  
  71. .stat-item {
  72. display: flex;
  73. align-items: center;
  74. gap: 10px;
  75. font-size: 19px;
  76. color: #334155;
  77. font-weight: 500;
  78. }
  79.  
  80. .dot {
  81. width: 9px;
  82. height: 9px;
  83. background-color: #0ea5e9;
  84. border-radius: 50%;
  85. display: inline-block;
  86. }
  87.  
  88. .stat-val {
  89. color: #0284c7;
  90. font-weight: 800;
  91. font-size: 24px;
  92. margin-left: 4px;
  93. }
  94.  
  95. .divider-vertical {
  96. width: 1px;
  97. height: 38px;
  98. background-color: #cbd5e1;
  99. }
  100.  
  101. /* Tabela wyników */
  102. .table-container {
  103. width: 100%;
  104. border-radius: 12px;
  105. overflow: hidden;
  106. border: 1px solid #e2e8f0;
  107. margin-bottom: 30px;
  108. }
  109.  
  110. table {
  111. width: 100%;
  112. border-collapse: collapse;
  113. text-align: center;
  114. background: #ffffff;
  115. }
  116.  
  117. thead th {
  118. background-color: #0b3967;
  119. color: #ffffff;
  120. padding: 16px 14px;
  121. font-size: 16px;
  122. font-weight: 600;
  123. letter-spacing: 0.2px;
  124. }
  125.  
  126. tbody tr {
  127. border-bottom: 1px solid #edf2f7;
  128. transition: background-color 0.15s;
  129. }
  130.  
  131. tbody tr:last-child {
  132. border-bottom: none;
  133. }
  134.  
  135. tbody td {
  136. padding: 18px 12px;
  137. font-size: 18px;
  138. color: #1e293b;
  139. vertical-align: middle;
  140. }
  141.  
  142. .task-cell {
  143. font-size: 20px;
  144. font-weight: 500;
  145. letter-spacing: 0.5px;
  146. }
  147.  
  148. .ans-cell {
  149. font-size: 20px;
  150. font-weight: 500;
  151. }
  152.  
  153. /* Numer zadania w kwadracie z zaokrąglonymi rogami */
  154. .badge-nr {
  155. display: inline-flex;
  156. justify-content: center;
  157. align-items: center;
  158. width: 38px;
  159. height: 38px;
  160. background-color: #3b4b5e;
  161. color: #ffffff;
  162. font-size: 18px;
  163. font-weight: 700;
  164. border-radius: 8px;
  165. }
  166.  
  167. /* Statusy (poprawna / błędna) */
  168. .status-badge {
  169. display: inline-flex;
  170. align-items: center;
  171. gap: 6px;
  172. font-size: 15px;
  173. font-weight: 500;
  174. }
  175.  
  176. .status-badge.ok {
  177. color: #43a047;
  178. }
  179.  
  180. .status-badge.err {
  181. color: #e53935;
  182. }
  183.  
  184. .icon-circle {
  185. display: inline-flex;
  186. align-items: center;
  187. justify-content: center;
  188. width: 22px;
  189. height: 22px;
  190. border-radius: 50%;
  191. color: #ffffff;
  192. font-size: 13px;
  193. font-weight: bold;
  194. }
  195.  
  196. .icon-circle.ok {
  197. background-color: #8bc34a;
  198. }
  199.  
  200. .icon-circle.err {
  201. background-color: #e53935;
  202. }
  203.  
  204. /* Przycisk akcji */
  205. .action-btn {
  206. width: 100%;
  207. background-color: #0b3967;
  208. color: #ffffff;
  209. font-size: 18px;
  210. font-weight: 600;
  211. padding: 16px 20px;
  212. border: none;
  213. border-radius: 8px;
  214. cursor: pointer;
  215. transition: background-color 0.2s, transform 0.05s;
  216. }
  217.  
  218. .action-btn:hover {
  219. background-color: #072747;
  220. }
  221.  
  222. .action-btn:active {
  223. transform: scale(0.99);
  224. }
  225.  
  226. /* Ekran aktywnego testu */
  227. .quiz-card {
  228. width: 100%;
  229. background: #fbfcfd;
  230. border: 1px solid #e2e8f0;
  231. border-radius: 18px;
  232. padding: 40px 24px;
  233. margin-bottom: 24px;
  234. }
  235.  
  236. .quiz-progress {
  237. font-size: 16px;
  238. color: #64748b;
  239. margin-bottom: 12px;
  240. font-weight: 500;
  241. }
  242.  
  243. .quiz-question {
  244. font-size: 38px;
  245. font-weight: 700;
  246. color: #0f172a;
  247. margin: 20px 0 28px 0;
  248. }
  249.  
  250. .quiz-input {
  251. font-size: 26px;
  252. text-align: center;
  253. padding: 12px 18px;
  254. width: 180px;
  255. border: 2px solid #cbd5e1;
  256. border-radius: 10px;
  257. outline: none;
  258. transition: border-color 0.2s;
  259. }
  260.  
  261. .quiz-input:focus {
  262. border-color: #0284c7;
  263. }
  264.  
  265. .hidden {
  266. display: none;
  267. }
  268. </style>
  269. </head>
  270. <body>
  271.  
  272. <div class="app-card">
  273. <h1 class="title">Egzamin Online</h1>
  274.  
  275. <!-- WIDOK TRWAJĄCEGO EGZAMINU -->
  276. <div id="view-exam" class="quiz-card">
  277. <div id="exam-progress" class="quiz-progress">Zadanie 1 z 10</div>
  278. <div id="exam-question" class="quiz-question">7 × 3 = ?</div>
  279. <form id="quiz-form">
  280. <input
  281. type="number"
  282. id="quiz-input"
  283. class="quiz-input"
  284. placeholder="?"
  285. required
  286. autocomplete="off"
  287. autofocus
  288. />
  289. <div style="margin-top: 25px;">
  290. <button type="submit" class="action-btn" style="max-width: 240px;">Dalej</button>
  291. </div>
  292. </form>
  293. </div>
  294.  
  295. <!-- WIDOK PODSUMOWANIA I WYNIKÓW -->
  296. <div id="view-results" class="hidden" style="width: 100%;">
  297. <div id="result-feedback" class="subtitle-msg"></div>
  298. <div id="result-time" class="subtitle-time"></div>
  299.  
  300. <!-- Karta punktów -->
  301. <div class="summary-card">
  302. <div class="stat-item">
  303. <span class="dot"></span>
  304. <span>Poprawne odpowiedzi</span>
  305. <span id="correct-count" class="stat-val">10/10</span>
  306. </div>
  307. <div class="divider-vertical"></div>
  308. <div class="stat-item">
  309. <span class="dot"></span>
  310. <span>Wynik</span>
  311. <span id="percentage-score" class="stat-val">100%</span>
  312. </div>
  313. </div>
  314.  
  315. <!-- Tabela -->
  316. <div class="table-container">
  317. <table>
  318. <thead>
  319. <tr>
  320. <th style="width: 12%;">Nr</th>
  321. <th style="width: 38%;">Zadanie</th>
  322. <th style="width: 25%;">Twoje odpowiedzi</th>
  323. <th style="width: 25%;">Status</th>
  324. </tr>
  325. </thead>
  326. <tbody id="results-body"></tbody>
  327. </table>
  328. </div>
  329.  
  330. <button id="btn-restart" class="action-btn">Rozpocznij jeszcze raz</button>
  331. </div>
  332. </div>
  333.  
  334. <script>
  335. const TOTAL_QUESTIONS = 10;
  336. const TIME_LIMIT = 60;
  337.  
  338. let questions = [];
  339. let currentIndex = 0;
  340. let startTime = null;
  341.  
  342. // Losowanie liczb całkowitych w przedziale [min, max]
  343. function randRange(min, max) {
  344. return Math.floor(Math.random() * (max - min + 1)) + min;
  345. }
  346.  
  347. // Generator 10 zadań bez mnożenia przez 1, 2 oraz 10 (zakres czynników 3-9)
  348. function generateExamQuestions() {
  349. const list = [];
  350. for (let i = 0; i < TOTAL_QUESTIONS; i++) {
  351. const a = randRange(3, 9);
  352. const b = randRange(3, 9);
  353. const product = a * b;
  354. const pattern = randRange(1, 5);
  355.  
  356. let taskStr = "";
  357. let expected = 0;
  358.  
  359. switch (pattern) {
  360. case 1: // 7 × 3 = ?
  361. taskStr = `${a} × ${b} = ?`;
  362. expected = product;
  363. break;
  364. case 2: // ? = 8 × 9
  365. taskStr = `? = ${a} × ${b}`;
  366. expected = product;
  367. break;
  368. case 3: // 7 = 49 ÷ ?
  369. taskStr = `${a} = ${product} ÷ ?`;
  370. expected = b;
  371. break;
  372. case 4: // ? ÷ 7 = 4
  373. taskStr = `? ÷ ${a} = ${b}`;
  374. expected = product;
  375. break;
  376. case 5: // 9 × ? = 63
  377. taskStr = `${a} × ? = ${product}`;
  378. expected = b;
  379. break;
  380. }
  381.  
  382. list.push({
  383. task: taskStr,
  384. expected: expected,
  385. userAnswer: null
  386. });
  387. }
  388. return list;
  389. }
  390.  
  391. function renderQuestion() {
  392. const item = questions[currentIndex];
  393. document.getElementById("exam-progress").textContent = `Zadanie ${currentIndex + 1} z ${TOTAL_QUESTIONS}`;
  394. document.getElementById("exam-question").textContent = item.task;
  395. const inp = document.getElementById("quiz-input");
  396. inp.value = "";
  397. inp.focus();
  398. }
  399.  
  400. function showResults() {
  401. const totalSeconds = Math.round((new Date() - startTime) / 1000);
  402. const correctCount = questions.filter(q => Number(q.userAnswer) === q.expected).length;
  403. const percentage = Math.round((correctCount / TOTAL_QUESTIONS) * 100);
  404.  
  405. document.getElementById("view-exam").classList.add("hidden");
  406. document.getElementById("view-results").classList.remove("hidden");
  407.  
  408. // Logika komentarzy zależna od czasu i trafień
  409. let msg = "";
  410. if (correctCount === TOTAL_QUESTIONS && totalSeconds <= TIME_LIMIT) {
  411. if (totalSeconds <= 20) {
  412. msg = "Błyskawiczny refleks! Niewiarygodne tempo – otrzymujesz tytuł Arcymistrza Tabliczki Mnożenia!";
  413. } else if (totalSeconds <= 30) {
  414. msg = "Rewelacyjny wynik! Otrzymujesz tytuł Mistrza Tabliczki Mnożenia.";
  415. } else if (totalSeconds <= 40) {
  416. msg = "Gratulacje, zdałeś egzamin – otrzymujesz tytuł Experta Tabliczki Mnożenia!";
  417. } else if (totalSeconds <= 50) {
  418. msg = "Gratulacje, egzamin zaliczony! Bardzo dobra znajomość tabliczki mnożenia.";
  419. } else {
  420. msg = "Egzamin zdany rzutem na taśmę! Wszystkie odpowiedzi bezbłędne.";
  421. }
  422. } else if (correctCount === TOTAL_QUESTIONS && totalSeconds > TIME_LIMIT) {
  423. msg = `Wszystkie odpowiedzi poprawne, lecz limit czasu (${TIME_LIMIT} s) został przekroczony. Poćwicz tempo liczenia!`;
  424. } else {
  425. if (correctCount >= 8) {
  426. msg = "Egzamin niezdany – było bardzo blisko! Przeanalizuj błędy i spróbuj ponownie.";
  427. } else {
  428. msg = "Egzamin niezdany. Aby zdobyć tytuł Experta, wymagane jest 100% poprawnych odpowiedzi.";
  429. }
  430. }
  431.  
  432. document.getElementById("result-feedback").textContent = msg;
  433. document.getElementById("result-time").textContent = `Twój czas to ${totalSeconds} sekund`;
  434. document.getElementById("correct-count").textContent = `${correctCount}/${TOTAL_QUESTIONS}`;
  435. document.getElementById("percentage-score").textContent = `${percentage}%`;
  436.  
  437. // Wypełnienie tabeli
  438. const tbody = document.getElementById("results-body");
  439. tbody.innerHTML = "";
  440.  
  441. questions.forEach((q, idx) => {
  442. const isCorrect = Number(q.userAnswer) === q.expected;
  443. const row = document.createElement("tr");
  444.  
  445. const statusHTML = isCorrect
  446. ? `<span class="status-badge ok"><span class="icon-circle ok">&#10003;</span> Poprawna</span>`
  447. : `<span class="status-badge err"><span class="icon-circle err">&#10005;</span> Błędna (${q.expected})</span>`;
  448.  
  449. row.innerHTML = `
  450. <td><span class="badge-nr">${idx + 1}</span></td>
  451. <td class="task-cell">${q.task}</td>
  452. <td class="ans-cell">${q.userAnswer !== null ? q.userAnswer : "-"}</td>
  453. <td>${statusHTML}</td>
  454. `;
  455. tbody.appendChild(row);
  456. });
  457. }
  458.  
  459. document.getElementById("quiz-form").addEventListener("submit", function(e) {
  460. e.preventDefault();
  461. const val = document.getElementById("quiz-input").value.trim();
  462. questions[currentIndex].userAnswer = val;
  463.  
  464. currentIndex++;
  465. if (currentIndex < TOTAL_QUESTIONS) {
  466. renderQuestion();
  467. } else {
  468. showResults();
  469. }
  470. });
  471.  
  472. document.getElementById("btn-restart").addEventListener("click", function() {
  473. initExam();
  474. });
  475.  
  476. function initExam() {
  477. questions = generateExamQuestions();
  478. currentIndex = 0;
  479. startTime = new Date();
  480. document.getElementById("view-results").classList.add("hidden");
  481. document.getElementById("view-exam").classList.remove("hidden");
  482. renderQuestion();
  483. }
  484.  
  485. // Start od razu po otwarciu strony
  486. initExam();
  487. </script>
  488. </body>
  489. </html>
Advertisement
Add Comment
Please, Sign In to add comment