diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
commit | 63601400e476c6cf43d985f3e7b9864681695ed4 (patch) | |
tree | f7846203a952e38aaf66989d0a4702779f549962 /extensions/Vector/modules | |
parent | 8ff01378c9e0207f9169b81966a51def645b6a51 (diff) |
Update to MediaWiki 1.20.2
this update includes:
* adjusted Arch Linux skin
* updated FluxBBAuthPlugin
* patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'extensions/Vector/modules')
5 files changed, 137 insertions, 317 deletions
diff --git a/extensions/Vector/modules/ext.vector.editWarning.js b/extensions/Vector/modules/ext.vector.editWarning.js index e6ee5c60..e128fd45 100644 --- a/extensions/Vector/modules/ext.vector.editWarning.js +++ b/extensions/Vector/modules/ext.vector.editWarning.js @@ -11,22 +11,11 @@ $( '#wpTextbox1, #wpSummary' ).each( function () { $(this).data( 'origtext', $(this).val() ); }); - // Attach our own handler for onbeforeunload which respects the current one - var otherOnBeforeUnload = window.onbeforeunload; - function ourOnBeforeUnload() { - var fallbackResult, retval; + var savedWindowOnBeforeUnload; + $( window ) + .on( 'beforeunload.editwarning', function () { + var retval; - // Check if someone already set an onbeforeunload hook - if ( otherOnBeforeUnload ) { - // Get the result of their onbeforeunload hook - fallbackResult = otherOnBeforeUnload(); - } - - // Check if their onbeforeunload hook returned something - if ( fallbackResult !== undefined ) { - // Exit here, returning their message - retval = fallbackResult; - } else { // Check if the current values of some form elements are the same as // the original values if ( @@ -37,33 +26,29 @@ // Return our message retval = mw.msg( 'vector-editwarning-warning' ); } - } - - // Unset the onbeforeunload handler so we don't break page caching in Firefox - 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 = ourOnBeforeUnload; - }, 1 ); - return retval; - } - } - - // Do the first binding now - window.onbeforeunload = ourOnBeforeUnload; - function pageShowHandler() { - // Re-add onbeforeunload handler on pageshow. - window.onbeforeunload = ourOnBeforeUnload; - } - - $( window ).on( 'pageshow', pageShowHandler ); + // 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.editwarning', function () { + // Re-add onbeforeunload handler + if ( window.onbeforeunload == null ) { + window.onbeforeunload = savedWindowOnBeforeUnload; + } + } ); // Add form submission handler $( '#editform' ).submit( function () { - // Restore whatever previous onbeforeload hook existed - window.onbeforeunload = otherOnBeforeUnload; + // Unbind our handlers + $( window ).off( '.editwarning' ); }); }); diff --git a/extensions/Vector/modules/ext.vector.footerCleanup.css b/extensions/Vector/modules/ext.vector.footerCleanup.css index cd621006..a2220c80 100644 --- a/extensions/Vector/modules/ext.vector.footerCleanup.css +++ b/extensions/Vector/modules/ext.vector.footerCleanup.css @@ -2,104 +2,75 @@ * Footer cleanup */ -#editpage-bottom { - background-color: #F3F3F3; +#wpTextbox1 { + margin: 0; + display: block; +} + +.editOptions { + background-color: #F0F0F0; border: 1px solid silver; border-top: none; - padding: 20px 170px 20px 170px; + padding: 1em 1em 1.5em 1em; margin-right: -2px; -} - -#editpage-bottom input.inline-hint { - color: #999999; - font-style: italic; + margin-bottom: 2em; } .collapsible-list { - border-top: 1px solid silver; - border-bottom: 1px solid silver; + display: inline; + cursor: pointer; + min-width: 400px; } - -.collapsible-list { - border-top: 1px solid silver; - border-bottom: 1px solid silver; - padding: 3px 2px; -} - -.collapsible-list ul { - display: block; - padding: 0 0 0 14px; -} - -.collapsible-list.collapsed label { +.collapsible-list > span { + float: left; /* @embed */ - background: url(../images/vector/collapsibleNav/arrow-down.png) 0 50% no-repeat; - padding: 4px 0 3px 1.5em; - margin-bottom: 0; + background: url(./images/open.png); + background-repeat: no-repeat; + background-position: 50% 50%; + display: block; + height: 16px; + width: 16px; } -.collapsible-list.expanded label { +.collapsible-list > span.collapsed { /* @embed */ - background: url(../images/vector/collapsibleNav/arrow-right.png) 0 50% no-repeat; - padding: 4px 0 3px 1.5em; - margin-bottom: 0; -} - -#editpage-bottom .editOptions { - width: 100%; + background: url(./images/closed-ltr.png); + background-repeat: no-repeat; + background-position: 50% 50%; } -#editpage-bottom #wpSummaryLabel, -#editpage-bottom #editpage-summary-fields, -#editpage-bottom .editButtons { - float: left; +.hiddencats > ul, .templatesUsed > ul { + margin: 1em 2.5em; } -#editpage-bottom #wpSummaryLabel { - width: 150px; - margin-left: -150px; - position: relative; +.editCheckboxes { + margin-bottom: 1em; } -#editpage-bottom #editpage-summary-fields { - width: 100%; - margin-right: -100%; +.editCheckboxes input[type='checkbox']:first-child { + margin-left: 0; } -#editpage-bottom #editpage-summary-fields input.mw-summary { - width: 95%; +.cancelLink { + margin: 0 0.5em; } -#editpage-bottom .editButtons { - width: 150px; - margin-right: -150px; - float: right; - position: relative; +.cancelLinkPipeSpace { + display: inline-block; + width: 0.5em; + height: 0.5em; } -#editpage-bottom #editpage-copywarn { - margin-left: -150px; - margin-right: 10px; +#editpage-copywarn { + font-size: 0.9em; } -/* Why don't we use self clearing floats anywhere? */ - -#editpage-bottom .editOptions:after { - content: "."; +input#wpSummary { display: block; - height: 0; - clear: both; - visibility: hidden; + margin-top: 0; + margin-bottom: 0.5em; } -#editpage-bottom .editOptions { - display: inline-block; -} - -* html #editpage-bottom .editOptions { - height: 1%; -} - -#editpage-bottom .editOptions { - display: block; +.editButtons > input[type='submit']:first-child { + margin-left: .1em; } diff --git a/extensions/Vector/modules/ext.vector.footerCleanup.js b/extensions/Vector/modules/ext.vector.footerCleanup.js index b3f5594d..ba4791e7 100644 --- a/extensions/Vector/modules/ext.vector.footerCleanup.js +++ b/extensions/Vector/modules/ext.vector.footerCleanup.js @@ -1,69 +1,29 @@ /* * Footer cleanup for Vector */ -jQuery( function ( $ ) { - $( '#editpage-copywarn' ) - .add( '.editOptions' ) - .wrapAll( '<div id="editpage-bottom"></div>' ); - $( '#wpSummary' ) - .data( 'hint', - $( '#wpSummaryLabel span small' ) - .remove() - .text() - // FIXME - Not a long-term solution. This change should be done in the message itself - .replace( /\)|\(/g, '' ) - ) - .change( function () { - if ( $( this ).val().length === 0 ) { - $( this ) - .addClass( 'inline-hint' ) - .val( $( this ).data( 'hint' ) ); - } else { - $( this ).removeClass( 'inline-hint' ); - } - } ) - .focus( function () { - if ( $( this ).val() == $( this ).data( 'hint' ) ) { - $( this ) - .removeClass( 'inline-hint' ) - .val( "" ); - } - }) - .blur( function () { $( this ).trigger( 'change' ); } ) - .trigger( 'change' ); - $( '#wpSummary' ) - .add( '.editCheckboxes' ) - .wrapAll( '<div id="editpage-summary-fields"></div>' ); - - $( '#editpage-specialchars' ).remove(); - - // transclusions - // FIXME - bad CSS styling here with double class selectors. Should address here. - var transclusionCount = $( '.templatesUsed ul li' ).size(); - $( '.templatesUsed ul' ) - .wrap( '<div id="transclusions-list" class="collapsible-list collapsed"></div>' ) - .parent() - .prepend( $( '<label>' ) - .text( mw.msg( 'vector-footercleanup-transclusion', transclusionCount ) ) - ); - $( '.mw-templatesUsedExplanation' ).remove(); - - $( '.collapsible-list label' ) - .click( function () { - $( this ) - .parent() - .toggleClass( 'expanded' ) - .toggleClass( 'collapsed' ) - .find( 'ul' ) - .slideToggle( 'fast' ); - return false; - }) - .trigger( 'click' ); + ( function ( $ ) { + // Wait for onload to remove edit help and "|" after cancel link. + window.onload = function() { + // Only if advanced editor is found. + if ( 'wikiEditor' in $ ) { + $( '.editButtons' ).find( '.editHelp' ).remove(); + // Remove the "|" from after the cancelLink. + var $cancelLink = $( '#mw-editform-cancel' ); + $cancelLink.parent().empty().append( $cancelLink ); + } + }; + // Waiting until dom ready as the module is loaded in the head. + $( document ).ready( function () { + // Make "Templates used" a collapsible list. + $( '.templatesUsed ul' ).footerCollapsibleList( { + name: 'templates-used-list', + title: mw.msg( 'vector-footercleanup-templates' ) + } ); - $( '#wpPreview, #wpDiff, .editHelp, #editpage-specialchars' ) - .remove(); - - $( '#mw-editform-cancel' ) - .remove() - .appendTo( '.editButtons' ); -} ); + // Make "Hidden categories" a collapsible list. + $( '.hiddencats ul' ).footerCollapsibleList( { + name: 'hidden-categories-list', + title: mw.msg( 'vector-footercleanup-categories' ) + } ); + } ); +} ( jQuery ) ); diff --git a/extensions/Vector/modules/ext.vector.simpleSearch.js b/extensions/Vector/modules/ext.vector.simpleSearch.js deleted file mode 100644 index 4dbdd705..00000000 --- a/extensions/Vector/modules/ext.vector.simpleSearch.js +++ /dev/null @@ -1,142 +0,0 @@ -/** - * JavaScript for SimpleSearch - */ - -jQuery( document ).ready( function ( $ ) { - - // Ensure that the thing is actually present! - if ( $( '#simpleSearch' ).length === 0 ) { - // Don't try to set anything up if simpleSearch is disabled sitewide. - // The loader code loads us if the option is present, even if we're - // not actually enabled (anymore). - return; - } - - // Compatibility map - var map = { - browsers: { - // Left-to-right languages - ltr: { - // SimpleSearch is broken in Opera < 9.6 - opera: [['>=', 9.6]], - docomo: false, - blackberry: false, - ipod: false, - iphone: false - }, - // Right-to-left languages - rtl: { - opera: [['>=', 9.6]], - docomo: false, - blackberry: false, - ipod: false, - iphone: false - } - } - }; - if ( !$.client.test( map ) ) { - return true; - } - - // Disable MWSuggest if loaded - if ( window.os_MWSuggestDisable ) { - window.os_MWSuggestDisable(); - } - - // Placeholder text for SimpleSearch box - $( '#simpleSearch > input#searchInput' ) - .attr( 'placeholder', mw.msg( 'vector-simplesearch-search' ) ) - .placeholder(); - - // General suggestions functionality for all search boxes - $( '#searchInput, #searchInput2, #powerSearchText, #searchText' ) - .suggestions( { - fetch: function ( query ) { - var $el = $(this); - if ( query.length !== 0 ) { - var jqXhr = $.ajax( { - url: mw.util.wikiScript( 'api' ), - data: { - format: 'json', - action: 'opensearch', - search: query, - namespace: 0, - suggest: '' - }, - dataType: 'json', - success: function ( data ) { - if ( $.isArray( data ) && data.length ) { - $el.suggestions( 'suggestions', data[1] ); - } - } - }); - $el.data( 'request', jqXhr ); - } - }, - cancel: function () { - var jqXhr = $(this).data( 'request' ); - // If the delay setting has caused the fetch to have not even happend yet, - // the jqXHR object will have never been set. - if ( jqXhr && $.isFunction ( jqXhr.abort ) ) { - jqXhr.abort(); - $(this).removeData( 'request' ); - } - }, - result: { - select: function ( $input ) { - $input.closest( 'form' ).submit(); - } - }, - delay: 120, - positionFromLeft: $( 'body' ).hasClass( 'rtl' ), - highlightInput: true - } ) - .bind( 'paste cut drop', function ( e ) { - // make sure paste and cut events from the mouse and drag&drop events - // trigger the keypress handler and cause the suggestions to update - $( this ).trigger( 'keypress' ); - } ); - // Special suggestions functionality for skin-provided search box - $( '#searchInput' ).suggestions( { - result: { - select: function ( $input ) { - $input.closest( 'form' ).submit(); - } - }, - special: { - render: function ( query ) { - var $el = $(this); - if ( $el.children().length === 0 ) { - $el.show(); - $( '<div>', { - 'class': 'special-label', - text: mw.msg( 'vector-simplesearch-containing' ) - }) - .appendTo( $el ); - $( '<div>', { - 'class': 'special-query', - text: query - }) - .appendTo( $el ) - .autoEllipsis(); - } else { - $el.find( '.special-query' ) - .empty() - .text( query ) - .autoEllipsis(); - } - }, - select: function ( $input ) { - $input.closest( 'form' ).append( - $( '<input>', { - type: 'hidden', - name: 'fulltext', - val: '1' - }) - ); - $input.closest( 'form' ).submit(); - } - }, - $region: $( '#simpleSearch' ) - } ); -});
\ No newline at end of file diff --git a/extensions/Vector/modules/jquery.footerCollapsibleList.js b/extensions/Vector/modules/jquery.footerCollapsibleList.js new file mode 100644 index 00000000..2915ce29 --- /dev/null +++ b/extensions/Vector/modules/jquery.footerCollapsibleList.js @@ -0,0 +1,46 @@ +( function( $ ) { + // Small jQuery plugin to handle the toggle function & cookie for state + // For collapsible items in the footer + $.fn.footerCollapsibleList = function( config ) { + if ( + ! ( 'title' in config ) || + ! ( 'name' in config ) + ) { + return; + } + return this.each( function () { + // Setup + $( this ) + .parent() + .prepend( + $( '<a>' ) + .addClass( 'collapsible-list' ) + .text( config.title ) + .on( 'click', function( e ) { + e.preventDefault(); + // Modify state cookie. + var state = ( $.cookie( config.name ) !== 'expanded' ) ? + 'expanded' : 'collapsed'; + $.cookie( config.name, state ); + // Modify DOM. + $( this ).next().toggle(); + $( this ).find( 'span' ).toggleClass( 'collapsed' ); + } ) + .append( $( '<span>' ) ) + ) + .end() + .prev() + .remove(); + // Check cookie and collapse. + if( + $.cookie( config.name ) === null || + $.cookie( config.name ) === 'collapsed' + ) { + $( this ) + .slideUp() + .prev() + .find( 'span' ).addClass( 'collapsed' ); + } + } ); + }; +}( jQuery ) ); |