update documentation to move search box in header + toggle header

This commit is contained in:
Mathieu Virbel 2011-01-31 22:11:41 +01:00
parent cf31d27dda
commit ed4de7ebd1
5 changed files with 171 additions and 17 deletions

View File

@ -52,6 +52,23 @@ div.anchor {
margin-bottom: 10px;
}
#toggleheader {
font-size: 10px;
float: right;
background-color: #eceae0;
background-color: #acaaa0;
margin-top: 35px;
margin-right: 10px;
padding: 3px 9px;
cursor: pointer;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
-moz-border-radius-bottomleft: 15px;
-moz-border-radius-bottomright: 15px;
-webkit-border-radius-bottomleft: 15px;
-webkit-border-radius-topright: 15px;
}
/** Header
*/
#topbar {
@ -85,18 +102,28 @@ ul.navigation {
margin-left: 5px;
}
ul.navigation form.search,
ul.navigation li a {
float: left;
margin-right: 20px;
outline: 0;
font-size: 13px;
}
ul.navigation li a {
color: #adaba8;
text-decoration: none;
}
ul.navigation input {
font-family: sans-serif;
font-size: 1em;
background: #eceae0 url('search.png') 140px 3px no-repeat;
padding: 3px 5px 3px 10px;
border: none;
border-radius: 15px;
width: 150px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
}
ul.navigation li a.selected,
ul.navigation li a:hover {
background: transparent url('highlight.png') center top no-repeat;

View File

@ -0,0 +1,91 @@
/*jslint browser: true */ /*global jQuery: true */
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
// TODO JsDoc
/**
* Create a cookie with the given key and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String key The key of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given key.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String key The key of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function (key, value, options) {
// key and at least value given, set cookie...
if (arguments.length > 1 && String(value) !== "[object Object]") {
options = jQuery.extend({}, options);
if (value === null || value === undefined) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

View File

@ -1,4 +1,44 @@
function updateheadercookie(st) {
$.cookie('kivy.header', st);
}
function hideheader(do_animation) {
if (do_animation) {
$('#wrapper').animate({'padding-top': '40'}, 500);
$('div.anchor').animate({'margin-top': '-40'}, 500);
$('#topbar').animate({'margin-top': '-120'}, 500);
} else {
$('#wrapper').css('padding-top', '40px');
$('div.anchor').css('margin-top', '-40px');
$('#topbar').css('margin-top', '-120px');
}
$('#toggleheader').html('Expand header');
updateheadercookie('hide');
}
function showheader() {
$('#wrapper').animate({'padding-top': '160'}, 500);
$('div.anchor').animate({'margin-top': '-160'}, 500);
$('#topbar').animate({'margin-top': '0'}, 500);
$('#toggleheader').html('Hide header');
updateheadercookie('show');
}
$(document).ready(function () {
st = $.cookie('kivy.header')
if ( st == 'hide' )
hideheader();
else
showheader();
$('#toggleheader').click(function() {
if ( $.cookie('kivy.header') == 'hide' )
showheader();
else
hideheader(true);
});
$(['div.section[id]', 'dt[id]']).each(function(i1, elem) {
$(elem).each(function(i2, e) {
var eid = $(e).attr('id');

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

View File

@ -68,20 +68,6 @@
{%- if not embedded %}{% if not theme_nosidebar|tobool %}
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
{%- block sidebarsearch %}
{%- if pagename != "search" %}
<h3>{{ _('Quick search') }}</h3>
<div id="searchbox" style="display: none">
<form class="search" action="{{ pathto('search') }}" method="get">
<input type="text" name="q" size="15" />
<input type="submit" value="{{ _('Go') }}" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
{%- endif %}
{%- endblock %}
{%- block sidebartoc %}
<h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
{{ toc }}
@ -127,6 +113,7 @@
{%- for scriptfile in script_files %}
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
{%- endfor %}
<script type="text/javascript" src="{{ pathto('_static/jquery.cookie.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/kivy.js', 1) }}"></script>
{%- if use_opensearch %}
<link rel="search" type="application/opensearchdescription+xml"
@ -182,8 +169,17 @@
<li><a href="{{ pathto('guide-index') }}">Programming Guide</a></li>
<li><a href="{{ pathto('api-index') }}">API Reference</a></li>
<li><a href="{{ pathto('faq') }}">FAQ</a></li>
<li>
<form class="search" action="{{ pathto('search') }}" method="get">
&nbsp;
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
<input type="text" class="text" name="q" />
</form>
</li>
</ul>
</div>
<div id="toggleheader"></div>
</div>
<div id="wrapper">