From 5a8f676fbe7996f153bcfb7e7b9659edcfd5dcd4 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 17 May 2015 03:52:21 +0300 Subject: [PATCH] minor refactoring... Signed-off-by: Alex A. Naanou --- ui (gen4)/experiments/browse-dialog.js | 51 +++++++++++++++----------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/ui (gen4)/experiments/browse-dialog.js b/ui (gen4)/experiments/browse-dialog.js index 98a9514d..99e3f831 100755 --- a/ui (gen4)/experiments/browse-dialog.js +++ b/ui (gen4)/experiments/browse-dialog.js @@ -196,12 +196,22 @@ var BrowserPrototype = { // Select a list element... // + // Get selected element if it exists, otherwise select and return + // the first... + // .select() + // -> elem + // + // Get selected element if it exists, null otherwise... + // .select('!') + // -> elem + // -> $() + // // Select first/last child // .select('first') // .select('last') // -> elem // - // Select previous/lext child + // Select previous/next child // .select('prev') // .select('next') // -> elem @@ -210,11 +220,6 @@ var BrowserPrototype = { // .select('none') // -> elem // - // Get selected element if it exists, null otherwise... - // .select('!') - // -> elem - // -> $() - // // Select element by sequence number // .select() // -> elem @@ -288,6 +293,24 @@ var BrowserPrototype = { } }, + // Select next element... + next: function(elem){ + if(elem != null){ + this.select(elem) + } + this.select('next') + return this + }, + // Select previous element... + prev: function(elem){ + if(elem != null){ + this.select(elem) + } + this.select('prev') + return this + }, + + // Push an element to path / go down one level... push: function(elem){ var browser = this.dom var elem = this.select(elem || '!') @@ -314,7 +337,7 @@ var BrowserPrototype = { return this }, - // pop an element off the path / go up one level... + // Pop an element off the path / go up one level... pop: function(){ var browser = this.dom var path = this.path @@ -326,20 +349,6 @@ var BrowserPrototype = { return this }, - next: function(elem){ - if(elem != null){ - this.select(elem) - } - this.select('next') - return this - }, - prev: function(elem){ - if(elem != null){ - this.select(elem) - } - this.select('prev') - return this - }, focus: function(){ this.dom.focus()