Skip to content

Commit 41e471e

Browse files
committed
Update document title
1 parent d00e814 commit 41e471e

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

etc/typedoc/theme/assets/js/theme.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@
2727
* @returns {string} cleaned text
2828
*/
2929
function cleanPath( txt ) {
30+
var ch;
3031
var j;
31-
if (
32-
txt.charCodeAt( 0 ) === 34 && // "
33-
txt.charCodeAt( txt.length-1 ) === 34 // "
34-
) {
35-
txt = txt.slice( 1, txt.length-1 );
32+
if ( txt.charCodeAt( 0 ) === 34 ) {
33+
j = 1;
34+
for ( j = 1; j < txt.length; j++ ) {
35+
ch = txt.charCodeAt( j );
36+
if ( ch === 34 ) {
37+
txt = txt.slice( 1, j );
38+
break;
39+
}
40+
}
3641
}
3742
j = txt.indexOf( '/docs/types/' );
3843
if ( j >= 0 ) {
@@ -46,6 +51,16 @@
4651
return txt;
4752
}
4853

54+
/**
55+
* Cleans up the document title.
56+
*
57+
* @private
58+
* @param {DOMElement} el - title element
59+
*/
60+
function cleanTitle( el ) {
61+
el.innerHTML = cleanPath( el.innerHTML ) + ' | stdlib';
62+
}
63+
4964
/**
5065
* Cleans up link text.
5166
*
@@ -129,6 +144,9 @@
129144
function main() {
130145
var el;
131146

147+
el = document.querySelector( 'title' );
148+
cleanTitle( el );
149+
132150
el = document.querySelectorAll( '.tsd-kind-external-module a' );
133151
cleanLinks( el );
134152

0 commit comments

Comments
 (0)