Updated documentation
This commit is contained in:
214
doc_yard/js/app.js
Normal file
214
doc_yard/js/app.js
Normal file
@@ -0,0 +1,214 @@
|
||||
function createSourceLinks() {
|
||||
$('.method_details_list .source_code').
|
||||
before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
|
||||
$('.toggleSource').toggle(function() {
|
||||
$(this).parent().nextAll('.source_code').slideDown(100);
|
||||
$(this).text("Hide source");
|
||||
},
|
||||
function() {
|
||||
$(this).parent().nextAll('.source_code').slideUp(100);
|
||||
$(this).text("View source");
|
||||
});
|
||||
}
|
||||
|
||||
function createDefineLinks() {
|
||||
var tHeight = 0;
|
||||
$('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
|
||||
$('.toggleDefines').toggle(function() {
|
||||
tHeight = $(this).parent().prev().height();
|
||||
$(this).prev().show();
|
||||
$(this).parent().prev().height($(this).parent().height());
|
||||
$(this).text("(less)");
|
||||
},
|
||||
function() {
|
||||
$(this).prev().hide();
|
||||
$(this).parent().prev().height(tHeight);
|
||||
$(this).text("more...");
|
||||
});
|
||||
}
|
||||
|
||||
function createFullTreeLinks() {
|
||||
var tHeight = 0;
|
||||
$('.inheritanceTree').toggle(function() {
|
||||
tHeight = $(this).parent().prev().height();
|
||||
$(this).parent().toggleClass('showAll');
|
||||
$(this).text("(hide)");
|
||||
$(this).parent().prev().height($(this).parent().height());
|
||||
},
|
||||
function() {
|
||||
$(this).parent().toggleClass('showAll');
|
||||
$(this).parent().prev().height(tHeight);
|
||||
$(this).text("show all");
|
||||
});
|
||||
}
|
||||
|
||||
function fixBoxInfoHeights() {
|
||||
$('dl.box dd.r1, dl.box dd.r2').each(function() {
|
||||
$(this).prev().height($(this).height());
|
||||
});
|
||||
}
|
||||
|
||||
function searchFrameLinks() {
|
||||
$('.full_list_link').click(function() {
|
||||
toggleSearchFrame(this, $(this).attr('href'));
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function toggleSearchFrame(id, link) {
|
||||
var frame = $('#search_frame');
|
||||
$('#search a').removeClass('active').addClass('inactive');
|
||||
if (frame.attr('src') == link && frame.css('display') != "none") {
|
||||
frame.slideUp(100);
|
||||
$('#search a').removeClass('active inactive');
|
||||
}
|
||||
else {
|
||||
$(id).addClass('active').removeClass('inactive');
|
||||
frame.attr('src', link).slideDown(100);
|
||||
}
|
||||
}
|
||||
|
||||
function linkSummaries() {
|
||||
$('.summary_signature').click(function() {
|
||||
document.location = $(this).find('a').attr('href');
|
||||
});
|
||||
}
|
||||
|
||||
function framesInit() {
|
||||
if (hasFrames) {
|
||||
document.body.className = 'frames';
|
||||
$('#menu .noframes a').attr('href', document.location);
|
||||
window.top.document.title = $('html head title').text();
|
||||
}
|
||||
else {
|
||||
$('#menu .noframes a').text('frames').attr('href', framesUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function keyboardShortcuts() {
|
||||
if (window.top.frames.main) return;
|
||||
$(document).keypress(function(evt) {
|
||||
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
|
||||
if (typeof evt.target !== "undefined" &&
|
||||
(evt.target.nodeName == "INPUT" ||
|
||||
evt.target.nodeName == "TEXTAREA")) return;
|
||||
switch (evt.charCode) {
|
||||
case 67: case 99: $('#class_list_link').click(); break; // 'c'
|
||||
case 77: case 109: $('#method_list_link').click(); break; // 'm'
|
||||
case 70: case 102: $('#file_list_link').click(); break; // 'f'
|
||||
default: break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function summaryToggle() {
|
||||
$('.summary_toggle').click(function() {
|
||||
if (localStorage) {
|
||||
localStorage.summaryCollapsed = $(this).text();
|
||||
}
|
||||
$('.summary_toggle').each(function() {
|
||||
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
|
||||
var next = $(this).parent().parent().nextAll('ul.summary').first();
|
||||
if (next.hasClass('compact')) {
|
||||
next.toggle();
|
||||
next.nextAll('ul.summary').first().toggle();
|
||||
}
|
||||
else if (next.hasClass('summary')) {
|
||||
var list = $('<ul class="summary compact" />');
|
||||
list.html(next.html());
|
||||
list.find('.summary_desc, .note').remove();
|
||||
list.find('a').each(function() {
|
||||
$(this).html($(this).find('strong').html());
|
||||
$(this).parent().html($(this)[0].outerHTML);
|
||||
});
|
||||
next.before(list);
|
||||
next.toggle();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
if (localStorage) {
|
||||
if (localStorage.summaryCollapsed == "collapse") {
|
||||
$('.summary_toggle').first().click();
|
||||
}
|
||||
else localStorage.summaryCollapsed = "expand";
|
||||
}
|
||||
}
|
||||
|
||||
function fixOutsideWorldLinks() {
|
||||
$('a').each(function() {
|
||||
if (window.location.host != this.host) this.target = '_parent';
|
||||
});
|
||||
}
|
||||
|
||||
function generateTOC() {
|
||||
if ($('#filecontents').length === 0) return;
|
||||
var _toc = $('<ol class="top"></ol>');
|
||||
var show = false;
|
||||
var toc = _toc;
|
||||
var counter = 0;
|
||||
var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
|
||||
var i;
|
||||
if ($('#filecontents h1').length > 1) tags.unshift('h1');
|
||||
for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
|
||||
var lastTag = parseInt(tags[0][1], 10);
|
||||
$(tags.join(', ')).each(function() {
|
||||
if ($(this).parents('.method_details .docstring').length != 0) return;
|
||||
if (this.id == "filecontents") return;
|
||||
show = true;
|
||||
var thisTag = parseInt(this.tagName[1], 10);
|
||||
if (this.id.length === 0) {
|
||||
var proposedId = $(this).attr('toc-id');
|
||||
if (typeof(proposedId) != "undefined") this.id = proposedId;
|
||||
else {
|
||||
var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
|
||||
if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
|
||||
this.id = proposedId;
|
||||
}
|
||||
}
|
||||
if (thisTag > lastTag) {
|
||||
for (i = 0; i < thisTag - lastTag; i++) {
|
||||
var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
|
||||
}
|
||||
}
|
||||
if (thisTag < lastTag) {
|
||||
for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
|
||||
}
|
||||
var title = $(this).attr('toc-title');
|
||||
if (typeof(title) == "undefined") title = $(this).text();
|
||||
toc.append('<li><a href="#' + this.id + '">' + title + '</a></li>');
|
||||
lastTag = thisTag;
|
||||
});
|
||||
if (!show) return;
|
||||
html = '<div id="toc"><p class="title"><a class="hide_toc" href="#"><strong>Table of Contents</strong></a> <small>(<a href="#" class="float_toc">left</a>)</small></p></div>';
|
||||
$('#content').prepend(html);
|
||||
$('#toc').append(_toc);
|
||||
$('#toc .hide_toc').toggle(function() {
|
||||
$('#toc .top').slideUp('fast');
|
||||
$('#toc').toggleClass('hidden');
|
||||
$('#toc .title small').toggle();
|
||||
}, function() {
|
||||
$('#toc .top').slideDown('fast');
|
||||
$('#toc').toggleClass('hidden');
|
||||
$('#toc .title small').toggle();
|
||||
});
|
||||
$('#toc .float_toc').toggle(function() {
|
||||
$(this).text('float');
|
||||
$('#toc').toggleClass('nofloat');
|
||||
}, function() {
|
||||
$(this).text('left');
|
||||
$('#toc').toggleClass('nofloat');
|
||||
});
|
||||
}
|
||||
|
||||
$(framesInit);
|
||||
$(createSourceLinks);
|
||||
$(createDefineLinks);
|
||||
$(createFullTreeLinks);
|
||||
$(fixBoxInfoHeights);
|
||||
$(searchFrameLinks);
|
||||
$(linkSummaries);
|
||||
$(keyboardShortcuts);
|
||||
$(summaryToggle);
|
||||
$(fixOutsideWorldLinks);
|
||||
$(generateTOC);
|
||||
178
doc_yard/js/full_list.js
Normal file
178
doc_yard/js/full_list.js
Normal file
@@ -0,0 +1,178 @@
|
||||
var inSearch = null;
|
||||
var searchIndex = 0;
|
||||
var searchCache = [];
|
||||
var searchString = '';
|
||||
var regexSearchString = '';
|
||||
var caseSensitiveMatch = false;
|
||||
var ignoreKeyCodeMin = 8;
|
||||
var ignoreKeyCodeMax = 46;
|
||||
var commandKey = 91;
|
||||
|
||||
RegExp.escape = function(text) {
|
||||
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||
}
|
||||
|
||||
function fullListSearch() {
|
||||
// generate cache
|
||||
searchCache = [];
|
||||
$('#full_list li').each(function() {
|
||||
var link = $(this).find('.object_link a');
|
||||
if (link.length === 0) return;
|
||||
var fullName = link.attr('title').split(' ')[0];
|
||||
searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link});
|
||||
});
|
||||
|
||||
$('#search input').keyup(function(event) {
|
||||
if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax)
|
||||
|| event.keyCode == commandKey)
|
||||
return;
|
||||
searchString = this.value;
|
||||
caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
|
||||
regexSearchString = RegExp.escape(searchString);
|
||||
if (caseSensitiveMatch) {
|
||||
regexSearchString += "|" +
|
||||
$.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
|
||||
join('.+?');
|
||||
}
|
||||
if (searchString === "") {
|
||||
clearTimeout(inSearch);
|
||||
inSearch = null;
|
||||
$('ul .search_uncollapsed').removeClass('search_uncollapsed');
|
||||
$('#full_list, #content').removeClass('insearch');
|
||||
$('#full_list li').removeClass('found').each(function() {
|
||||
|
||||
var link = $(this).find('.object_link a');
|
||||
if (link.length > 0) link.text(link.text());
|
||||
});
|
||||
if (clicked) {
|
||||
clicked.parents('ul').each(function() {
|
||||
$(this).removeClass('collapsed').prev().removeClass('collapsed');
|
||||
});
|
||||
}
|
||||
highlight();
|
||||
}
|
||||
else {
|
||||
if (inSearch) clearTimeout(inSearch);
|
||||
searchIndex = 0;
|
||||
lastRowClass = '';
|
||||
$('#full_list, #content').addClass('insearch');
|
||||
$('#noresults').text('');
|
||||
searchItem();
|
||||
}
|
||||
});
|
||||
|
||||
$('#search input').focus();
|
||||
$('#full_list').after("<div id='noresults'></div>");
|
||||
}
|
||||
|
||||
var lastRowClass = '';
|
||||
function searchItem() {
|
||||
for (var i = 0; i < searchCache.length / 50; i++) {
|
||||
var item = searchCache[searchIndex];
|
||||
var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
|
||||
var matchString = regexSearchString;
|
||||
var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
|
||||
if (searchName.match(matchRegexp) == null) {
|
||||
item.node.removeClass('found');
|
||||
}
|
||||
else {
|
||||
item.node.css('padding-left', '10px').addClass('found');
|
||||
item.node.parents().addClass('search_uncollapsed');
|
||||
item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
|
||||
lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
|
||||
item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
|
||||
}
|
||||
|
||||
if (searchCache.length === searchIndex + 1) {
|
||||
searchDone();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
searchIndex++;
|
||||
}
|
||||
}
|
||||
inSearch = setTimeout('searchItem()', 0);
|
||||
}
|
||||
|
||||
function searchDone() {
|
||||
highlight(true);
|
||||
if ($('#full_list li:visible').size() === 0) {
|
||||
$('#noresults').text('No results were found.').hide().fadeIn();
|
||||
}
|
||||
else {
|
||||
$('#noresults').text('');
|
||||
}
|
||||
$('#content').removeClass('insearch');
|
||||
clearTimeout(inSearch);
|
||||
inSearch = null;
|
||||
}
|
||||
|
||||
clicked = null;
|
||||
function linkList() {
|
||||
$('#full_list li, #full_list li a:last').click(function(evt) {
|
||||
if ($(this).hasClass('toggle')) return true;
|
||||
if ($(this).find('.object_link a').length === 0) {
|
||||
$(this).children('a.toggle').click();
|
||||
return false;
|
||||
}
|
||||
if (this.tagName.toLowerCase() == "li") {
|
||||
var toggle = $(this).children('a.toggle');
|
||||
if (toggle.size() > 0 && evt.pageX < toggle.offset().left) {
|
||||
toggle.click();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (clicked) clicked.removeClass('clicked');
|
||||
var win = window.top.frames.main ? window.top.frames.main : window.parent;
|
||||
if (this.tagName.toLowerCase() == "a") {
|
||||
clicked = $(this).parent('li').addClass('clicked');
|
||||
win.location = this.href;
|
||||
}
|
||||
else {
|
||||
clicked = $(this).addClass('clicked');
|
||||
win.location = $(this).find('a:last').attr('href');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function collapse() {
|
||||
if (!$('#full_list').hasClass('class')) return;
|
||||
$('#full_list.class a.toggle').click(function() {
|
||||
$(this).parent().toggleClass('collapsed').next().toggleClass('collapsed');
|
||||
highlight();
|
||||
return false;
|
||||
});
|
||||
$('#full_list.class ul').each(function() {
|
||||
$(this).addClass('collapsed').prev().addClass('collapsed');
|
||||
});
|
||||
$('#full_list.class').children().removeClass('collapsed');
|
||||
highlight();
|
||||
}
|
||||
|
||||
function highlight(no_padding) {
|
||||
var n = 1;
|
||||
$('#full_list li:visible').each(function() {
|
||||
var next = n == 1 ? 2 : 1;
|
||||
$(this).removeClass("r" + next).addClass("r" + n);
|
||||
if (!no_padding && $('#full_list').hasClass('class')) {
|
||||
$(this).css('padding-left', (10 + $(this).parents('ul').size() * 15) + 'px');
|
||||
}
|
||||
n = next;
|
||||
});
|
||||
}
|
||||
|
||||
function escapeShortcut() {
|
||||
$(document).keydown(function(evt) {
|
||||
if (evt.which == 27) {
|
||||
$('#search_frame', window.top.document).slideUp(100);
|
||||
$('#search a', window.top.document).removeClass('active inactive');
|
||||
$(window.top).focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(escapeShortcut);
|
||||
$(fullListSearch);
|
||||
$(linkList);
|
||||
$(collapse);
|
||||
4
doc_yard/js/jquery.js
vendored
Normal file
4
doc_yard/js/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user