Merge branch 'master' into devel

This commit is contained in:
Devin Howard 2013-01-02 23:02:14 -05:00
commit a9462d0f0e
3 changed files with 59 additions and 30 deletions

View file

@ -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');

View file

@ -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'));
};

View file

@ -0,0 +1,7 @@
// jQuery-typing
//
// Version: 0.2.0
// Website: http://narf.pl/jquery-typing/
// License: public domain <http://unlicense.org/>
// Author: Maciej Konieczny <hello@narf.pl>
(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);