| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
function InsertLinkTitleOptionWidget( config ) { |
| 14 |
this.external = config.external || false; |
| 15 |
if ( this.external ) { |
| 16 |
config.icon = 'linkExternal'; |
| 17 |
config.description = mw.msg( 'wikieditor-toolbar-tool-link-int-target-status-external' ); |
| 18 |
|
| 19 |
config.url = config.data.slice( 0, 1 ).toLowerCase() + config.data.slice( 1 ); |
| 20 |
config.data = config.url; |
| 21 |
|
| 22 |
|
| 23 |
if ( !/^[a-z]+:\/\/./.test( config.url ) ) { |
| 24 |
config.url = 'http://' + config.url; |
| 25 |
} |
| 26 |
config.missing = false; |
| 27 |
} |
| 28 |
this.disambiguation = config.disambiguation || false; |
| 29 |
this.missing = config.missing || false; |
| 30 |
InsertLinkTitleOptionWidget.super.call( this, config ); |
| 31 |
} |
| 32 |
|
| 33 |
OO.inheritClass( InsertLinkTitleOptionWidget, mw.widgets.TitleOptionWidget ); |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
InsertLinkTitleOptionWidget.prototype.isExternal = function () { |
| 39 |
return this.external; |
| 40 |
}; |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
InsertLinkTitleOptionWidget.prototype.isMissing = function () { |
| 46 |
return this.missing; |
| 47 |
}; |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
InsertLinkTitleOptionWidget.prototype.isDisambiguation = function () { |
| 53 |
return this.disambiguation; |
| 54 |
}; |
| 55 |
|
| 56 |
module.exports = InsertLinkTitleOptionWidget; |