Merge "Whitelist the <wbr> element."
[mediawiki.git] / maintenance / jsduck / eg-iframe.html
blob86eae4b61630f63868e63f13e7804450edf73bad
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>MediaWiki Code Example</title>
6 <script src="modules/startup.js"></script>
7 <script>
8 function startUp() {
9 mw.config = new mw.Map();
11 </script>
12 <script src="modules/jquery/jquery.js"></script>
13 <script src="modules/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;
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';
36 .mw-jsduck-log-line {
37 padding: 0.2em 0.5em;
38 white-space: pre-wrap;
41 .mw-jsduck-log-line:nth-child(odd) {
42 background: #fff;
44 </style>
45 </head>
46 <body>
47 <script>
48 /**
49 * Basic log console for the example iframe in documentation pages.
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 );
60 str = [];
61 for ( i = 0, len = arguments.length; i < len; i++ ) {
62 str.push( String( arguments[ i ] ) );
64 line = document.createElement( 'div' );
65 line.className = 'mw-jsduck-log-line';
66 line.appendChild(
67 document.createTextNode( str.join( ' , ' ) + '\n' )
69 pre.appendChild( line );
71 }() );
73 /**
74 * Method called by jsduck to execute the example code.
76 function loadInlineExample( code, options, callback ) {
77 try {
78 eval( code );
79 callback && callback( true );
80 } catch (e) {
81 mw.log( 'Uncaught exception: ' + e );
82 callback && callback( false, e );
83 throw e;
86 </script>
87 </body>
88 </html>