MCPcopy Create free account
hub / github.com/crisxuan/bestJavaer / getActiveSidebarHref

Function getActiveSidebarHref

assets/article-cards.js:354–374  ·  view source on GitHub ↗
(route, locale)

Source from the content-addressed store, hash-verified

352 }
353
354 function getActiveSidebarHref(route, locale) {
355 var normalizedRoute = normalizeRoute(route);
356
357 if (normalizedRoute === '' || normalizedRoute === '/' || normalizedRoute === 'README') {
358 return normalizeHashHref('#/');
359 }
360
361 if (normalizedRoute === 'README.zh-CN') {
362 return normalizeHashHref('#/README.zh-CN');
363 }
364
365 if (!/\/README$/.test(normalizedRoute) && normalizedRoute.indexOf('/') > -1) {
366 normalizedRoute = normalizedRoute.replace(/\/[^/]+$/, '/README');
367 }
368
369 if (locale === 'zh' && normalizedRoute.indexOf('en/') === 0) {
370 normalizedRoute = normalizedRoute.replace(/^en\//, '');
371 }
372
373 return normalizeHashHref('#/' + normalizedRoute);
374 }
375
376 function normalizeHashHref(href) {
377 var cleanHref = (href || '').trim();

Callers 1

syncSidebarActiveStateFunction · 0.85

Calls 2

normalizeRouteFunction · 0.85
normalizeHashHrefFunction · 0.85

Tested by

no test coverage detected