diff options
Diffstat (limited to 'doc/html/_static/doctools.js')
-rw-r--r-- | doc/html/_static/doctools.js | 59 |
1 files changed, 37 insertions, 22 deletions
diff --git a/doc/html/_static/doctools.js b/doc/html/_static/doctools.js index 9447678..d4619fd 100644 --- a/doc/html/_static/doctools.js +++ b/doc/html/_static/doctools.js @@ -1,16 +1,31 @@ -/// XXX: make it cross browser +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for all documentation. + * + * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); /** * make the code below compatible with browsers without * an installed firebug like debugger - */ if (!window.console || !console.firebug) { - var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", - "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", + "profile", "profileEnd"]; window.console = {}; for (var i = 0; i < names.length; ++i) - window.console[names[i]] = function() {} + window.console[names[i]] = function() {}; } + */ /** * small helper function to urldecode strings @@ -44,7 +59,7 @@ jQuery.getQueryParameters = function(s) { result[key] = [value]; } return result; -} +}; /** * small function to check if an array contains @@ -56,7 +71,7 @@ jQuery.contains = function(arr, item) { return true; } return false; -} +}; /** * highlight a given string on a jquery object by wrapping it in @@ -67,7 +82,7 @@ jQuery.fn.highlightText = function(text, className) { if (node.nodeType == 3) { var val = node.nodeValue; var pos = val.toLowerCase().indexOf(text); - if (pos >= 0 && !jQuery.className.has(node.parentNode, className)) { + if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { var span = document.createElement("span"); span.className = className; span.appendChild(document.createTextNode(val.substr(pos, text.length))); @@ -79,14 +94,14 @@ jQuery.fn.highlightText = function(text, className) { } else if (!jQuery(node).is("button, select, textarea")) { jQuery.each(node.childNodes, function() { - highlight(this) + highlight(this); }); } } return this.each(function() { highlight(this); }); -} +}; /** * Small JavaScript module for the documentation. @@ -96,7 +111,7 @@ var Documentation = { init : function() { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); - this.initModIndex(); + this.initIndexTable(); }, /** @@ -107,7 +122,7 @@ var Documentation = { LOCALE : 'unknown', // gettext and ngettext don't access this so that the functions - // can savely bound to a different name (_ = Documentation.gettext) + // can safely bound to a different name (_ = Documentation.gettext) gettext : function(string) { var translated = Documentation.TRANSLATIONS[string]; if (typeof translated == 'undefined') @@ -167,29 +182,29 @@ var Documentation = { var body = $('div.body'); window.setTimeout(function() { $.each(terms, function() { - body.highlightText(this.toLowerCase(), 'highlight'); + body.highlightText(this.toLowerCase(), 'highlighted'); }); }, 10); - $('<li class="highlight-link"><a href="javascript:Documentation.' + - 'hideSearchWords()">' + _('Hide Search Matches') + '</a></li>') - .appendTo($('.sidebar .this-page-menu')); + $('<p class="highlight-link"><a href="javascript:Documentation.' + + 'hideSearchWords()">' + _('Hide Search Matches') + '</a></p>') + .appendTo($('#searchbox')); } }, /** - * init the modindex toggle buttons + * init the domain index toggle buttons */ - initModIndex : function() { + initIndexTable : function() { var togglers = $('img.toggler').click(function() { var src = $(this).attr('src'); var idnum = $(this).attr('id').substr(7); - console.log($('tr.cg-' + idnum).toggle()); + $('tr.cg-' + idnum).toggle(); if (src.substr(-9) == 'minus.png') $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); else $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); }).css('display', ''); - if (DOCUMENTATION_OPTIONS.COLLAPSE_MODINDEX) { + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { togglers.click(); } }, @@ -198,8 +213,8 @@ var Documentation = { * helper function to hide the search marks again */ hideSearchWords : function() { - $('.sidebar .this-page-menu li.highlight-link').fadeOut(300); - $('span.highlight').removeClass('highlight'); + $('#searchbox .highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); }, /** |