1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/python/mock-1.0.0/html/_static/doctools.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,247 @@ 1.4 +/* 1.5 + * doctools.js 1.6 + * ~~~~~~~~~~~ 1.7 + * 1.8 + * Sphinx JavaScript utilities for all documentation. 1.9 + * 1.10 + * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. 1.11 + * :license: BSD, see LICENSE for details. 1.12 + * 1.13 + */ 1.14 + 1.15 +/** 1.16 + * select a different prefix for underscore 1.17 + */ 1.18 +$u = _.noConflict(); 1.19 + 1.20 +/** 1.21 + * make the code below compatible with browsers without 1.22 + * an installed firebug like debugger 1.23 +if (!window.console || !console.firebug) { 1.24 + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", 1.25 + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", 1.26 + "profile", "profileEnd"]; 1.27 + window.console = {}; 1.28 + for (var i = 0; i < names.length; ++i) 1.29 + window.console[names[i]] = function() {}; 1.30 +} 1.31 + */ 1.32 + 1.33 +/** 1.34 + * small helper function to urldecode strings 1.35 + */ 1.36 +jQuery.urldecode = function(x) { 1.37 + return decodeURIComponent(x).replace(/\+/g, ' '); 1.38 +} 1.39 + 1.40 +/** 1.41 + * small helper function to urlencode strings 1.42 + */ 1.43 +jQuery.urlencode = encodeURIComponent; 1.44 + 1.45 +/** 1.46 + * This function returns the parsed url parameters of the 1.47 + * current request. Multiple values per key are supported, 1.48 + * it will always return arrays of strings for the value parts. 1.49 + */ 1.50 +jQuery.getQueryParameters = function(s) { 1.51 + if (typeof s == 'undefined') 1.52 + s = document.location.search; 1.53 + var parts = s.substr(s.indexOf('?') + 1).split('&'); 1.54 + var result = {}; 1.55 + for (var i = 0; i < parts.length; i++) { 1.56 + var tmp = parts[i].split('=', 2); 1.57 + var key = jQuery.urldecode(tmp[0]); 1.58 + var value = jQuery.urldecode(tmp[1]); 1.59 + if (key in result) 1.60 + result[key].push(value); 1.61 + else 1.62 + result[key] = [value]; 1.63 + } 1.64 + return result; 1.65 +}; 1.66 + 1.67 +/** 1.68 + * small function to check if an array contains 1.69 + * a given item. 1.70 + */ 1.71 +jQuery.contains = function(arr, item) { 1.72 + for (var i = 0; i < arr.length; i++) { 1.73 + if (arr[i] == item) 1.74 + return true; 1.75 + } 1.76 + return false; 1.77 +}; 1.78 + 1.79 +/** 1.80 + * highlight a given string on a jquery object by wrapping it in 1.81 + * span elements with the given class name. 1.82 + */ 1.83 +jQuery.fn.highlightText = function(text, className) { 1.84 + function highlight(node) { 1.85 + if (node.nodeType == 3) { 1.86 + var val = node.nodeValue; 1.87 + var pos = val.toLowerCase().indexOf(text); 1.88 + if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { 1.89 + var span = document.createElement("span"); 1.90 + span.className = className; 1.91 + span.appendChild(document.createTextNode(val.substr(pos, text.length))); 1.92 + node.parentNode.insertBefore(span, node.parentNode.insertBefore( 1.93 + document.createTextNode(val.substr(pos + text.length)), 1.94 + node.nextSibling)); 1.95 + node.nodeValue = val.substr(0, pos); 1.96 + } 1.97 + } 1.98 + else if (!jQuery(node).is("button, select, textarea")) { 1.99 + jQuery.each(node.childNodes, function() { 1.100 + highlight(this); 1.101 + }); 1.102 + } 1.103 + } 1.104 + return this.each(function() { 1.105 + highlight(this); 1.106 + }); 1.107 +}; 1.108 + 1.109 +/** 1.110 + * Small JavaScript module for the documentation. 1.111 + */ 1.112 +var Documentation = { 1.113 + 1.114 + init : function() { 1.115 + this.fixFirefoxAnchorBug(); 1.116 + this.highlightSearchWords(); 1.117 + this.initIndexTable(); 1.118 + }, 1.119 + 1.120 + /** 1.121 + * i18n support 1.122 + */ 1.123 + TRANSLATIONS : {}, 1.124 + PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, 1.125 + LOCALE : 'unknown', 1.126 + 1.127 + // gettext and ngettext don't access this so that the functions 1.128 + // can safely bound to a different name (_ = Documentation.gettext) 1.129 + gettext : function(string) { 1.130 + var translated = Documentation.TRANSLATIONS[string]; 1.131 + if (typeof translated == 'undefined') 1.132 + return string; 1.133 + return (typeof translated == 'string') ? translated : translated[0]; 1.134 + }, 1.135 + 1.136 + ngettext : function(singular, plural, n) { 1.137 + var translated = Documentation.TRANSLATIONS[singular]; 1.138 + if (typeof translated == 'undefined') 1.139 + return (n == 1) ? singular : plural; 1.140 + return translated[Documentation.PLURALEXPR(n)]; 1.141 + }, 1.142 + 1.143 + addTranslations : function(catalog) { 1.144 + for (var key in catalog.messages) 1.145 + this.TRANSLATIONS[key] = catalog.messages[key]; 1.146 + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); 1.147 + this.LOCALE = catalog.locale; 1.148 + }, 1.149 + 1.150 + /** 1.151 + * add context elements like header anchor links 1.152 + */ 1.153 + addContextElements : function() { 1.154 + $('div[id] > :header:first').each(function() { 1.155 + $('<a class="headerlink">\u00B6</a>'). 1.156 + attr('href', '#' + this.id). 1.157 + attr('title', _('Permalink to this headline')). 1.158 + appendTo(this); 1.159 + }); 1.160 + $('dt[id]').each(function() { 1.161 + $('<a class="headerlink">\u00B6</a>'). 1.162 + attr('href', '#' + this.id). 1.163 + attr('title', _('Permalink to this definition')). 1.164 + appendTo(this); 1.165 + }); 1.166 + }, 1.167 + 1.168 + /** 1.169 + * workaround a firefox stupidity 1.170 + */ 1.171 + fixFirefoxAnchorBug : function() { 1.172 + if (document.location.hash && $.browser.mozilla) 1.173 + window.setTimeout(function() { 1.174 + document.location.href += ''; 1.175 + }, 10); 1.176 + }, 1.177 + 1.178 + /** 1.179 + * highlight the search words provided in the url in the text 1.180 + */ 1.181 + highlightSearchWords : function() { 1.182 + var params = $.getQueryParameters(); 1.183 + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; 1.184 + if (terms.length) { 1.185 + var body = $('div.body'); 1.186 + window.setTimeout(function() { 1.187 + $.each(terms, function() { 1.188 + body.highlightText(this.toLowerCase(), 'highlighted'); 1.189 + }); 1.190 + }, 10); 1.191 + $('<p class="highlight-link"><a href="javascript:Documentation.' + 1.192 + 'hideSearchWords()">' + _('Hide Search Matches') + '</a></p>') 1.193 + .appendTo($('#searchbox')); 1.194 + } 1.195 + }, 1.196 + 1.197 + /** 1.198 + * init the domain index toggle buttons 1.199 + */ 1.200 + initIndexTable : function() { 1.201 + var togglers = $('img.toggler').click(function() { 1.202 + var src = $(this).attr('src'); 1.203 + var idnum = $(this).attr('id').substr(7); 1.204 + $('tr.cg-' + idnum).toggle(); 1.205 + if (src.substr(-9) == 'minus.png') 1.206 + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); 1.207 + else 1.208 + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); 1.209 + }).css('display', ''); 1.210 + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { 1.211 + togglers.click(); 1.212 + } 1.213 + }, 1.214 + 1.215 + /** 1.216 + * helper function to hide the search marks again 1.217 + */ 1.218 + hideSearchWords : function() { 1.219 + $('#searchbox .highlight-link').fadeOut(300); 1.220 + $('span.highlighted').removeClass('highlighted'); 1.221 + }, 1.222 + 1.223 + /** 1.224 + * make the url absolute 1.225 + */ 1.226 + makeURL : function(relativeURL) { 1.227 + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; 1.228 + }, 1.229 + 1.230 + /** 1.231 + * get the current relative url 1.232 + */ 1.233 + getCurrentURL : function() { 1.234 + var path = document.location.pathname; 1.235 + var parts = path.split(/\//); 1.236 + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { 1.237 + if (this == '..') 1.238 + parts.pop(); 1.239 + }); 1.240 + var url = parts.join('/'); 1.241 + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); 1.242 + } 1.243 +}; 1.244 + 1.245 +// quick alias for translations 1.246 +_ = Documentation.gettext; 1.247 + 1.248 +$(document).ready(function() { 1.249 + Documentation.init(); 1.250 +});