From: Mike Taylor Date: Fri, 21 Mar 2014 17:07:28 +0000 (+0000) Subject: Simplify Sort and Perpage widget to use anonymous closures. X-Git-Tag: 1.0.0~1277 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=5710282758daaa01312c510231168058e587b63d;p=mkws-moved-to-github.git Simplify Sort and Perpage widget to use anonymous closures. Disposes of the onSortChange and onPerpageChange functions. --- diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 193a663..057b8ff 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -402,30 +402,24 @@ function widget($, team, type, node) { // It seems this and the Perpage widget doen't need to // subscribe to anything, since they produce events rather // than consuming them. - $(node).change(onSortChange); - - function onSortChange() - { + $(node).change(function () { team.set_sortOrder($(node).val()); if (!team.submitted()) return false; team.resetPage(); team.reShow(); return false; - } + }); } function promotePerpage() { - $(node).change(onPerpageChange); - - function onPerpageChange() - { + $(node).change(function() { team.set_perpage($(node).val()); if (!team.submitted()) return false; team.resetPage(); team.reShow(); return false; - } + }); } }