-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Neat Url] Don't catch url with # #83
Comments
I will look what I can do. |
I think I have a related issue I encounted this url: https://vivaldi.com/blog/teamblog/vivaldi-1-13-adds-window-panel/#pk_campaign=newsletter&pk_kwd=community I want to filter I see in the source code it does build a list of I came up with a simplistic implementation using a secondary URL object to track the hash as if it were a query string, which is an approach that many sites use. (function () {
const url = new URL('https://vivaldi.com/blog/teamblog/vivaldi-1-13-adds-window-panel/?removethis=true#pk_campaign=newsletter&pk_kwd=community');
const fields = ['#pk_campaign', '#pk_kwd', 'removethis'];
const hashUrl = new URL(url.href);
hashUrl.search = hashUrl.hash.replace('#', '');
hashUrl.hash = '';
for (const field of fields) {
if (field.startsWith('#')) {
const fieldName = field.replace('#', '');
hashUrl.searchParams.delete(fieldName);
} else if (url.searchParams.has(field)) {
url.searchParams.delete(field);
}
}
const newHash = hashUrl.search.replace('?', '');
url.hash = newHash ? `#${newHash}` : '';
return url.href;
})();
// returns 'https://vivaldi.com/blog/teamblog/vivaldi-1-13-adds-window-panel/' Perhaps this sort of replacement needs a special notation, like Anyways, thank you for your hard work with Neat URL! |
Thank you for your hard work. It is indeed a simplistic implementation but it shows the intent. Maybe I can use the code with some changes. Please be patient as this will take some time to adapt for Neat URL. |
* Performance improvements * Several encoding bugs fixed #73 #75 #93 * Re-initialise listener, hopefully fixes #92 * Fix "Show counter" setting (introduced in 3.2.0) doesn't do anything #91 * Workaround for gws_rd@google.* on google.com #76 * Implement hash parameters using #? #83 * Cleanups * Fix translation string mapped to wrong i18n id * Move most functions related to the toolbar button to a separate file
Implemented in Neat URL 4.0.0 which is now available on addons.mozilla.org. |
This is great! |
I noticed on a link redirect link from Facebook where Neat Url did not clean it:
www.cuisineactuelle.fr/recettes/mini-burgers-au-foie-gras-331523#utm_source=Facebook&utm_medium=social&utm_campaign=PassionApero
It seams that's the # instead of ? which introduce this behavior
The text was updated successfully, but these errors were encountered: