Compare commits

...

2 Commits

Author SHA1 Message Date
Dym Sohin c655672d00 upd url 2024-06-15 12:07:33 +02:00
Dym Sohin 4ddb8ee852 remove index.html etc from end of urls 2024-06-15 12:05:01 +02:00
2 changed files with 19 additions and 1 deletions

View File

@ -194,6 +194,9 @@ const fn_output = ( ) =>
if( chk_nowww.checked )
{
u.hostname = u.hostname.replace(/^(www\.)+/,'')
u.hostname = u.hostname.replace(/\?$/,'')
u.hostname = u.hostname.replace(/index\.html?$/,'')
u.hostname = u.hostname.replace(/\/$/,'')
}
if( chk_utm.checked )
@ -209,6 +212,21 @@ const fn_output = ( ) =>
}
}
}
if( chk_utm.checked )
{
for( [k,v] of u.searchParams.entries() )
{
// console.log(`'${k}':'${v}'`)
if( /^utm_\w+/.test(k)
|| /^ref$/i.test(k)
)
{
u.searchParams.delete(k,v)
}
}
}
})
let arr_output = arr_urls

View File

@ -3,5 +3,5 @@
> cleaning URLs from www, final slashes, and utm_
### live
- https://web.dym.sh/clean-urls/
- https://live.source.garden/clean-urls/
- https://codepen.io/dym-sh/pen/xxeZPrx