| Download
Reference manual of the SageMath package kerrgeodesic_gw
Project: Sagittarius
Views: 7654License: GPL3
Image: ubuntu2004
/*1* doctools.js2* ~~~~~~~~~~~3*4* Sphinx JavaScript utilities for all documentation.5*6* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.7* :license: BSD, see LICENSE for details.8*9*/1011/**12* select a different prefix for underscore13*/14$u = _.noConflict();1516/**17* make the code below compatible with browsers without18* an installed firebug like debugger19if (!window.console || !console.firebug) {20var names = ["log", "debug", "info", "warn", "error", "assert", "dir",21"dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",22"profile", "profileEnd"];23window.console = {};24for (var i = 0; i < names.length; ++i)25window.console[names[i]] = function() {};26}27*/2829/**30* small helper function to urldecode strings31*32* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL33*/34jQuery.urldecode = function(x) {35if (!x) {36return x37}38return decodeURIComponent(x.replace(/\+/g, ' '));39};4041/**42* small helper function to urlencode strings43*/44jQuery.urlencode = encodeURIComponent;4546/**47* This function returns the parsed url parameters of the48* current request. Multiple values per key are supported,49* it will always return arrays of strings for the value parts.50*/51jQuery.getQueryParameters = function(s) {52if (typeof s === 'undefined')53s = document.location.search;54var parts = s.substr(s.indexOf('?') + 1).split('&');55var result = {};56for (var i = 0; i < parts.length; i++) {57var tmp = parts[i].split('=', 2);58var key = jQuery.urldecode(tmp[0]);59var value = jQuery.urldecode(tmp[1]);60if (key in result)61result[key].push(value);62else63result[key] = [value];64}65return result;66};6768/**69* highlight a given string on a jquery object by wrapping it in70* span elements with the given class name.71*/72jQuery.fn.highlightText = function(text, className) {73function highlight(node, addItems) {74if (node.nodeType === 3) {75var val = node.nodeValue;76var pos = val.toLowerCase().indexOf(text);77if (pos >= 0 &&78!jQuery(node.parentNode).hasClass(className) &&79!jQuery(node.parentNode).hasClass("nohighlight")) {80var span;81var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");82if (isInSVG) {83span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");84} else {85span = document.createElement("span");86span.className = className;87}88span.appendChild(document.createTextNode(val.substr(pos, text.length)));89node.parentNode.insertBefore(span, node.parentNode.insertBefore(90document.createTextNode(val.substr(pos + text.length)),91node.nextSibling));92node.nodeValue = val.substr(0, pos);93if (isInSVG) {94var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");95var bbox = node.parentElement.getBBox();96rect.x.baseVal.value = bbox.x;97rect.y.baseVal.value = bbox.y;98rect.width.baseVal.value = bbox.width;99rect.height.baseVal.value = bbox.height;100rect.setAttribute('class', className);101addItems.push({102"parent": node.parentNode,103"target": rect});104}105}106}107else if (!jQuery(node).is("button, select, textarea")) {108jQuery.each(node.childNodes, function() {109highlight(this, addItems);110});111}112}113var addItems = [];114var result = this.each(function() {115highlight(this, addItems);116});117for (var i = 0; i < addItems.length; ++i) {118jQuery(addItems[i].parent).before(addItems[i].target);119}120return result;121};122123/*124* backward compatibility for jQuery.browser125* This will be supported until firefox bug is fixed.126*/127if (!jQuery.browser) {128jQuery.uaMatch = function(ua) {129ua = ua.toLowerCase();130131var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||132/(webkit)[ \/]([\w.]+)/.exec(ua) ||133/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||134/(msie) ([\w.]+)/.exec(ua) ||135ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||136[];137138return {139browser: match[ 1 ] || "",140version: match[ 2 ] || "0"141};142};143jQuery.browser = {};144jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;145}146147/**148* Small JavaScript module for the documentation.149*/150var Documentation = {151152init : function() {153this.fixFirefoxAnchorBug();154this.highlightSearchWords();155this.initIndexTable();156if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) {157this.initOnKeyListeners();158}159},160161/**162* i18n support163*/164TRANSLATIONS : {},165PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; },166LOCALE : 'unknown',167168// gettext and ngettext don't access this so that the functions169// can safely bound to a different name (_ = Documentation.gettext)170gettext : function(string) {171var translated = Documentation.TRANSLATIONS[string];172if (typeof translated === 'undefined')173return string;174return (typeof translated === 'string') ? translated : translated[0];175},176177ngettext : function(singular, plural, n) {178var translated = Documentation.TRANSLATIONS[singular];179if (typeof translated === 'undefined')180return (n == 1) ? singular : plural;181return translated[Documentation.PLURALEXPR(n)];182},183184addTranslations : function(catalog) {185for (var key in catalog.messages)186this.TRANSLATIONS[key] = catalog.messages[key];187this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');188this.LOCALE = catalog.locale;189},190191/**192* add context elements like header anchor links193*/194addContextElements : function() {195$('div[id] > :header:first').each(function() {196$('<a class="headerlink">\u00B6</a>').197attr('href', '#' + this.id).198attr('title', _('Permalink to this headline')).199appendTo(this);200});201$('dt[id]').each(function() {202$('<a class="headerlink">\u00B6</a>').203attr('href', '#' + this.id).204attr('title', _('Permalink to this definition')).205appendTo(this);206});207},208209/**210* workaround a firefox stupidity211* see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075212*/213fixFirefoxAnchorBug : function() {214if (document.location.hash && $.browser.mozilla)215window.setTimeout(function() {216document.location.href += '';217}, 10);218},219220/**221* highlight the search words provided in the url in the text222*/223highlightSearchWords : function() {224var params = $.getQueryParameters();225var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];226if (terms.length) {227var body = $('div.body');228if (!body.length) {229body = $('body');230}231window.setTimeout(function() {232$.each(terms, function() {233body.highlightText(this.toLowerCase(), 'highlighted');234});235}, 10);236$('<p class="highlight-link"><a href="javascript:Documentation.' +237'hideSearchWords()">' + _('Hide Search Matches') + '</a></p>')238.appendTo($('#searchbox'));239}240},241242/**243* init the domain index toggle buttons244*/245initIndexTable : function() {246var togglers = $('img.toggler').click(function() {247var src = $(this).attr('src');248var idnum = $(this).attr('id').substr(7);249$('tr.cg-' + idnum).toggle();250if (src.substr(-9) === 'minus.png')251$(this).attr('src', src.substr(0, src.length-9) + 'plus.png');252else253$(this).attr('src', src.substr(0, src.length-8) + 'minus.png');254}).css('display', '');255if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {256togglers.click();257}258},259260/**261* helper function to hide the search marks again262*/263hideSearchWords : function() {264$('#searchbox .highlight-link').fadeOut(300);265$('span.highlighted').removeClass('highlighted');266},267268/**269* make the url absolute270*/271makeURL : function(relativeURL) {272return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;273},274275/**276* get the current relative url277*/278getCurrentURL : function() {279var path = document.location.pathname;280var parts = path.split(/\//);281$.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {282if (this === '..')283parts.pop();284});285var url = parts.join('/');286return path.substring(url.lastIndexOf('/') + 1, path.length - 1);287},288289initOnKeyListeners: function() {290$(document).keydown(function(event) {291var activeElementType = document.activeElement.tagName;292// don't navigate when in search box, textarea, dropdown or button293if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT'294&& activeElementType !== 'BUTTON' && !event.altKey && !event.ctrlKey && !event.metaKey295&& !event.shiftKey) {296switch (event.keyCode) {297case 37: // left298var prevHref = $('link[rel="prev"]').prop('href');299if (prevHref) {300window.location.href = prevHref;301return false;302}303case 39: // right304var nextHref = $('link[rel="next"]').prop('href');305if (nextHref) {306window.location.href = nextHref;307return false;308}309}310}311});312}313};314315// quick alias for translations316_ = Documentation.gettext;317318$(document).ready(function() {319Documentation.init();320});321322323