File size: 16,483 Bytes
e25fffc
ad792a4
 
 
 
24ef1b8
a6c9f20
ec62e6a
 
 
ad792a4
a6c9f20
 
 
ad792a4
ec62e6a
 
 
 
 
 
 
 
a6c9f20
ec62e6a
 
 
 
 
 
 
 
 
 
 
ad792a4
a6c9f20
 
 
 
ad792a4
 
ec62e6a
 
a6c9f20
 
ad792a4
ec62e6a
 
 
ad792a4
a6c9f20
 
ec62e6a
 
 
 
ad792a4
a6c9f20
 
 
 
 
 
 
 
 
 
 
 
 
ec62e6a
a6c9f20
 
ad792a4
a6c9f20
 
 
 
 
ec62e6a
a6c9f20
 
 
 
 
 
 
 
 
 
ec62e6a
a6c9f20
 
 
 
ad792a4
a6c9f20
 
 
 
 
 
 
24ef1b8
a6c9f20
 
 
 
 
 
 
 
ad792a4
a6c9f20
 
 
 
ad792a4
 
 
a6c9f20
299c958
 
a6c9f20
ec62e6a
 
 
24ef1b8
 
 
a6c9f20
ec62e6a
06c1561
ec62e6a
 
24ef1b8
 
a6c9f20
24ef1b8
ec62e6a
8b9ffc0
ec62e6a
 
24ef1b8
a6c9f20
24ef1b8
ec62e6a
8b9ffc0
ec62e6a
 
24ef1b8
a6c9f20
ec62e6a
8b9ffc0
ec62e6a
 
 
a6c9f20
24ef1b8
ec62e6a
8b9ffc0
ec62e6a
 
 
a6c9f20
ec62e6a
8b9ffc0
684978f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24ef1b8
ec62e6a
684978f
8b9ffc0
ec62e6a
a6c9f20
ec62e6a
a6c9f20
 
ad792a4
a6c9f20
 
1950ad3
 
a6c9f20
 
 
ad792a4
a6c9f20
 
 
ad792a4
a6c9f20
 
 
 
684978f
 
 
 
 
 
ec62e6a
a6c9f20
 
 
 
 
 
 
684978f
 
 
 
 
 
 
a6c9f20
 
684978f
 
 
 
 
 
 
a6c9f20
24ef1b8
7c3ae9a
a6c9f20
 
 
 
 
 
 
 
 
 
 
 
06c1561
a6c9f20
1950ad3
 
684978f
1950ad3
a6c9f20
 
 
 
06c1561
a6c9f20
684978f
a6c9f20
 
 
 
 
 
 
 
 
684978f
 
 
 
 
 
 
a6c9f20
 
684978f
a6c9f20
 
 
 
 
 
 
684978f
 
 
 
 
 
 
a6c9f20
 
 
684978f
a6c9f20
684978f
a6c9f20
 
 
 
684978f
a6c9f20
684978f
 
 
 
 
 
a6c9f20
684978f
a6c9f20
684978f
a6c9f20
 
 
 
 
 
 
 
 
684978f
 
 
 
 
 
a6c9f20
 
 
 
ad792a4
e25fffc
ad792a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Edu Assess Pro - smart Exam Paper Designer</title>
  <!-- Poppins 400/600/700 -->
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
  <style>
    /* =======================
       1) Design Tokens (exact)
       ======================= */
    :root{
      --primary-color-start: #4F46E5;
      --primary-color-end: #8B5CF6;
      --background-color: #f8f9fc;
      --container-bg: #ffffff;
      --text-color: #1f2937;
      --label-color: #374151;
      --border-color: #d1d5db;
      --shadow-color: rgba(0, 0, 0, 0.08);
      /* Fixed colors (don’t change) */
      --fixed-outer-border: #e5e7eb;
      --fixed-subtitle: #6b7280;
      --fixed-inputs-bg: #f9fafb;
      --fixed-text-on-primary: #fff;
      --fixed-focus-shadow: rgba(79,70,229,.15);
      --fixed-btn-shadow: rgba(0,0,0,.10);
      --fixed-btn-hover-shadow: rgba(0,0,0,.15);
      --fixed-secondary-bg: #111827;
      --fixed-pre-bg: #0f172a;
      --fixed-pre-border: #1f2937;
      --fixed-toast-shadow: rgba(0,0,0,.2);
    }

    /* =======================
       2) Base Layout & Typography
       ======================= */
    html,body{height:100%}
    body{
      padding:1rem; display:flex; justify-content:center; align-items:flex-start;
      min-height:100vh; background:var(--background-color); color:var(--text-color);
      font-family:"Poppins", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
      font-size:1rem;
    }
    .container{
      max-width:820px; width:100%; background:var(--container-bg); padding:2rem; border-radius:16px;
      box-shadow:0 10px 30px var(--shadow-color); border:1px solid var(--fixed-outer-border);
    }
    @media (max-width:600px){ .container{ padding:1.25rem; } }

    h1{
      font-size:2rem; font-weight:700; margin:0 0 .75rem 0; text-align:center;
      background:linear-gradient(90deg,var(--primary-color-start),var(--primary-color-end));
      -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
    }
    .subtitle{ font-size:.9rem; color:var(--fixed-subtitle); text-align:center; margin-bottom:.75rem; }

    label{ font-weight:600; color:var(--label-color); margin-top:1rem; margin-bottom:.4rem; font-size:.95rem; display:block; }

    .row{ display:grid; grid-template-columns:1fr 1fr; gap:.75rem 1rem; }
    .actions{ display:grid; grid-template-columns:1fr 1fr; gap:.75rem; margin-top:1.25rem; }

    /* =======================
       4) Inputs / Textareas / Selects (uniform)
       ======================= */
    .field, select, textarea{
      width:100%; padding:.8rem 1rem; border-radius:10px; border:1px solid var(--border-color);
      background:var(--fixed-inputs-bg); transition:all .2s; font-size:1rem;
    }
    .field:focus, select:focus, textarea:focus{
      outline:none; border-color:var(--primary-color-start); box-shadow:0 0 0 3px var(--fixed-focus-shadow); background:#fff;
    }

    /* Select (custom chevron) */
    select{
      -webkit-appearance:none; -moz-appearance:none; appearance:none;
      padding-right:2.25rem;
      background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none"><path d="M6 8l4 4 4-4" stroke="%234F46E5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
      background-repeat:no-repeat; background-position:right .75rem center; background-size:14px;
    }
    select::-ms-expand{ display:none; }
    select:disabled{ opacity:.6; cursor:not-allowed; }

    textarea{ min-height:110px; resize:vertical; }

    /* =======================
       5) Buttons
       ======================= */
    .btn{
      display:inline-flex; align-items:center; justify-content:center; gap:.5rem; cursor:pointer; user-select:none;
      background:linear-gradient(90deg, var(--primary-color-start), var(--primary-color-end));
      color:var(--fixed-text-on-primary); padding:.9rem 1.2rem; border:none; border-radius:10px; width:100%;
      font-weight:700; font-size:1.05rem; box-shadow:0 4px 15px var(--fixed-btn-shadow); transition:transform .15s ease, box-shadow .15s ease;
    }
    .btn:hover{ transform:translateY(-2px); box-shadow:0 7px 20px var(--fixed-btn-hover-shadow); }
    .btn:active{ transform:translateY(0); }
    .btn.secondary{ background:var(--fixed-secondary-bg); }

    /* =======================
       6) Output & Toast
       ======================= */
    pre#output{
      background:var(--fixed-pre-bg); color:#e5e7eb; padding:1rem 1.25rem; border-radius:12px; margin-top:1rem;
      border:1px solid var(--fixed-pre-border); font-size:.92rem; line-height:1.6; white-space:pre-wrap; word-break:break-word;
    }

    .toast{
      position:fixed; right:16px; bottom:16px; background:var(--fixed-secondary-bg); color:#fff;
      padding:10px 12px; border-radius:10px; box-shadow:0 8px 20px var(--fixed-toast-shadow);
      opacity:0; transform:translateY(10px); transition:opacity .2s, transform .2s; z-index:50;
    }
    .toast.show{ opacity:1; transform:translateY(0); }

    /* A hidden test log area (will not alter layout) */
    #testlog{ display:none; }
  </style>
</head>
<body>
  <div class="container" role="application" aria-label="Prompt builder">
    <h1>EduPaper Pro -  Exam Paper Designer</h1>
    <p class="subtitle">Fill the fields to generate a <strong> text prompt</strong></p>

    <div class="row">
      <div>
        <label for="grade">Grade</label>
        <select id="grade" class="field">
          <option>Grade 1</option><option>Grade 2</option><option>Grade 3</option><option>Grade 4</option>
          <option>Grade 5</option><option>Grade 6</option><option>Grade 7</option><option>Grade 8</option>
          <option selected>Grade 9</option><option>Grade 10</option><option>Grade 11</option><option>Grade 12</option>
        </select>
      </div>
      <div>
        <label for="subject">Subject</label>
        <select id="subject" class="field">
          <option>Mathematics</option><option>English</option><option>Urdu</option><option>Science</option>
          <option selected>Physics</option><option>Chemistry</option><option>Biology</option><option>Computer Science</option>
          <option>Islamiat</option><option>Pakistan Studies</option>
        </select>
      </div>
      <div>
        <label for="board">Board</label>
        <select id="board" class="field">
          <option>PCTB (Punjab)</option><option selected>FBISE (Federal)</option><option>Sindh Board</option>
          <option>KPK Board</option><option>Balochistan Board</option><option>AKUEB</option>
        </select>
      </div>
      <div>
        <label for="testType">Test Type</label>
        <select id="testType" class="field">
          <option selected>Formative</option><option>Summative</option><option>Diagnostic</option>
        </select>
      </div>
      <div>
        <label for="questionType">Question Type</label>
        <select id="questionType" class="field">
          <option selected>MCQs</option><option>Short Questions</option><option>Long Questions</option>
          <option>Practical/Diagram</option><option>Moral/Ethical</option><option>Islamic</option>
        </select>
      </div>
      <div>
        <label for="duration">Duration</label>
        <select id="duration" class="field">
          <option>30 minutes</option><option selected>45 minutes</option><option>60 minutes</option>
        </select>
      </div>
      <div>
        <label for="language">Language of Paper</label>
        <select id="language" class="field">
          <option value="">β€” Select β€”</option>
          <option>English</option>
          <option>Urdu</option>
          <option>Bilingual</option>
        </select>
      </div>
      <div>
        <label for="bloom">Bloom's Taxonomy</label>
        <select id="bloom" class="field">
          <option value="no" selected>No</option>
          <option value="yes">Yes (Varied Levels)</option>
        </select>
      </div>
      <div>
        <label for="bloomLevel">Bloom Level Emphasis (optional)</label>
        <select id="bloomLevel" class="field">
          <option value="">β€” Not specified β€”</option>
          <option>Knowledge</option>
          <option>Comprehension</option>
          <option>Application</option>
          <option>Analysis</option>
          <option>Synthesis</option>
          <option>Evaluation</option>
          <option>Mixed/Varied</option>
        </select>
      </div>
      <div>
        <label for="mcqSelect">How many MCQs?</label>
        <select id="mcqSelect" class="field">
          <option value="">β€” Select β€”</option>
          <option>10</option><option>15</option><option>20</option><option>25</option><option>30</option>
        </select>
      </div>
      <div>
        <label for="mcqCustom">Custom MCQs (optional)</label>
        <input id="mcqCustom" class="field" type="number" min="1" step="1" placeholder="e.g., 18" />
      </div>
      <div>
        <label for="difficulty">Difficulty (optional)</label>
        <select id="difficulty" class="field">
          <option value="">β€” Not specified β€”</option>
          <option>Easy</option><option>Moderate</option><option>Hard</option><option>Mixed</option>
        </select>
      </div>
      <div style="grid-column:1/-1">
        <label for="topic">Topic (optional)</label>
        <input id="topic" class="field" type="text" placeholder="Units 3–4" />
      </div>
    </div>

    <div class="actions">
      <button id="gen" class="btn" type="button" aria-label="Generate prompt from form">Generate Prompt</button>
      <button id="copy" class="btn secondary" type="button" aria-label="Copy full prompt and open GPT">Copy Prompt and Paste Now</button>
    </div>

    <div class="actions" style="grid-template-columns:auto; justify-items:end; margin-top:.75rem">
      <a id="open-gpt-fallback" href="https://chatgpt.com/g/g-68697e4c49508191b175d86830b34d85-eduassess-pro-smart-exam-paper-designer" target="_blank" rel="noopener noreferrer" class="btn secondary" style="display:none; width:auto; min-width:14ch; padding:.7rem 1rem;">Open GPT</a>
    </div>

    <pre id="output" aria-live="polite" aria-atomic="true"></pre>
    <pre id="testlog"></pre>
  </div>

  <div id="toast" class="toast" role="status" aria-live="polite">Copied!</div>

  <script>
    // ===== Config & helpers =====
    const CUSTOM_GPT_URL = "https://chatgpt.com/g/g-68697e4c49508191b175d86830b34d85-eduassess-pro-smart-exam-paper-designer";
    const $ = (s)=>document.querySelector(s);

    function normalizeInt(v){
      const n = parseInt(v, 10);
      return Number.isFinite(n) && n > 0 ? n : null;
    }

    // Build plain-text prompt
    function buildPrompt(){
      const grade = $('#grade').value;
      const subject = $('#subject').value;
      const board = $('#board').value;
      const testType = $('#testType').value;
      const questionType = $('#questionType').value;
      const duration = $('#duration').value;
      const topic = ($('#topic').value || '').trim();
      const language = $('#language').value; // may be '' (not specified)
      const bloom = $('#bloom').value; // 'yes' | 'no'
      const bloomLevel = $('#bloomLevel').value; // '' or specific
      const mcqSel = normalizeInt($('#mcqSelect').value);
      const mcqCustom = normalizeInt($('#mcqCustom').value);
      const mcqs = mcqCustom ?? mcqSel; // custom overrides select
      const difficulty = $('#difficulty').value; // may be ''

      let p = `I need a ${testType} paper for ${grade} - ${subject}, Board: ${board}.`;
      p += ` Question Type: ${questionType}.`;
      if(duration) p += ` Duration: ${duration}.`;
      if(typeof mcqs === 'number') p += ` MCQs: ${mcqs}.`;
      if(language) p += ` Language: ${language}.`;
      if(bloom === 'yes') p += ` Include Bloom's taxonomy: Yes.`;
      if(bloomLevel) p += ` Bloom emphasis: ${bloomLevel}.`;
      if(difficulty) p += ` Difficulty: ${difficulty}.`;
      if(topic) p += ` Topic: ${topic}.`;
      return p;
    }

    function showToast(msg){
      const t = $('#toast');
      t.textContent = msg;
      t.classList.add('show');
      setTimeout(()=>t.classList.remove('show'), 1800);
    }

    // ===== UI actions =====
    $('#gen').addEventListener('click', ()=>{
      const prompt = buildPrompt();
      $('#output').textContent = prompt; // plain text prompt output
    });

    $('#copy').addEventListener('click', async ()=>{
      const prompt = $('#output').textContent || buildPrompt();
      // Try to open immediately (user gesture)
      const popup = window.open(CUSTOM_GPT_URL, '_blank', 'noopener,noreferrer');
      try{ await navigator.clipboard.writeText(prompt); }catch(e){}
      showToast(popup ? 'Copied & Opening GPT...' : 'Copied! Tap Open GPT');
      const link = $('#open-gpt-fallback');
      if(link){ link.style.display = 'inline-flex'; link.focus(); }
    });

    // ===== Minimal tests (keep old behavior intact) =====
    (function runTests(){
      const log = [];
      const save = {
        grade: $('#grade').value,
        subject: $('#subject').value,
        board: $('#board').value,
        testType: $('#testType').value,
        questionType: $('#questionType').value,
        duration: $('#duration').value,
        topic: $('#topic').value,
        language: $('#language').value,
        bloom: $('#bloom').value,
        bloomLevel: $('#bloomLevel').value,
        mcqSelect: $('#mcqSelect').value,
        mcqCustom: $('#mcqCustom').value,
        difficulty: $('#difficulty').value
      };

      // Ensure new fields do NOT change legacy prompt when left blank/No
      $('#grade').value = 'Grade 9';
      $('#subject').value = 'Physics';
      $('#board').value = 'FBISE (Federal)';
      $('#testType').value = 'Formative';
      $('#questionType').value = 'MCQs';
      $('#duration').value = '45 minutes';
      $('#topic').value = '';
      $('#language').value = '';
      $('#bloom').value = 'no';
      $('#bloomLevel').value = '';
      $('#mcqSelect').value = '';
      $('#mcqCustom').value = '';
      $('#difficulty').value = '';

      let out = buildPrompt();
      const expected1 = 'I need a Formative paper for Grade 9 - Physics, Board: FBISE (Federal). Question Type: MCQs. Duration: 45 minutes.';
      console.assert(out === expected1, 'Test 1 failed', {out, expected1});
      log.push((out === expected1 ? 'βœ…' : '❌') + ' Test 1: legacy prompt unchanged');

      // Test 2: With topic only
      $('#topic').value = 'Unit 2 (Dynamics)';
      out = buildPrompt();
      const expected2 = expected1 + ' Topic: Unit 2 (Dynamics).';
      console.assert(out === expected2, 'Test 2 failed', {out, expected2});
      log.push((out === expected2 ? 'βœ…' : '❌') + ' Test 2: topic appends');

      // Test 3: New fields engaged
      $('#language').value = 'English';
      $('#bloom').value = 'yes';
      $('#bloomLevel').value = 'Application';
      $('#mcqSelect').value = '20';
      $('#difficulty').value = 'Moderate';
      out = buildPrompt();
      const expected3 = expected2 + ' MCQs: 20. Language: English. Include Bloom\'s taxonomy: Yes. Bloom emphasis: Application. Difficulty: Moderate.';
      console.assert(out === expected3, 'Test 3 failed', {out, expected3});
      log.push((out === expected3 ? 'βœ…' : '❌') + ' Test 3: new fields appended');

      // Restore original values
      $('#grade').value = save.grade;
      $('#subject').value = save.subject;
      $('#board').value = save.board;
      $('#testType').value = save.testType;
      $('#questionType').value = save.questionType;
      $('#duration').value = save.duration;
      $('#topic').value = save.topic;
      $('#language').value = save.language;
      $('#bloom').value = save.bloom;
      $('#bloomLevel').value = save.bloomLevel;
      $('#mcqSelect').value = save.mcqSelect;
      $('#mcqCustom').value = save.mcqCustom;
      $('#difficulty').value = save.difficulty;

      const tl = document.getElementById('testlog');
      if(tl){ tl.textContent = log.join('\n'); }
    })();
  </script>
</body>
</html>