mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 09:40:07 +01:00
Add code to make the inheritance diagrams able to be toggled between shown and hidden.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
BIN
docs/sphinx/_static/images/closed.png
Normal file
BIN
docs/sphinx/_static/images/closed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 123 B |
BIN
docs/sphinx/_static/images/open.png
Normal file
BIN
docs/sphinx/_static/images/open.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 114 B |
60
docs/sphinx/_static/javascript/toggle_visibility.js
Normal file
60
docs/sphinx/_static/javascript/toggle_visibility.js
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* toggle_visibility.js
|
||||
* --------------------
|
||||
*
|
||||
* These functions enable the user to toggle the visibility of a block of
|
||||
* the document, which is delimited by a <div> tag with an expected id
|
||||
* attribute. The magic happens via using the id of the object passed to
|
||||
* toggle visibility to make the id's used to find the other elements that
|
||||
* will be operated upon.
|
||||
*/
|
||||
|
||||
function hasClass(ele,cls) {
|
||||
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
|
||||
}
|
||||
|
||||
function addClass(ele,cls) {
|
||||
if (!this.hasClass(ele,cls)) ele.className += " "+cls;
|
||||
}
|
||||
|
||||
function removeClass(ele,cls) {
|
||||
if (hasClass(ele,cls)) {
|
||||
var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
|
||||
ele.className=ele.className.replace(reg,' ');
|
||||
}
|
||||
}
|
||||
|
||||
function toggleVisibility(linkObj) {
|
||||
var base = linkObj.getAttribute('id');
|
||||
var summary = document.getElementById(base + '-summary');
|
||||
var content = document.getElementById(base + '-content');
|
||||
var trigger = document.getElementById(base + '-trigger');
|
||||
var cookieName = base + '-savedState'
|
||||
if ( hasClass(linkObj,'closed') ) {
|
||||
summary.style.display = 'none';
|
||||
content.style.display = 'block';
|
||||
trigger.src = '_static/images/open.png';
|
||||
removeClass(linkObj,'closed');
|
||||
addClass(linkObj,'opened');
|
||||
$.cookie(cookieName, 'opened');
|
||||
} else if ( hasClass(linkObj,'opened') ) {
|
||||
summary.style.display = 'block';
|
||||
content.style.display = 'none';
|
||||
trigger.src = '_static/images/closed.png';
|
||||
removeClass(linkObj,'opened');
|
||||
addClass(linkObj,'closed');
|
||||
$.cookie(cookieName, 'closed');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function toggleVisibilityOnLoad(linkObj) {
|
||||
var base = linkObj.getAttribute('id');
|
||||
var cookieName = base + '-savedState'
|
||||
var state = $.cookie(cookieName);
|
||||
if ( state == 'opened' ) {
|
||||
toggleVisibility(linkObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,6 +181,8 @@ def setup(app):
|
||||
app.add_javascript('javascript/sidebar.js')
|
||||
app.add_javascript('javascript/jquery.collapse.js')
|
||||
app.add_javascript('javascript/jquery.cookie.js')
|
||||
app.add_javascript('javascript/jquery.cookie.js')
|
||||
app.add_javascript('javascript/toggle_visibility.js')
|
||||
|
||||
app.add_config_value('availability_include_availabilities', False, False)
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ def SphinxIndexes(sphinxDir):
|
||||
"""
|
||||
This is the main function called after the `etg` process has finished.
|
||||
|
||||
It class other functions to generate the standalone functions page, the
|
||||
It calls other functions to generate the standalone functions page, the
|
||||
main class index and some clean-up/maintenance of the generated ReST
|
||||
files.
|
||||
"""
|
||||
|
||||
@@ -30,15 +30,21 @@ TEMPLATE_INHERITANCE = '''
|
||||
|
||||
|
|
||||
|
||||
|class_hierarchy| Inheritance Diagram
|
||||
=====================================
|
||||
|
||||
Inheritance diagram for %s **%s**
|
||||
|class_hierarchy| Class Hierarchy
|
||||
=================================
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
|
||||
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
|
||||
Inheritance diagram for %s <strong>%s</strong>:
|
||||
</div>
|
||||
<div id="toggleBlock-summary" style="display:block;"></div>
|
||||
<div id="toggleBlock-content" style="display:none;">
|
||||
<p class="graphviz">
|
||||
<center><img src="_static/images/inheritance/%s" alt="Inheritance diagram of %s" usemap="#dummy" class="inheritance"/></center>
|
||||
</div>
|
||||
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
|
||||
%s
|
||||
</p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user