diff --git a/app/assets/javascripts/Jit/filters.js b/app/assets/javascripts/Jit/filters.js index 936657fc..271361ad 100644 --- a/app/assets/javascripts/Jit/filters.js +++ b/app/assets/javascripts/Jit/filters.js @@ -246,32 +246,55 @@ $(document).ready(function() { // this is where interactions within the find box begin // - $("#topic_by_name_input").keyup(function() { - var topicName = $(this).val(); - - // grab the checkboxes to see if the search is on the canvas, in the commons, or both - firstVal = $("#onCanvas").attr('checked'); - secondVal = $("#inCommons").attr('checked'); - - // only have the autocomplete enabled if they are searching in the commons - - if (firstVal == "checked" && secondVal == "checked"){ - $('#topic_by_name_input').autocomplete( "option", "disabled", false ); - onCanvasSearch(topicName,null,null); - } - else if (firstVal == "checked"){ - $('#topic_by_name_input').autocomplete( "option", "disabled", true ); - onCanvasSearch(topicName,null,null); - } - else if (secondVal == "checked"){ - hideAll(); - $('#topic_by_name_input').autocomplete( "option", "disabled", false ); - } - else { - $('#topic_by_name_input').autocomplete( "option", "disabled", true ); - } - - }); + + //on keyup, start the countdown + $('#topic_by_name_input').typing({ + start: function (event, $elem) { + // grab the checkboxes to see if the search is on the canvas, in the commons, or both + firstVal = $("#onCanvas").attr('checked'); + secondVal = $("#inCommons").attr('checked'); + + // only have the autocomplete enabled if they are searching in the commons + if (firstVal == "checked" && secondVal == "checked"){ + $('#topic_by_name_input').autocomplete( "option", "disabled", false ); + } + else if (firstVal == "checked"){ + showAll(); + $('#topic_by_name_input').autocomplete( "option", "disabled", true ); + } + else if (secondVal == "checked"){ + hideAll(); + $('#topic_by_name_input').autocomplete( "option", "disabled", false ); + } + else { + alert('Either select searching In the Commons, or On the Canvas to search'); + } + }, + stop: function (event, $elem) { + // grab the checkboxes to see if the search is on the canvas, in the commons, or both + firstVal = $("#onCanvas").attr('checked'); + secondVal = $("#inCommons").attr('checked'); + + var topicName = $('#topic_by_name_input').val(); + // run a search on the canvas or in the commons or both + if (firstVal == "checked" && secondVal == "checked"){ + onCanvasSearch(topicName,null,null); + // and run a search in the commons + } + else if (firstVal == "checked"){ + onCanvasSearch(topicName,null,null); + } + else if (secondVal == "checked"){ + //run a search in the commons + } + else { + //do nothing + } + + if (topicName == "") showAll(); + }, + delay: 2000 + }); $('.sideOption .select_content').change(function() { firstVal = $(this).children("option[value='topics']").attr('selected'); diff --git a/app/assets/javascripts/carousel/cloud-carousel.1.0.5.js b/app/assets/javascripts/carousel/cloud-carousel.1.0.5.js index 0dd961af..3f5eb747 100644 --- a/app/assets/javascripts/carousel/cloud-carousel.1.0.5.js +++ b/app/assets/javascripts/carousel/cloud-carousel.1.0.5.js @@ -149,7 +149,9 @@ $(options.titleBox).html( ($(event.target).attr('title') )); if ( options.bringToFront && event.type == 'click' ) { - + // METAMAPS CODE + $('#topic_metacode').val($(event.target).attr('title')); + // NOT METAMAPS CODE var idx = $(event.target).data('itemIndex'); var frontIndex = event.data.frontIndex; //var diff = idx - frontIndex; @@ -186,9 +188,6 @@ { if ( items[this.frontIndex] === undefined ) { return; } // Images might not have loaded yet. $(options.titleBox).html( $(items[this.frontIndex].image).attr('title')); - // METAMAPS CODE - $('#topic_metacode').val( $(items[this.frontIndex].image).attr('title')); - // NOT METAMAPS CODE $(options.altBox).html( $(items[this.frontIndex].image).attr('alt')); }; diff --git a/app/assets/javascripts/typing/jquery.typing-0.2.0.min.js b/app/assets/javascripts/typing/jquery.typing-0.2.0.min.js new file mode 100644 index 00000000..23f34f78 --- /dev/null +++ b/app/assets/javascripts/typing/jquery.typing-0.2.0.min.js @@ -0,0 +1,7 @@ +// jQuery-typing +// +// Version: 0.2.0 +// Website: http://narf.pl/jquery-typing/ +// License: public domain +// Author: Maciej Konieczny +(function(f){function l(g,h){function d(a){if(!e){e=true;c.start&&c.start(a,b)}}function i(a,j){if(e){clearTimeout(k);k=setTimeout(function(){e=false;c.stop&&c.stop(a,b)},j>=0?j:c.delay)}}var c=f.extend({start:null,stop:null,delay:400},h),b=f(g),e=false,k;b.keypress(d);b.keydown(function(a){if(a.keyCode===8||a.keyCode===46)d(a)});b.keyup(i);b.blur(function(a){i(a,0)})}f.fn.typing=function(g){return this.each(function(h,d){l(d,g)})}})(jQuery);