| 1 |
( function () { |
| 2 |
const newPageIssueLink = require( './PageIssueLink.js' ); |
| 3 |
const newPageIssueLearnMoreLink = require( './PageIssueLearnMoreLink.js' ); |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
function insertPageIssueBanner( issue, msg, overlayUrl, overlayManager, multiple ) { |
| 16 |
const $learnMoreEl = newPageIssueLearnMoreLink( msg ); |
| 17 |
const $issueContainer = multiple ? |
| 18 |
issue.$el.parents( '.mbox-text-span, .mbox-text-div' ) : |
| 19 |
issue.$el.find( '.mbox-text' ); |
| 20 |
const $clickContainer = multiple ? issue.$el.parents( '.mbox-text' ) : issue.$el; |
| 21 |
|
| 22 |
$issueContainer.prepend( issue.issue.iconElement ); |
| 23 |
$issueContainer.prepend( $learnMoreEl ); |
| 24 |
|
| 25 |
$clickContainer.on( 'click', () => { |
| 26 |
overlayManager.router.navigate( overlayUrl ); |
| 27 |
return false; |
| 28 |
} ); |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
function insertPageIssueNotice( labelText, section ) { |
| 40 |
const $link = newPageIssueLink( labelText ); |
| 41 |
$link.attr( 'href', '#/issues/' + section ); |
| 42 |
|
| 43 |
$link.insertAfter( $( 'h1.mw-first-heading' ) ); |
| 44 |
} |
| 45 |
|
| 46 |
module.exports = { |
| 47 |
insertPageIssueBanner, |
| 48 |
insertPageIssueNotice |
| 49 |
}; |
| 50 |
}() ); |