1define(['jquery','tag-it','jqueryui','setup'],function($){function init($target){if(typeof $target!='undefined'){$target_tags=$target.find('.autocomplete_tags');$target_author=$target.find('.autocomplete_author');} 2else{$target_tags=$('.autocomplete_tags');$target_author=$('.autocomplete_author');} 3$target_tags.tagit({allowSpaces:true,tagSource:function(search,showChoices){if(search.term.length<2){return;} 4var url=$('#autocomplete_tags').val();$.get(url+'?term='+search.term,function(data){var terms=[] 5for(var i=0;i<data.length&i<15;i++){terms.push(data[i].term);} 6showChoices(terms);},'json');}});$target_author.autocomplete().autocomplete('option','source',function(request,response){var tokens=$.trim(request.term).split(" ");var enough=false;for(t in tokens){enough|=tokens[t].length>2} 7if(!enough){response([]);return;} 8$.getJSON($('#autocomplete_authors').val() 9+'?mask=[last_name], [first_name] "[author_string]"' 10+'&term='+request.term,function(data){var results=[];for(i in data){var highlightened=data[i].formatted;for(t in tokens){if(tokens[t]!=""){highlightened=highlightened.replace(new RegExp('('+tokens[t]+')','gi'),'[[$1]]');}} 11highlightened=highlightened.replace(/\[\[/g,'<strong>').replace(/\]\]/g,'</strong>').replace(/""/g,'');results.push({'value':data[i].raw,'label':highlightened});} 12response(results);});});if($target_author.length>0){$target_author.data("autocomplete")._renderItem=function(ul,item){return $("<li>").data("item.autocomplete",item).append("<a>"+item.label+"</a>").appendTo(ul);};} 13$('.tagit-new input[type=text]').focus(function(){$(this).closest('ul.tagit').addClass('fc-box-shadow');}).blur(function(){$(this).closest('ul.tagit').removeClass('fc-box-shadow');})} 14return{'init':init};});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.