Mercurial > pygame
annotate docs/_static/doctools.js @ 3172:d1b367fc08bc tests-returncode
Use a return code of 1 when the tests fail.
| author | Thomas Kluyver <takowl@gmail.com> |
|---|---|
| date | Wed, 09 Jan 2013 10:13:57 +0000 |
| parents | 8d9ce368f8d3 |
| children |
| rev | line source |
|---|---|
| 2225 | 1 /* |
| 2 * doctools.js | |
| 3 * ~~~~~~~~~~~ | |
| 4 * | |
| 5 * Sphinx JavaScript utilties for all documentation. | |
| 6 * | |
|
3092
8d9ce368f8d3
Rebuild docs with Sphinx 1.0.2 and Docutils 0.7
Lenard Lindstrom <len-l@telus.net>
parents:
2225
diff
changeset
|
7 * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. |
| 2225 | 8 * :license: BSD, see LICENSE for details. |
| 9 * | |
| 10 */ | |
| 11 | |
| 12 /** | |
| 13 * select a different prefix for underscore | |
| 14 */ | |
| 15 $u = _.noConflict(); | |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
16 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
17 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
18 * make the code below compatible with browsers without |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
19 * an installed firebug like debugger |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
20 if (!window.console || !console.firebug) { |
| 2225 | 21 var names = ["log", "debug", "info", "warn", "error", "assert", "dir", |
| 22 "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", | |
| 23 "profile", "profileEnd"]; | |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
24 window.console = {}; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
25 for (var i = 0; i < names.length; ++i) |
| 2225 | 26 window.console[names[i]] = function() {}; |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
27 } |
| 2225 | 28 */ |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
29 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
30 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
31 * small helper function to urldecode strings |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
32 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
33 jQuery.urldecode = function(x) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
34 return decodeURIComponent(x).replace(/\+/g, ' '); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
35 } |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
36 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
37 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
38 * small helper function to urlencode strings |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
39 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
40 jQuery.urlencode = encodeURIComponent; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
41 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
42 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
43 * This function returns the parsed url parameters of the |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
44 * current request. Multiple values per key are supported, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
45 * it will always return arrays of strings for the value parts. |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
46 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
47 jQuery.getQueryParameters = function(s) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
48 if (typeof s == 'undefined') |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
49 s = document.location.search; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
50 var parts = s.substr(s.indexOf('?') + 1).split('&'); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
51 var result = {}; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
52 for (var i = 0; i < parts.length; i++) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
53 var tmp = parts[i].split('=', 2); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
54 var key = jQuery.urldecode(tmp[0]); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
55 var value = jQuery.urldecode(tmp[1]); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
56 if (key in result) |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
57 result[key].push(value); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
58 else |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
59 result[key] = [value]; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
60 } |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
61 return result; |
| 2225 | 62 }; |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
63 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
64 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
65 * small function to check if an array contains |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
66 * a given item. |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
67 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
68 jQuery.contains = function(arr, item) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
69 for (var i = 0; i < arr.length; i++) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
70 if (arr[i] == item) |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
71 return true; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
72 } |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
73 return false; |
| 2225 | 74 }; |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
75 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
76 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
77 * highlight a given string on a jquery object by wrapping it in |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
78 * span elements with the given class name. |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
79 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
80 jQuery.fn.highlightText = function(text, className) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
81 function highlight(node) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
82 if (node.nodeType == 3) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
83 var val = node.nodeValue; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
84 var pos = val.toLowerCase().indexOf(text); |
| 2225 | 85 if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
86 var span = document.createElement("span"); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
87 span.className = className; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
88 span.appendChild(document.createTextNode(val.substr(pos, text.length))); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
89 node.parentNode.insertBefore(span, node.parentNode.insertBefore( |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
90 document.createTextNode(val.substr(pos + text.length)), |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
91 node.nextSibling)); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
92 node.nodeValue = val.substr(0, pos); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
93 } |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
94 } |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
95 else if (!jQuery(node).is("button, select, textarea")) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
96 jQuery.each(node.childNodes, function() { |
| 2225 | 97 highlight(this); |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
98 }); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
99 } |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
100 } |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
101 return this.each(function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
102 highlight(this); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
103 }); |
| 2225 | 104 }; |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
105 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
106 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
107 * Small JavaScript module for the documentation. |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
108 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
109 var Documentation = { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
110 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
111 init : function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
112 this.fixFirefoxAnchorBug(); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
113 this.highlightSearchWords(); |
| 2225 | 114 this.initIndexTable(); |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
115 }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
116 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
117 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
118 * i18n support |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
119 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
120 TRANSLATIONS : {}, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
121 PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
122 LOCALE : 'unknown', |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
123 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
124 // gettext and ngettext don't access this so that the functions |
| 2225 | 125 // can safely bound to a different name (_ = Documentation.gettext) |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
126 gettext : function(string) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
127 var translated = Documentation.TRANSLATIONS[string]; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
128 if (typeof translated == 'undefined') |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
129 return string; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
130 return (typeof translated == 'string') ? translated : translated[0]; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
131 }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
132 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
133 ngettext : function(singular, plural, n) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
134 var translated = Documentation.TRANSLATIONS[singular]; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
135 if (typeof translated == 'undefined') |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
136 return (n == 1) ? singular : plural; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
137 return translated[Documentation.PLURALEXPR(n)]; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
138 }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
139 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
140 addTranslations : function(catalog) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
141 for (var key in catalog.messages) |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
142 this.TRANSLATIONS[key] = catalog.messages[key]; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
143 this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
144 this.LOCALE = catalog.locale; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
145 }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
146 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
147 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
148 * add context elements like header anchor links |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
149 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
150 addContextElements : function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
151 $('div[id] > :header:first').each(function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
152 $('<a class="headerlink">\u00B6</a>'). |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
153 attr('href', '#' + this.id). |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
154 attr('title', _('Permalink to this headline')). |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
155 appendTo(this); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
156 }); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
157 $('dt[id]').each(function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
158 $('<a class="headerlink">\u00B6</a>'). |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
159 attr('href', '#' + this.id). |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
160 attr('title', _('Permalink to this definition')). |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
161 appendTo(this); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
162 }); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
163 }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
164 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
165 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
166 * workaround a firefox stupidity |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
167 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
168 fixFirefoxAnchorBug : function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
169 if (document.location.hash && $.browser.mozilla) |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
170 window.setTimeout(function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
171 document.location.href += ''; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
172 }, 10); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
173 }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
174 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
175 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
176 * highlight the search words provided in the url in the text |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
177 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
178 highlightSearchWords : function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
179 var params = $.getQueryParameters(); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
180 var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
181 if (terms.length) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
182 var body = $('div.body'); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
183 window.setTimeout(function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
184 $.each(terms, function() { |
| 2225 | 185 body.highlightText(this.toLowerCase(), 'highlighted'); |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
186 }); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
187 }, 10); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
188 $('<li class="highlight-link"><a href="javascript:Documentation.' + |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
189 'hideSearchWords()">' + _('Hide Search Matches') + '</a></li>') |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
190 .appendTo($('.sidebar .this-page-menu')); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
191 } |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
192 }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
193 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
194 /** |
| 2225 | 195 * init the domain index toggle buttons |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
196 */ |
| 2225 | 197 initIndexTable : function() { |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
198 var togglers = $('img.toggler').click(function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
199 var src = $(this).attr('src'); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
200 var idnum = $(this).attr('id').substr(7); |
| 2225 | 201 $('tr.cg-' + idnum).toggle(); |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
202 if (src.substr(-9) == 'minus.png') |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
203 $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
204 else |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
205 $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
206 }).css('display', ''); |
| 2225 | 207 if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
208 togglers.click(); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
209 } |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
210 }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
211 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
212 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
213 * helper function to hide the search marks again |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
214 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
215 hideSearchWords : function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
216 $('.sidebar .this-page-menu li.highlight-link').fadeOut(300); |
| 2225 | 217 $('span.highlighted').removeClass('highlighted'); |
|
2198
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
218 }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
219 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
220 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
221 * make the url absolute |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
222 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
223 makeURL : function(relativeURL) { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
224 return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
225 }, |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
226 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
227 /** |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
228 * get the current relative url |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
229 */ |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
230 getCurrentURL : function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
231 var path = document.location.pathname; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
232 var parts = path.split(/\//); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
233 $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
234 if (this == '..') |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
235 parts.pop(); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
236 }); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
237 var url = parts.join('/'); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
238 return path.substring(url.lastIndexOf('/') + 1, path.length - 1); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
239 } |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
240 }; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
241 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
242 // quick alias for translations |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
243 _ = Documentation.gettext; |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
244 |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
245 $(document).ready(function() { |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
246 Documentation.init(); |
|
da4302429d3b
replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
247 }); |
