2011-01-31 02:06:59 +00:00
|
|
|
$(document).ready(function () {
|
2011-07-23 21:41:22 +00:00
|
|
|
var height = $(document).height();
|
|
|
|
$('#content').css('min-height', function(){ return height; });
|
2011-07-24 17:39:25 +00:00
|
|
|
|
|
|
|
// insert breaker only for the first data/class/function found.
|
|
|
|
var apibreaker = false;
|
|
|
|
$('div.body dl[class]').each(function (i1, elem) {
|
|
|
|
// theses are first level class: attribute and method are inside class.
|
|
|
|
if (!$(elem).hasClass('data') &&
|
|
|
|
!$(elem).hasClass('class') &&
|
|
|
|
!$(elem).hasClass('exception') &&
|
|
|
|
!$(elem).hasClass('function'))
|
|
|
|
return;
|
|
|
|
// dont accept dl inside dl
|
|
|
|
if ($(elem).parents().filter('dl').length > 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
$(elem).addClass('api-level');
|
|
|
|
|
|
|
|
if ( apibreaker == true )
|
|
|
|
return;
|
|
|
|
$('<div id="api"></div>')
|
|
|
|
.attr('id', 'api')
|
|
|
|
.html(
|
|
|
|
$('<h2>API ' +
|
|
|
|
'<a id="api-toggle-all" class="showed">Collapse All ⇑</a>' +
|
|
|
|
'<a id="api-toggle-desc" class="showed">Hide Description ⇑</a>' +
|
|
|
|
'</h2>')
|
|
|
|
)
|
|
|
|
.insertBefore(elem);
|
|
|
|
apibreaker = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('div.body dl[class] dt').hover(
|
|
|
|
function() { $(this).addClass('hover'); },
|
|
|
|
function() { $(this).removeClass('hover'); }
|
|
|
|
);
|
|
|
|
|
|
|
|
if ( apibreaker == true ) {
|
|
|
|
var apilink = $('<div class="bodyshortcut">» <a id="api-link" href="#api">Jump to API</a></div>');
|
|
|
|
apilink.insertAfter($('div.body h1:first'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#api-toggle-all').click(function() {
|
|
|
|
if ($(this).hasClass('showed')) {
|
|
|
|
$('div.body dl.api-level > dd').slideUp();
|
|
|
|
$(this).removeClass('showed');
|
|
|
|
$(this).html('Expand All ⇓');
|
|
|
|
$.cookie('kivy.toggleall', 'true');
|
|
|
|
} else {
|
|
|
|
$('div.body dl.api-level > dd').slideDown();
|
|
|
|
$(this).addClass('showed');
|
|
|
|
$(this).html('Collapse All ⇑');
|
|
|
|
$.cookie('kivy.toggleall', 'false');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#api-toggle-desc').click(function() {
|
|
|
|
if ($(this).hasClass('showed')) {
|
|
|
|
$('div.body dl.api-level > dd > dl > dd').slideUp();
|
|
|
|
$(this).removeClass('showed');
|
|
|
|
$(this).html('Show Descriptions ⇓');
|
|
|
|
$.cookie('kivy.toggledesc', 'true');
|
|
|
|
} else {
|
|
|
|
$('div.body dl.api-level > dd > dl > dd').slideDown();
|
|
|
|
$(this).addClass('showed');
|
|
|
|
$(this).html('Hide Descriptions ⇑');
|
|
|
|
$.cookie('kivy.toggledesc', 'false');
|
|
|
|
}
|
|
|
|
console.log($.cookie('kivy.toggledesc'));
|
|
|
|
});
|
|
|
|
|
|
|
|
$('div.body dl dt').click(function() {
|
|
|
|
$(this).next().slideToggle();
|
|
|
|
});
|
|
|
|
|
|
|
|
if ( $.cookie('kivy.toggledesc') == 'true' ) {
|
|
|
|
$('div.body dl.api-level > dd > dl > dd').hide();
|
|
|
|
$('#api-toggle-desc').removeClass('showed');
|
|
|
|
$('#api-toggle-desc').html('Show Descriptions ⇓');
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $.cookie('kivy.toggleall') == 'true' ) {
|
|
|
|
$('div.body dl.api-level > dd').hide();
|
|
|
|
$('#api-toggle').removeClass('showed');
|
|
|
|
$('#api-toggle').html('Expand All ⇓');
|
|
|
|
}
|
|
|
|
|
|
|
|
//$('div.body dl[class]:first-child').hide();
|
2011-07-23 21:41:22 +00:00
|
|
|
/**
|
|
|
|
$('dl[class]:first-child > a[class="headerlink"]').each(function(i1, elem) {
|
|
|
|
console.log(i1);
|
|
|
|
console.log(elem);
|
2011-01-31 21:42:39 +00:00
|
|
|
$(elem).each(function(i2, e) {
|
|
|
|
var eid = $(e).attr('id');
|
|
|
|
$(e).removeAttr('id');
|
|
|
|
$('<div></div>').attr('id', eid).addClass('anchor').insertBefore(e);
|
|
|
|
});
|
|
|
|
});
|
2011-07-23 21:41:22 +00:00
|
|
|
**/
|
2012-01-25 17:15:36 +00:00
|
|
|
|
|
|
|
// if it's an API page, show the module name.
|
|
|
|
var pagename = location.pathname.split('/');
|
|
|
|
pagename = pagename[pagename.length - 1];
|
|
|
|
if (pagename.search('api-') == 0) {
|
|
|
|
pagename = pagename.substr(4, pagename.length - 9);
|
|
|
|
|
|
|
|
var modulename = $('<div class="bodyshortcut right">Module: <a href="#">' + pagename + '</a></div>')
|
|
|
|
modulename.insertAfter($('div.body h1:first'));
|
|
|
|
}
|
|
|
|
|
2011-01-31 02:06:59 +00:00
|
|
|
});
|