From 4ad8831b86a583d8c50ab70736e3a156c5ac3753 Mon Sep 17 00:00:00 2001 From: Nick Sergeant Date: Sun, 15 Jan 2012 20:08:35 -0500 Subject: [PATCH] go --- snipt/media/cache/snipt.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/snipt/media/cache/snipt.js b/snipt/media/cache/snipt.js index 6a1e146..558c42c 100644 --- a/snipt/media/cache/snipt.js +++ b/snipt/media/cache/snipt.js @@ -933,6 +933,13 @@ jQuery(function($) { SniptList = new SniptListView({ 'snipts': this.$snipts }); } + // Search + this.$search_query.focus(function() { + if (window.$selected) { + $selected.trigger('deselect'); + } + }); + }, keyboardShortcuts: function() { @@ -951,7 +958,9 @@ jQuery(function($) { }); }, inFieldLabels: function () { - $('div.infield label', this.el).inFieldLabels(); + $('div.infield label', this.el).inFieldLabels({ + fadeDuration: 200 + }); } }); @@ -989,6 +998,7 @@ jQuery(function($) { 'click .container': 'clickSelect', 'copy': 'copy', 'detail': 'detail', + 'deselect': 'deselect', 'expand': 'expand', 'next': 'next', 'prev': 'prev', @@ -1010,6 +1020,10 @@ jQuery(function($) { window.prompt('Text is selected. To copy: press ' + cmd + '+C then ', this.$raw.text()); return false; }, + deselect: function() { + this.$el.removeClass('selected'); + window.$selected = false; + }, detail: function() { window.location = this.model.get('url'); }, @@ -1084,8 +1098,7 @@ jQuery(function($) { }); $(document).bind('keydown', 'esc', function() { if ($selected) { - $selected.removeClass('selected'); - $selected = false; + $selected.trigger('deselect'); } }); $(document).bind('keydown', 'j', function() {