Merge "Remove $wgSessionsInMemcached"
[lhc/web/wiklou.git] / resources / src / mediawiki.widgets / mw.widgets.DateInputWidget.js
index ed251f2..7f5e608 100644 (file)
@@ -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',
                        }
                }
 
-               var placeholderDateFormat, mustBeAfter, mustBeBefore;
                if ( config.placeholderDateFormat ) {
                        placeholderDateFormat = config.placeholderDateFormat;
                } else if ( config.inputFormat ) {
         * @return {string} Format string
         */
        mw.widgets.DateInputWidget.prototype.getDisplayFormat = function () {
+               var localeData, llll, lll, ll, format;
+
                if ( this.displayFormat !== undefined ) {
                        return this.displayFormat;
                }
                        // 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;
                }
         *
         * @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 ) {
         *
         * @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() &&
         *
         * @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 ) {
         *
         * @private
         * @param {jQuery.Event} e Mouse click event
+        * @return {boolean} False to cancel the default event
         */
        mw.widgets.DateInputWidget.prototype.onCalendarClick = function ( e ) {
                if (