From 2827e9e6795eebb75536b14b306e9925597af156 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 24 Sep 2017 04:42:14 +0300 Subject: [PATCH] cleanup, fixes and tweaks... Signed-off-by: Alex A. Naanou --- ui (gen4)/lib/widget/browse.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ui (gen4)/lib/widget/browse.js b/ui (gen4)/lib/widget/browse.js index a4bbd2a2..785d44ce 100755 --- a/ui (gen4)/lib/widget/browse.js +++ b/ui (gen4)/lib/widget/browse.js @@ -955,6 +955,10 @@ function(list, options){ : txt // account for '$' as key binding marker... var ntxt = txt.replace(/\$/g, '') + // unique-test text... + var utxt = options.unique instanceof Function ? + options.unique(txt)+'' + : null // invalid format... if(options.check && !options.check(txt)){ @@ -982,13 +986,13 @@ function(list, options){ } // check if item pre-existed... - var preexisted = options.unique instanceof Function ? - //lst.indexOf(options.unique(txt)) >= 0 - (lst.indexOf(options.unique(txt)) >= 0 - // account for '$' as key binding marker... (XXX ???) - || normalized.indexOf(options.unique(txt).replace(/\$/g, ''))) - : (lst.indexOf(txt) >= 0 - || normalized.indexOf(ntxt) >= 0) + var preexisted = utxt ? + //lst.indexOf(options.unique(txt)) >= 0 + (lst.indexOf(utxt) >= 0 + // account for '$' as key binding marker... (XXX ???) + || normalized.indexOf(utxt.replace(/\$/g, '')) >= 0) + : (lst.indexOf(txt) >= 0 + || normalized.indexOf(ntxt) >= 0) // add new value and sort list... lst.push(txt)