blob: 7dc4afa87af68dd5ad4738667980b3f1e9ce8873 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>MediaWiki Code Example</title>
<script src="modules/startup.js"></script>
<script>
function startUp() {
mw.config = new mw.Map();
}
</script>
<script src="modules/jquery/jquery.js"></script>
<script src="modules/mediawiki/mediawiki.js"></script>
<style>
.mw-jsduck-log {
position: relative;
min-height: 3em;
margin-top: 2em;
background: #f7f7f7;
border: 1px solid #e4e4e4;
}
.mw-jsduck-log::after {
position: absolute;
bottom: 100%;
right: -1px;
padding: 0.5em;
background: #fff;
border: 1px solid #e4e4e4;
border-bottom: 0;
border-radius: 0.5em 0.5em 0 0;
font: normal 0.5em sans-serif;
content: 'console';
}
.mw-jsduck-log-line {
padding: 0.2em 0.5em;
white-space: pre-wrap;
}
.mw-jsduck-log-line:nth-child(odd) {
background: #fff;
}
</style>
</head>
<body>
<script>
/**
* Basic log console for the example iframe in documentation pages.
*/
( function () {
var pre;
mw.log = function () {
var str, i, len, line;
if ( !pre ) {
pre = document.createElement( 'pre' );
pre.className = 'mw-jsduck-log';
document.body.appendChild( pre );
}
str = [];
for ( i = 0, len = arguments.length; i < len; i++ ) {
str.push( String( arguments[ i ] ) );
}
line = document.createElement( 'div' );
line.className = 'mw-jsduck-log-line';
line.appendChild(
document.createTextNode( str.join( ' , ' ) + '\n' )
);
pre.appendChild( line );
};
}() );
/**
* Method called by jsduck to execute the example code.
*/
function loadInlineExample( code, options, callback ) {
try {
eval( code );
callback && callback( true );
} catch ( e ) {
mw.log( 'Uncaught exception: ' + e );
callback && callback( false, e );
throw e;
}
}
</script>
</body>
</html>
|