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

Function activate

data/indexscript.js:58–91  ·  view source on GitHub ↗
(event,ui)

Source from the content-addressed store, hash-verified

56
57 // callback for jqueryui's autocomple activate
58 var activate = function(event,ui) {
59 var val = ui.item.value;
60 var type = searchTerms[val] && searchTerms[val].type;
61 if (type == "file") {
62 window.location = root_path + '/' + searchTerms[val].file + ".html";
63 } else if (type == "ref") {
64 var ref = searchTerms[val].ref;
65 var url = root_path + "/refs/" + ref;
66 $.get(url, function(data) {
67 var res = $("<data>"+data+"</data>");
68 var def = res.find("def");
69 var result = { len: -1 };
70 def.each( function() {
71 var cur = { len : -1,
72 f : $(this).attr("f"),
73 l : $(this).attr("l") }
74
75 cur.len = prefixLen(cur.f, file)
76 if (cur.len >= result.len) {
77 result = cur;
78 result.isMarcro = ($(this).attr("macro"));
79 }
80 });
81
82 if (result.len >= 0) {
83 var newloc = root_path + "/" + result.f + ".html#" +
84 (result.isMarcro ? result.l : ref );
85 window.location = newloc;
86 }
87 });
88 } else {
89 text_search(val);
90 }
91 };
92
93 var getFnNameKey = function (request) {
94 if (request.indexOf('/') != -1 || request.indexOf('.') != -1)

Callers 1

indexscript.jsFile · 0.70

Calls 2

prefixLenFunction · 0.70
text_searchFunction · 0.70

Tested by

no test coverage detected