2011-03-21 22:01:15 -04:00
|
|
|
/**
|
|
|
|
* Makes HTML documentation interactive
|
2015-07-06 23:42:51 -04:00
|
|
|
*
|
|
|
|
* @licstart The following is the entire license notice for the JavaScript
|
|
|
|
* code in this page.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Free Software Foundation, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* @licend The above is the entire license notice for the JavaScript code
|
|
|
|
* in this page.
|
2011-03-21 22:01:15 -04:00
|
|
|
*/
|
|
|
|
|
2015-08-23 00:36:25 -04:00
|
|
|
var head = document.getElementsByTagName( 'head' )[ 0 ],
|
|
|
|
css = document.createElement( 'link' );
|
2011-03-21 22:01:15 -04:00
|
|
|
|
|
|
|
css.type = 'text/css';
|
|
|
|
css.rel = 'stylesheet';
|
|
|
|
|
2015-08-23 00:36:25 -04:00
|
|
|
// quick-n-dirty sub and super script impl (it is by no means
|
|
|
|
// perfect)
|
|
|
|
var vars = document.getElementsByTagName( 'var' ),
|
|
|
|
chk = /\\/;
|
2011-03-21 21:09:36 -04:00
|
|
|
|
2015-08-23 00:36:25 -04:00
|
|
|
for ( var i in vars )
|
2011-06-05 11:18:41 -04:00
|
|
|
{
|
2015-08-23 00:36:25 -04:00
|
|
|
var v = vars[ i ];
|
2011-06-05 11:18:41 -04:00
|
|
|
|
2015-08-23 00:36:25 -04:00
|
|
|
if ( !chk.test( v.innerHTML ) )
|
|
|
|
{
|
|
|
|
continue;
|
2011-06-05 11:18:41 -04:00
|
|
|
}
|
|
|
|
|
2015-08-23 00:36:25 -04:00
|
|
|
v.innerHTML = v.innerHTML
|
|
|
|
.replace( /(\\.*)$/, '<div>$1</div>' )
|
|
|
|
.replace( /\\_([^ \\]+)/, '<sub>$1</sub>' )
|
|
|
|
.replace( /\\\^([^ \\]+)/, '<sup>$1</sup>' )
|
|
|
|
.replace( /(<\/su[bp]><su[bp])>/, '$1 class="left">' );
|
2011-06-05 11:18:41 -04:00
|
|
|
}
|
|
|
|
|
2015-08-23 00:36:25 -04:00
|
|
|
var hlnodes = document.querySelectorAll(
|
|
|
|
'.verbatim, .samp, .code, .example'
|
|
|
|
);
|
2011-06-05 11:18:41 -04:00
|
|
|
|
2015-08-23 00:36:25 -04:00
|
|
|
// highlight code blocks
|
|
|
|
for ( var i in hlnodes )
|
|
|
|
{
|
|
|
|
hljs.highlightBlock( hlnodes[ i ], ' ' );
|
|
|
|
}
|