autocomplete done
This commit is contained in:
1 parent
46576c6947
commit
9cc518b456
4 files changed
+53
-4
No files matched your search
@@ -229,6 +229,8 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
|
||||
})
|
||||
}
|
||||
bindHandlers();
|
||||
|
||||
|
||||
}
|
||||
this.initializeJournalPapers.coAuthorformCallback = function(data){
|
||||
if(data.success){
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
//container=true is the area where the view will be loaded
|
||||
//load = true is used to load the list element by default
|
||||
//response-type = "json"|"script"|"xml|html" default is json
|
||||
//autocomplete-list = "listname" an array from which autocomplete will be attached to its respective input or textarea
|
||||
|
||||
|
||||
$.extend($.expr[':'], {
|
||||
@@ -172,6 +173,7 @@ var orbitDesktop = function(dom){
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
var $widget_fn = $('.widget_fn'),$fn_des = $('.fn_des');
|
||||
$widget_fn.hover(function(){
|
||||
var fn_name = $(this).find('img').attr('alt'),nth = $(this).parents('.d_cate').index(),des_left = $('.dock_child').eq(nth).width();
|
||||
@@ -181,6 +183,45 @@ var orbitDesktop = function(dom){
|
||||
$(this).removeClass('thmc1');
|
||||
$fn_des.stop(true, true).fadeOut();
|
||||
});
|
||||
|
||||
var split = function( val ) {
|
||||
return val.split( /,\s*/ );
|
||||
}
|
||||
var extractLast = function( term ) {
|
||||
return split( term ).pop();
|
||||
}
|
||||
var autocompleteListName = null;
|
||||
$("body").on("keydown","*[autocomplete-list]", function( event ) {
|
||||
autocompleteListName = $(this).attr("autocomplete-list");
|
||||
if ( event.keyCode === $.ui.keyCode.TAB &&
|
||||
$( this ).data( "autocomplete" ).menu.active ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
$(this).autocomplete({
|
||||
minLength: 0,
|
||||
source: function( request, response ) {
|
||||
// delegate back to autocomplete, but extract the last term
|
||||
response( $.ui.autocomplete.filter(
|
||||
window.o[o.data_method][autocompleteListName], extractLast( request.term ) ) );
|
||||
},
|
||||
focus: function() {
|
||||
// prevent value inserted on focus
|
||||
return false;
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
var terms = split( this.value );
|
||||
// remove the current input
|
||||
terms.pop();
|
||||
// add the selected item
|
||||
terms.push( ui.item.value );
|
||||
// add placeholder to get the comma-and-space at the end
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
};
|
||||
this.sub_menu_item = function(dom){
|
||||
if(!dom.hasClass('active')){
|
||||
|
||||
Reference in new issue
Block a user