From cab59791c1404a649cd64c40d9fdccd27a8fbed4 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Mon, 3 Mar 2014 14:37:30 +0000 Subject: [PATCH] Dramatically simplify onFormSubmitEventHandler() newSearch() can now be a regular, hidden member function. --- tools/htdocs/mkws.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 2e0c5fd..0a0f632 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -448,21 +448,17 @@ function team($, teamName) { // when search button pressed - // ### This is closure, so can always just operate on its own team function onFormSubmitEventHandler() { - mkws.handle_node_with_team(this, function (tname) { - var val = findnode('.mkwsQuery').val(); - mkws.teams[tname].newSearch(val); - }); - + var val = findnode('.mkwsQuery').val(); + newSearch(val); return false; } // ### won't need to be externally visible once onFormSubmitEventHandler() is fixed. // ### doesn't need windowid - that.newSearch = function(query, sort, targets, windowid) + function newSearch(query, sort, targets, windowid) { debug("newSearch: " + query); @@ -476,7 +472,7 @@ function team($, teamName) { resetPage(); loadSelect(); triggerSearch(query, sort, targets, windowid); - that.switchView('records'); // In case it's configured to start off as hidden + switchView('records'); // In case it's configured to start off as hidden m_submitted = true; } @@ -740,7 +736,7 @@ function team($, teamName) { // switching view between targets and records - that.switchView = function(view) { + function switchView(view) { var targets = findnode('.mkwsTargets'); var results = findnode('.mkwsResults,.mkwsRecords'); var blanket = findnode('.mkwsBlanket'); @@ -772,6 +768,9 @@ function team($, teamName) { } + that.switchView = switchView; + + // detailed record drawing that.showDetails = function (prefixRecId) { var recId = prefixRecId.replace('mkwsRec_', ''); @@ -1169,7 +1168,7 @@ function team($, teamName) { if (targets) s += " in targets '" + targets + "'"; debug(s); - this.newSearch(query, sort, targets, m_teamName); + newSearch(query, sort, targets, m_teamName); } -- 1.7.10.4