@internetarchive/ia-topnav 1.1.18-a1 → 1.1.18

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