| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
( function () { |
| 5 |
mw.hook( 'wikipage.content' ).add( function ( $content ) { |
| 6 |
$content.find( |
| 7 |
'figure[class*="mw-ext-imagemap-desc-"] > :not(figcaption) .mw-file-element' |
| 8 |
).each( function () { |
| 9 |
var resource = this.getAttribute( 'resource' ); |
| 10 |
if ( !resource ) { |
| 11 |
return; |
| 12 |
} |
| 13 |
var inner = this.parentNode; |
| 14 |
inner.classList.add( 'mw-ext-imagemap-inner' ); |
| 15 |
var desc = this.ownerDocument.createElement( 'a' ); |
| 16 |
desc.setAttribute( 'href', resource ); |
| 17 |
desc.classList.add( 'mw-ext-imagemap-desc-link' ); |
| 18 |
inner.appendChild( desc ); |
| 19 |
} ); |
| 20 |
} ); |
| 21 |
}() ); |