From 571790bc7f30ce675dd09c2881247cb7f1aacf98 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 2 Apr 2014 17:02:15 +0100 Subject: [PATCH] Move auto-searching code out of Records widget into mkws.maybeAutosearch utility function. --- src/mkws-widgets.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mkws-widgets.js b/src/mkws-widgets.js index be802dd..4df81d7 100644 --- a/src/mkws-widgets.js +++ b/src/mkws-widgets.js @@ -265,6 +265,11 @@ mkws.registerWidgetType('Records', function() { } }); + mkws.maybeAutosearch(that); +}); + + +mkws.maybeAutosearch = function(that) { var query = that.config.autosearch; if (query) { if (query.match(/^!param!/)) { @@ -284,7 +289,7 @@ mkws.registerWidgetType('Records', function() { } } - this.team.queue("ready").subscribe(function() { + that.team.queue("ready").subscribe(function() { var sortOrder = that.config.sort; var perpage = that.config.perpage; var limit = that.config.limit; @@ -301,7 +306,7 @@ mkws.registerWidgetType('Records', function() { that.team.newSearch(query, sortOrder, perpage, limit, targets, targetfilter); }); } -}); +}; mkws.registerWidgetType('Navi', function() { -- 1.7.10.4