File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -352,6 +352,8 @@ const SIDE_SLOT_COUNT = 3;
352352 }
353353
354354 function initNewsCategoryFilters() {
355+ const homeRoot = document .querySelector (' [data-news-home-root]' );
356+ if (! (homeRoot instanceof HTMLElement )) return ;
355357 if (document .body .dataset .newsCategoryBound === ' 1' ) return ;
356358 document .body .dataset .newsCategoryBound = ' 1' ;
357359
@@ -361,6 +363,8 @@ const SIDE_SLOT_COUNT = 3;
361363 document .querySelectorAll (' [data-news-nav] a' ).forEach ((link ) => {
362364 if (! (link instanceof HTMLAnchorElement )) return ;
363365 link .addEventListener (' click' , (event ) => {
366+ const currentPath = window .location .pathname .replace (/ \/ + $ / , ' ' ) || ' /' ;
367+ if (currentPath !== ' /anlik-haber' ) return ;
364368 const url = new URL (link .href , window .location .origin );
365369 if (url .pathname !== ' /anlik-haber/' ) return ;
366370 event .preventDefault ();
@@ -369,6 +373,7 @@ const SIDE_SLOT_COUNT = 3;
369373 });
370374
371375 window .addEventListener (' popstate' , () => {
376+ if (! document .querySelector (' [data-news-home-root]' )) return ;
372377 applyCategory (categoryFromUrl (new URL (window .location .href )), false );
373378 });
374379 }
You can’t perform that action at this time.
0 commit comments