Nuzwa commited on
Commit
722e702
·
verified ·
1 Parent(s): 921db20

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +437 -0
index.html CHANGED
@@ -0,0 +1,437 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>coachproai • CourseMaster Pro</title>
7
+ <style>
8
+ :root {
9
+ --primary-purple: #8A2BE2;
10
+ --accent-purple: #F3E5F5;
11
+ --text-color-main: #6A1B9A;
12
+ --button-border: #D1C4E9;
13
+ --input-border: #d9d4e0;
14
+ font-family: Arial, Helvetica, sans-serif;
15
+ color-scheme: light;
16
+ }
17
+ *, *::before, *::after { box-sizing: border-box; }
18
+ html { margin: 0; min-height: 100%; -webkit-text-size-adjust: 100%; }
19
+ body { margin: 0; min-height: 100%; color: #333; background: #fff; font-size: 16px; line-height: 1.6; }
20
+ button, input, select, textarea { font: inherit; }
21
+ .app {
22
+ display: grid;
23
+ grid-template-columns: minmax(0, 1fr);
24
+ gap: 20px;
25
+ width: 100%;
26
+ max-width: none;
27
+ min-height: 100vh;
28
+ min-height: 100dvh;
29
+ padding: clamp(16px, 3vw, 48px);
30
+ border-top: 5px solid var(--primary-purple);
31
+ background: #faf9fc;
32
+ }
33
+ html.is-embedded .app { min-height: 0; }
34
+ .app > *, .options > *, .settings-grid > * { min-width: 0; }
35
+ h1 { margin: 0; color: var(--primary-purple); font-size: clamp(25px, 3vw, 42px); line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
36
+ .subtitle { margin: -8px 0 4px; color: #666; text-align: center; font-size: 15px; }
37
+ .top-input, .group, .notes, .response {
38
+ margin: 0;
39
+ padding: clamp(16px, 2vw, 24px);
40
+ border: 1px solid var(--button-border);
41
+ border-radius: 14px;
42
+ background: #fff;
43
+ }
44
+ .options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
45
+ .settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
46
+ .label { display: block; margin: 0 0 10px; color: var(--text-color-main); font-size: 16px; font-weight: 600; }
47
+ .input, select, textarea {
48
+ display: block;
49
+ width: 100%;
50
+ max-width: 100%;
51
+ min-width: 0;
52
+ min-height: 48px;
53
+ padding: 12px 14px;
54
+ border: 1px solid var(--input-border);
55
+ border-radius: 9px;
56
+ background: #fff;
57
+ color: #333;
58
+ font-size: 16px;
59
+ }
60
+ textarea { min-height: 160px; resize: vertical; }
61
+ .input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-purple); outline-offset: 2px; }
62
+ .toggles { display: flex; flex-wrap: wrap; gap: 8px; }
63
+ .toggle {
64
+ flex: 1 1 120px;
65
+ min-width: 0;
66
+ max-width: 100%;
67
+ min-height: 46px;
68
+ padding: 10px 12px;
69
+ border: 1px solid var(--button-border);
70
+ border-radius: 9px;
71
+ color: var(--primary-purple);
72
+ background: #fff;
73
+ font-size: 15px;
74
+ font-weight: 600;
75
+ line-height: 1.4;
76
+ text-align: center;
77
+ white-space: normal;
78
+ overflow-wrap: anywhere;
79
+ cursor: pointer;
80
+ }
81
+ .toggle[aria-pressed="true"] { border-color: var(--primary-purple); background: var(--primary-purple); color: #fff; }
82
+ button:focus-visible, a:focus-visible { outline: 3px solid var(--primary-purple); outline-offset: 3px; }
83
+ .out {
84
+ margin: 0;
85
+ padding: 16px;
86
+ min-height: 160px;
87
+ max-width: 100%;
88
+ border: 1px solid var(--button-border);
89
+ border-radius: 9px;
90
+ background: var(--accent-purple);
91
+ color: #4b2463;
92
+ font: 15px/1.7 ui-monospace, Consolas, monospace;
93
+ white-space: pre-wrap;
94
+ overflow-wrap: anywhere;
95
+ word-break: normal;
96
+ }
97
+ .cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
98
+ .btn {
99
+ display: inline-flex;
100
+ justify-content: center;
101
+ align-items: center;
102
+ width: 100%;
103
+ min-width: 0;
104
+ min-height: 52px;
105
+ padding: 12px 16px;
106
+ border: 2px solid var(--primary-purple);
107
+ border-radius: 10px;
108
+ background: var(--primary-purple);
109
+ color: #fff;
110
+ font-size: 17px;
111
+ font-weight: 600;
112
+ line-height: 1.4;
113
+ white-space: normal;
114
+ overflow-wrap: anywhere;
115
+ cursor: pointer;
116
+ }
117
+ .btn.hidden, a[hidden] { display: none !important; }
118
+ .hint { margin-top: 12px; min-height: 1.5em; color: var(--text-color-main); font-size: 14px; text-align: center; overflow-wrap: anywhere; }
119
+ .response > a { display: block; padding: 10px; min-height: 44px; overflow-wrap: anywhere; }
120
+ .footer { margin: 0; padding: 4px 0; color: #777; text-align: center; font-size: 14px; }
121
+ @media (hover: hover) {
122
+ .toggle:hover { border-color: var(--primary-purple); background: var(--accent-purple); }
123
+ .toggle[aria-pressed="true"]:hover, .btn:hover { background: #7221bd; color: #fff; }
124
+ }
125
+ @media (min-width: 700px) {
126
+ .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
127
+ .settings-group, .addons-group { grid-column: 1 / -1; }
128
+ .settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
129
+ }
130
+ @media (min-width: 1000px) {
131
+ .app { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-content: start; }
132
+ h1, .subtitle, .top-input, .options, .footer { grid-column: 1 / -1; }
133
+ .options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
134
+ .notes, .response { align-self: start; }
135
+ }
136
+ @media (max-width: 399px) {
137
+ .app { gap: 16px; padding: 12px; }
138
+ .top-input, .group, .notes, .response { padding: 14px; }
139
+ .toggle { flex-basis: 100%; }
140
+ }
141
+ </style>
142
+ </head>
143
+ <body>
144
+ <main class="app" aria-labelledby="title">
145
+ <h1 id="title">CourseMaster Pro</h1>
146
+ <p class="subtitle">Powered by <strong>coachproai</strong></p>
147
+
148
+ <section class="top-input">
149
+ <label class="label" for="topic">Topic</label>
150
+ <input id="topic" class="input" type="text" placeholder="e.g., Personal Branding on Social Media" />
151
+ </section>
152
+
153
+ <section class="options" aria-label="Options">
154
+ <div class="group" role="group" aria-label="Audience">
155
+ <span class="label">Audience</span>
156
+ <div class="toggles" data-name="Audience">
157
+ <button class="toggle" type="button" aria-pressed="false">Students</button>
158
+ <button class="toggle" type="button" aria-pressed="false">Freelancers</button>
159
+ <button class="toggle" type="button" aria-pressed="false">Professionals</button>
160
+ </div>
161
+ </div>
162
+
163
+ <div class="group" role="group" aria-label="Level">
164
+ <span class="label">Level</span>
165
+ <div class="toggles" data-name="Level">
166
+ <button class="toggle" type="button" aria-pressed="false">Beginner</button>
167
+ <button class="toggle" type="button" aria-pressed="false">Intermediate</button>
168
+ <button class="toggle" type="button" aria-pressed="false">Advanced</button>
169
+ </div>
170
+ </div>
171
+
172
+ <div class="group" role="group" aria-label="Delivery">
173
+ <span class="label">Delivery</span>
174
+ <div class="toggles" data-name="Delivery">
175
+ <button class="toggle" type="button" aria-pressed="false">Live</button>
176
+ <button class="toggle" type="button" aria-pressed="false">Recorded</button>
177
+ <button class="toggle" type="button" aria-pressed="false">Hybrid</button>
178
+ <button class="toggle" type="button" aria-pressed="false">Offline</button>
179
+ </div>
180
+ </div>
181
+
182
+ <div class="group" role="group" aria-label="Language">
183
+ <span class="label">Language</span>
184
+ <div class="toggles" data-name="Language">
185
+ <button class="toggle" type="button" aria-pressed="false">Auto</button>
186
+ <button class="toggle" type="button" aria-pressed="false">Urdu</button>
187
+ <button class="toggle" type="button" aria-pressed="false">English</button>
188
+ <button class="toggle" type="button" aria-pressed="false">Mixed</button>
189
+ </div>
190
+ </div>
191
+
192
+ <div class="group" role="group" aria-label="Tone">
193
+ <span class="label">Tone</span>
194
+ <div class="toggles" data-name="Tone">
195
+ <button class="toggle" type="button" aria-pressed="false">Professional</button>
196
+ <button class="toggle" type="button" aria-pressed="false">Motivational</button>
197
+ </div>
198
+ </div>
199
+
200
+ <div class="group" role="group" aria-label="Depth">
201
+ <span class="label">Depth</span>
202
+ <div class="toggles" data-name="Depth">
203
+ <button class="toggle" type="button" aria-pressed="false">Basic</button>
204
+ <button class="toggle" type="button" aria-pressed="false">Standard</button>
205
+ <button class="toggle" type="button" aria-pressed="false">Comprehensive</button>
206
+ </div>
207
+ </div>
208
+
209
+ <div class="group settings-group">
210
+ <div class="settings-grid">
211
+ <div>
212
+ <label for="duration" class="label">Duration</label>
213
+ <input id="duration" class="input" type="text" placeholder="e.g., 8 weeks" />
214
+ </div>
215
+ <div>
216
+ <label for="localization" class="label">Localization</label>
217
+ <select id="localization" class="input">
218
+ <option>Auto</option><option>Pakistan</option><option>GCC</option><option>Global</option>
219
+ </select>
220
+ </div>
221
+ <div>
222
+ <label for="export" class="label">Export</label>
223
+ <select id="export" class="input">
224
+ <option>PDF</option><option>DOCX</option><option>HTML</option>
225
+ </select>
226
+ </div>
227
+ </div>
228
+ </div>
229
+
230
+ <div class="group addons-group" role="group" aria-label="Add-ons">
231
+ <span class="label">Add-ons</span>
232
+ <div class="toggles multi" data-name="Add-ons">
233
+ <button class="toggle" type="button" aria-pressed="false">Include Video Support</button>
234
+ <button class="toggle" type="button" aria-pressed="false">Bloom Mapping</button>
235
+ <button class="toggle" type="button" aria-pressed="false">Assessments</button>
236
+ </div>
237
+ </div>
238
+ </section>
239
+
240
+ <section class="notes">
241
+ <label class="label" for="notes">Notes</label>
242
+ <textarea id="notes" class="input" rows="4" placeholder="Special requirements, target platform, constraints, tools, etc."></textarea>
243
+ </section>
244
+
245
+ <section class="response">
246
+ <span class="label">Prompt Preview</span>
247
+ <pre id="out" class="out" role="status" aria-live="polite">Please select options and enter Topic/Duration...</pre>
248
+ <div class="cta-row">
249
+ <button id="generate" class="btn cta" type="button">Generate Prompt</button>
250
+ <button id="copyOpen" class="btn cta hidden" type="button">Copy &amp; Paste Now</button>
251
+ </div>
252
+ <div class="hint" id="hint" aria-live="polite"></div>
253
+ </section>
254
+
255
+ <div class="footer">© coachproai</div>
256
+ </main>
257
+
258
+ <script>
259
+ // Embedded pages grow to their content; standalone pages fill the viewport.
260
+ if (window.self !== window.top) {
261
+ document.documentElement.classList.add("is-embedded");
262
+ }
263
+ const GPT_URL='https://chatgpt.com/g/g-6864ab7c8c188191b8641483747e63c2-coursemaster-pro';
264
+ const $=s=>document.querySelector(s);
265
+ const $$=(s,root=document)=>Array.from(root.querySelectorAll(s));
266
+
267
+ // Get elements
268
+ const outElement = $("#out");
269
+ const generateButton = $("#generate");
270
+ const copyOpenButton = $("#copyOpen");
271
+
272
+ // Toggle handling
273
+ $$(".toggles").forEach(group=>{
274
+ group.addEventListener("click",e=>{
275
+ if(!e.target.classList.contains("toggle"))return;
276
+ const btn=e.target;
277
+ const isMulti=!group.dataset.name.includes("Add-ons"); // Single selection logic
278
+
279
+ if(isMulti && btn.getAttribute("aria-pressed") !== "true"){
280
+ $$(".toggle",group).forEach(b=>b.setAttribute("aria-pressed","false"));
281
+ }
282
+
283
+ btn.setAttribute("aria-pressed", btn.getAttribute("aria-pressed")==="true" ? "false" : "true");
284
+
285
+ buildPrompt();
286
+ });
287
+ group.addEventListener("keydown",e=>{
288
+ if(!e.target.classList.contains("toggle"))return;
289
+ if(e.key===" "||e.key==="Enter"){ e.preventDefault(); e.target.click(); }
290
+ });
291
+ });
292
+
293
+ let currentPrompt = "";
294
+
295
+ // Function to build and display the prompt (without typewriter for brevity)
296
+ function buildPrompt(){
297
+ const topic=$("#topic").value.trim();
298
+ const duration=$("#duration").value.trim();
299
+ const notes=$("#notes").value.trim();
300
+
301
+ let p=`Create a course plan for "${topic||"<<<Add Topic>>>"}".`;
302
+
303
+ $$(".toggles").forEach(g=>{
304
+ const name=g.dataset.name;
305
+ const sel=$$(".toggle[aria-pressed='true']",g).map(b=>b.textContent.trim());
306
+ if(sel.length>0) p+=`\n- ${name}: ${sel.join(", ")}`;
307
+ });
308
+
309
+ if(duration) p+=`\n- Duration: ${duration}`;
310
+
311
+ const loc=$("#localization").value;
312
+ if(loc && loc!=="Auto") p+=`\n- Localization: ${loc}`;
313
+
314
+ const exp=$("#export").value;
315
+ if(exp) p+=`\n- Export Format: ${exp}`;
316
+
317
+ if(notes) p+=`\n- Notes: ${notes}`;
318
+
319
+ currentPrompt = p.trim();
320
+ outElement.textContent = currentPrompt;
321
+
322
+ // Show/Hide CTA buttons based on valid topic
323
+ if (topic) {
324
+ generateButton.classList.add("hidden");
325
+ copyOpenButton.classList.remove("hidden");
326
+ $("#hint").textContent="Prompt ready! Click 'Copy & Paste Now'";
327
+ } else {
328
+ generateButton.classList.remove("hidden");
329
+ copyOpenButton.classList.add("hidden");
330
+ $("#hint").textContent="Enter a Topic and select options.";
331
+ }
332
+ }
333
+
334
+ // Event listeners for input changes
335
+ $$(".input, .textarea, select").forEach(s=>s.addEventListener("input",buildPrompt));
336
+
337
+ // Initial build to show placeholder
338
+ buildPrompt();
339
+
340
+ // Generate button (in this case, it just runs buildPrompt again)
341
+ generateButton.addEventListener("click", () => {
342
+ buildPrompt();
343
+ if (currentPrompt && currentPrompt.includes("Topic>>>")) {
344
+ $("#hint").textContent = "Please enter a valid Topic!";
345
+ }
346
+ });
347
+
348
+ // Keep a direct link available if a browser blocks the new tab.
349
+ const directOpenLink = document.createElement("a");
350
+ directOpenLink.href = GPT_URL;
351
+ directOpenLink.target = "_blank";
352
+ directOpenLink.rel = "noopener noreferrer";
353
+ directOpenLink.textContent = "Open CourseMaster Pro";
354
+ directOpenLink.style.cssText = "text-align:center;margin-top:12px;color:#8A2BE2;font-weight:bold;";
355
+ directOpenLink.hidden = true;
356
+ $("#hint").after(directOpenLink);
357
+
358
+ function updateDirectLink() {
359
+ directOpenLink.hidden = !$("#topic").value.trim();
360
+ }
361
+ $("#topic").addEventListener("input", updateDirectLink);
362
+ updateDirectLink();
363
+
364
+ // Start copying, then open during the original click without awaiting.
365
+ // Clipboard failure must never prevent the GPT link from opening.
366
+ copyOpenButton.addEventListener("click", async () => {
367
+ const t = currentPrompt;
368
+ if (!t || !$("#topic").value.trim()) {
369
+ $("#hint").textContent = "Please enter a valid Topic!";
370
+ return;
371
+ }
372
+
373
+ let copyTask;
374
+ try {
375
+ copyTask = navigator.clipboard.writeText(t);
376
+ } catch (err) {
377
+ copyTask = Promise.reject(err);
378
+ }
379
+
380
+ let openThrew = false;
381
+ try {
382
+ // Do not place await, a timer, or a network request before this.
383
+ // noopener may return null even when opening succeeds.
384
+ window.open(GPT_URL, "_blank", "noopener,noreferrer");
385
+ } catch (err) {
386
+ openThrew = true;
387
+ }
388
+
389
+ try {
390
+ await copyTask;
391
+ $("#hint").textContent = openThrew
392
+ ? "Copied! Use 'Open CourseMaster Pro' below, then paste your prompt."
393
+ : "Copied! Paste your prompt in CourseMaster Pro. If no tab opened, use the link below.";
394
+ } catch (err) {
395
+ $("#hint").textContent = "Automatic copy was unavailable. Select and copy the Prompt Preview manually, then open CourseMaster Pro using the link below and paste it.";
396
+ }
397
+ });
398
+
399
+ // Initial check for topic and setting up buttons
400
+ if (!$("#topic").value.trim()) {
401
+ copyOpenButton.classList.add("hidden");
402
+ generateButton.textContent = "Generate Prompt";
403
+ generateButton.classList.remove("hidden");
404
+ }
405
+
406
+ // Send only public layout dimensions to the embedding page.
407
+ // The parent validates both this frame's origin and its window reference.
408
+ if (window.self !== window.top) {
409
+ let lastReportedHeight = 0;
410
+ let measureFrame = 0;
411
+ function reportContentHeight() {
412
+ measureFrame = 0;
413
+ const height = Math.ceil(document.querySelector(".app").getBoundingClientRect().height);
414
+ if (height > 0 && height !== lastReportedHeight) {
415
+ lastReportedHeight = height;
416
+ window.parent.postMessage({type: "coursemaster:height", height}, "*");
417
+ }
418
+ }
419
+ function scheduleHeightReport() {
420
+ if (!measureFrame) measureFrame = requestAnimationFrame(reportContentHeight);
421
+ }
422
+ if (typeof ResizeObserver !== "undefined") {
423
+ new ResizeObserver(scheduleHeightReport).observe(document.querySelector(".app"));
424
+ }
425
+ window.addEventListener("resize", scheduleHeightReport);
426
+ window.addEventListener("load", scheduleHeightReport);
427
+ window.addEventListener("message", event => {
428
+ if (event.source === window.parent && event.data?.type === "coursemaster:measure") {
429
+ lastReportedHeight = 0;
430
+ scheduleHeightReport();
431
+ }
432
+ });
433
+ scheduleHeightReport();
434
+ }
435
+ </script>
436
+ </body>
437
+ </html>