Fix slugify function

main
Elbert Alias 8 years ago
parent 8b946ee3bf
commit 7d2952049f

@ -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 = {

@ -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 ) {

@ -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 = {