@internetarchive/ia-topnav 1.1.19 → 1.1.21-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/.eslintrc +16 -16
  2. package/.storybook/.babelrc +15 -15
  3. package/.storybook/addons.js +7 -7
  4. package/.storybook/config.js +11 -11
  5. package/.storybook/webpack.config.js +5 -5
  6. package/LICENSE +661 -661
  7. package/README.md +145 -145
  8. package/demo.html +41 -41
  9. package/index.d.ts +105 -105
  10. package/index.js +3 -3
  11. package/package.json +65 -65
  12. package/src/assets/img/hamburger.js +36 -36
  13. package/src/assets/img/ia-icon.js +33 -33
  14. package/src/assets/img/icon-audio.js +23 -23
  15. package/src/assets/img/icon-close.js +16 -16
  16. package/src/assets/img/icon-donate.js +15 -15
  17. package/src/assets/img/icon-ellipses.js +15 -15
  18. package/src/assets/img/icon-ia-logo.js +24 -24
  19. package/src/assets/img/icon-images.js +15 -15
  20. package/src/assets/img/icon-search.js +15 -15
  21. package/src/assets/img/icon-software.js +15 -15
  22. package/src/assets/img/icon-texts.js +15 -15
  23. package/src/assets/img/icon-upload.js +15 -15
  24. package/src/assets/img/icon-user.js +15 -15
  25. package/src/assets/img/icon-video.js +15 -15
  26. package/src/assets/img/icon-web.js +15 -15
  27. package/src/assets/img/icon.js +18 -18
  28. package/src/assets/img/icons.js +29 -29
  29. package/src/assets/img/user.js +38 -38
  30. package/src/assets/img/wordmark-stacked.js +13 -13
  31. package/src/data/menus.js +603 -603
  32. package/src/desktop-subnav.js +45 -45
  33. package/src/dropdown-menu.js +98 -98
  34. package/src/ia-topnav.js +285 -285
  35. package/src/lib/formatUrl.js +1 -1
  36. package/src/lib/location-handler.js +5 -5
  37. package/src/lib/query-handler.js +7 -7
  38. package/src/lib/toSentenceCase.js +8 -8
  39. package/src/login-button.js +79 -79
  40. package/src/media-button.js +113 -113
  41. package/src/media-menu.js +133 -133
  42. package/src/media-slider.js +104 -104
  43. package/src/media-subnav.js +112 -112
  44. package/src/more-slider.js +33 -33
  45. package/src/nav-search.js +124 -124
  46. package/src/primary-nav.js +211 -211
  47. package/src/save-page-form.js +59 -59
  48. package/src/search-menu.js +115 -115
  49. package/src/signed-out-dropdown.js +10 -10
  50. package/src/styles/base.js +48 -48
  51. package/src/styles/desktop-subnav.js +37 -37
  52. package/src/styles/dropdown-menu.js +143 -143
  53. package/src/styles/ia-topnav.js +88 -88
  54. package/src/styles/login-button.js +70 -70
  55. package/src/styles/media-button.js +153 -153
  56. package/src/styles/media-menu.js +70 -70
  57. package/src/styles/media-slider.js +81 -81
  58. package/src/styles/media-subnav.js +156 -156
  59. package/src/styles/more-slider.js +15 -15
  60. package/src/styles/nav-search.js +134 -130
  61. package/src/styles/primary-nav.js +254 -254
  62. package/src/styles/save-page-form.js +53 -52
  63. package/src/styles/search-menu.js +104 -103
  64. package/src/styles/signed-out-dropdown.js +31 -31
  65. package/src/styles/user-menu.js +31 -31
  66. package/src/styles/wayback-search.js +48 -48
  67. package/src/styles/wayback-slider.js +30 -30
  68. package/src/tracked-element.js +27 -27
  69. package/src/user-menu.js +42 -42
  70. package/src/wayback-search.js +18 -18
  71. package/src/wayback-slider.js +88 -88
  72. package/stories/topnav-element.stories.js +7 -7
  73. package/test/assets/img/hamburger.test.js +15 -15
  74. package/test/assets/img/user.test.js +15 -15
  75. package/test/data/menus.test.js +19 -19
  76. package/test/dropdown-menu.test.js +25 -25
  77. package/test/ia-icon.test.js +13 -13
  78. package/test/ia-topnav.test.js +273 -273
  79. package/test/login-button.test.js +15 -15
  80. package/test/media-button.test.js +19 -19
  81. package/test/media-menu.test.js +40 -40
  82. package/test/media-slider.test.js +57 -57
  83. package/test/more-slider.test.js +13 -13
  84. package/test/nav-search.test.js +61 -61
  85. package/test/primary-nav.test.js +82 -82
  86. package/test/save-page-form.test.js +35 -35
  87. package/test/search-menu.test.js +49 -49
  88. package/test/user-menu.test.js +33 -33
  89. package/test/wayback-slider.test.js +80 -80
package/src/data/menus.js CHANGED
@@ -1,603 +1,603 @@
1
- // @see https://git.archive.org/www/offshoot/-/blob/main/guides/update-top-nav.md
2
-
3
- export const defaultTopNavConfig = {
4
- // Google Analytics event category
5
- eventCategory: 'TopNav',
6
- // Array of strings representing the values of options that should be hidden from search options
7
- hiddenSearchOptions: [],
8
- // Default value, if more accurate value is not passed in to `buildTopNavMenus()`
9
- waybackPagesArchived: '740 billion',
10
- };
11
-
12
-
13
- /**
14
- * Creates archive.org top navigation configuration
15
- * @param { string } userid archive.org account (immutable) userid
16
- * @param { boolean } localLinks passing in false will ensure all links begin: https://archive.org
17
- * @param { string } waybackPagesArchived label readable 'how many pages in WayBack machine?'
18
- * If you don't pass in something, you'll get the potentially
19
- * older/less accurate version. Otherwise,
20
- * @see waybackPagesArchivedFN() (below) (please cache it)
21
- * for a live service accurate count result.
22
- * @returns { object }
23
- */
24
- export function buildTopNavMenus(userid = '___USERID___', localLinks = true, waybackPagesArchived = '') {
25
- if (waybackPagesArchived)
26
- defaultTopNavConfig.waybackPagesArchived = waybackPagesArchived // update to more accurate val
27
-
28
-
29
- const prefix = localLinks ? '' : 'https://archive.org'
30
- return {
31
- audio: {
32
- heading: 'Internet Archive Audio',
33
- iconLinks: [
34
- {
35
- icon: `${prefix}/services/img/etree`,
36
- title: 'Live Music Archive',
37
- url: `${prefix}/details/etree`,
38
- },
39
- {
40
- icon: `${prefix}/services/img/librivoxaudio`,
41
- title: 'Librivox Free Audio',
42
- url: `${prefix}/details/librivoxaudio`,
43
- },
44
- ],
45
- featuredLinks: [
46
- {
47
- title: 'All Audio',
48
- url: `${prefix}/details/audio`,
49
- },
50
- {
51
- title: 'This Just In',
52
- url: `${prefix}/search.php?query=mediatype:audio&sort=-publicdate`,
53
- },
54
- {
55
- title: 'Grateful Dead',
56
- url: `${prefix}/details/GratefulDead`,
57
- },
58
- {
59
- title: 'Netlabels',
60
- url: `${prefix}/details/netlabels`,
61
- },
62
- {
63
- title: 'Old Time Radio',
64
- url: `${prefix}/details/oldtimeradio`,
65
- },
66
- {
67
- title: '78 RPMs and Cylinder Recordings',
68
- url: `${prefix}/details/78rpm`,
69
- },
70
- ],
71
- links: [
72
- {
73
- title: 'Audio Books & Poetry',
74
- url: `${prefix}/details/audio_bookspoetry`,
75
- },
76
- {
77
- title: 'Computers, Technology and Science',
78
- url: `${prefix}/details/audio_tech`,
79
- },
80
- {
81
- title: 'Music, Arts & Culture',
82
- url: `${prefix}/details/audio_music`,
83
- },
84
- {
85
- title: 'News & Public Affairs',
86
- url: `${prefix}/details/audio_news`,
87
- },
88
- {
89
- title: 'Spirituality & Religion',
90
- url: `${prefix}/details/audio_religion`,
91
- },
92
- {
93
- title: 'Podcasts',
94
- url: `${prefix}/details/podcasts`,
95
- },
96
- {
97
- title: 'Radio News Archive',
98
- url: `${prefix}/details/radio`,
99
- },
100
- ],
101
- },
102
- images: {
103
- heading: 'Images',
104
- iconLinks: [
105
- {
106
- icon: `${prefix}/services/img/metropolitanmuseumofart-gallery`,
107
- title: 'Metropolitan Museum',
108
- url: `${prefix}/details/metropolitanmuseumofart-gallery`,
109
- },
110
- {
111
- icon: `${prefix}/services/img/clevelandart`,
112
- title: 'Cleveland Museum of Art',
113
- url: `${prefix}/details/clevelandart`,
114
- },
115
- ],
116
- featuredLinks: [
117
- {
118
- title: 'All Images',
119
- url: `${prefix}/details/image`,
120
- },
121
- {
122
- title: 'This Just In',
123
- url: `${prefix}/search.php?query=mediatype:image&sort=-publicdate`,
124
- },
125
- {
126
- title: 'Flickr Commons',
127
- url: `${prefix}/details/flickrcommons`,
128
- },
129
- {
130
- title: 'Occupy Wall Street Flickr',
131
- url: `${prefix}/details/flickr-ows`,
132
- },
133
- {
134
- title: 'Cover Art',
135
- url: `${prefix}/details/coverartarchive`,
136
- },
137
- {
138
- title: 'USGS Maps',
139
- url: `${prefix}/details/maps_usgs`,
140
- },
141
- ],
142
- links: [
143
- {
144
- title: 'NASA Images',
145
- url: `${prefix}/details/nasa`,
146
- },
147
- {
148
- title: 'Solar System Collection',
149
- url: `${prefix}/details/solarsystemcollection`,
150
- },
151
- {
152
- title: 'Ames Research Center',
153
- url: `${prefix}/details/amesresearchcenterimagelibrary`,
154
- },
155
- ],
156
- },
157
- more: [
158
- {
159
- title: 'About',
160
- url: `${prefix}/about/`,
161
- },
162
- {
163
- title: 'Blog',
164
- url: 'https://blog.archive.org',
165
- },
166
- {
167
- title: 'Projects',
168
- url: `${prefix}/projects/`,
169
- },
170
- {
171
- title: 'Help',
172
- url: `${prefix}/about/faqs.php`,
173
- },
174
- {
175
- title: 'Donate',
176
- url: `${prefix}/donate?origin=iawww-TopNavDonateButton`,
177
- },
178
- {
179
- title: 'Contact',
180
- url: `${prefix}/about/contact.php`,
181
- },
182
- {
183
- title: 'Jobs',
184
- url: `${prefix}/about/jobs.php`,
185
- },
186
- {
187
- title: 'Volunteer',
188
- url: `${prefix}/about/volunteerpositions.php`,
189
- },
190
- {
191
- title: 'People',
192
- url: `${prefix}/about/bios.php`,
193
- },
194
- ],
195
- software: {
196
- heading: 'Software',
197
- iconLinks: [
198
- {
199
- icon: `${prefix}/services/img/internetarcade`,
200
- title: 'Internet Arcade',
201
- url: `${prefix}/details/internetarcade`,
202
- },
203
- {
204
- icon: `${prefix}/services/img/consolelivingroom`,
205
- title: 'Console Living Room',
206
- url: `${prefix}/details/consolelivingroom`,
207
- },
208
- ],
209
- featuredLinks: [
210
- {
211
- title: 'All Software',
212
- url: `${prefix}/details/software`,
213
- },
214
- {
215
- title: 'This Just In',
216
- url: `${prefix}/search.php?query=mediatype:software&sort=-publicdate`,
217
- },
218
- {
219
- title: 'Old School Emulation',
220
- url: `${prefix}/details/tosec`,
221
- },
222
- {
223
- title: 'MS-DOS Games',
224
- url: `${prefix}/details/softwarelibrary_msdos_games`,
225
- },
226
- {
227
- title: 'Historical Software',
228
- url: `${prefix}/details/historicalsoftware`,
229
- },
230
- {
231
- title: 'Classic PC Games',
232
- url: `${prefix}/details/classicpcgames`,
233
- },
234
- {
235
- title: 'Software Library',
236
- url: `${prefix}/details/softwarelibrary`,
237
- },
238
- ],
239
- links: [
240
- {
241
- title: 'Kodi Archive and Support File',
242
- url: `${prefix}/details/kodi_archive`,
243
- },
244
- {
245
- title: 'Vintage Software',
246
- url: `${prefix}/details/vintagesoftware`,
247
- },
248
- {
249
- title: 'APK',
250
- url: `${prefix}/details/apkarchive`,
251
- },
252
- {
253
- title: 'MS-DOS',
254
- url: `${prefix}/details/softwarelibrary_msdos`,
255
- },
256
- {
257
- title: 'CD-ROM Software',
258
- url: `${prefix}/details/cd-roms`,
259
- },
260
- {
261
- title: 'CD-ROM Software Library',
262
- url: `${prefix}/details/cdromsoftware`,
263
- },
264
- {
265
- title: 'Software Sites',
266
- url: `${prefix}/details/softwaresites`,
267
- },
268
- {
269
- title: 'Tucows Software Library',
270
- url: `${prefix}/details/tucows`,
271
- },
272
- {
273
- title: 'Shareware CD-ROMs',
274
- url: `${prefix}/details/cdbbsarchive`,
275
- },
276
- {
277
- title: 'Software Capsules Compilation',
278
- url: `${prefix}/details/softwarecapsules`,
279
- },
280
- {
281
- title: 'CD-ROM Images',
282
- url: `${prefix}/details/cdromimages`,
283
- },
284
- {
285
- title: 'ZX Spectrum',
286
- url: `${prefix}/details/softwarelibrary_zx_spectrum`,
287
- },
288
- {
289
- title: 'DOOM Level CD',
290
- url: `${prefix}/details/doom-cds`,
291
- },
292
- ],
293
- },
294
- texts: {
295
- heading: 'Books',
296
- iconLinks: [
297
- {
298
- title: 'Books to Borrow',
299
- icon: `${prefix}/images/book-lend.png`,
300
- url: `${prefix}/details/inlibrary`,
301
- },
302
- {
303
- title: 'Open Library',
304
- icon: `${prefix}/images/widgetOL.png`,
305
- url: 'https://openlibrary.org/',
306
- },
307
- ],
308
- featuredLinks: [
309
- {
310
- title: 'All Books',
311
- url: `${prefix}/details/books`,
312
- },
313
- {
314
- title: 'All Texts',
315
- url: `${prefix}/details/texts`,
316
- },
317
- {
318
- title: 'This Just In',
319
- url: `${prefix}/search.php?query=mediatype:texts&sort=-publicdate`,
320
- },
321
- {
322
- title: 'Smithsonian Libraries',
323
- url: `${prefix}/details/smithsonian`,
324
- },
325
- {
326
- title: 'FEDLINK (US)',
327
- url: `${prefix}/details/fedlink`,
328
- },
329
- {
330
- title: 'Genealogy',
331
- url: `${prefix}/details/genealogy`,
332
- },
333
- {
334
- title: 'Lincoln Collection',
335
- url: `${prefix}/details/lincolncollection`,
336
- },
337
- ],
338
- links: [
339
- {
340
- title: 'American Libraries',
341
- url: `${prefix}/details/americana`,
342
- },
343
- {
344
- title: 'Canadian Libraries',
345
- url: `${prefix}/details/toronto`,
346
- },
347
- {
348
- title: 'Universal Library',
349
- url: `${prefix}/details/universallibrary`,
350
- },
351
- {
352
- title: 'Project Gutenberg',
353
- url: `${prefix}/details/gutenberg`,
354
- },
355
- {
356
- title: "Children's Library",
357
- url: `${prefix}/details/iacl`,
358
- },
359
- {
360
- title: 'Biodiversity Heritage Library',
361
- url: `${prefix}/details/biodiversity`,
362
- },
363
- {
364
- title: 'Books by Language',
365
- url: `${prefix}/details/booksbylanguage`,
366
- },
367
- {
368
- title: 'Additional Collections',
369
- url: `${prefix}/details/additional_collections`,
370
- },
371
- ],
372
- },
373
- web: {
374
- mobileAppsLinks: [
375
- {
376
- url: 'https://apps.apple.com/us/app/wayback-machine/id1201888313',
377
- title: 'Wayback Machine (iOS)',
378
- external: true,
379
- },
380
- {
381
- url: 'https://play.google.com/store/apps/details?id=com.archive.waybackmachine&hl=en_US',
382
- title: 'Wayback Machine (Android)',
383
- external: true,
384
- },
385
- ],
386
- browserExtensionsLinks: [
387
- {
388
- url: 'https://chrome.google.com/webstore/detail/wayback-machine/fpnmgdkabkmnadcjpehmlllkndpkmiak',
389
- title: 'Chrome',
390
- external: true,
391
- },
392
- {
393
- url: 'https://addons.mozilla.org/en-US/firefox/addon/wayback-machine_new/',
394
- title: 'Firefox',
395
- external: true,
396
- },
397
- {
398
- url: 'https://apps.apple.com/us/app/wayback-machine/id1472432422?mt=12',
399
- title: 'Safari',
400
- external: true,
401
- },
402
- {
403
- url: 'https://microsoftedge.microsoft.com/addons/detail/wayback-machine/kjmickeoogghaimmomagaghnogelpcpn?hl=en-US',
404
- title: 'Edge',
405
- external: true,
406
- },
407
- ],
408
- archiveItLinks: [
409
- {
410
- url: 'https://www.archive-it.org/explore',
411
- title: 'Explore the Collections',
412
- external: true,
413
- },
414
- {
415
- url: 'https://www.archive-it.org/blog/learn-more/',
416
- title: 'Learn More',
417
- external: true,
418
- },
419
- {
420
- url: 'https://www.archive-it.org/contact-us',
421
- title: 'Build Collections',
422
- external: true,
423
- },
424
- ],
425
- },
426
- video: {
427
- heading: 'Video',
428
- iconLinks: [
429
- {
430
- icon: `${prefix}/services/img/tv`,
431
- title: 'TV News',
432
- url: `${prefix}/details/tv`,
433
- },
434
- {
435
- icon: `${prefix}/services/img/911`,
436
- title: 'Understanding 9/11',
437
- url: `${prefix}/details/911`,
438
- },
439
- ],
440
- featuredLinks: [
441
- {
442
- title: 'All Video',
443
- url: `${prefix}/details/movies`,
444
- },
445
- {
446
- title: 'This Just In',
447
- url: `${prefix}/search.php?query=mediatype:movies&sort=-publicdate`,
448
- },
449
- {
450
- title: 'Prelinger Archives',
451
- url: `${prefix}/details/prelinger`,
452
- },
453
- {
454
- title: 'Democracy Now!',
455
- url: `${prefix}/details/democracy_now_vid`,
456
- },
457
- {
458
- title: 'Occupy Wall Street',
459
- url: `${prefix}/details/occupywallstreet`,
460
- },
461
- {
462
- title: 'TV NSA Clip Library',
463
- url: `${prefix}/details/nsa`,
464
- },
465
- ],
466
- links: [
467
- {
468
- title: 'Animation & Cartoons',
469
- url: `${prefix}/details/animationandcartoons`,
470
- },
471
- {
472
- title: 'Arts & Music',
473
- url: `${prefix}/details/artsandmusicvideos`,
474
- },
475
- {
476
- title: 'Computers & Technology',
477
- url: `${prefix}/details/computersandtechvideos`,
478
- },
479
- {
480
- title: 'Cultural & Academic Films',
481
- url: `${prefix}/details/culturalandacademicfilms`,
482
- },
483
- {
484
- title: 'Ephemeral Films',
485
- url: `${prefix}/details/ephemera`,
486
- },
487
- {
488
- title: 'Movies',
489
- url: `${prefix}/details/moviesandfilms`,
490
- },
491
- {
492
- title: 'News & Public Affairs',
493
- url: `${prefix}/details/newsandpublicaffairs`,
494
- },
495
- {
496
- title: 'Spirituality & Religion',
497
- url: `${prefix}/details/spiritualityandreligion`,
498
- },
499
- {
500
- title: 'Sports Videos',
501
- url: `${prefix}/details/sports`,
502
- },
503
- {
504
- title: 'Television',
505
- url: `${prefix}/details/television`,
506
- },
507
- {
508
- title: 'Videogame Videos',
509
- url: `${prefix}/details/gamevideos`,
510
- },
511
- {
512
- title: 'Vlogs',
513
- url: `${prefix}/details/vlogs`,
514
- },
515
- {
516
- title: 'Youth Media',
517
- url: `${prefix}/details/youth_media`,
518
- },
519
- ],
520
- },
521
- user: [
522
- {
523
- url: `${prefix}/create`,
524
- title: 'Upload files',
525
- analyticsEvent: 'UserUpload',
526
- },
527
- {
528
- url: `${prefix}/details/@${userid}`,
529
- title: 'My uploads',
530
- analyticsEvent: 'UserLibrary',
531
- },
532
- {
533
- url: `${prefix}/details/@${userid}?tab=loans`,
534
- title: 'My loans',
535
- analyticsEvent: 'UserLoans',
536
- },
537
- {
538
- url: `${prefix}/details/fav-${userid}`,
539
- title: 'My favorites',
540
- analyticsEvent: 'UserFavorites',
541
- },
542
- {
543
- url: `${prefix}/details/@${userid}/web-archive`,
544
- title: 'My web archives',
545
- analyticsEvent: 'UserWebArchive',
546
- },
547
- {
548
- url: `${prefix}/account/index.php?settings=1`,
549
- title: 'Account settings',
550
- analyticsEvent: 'UserSettings',
551
- },
552
- {
553
- url: 'https://help.archive.org',
554
- title: 'Get help',
555
- analyticsEvent: 'UserHelp',
556
- },
557
- {
558
- url: `${prefix}/account/logout`,
559
- title: 'Log out',
560
- analyticsEvent: 'UserLogOut',
561
- },
562
- ],
563
- signedOut: [
564
- {
565
- url: `${prefix}/account/signup`,
566
- title: 'Sign up for free',
567
- analyticsEvent: 'AvatarMenu-Signup',
568
- },
569
- {
570
- url: `${prefix}/account/login`,
571
- title: 'Log in',
572
- analyticsEvent: 'AvatarMenu-Login',
573
- },
574
- ],
575
- };
576
- };
577
-
578
-
579
- let waybackPagesArchivedCached
580
-
581
- /**
582
- * Fetches accurate count of number of pages in WayBack Machine
583
- * @returns { string }
584
- */
585
- export async function waybackPagesArchivedFN() {
586
- if (waybackPagesArchivedCached)
587
- return waybackPagesArchivedCached;
588
-
589
- const counts = await (await fetch('https://archive.org/services/offshoot/home-page/mediacounts.php')).json();
590
- if (counts.success) {
591
- let label = ''
592
- let n = parseInt(counts.value.counts.web, 10);
593
- if (n > 1000) { n /= 1000; label = 'thousand'; }
594
- if (n > 1000) { n /= 1000; label = 'million'; }
595
- if (n > 1000) { n /= 1000; label = 'billion'; }
596
- if (n > 1000) { n /= 1000; label = 'trillion'; }
597
- waybackPagesArchivedCached = `${Math.round(n)} ${label}`
598
- } else {
599
- waybackPagesArchivedCached = '741 billion';
600
- }
601
-
602
- return waybackPagesArchivedCached;
603
- }
1
+ // @see https://git.archive.org/www/offshoot/-/blob/main/guides/update-top-nav.md
2
+
3
+ export const defaultTopNavConfig = {
4
+ // Google Analytics event category
5
+ eventCategory: 'TopNav',
6
+ // Array of strings representing the values of options that should be hidden from search options
7
+ hiddenSearchOptions: [],
8
+ // Default value, if more accurate value is not passed in to `buildTopNavMenus()`
9
+ waybackPagesArchived: '740 billion',
10
+ };
11
+
12
+
13
+ /**
14
+ * Creates archive.org top navigation configuration
15
+ * @param { string } userid archive.org account (immutable) userid
16
+ * @param { boolean } localLinks passing in false will ensure all links begin: https://archive.org
17
+ * @param { string } waybackPagesArchived label readable 'how many pages in WayBack machine?'
18
+ * If you don't pass in something, you'll get the potentially
19
+ * older/less accurate version. Otherwise,
20
+ * @see waybackPagesArchivedFN() (below) (please cache it)
21
+ * for a live service accurate count result.
22
+ * @returns { object }
23
+ */
24
+ export function buildTopNavMenus(userid = '___USERID___', localLinks = true, waybackPagesArchived = '') {
25
+ if (waybackPagesArchived)
26
+ defaultTopNavConfig.waybackPagesArchived = waybackPagesArchived // update to more accurate val
27
+
28
+
29
+ const prefix = localLinks ? '' : 'https://archive.org'
30
+ return {
31
+ audio: {
32
+ heading: 'Internet Archive Audio',
33
+ iconLinks: [
34
+ {
35
+ icon: `${prefix}/services/img/etree`,
36
+ title: 'Live Music Archive',
37
+ url: `${prefix}/details/etree`,
38
+ },
39
+ {
40
+ icon: `${prefix}/services/img/librivoxaudio`,
41
+ title: 'Librivox Free Audio',
42
+ url: `${prefix}/details/librivoxaudio`,
43
+ },
44
+ ],
45
+ featuredLinks: [
46
+ {
47
+ title: 'All Audio',
48
+ url: `${prefix}/details/audio`,
49
+ },
50
+ {
51
+ title: 'This Just In',
52
+ url: `${prefix}/search.php?query=mediatype:audio&sort=-publicdate`,
53
+ },
54
+ {
55
+ title: 'Grateful Dead',
56
+ url: `${prefix}/details/GratefulDead`,
57
+ },
58
+ {
59
+ title: 'Netlabels',
60
+ url: `${prefix}/details/netlabels`,
61
+ },
62
+ {
63
+ title: 'Old Time Radio',
64
+ url: `${prefix}/details/oldtimeradio`,
65
+ },
66
+ {
67
+ title: '78 RPMs and Cylinder Recordings',
68
+ url: `${prefix}/details/78rpm`,
69
+ },
70
+ ],
71
+ links: [
72
+ {
73
+ title: 'Audio Books & Poetry',
74
+ url: `${prefix}/details/audio_bookspoetry`,
75
+ },
76
+ {
77
+ title: 'Computers, Technology and Science',
78
+ url: `${prefix}/details/audio_tech`,
79
+ },
80
+ {
81
+ title: 'Music, Arts & Culture',
82
+ url: `${prefix}/details/audio_music`,
83
+ },
84
+ {
85
+ title: 'News & Public Affairs',
86
+ url: `${prefix}/details/audio_news`,
87
+ },
88
+ {
89
+ title: 'Spirituality & Religion',
90
+ url: `${prefix}/details/audio_religion`,
91
+ },
92
+ {
93
+ title: 'Podcasts',
94
+ url: `${prefix}/details/podcasts`,
95
+ },
96
+ {
97
+ title: 'Radio News Archive',
98
+ url: `${prefix}/details/radio`,
99
+ },
100
+ ],
101
+ },
102
+ images: {
103
+ heading: 'Images',
104
+ iconLinks: [
105
+ {
106
+ icon: `${prefix}/services/img/metropolitanmuseumofart-gallery`,
107
+ title: 'Metropolitan Museum',
108
+ url: `${prefix}/details/metropolitanmuseumofart-gallery`,
109
+ },
110
+ {
111
+ icon: `${prefix}/services/img/clevelandart`,
112
+ title: 'Cleveland Museum of Art',
113
+ url: `${prefix}/details/clevelandart`,
114
+ },
115
+ ],
116
+ featuredLinks: [
117
+ {
118
+ title: 'All Images',
119
+ url: `${prefix}/details/image`,
120
+ },
121
+ {
122
+ title: 'This Just In',
123
+ url: `${prefix}/search.php?query=mediatype:image&sort=-publicdate`,
124
+ },
125
+ {
126
+ title: 'Flickr Commons',
127
+ url: `${prefix}/details/flickrcommons`,
128
+ },
129
+ {
130
+ title: 'Occupy Wall Street Flickr',
131
+ url: `${prefix}/details/flickr-ows`,
132
+ },
133
+ {
134
+ title: 'Cover Art',
135
+ url: `${prefix}/details/coverartarchive`,
136
+ },
137
+ {
138
+ title: 'USGS Maps',
139
+ url: `${prefix}/details/maps_usgs`,
140
+ },
141
+ ],
142
+ links: [
143
+ {
144
+ title: 'NASA Images',
145
+ url: `${prefix}/details/nasa`,
146
+ },
147
+ {
148
+ title: 'Solar System Collection',
149
+ url: `${prefix}/details/solarsystemcollection`,
150
+ },
151
+ {
152
+ title: 'Ames Research Center',
153
+ url: `${prefix}/details/amesresearchcenterimagelibrary`,
154
+ },
155
+ ],
156
+ },
157
+ more: [
158
+ {
159
+ title: 'About',
160
+ url: `${prefix}/about/`,
161
+ },
162
+ {
163
+ title: 'Blog',
164
+ url: 'https://blog.archive.org',
165
+ },
166
+ {
167
+ title: 'Projects',
168
+ url: `${prefix}/projects/`,
169
+ },
170
+ {
171
+ title: 'Help',
172
+ url: `${prefix}/about/faqs.php`,
173
+ },
174
+ {
175
+ title: 'Donate',
176
+ url: `${prefix}/donate?origin=iawww-TopNavDonateButton`,
177
+ },
178
+ {
179
+ title: 'Contact',
180
+ url: `${prefix}/about/contact.php`,
181
+ },
182
+ {
183
+ title: 'Jobs',
184
+ url: `${prefix}/about/jobs.php`,
185
+ },
186
+ {
187
+ title: 'Volunteer',
188
+ url: `${prefix}/about/volunteerpositions.php`,
189
+ },
190
+ {
191
+ title: 'People',
192
+ url: `${prefix}/about/bios.php`,
193
+ },
194
+ ],
195
+ software: {
196
+ heading: 'Software',
197
+ iconLinks: [
198
+ {
199
+ icon: `${prefix}/services/img/internetarcade`,
200
+ title: 'Internet Arcade',
201
+ url: `${prefix}/details/internetarcade`,
202
+ },
203
+ {
204
+ icon: `${prefix}/services/img/consolelivingroom`,
205
+ title: 'Console Living Room',
206
+ url: `${prefix}/details/consolelivingroom`,
207
+ },
208
+ ],
209
+ featuredLinks: [
210
+ {
211
+ title: 'All Software',
212
+ url: `${prefix}/details/software`,
213
+ },
214
+ {
215
+ title: 'This Just In',
216
+ url: `${prefix}/search.php?query=mediatype:software&sort=-publicdate`,
217
+ },
218
+ {
219
+ title: 'Old School Emulation',
220
+ url: `${prefix}/details/tosec`,
221
+ },
222
+ {
223
+ title: 'MS-DOS Games',
224
+ url: `${prefix}/details/softwarelibrary_msdos_games`,
225
+ },
226
+ {
227
+ title: 'Historical Software',
228
+ url: `${prefix}/details/historicalsoftware`,
229
+ },
230
+ {
231
+ title: 'Classic PC Games',
232
+ url: `${prefix}/details/classicpcgames`,
233
+ },
234
+ {
235
+ title: 'Software Library',
236
+ url: `${prefix}/details/softwarelibrary`,
237
+ },
238
+ ],
239
+ links: [
240
+ {
241
+ title: 'Kodi Archive and Support File',
242
+ url: `${prefix}/details/kodi_archive`,
243
+ },
244
+ {
245
+ title: 'Vintage Software',
246
+ url: `${prefix}/details/vintagesoftware`,
247
+ },
248
+ {
249
+ title: 'APK',
250
+ url: `${prefix}/details/apkarchive`,
251
+ },
252
+ {
253
+ title: 'MS-DOS',
254
+ url: `${prefix}/details/softwarelibrary_msdos`,
255
+ },
256
+ {
257
+ title: 'CD-ROM Software',
258
+ url: `${prefix}/details/cd-roms`,
259
+ },
260
+ {
261
+ title: 'CD-ROM Software Library',
262
+ url: `${prefix}/details/cdromsoftware`,
263
+ },
264
+ {
265
+ title: 'Software Sites',
266
+ url: `${prefix}/details/softwaresites`,
267
+ },
268
+ {
269
+ title: 'Tucows Software Library',
270
+ url: `${prefix}/details/tucows`,
271
+ },
272
+ {
273
+ title: 'Shareware CD-ROMs',
274
+ url: `${prefix}/details/cdbbsarchive`,
275
+ },
276
+ {
277
+ title: 'Software Capsules Compilation',
278
+ url: `${prefix}/details/softwarecapsules`,
279
+ },
280
+ {
281
+ title: 'CD-ROM Images',
282
+ url: `${prefix}/details/cdromimages`,
283
+ },
284
+ {
285
+ title: 'ZX Spectrum',
286
+ url: `${prefix}/details/softwarelibrary_zx_spectrum`,
287
+ },
288
+ {
289
+ title: 'DOOM Level CD',
290
+ url: `${prefix}/details/doom-cds`,
291
+ },
292
+ ],
293
+ },
294
+ texts: {
295
+ heading: 'Books',
296
+ iconLinks: [
297
+ {
298
+ title: 'Books to Borrow',
299
+ icon: `${prefix}/images/book-lend.png`,
300
+ url: `${prefix}/details/inlibrary`,
301
+ },
302
+ {
303
+ title: 'Open Library',
304
+ icon: `${prefix}/images/widgetOL.png`,
305
+ url: 'https://openlibrary.org/',
306
+ },
307
+ ],
308
+ featuredLinks: [
309
+ {
310
+ title: 'All Books',
311
+ url: `${prefix}/details/books`,
312
+ },
313
+ {
314
+ title: 'All Texts',
315
+ url: `${prefix}/details/texts`,
316
+ },
317
+ {
318
+ title: 'This Just In',
319
+ url: `${prefix}/search.php?query=mediatype:texts&sort=-publicdate`,
320
+ },
321
+ {
322
+ title: 'Smithsonian Libraries',
323
+ url: `${prefix}/details/smithsonian`,
324
+ },
325
+ {
326
+ title: 'FEDLINK (US)',
327
+ url: `${prefix}/details/fedlink`,
328
+ },
329
+ {
330
+ title: 'Genealogy',
331
+ url: `${prefix}/details/genealogy`,
332
+ },
333
+ {
334
+ title: 'Lincoln Collection',
335
+ url: `${prefix}/details/lincolncollection`,
336
+ },
337
+ ],
338
+ links: [
339
+ {
340
+ title: 'American Libraries',
341
+ url: `${prefix}/details/americana`,
342
+ },
343
+ {
344
+ title: 'Canadian Libraries',
345
+ url: `${prefix}/details/toronto`,
346
+ },
347
+ {
348
+ title: 'Universal Library',
349
+ url: `${prefix}/details/universallibrary`,
350
+ },
351
+ {
352
+ title: 'Project Gutenberg',
353
+ url: `${prefix}/details/gutenberg`,
354
+ },
355
+ {
356
+ title: "Children's Library",
357
+ url: `${prefix}/details/iacl`,
358
+ },
359
+ {
360
+ title: 'Biodiversity Heritage Library',
361
+ url: `${prefix}/details/biodiversity`,
362
+ },
363
+ {
364
+ title: 'Books by Language',
365
+ url: `${prefix}/details/booksbylanguage`,
366
+ },
367
+ {
368
+ title: 'Additional Collections',
369
+ url: `${prefix}/details/additional_collections`,
370
+ },
371
+ ],
372
+ },
373
+ web: {
374
+ mobileAppsLinks: [
375
+ {
376
+ url: 'https://apps.apple.com/us/app/wayback-machine/id1201888313',
377
+ title: 'Wayback Machine (iOS)',
378
+ external: true,
379
+ },
380
+ {
381
+ url: 'https://play.google.com/store/apps/details?id=com.archive.waybackmachine&hl=en_US',
382
+ title: 'Wayback Machine (Android)',
383
+ external: true,
384
+ },
385
+ ],
386
+ browserExtensionsLinks: [
387
+ {
388
+ url: 'https://chrome.google.com/webstore/detail/wayback-machine/fpnmgdkabkmnadcjpehmlllkndpkmiak',
389
+ title: 'Chrome',
390
+ external: true,
391
+ },
392
+ {
393
+ url: 'https://addons.mozilla.org/en-US/firefox/addon/wayback-machine_new/',
394
+ title: 'Firefox',
395
+ external: true,
396
+ },
397
+ {
398
+ url: 'https://apps.apple.com/us/app/wayback-machine/id1472432422?mt=12',
399
+ title: 'Safari',
400
+ external: true,
401
+ },
402
+ {
403
+ url: 'https://microsoftedge.microsoft.com/addons/detail/wayback-machine/kjmickeoogghaimmomagaghnogelpcpn?hl=en-US',
404
+ title: 'Edge',
405
+ external: true,
406
+ },
407
+ ],
408
+ archiveItLinks: [
409
+ {
410
+ url: 'https://www.archive-it.org/explore',
411
+ title: 'Explore the Collections',
412
+ external: true,
413
+ },
414
+ {
415
+ url: 'https://www.archive-it.org/blog/learn-more/',
416
+ title: 'Learn More',
417
+ external: true,
418
+ },
419
+ {
420
+ url: 'https://www.archive-it.org/contact-us',
421
+ title: 'Build Collections',
422
+ external: true,
423
+ },
424
+ ],
425
+ },
426
+ video: {
427
+ heading: 'Video',
428
+ iconLinks: [
429
+ {
430
+ icon: `${prefix}/services/img/tv`,
431
+ title: 'TV News',
432
+ url: `${prefix}/details/tv`,
433
+ },
434
+ {
435
+ icon: `${prefix}/services/img/911`,
436
+ title: 'Understanding 9/11',
437
+ url: `${prefix}/details/911`,
438
+ },
439
+ ],
440
+ featuredLinks: [
441
+ {
442
+ title: 'All Video',
443
+ url: `${prefix}/details/movies`,
444
+ },
445
+ {
446
+ title: 'This Just In',
447
+ url: `${prefix}/search.php?query=mediatype:movies&sort=-publicdate`,
448
+ },
449
+ {
450
+ title: 'Prelinger Archives',
451
+ url: `${prefix}/details/prelinger`,
452
+ },
453
+ {
454
+ title: 'Democracy Now!',
455
+ url: `${prefix}/details/democracy_now_vid`,
456
+ },
457
+ {
458
+ title: 'Occupy Wall Street',
459
+ url: `${prefix}/details/occupywallstreet`,
460
+ },
461
+ {
462
+ title: 'TV NSA Clip Library',
463
+ url: `${prefix}/details/nsa`,
464
+ },
465
+ ],
466
+ links: [
467
+ {
468
+ title: 'Animation & Cartoons',
469
+ url: `${prefix}/details/animationandcartoons`,
470
+ },
471
+ {
472
+ title: 'Arts & Music',
473
+ url: `${prefix}/details/artsandmusicvideos`,
474
+ },
475
+ {
476
+ title: 'Computers & Technology',
477
+ url: `${prefix}/details/computersandtechvideos`,
478
+ },
479
+ {
480
+ title: 'Cultural & Academic Films',
481
+ url: `${prefix}/details/culturalandacademicfilms`,
482
+ },
483
+ {
484
+ title: 'Ephemeral Films',
485
+ url: `${prefix}/details/ephemera`,
486
+ },
487
+ {
488
+ title: 'Movies',
489
+ url: `${prefix}/details/moviesandfilms`,
490
+ },
491
+ {
492
+ title: 'News & Public Affairs',
493
+ url: `${prefix}/details/newsandpublicaffairs`,
494
+ },
495
+ {
496
+ title: 'Spirituality & Religion',
497
+ url: `${prefix}/details/spiritualityandreligion`,
498
+ },
499
+ {
500
+ title: 'Sports Videos',
501
+ url: `${prefix}/details/sports`,
502
+ },
503
+ {
504
+ title: 'Television',
505
+ url: `${prefix}/details/television`,
506
+ },
507
+ {
508
+ title: 'Videogame Videos',
509
+ url: `${prefix}/details/gamevideos`,
510
+ },
511
+ {
512
+ title: 'Vlogs',
513
+ url: `${prefix}/details/vlogs`,
514
+ },
515
+ {
516
+ title: 'Youth Media',
517
+ url: `${prefix}/details/youth_media`,
518
+ },
519
+ ],
520
+ },
521
+ user: [
522
+ {
523
+ url: `${prefix}/create`,
524
+ title: 'Upload files',
525
+ analyticsEvent: 'UserUpload',
526
+ },
527
+ {
528
+ url: `${prefix}/details/@${userid}`,
529
+ title: 'My uploads',
530
+ analyticsEvent: 'UserLibrary',
531
+ },
532
+ {
533
+ url: `${prefix}/details/@${userid}?tab=loans`,
534
+ title: 'My loans',
535
+ analyticsEvent: 'UserLoans',
536
+ },
537
+ {
538
+ url: `${prefix}/details/fav-${userid}`,
539
+ title: 'My favorites',
540
+ analyticsEvent: 'UserFavorites',
541
+ },
542
+ {
543
+ url: `${prefix}/details/@${userid}/web-archive`,
544
+ title: 'My web archives',
545
+ analyticsEvent: 'UserWebArchive',
546
+ },
547
+ {
548
+ url: `${prefix}/account/index.php?settings=1`,
549
+ title: 'Account settings',
550
+ analyticsEvent: 'UserSettings',
551
+ },
552
+ {
553
+ url: 'https://help.archive.org',
554
+ title: 'Get help',
555
+ analyticsEvent: 'UserHelp',
556
+ },
557
+ {
558
+ url: `${prefix}/account/logout`,
559
+ title: 'Log out',
560
+ analyticsEvent: 'UserLogOut',
561
+ },
562
+ ],
563
+ signedOut: [
564
+ {
565
+ url: `${prefix}/account/signup`,
566
+ title: 'Sign up for free',
567
+ analyticsEvent: 'AvatarMenu-Signup',
568
+ },
569
+ {
570
+ url: `${prefix}/account/login`,
571
+ title: 'Log in',
572
+ analyticsEvent: 'AvatarMenu-Login',
573
+ },
574
+ ],
575
+ };
576
+ };
577
+
578
+
579
+ let waybackPagesArchivedCached
580
+
581
+ /**
582
+ * Fetches accurate count of number of pages in WayBack Machine
583
+ * @returns { string }
584
+ */
585
+ export async function waybackPagesArchivedFN() {
586
+ if (waybackPagesArchivedCached)
587
+ return waybackPagesArchivedCached;
588
+
589
+ const counts = await (await fetch('https://archive.org/services/offshoot/home-page/mediacounts.php')).json();
590
+ if (counts.success) {
591
+ let label = ''
592
+ let n = parseInt(counts.value.counts.web, 10);
593
+ if (n > 1000) { n /= 1000; label = 'thousand'; }
594
+ if (n > 1000) { n /= 1000; label = 'million'; }
595
+ if (n > 1000) { n /= 1000; label = 'billion'; }
596
+ if (n > 1000) { n /= 1000; label = 'trillion'; }
597
+ waybackPagesArchivedCached = `${Math.round(n)} ${label}`
598
+ } else {
599
+ waybackPagesArchivedCached = '741 billion';
600
+ }
601
+
602
+ return waybackPagesArchivedCached;
603
+ }