diff --git a/couchpotato/static/scripts/page/settings.js b/couchpotato/static/scripts/page/settings.js index 9184855..ed75cfd 100644 --- a/couchpotato/static/scripts/page/settings.js +++ b/couchpotato/static/scripts/page/settings.js @@ -926,14 +926,19 @@ Option.Choice = new Class({ var mtches = [] if(matches) matches.each(function(match, mnr){ - var msplit = value.split(match); + var pos = value.indexOf(match), + msplit = [value.substr(0, pos), value.substr(pos, match.length), value.substr(pos+match.length)]; + msplit.each(function(matchsplit, snr){ - if(msplit.length-1 == snr) + if(msplit.length-1 == snr){ value = matchsplit; - mtches.append([value == matchsplit ? match : matchsplit]); - if(matches.length*2 == mtches.length) - mtches.append([value]); + if(matches.length-1 == mnr) + mtches.append([value]); + + return; + } + mtches.append([value == matchsplit ? match : matchsplit]); }); });