Remove interactive.js jQuery dependency
Importantly, this also removes loading from ajax.googleapis.com, which is a problem, because the domain must be allowed using NoScript, and hosts many other things. Why this was added to begin with is beyond me. Perhaps it demonstrates my novice abilities back in the day.master
parent
62f7e0111a
commit
1fe8a0e8d6
|
@ -24,62 +24,38 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var head = document.getElementsByTagName( 'head' )[ 0 ],
|
var head = document.getElementsByTagName( 'head' )[ 0 ],
|
||||||
sjquery = document.createElement( 'script' ),
|
|
||||||
sjquery_ui = document.createElement( 'script' ),
|
|
||||||
css = document.createElement( 'link' );
|
css = document.createElement( 'link' );
|
||||||
|
|
||||||
sjquery.type = sjquery_ui.type = 'text/javascript';
|
|
||||||
|
|
||||||
css.type = 'text/css';
|
css.type = 'text/css';
|
||||||
css.rel = 'stylesheet';
|
css.rel = 'stylesheet';
|
||||||
|
|
||||||
sjquery.src =
|
|
||||||
'https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js';
|
|
||||||
|
|
||||||
head.appendChild( sjquery );
|
|
||||||
|
|
||||||
// will call callback when jQuery has been loaded
|
|
||||||
function jqueryCheck( callback )
|
|
||||||
{
|
|
||||||
if ( typeof $ === 'undefined' )
|
|
||||||
{
|
|
||||||
// check again in 50ms
|
|
||||||
setTimeout( function()
|
|
||||||
{
|
|
||||||
jqueryCheck( callback );
|
|
||||||
}, 50 );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
|
|
||||||
jqueryCheck( function()
|
|
||||||
{
|
|
||||||
$( document ).ready( function()
|
|
||||||
{
|
|
||||||
// syntax highlighting for code samples
|
|
||||||
$( '.verbatim, .samp, .code, .example' ).each(
|
|
||||||
function( i, element )
|
|
||||||
{
|
|
||||||
hljs.highlightBlock( element, ' ' );
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// quick-n-dirty sub and super script impl (it is by no means
|
// quick-n-dirty sub and super script impl (it is by no means
|
||||||
// perfect)
|
// perfect)
|
||||||
$( 'var:contains("\\")' ).each( function()
|
var vars = document.getElementsByTagName( 'var' ),
|
||||||
{
|
chk = /\\/;
|
||||||
var $this = $( this );
|
|
||||||
|
|
||||||
$this.html(
|
for ( var i in vars )
|
||||||
$this.html().replace( /(\\.*)$/, '<div>$1</div>' )
|
{
|
||||||
|
var v = vars[ i ];
|
||||||
|
|
||||||
|
if ( !chk.test( v.innerHTML ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
v.innerHTML = v.innerHTML
|
||||||
|
.replace( /(\\.*)$/, '<div>$1</div>' )
|
||||||
.replace( /\\_([^ \\]+)/, '<sub>$1</sub>' )
|
.replace( /\\_([^ \\]+)/, '<sub>$1</sub>' )
|
||||||
.replace( /\\\^([^ \\]+)/, '<sup>$1</sup>' )
|
.replace( /\\\^([^ \\]+)/, '<sup>$1</sup>' )
|
||||||
.replace( /(<\/su[bp]><su[bp])>/, '$1 class="left">' )
|
.replace( /(<\/su[bp]><su[bp])>/, '$1 class="left">' );
|
||||||
);
|
}
|
||||||
} );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
|
|
||||||
|
var hlnodes = document.querySelectorAll(
|
||||||
|
'.verbatim, .samp, .code, .example'
|
||||||
|
);
|
||||||
|
|
||||||
|
// highlight code blocks
|
||||||
|
for ( var i in hlnodes )
|
||||||
|
{
|
||||||
|
hljs.highlightBlock( hlnodes[ i ], ' ' );
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue