From: Mike Taylor Date: Wed, 28 May 2014 14:37:35 +0000 (+0100) Subject: The hideWhenNarrow function is now a member of the widget object, so it's X-Git-Tag: 1.0.0~583 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=fb95a1c0ae9ea20d05326b7edec857fbef1714ef The hideWhenNarrow function is now a member of the widget object, so it's invoked as w.hideWhenNarrow() rather than widget.hideWhenNarrow(w) --- diff --git a/src/mkws-widget.js b/src/mkws-widget.js index f6c2e2e..ca8b12d 100644 --- a/src/mkws-widget.js +++ b/src/mkws-widget.js @@ -126,6 +126,17 @@ function widget($, team, type, node) { } }; + // Utility function for all widgets that want to hide in narrow windows + that.hideWhenNarrow = function() { + var widget = this; + widget.team.queue("resize-narrow").subscribe(function(n) { + widget.node.hide(); + }); + widget.team.queue("resize-wide").subscribe(function(n) { + widget.node.show(); + }); + }; + for (var i = 0; i < node.attributes.length; i++) { var a = node.attributes[i]; @@ -164,16 +175,3 @@ function widget($, team, type, node) { return that; } - - -// Utility function for all widgets that want to hide in narrow windows -widget.hideWhenNarrow = function(widget) { - widget.team.queue("resize-narrow").subscribe(function(n) { - widget.node.hide(); - }); - widget.team.queue("resize-wide").subscribe(function(n) { - widget.node.show(); - }); -}; - -