|
1 | | -if ( !String.prototype.startsWith ) { |
2 | | - String.prototype.startsWith = function( searchString, position ) { |
3 | | - position = position || 0; |
4 | | - return this.slice( position, position + searchString.length ) === searchString; |
5 | | - }; |
6 | | -} |
7 | | - |
8 | | -if ( !String.prototype.endsWith ) { |
9 | | - String.prototype.endsWith = function( searchString, position ) { |
10 | | - const subjectString = this.toString(); |
11 | | - if ( typeof position !== 'number' || !isFinite( position ) || Math.floor( position ) !== position || position > subjectString.length ) { |
12 | | - position = subjectString.length; |
13 | | - } |
14 | | - position -= searchString.length; |
15 | | - const lastIndex = subjectString.indexOf( searchString, position ); |
16 | | - return lastIndex !== -1 && lastIndex === position; |
17 | | - }; |
18 | | -} |
19 | | - |
20 | | -if ( !String.prototype.includes ) { |
21 | | - String.prototype.includes = function( search, start ) { |
22 | | - 'use strict'; |
23 | | - if ( typeof start !== 'number' ) { |
24 | | - start = 0; |
25 | | - } |
26 | | - if ( start + search.length > this.length ) { |
27 | | - return false; |
28 | | - } else { |
29 | | - return this.indexOf( search, start ) !== -1; |
30 | | - } |
31 | | - }; |
32 | | -} |
33 | | - |
34 | 1 | /* |
35 | 2 | * Adapted from https://www.mediawiki.org/wiki/Extension:CodeMirror |
36 | 3 | * License: GPL 2.0 or later |
@@ -328,10 +295,6 @@ if ( !String.prototype.includes ) { |
328 | 295 | lineWrapping: linewrapping, |
329 | 296 | styleActiveLine: true |
330 | 297 | } ); |
331 | | - // Our best friend, IE, needs some special css |
332 | | - if ( window.navigator.userAgent.indexOf( 'Trident/' ) > -1 ) { |
333 | | - $( '.CodeMirror' ).addClass( 'CodeMirrorIE' ); |
334 | | - } |
335 | 298 | if ( linewrapping ) { |
336 | 299 | $( '.CodeMirror' ).addClass( 'lineWrapping' ); |
337 | 300 | } |
@@ -380,6 +343,10 @@ if ( !String.prototype.includes ) { |
380 | 343 |
|
381 | 344 | if ( pagename.startsWith( 'module=' ) ) { |
382 | 345 | pagename = pagename.slice( 7 ); |
| 346 | + } else if ( pagename.startsWith( 'widget=' ) ) { |
| 347 | + // Support invokes of style |
| 348 | + // {{#invoke:Lua|invoke|module=Widget/Factory|fn=fromTemplate|widget=pagename}} |
| 349 | + pagename = pagename.replace( 'widget=', 'Widget/' ); |
383 | 350 | } else if ( !parserfunction.hasClass( 'cm-mw-parserfunction-name' ) || |
384 | 351 | parserfunction.text() !== '#invoke' ) { |
385 | 352 | return; |
|
0 commit comments