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

Function computeTooltipContent

data/codebrowser.js:503–794  ·  view source on GitHub ↗
(data, title, id)

Source from the content-addressed store, hash-verified

501 }
502
503 var computeTooltipContent = function(data, title, id) {
504 var type ="", content ="";
505 var tt = tooltip.tooltip;
506 var showUseFunc = function(e) {
507 e.stopPropagation();
508 tt.find(".uses").toggle();
509 return false;
510 };
511
512 var symbolUrl;
513 if (data) { // this mean the ref symbol exists
514 var absoluteRoot = absoluteUrl(proj_root_path);
515 var absoluteDataPath = absoluteUrl(data_path);
516 symbolUrl = data_path + "/symbol.html?root=" + computeRelativeUrlTo(absoluteDataPath, absoluteRoot) + "&ref=" + ref;
517 }
518
519 if (elem.hasClass("local") || elem.hasClass("tu") || elem.hasClass("lbl")
520 || (isMacro && !data && ref)) {
521 type = $("#" + escape_selector(ref)).attr("data-type");
522
523 var docs = $("i[data-doc='"+escape_selector(ref)+"']");
524 docs.each(function() {
525 var comment = $(this).html();
526 content += "<br/><i>" + comment + "</i>";
527 var l = $(this).parent().prev("th").text();
528 if (l) {
529 var url = "#" + l;
530 content += " <a href='" + url +"'>&#8618;</a>";
531 }
532
533 });
534
535 //var uses = highlighted_items;
536 var uses = $(".code [data-ref='"+escape_selector(ref)+"']");
537 var usesLis ="";
538 var usesCount = 0;
539 uses.each(function() {
540 var t = $(this);
541 var l = t.parents("td").prev("th").text();
542
543 if (t.hasClass("def")) {
544 content += "<br/><a href='#"+ l +"'>Definition</a>";
545 } else if (t.hasClass("decl") || this.nodeName === "DFN") {
546 content += "<br/><a href='#"+ l +"'>Declaration</a>";
547 } else {
548 var c;
549 if (elem.hasClass("tu")) {
550 // Find the context: Look at up every line from the current one if
551 // there is a .def, if this definition is a declaration, it is the context
552 var prevLines = t.closest("tr").prevAll();
553 for (var x = 0; x < prevLines.length; ++x) {
554 var context = $(prevLines[x]).find(".def");
555 if (!context.length)
556 continue;
557 if (context.length == 1 && context.hasClass("decl")) {
558 c = context[0].title_;
559 if (c === undefined)
560 c = context.attr("title")

Callers 1

onMouseEnterRefFunction · 0.85

Calls 7

absoluteUrlFunction · 0.85
computeRelativeUrlToFunction · 0.85
escape_selectorFunction · 0.85
escape_htmlFunction · 0.85
demangleFunctionNameFunction · 0.85
pFunction · 0.70
prefixLenFunction · 0.70

Tested by

no test coverage detected