MCPcopy Create free account
hub / github.com/KDAB/codebrowser / activate

Function activate

data/codebrowser.js:999–1032  ·  view source on GitHub ↗
(event,ui)

Source from the content-addressed store, hash-verified

997//BEGIN code duplicated in indexscript.js
998 // callback for jqueryui's autocomple activate
999 var activate = function(event,ui) {
1000 var val = ui.item.value;
1001 var type = searchTerms[val] && searchTerms[val].type;
1002 if (type == "file") {
1003 window.location = root_path + '/' + searchTerms[val].file + ".html";
1004 } else if (type == "ref") {
1005 var ref = searchTerms[val].ref;
1006 var url = root_path + "/refs/" + ref;
1007 $.get(url, function(data) {
1008 var res = $("<data>"+data+"</data>");
1009 var def = res.find("def");
1010 var result = { len: -1 };
1011 def.each( function() {
1012 var cur = { len : -1,
1013 f : $(this).attr("f"),
1014 l : $(this).attr("l") }
1015
1016 cur.len = prefixLen(cur.f, file)
1017 if (cur.len >= result.len) {
1018 result = cur;
1019 result.isMarcro = ($(this).attr("macro"));
1020 }
1021 });
1022
1023 if (result.len >= 0) {
1024 var newloc = root_path + "/" + result.f + ".html#" +
1025 (result.isMarcro ? result.l : ref );
1026 window.location = newloc;
1027 }
1028 });
1029 } else {
1030 text_search(val);
1031 }
1032 };
1033
1034 var getFnNameKey = function (request) {
1035 if (request.indexOf('/') != -1 || request.indexOf('.') != -1)

Callers 1

codebrowser.jsFile · 0.70

Calls 2

prefixLenFunction · 0.70
text_searchFunction · 0.70

Tested by

no test coverage detected