File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 4343
4444 function getBasePath ( ) {
4545 const path = window . location . pathname ;
46- if ( path === '/' || path . endsWith ( '/index.html' ) && ! path . includes ( '-' ) ) {
46+ const pathParts = path . split ( '/' ) . filter ( Boolean ) ;
47+
48+ if ( pathParts . length === 0 ) {
4749 return './' ;
4850 }
49- return '../' ;
51+
52+ const lastPart = pathParts [ pathParts . length - 1 ] ;
53+ const secondLastPart = pathParts [ pathParts . length - 2 ] || '' ;
54+
55+ if ( lastPart === 'index.html' ) {
56+ if ( secondLastPart . match ( / ^ \d { 2 } - / ) || secondLastPart === 'PTZOptics-Moondream-Tracker' ) {
57+ return '../' ;
58+ }
59+ return './' ;
60+ }
61+
62+ if ( lastPart . match ( / ^ \d { 2 } - / ) || lastPart === 'PTZOptics-Moondream-Tracker' ) {
63+ return '../' ;
64+ }
65+
66+ return './' ;
5067 }
5168
5269 function injectStyles ( ) {
You can’t perform that action at this time.
0 commit comments