PageSourceSearch

https://api.qgroundcontrol.com/master/dynsections.js

js qgroundcontrol.com collected 2026-10-03 19:09:39 UTC 8,054 bytes, 199 lines download raw bytes

1/*
2 @licstart  The following is the entire license notice for the JavaScript code in this file.
3
4 The MIT License (MIT)
5
6 Copyright (C) 1997-2020 by Dimitri van Heesch
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
9 and associated documentation files (the "Software"), to deal in the Software without restriction,
10 including without limitation the rights to use, copy, modify, merge, publish, distribute,
11 sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in all copies or
15 substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
18 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23 @licend  The above is the entire license notice for the JavaScript code in this file
24 */
25function toggleVisibility(linkObj)
26{
27 var base = $(linkObj).attr('id');
28 var summary = $('#'+base+'-summary');
29 var content = $('#'+base+'-content');
30 var trigger = $('#'+base+'-trigger');
31 var src=$(trigger).attr('src');
32 if (content.is(':visible')===true) {
33   content.hide();
34   summary.show();
35   $(linkObj).addClass('closed').removeClass('opened');
36   $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
37 } else {
38   content.show();
39   summary.hide();
40   $(linkObj).removeClass('closed').addClass('opened');
41   $(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
42 }
43 return false;
44}
45
46function updateStripes()
47{
48  $('table.directory tr').
49       removeClass('even').filter(':visible:even').addClass('even');
50  $('table.directory tr').
51       removeClass('odd').filter(':visible:odd').addClass('odd');
52}
53
54function toggleLevel(level)
55{
56  $('table.directory tr').each(function() {
57    var l = this.id.split('_').length-1;
58    var i = $('#img'+this.id.substring(3));
59    var a = $('#arr'+this.id.substring(3));
60    if (l<level+1) {
61      i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
62      a.html('&#9660;');
63      $(this).show();
64    } else if (l==level+1) {
65      i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
66      a.html('&#9658;');
67      $(this).show();
68    } else {
69      $(this).hide();
70    }
71  });
72  updateStripes();
73}
74
75function toggleFolder(id)
76{
77  // the clicked row
78  var currentRow = $('#row_'+id);
79
80  // all rows after the clicked row
81  var rows = currentRow.nextAll("tr");
82
83  var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
84
85  // only match elements AFTER this one (can't hide elements before)
86  var childRows = rows.filter(function() { return this.id.match(re); });
87
88  // first row is visible we are HIDING
89  if (childRows.filter(':first').is(':visible')===true) {
90    // replace down arrow by right arrow for current row
91    var currentRowSpans = currentRow.find("span");
92    currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
93    currentRowSpans.filter(".arrow").html('&#9658;');
94    rows.filter("[id^=row_"+id+"]").hide(); // hide all children
95  } else { // we are SHOWING
96    // replace right arrow by down arrow for current row
97    var currentRowSpans = currentRow.find("span");
98    currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
99    currentRowSpans.filter(".arrow").html('&#9660;');
100    // replace down arrows by right arrows for child rows
101    var childRowsSpans = childRows.find("span");
102    childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
103    childRowsSpans.filter(".arrow").html('&#9658;');
104    childRows.show(); //show all children
105  }
106  updateStripes();
107}
108
109
110function toggleInherit(id)
111{
112  var rows = $('tr.inherit.'+id);
113  var img = $('tr.inherit_header.'+id+' img');
114  var src = $(img).attr('src');
115  if (rows.filter(':first').is(':visible')===true) {
116    rows.css('display','none');
117    $(img).attr('src',src.substring(0,src.length-8)+'closed.png');
118  } else {
119    rows.css('display','table-row'); // using show() causes jump in firefox
120    $(img).attr('src',src.substring(0,src.length-10)+'open.png');
121  }
122}
123
124var opened=true;
125// in case HTML_COLORSTYLE is LIGHT or DARK the vars will be replaced, so we write them out explicitly and use double quotes
126var plusImg  = [ "var(--fold-plus-image)",  "var(--fold-plus-image-relpath)" ];
127var minusImg = [ "var(--fold-minus-image)", "var(--fold-minus-image-relpath)" ];
128
129// toggle all folding blocks
130function codefold_toggle_all(relPath) {
131 if (opened) {
132   $('#fold_all').css('background-image',plusImg[relPath]);
133   $('div[id^=foldopen]').hide();
134   $('div[id^=foldclosed]').show();
135 } else {
136   $('#fold_all').css('background-image',minusImg[relPath]);
137   $('div[id^=foldopen]').show();
138   $('div[id^=foldclosed]').hide();
139 }
140 opened=!opened;
141}
142
143// toggle single folding block
144function codefold_toggle(id) {
145  $('#foldopen'+id).toggle();
146  $('#foldclosed'+id).toggle();
147}
148function init_codefold(relPath) {
149  $('span[class=lineno]').css(
150    {'padding-right':'4px',
151     'margin-right':'2px',
152     'display':'inline-block',
153     'width':'54px',
154     'background':'linear-gradient(var(--fold-line-color),var(--fold-line-color)) no-repeat 46px/2px 100%'
155    });
156  // add global toggle to first line
157  $('span[class=lineno]:first').append('<span class="fold" id="fold_all" '+
158                                             'onclick="javascript:codefold_toggle_all('+relPath+');" '+
159                                             'style="background-image:'+minusImg[relPath]+';"></span>');
160  // add vertical lines to other rows
161  $('span[class=lineno]').not(':eq(0)').append('<span class="fold"></span>');
162  // add toggle controls to lines with fold divs
163  $('div[class=foldopen]').each(function() {
164    // extract specific id to use
165    var id    = $(this).attr('id').replace('foldopen','');
166    // extract start and end foldable fragment attributes
167    var start = $(this).attr('data-start');
168    var end   = $(this).attr('data-end');
169    // replace normal fold span with controls for the first line of a foldable fragment
170    $(this).find('span[class=fold]:first').replaceWith('<span class="fold" '+
171                                                       'onclick="javascript:codefold_toggle(\''+id+'\');" '+
172                                                       'style="background-image:'+minusImg[relPath]+';"></span>');
173    // append div for folded (closed) representation
174    $(this).after('<div id="foldclosed'+id+'" class="foldclosed" style="display:none;"></div>');
175    // extract the first line from the "open" section to represent closed content
176    var line = $(this).children().first().clone();
177    // remove any glow that might still be active on the original line
178    $(line).removeClass('glow');
179    if (start) {
180      // if line already ends with a start marker (e.g. trailing {), remove it
181      $(line).html($(line).html().replace(new RegExp('\\s*'+start+'\\s*$','g'),''));
182    }
183    // replace minus with plus symbol
184    $(line).find('span[class=fold]').css('background-image',plusImg[relPath]);
185    // append ellipsis
186    $(line).append(' '+start+'<a href="javascript:codefold_toggle(\''+id+'\')">&#8230;</a>'+end);
187    // insert constructed line into closed div
188    $('#foldclosed'+id).html(line);
189  });
190}
191
192/* @license-end */
193$(document).ready(function() {
194  $('.code,.codeRef').each(function() {
195    $(this).data('powertip',$('#a'+$(this).attr('href').replace(/.*\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html());
196    $.fn.powerTip.smartPlacementLists.s = [ 's', 'n', 'ne', 'se' ];
197    $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true });
198  });
199});

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.