File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -40,14 +40,24 @@ window.addEventListener('load', function() {
4040
4141
4242$ ( document ) . on ( 'click' , '.cypht-layout a' , function ( event ) {
43- if ( $ ( this ) . attr ( 'href' ) !== "#" && $ ( this ) . attr ( 'target' ) !== '_blank' && ! $ ( this ) . data ( 'external' ) ) {
43+ const href = $ ( this ) . attr ( 'href' ) ;
44+ const target = $ ( this ) . attr ( 'target' ) ;
45+ const isExternal = $ ( this ) . data ( 'external' ) ;
46+
47+ const isExternalDomain = href && (
48+ href . startsWith ( 'http://' ) ||
49+ href . startsWith ( 'https://' ) ||
50+ href . startsWith ( '//' )
51+ ) && ! href . includes ( window . location . hostname ) ;
52+
53+ if ( href !== "#" && target !== '_blank' && ! isExternal && ! isExternalDomain ) {
4454 event . preventDefault ( ) ;
4555 const currentUrl = new URL ( window . location . href ) ;
4656 const currentPage = currentUrl . searchParams . toString ( ) ;
47- const target = new URLSearchParams ( $ ( this ) . attr ( ' href' ) . split ( '?' ) [ 1 ] ) ;
48- if ( currentPage !== target . toString ( ) ) {
57+ const targetParams = new URLSearchParams ( href . split ( '?' ) [ 1 ] ) ;
58+ if ( currentPage !== targetParams . toString ( ) ) {
4959 Hm_Ajax . abort_all_requests ( ) ;
50- navigate ( autoAppendParamsForNavigation ( $ ( this ) . attr ( ' href' ) ) ) ;
60+ navigate ( autoAppendParamsForNavigation ( href ) ) ;
5161 }
5262 }
5363} ) ;
You can’t perform that action at this time.
0 commit comments