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