openfree commited on
Commit
45ed4b2
ยท
verified ยท
1 Parent(s): 86fdb32

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +218 -356
index.html CHANGED
@@ -3,449 +3,311 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Perceptron Passive Radar</title>
7
  <style>
 
 
 
 
 
 
 
8
  * {
9
  margin: 0;
10
  padding: 0;
11
  box-sizing: border-box;
12
- font-family: monospace;
13
  }
14
 
15
  body {
16
- background: #001;
17
- color: #0f8;
18
  min-height: 100vh;
19
- overflow: hidden;
 
20
  }
21
 
22
- .main-container {
23
- display: grid;
24
- grid-template-columns: 1fr 400px;
25
- gap: 10px;
26
- padding: 10px;
27
- height: 100vh;
 
28
  }
29
 
30
- .radar-container {
31
- position: relative;
32
- border: 2px solid #0f8;
33
- border-radius: 50%;
34
- background: radial-gradient(circle, rgba(0,255,136,0.05) 0%, rgba(0,0,0,0.9) 100%);
35
- overflow: hidden;
36
  }
37
 
38
- .sweep-line {
39
- position: absolute;
40
- top: 50%;
41
- left: 50%;
42
- width: 50%;
43
- height: 2px;
44
- background: linear-gradient(90deg, #0f8, transparent);
45
- transform-origin: left;
46
- animation: radar-sweep 4s linear infinite;
47
  }
48
 
49
- .grid-overlay {
50
- position: absolute;
51
- width: 100%;
52
- height: 100%;
53
- background:
54
- linear-gradient(#0f81 1px, transparent 1px),
55
- linear-gradient(90deg, #0f81 1px, transparent 1px);
56
- background-size: 50px 50px;
57
  }
58
 
59
- @keyframes radar-sweep {
60
- from { transform: rotate(0deg); }
61
- to { transform: rotate(360deg); }
62
  }
63
 
64
- .control-panel {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  display: flex;
66
- flex-direction: column;
67
- gap: 10px;
68
  }
69
 
70
- .panel {
71
- background: rgba(0,255,136,0.1);
72
- border: 1px solid #0f8;
73
- padding: 10px;
 
 
 
74
  }
75
 
76
- .perceptron-layer {
77
- display: flex;
78
- justify-content: space-between;
79
- align-items: center;
80
- height: 200px;
81
- margin: 10px 0;
82
- position: relative;
83
  }
84
 
85
- .layer {
86
- display: flex;
87
- flex-direction: column;
88
- gap: 4px;
 
89
  }
90
 
91
- .neuron {
92
- width: 12px;
93
- height: 12px;
94
- background: #0f8;
95
- border-radius: 50%;
96
- position: relative;
97
- opacity: 0.3;
98
- transition: all 0.2s;
99
  }
100
 
101
- .neuron.active {
102
- opacity: 1;
103
- box-shadow: 0 0 10px #0f8;
104
  }
105
 
106
- .connections {
107
- position: absolute;
108
- width: 100%;
109
- height: 100%;
110
- pointer-events: none;
111
  }
112
 
113
- .spectrum {
114
- height: 120px;
115
- display: flex;
116
- align-items: flex-end;
117
- gap: 2px;
118
  }
119
 
120
- .bar {
121
- flex: 1;
122
- background: #0f8;
123
- transition: height 0.1s;
 
 
 
 
 
 
 
124
  }
125
 
126
- .signal {
127
- position: absolute;
128
- width: 8px;
129
- height: 8px;
130
- background: #0f8;
131
- border-radius: 50%;
132
- transform: translate(-50%, -50%);
 
133
  }
134
 
135
- .signal-echo {
136
- position: absolute;
137
- border: 1px solid #0f8;
 
 
138
  border-radius: 50%;
139
- transform: translate(-50%, -50%);
140
- animation: echo 2s ease-out forwards;
141
  }
142
 
143
- @keyframes echo {
144
- 0% {
145
- width: 8px;
146
- height: 8px;
147
- opacity: 1;
148
- }
149
- 100% {
150
- width: 60px;
151
- height: 60px;
152
- opacity: 0;
153
- }
154
  }
155
 
156
- button {
157
- background: transparent;
158
- border: 1px solid #0f8;
159
- color: #0f8;
160
- padding: 8px;
161
- cursor: pointer;
162
- transition: 0.3s;
163
  }
164
 
165
- button:hover {
166
- background: #0f8;
167
- color: #001;
 
 
 
168
  }
169
 
170
- .stats {
171
- font-size: 12px;
172
- line-height: 1.5;
 
 
 
 
 
173
  }
174
 
175
- canvas {
176
- margin-top: 10px;
177
- border: 1px solid #0f8;
178
  }
179
  </style>
180
  </head>
181
  <body>
182
- <div class="main-container">
183
- <div class="radar-container">
184
- <div class="grid-overlay"></div>
185
- <div class="sweep-line"></div>
186
- <div id="signals"></div>
187
  </div>
188
 
189
- <div class="control-panel">
190
- <div class="panel">
191
- <h3>Perceptron Network</h3>
192
- <div class="perceptron-layer">
193
- <canvas id="networkCanvas"></canvas>
 
 
 
 
 
 
194
  </div>
195
- <div class="stats" id="networkStats">
196
- Accuracy: 0%<br>
197
- Detections: 0<br>
198
- Signal Strength: 0
199
  </div>
200
  </div>
 
201
 
202
- <div class="panel">
203
- <h3>Frequency Analysis</h3>
204
- <div class="spectrum" id="spectrum"></div>
205
- </div>
206
 
207
- <div class="panel">
208
- <button onclick="startRadar()">Start Detection</button>
209
- <button onclick="stopRadar()">Stop</button>
210
- <button onclick="trainPerceptrons()">Train Network</button>
211
- <button onclick="toggleLearning()">Toggle Learning</button>
212
- </div>
 
 
213
  </div>
214
  </div>
215
 
216
  <script>
217
- class Perceptron {
218
- constructor(inputs) {
219
- this.weights = new Array(inputs).fill(0).map(() => Math.random() * 2 - 1);
220
- this.bias = Math.random() * 2 - 1;
221
- this.learningRate = 0.1;
222
- }
 
 
 
 
 
 
 
 
 
223
 
224
- activate(sum) {
225
- return sum > 0 ? 1 : 0;
226
- }
 
 
227
 
228
- predict(inputs) {
229
- const sum = inputs.reduce((sum, input, i) => sum + input * this.weights[i], 0) + this.bias;
230
- return this.activate(sum);
231
- }
232
 
233
- train(inputs, target) {
234
- const prediction = this.predict(inputs);
235
- const error = target - prediction;
236
-
237
- for(let i = 0; i < this.weights.length; i++) {
238
- this.weights[i] += error * inputs[i] * this.learningRate;
239
- }
240
- this.bias += error * this.learningRate;
241
-
242
- return Math.abs(error);
243
- }
244
- }
245
 
246
- class PerceptronNetwork {
247
- constructor(inputSize, hiddenSize, outputSize) {
248
- this.inputLayer = new Array(hiddenSize)
249
- .fill(0)
250
- .map(() => new Perceptron(inputSize));
251
-
252
- this.outputLayer = new Array(outputSize)
253
- .fill(0)
254
- .map(() => new Perceptron(hiddenSize));
255
- }
256
 
257
- predict(inputs) {
258
- const hiddenOutputs = this.inputLayer.map(p => p.predict(inputs));
259
- return this.outputLayer.map(p => p.predict(hiddenOutputs));
260
- }
261
 
262
- train(inputs, targets) {
263
- const hiddenOutputs = this.inputLayer.map(p => p.predict(inputs));
264
- const finalOutputs = this.outputLayer.map(p => p.predict(hiddenOutputs));
265
-
266
- let error = 0;
267
- this.outputLayer.forEach((p, i) => {
268
- error += p.train(hiddenOutputs, targets[i]);
269
- });
270
- this.inputLayer.forEach(p => {
271
- error += p.train(inputs, 1);
272
- });
273
-
274
- return error / (this.inputLayer.length + this.outputLayer.length);
275
- }
276
- }
277
 
278
- // Initialize system
279
- const INPUT_SIZE = 32;
280
- const HIDDEN_SIZE = 16;
281
- const OUTPUT_SIZE = 4;
282
-
283
- let isRunning = false;
284
- let isLearning = false;
285
- let network = new PerceptronNetwork(INPUT_SIZE, HIDDEN_SIZE, OUTPUT_SIZE);
286
- let audioContext, analyser, dataArray;
287
-
288
- // Setup UI
289
- const spectrum = document.getElementById('spectrum');
290
- for(let i = 0; i < INPUT_SIZE; i++) {
291
- const bar = document.createElement('div');
292
- bar.className = 'bar';
293
- spectrum.appendChild(bar);
294
- }
295
 
296
- // Setup canvas
297
- const canvas = document.getElementById('networkCanvas');
298
- canvas.width = 350;
299
- canvas.height = 180;
300
- const ctx = canvas.getContext('2d');
301
-
302
- function drawNetwork(inputs, hiddenOutputs, finalOutputs) {
303
- ctx.clearRect(0, 0, canvas.width, canvas.height);
304
- ctx.strokeStyle = '#0f8';
305
- ctx.lineWidth = 0.5;
306
-
307
- const drawLayer = (nodes, x, active) => {
308
- const spacing = canvas.height / (nodes.length + 1);
309
- return nodes.map((value, i) => {
310
- const y = spacing * (i + 1);
311
- ctx.beginPath();
312
- ctx.arc(x, y, 4, 0, Math.PI * 2);
313
- ctx.fillStyle = `rgba(0,255,136,${active ? value : 0.3})`;
314
- ctx.fill();
315
- return {x, y};
316
- });
317
- };
318
-
319
- const inputNodes = drawLayer(inputs, 30, true);
320
- const hiddenNodes = drawLayer(hiddenOutputs, canvas.width/2, true);
321
- const outputNodes = drawLayer(finalOutputs, canvas.width - 30, true);
322
-
323
- // Draw connections
324
- ctx.beginPath();
325
- inputNodes.forEach(input => {
326
- hiddenNodes.forEach(hidden => {
327
- ctx.moveTo(input.x, input.y);
328
- ctx.lineTo(hidden.x, hidden.y);
329
- });
330
- });
331
- hiddenNodes.forEach(hidden => {
332
- outputNodes.forEach(output => {
333
- ctx.moveTo(hidden.x, hidden.y);
334
- ctx.lineTo(output.x, output.y);
335
- });
336
- });
337
- ctx.stroke();
338
- }
339
 
340
- async function startRadar() {
341
- try {
342
- if(!audioContext) {
343
- audioContext = new (window.AudioContext || window.webkitAudioContext)();
344
- const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
345
- const source = audioContext.createMediaStreamSource(stream);
346
- analyser = audioContext.createAnalyser();
347
- analyser.fftSize = 64;
348
- source.connect(analyser);
349
- dataArray = new Uint8Array(analyser.frequencyBinCount);
350
- }
351
-
352
- isRunning = true;
353
- updateRadar();
354
- } catch(err) {
355
- console.error('Error accessing microphone:', err);
356
- }
357
- }
358
 
359
- function stopRadar() {
360
- isRunning = false;
361
- }
362
 
363
- function updateRadar() {
364
- if(!isRunning) return;
365
 
366
- analyser.getByteFrequencyData(dataArray);
 
367
 
368
- // Update spectrum
369
- const bars = spectrum.children;
370
- for(let i = 0; i < bars.length; i++) {
371
- const height = (dataArray[i] / 255) * 120;
372
- bars[i].style.height = height + 'px';
373
  }
374
-
375
- // Normalize input data
376
- const inputs = Array.from(dataArray).map(x => x / 255);
377
 
378
- // Get network predictions
379
- const hiddenOutputs = network.inputLayer.map(p => p.predict(inputs));
380
- const outputs = network.outputLayer.map(p => p.predict(hiddenOutputs));
381
-
382
- // Draw network state
383
- drawNetwork(inputs, hiddenOutputs, outputs);
384
-
385
- // Create signals for strong predictions
386
- outputs.forEach((output, i) => {
387
- if(output > 0.7) {
388
- createSignal(i);
389
- }
390
- });
391
-
392
- // Update stats
393
- const avgOutput = outputs.reduce((a,b) => a+b) / outputs.length;
394
- document.getElementById('networkStats').innerHTML =
395
- `Accuracy: ${Math.round(avgOutput * 100)}%<br>` +
396
- `Detections: ${outputs.filter(x => x > 0.7).length}<br>` +
397
- `Signal Strength: ${Math.round(inputs.reduce((a,b) => a+b) / inputs.length * 100)}`;
398
-
399
- if(isLearning) {
400
- const target = Array(OUTPUT_SIZE).fill(0);
401
- target[Math.floor(Math.random() * OUTPUT_SIZE)] = 1;
402
- network.train(inputs, target);
403
  }
404
 
405
- requestAnimationFrame(updateRadar);
406
- }
407
-
408
- function createSignal(type) {
409
- const radar = document.querySelector('.radar-container');
410
- const angle = Math.random() * Math.PI * 2;
411
- const distance = Math.random() * (radar.offsetWidth / 3);
412
-
413
- const x = Math.cos(angle) * distance + radar.offsetWidth / 2;
414
- const y = Math.sin(angle) * distance + radar.offsetHeight / 2;
415
-
416
- const signal = document.createElement('div');
417
- signal.className = 'signal';
418
- signal.style.left = x + 'px';
419
- signal.style.top = y + 'px';
420
- radar.appendChild(signal);
421
-
422
- const echo = document.createElement('div');
423
- echo.className = 'signal-echo';
424
- echo.style.left = x + 'px';
425
- echo.style.top = y + 'px';
426
- radar.appendChild(echo);
427
 
428
  setTimeout(() => {
429
- signal.remove();
430
- echo.remove();
431
- }, 2000);
432
- }
433
-
434
- function trainPerceptrons() {
435
- let error = 0;
436
- for(let i = 0; i < 100; i++) {
437
- const inputs = Array(INPUT_SIZE).fill(0).map(() => Math.random());
438
- const targets = Array(OUTPUT_SIZE).fill(0);
439
- targets[Math.floor(Math.random() * OUTPUT_SIZE)] = 1;
440
- error += network.train(inputs, targets);
441
- }
442
- document.getElementById('networkStats').innerHTML =
443
- `Training complete<br>Error: ${Math.round(error * 100) / 100}<br>Network ready`;
444
- }
445
-
446
- function toggleLearning() {
447
- isLearning = !isLearning;
448
- }
449
  </script>
450
  </body>
451
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Smart Article Generator ๐Ÿ“</title>
7
  <style>
8
+ :root {
9
+ --primary: #2563eb;
10
+ --secondary: #475569;
11
+ --background: #f8fafc;
12
+ --surface: #ffffff;
13
+ }
14
+
15
  * {
16
  margin: 0;
17
  padding: 0;
18
  box-sizing: border-box;
19
+ font-family: 'Inter', system-ui, sans-serif;
20
  }
21
 
22
  body {
23
+ background-color: var(--background);
 
24
  min-height: 100vh;
25
+ padding: 2rem;
26
+ line-height: 1.6;
27
  }
28
 
29
+ .container {
30
+ max-width: 900px;
31
+ margin: 0 auto;
32
+ background: var(--surface);
33
+ padding: 2.5rem;
34
+ border-radius: 1rem;
35
+ box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
36
  }
37
 
38
+ .header {
39
+ text-align: center;
40
+ margin-bottom: 3rem;
 
 
 
41
  }
42
 
43
+ .header h1 {
44
+ color: var(--primary);
45
+ font-size: 2.5rem;
46
+ margin-bottom: 1rem;
 
 
 
 
 
47
  }
48
 
49
+ .header p {
50
+ color: var(--secondary);
51
+ font-size: 1.1rem;
 
 
 
 
 
52
  }
53
 
54
+ .step {
55
+ margin-bottom: 2rem;
 
56
  }
57
 
58
+ .step-number {
59
+ background: var(--primary);
60
+ color: white;
61
+ width: 30px;
62
+ height: 30px;
63
+ display: inline-flex;
64
+ align-items: center;
65
+ justify-content: center;
66
+ border-radius: 50%;
67
+ margin-right: 0.5rem;
68
+ }
69
+
70
+ .step h2 {
71
+ color: var(--secondary);
72
+ margin-bottom: 1rem;
73
  display: flex;
74
+ align-items: center;
 
75
  }
76
 
77
+ input[type="text"] {
78
+ width: 100%;
79
+ padding: 1rem;
80
+ border: 2px solid #e2e8f0;
81
+ border-radius: 0.5rem;
82
+ font-size: 1rem;
83
+ transition: all 0.3s;
84
  }
85
 
86
+ input[type="text"]:focus {
87
+ outline: none;
88
+ border-color: var(--primary);
89
+ box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
 
 
 
90
  }
91
 
92
+ .source-options {
93
+ display: grid;
94
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
95
+ gap: 1rem;
96
+ margin-top: 1rem;
97
  }
98
 
99
+ .source-option {
100
+ padding: 1.5rem;
101
+ border: 2px solid #e2e8f0;
102
+ border-radius: 0.5rem;
103
+ cursor: pointer;
104
+ transition: all 0.3s;
105
+ text-align: center;
 
106
  }
107
 
108
+ .source-option:hover {
109
+ border-color: var(--primary);
110
+ background: rgba(37, 99, 235, 0.05);
111
  }
112
 
113
+ .source-option.selected {
114
+ border-color: var(--primary);
115
+ background: rgba(37, 99, 235, 0.1);
 
 
116
  }
117
 
118
+ .source-option h3 {
119
+ font-size: 1.2rem;
120
+ margin-bottom: 0.5rem;
 
 
121
  }
122
 
123
+ .generate-btn {
124
+ width: 100%;
125
+ padding: 1rem;
126
+ background: var(--primary);
127
+ color: white;
128
+ border: none;
129
+ border-radius: 0.5rem;
130
+ font-size: 1.1rem;
131
+ cursor: pointer;
132
+ transition: all 0.3s;
133
+ margin: 2rem 0;
134
  }
135
 
136
+ .generate-btn:hover {
137
+ background: #1d4ed8;
138
+ }
139
+
140
+ .loader {
141
+ display: none;
142
+ text-align: center;
143
+ margin: 2rem 0;
144
  }
145
 
146
+ .loader-spinner {
147
+ width: 40px;
148
+ height: 40px;
149
+ border: 4px solid #f3f3f3;
150
+ border-top: 4px solid var(--primary);
151
  border-radius: 50%;
152
+ animation: spin 1s linear infinite;
153
+ margin: 0 auto 1rem;
154
  }
155
 
156
+ @keyframes spin {
157
+ 0% { transform: rotate(0deg); }
158
+ 100% { transform: rotate(360deg); }
 
 
 
 
 
 
 
 
159
  }
160
 
161
+ .result {
162
+ display: none;
163
+ margin-top: 2rem;
 
 
 
 
164
  }
165
 
166
+ .article-content {
167
+ padding: 1.5rem;
168
+ border: 2px solid #e2e8f0;
169
+ border-radius: 0.5rem;
170
+ margin-bottom: 1rem;
171
+ white-space: pre-wrap;
172
  }
173
 
174
+ .copy-btn {
175
+ padding: 0.75rem 1.5rem;
176
+ background: #10b981;
177
+ color: white;
178
+ border: none;
179
+ border-radius: 0.5rem;
180
+ cursor: pointer;
181
+ transition: all 0.3s;
182
  }
183
 
184
+ .copy-btn:hover {
185
+ background: #059669;
 
186
  }
187
  </style>
188
  </head>
189
  <body>
190
+ <div class="container">
191
+ <div class="header">
192
+ <h1>โœจ Smart Article Generator โœจ</h1>
193
+ <p>Create professional articles in seconds! ๐Ÿš€</p>
 
194
  </div>
195
 
196
+ <div class="step">
197
+ <h2><span class="step-number">1</span> Enter Your Topic ๐Ÿ“</h2>
198
+ <input type="text" id="topic" placeholder="Example: The Impact of Artificial Intelligence on Modern Society">
199
+ </div>
200
+
201
+ <div class="step">
202
+ <h2><span class="step-number">2</span> Choose Your Source ๐ŸŽฏ</h2>
203
+ <div class="source-options">
204
+ <div class="source-option" data-source="trusted">
205
+ <h3>Trusted Sources ๐Ÿ“ฐ</h3>
206
+ <p>Curated from reputable publications</p>
207
  </div>
208
+ <div class="source-option" data-source="ai">
209
+ <h3>AI Generated ๐Ÿค–</h3>
210
+ <p>Created by advanced AI</p>
 
211
  </div>
212
  </div>
213
+ </div>
214
 
215
+ <button class="generate-btn" id="generateBtn">Generate Article โœจ</button>
 
 
 
216
 
217
+ <div class="loader">
218
+ <div class="loader-spinner"></div>
219
+ <p>Creating your professional article... ๐ŸŽจ</p>
220
+ </div>
221
+
222
+ <div class="result">
223
+ <div class="article-content" id="articleContent"></div>
224
+ <button class="copy-btn" id="copyBtn">Copy Article ๐Ÿ“‹</button>
225
  </div>
226
  </div>
227
 
228
  <script>
229
+ const sourceOptions = document.querySelectorAll('.source-option');
230
+ const generateBtn = document.getElementById('generateBtn');
231
+ const loader = document.querySelector('.loader');
232
+ const result = document.querySelector('.result');
233
+ const articleContent = document.getElementById('articleContent');
234
+ const copyBtn = document.getElementById('copyBtn');
235
+ let selectedSource = null;
236
+
237
+ sourceOptions.forEach(option => {
238
+ option.addEventListener('click', () => {
239
+ sourceOptions.forEach(opt => opt.classList.remove('selected'));
240
+ option.classList.add('selected');
241
+ selectedSource = option.dataset.source;
242
+ });
243
+ });
244
 
245
+ function generateArticle(topic, source) {
246
+ const trustedSources = ["The New York Times ๐Ÿ“ฐ", "BBC News ๐ŸŒ", "Reuters ๐Ÿ“ฑ", "Associated Press ๐Ÿ“ข"];
247
+ const source_credit = source === 'trusted' ?
248
+ `Source: ${trustedSources[Math.floor(Math.random() * trustedSources.length)]}` :
249
+ "Generated by AI ๐Ÿค–";
250
 
251
+ const paragraphs = [
252
+ `๐Ÿ“Œ ${topic} has become one of the most discussed topics in recent times. As we delve deeper into this fascinating subject, we discover its profound impact on various aspects of our lives and society as a whole.`,
 
 
253
 
254
+ `๐Ÿ” Recent studies and analyses have shown that ${topic} plays a crucial role in shaping our future. Experts from leading institutions have conducted extensive research, revealing remarkable insights about this phenomenon.`,
 
 
 
 
 
 
 
 
 
 
 
255
 
256
+ `๐Ÿ’ก The evolution of ${topic} has been nothing short of revolutionary. From its humble beginnings to its current state, we've witnessed tremendous growth and development in this field. Industry leaders and innovators continue to push boundaries, exploring new possibilities and applications.`,
 
 
 
 
 
 
 
 
 
257
 
258
+ `๐Ÿ“Š According to recent statistics and data analysis, the impact of ${topic} has grown exponentially over the past decade. Organizations implementing related strategies have reported significant improvements in efficiency and effectiveness.`,
 
 
 
259
 
260
+ `๐ŸŒŸ Looking ahead, the future of ${topic} appears incredibly promising. Experts predict continued growth and innovation in this space, with new developments emerging regularly. This dynamic landscape presents both challenges and opportunities for individuals and organizations alike.`,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
 
262
+ `๐Ÿ“ˆ The practical implications of ${topic} are far-reaching. From everyday applications to complex industrial solutions, its influence can be observed across various sectors. This widespread adoption has led to remarkable transformations in how we approach traditional problems.`,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
 
264
+ `๐ŸŽฏ To fully leverage the potential of ${topic}, experts recommend following these key principles: understanding fundamental concepts, staying updated with latest developments, and implementing best practices. These guidelines ensure optimal results and sustainable progress.`,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
 
266
+ `๐Ÿ”ฎ As we look to the future, it's clear that ${topic} will continue to evolve and shape our world in unprecedented ways. The possibilities are endless, and the potential for positive change is immense.`,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
 
268
+ `\n${source_credit}\nArticle generated on: ${new Date().toLocaleDateString()} ๐Ÿ“…`
269
+ ].join('\n\n');
 
270
 
271
+ return paragraphs;
272
+ }
273
 
274
+ generateBtn.addEventListener('click', () => {
275
+ const topic = document.getElementById('topic').value;
276
 
277
+ if (!topic) {
278
+ alert('Please enter a topic first! ๐ŸŽฏ');
279
+ return;
 
 
280
  }
 
 
 
281
 
282
+ if (!selectedSource) {
283
+ alert('Please select a source! ๐Ÿ“š');
284
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  }
286
 
287
+ loader.style.display = 'block';
288
+ result.style.display = 'none';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
 
290
  setTimeout(() => {
291
+ const article = generateArticle(topic, selectedSource);
292
+ articleContent.textContent = article;
293
+ loader.style.display = 'none';
294
+ result.style.display = 'block';
295
+ }, 3000);
296
+ });
297
+
298
+ copyBtn.addEventListener('click', () => {
299
+ navigator.clipboard.writeText(articleContent.textContent)
300
+ .then(() => {
301
+ copyBtn.textContent = 'Copied! โœ…';
302
+ setTimeout(() => {
303
+ copyBtn.textContent = 'Copy Article ๐Ÿ“‹';
304
+ }, 2000);
305
+ })
306
+ .catch(err => {
307
+ alert('Failed to copy text! โŒ');
308
+ console.error('Failed to copy text: ', err);
309
+ });
310
+ });
311
  </script>
312
  </body>
313
  </html>