-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdashboard.html
More file actions
980 lines (885 loc) · 56.7 KB
/
Copy pathdashboard.html
File metadata and controls
980 lines (885 loc) · 56.7 KB
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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Job Scraper Dashboard</title>
<link href="https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Mono:wght@300;400;500&display=swap" rel="stylesheet">
<style>
:root {
--bg: #0a0a0f;
--surface: #111118;
--border: #1e1e2e;
--accent: #7c6aff;
--accent2: #ff6a8a;
--accent3: #6affb4;
--text: #e8e8f0;
--muted: #5a5a72;
--card: #13131c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: 'DM Mono', monospace; min-height: 100vh; overflow-x: hidden; }
body::before {
content: ''; position: fixed; inset: 0;
background-image: linear-gradient(rgba(124,106,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(124,106,255,0.03) 1px, transparent 1px);
background-size: 40px 40px; pointer-events: none; z-index: 0;
}
.wrap { max-width: 900px; margin: 0 auto; padding: 60px 24px; position: relative; z-index: 1; }
header { margin-bottom: 56px; }
.badge { display: inline-block; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); border: 1px solid rgba(124,106,255,0.3); padding: 4px 10px; border-radius: 2px; margin-bottom: 16px; }
h1 { font-family: 'Syne', sans-serif; font-size: clamp(32px, 5vw, 52px); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 12px; }
h1 span { color: var(--accent); }
.subtitle { color: var(--muted); font-size: 13px; line-height: 1.6; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 40px; }
.mode-card { border: 1px solid var(--border); border-radius: 8px; padding: 20px 16px; cursor: pointer; transition: all 0.2s; background: var(--card); position: relative; overflow: hidden; }
.mode-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform 0.2s; }
.mode-card:hover { border-color: rgba(124,106,255,0.4); }
.mode-card.active { border-color: var(--accent); background: rgba(124,106,255,0.05); }
.mode-card.active::before { transform: scaleX(1); }
.mode-icon { font-size: 20px; margin-bottom: 8px; }
.mode-name { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.mode-desc { font-size: 10px; color: var(--muted); line-height: 1.5; }
.mode-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.tag { font-size: 9px; padding: 2px 6px; border-radius: 2px; background: rgba(124,106,255,0.1); color: var(--accent); letter-spacing: 0.05em; }
.tag.green { background: rgba(106,255,180,0.1); color: var(--accent3); }
.tag.pink { background: rgba(255,106,138,0.1); color: var(--accent2); }
.form-section { margin-bottom: 32px; }
.section-label { font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.field-grid { display: grid; gap: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 11px; color: var(--muted); letter-spacing: 0.05em; }
input, textarea, select { background: var(--surface); border: 1px solid var(--border); color: var(--text); font-family: 'DM Mono', monospace; font-size: 12px; padding: 10px 12px; border-radius: 6px; outline: none; transition: border-color 0.15s; width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
select option { background: #1a1a2e; }
.upload-zone { border: 1px dashed var(--border); border-radius: 6px; padding: 24px; text-align: center; cursor: pointer; transition: all 0.2s; position: relative; }
.upload-zone:hover { border-color: var(--accent); background: rgba(124,106,255,0.03); }
.upload-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-icon { font-size: 24px; margin-bottom: 8px; }
.upload-text { font-size: 11px; color: var(--muted); }
.upload-name { font-size: 11px; color: var(--accent3); margin-top: 4px; }
.hidden { display: none !important; }
.run-btn { width: 100%; padding: 16px; background: var(--accent); color: white; border: none; border-radius: 8px; font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.2s; letter-spacing: 0.02em; margin-top: 8px; }
.run-btn:hover { background: #6a58f0; transform: translateY(-1px); }
.run-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.run-btn.running { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.stop-btn { width: 100%; padding: 12px; background: transparent; color: var(--accent2); border: 1px solid rgba(255,106,138,0.4); border-radius: 8px; font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s; margin-top: 8px; display: none; }
.stop-btn:hover { background: rgba(255,106,138,0.08); }
.reset-btn { width: 100%; padding: 12px; background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s; margin-top: 8px; display: none; }
.reset-btn:hover { border-color: rgba(124,106,255,0.4); color: var(--text); }
.progress-wrap { margin-top: 32px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card); }
.progress-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.progress-title { font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700; }
.stage-pill { font-size: 10px; padding: 3px 8px; border-radius: 20px; background: rgba(124,106,255,0.15); color: var(--accent); }
.stage-pill.done { background: rgba(106,255,180,0.15); color: var(--accent3); }
.stage-pill.error { background: rgba(255,106,138,0.15); color: var(--accent2); }
.log-box { padding: 16px; height: 200px; overflow-y: auto; font-size: 11px; line-height: 1.8; color: var(--muted); }
.log-box .ok { color: var(--accent3); }
.log-box .err { color: var(--accent2); }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border-top: 1px solid var(--border); }
.stat { padding: 16px; background: var(--card); text-align: center; }
.stat-num { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 10px; color: var(--muted); margin-top: 2px; }
.downloads { margin-top: 32px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dl-btn { padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); font-family: 'DM Mono', monospace; font-size: 11px; cursor: pointer; transition: all 0.2s; text-align: center; text-decoration: none; display: block; }
.dl-btn:hover { border-color: var(--accent); color: var(--accent); }
.dl-icon { font-size: 20px; display: block; margin-bottom: 6px; }
.dl-name { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 12px; }
.dl-desc { color: var(--muted); font-size: 10px; margin-top: 2px; }
/* Salary tabs */
.tab-btn { background: var(--card); border: 1px solid var(--border); color: var(--muted); font-family: 'DM Mono', monospace; font-size: 11px; padding: 8px 14px; border-radius: 6px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.tab-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(124,106,255,0.05); }
.tab-btn:hover { border-color: rgba(124,106,255,0.4); }
.tab-count { font-size: 10px; padding: 1px 6px; background: rgba(124,106,255,0.15); border-radius: 10px; }
/* Job cards */
.job-card { border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 10px; background: var(--card); display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; transition: border-color 0.15s; }
.job-card:hover { border-color: rgba(124,106,255,0.3); }
.job-card.applied-card { opacity: 0.7; border-color: rgba(106,255,180,0.2); }
/* Application Type Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 24px; max-width: 400px; }
.modal-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.modal-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-btn { padding: 12px; border-radius: 6px; border: none; font-family: 'Syne', sans-serif; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.modal-btn.easy { background: rgba(106,255,180,0.15); color: var(--accent3); border: 1px solid rgba(106,255,180,0.3); }
.modal-btn.easy:hover { background: rgba(106,255,180,0.25); }
.modal-btn.cover { background: rgba(124,106,255,0.15); color: var(--accent); border: 1px solid rgba(124,106,255,0.3); }
.modal-btn.cover:hover { background: rgba(124,106,255,0.25); }
.app-type-badge { font-size: 9px; padding: 3px 8px; border-radius: 3px; font-weight: 600; margin-left: 8px; }
.app-type-badge.easy { background: rgba(106,255,180,0.1); color: var(--accent3); }
.app-type-badge.cover { background: rgba(124,106,255,0.1); color: var(--accent); }
.job-title { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.job-company { font-size: 11px; color: var(--muted); }
.job-meta { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.job-tag { font-size: 10px; padding: 2px 7px; border-radius: 3px; }
.job-tag.fit { background: rgba(106,255,180,0.1); color: var(--accent3); }
.job-tag.prob { background: rgba(124,106,255,0.1); color: var(--accent); }
.job-tag.salary { background: rgba(255,200,100,0.1); color: #ffc864; }
.job-verdict { font-size: 10px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.job-link { font-size: 11px; color: var(--accent); text-decoration: none; white-space: nowrap; margin-top: 2px; }
.job-link:hover { text-decoration: underline; }
.skills-section { margin-top: 8px; }
.skills-label { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.skills-wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.skill-tag { font-size: 9px; padding: 2px 6px; border-radius: 3px; }
.skill-tag.matched { background: rgba(106,255,180,0.08); color: var(--accent3); border: 1px solid rgba(106,255,180,0.2); }
.skill-tag.missing { background: rgba(255,106,138,0.08); color: var(--accent2); border: 1px solid rgba(255,106,138,0.2); }
.action-btns { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.apply-btn { font-size: 10px; padding: 5px 10px; border-radius: 4px; border: 1px solid rgba(106,255,180,0.3); background: transparent; color: var(--accent3); cursor: pointer; font-family: 'DM Mono', monospace; transition: all 0.15s; white-space: nowrap; }
.apply-btn:hover { background: rgba(106,255,180,0.08); }
.apply-btn.applied { border-color: rgba(106,255,180,0.15); color: var(--muted); cursor: default; }
.apply-btn.danger { border-color: rgba(255,106,138,0.3); color: var(--accent2); }
.apply-btn.danger:hover { background: rgba(255,106,138,0.08); }
.apply-btn.neutral { border-color: var(--border); color: var(--muted); }
.apply-btn.neutral:hover { border-color: rgba(124,106,255,0.4); color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(124,106,255,0.3); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 8px; vertical-align: middle; }
@media (max-width: 600px) {
.mode-grid { grid-template-columns: 1fr; }
.field-row { grid-template-columns: 1fr; }
.stats-row { grid-template-columns: 1fr; }
.downloads { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="wrap">
<header>
<div class="badge">Job Intelligence</div>
<h1>Job Scraper<br><span>Dashboard</span></h1>
<p class="subtitle">Scrape LinkedIn jobs, score them against your resume with Claude AI,<br>and get a personalised skill gap study plan.</p>
</header>
<!-- Mode Selection -->
<div class="section-label">Select Mode</div>
<div class="mode-grid">
<div class="mode-card active" onclick="setMode('scraper_only')" id="mode-scraper_only">
<div class="mode-icon">🔍</div>
<div class="mode-name">Scraper Only</div>
<div class="mode-desc">Scrape LinkedIn jobs and export to CSV. No AI needed.</div>
<div class="mode-tags"><span class="tag">Credentials</span><span class="tag">Keywords</span></div>
</div>
<div class="mode-card" onclick="setMode('with_scoring')" id="mode-with_scoring">
<div class="mode-icon">🎯</div>
<div class="mode-name">Scraper + AI Score</div>
<div class="mode-desc">Scrape and score each job against your resume with Claude.</div>
<div class="mode-tags"><span class="tag green">+ Resume</span><span class="tag green">+ API Key</span></div>
</div>
<div class="mode-card" onclick="setMode('full')" id="mode-full">
<div class="mode-icon">🧠</div>
<div class="mode-name">Full Analysis</div>
<div class="mode-desc">Everything above + skill gap clusters + 4-week study plan.</div>
<div class="mode-tags"><span class="tag pink">+ Study Plan</span><span class="tag pink">+ Clusters</span></div>
</div>
</div>
<form id="main-form" onsubmit="startRun(event)">
<input type="hidden" id="mode-input" name="mode" value="scraper_only">
<input type="hidden" id="single-run-input" name="single_run" value="">
<!-- LinkedIn Credentials -->
<div class="form-section">
<div class="section-label">LinkedIn Credentials</div>
<div class="field-row">
<div class="field"><label>Email</label><input type="email" name="email" placeholder="your@email.com" required></div>
<div class="field"><label>Password</label><input type="password" name="password" placeholder="••••••••" required></div>
</div>
</div>
<!-- Search Config -->
<div class="form-section">
<div class="section-label">Search Configuration</div>
<div class="field-grid">
<div class="field"><label>Keywords (comma separated)</label><input type="text" name="keywords" placeholder="e.g. Machine Learning Engineer, Data Scientist, Software Engineer"></div>
<div class="field-row">
<div class="field"><label>Location</label><input type="text" name="location" placeholder="e.g. Vienna, Remote, New York"></div>
<div class="field"><label>Profession / field <span style="color:var(--muted);font-size:10px">(for AI scorer)</span></label><input type="text" name="profession" placeholder="e.g. Software Engineer, Nurse, Designer"></div>
</div>
<div class="field-row">
<div class="field">
<label>Pages per keyword</label>
<select name="pages">
<option value="1">1 page (~25 jobs)</option>
<option value="3">3 pages (~75 jobs)</option>
<option value="5" selected>5 pages (~125 jobs)</option>
<option value="10">10 pages (~250 jobs)</option>
</select>
</div>
<div class="field">
<label>Time Filter</label>
<select name="time_filter">
<option value="r86400">Last 24 hours</option>
<option value="r604800" selected>Last week</option>
<option value="r2592000">Last month</option>
</select>
</div>
</div>
<div class="field-row">
<div class="field">
<label>Speed <span style="color:var(--muted);font-size:10px">(LinkedIn pace — keeps human-like jitter)</span></label>
<select name="speed" id="speed-select">
<option value="fast">Fast — small / test batches</option>
<option value="balanced" selected>Balanced — recommended</option>
<option value="safe">Safe — overnight, large batches</option>
</select>
</div>
<div class="field"></div>
</div>
</div>
</div>
<!-- AI Fields -->
<div id="ai-fields">
<div class="form-section">
<div class="section-label">Resume</div>
<div class="upload-zone" id="upload-zone">
<input type="file" name="resume" id="resume-input" accept=".pdf,.docx,.doc" onchange="showFileName(this)">
<div class="upload-icon">📄</div>
<div class="upload-text">Drop your resume here or click to browse<br>PDF or DOCX accepted</div>
<div class="upload-name" id="file-name"></div>
</div>
</div>
<div class="form-section">
<div class="section-label">AI Provider</div>
<div class="field-grid">
<div class="field-row">
<div class="field">
<label>Provider</label>
<select name="llm_provider" id="llm-provider" onchange="updateProviderUI()">
<option value="anthropic">Anthropic (Claude)</option>
<option value="deepseek">DeepSeek</option>
<option value="gemini">Google Gemini</option>
<option value="openai">OpenAI (GPT)</option>
<option value="llama">Meta Llama</option>
<option value="custom">Custom (OpenAI-compatible)</option>
</select>
</div>
<div class="field">
<label>Model <span style="color:var(--muted);font-size:10px">(pick or type)</span></label>
<input type="text" name="llm_model" id="llm-model" list="model-options" autocomplete="off" placeholder="claude-sonnet-4-6">
<datalist id="model-options"></datalist>
</div>
</div>
<div class="field" id="base-url-field" style="display:none">
<label>Base URL <span style="color:var(--muted);font-size:10px">(OpenRouter, Ollama, etc.)</span></label>
<input type="text" name="llm_base_url" placeholder="https://api.openrouter.ai/v1">
</div>
<div class="field">
<label id="api-key-label">API Key</label>
<input type="password" name="llm_api_key" id="llm-api-key" placeholder="sk-...">
</div>
</div>
</div>
</div>
<button type="submit" class="run-btn" id="run-btn">Run Pipeline</button>
<button type="button" class="run-btn" id="test-btn" onclick="startSingleRun()" style="background:transparent;border:1px solid var(--accent);color:var(--accent);margin-top:10px;">🔬 Test Run — login, grab one job, score it</button>
<button type="button" class="stop-btn" id="stop-btn" onclick="stopRun()">⚠ Stop Pipeline</button>
<button type="button" class="reset-btn" id="reset-btn" onclick="resetRun()">↺ Reset & Start Fresh</button>
</form>
<!-- Progress -->
<div class="progress-wrap" id="progress" style="display:none; margin-top: 32px;">
<div class="progress-header">
<span class="progress-title">Pipeline Log</span>
<span class="stage-pill" id="stage-pill">Idle</span>
</div>
<div class="log-box" id="log-box"></div>
<div class="stats-row">
<div class="stat"><div class="stat-num" id="stat-scraped">0</div><div class="stat-label">Jobs Scraped</div></div>
<div class="stat"><div class="stat-num" id="stat-scored">0</div><div class="stat-label">Jobs Scored</div></div>
<div class="stat"><div class="stat-num" id="stat-stage">—</div><div class="stat-label">Current Stage</div></div>
</div>
</div>
<!-- Downloads -->
<div class="downloads" id="downloads" style="display:none; margin-top: 32px;">
<a class="dl-btn" href="/download/csv" id="dl-csv">
<span class="dl-icon">📊</span><span class="dl-name">job_results.csv</span>
<span class="dl-desc">Jobs split by salary type,<br>sorted by fit score</span>
</a>
<a class="dl-btn" href="/download/skills" id="dl-skills">
<span class="dl-icon">🎯</span><span class="dl-name">skill_clusters.txt</span>
<span class="dl-desc">Skill gaps ranked<br>by score boost</span>
</a>
<a class="dl-btn" href="/download/plan" id="dl-plan">
<span class="dl-icon">📅</span><span class="dl-name">study_plan.txt</span>
<span class="dl-desc">4-week day-by-day<br>learning roadmap</span>
</a>
</div>
<!-- Load Existing CSV -->
<div style="margin-top: 48px;">
<div class="section-label">Load Existing Results</div>
<div style="border: 1px solid var(--border); border-radius: 8px; padding: 20px; background: var(--card); display: flex; align-items: center; gap: 16px; flex-wrap: wrap;">
<div style="flex: 1; min-width: 200px;">
<div style="font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; margin-bottom: 4px;">Open a previous CSV</div>
<div style="font-size: 11px; color: var(--muted);">Load a job_results CSV from a previous run to browse tabs without re-scraping.</div>
</div>
<div style="display: flex; align-items: center; gap: 10px; flex-wrap: wrap;">
<div class="upload-zone" style="padding: 10px 16px; display: inline-flex; align-items: center; gap: 8px; width: auto; text-align: left;">
<input type="file" id="csv-upload-input" accept=".csv" onchange="loadCsvFile(this)" style="position: absolute; inset: 0; opacity: 0; cursor: pointer;">
<span style="font-size: 16px;">📂</span>
<span class="upload-text" id="csv-upload-label">Choose CSV file</span>
</div>
<div id="csv-load-status" style="font-size: 11px; color: var(--muted);"></div>
</div>
</div>
</div>
<!-- Salary + Status Tabs -->
<div id="salary-section" style="display:none; margin-top: 40px;">
<div class="section-label">Jobs by Salary Type</div>
<div style="display:flex; gap:8px; margin-bottom:16px; flex-wrap:wrap; align-items:center;">
<button class="tab-btn active" onclick="showTab('annual')" id="tab-annual">💰 Annual <span id="count-annual" class="tab-count">0</span></button>
<button class="tab-btn" onclick="showTab('hourly')" id="tab-hourly">⏱ Hourly <span id="count-hourly" class="tab-count">0</span></button>
<button class="tab-btn" onclick="showTab('missing')" id="tab-missing">❓ Not Listed <span id="count-missing" class="tab-count">0</span></button>
<button class="tab-btn" onclick="showTab('interested')" id="tab-interested" style="border-color:rgba(124,106,255,0.3);color:var(--accent);">⭐ Interested <span id="count-interested" class="tab-count" style="background:rgba(124,106,255,0.15);">0</span></button>
<button class="tab-btn" onclick="showTab('applied')" id="tab-applied" style="border-color:rgba(106,255,180,0.3);color:var(--accent3);">✅ Applied <span id="count-applied" class="tab-count" style="background:rgba(106,255,180,0.15);">0</span></button>
<button class="tab-btn" id="applied-filter-toggle" style="display:none;border-color:rgba(255,200,100,0.3);color:#ffc864;cursor:pointer;" onclick="toggleActionNeededFilter()">⚡ Action Needed <span id="count-action-needed" class="tab-count" style="background:rgba(255,200,100,0.15);">0</span></button>
<button class="tab-btn" onclick="showTab('not-interested')" id="tab-not-interested" style="border-color:rgba(255,106,138,0.3);color:var(--accent2);">🚫 Not Interested <span id="count-not-interested" class="tab-count" style="background:rgba(255,106,138,0.15);">0</span></button>
<button class="tab-btn" onclick="showTab('rejected')" id="tab-rejected" style="border-color:rgba(255,200,100,0.3);color:#ffc864;">✗ Rejected <span id="count-rejected" class="tab-count" style="background:rgba(255,200,100,0.15);">0</span></button>
<button onclick="downloadAppliedCsv()" style="margin-left:auto;font-size:11px;padding:6px 12px;background:transparent;border:1px solid var(--border);border-radius:6px;color:var(--muted);cursor:pointer;font-family:'DM Mono',monospace;transition:all 0.15s;" onmouseover="this.style.borderColor='var(--accent3)';this.style.color='var(--accent3)'" onmouseout="this.style.borderColor='var(--border)';this.style.color='var(--muted)'">↓ Export Applied CSV</button>
</div>
<div id="jobs-annual" class="job-list"></div>
<div id="jobs-hourly" class="job-list" style="display:none"></div>
<div id="jobs-missing" class="job-list" style="display:none"></div>
<div id="jobs-interested" class="job-list" style="display:none"></div>
<div id="jobs-applied" class="job-list" style="display:none"></div>
<div id="jobs-not-interested" class="job-list" style="display:none"></div>
<div id="jobs-rejected" class="job-list" style="display:none"></div>
</div>
</div>
<script>
let currentMode = 'scraper_only';
let polling = null;
let activeTab = 'annual';
// ── Job Registry ──────────────────────────────────────────────────────────
const jobRegistry = {};
let jobRegistryCounter = 0;
function registerJob(job) {
const key = 'job_' + (jobRegistryCounter++);
jobRegistry[key] = job;
return key;
}
// ── State ─────────────────────────────────────────────────────────────────
let appliedJobs = new Set();
let notInterestedJobs = new Set();
let rejectedJobs = new Set();
let interestedJobs = new Set();
let actionNeededJobs = new Set();
let expiredJobs = new Set();
let allJobsCache = { annual: [], hourly: [], missing: [] };
let showActionNeededOnly = false;
// ── Salary Tab Rendering ──────────────────────────────────────────────────
function renderSalaryTab(tab, jobs) {
const filtered = jobs.filter(j => {
const id = j.url || j.title;
return !appliedJobs.has(id) && !notInterestedJobs.has(id) && !rejectedJobs.has(id)
&& !interestedJobs.has(id) && !expiredJobs.has(id);
});
const msgs = { annual: 'No annual salary jobs.', hourly: 'No hourly rate jobs.', missing: 'No salary not listed jobs.' };
document.getElementById('count-' + tab).textContent = filtered.length;
document.getElementById('jobs-' + tab).innerHTML = filtered.length
? filtered.map(renderJobCard).join('')
: `<p style="color:var(--muted);font-size:12px;padding:16px">${msgs[tab]}</p>`;
}
function reRenderSalaryTabs() {
renderSalaryTab('annual', allJobsCache.annual);
renderSalaryTab('hourly', allJobsCache.hourly);
renderSalaryTab('missing', allJobsCache.missing);
}
function renderJobCard(job) {
const fit = job.fit_score !== '' ? `<span class="job-tag fit">Fit: ${job.fit_score}</span>` : '';
const prob = job.response_probability !== '' ? `<span class="job-tag prob">Callback: ${job.response_probability}%</span>` : '';
const salaryConf = job.salary_confidence === 'unverified' ? 'style="opacity:0.6" title="Auto-detected — may be inaccurate"' : '';
const salary = job.salary ? `<span class="job-tag salary" ${salaryConf}>${job.salary}${job.salary_confidence === 'unverified' ? ' ?' : ''}</span>` : '';
const verdict = job.verdict ? `<div class="job-verdict">${job.verdict}</div>` : '';
const matched = (job.matched_skills || []).slice(0, 5);
const missing = (job.missing_skills || []).slice(0, 5);
const matchedHtml = matched.length ? `<div class="skills-section"><div class="skills-label">✓ Matched</div><div class="skills-wrap">${matched.map(s=>`<span class="skill-tag matched">${s}</span>`).join('')}</div></div>` : '';
const missingHtml = missing.length ? `<div class="skills-section"><div class="skills-label">✗ Missing</div><div class="skills-wrap">${missing.map(s=>`<span class="skill-tag missing">${s}</span>`).join('')}</div></div>` : '';
const regKey = registerJob(job);
const jobId = job.url || job.title;
const isApplied = appliedJobs.has(jobId);
const isInterested = interestedJobs.has(jobId);
return `
<div class="job-card" id="card-${encodeURIComponent(jobId)}">
<div style="flex:1">
<div class="job-title">${job.title}</div>
<div class="job-company">${job.company} · ${job.location || ''}</div>
<div class="job-meta">${fit}${prob}${salary}</div>
${verdict}${matchedHtml}${missingHtml}
<div class="action-btns">
<button class="apply-btn ${isInterested ? 'applied' : ''}" ${isInterested ? 'disabled' : ''}
onclick="markInterested(jobRegistry['${regKey}'])">⭐ ${isInterested ? 'Interested' : 'Mark Interested'}</button>
<button class="apply-btn ${isApplied ? 'applied' : ''}" ${isApplied ? 'disabled' : ''}
onclick="markApplied(jobRegistry['${regKey}'])">✅ ${isApplied ? 'Applied' : 'Mark Applied'}</button>
<button class="apply-btn danger"
onclick="markNotInterested(jobRegistry['${regKey}'])">🚫 Not Interested</button>
<button class="apply-btn neutral"
onclick="markExpired(jobRegistry['${regKey}'])">⏱ Expired</button>
</div>
</div>
<a class="job-link" href="${job.url}" target="_blank">View →</a>
</div>`;
}
// ── Status Card Renderer ──────────────────────────────────────────────────
function renderStatusCard(job, status) {
const jobId = job.url || job.title;
const fit = job.fit_score ? `<span class="job-tag fit">Fit: ${job.fit_score}</span>` : '';
const prob = job.response_probability ? `<span class="job-tag prob">Callback: ${job.response_probability}%</span>` : '';
const salConf = job.salary_confidence === 'unverified' ? 'style="opacity:0.6" title="Auto-detected — may be inaccurate"' : '';
const sal = job.salary ? `<span class="job-tag salary" ${salConf}>${job.salary}${job.salary_confidence === 'unverified' ? ' ?' : ''}</span>` : '';
const missing = (job.missing_skills || []).slice(0, 5);
const missingHtml = missing.length ? `<div class="skills-section"><div class="skills-label">✗ Missing</div><div class="skills-wrap">${missing.map(s=>`<span class="skill-tag missing">${s}</span>`).join('')}</div></div>` : '';
const encodedId = encodeURIComponent(jobId);
const regKey = registerJob(job);
let timestamp = '', actions = '';
if (status === 'interested') {
timestamp = job.interested_at ? `<div class="job-verdict">Interested: ${job.interested_at}</div>` : '';
actions = `
<button class="apply-btn ${appliedJobs.has(jobId) ? 'applied' : ''}" ${appliedJobs.has(jobId) ? 'disabled' : ''} onclick="markApplied(jobRegistry['${regKey}'])">✅ Mark Applied</button>
<button class="apply-btn danger" onclick="markNotInterested(jobRegistry['${regKey}'])">🚫 Not Interested</button>
<button class="apply-btn neutral" onclick="markExpired(jobRegistry['${regKey}'])">⏱ Expired</button>`;
} else if (status === 'applied') {
timestamp = job.applied_at ? `<div class="job-verdict">Applied: ${job.applied_at}${job.application_type ? ` <span class="app-type-badge ${job.application_type === 'easy_apply' ? 'easy' : 'cover'}">${job.application_type === 'easy_apply' ? '📱 Easy Apply' : '📝 Cover Letter'}</span>` : ''}</div>` : '';
const isActionNeeded = actionNeededJobs.has(jobId);
const switchType = job.application_type === 'easy_apply' ? 'cover_letter' : 'easy_apply';
const switchLabel = job.application_type === 'easy_apply' ? '📝 Switch to Cover Letter' : '📱 Switch to Easy Apply';
actions = `
<button class="apply-btn neutral" data-jobid="${encodedId}" onclick="switchApplicationType(decodeURIComponent(this.dataset.jobid), '${switchType}')">${switchLabel}</button>
<button class="apply-btn ${isActionNeeded ? 'applied' : ''}" ${isActionNeeded ? 'disabled' : ''} data-jobid="${encodedId}" onclick="markActionNeeded(decodeURIComponent(this.dataset.jobid))">⚡ ${isActionNeeded ? 'Action Needed' : 'Mark Action Needed'}</button>
<button class="apply-btn danger" data-jobid="${encodedId}" onclick="rejectApplied(decodeURIComponent(this.dataset.jobid))">✗ Mark Rejected</button>
<button class="apply-btn neutral" data-jobid="${encodedId}" onclick="unmarkApplied(decodeURIComponent(this.dataset.jobid))">↩ Undo</button>`;
} else if (status === 'action-needed') {
timestamp = job.action_needed_at ? `<div class="job-verdict">Action Needed: ${job.action_needed_at}</div>` : '';
actions = `
<button class="apply-btn danger" data-jobid="${encodedId}" onclick="rejectApplied(decodeURIComponent(this.dataset.jobid))">✗ Mark Rejected</button>
<button class="apply-btn neutral" onclick="markExpired(jobRegistry['${regKey}'])">⏱ Expired</button>`;
} else if (status === 'not-interested') {
timestamp = job.hidden_at ? `<div class="job-verdict">Hidden: ${job.hidden_at}</div>` : '';
actions = `<button class="apply-btn neutral" data-jobid="${encodedId}" onclick="restoreNotInterested(decodeURIComponent(this.dataset.jobid))">↩ Undo</button>`;
} else if (status === 'rejected') {
timestamp = job.rejected_at ? `<div class="job-verdict">Rejected: ${job.rejected_at}</div>` : '';
actions = `<button class="apply-btn neutral" data-jobid="${encodedId}" onclick="restoreRejected(decodeURIComponent(this.dataset.jobid))">↩ Move back to Applied</button>`;
}
return `
<div class="job-card applied-card">
<div style="flex:1">
<div class="job-title">${job.title}</div>
<div class="job-company">${job.company} · ${job.location || ''}</div>
<div class="job-meta">${fit}${prob}${sal}</div>
${timestamp}${missingHtml}
<div class="action-btns">${actions}</div>
</div>
<a class="job-link" href="${job.url}" target="_blank">View →</a>
</div>`;
}
// ── Load All Status From Server ────────────────────────────────────────────
async function loadAllStatus() {
try {
const [appRes, niRes, rejRes, intRes, actRes, expRes] = await Promise.all([
fetch('/applied'), fetch('/not_interested'), fetch('/rejected'), fetch('/interested'), fetch('/action_needed'), fetch('/expired')
]);
const appData = await appRes.json();
const niData = await niRes.json();
const rejData = await rejRes.json();
const intData = await intRes.json();
const actData = await actRes.json();
const expData = await expRes.json();
appliedJobs = new Set(Object.keys(appData));
notInterestedJobs = new Set(Object.keys(niData));
rejectedJobs = new Set(Object.keys(rejData));
interestedJobs = new Set(Object.keys(intData));
actionNeededJobs = new Set(Object.keys(actData));
expiredJobs = new Set(Object.keys(expData));
document.getElementById('count-applied').textContent = Object.keys(appData).length;
document.getElementById('count-not-interested').textContent = Object.keys(niData).length;
document.getElementById('count-rejected').textContent = Object.keys(rejData).length;
document.getElementById('count-interested').textContent = Object.keys(intData).length;
document.getElementById('count-action-needed').textContent = Object.keys(actData).length;
document.getElementById('jobs-interested').innerHTML = Object.keys(intData).length
? Object.values(intData).map(j => renderStatusCard(j, 'interested')).join('')
: '<p style="color:var(--muted);font-size:12px;padding:16px">No interested jobs yet.</p>';
renderAppliedTab();
document.getElementById('jobs-not-interested').innerHTML = Object.keys(niData).length
? Object.values(niData).map(j => renderStatusCard(j, 'not-interested')).join('')
: '<p style="color:var(--muted);font-size:12px;padding:16px">No hidden jobs yet.</p>';
document.getElementById('jobs-rejected').innerHTML = Object.keys(rejData).length
? Object.values(rejData).map(j => renderStatusCard(j, 'rejected')).join('')
: '<p style="color:var(--muted);font-size:12px;padding:16px">No rejected jobs yet.</p>';
reRenderSalaryTabs();
} catch(e) { console.error('Could not load status', e); }
}
function renderAppliedTab() {
const allAppliedRes = fetch('/applied').then(r => r.json());
allAppliedRes.then(appData => {
let jobs = Object.values(appData);
if (showActionNeededOnly) {
jobs = jobs.filter(j => actionNeededJobs.has(j.url || j.title));
}
document.getElementById('jobs-applied').innerHTML = jobs.length
? jobs.map(j => renderStatusCard(j, actionNeededJobs.has(j.url || j.title) ? 'action-needed' : 'applied')).join('')
: '<p style="color:var(--muted);font-size:12px;padding:16px">' + (showActionNeededOnly ? 'No jobs needing action.' : 'No applied jobs yet.') + '</p>';
});
}
// ── Actions ───────────────────────────────────────────────────────────────
let pendingApplyJob = null;
function markApplied(job) {
pendingApplyJob = job;
document.getElementById('appTypeModal').classList.add('active');
}
async function confirmApplied(applicationType) {
document.getElementById('appTypeModal').classList.remove('active');
if (!pendingApplyJob) return;
const jobId = pendingApplyJob.url || pendingApplyJob.title;
pendingApplyJob.application_type = applicationType;
await fetch('/applied/mark', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({job: pendingApplyJob}) });
pendingApplyJob = null;
await loadAllStatus();
}
async function switchApplicationType(jobId, newType) {
await fetch('/applied/switch_type', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({job_id:jobId, application_type:newType}) });
await loadAllStatus();
}
async function unmarkApplied(jobId) {
await fetch('/applied/unmark', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({job_id:jobId}) });
await loadAllStatus();
}
async function rejectApplied(jobId) {
await fetch('/applied/reject', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({job_id:jobId}) });
await loadAllStatus();
}
async function markNotInterested(job) {
await fetch('/not_interested/mark', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({job}) });
await loadAllStatus();
}
async function restoreNotInterested(jobId) {
await fetch('/not_interested/restore', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({job_id:jobId}) });
await loadAllStatus();
}
async function restoreRejected(jobId) {
await fetch('/rejected/restore', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({job_id:jobId}) });
await loadAllStatus();
}
async function markInterested(job) {
const jobId = job.url || job.title;
await fetch('/interested/mark', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({job}) });
await loadAllStatus();
}
async function markExpired(job) {
if (!job) {
console.error('markExpired: no job provided');
return;
}
const jobId = job.url || job.title;
if (!jobId) {
console.error('markExpired: job has no url or title', job);
return;
}
try {
const res = await fetch('/expired/mark', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({job}) });
if (!res.ok) {
console.error('markExpired: fetch failed', res.status, res.statusText);
return;
}
await loadAllStatus();
} catch(e) {
console.error('markExpired: error', e);
}
}
async function markActionNeeded(jobId) {
await fetch('/action_needed/mark', { method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({job_id:jobId}) });
await loadAllStatus();
}
// ── Download Applied CSV ──────────────────────────────────────────────────
async function downloadAppliedCsv() {
const res = await fetch('/applied');
const data = await res.json();
const jobs = Object.values(data);
if (!jobs.length) { alert('No applied jobs to export yet.'); return; }
const headers = ['Title','Company','Location','Salary','Fit Score','Response Probability','Missing Skills','Verdict','Applied At','URL'];
const rows = jobs.map(j => [j.title,j.company,j.location,j.salary,j.fit_score,j.response_probability,(j.missing_skills||[]).join(' | '),j.verdict,j.applied_at||'',j.url]);
const csv_content = [headers,...rows].map(r=>r.map(v=>`"${String(v||'').replace(/"/g,'""')}"`).join(',')).join('\n');
const blob = new Blob([csv_content],{type:'text/csv'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href=url; a.download=`applied_jobs_${new Date().toISOString().slice(0,10)}.csv`; a.click();
URL.revokeObjectURL(url);
}
// ── Tabs ──────────────────────────────────────────────────────────────────
function showTab(tab) {
activeTab = tab;
['annual','hourly','missing','interested','applied','not-interested','rejected'].forEach(t => {
const container = document.getElementById('jobs-' + t);
if (container) container.style.display = t === tab ? 'block' : 'none';
const btn = document.getElementById('tab-' + t);
if (btn) btn.classList.toggle('active', t === tab);
});
if (tab === 'applied') {
document.getElementById('applied-filter-toggle').style.display = 'inline-flex';
showActionNeededOnly = false;
} else {
document.getElementById('applied-filter-toggle').style.display = 'none';
}
}
function toggleActionNeededFilter() {
showActionNeededOnly = !showActionNeededOnly;
renderAppliedTab();
}
// ── Load CSV ──────────────────────────────────────────────────────────────
async function loadCsvFile(input) {
const file = input.files[0];
if (!file) return;
document.getElementById('csv-upload-label').textContent = file.name;
document.getElementById('csv-load-status').textContent = 'Loading...';
const formData = new FormData();
formData.append('csv_file', file);
try {
const res = await fetch('/load_csv', { method: 'POST', body: formData });
const data = await res.json();
if (data.error) { document.getElementById('csv-load-status').textContent = '✗ ' + data.error; return; }
allJobsCache = { annual: data.annual, hourly: data.hourly, missing: data.missing };
document.getElementById('count-annual').textContent = data.annual.length;
document.getElementById('count-hourly').textContent = data.hourly.length;
document.getElementById('count-missing').textContent = data.missing.length;
await loadAllStatus();
document.getElementById('salary-section').style.display = 'block';
document.getElementById('csv-load-status').textContent = `✓ ${data.total} jobs loaded`;
document.getElementById('csv-load-status').style.color = 'var(--accent3)';
document.getElementById('salary-section').scrollIntoView({ behavior: 'smooth' });
} catch(e) {
document.getElementById('csv-load-status').textContent = '✗ Failed to load file';
}
}
// ── Pipeline Controls ─────────────────────────────────────────────────────
// Verified June 2026. Models are suggestions in an editable combo — you can
// always type a different id if a provider ships a new one (no code change).
const PROVIDER_MODELS = {
anthropic: { models: ['claude-opus-4-8','claude-sonnet-4-6','claude-haiku-4-5'],
keyLabel: 'Anthropic API Key', placeholder: 'sk-ant-...', custom: false },
deepseek: { models: ['deepseek-v4-pro','deepseek-v4-flash'],
keyLabel: 'DeepSeek API Key', placeholder: 'sk-...', custom: false },
gemini: { models: ['gemini-2.5-pro','gemini-2.5-flash','gemini-3-flash-preview'],
keyLabel: 'Google AI API Key', placeholder: 'AIza...', custom: false },
openai: { models: ['gpt-4o','gpt-4o-mini'],
keyLabel: 'OpenAI API Key', placeholder: 'sk-...', custom: false },
llama: { models: ['Llama-4-Maverick-17B-128E-Instruct-FP8','Llama-4-Scout-17B-16E-Instruct'],
keyLabel: 'Llama API Key', placeholder: 'LLM|...', custom: false },
custom: { models: [], keyLabel: 'API Key', placeholder: 'sk-...', custom: true },
};
function updateProviderUI() {
const provider = document.getElementById('llm-provider').value;
const modelInput = document.getElementById('llm-model');
const datalist = document.getElementById('model-options');
const apiKeyLabel = document.getElementById('api-key-label');
const baseUrlField = document.getElementById('base-url-field');
const d = PROVIDER_MODELS[provider] || PROVIDER_MODELS.custom;
// Repopulate model suggestions for this provider.
datalist.innerHTML = d.models.map(m => `<option value="${m}"></option>`).join('');
// If the current value is another provider's known default, swap to this
// provider's default. A custom-typed id (not in any list) is preserved.
const allKnown = Object.values(PROVIDER_MODELS).flatMap(p => p.models);
if (!modelInput.value || (allKnown.includes(modelInput.value) && !d.models.includes(modelInput.value))) {
modelInput.value = d.models[0] || '';
}
modelInput.placeholder = d.models[0] || 'model-id';
apiKeyLabel.textContent = d.keyLabel;
document.getElementById('llm-api-key').placeholder = d.placeholder;
baseUrlField.style.display = d.custom ? 'flex' : 'none';
}
// Test Run: force the single-job flag, make sure the AI key field is visible
// (a test always scores), then submit the same form.
function startSingleRun() {
document.getElementById('single-run-input').value = '1';
document.getElementById('ai-fields').classList.remove('hidden');
document.getElementById('main-form').requestSubmit();
}
function setMode(mode) {
currentMode = mode;
document.getElementById('mode-input').value = mode;
document.querySelectorAll('.mode-card').forEach(c => c.classList.remove('active'));
document.getElementById('mode-' + mode).classList.add('active');
const aiFields = document.getElementById('ai-fields');
const resumeInput = document.getElementById('resume-input');
const apiKeyInput = document.getElementById('llm-api-key');
if (mode === 'scraper_only') {
aiFields.classList.add('hidden');
resumeInput.removeAttribute('required');
if (apiKeyInput) apiKeyInput.removeAttribute('required');
} else {
aiFields.classList.remove('hidden');
resumeInput.setAttribute('required', '');
if (apiKeyInput) apiKeyInput.setAttribute('required', '');
}
}
function showFileName(input) {
document.getElementById('file-name').textContent = input.files[0]?.name || '';
}
async function startRun(e) {
e.preventDefault();
const formData = new FormData(document.getElementById('main-form'));
const isSingle = formData.get('single_run') === '1';
// Reset the flag immediately so the next normal Run isn't a test run.
document.getElementById('single-run-input').value = '';
const btn = document.getElementById('run-btn');
btn.disabled = true;
btn.innerHTML = '<span class="spinner"></span>' + (isSingle ? 'Testing one job...' : 'Running...');
btn.classList.add('running');
document.getElementById('test-btn').disabled = true;
document.getElementById('progress').style.display = 'block';
document.getElementById('downloads').style.display = 'none';
document.getElementById('salary-section').style.display = 'none';
document.getElementById('log-box').innerHTML = '';
document.getElementById('stop-btn').style.display = 'block';
document.getElementById('reset-btn').style.display = 'none';
try {
const res = await fetch('/run', { method: 'POST', body: formData });
const data = await res.json();
if (data.error) { showError(data.error); return; }
startPolling();
} catch (err) { showError(err.message); }
}
function startPolling() {
polling = setInterval(async () => {
try {
const res = await fetch('/status');
const data = await res.json();
updateUI(data);
if (!data.running) { clearInterval(polling); onComplete(data); }
} catch(e) {}
}, 1500);
}
function updateUI(data) {
const pill = document.getElementById('stage-pill');
pill.textContent = data.stage || 'Running';
pill.className = 'stage-pill';
if (data.stage === 'Done ✓') pill.classList.add('done');
if (data.stage === 'Error') pill.classList.add('error');
document.getElementById('stat-scraped').textContent = data.job_count;
document.getElementById('stat-scored').textContent = data.scored_count;
document.getElementById('stat-stage').textContent = data.stage.length > 8 ? data.stage.slice(0,8)+'…' : data.stage;
const box = document.getElementById('log-box');
box.innerHTML = data.log.map(line => {
const cls = line.startsWith('✓') ? 'ok' : line.startsWith('✗') ? 'err' : '';
return `<div class="${cls}">${line}</div>`;
}).join('');
box.scrollTop = box.scrollHeight;
}
async function onComplete(data) {
const btn = document.getElementById('run-btn');
btn.disabled = false;
btn.classList.remove('running');
document.getElementById('test-btn').disabled = false;
document.getElementById('stop-btn').style.display = 'none';
document.getElementById('reset-btn').style.display = 'block';
if (data.error) { btn.innerHTML = '✗ Error — try again'; return; }
const stopped = data.stage === 'Stopped ⚠';
btn.innerHTML = stopped ? '⚠ Stopped — Run Again' : '✓ Done — Run Again';
document.getElementById('downloads').style.display = 'grid';
if (currentMode === 'scraper_only') {
document.getElementById('dl-skills').classList.add('hidden');
document.getElementById('dl-plan').classList.add('hidden');
} else if (currentMode === 'with_scoring') {
document.getElementById('dl-plan').classList.add('hidden');
}
// Load jobs from salary_stats
try {
const res = await fetch('/salary_stats');
const statsData = await res.json();
allJobsCache = { annual: statsData.annual, hourly: statsData.hourly, missing: statsData.missing };
document.getElementById('count-annual').textContent = statsData.annual.length;
document.getElementById('count-hourly').textContent = statsData.hourly.length;
document.getElementById('count-missing').textContent = statsData.missing.length;
await loadAllStatus();
document.getElementById('salary-section').style.display = 'block';
} catch(e) {}
}
async function stopRun() {
await fetch('/stop', { method: 'POST' });
document.getElementById('stop-btn').textContent = '⚠ Stopping...';
document.getElementById('stop-btn').disabled = true;
}
async function resetRun() {
await fetch('/reset', { method: 'POST' });
document.getElementById('reset-btn').style.display = 'none';
document.getElementById('run-btn').disabled = false;
document.getElementById('run-btn').classList.remove('running');
document.getElementById('run-btn').innerHTML = 'Run Pipeline';
document.getElementById('test-btn').disabled = false;
document.getElementById('stop-btn').style.display = 'none';
document.getElementById('stop-btn').disabled = false;
document.getElementById('stop-btn').textContent = '⚠ Stop Pipeline';
document.getElementById('progress').style.display = 'none';
document.getElementById('downloads').style.display = 'none';
document.getElementById('salary-section').style.display = 'none';
document.getElementById('log-box').innerHTML = '';
}
function showError(msg) {
const btn = document.getElementById('run-btn');
btn.disabled = false;
btn.classList.remove('running');
btn.innerHTML = '✗ Error — try again';
document.getElementById('test-btn').disabled = false;
// The progress panel hosts the log-box; without showing it the error is
// written into an invisible element. Reveal it so the user actually sees.
document.getElementById('progress').style.display = 'block';
document.getElementById('log-box').innerHTML = `<div class="err">Error: ${msg}</div>`;
document.getElementById('stop-btn').style.display = 'none';
document.getElementById('reset-btn').style.display = 'block';
}
// ── Prefill from config.json ───────────────────────────────────────────────
async function loadConfig() {
try {
const res = await fetch('/config');
const cfg = await res.json();
if (cfg.email) document.querySelector('input[name=email]').value = cfg.email;
if (cfg.password) document.querySelector('input[name=password]').value = cfg.password;
if (cfg.llm_provider) { document.getElementById('llm-provider').value = cfg.llm_provider; updateProviderUI(); }
if (cfg.llm_model) document.getElementById('llm-model').value = cfg.llm_model;
if (cfg.llm_base_url) { const f = document.querySelector('input[name=llm_base_url]'); if (f) f.value = cfg.llm_base_url; }
if (cfg.speed) document.getElementById('speed-select').value = cfg.speed;
if (cfg.llm_api_key) document.getElementById('llm-api-key').value = cfg.llm_api_key;
if (cfg.keywords) document.querySelector('input[name=keywords]').value = cfg.keywords;
if (cfg.location) document.querySelector('input[name=location]').value = cfg.location;
if (cfg.profession) document.querySelector('input[name=profession]').value = cfg.profession;
} catch(e) {}
}
// ── Init ──────────────────────────────────────────────────────────────────
setMode('scraper_only');
loadAllStatus();
loadConfig();
// On page load, sync UI with whatever the server is doing right now.
// Without this, a running pipeline (or one with leftover logs) is invisible
// because polling only starts when YOU click Run successfully.
async function syncWithServer() {
try {
const res = await fetch('/status');
const data = await res.json();
const hasLogs = data.log && data.log.length > 0;
if (data.running || hasLogs) {
document.getElementById('progress').style.display = 'block';
updateUI(data);
if (data.running) {
document.getElementById('stop-btn').style.display = 'block';
document.getElementById('reset-btn').style.display = 'none';
const btn = document.getElementById('run-btn');
btn.disabled = true;
btn.classList.add('running');
btn.innerHTML = '⏳ Pipeline running…';
document.getElementById('test-btn').disabled = true;
startPolling();
} else {
// Not running but has logs — show Reset so user can clear them
document.getElementById('reset-btn').style.display = 'block';
}
}
} catch (e) { console.error('syncWithServer failed', e); }
}
syncWithServer();
</script> <!-- Application Type Modal -->
<div class="modal" id="appTypeModal">
<div class="modal-content">
<div class="modal-title">How did you apply?</div>
<div class="modal-buttons">
<button class="modal-btn easy" onclick="confirmApplied('easy_apply')">📱 Easy Apply</button>
<button class="modal-btn cover" onclick="confirmApplied('cover_letter')">📝 Cover Letter</button>
</div>
</div>
</div>
</body>
</html>