diff --git a/src/drivers/chrome/js/popup.js b/src/drivers/chrome/js/popup.js index b7c4d68d3..a2657b67b 100644 --- a/src/drivers/chrome/js/popup.js +++ b/src/drivers/chrome/js/popup.js @@ -5,7 +5,7 @@ document.addEventListener('DOMContentLoaded', function() { detectedApps = d.getElementById('detected-apps'); slugify = function(string) { - return string.toLowerCase().replace(/ /g, '-').replace(/[^\w-]/g, ''); + return string.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/--+/g, '-').replace(/(?:^-|-$)/, ''); }; popup = { diff --git a/src/drivers/firefox/data/js/panel.js b/src/drivers/firefox/data/js/panel.js index 5a01f91ef..60f97d102 100644 --- a/src/drivers/firefox/data/js/panel.js +++ b/src/drivers/firefox/data/js/panel.js @@ -7,7 +7,7 @@ empty = d.getElementById('empty'); slugify = function(string) { - return string.toLowerCase().replace(/ /g, '-').replace(/[^\w-]/g, ''); + return string.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/--+/g, '-').replace(/(?:^-|-$)/g, ''); }; while ( detectedApps.firstChild ) { diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index 2b0a0e84d..a5dd2cb61 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -5,7 +5,7 @@ document.addEventListener('DOMContentLoaded', function() { detectedApps = d.getElementById('detected-apps'); slugify = function(string) { - return string.toLowerCase().replace(/ /g, '-').replace(/[^\w-]/g, ''); + return string.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/--+/g, '-').replace(/(?:^-|-$)/, ''); }; popup = {