remove index.html etc from end of urls

This commit is contained in:
Dym Sohin 2024-06-15 12:05:01 +02:00
parent 97ebb3c802
commit 4ddb8ee852
1 changed files with 18 additions and 0 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