diff options
Diffstat (limited to 'resources/src/mediawiki.special')
17 files changed, 163 insertions, 113 deletions
diff --git a/resources/src/mediawiki.special/mediawiki.special.block.js b/resources/src/mediawiki.special/mediawiki.special.block.js index 8579e054..aca335ee 100644 --- a/resources/src/mediawiki.special/mediawiki.special.block.js +++ b/resources/src/mediawiki.special/mediawiki.special.block.js @@ -12,7 +12,7 @@ function updateBlockOptions( instant ) { var blocktarget = $.trim( $blockTarget.val() ), isEmpty = blocktarget === '', - isIp = mw.util.isIPv4Address( blocktarget, true ) || mw.util.isIPv6Address( blocktarget, true ), + isIp = mw.util.isIPAddress( blocktarget, true ), isIpRange = isIp && blocktarget.match( /\/\d+$/ ); if ( isIp && !isEmpty ) { diff --git a/resources/src/mediawiki.special/mediawiki.special.changeslist.css b/resources/src/mediawiki.special/mediawiki.special.changeslist.css index c92db167..16fdf38a 100644 --- a/resources/src/mediawiki.special/mediawiki.special.changeslist.css +++ b/resources/src/mediawiki.special/mediawiki.special.changeslist.css @@ -5,3 +5,11 @@ .mw-changeslist-line-watched .mw-title { font-weight: bold; } + +/* + * Titles, including username links, are especially prone for getting jumbled up + * with other titles, usernames, etc. in mixed RTL-LTR environment. + */ +.mw-changeslist .mw-title { + unicode-bidi: embed; +} diff --git a/resources/src/mediawiki.special/mediawiki.special.changeslist.legend.css b/resources/src/mediawiki.special/mediawiki.special.changeslist.legend.css index 6b0bf991..14f6aeee 100644 --- a/resources/src/mediawiki.special/mediawiki.special.changeslist.legend.css +++ b/resources/src/mediawiki.special/mediawiki.special.changeslist.legend.css @@ -20,10 +20,14 @@ .mw-changeslist-legend dt { float: left; - margin-right: 0.5em; + margin: 0 0.5em 0 0; } .mw-changeslist-legend dd { margin-left: 1.5em; +} + +.mw-changeslist-legend dt, +.mw-changeslist-legend dd { line-height: 1.3em; } diff --git a/resources/src/mediawiki.special/mediawiki.special.css b/resources/src/mediawiki.special/mediawiki.special.css index 0356fc74..d2457262 100644 --- a/resources/src/mediawiki.special/mediawiki.special.css +++ b/resources/src/mediawiki.special/mediawiki.special.css @@ -118,3 +118,8 @@ table.mw-userrights-groups * td, table.mw-userrights-groups * th { padding-right: 1.5em; } + +/* Special:Contributions */ +.mw-contributions-form select { + vertical-align: middle; +} diff --git a/resources/src/mediawiki.special/mediawiki.special.edittags.css b/resources/src/mediawiki.special/mediawiki.special.edittags.css new file mode 100644 index 00000000..204009c9 --- /dev/null +++ b/resources/src/mediawiki.special/mediawiki.special.edittags.css @@ -0,0 +1,15 @@ +/*! + * Styling for Special:EditTags and action=editchangetags + */ +#mw-edittags-tags-selector td { + vertical-align: top; +} + +#mw-edittags-tags-selector-multi td { + vertical-align: top; + padding-right: 1.5em; +} + +#mw-edittags-tag-list { + min-width: 20em; +} diff --git a/resources/src/mediawiki.special/mediawiki.special.edittags.js b/resources/src/mediawiki.special/mediawiki.special.edittags.js new file mode 100644 index 00000000..69a2a67a --- /dev/null +++ b/resources/src/mediawiki.special/mediawiki.special.edittags.js @@ -0,0 +1,24 @@ +/*! + * JavaScript for Special:EditTags + */ +( function ( mw, $ ) { + $( function () { + var $tagList = $( '#mw-edittags-tag-list' ); + if ( $tagList.length ) { + $tagList.chosen( { + /*jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ + placeholder_text_multiple: mw.msg( 'tags-edit-chosen-placeholder' ), + no_results_text: mw.msg( 'tags-edit-chosen-no-results' ) + } ); + } + + $( '#mw-edittags-remove-all' ).on( 'change', function ( e ) { + $( '.mw-edittags-remove-checkbox' ).prop( 'checked', e.target.checked ); + } ); + $( '.mw-edittags-remove-checkbox' ).on( 'change', function ( e ) { + if ( !e.target.checked ) { + $( '#mw-edittags-remove-all' ).prop( 'checked', false ); + } + } ); + } ); +}( mediaWiki, jQuery ) ); diff --git a/resources/src/mediawiki.special/mediawiki.special.import.js b/resources/src/mediawiki.special/mediawiki.special.import.js index a9a985eb..5622b32a 100644 --- a/resources/src/mediawiki.special/mediawiki.special.import.js +++ b/resources/src/mediawiki.special/mediawiki.special.import.js @@ -2,7 +2,7 @@ * JavaScript for Special:Import */ ( function ( $ ) { - function updateImportSubprojectList() { + function updateImportSubprojectList( firstTime ) { var $projectField = $( '#mw-import-table-interwiki #interwiki' ), $subprojectField = $projectField.parent().find( '#subproject' ), $selected = $projectField.find( ':selected' ), @@ -14,7 +14,7 @@ option = document.createElement( 'option' ); option.appendChild( document.createTextNode( el ) ); option.setAttribute( 'value', el ); - if ( oldValue === el ) { + if ( oldValue === el && firstTime !== true ) { option.setAttribute( 'selected', 'selected' ); } return option; @@ -29,7 +29,7 @@ var $projectField = $( '#mw-import-table-interwiki #interwiki' ); if ( $projectField.length ) { $projectField.change( updateImportSubprojectList ); - updateImportSubprojectList(); + updateImportSubprojectList( true ); } } ); }( jQuery ) ); diff --git a/resources/src/mediawiki.special/mediawiki.special.pageLanguage.js b/resources/src/mediawiki.special/mediawiki.special.pageLanguage.js index ba7f7342..7c2269fa 100644 --- a/resources/src/mediawiki.special/mediawiki.special.pageLanguage.js +++ b/resources/src/mediawiki.special/mediawiki.special.pageLanguage.js @@ -6,4 +6,4 @@ $( '#mw-pl-options-2' ).prop( 'checked', true ); } ); } ); -} ( jQuery ) ); +}( jQuery ) ); diff --git a/resources/src/mediawiki.special/mediawiki.special.preferences.js b/resources/src/mediawiki.special/mediawiki.special.preferences.js index 1f6429b2..4bd747b2 100644 --- a/resources/src/mediawiki.special/mediawiki.special.preferences.js +++ b/resources/src/mediawiki.special/mediawiki.special.preferences.js @@ -5,15 +5,18 @@ jQuery( function ( $ ) { var $preftoc, $preferences, $fieldsets, $legends, hash, labelFunc, $tzSelect, $tzTextbox, $localtimeHolder, servertime, - $checkBoxes, savedWindowOnBeforeUnload; + $checkBoxes, allowCloseWindowFn; labelFunc = function () { return this.id.replace( /^mw-prefsection/g, 'preftab' ); }; $( '#prefsubmit' ).attr( 'id', 'prefcontrol' ); - $preftoc = $( '<ul id="preftoc"></ul>' ) - .attr( 'role', 'tablist' ); + $preftoc = $( '<ul>' ) + .attr( { + id: 'preftoc', + role: 'tablist' + } ); $preferences = $( '#preferences' ) .addClass( 'jsprefs' ) .before( $preftoc ); @@ -41,7 +44,7 @@ jQuery( function ( $ ) { } else { $( this ).css( 'height', 'auto' ); } - } ).insertBefore( $preftoc ); + } ).insertBefore( $preftoc ); /** * It uses document.getElementById for security reasons (HTML injections in $()). @@ -57,7 +60,7 @@ jQuery( function ( $ ) { // therefore save and restore scrollTop to prevent jumping. scrollTop = $( window ).scrollTop(); if ( mode !== 'noHash' ) { - window.location.hash = '#mw-prefsection-' + name; + location.hash = '#mw-prefsection-' + name; } $( window ).scrollTop( scrollTop ); @@ -127,7 +130,7 @@ jQuery( function ( $ ) { // If we've reloaded the page or followed an open-in-new-window, // make the selected tab visible. - hash = window.location.hash; + hash = location.hash; if ( hash.match( /^#mw-prefsection-[\w\-]+/ ) ) { switchPrefTab( hash.replace( '#mw-prefsection-', '' ) ); } @@ -142,7 +145,7 @@ jQuery( function ( $ ) { ( document.documentMode === undefined || document.documentMode >= 8 ) ) { $( window ).on( 'hashchange', function () { - var hash = window.location.hash; + var hash = location.hash; if ( hash.match( /^#mw-prefsection-[\w\-]+/ ) ) { switchPrefTab( hash.replace( '#mw-prefsection-', '' ) ); } else if ( hash === '' ) { @@ -223,12 +226,8 @@ jQuery( function ( $ ) { localTime = servertime + minuteDiff; // Bring time within the [0,1440) range. - while ( localTime < 0 ) { - localTime += 1440; - } - while ( localTime >= 1440 ) { - localTime -= 1440; - } + localTime = ( ( localTime % 1440 ) + 1440 ) % 1440; + $localtimeHolder.text( mediaWiki.language.convertNumber( minutesToHours( localTime ) ) ); } @@ -267,39 +266,14 @@ jQuery( function ( $ ) { // Set up a message to notify users if they try to leave the page without // saving. $( '#mw-prefs-form' ).data( 'origdata', $( '#mw-prefs-form' ).serialize() ); - $( window ) - .on( 'beforeunload.prefswarning', function () { - var retval; - - // Check if anything changed - if ( $( '#mw-prefs-form' ).serialize() !== $( '#mw-prefs-form' ).data( 'origdata' ) ) { - // Return our message - retval = mediaWiki.msg( 'prefswarning-warning', mediaWiki.msg( 'saveprefs' ) ); - } + allowCloseWindowFn = mediaWiki.confirmCloseWindow( { + test: function () { + return $( '#mw-prefs-form' ).serialize() !== $( '#mw-prefs-form' ).data( 'origdata' ); + }, - // Unset the onbeforeunload handler so we don't break page caching in Firefox - savedWindowOnBeforeUnload = window.onbeforeunload; - window.onbeforeunload = null; - if ( retval !== undefined ) { - // ...but if the user chooses not to leave the page, we need to rebind it - setTimeout( function () { - window.onbeforeunload = savedWindowOnBeforeUnload; - }, 1 ); - return retval; - } - } ) - .on( 'pageshow.prefswarning', function () { - // Re-add onbeforeunload handler - if ( !window.onbeforeunload ) { - window.onbeforeunload = savedWindowOnBeforeUnload; - } - } ); - $( '#mw-prefs-form' ).submit( function () { - // Unbind our beforeunload handler - $( window ).off( '.prefswarning' ); - } ); - $( '#mw-prefs-restoreprefs' ).click( function () { - // Unbind our beforeunload handler - $( window ).off( '.prefswarning' ); + message: mediaWiki.msg( 'prefswarning-warning', mediaWiki.msg( 'saveprefs' ) ), + namespace: 'prefswarning' } ); + $( '#mw-prefs-form' ).submit( allowCloseWindowFn ); + $( '#mw-prefs-restoreprefs' ).click( allowCloseWindowFn ); } ); diff --git a/resources/src/mediawiki.special/mediawiki.special.search.css b/resources/src/mediawiki.special/mediawiki.special.search.css index ef955077..8f845dfa 100644 --- a/resources/src/mediawiki.special/mediawiki.special.search.css +++ b/resources/src/mediawiki.special/mediawiki.special.search.css @@ -40,34 +40,34 @@ div.searchresult { color: green; font-size: 97%; } -.mw-search-formheader { +.mw-search-profile-tabs { background-color: #f3f3f3; margin-top: 1em; border: 1px solid silver; } -.mw-search-formheader div.search-types { +.mw-search-profile-tabs div.search-types { float: left; padding-left: 0.25em; } -.mw-search-formheader div.search-types ul { +.mw-search-profile-tabs div.search-types ul { margin: 0 !important; padding: 0 !important; list-style: none !important; } -.mw-search-formheader div.search-types ul li { +.mw-search-profile-tabs div.search-types ul li { float: left; margin: 0; padding: 0; } -.mw-search-formheader div.search-types ul li a { +.mw-search-profile-tabs div.search-types ul li a { display: block; padding: 0.5em; } -.mw-search-formheader div.search-types ul li.current a { +.mw-search-profile-tabs div.search-types ul li.current a { color: #333333; cursor: default; } -.mw-search-formheader div.search-types ul li.current a:hover { +.mw-search-profile-tabs div.search-types ul li.current a:hover { text-decoration: none; } #mw-search-top-table div.results-info { @@ -106,9 +106,10 @@ fieldset#mw-searchoptions div#mw-search-togglebox input { fieldset#mw-searchoptions table { float: left; margin-right: 3em; + border-collapse: collapse; } fieldset#mw-searchoptions table td { - padding-right: 1em; + padding: 0 1em 0 0; white-space: nowrap; } fieldset#mw-searchoptions div.divider { diff --git a/resources/src/mediawiki.special/mediawiki.special.upload.js b/resources/src/mediawiki.special/mediawiki.special.upload.js index 286befcc..eeccda59 100644 --- a/resources/src/mediawiki.special/mediawiki.special.upload.js +++ b/resources/src/mediawiki.special/mediawiki.special.upload.js @@ -6,8 +6,9 @@ * @singleton */ ( function ( mw, $ ) { - var ajaxUploadDestCheck = mw.config.get( 'wgAjaxUploadDestCheck' ), - $license = $( '#wpLicense' ), uploadWarning, uploadLicense; + var uploadWarning, uploadLicense, + ajaxUploadDestCheck = mw.config.get( 'wgAjaxUploadDestCheck' ), + $license = $( '#wpLicense' ); window.wgUploadWarningObj = uploadWarning = { responseCache: { '': ' ' }, @@ -136,11 +137,6 @@ }; $( function () { - // Disable URL box if the URL copy upload source type is not selected - if ( !$( '#wpSourceTypeurl' ).prop( 'checked' ) ) { - $( '#wpUploadFileURL' ).prop( 'disabled', true ); - } - // AJAX wpDestFile warnings if ( ajaxUploadDestCheck ) { // Insert an event handler that fetches upload warnings when wpDestFile @@ -202,6 +198,7 @@ // URLs are less likely to have a useful extension, so don't include them in the // extension check. if ( + mw.config.get( 'wgCheckFileExtensions' ) && mw.config.get( 'wgStrictFileExtensions' ) && mw.config.get( 'wgFileExtensions' ) && $( this ).attr( 'id' ) !== 'wpUploadFileURL' @@ -294,12 +291,7 @@ ctx, meta, previewSize = 180, - thumb = $( '<div id="mw-upload-thumbnail" class="thumb tright">' + - '<div class="thumbinner">' + - '<div class="mw-small-spinner" style="width: 180px; height: 180px"></div>' + - '<div class="thumbcaption"><div class="filename"></div><div class="fileinfo"></div></div>' + - '</div>' + - '</div>' ); + thumb = mw.template.get( 'mediawiki.special.upload', 'thumbnail.html' ).render(); thumb.find( '.filename' ).text( file.name ).end() .find( '.fileinfo' ).text( prettySize( file.size ) ).end(); @@ -387,10 +379,11 @@ }; img.src = dataURL; }, mw.config.get( 'wgFileCanRotate' ) ? function ( data ) { - /*jshint camelcase:false, nomen:false */ try { meta = mw.libs.jpegmeta( data, file.fileName ); + // jscs:disable requireCamelCaseOrUpperCaseIdentifiers, disallowDanglingUnderscores meta._binary_data = null; + // jscs:enable } catch ( e ) { meta = null; } @@ -534,32 +527,58 @@ // Disable all upload source fields except the selected one $( function () { - var i, $row, - $rows = $( '.mw-htmlform-field-UploadSourceField' ); + var $rows = $( '.mw-htmlform-field-UploadSourceField' ); - /** - * @param {jQuery} $currentRow - * @return {Function} Handler - * @return {jQuery.Event} return.e - */ - function createHandler( $currentRow ) { - return function () { - $( '.mw-upload-source-error' ).remove(); - if ( this.checked ) { - // Disable all inputs - $rows.find( 'input[name!="wpSourceType"]' ).prop( 'disabled', true ); - // Re-enable the current one - $currentRow.find( 'input' ).prop( 'disabled', false ); - } - }; - } + $rows.on( 'change', 'input[type="radio"]', function ( e ) { + var currentRow = e.delegateTarget; + + if ( !this.checked ) { + return; + } + + $( '.mw-upload-source-error' ).remove(); + + // Enable selected upload method + $( currentRow ).find( 'input' ).prop( 'disabled', false ); - for ( i = $rows.length; i; i-- ) { - $row = $rows.eq( i - 1 ); - $row - .find( 'input[name="wpSourceType"]' ) - .change( createHandler( $row ) ); + // Disable inputs of other upload methods + // (except for the radio button to re-enable it) + $rows + .not( currentRow ) + .find( 'input[type!="radio"]' ) + .prop( 'disabled', true ); + } ); + + // Set initial state + if ( !$( '#wpSourceTypeurl' ).prop( 'checked' ) ) { + $( '#wpUploadFileURL' ).prop( 'disabled', true ); } } ); + $( function () { + // Prevent losing work + var allowCloseWindow, + $uploadForm = $( '#mw-upload-form' ); + + if ( !mw.user.options.get( 'useeditwarning' ) ) { + // If the user doesn't want edit warnings, don't set things up. + return; + } + + $uploadForm.data( 'origtext', $uploadForm.serialize() ); + + allowCloseWindow = mw.confirmCloseWindow( { + test: function () { + return $( '#wpUploadFile' ).get( 0 ).files.length !== 0 || + $uploadForm.data( 'origtext' ) !== $uploadForm.serialize(); + }, + + message: mw.msg( 'editwarning-warning' ), + namespace: 'uploadwarning' + } ); + + $uploadForm.submit( function () { + allowCloseWindow(); + } ); + } ); }( mediaWiki, jQuery ) ); diff --git a/resources/src/mediawiki.special/mediawiki.special.userlogin.common.css b/resources/src/mediawiki.special/mediawiki.special.userlogin.common.css index 28b14462..30f000bf 100644 --- a/resources/src/mediawiki.special/mediawiki.special.userlogin.common.css +++ b/resources/src/mediawiki.special/mediawiki.special.userlogin.common.css @@ -1,5 +1,5 @@ /* Styles for user login and signup forms */ -#mw-userlogin-help { +.mw-form-related-link-container { text-align: center; } diff --git a/resources/src/mediawiki.special/mediawiki.special.userlogin.common.js b/resources/src/mediawiki.special/mediawiki.special.userlogin.common.js index 247f8141..f5289dee 100644 --- a/resources/src/mediawiki.special/mediawiki.special.userlogin.common.js +++ b/resources/src/mediawiki.special/mediawiki.special.userlogin.common.js @@ -20,7 +20,7 @@ if ( !$submit.length ) { return; } - tabIndex = $submit.prop( 'tabindex' ) - 1; + tabIndex = $submit.prop( 'tabIndex' ) - 1; $captchaStuff = $content.find( '.captcha' ); if ( $captchaStuff.length ) { diff --git a/resources/src/mediawiki.special/mediawiki.special.userlogin.login.css b/resources/src/mediawiki.special/mediawiki.special.userlogin.login.css index 64471b27..df3db574 100644 --- a/resources/src/mediawiki.special/mediawiki.special.userlogin.login.css +++ b/resources/src/mediawiki.special/mediawiki.special.userlogin.login.css @@ -7,16 +7,3 @@ margin: 0 auto; padding-top: 4em; } - -#mw-createaccount-cta, -#mw-createaccount-another { - font-size: 0.9em; - font-weight: normal; - text-align: center; -} - -#mw-createaccount-join { - margin-left: 0.75em; - width: auto; - display: inline-block; -} diff --git a/resources/src/mediawiki.special/mediawiki.special.userlogin.signup.js b/resources/src/mediawiki.special/mediawiki.special.userlogin.signup.js index 68d3f61b..a32a7902 100644 --- a/resources/src/mediawiki.special/mediawiki.special.userlogin.signup.js +++ b/resources/src/mediawiki.special/mediawiki.special.userlogin.signup.js @@ -135,6 +135,6 @@ } ); } - $input.on( events, $.debounce( 250, updateUsernameStatus ) ); + $input.on( events, $.debounce( 1000, updateUsernameStatus ) ); } ); }( mediaWiki, jQuery ) ); diff --git a/resources/src/mediawiki.special/mediawiki.special.version.css b/resources/src/mediawiki.special/mediawiki.special.version.css index 764e3777..7c87d68f 100644 --- a/resources/src/mediawiki.special/mediawiki.special.version.css +++ b/resources/src/mediawiki.special/mediawiki.special.version.css @@ -12,3 +12,7 @@ th.mw-version-ext-col-label { font-size: 0.9em; } + +.mw-version-ext-vcs-version { + unicode-bidi: embed; +} diff --git a/resources/src/mediawiki.special/templates/thumbnail.html b/resources/src/mediawiki.special/templates/thumbnail.html new file mode 100644 index 00000000..73042f24 --- /dev/null +++ b/resources/src/mediawiki.special/templates/thumbnail.html @@ -0,0 +1,9 @@ +<div id="mw-upload-thumbnail" class="thumb tright"> + <div class="thumbinner"> + <div class="mw-small-spinner" style="width: 180px; height: 180px"></div> + <div class="thumbcaption"> + <div class="filename"></div> + <div class="fileinfo"></div> + </div> + </div> +</div> |