From 4bf4d14a248b5f2d96cb01c703ef09341c31ffd7 Mon Sep 17 00:00:00 2001 From: Ben Yanke Date: Tue, 15 Nov 2016 01:31:28 -0600 Subject: [PATCH] formatName - replace spaces with dashes Name-formatter now replaces spaces with dashes, for more readable names. This is similar to Wordpress' permalink processing. --- js/lbry.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/lbry.js b/js/lbry.js index bf57e6c05..673c4b10c 100644 --- a/js/lbry.js +++ b/js/lbry.js @@ -296,8 +296,10 @@ lbry.formatCredits = function(amount, precision) } lbry.formatName = function(name) { - // Converts LBRY name to standard format (all lower case, no special characters) - return name.toLowerCase().replace(/[^a-z0-9\-]/g, ''); + // Converts LBRY name to standard format (all lower case, no special characters, spaces replaced by dashes) + name = name.replace(" ", "-"); + name = name.toLowerCase().replace(/[^a-z0-9\-]/g, ''); + return name; } lbry.loadJs = function(src, type, onload)