X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.widgets%2Fmw.widgets.DateInputWidget.js;h=7f5e608f91179c44a3eb77ddb66ebf1cd9de6a93;hb=00c8d18575b353a826b64c351ece9e381c51f663;hp=ed251f24ee992594e921f865854d0a1d8f4cea9e;hpb=cea10c66754f63d4fdc0b48a1ac04e60e7d80b39;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js b/resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js index ed251f24ee..7f5e608f91 100644 --- a/resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js +++ b/resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.js @@ -4,7 +4,7 @@ * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ -/*global moment */ +/* global moment */ ( function ( $, mw ) { /** @@ -87,6 +87,8 @@ * calendar uses relative positioning. */ mw.widgets.DateInputWidget = function MWWDateInputWidget( config ) { + var placeholderDateFormat, mustBeAfter, mustBeBefore; + // Config initialization config = $.extend( { precision: 'day', @@ -99,7 +101,6 @@ } } - var placeholderDateFormat, mustBeAfter, mustBeBefore; if ( config.placeholderDateFormat ) { placeholderDateFormat = config.placeholderDateFormat; } else if ( config.inputFormat ) { @@ -412,6 +413,8 @@ * @return {string} Format string */ mw.widgets.DateInputWidget.prototype.getDisplayFormat = function () { + var localeData, llll, lll, ll, format; + if ( this.displayFormat !== undefined ) { return this.displayFormat; } @@ -430,11 +433,11 @@ // We try to construct it as 'llll - (lll - ll)' and hope for the best. // This seems to work well for many languages (maybe even all?). - var localeData = moment.localeData( moment.locale() ), - llll = localeData.longDateFormat( 'llll' ), - lll = localeData.longDateFormat( 'lll' ), - ll = localeData.longDateFormat( 'll' ), - format = llll.replace( lll.replace( ll, '' ), '' ); + localeData = moment.localeData( moment.locale() ); + llll = localeData.longDateFormat( 'llll' ); + lll = localeData.longDateFormat( 'lll' ); + ll = localeData.longDateFormat( 'll' ); + format = llll.replace( lll.replace( ll, '' ), '' ); return format; } @@ -485,6 +488,7 @@ * * @private * @param {jQuery.Event} e Mouse click event + * @return {boolean} False to cancel the default event */ mw.widgets.DateInputWidget.prototype.onClick = function ( e ) { if ( !this.isDisabled() && e.which === 1 ) { @@ -498,6 +502,7 @@ * * @private * @param {jQuery.Event} e Key press event + * @return {boolean} False to cancel the default event */ mw.widgets.DateInputWidget.prototype.onKeyPress = function ( e ) { if ( !this.isDisabled() && @@ -513,6 +518,7 @@ * * @private * @param {jQuery.Event} e Key press event + * @return {boolean} False to cancel the default event */ mw.widgets.DateInputWidget.prototype.onCalendarKeyPress = function ( e ) { if ( !this.isDisabled() && e.which === OO.ui.Keys.ENTER ) { @@ -527,6 +533,7 @@ * * @private * @param {jQuery.Event} e Mouse click event + * @return {boolean} False to cancel the default event */ mw.widgets.DateInputWidget.prototype.onCalendarClick = function ( e ) { if (