summaryrefslogtreecommitdiff
path: root/resources/src/mediawiki.action
diff options
context:
space:
mode:
Diffstat (limited to 'resources/src/mediawiki.action')
-rw-r--r--resources/src/mediawiki.action/images/nextredirect-ltr.pngbin121 -> 122 bytes
-rw-r--r--resources/src/mediawiki.action/images/nextredirect-ltr.svg9
-rw-r--r--resources/src/mediawiki.action/images/nextredirect-rtl.pngbin121 -> 118 bytes
-rw-r--r--resources/src/mediawiki.action/images/nextredirect-rtl.svg9
-rw-r--r--resources/src/mediawiki.action/images/redirect-ltr.pngbin128 -> 169 bytes
-rw-r--r--resources/src/mediawiki.action/images/redirect-ltr.svg9
-rw-r--r--resources/src/mediawiki.action/images/redirect-rtl.pngbin132 -> 139 bytes
-rw-r--r--resources/src/mediawiki.action/images/redirect-rtl.svg9
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js61
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.js232
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.preview.js257
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.stash.js76
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.styles.css8
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_bold.pngbin533 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_headline.pngbin484 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_italic.pngbin532 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_link.pngbin557 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_nowiki.pngbin874 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_bold.pngbin550 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_italic.pngbin539 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_link.pngbin419 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_bold.pngbin255 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_italic.pngbin260 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_bold.pngbin250 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_extlink.pngbin435 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_headline.pngbin440 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_hr.pngbin200 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_image.pngbin483 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_italic.pngbin250 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_link.pngbin280 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_media.pngbin728 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_nowiki.pngbin322 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_sig.pngbin920 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_bold.pngbin459 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_headline.pngbin392 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_italic.pngbin512 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_link.pngbin485 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_nowiki.pngbin874 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/LICENSE7
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/button_italic.pngbin368 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/LICENSE17
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_bold.pngbin254 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_italic.pngbin423 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_link.pngbin278 -> 0 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less42
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.history.diff.css7
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.history.diff.print.css16
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.history.js3
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.categoryPage.less11
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js13
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.metadata.css10
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.postEdit.js11
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.redirect.js3
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.redirectPage.css20
-rw-r--r--resources/src/mediawiki.action/templates/postEdit.html6
55 files changed, 425 insertions, 411 deletions
diff --git a/resources/src/mediawiki.action/images/nextredirect-ltr.png b/resources/src/mediawiki.action/images/nextredirect-ltr.png
index cd657c33..e0a6bd7f 100644
--- a/resources/src/mediawiki.action/images/nextredirect-ltr.png
+++ b/resources/src/mediawiki.action/images/nextredirect-ltr.png
Binary files differ
diff --git a/resources/src/mediawiki.action/images/nextredirect-ltr.svg b/resources/src/mediawiki.action/images/nextredirect-ltr.svg
new file mode 100644
index 00000000..6932e580
--- /dev/null
+++ b/resources/src/mediawiki.action/images/nextredirect-ltr.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="42" height="20" viewBox="0 0 42 20">
+ <g id="Layer_2">
+ <path fill="#fff" stroke="#000" stroke-width="2" stroke-miterlimit="10" d="M11 10h17.064"/>
+ </g>
+ <g id="Layer_3">
+ <path d="M23 6l8 4-8 4z"/>
+ </g>
+</svg>
diff --git a/resources/src/mediawiki.action/images/nextredirect-rtl.png b/resources/src/mediawiki.action/images/nextredirect-rtl.png
index b788f334..ddb5273b 100644
--- a/resources/src/mediawiki.action/images/nextredirect-rtl.png
+++ b/resources/src/mediawiki.action/images/nextredirect-rtl.png
Binary files differ
diff --git a/resources/src/mediawiki.action/images/nextredirect-rtl.svg b/resources/src/mediawiki.action/images/nextredirect-rtl.svg
new file mode 100644
index 00000000..b309da94
--- /dev/null
+++ b/resources/src/mediawiki.action/images/nextredirect-rtl.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="42" height="20" viewBox="0 0 42 20">
+ <g id="Layer_2">
+ <path fill="#fff" stroke="#000" stroke-width="2" stroke-miterlimit="10" d="M31 10H13.936"/>
+ </g>
+ <g id="Layer_3">
+ <path d="M19 6l-8 4 8 4z"/>
+ </g>
+</svg>
diff --git a/resources/src/mediawiki.action/images/redirect-ltr.png b/resources/src/mediawiki.action/images/redirect-ltr.png
index 695f2a13..0734d731 100644
--- a/resources/src/mediawiki.action/images/redirect-ltr.png
+++ b/resources/src/mediawiki.action/images/redirect-ltr.png
Binary files differ
diff --git a/resources/src/mediawiki.action/images/redirect-ltr.svg b/resources/src/mediawiki.action/images/redirect-ltr.svg
new file mode 100644
index 00000000..713be6cb
--- /dev/null
+++ b/resources/src/mediawiki.action/images/redirect-ltr.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="47" height="20" viewBox="0 0 47 20">
+ <g id="Layer_1">
+ <path fill="none" stroke="#000" stroke-width="2" stroke-miterlimit="10" d="M14.98 2.5V11c0 1.04 1.02 1.98 2.02 1.98h6l3 .02"/>
+ </g>
+ <g id="Layer_3">
+ <path d="M23.48 9.5l.02 7L30 13z"/>
+ </g>
+</svg>
diff --git a/resources/src/mediawiki.action/images/redirect-rtl.png b/resources/src/mediawiki.action/images/redirect-rtl.png
index c954a2ad..c883795e 100644
--- a/resources/src/mediawiki.action/images/redirect-rtl.png
+++ b/resources/src/mediawiki.action/images/redirect-rtl.png
Binary files differ
diff --git a/resources/src/mediawiki.action/images/redirect-rtl.svg b/resources/src/mediawiki.action/images/redirect-rtl.svg
new file mode 100644
index 00000000..ce0c7c92
--- /dev/null
+++ b/resources/src/mediawiki.action/images/redirect-rtl.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="47" height="20" viewBox="0 0 47 20">
+ <g id="Layer_1">
+ <path fill="none" stroke="#000" stroke-width="2" stroke-miterlimit="10" d="M32.002 2.5V11c0 1.04-1.02 1.98-2.02 1.98h-6l-3 .02"/>
+ </g>
+ <g id="Layer_3">
+ <path d="M23.502 9.5l-.02 7-6.5-3.5z"/>
+ </g>
+</svg>
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js b/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js
index b5654400..6b330128 100644
--- a/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js
@@ -5,54 +5,37 @@
'use strict';
$( function () {
- var savedWindowOnBeforeUnload,
- $wpTextbox1 = $( '#wpTextbox1' ),
- $wpSummary = $( '#wpSummary' );
+ var allowCloseWindow,
+ $textBox = $( '#wpTextbox1' ),
+ $summary = $( '#wpSummary' ),
+ $both = $textBox.add( $summary );
+
// Check if EditWarning is enabled and if we need it
- if ( $wpTextbox1.length === 0 ) {
+ if ( !mw.user.options.get( 'useeditwarning' ) ) {
return true;
}
- // Get the original values of some form elements
- $wpTextbox1.add( $wpSummary ).each( function () {
- $( this ).data( 'origtext', $( this ).val() );
+
+ // Save the original value of the text fields
+ $both.each( function ( index, element ) {
+ var $element = $( element );
+ $element.data( 'origtext', $element.textSelection( 'getContents' ) );
} );
- $( window )
- .on( 'beforeunload.editwarning', function () {
- var retval;
- // Check if the current values of some form elements are the same as
- // the original values
- if (
- mw.config.get( 'wgAction' ) === 'submit' ||
- $wpTextbox1.data( 'origtext' ) !== $wpTextbox1.textSelection( 'getContents' ) ||
- $wpSummary.data( 'origtext' ) !== $wpSummary.textSelection( 'getContents' )
- ) {
- // Return our message
- retval = mw.msg( 'editwarning-warning' );
- }
+ allowCloseWindow = mw.confirmCloseWindow( {
+ test: function () {
+ // We use .textSelection, because editors might not have updated the form yet.
+ return mw.config.get( 'wgAction' ) === 'submit' ||
+ $textBox.data( 'origtext' ) !== $textBox.textSelection( 'getContents' ) ||
+ $summary.data( 'origtext' ) !== $summary.textSelection( 'getContents' );
+ },
- // 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 ) {
- window.onbeforeunload = savedWindowOnBeforeUnload;
- }
- } );
+ message: mw.msg( 'editwarning-warning' ),
+ namespace: 'editwarning'
+ } );
// Add form submission handler
$( '#editform' ).submit( function () {
- // Unbind our handlers
- $( window ).off( '.editwarning' );
+ allowCloseWindow();
} );
} );
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.js b/resources/src/mediawiki.action/mediawiki.action.edit.js
index 4519b049..01a25f3b 100644
--- a/resources/src/mediawiki.action/mediawiki.action.edit.js
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.js
@@ -1,217 +1,23 @@
-/**
- * Interface for the classic edit toolbar.
- *
- * @class mw.toolbar
- * @singleton
+/*!
+ * Scripts for action=edit at domready
*/
-( function ( mw, $ ) {
- var toolbar, isReady, $toolbar, queue, slice, $currentFocused;
-
- /**
- * Internal helper that does the actual insertion of the button into the toolbar.
- *
- * See #addButton for parameter documentation.
- *
- * @private
- */
- function insertButton( b, speedTip, tagOpen, tagClose, sampleText, imageId ) {
- var $button;
-
- // Backwards compatibility
- if ( typeof b !== 'object' ) {
- b = {
- imageFile: b,
- speedTip: speedTip,
- tagOpen: tagOpen,
- tagClose: tagClose,
- sampleText: sampleText,
- imageId: imageId
- };
- }
-
- if ( b.imageFile ) {
- $button = $( '<img>' ).attr( {
- src: b.imageFile,
- alt: b.speedTip,
- title: b.speedTip,
- id: b.imageId || undefined,
- 'class': 'mw-toolbar-editbutton'
- } );
- } else {
- $button = $( '<div>' ).attr( {
- title: b.speedTip,
- id: b.imageId || undefined,
- 'class': 'mw-toolbar-editbutton'
- } );
+jQuery( function ( $ ) {
+ var editBox, scrollTop, $editForm;
+
+ // Make sure edit summary does not exceed byte limit
+ $( '#wpSummary' ).byteLimit( 255 );
+
+ // Restore the edit box scroll state following a preview operation,
+ // and set up a form submission handler to remember this state.
+ editBox = document.getElementById( 'wpTextbox1' );
+ scrollTop = document.getElementById( 'wpScrolltop' );
+ $editForm = $( '#editform' );
+ if ( $editForm.length && editBox && scrollTop ) {
+ if ( scrollTop.value ) {
+ editBox.scrollTop = scrollTop.value;
}
-
- $button.click( function ( e ) {
- if ( b.onClick !== undefined ) {
- b.onClick( e );
- } else {
- toolbar.insertTags( b.tagOpen, b.tagClose, b.sampleText );
- }
-
- return false;
+ $editForm.submit( function () {
+ scrollTop.value = editBox.scrollTop;
} );
-
- $toolbar.append( $button );
}
-
- isReady = false;
- $toolbar = false;
-
- /**
- * @private
- * @property {Array}
- * Contains button objects (and for backwards compatibilty, it can
- * also contains an arguments array for insertButton).
- */
- queue = [];
- slice = queue.slice;
-
- toolbar = {
-
- /**
- * Add buttons to the toolbar.
- *
- * Takes care of race conditions and time-based dependencies
- * by placing buttons in a queue if this method is called before
- * the toolbar is created.
- *
- * For backwards-compatibility, passing `imageFile`, `speedTip`, `tagOpen`, `tagClose`,
- * `sampleText` and `imageId` as separate arguments (in this order) is also supported.
- *
- * @param {Object} button Object with the following properties.
- * You are required to provide *either* the `onClick` parameter, or the three parameters
- * `tagOpen`, `tagClose` and `sampleText`, but not both (they're mutually exclusive).
- * @param {string} [button.imageFile] Image to use for the button.
- * @param {string} button.speedTip Tooltip displayed when user mouses over the button.
- * @param {Function} [button.onClick] Function to be executed when the button is clicked.
- * @param {string} [button.tagOpen]
- * @param {string} [button.tagClose]
- * @param {string} [button.sampleText] Alternative to `onClick`. `tagOpen`, `tagClose` and
- * `sampleText` together provide the markup that should be inserted into page text at
- * current cursor position.
- * @param {string} [button.imageId] `id` attribute of the button HTML element. Can be
- * used to define the image with CSS if it's not provided as `imageFile`.
- */
- addButton: function () {
- if ( isReady ) {
- insertButton.apply( toolbar, arguments );
- } else {
- // Convert arguments list to array
- queue.push( slice.call( arguments ) );
- }
- },
- /**
- * Add multiple buttons to the toolbar (see also #addButton).
- *
- * Example usage:
- *
- * addButtons( [ { .. }, { .. }, { .. } ] );
- * addButtons( { .. }, { .. } );
- *
- * @param {Object|Array...} [buttons] An array of button objects or the first
- * button object in a list of variadic arguments.
- */
- addButtons: function ( buttons ) {
- if ( !$.isArray( buttons ) ) {
- buttons = slice.call( arguments );
- }
- if ( isReady ) {
- $.each( buttons, function () {
- insertButton( this );
- } );
- } else {
- // Push each button into the queue
- queue.push.apply( queue, buttons );
- }
- },
-
- /**
- * Apply tagOpen/tagClose to selection in currently focused textarea.
- *
- * Uses `sampleText` if selection is empty.
- *
- * @param {string} tagOpen
- * @param {string} tagClose
- * @param {string} sampleText
- */
- insertTags: function ( tagOpen, tagClose, sampleText ) {
- if ( $currentFocused && $currentFocused.length ) {
- $currentFocused.textSelection(
- 'encapsulateSelection', {
- pre: tagOpen,
- peri: sampleText,
- post: tagClose
- }
- );
- }
- },
-
- // For backwards compatibility,
- // Called from EditPage.php, maybe in other places as well.
- init: function () {}
- };
-
- // Legacy (for compatibility with the code previously in skins/common.edit.js)
- mw.log.deprecate( window, 'addButton', toolbar.addButton, 'Use mw.toolbar.addButton instead.' );
- mw.log.deprecate( window, 'insertTags', toolbar.insertTags, 'Use mw.toolbar.insertTags instead.' );
-
- // Expose API publicly
- mw.toolbar = toolbar;
-
- $( function () {
- var i, b, editBox, scrollTop, $editForm;
-
- // Used to determine where to insert tags
- $currentFocused = $( '#wpTextbox1' );
-
- // Populate the selector cache for $toolbar
- $toolbar = $( '#toolbar' );
-
- for ( i = 0; i < queue.length; i++ ) {
- b = queue[i];
- if ( $.isArray( b ) ) {
- // Forwarded arguments array from mw.toolbar.addButton
- insertButton.apply( toolbar, b );
- } else {
- // Raw object from mw.toolbar.addButtons
- insertButton( b );
- }
- }
-
- // Clear queue
- queue.length = 0;
-
- // This causes further calls to addButton to go to insertion directly
- // instead of to the queue.
- // It is important that this is after the one and only loop through
- // the the queue
- isReady = true;
-
- // Make sure edit summary does not exceed byte limit
- $( '#wpSummary' ).byteLimit( 255 );
-
- // Restore the edit box scroll state following a preview operation,
- // and set up a form submission handler to remember this state.
- editBox = document.getElementById( 'wpTextbox1' );
- scrollTop = document.getElementById( 'wpScrolltop' );
- $editForm = $( '#editform' );
- if ( $editForm.length && editBox && scrollTop ) {
- if ( scrollTop.value ) {
- editBox.scrollTop = scrollTop.value;
- }
- $editForm.submit( function () {
- scrollTop.value = editBox.scrollTop;
- } );
- }
-
- // Apply to dynamically created textboxes as well as normal ones
- $( document ).on( 'focus', 'textarea, input:text', function () {
- $currentFocused = $( this );
- } );
- } );
-
-}( mediaWiki, jQuery ) );
+} );
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js
index 6b212c28..f24703af 100644
--- a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js
@@ -8,17 +8,29 @@
* @param {jQuery.Event} e
*/
function doLivePreview( e ) {
- var $wikiPreview, $editform, copySelectors, $copyElements, $spinner,
- targetUrl, postData, $previewDataHolder;
-
- e.preventDefault();
-
- // Deprecated: Use mw.hook instead
- $( mw ).trigger( 'LivePreviewPrepare' );
+ var isDiff, api, request, postData, copySelectors, section,
+ $wikiPreview, $wikiDiff, $editform, $textbox, $summary, $copyElements, $spinner, $errorBox;
+ isDiff = ( e.target.name === 'wpDiff' );
$wikiPreview = $( '#wikiPreview' );
+ $wikiDiff = $( '#wikiDiff' );
$editform = $( '#editform' );
+ $textbox = $editform.find( '#wpTextbox1' );
+ $summary = $editform.find( '#wpSummary' );
+ $errorBox = $( '.errorbox' );
+ section = $editform.find( '[name="wpSection"]' ).val();
+
+ if ( $textbox.length === 0 ) {
+ return;
+ }
+ // Show changes for a new section is not yet supported
+ if ( isDiff && section === 'new' ) {
+ return;
+ }
+ e.preventDefault();
+ // Remove any previously displayed errors
+ $errorBox.remove();
// Show #wikiPreview if it's hidden to be able to scroll to it
// (if it is hidden, it's also empty, so nothing changes in the rendering)
$wikiPreview.show();
@@ -26,15 +38,12 @@
// Jump to where the preview will appear
$wikiPreview[0].scrollIntoView();
- // List of selectors matching elements that we will
- // update from from the ajax-loaded preview page.
copySelectors = [
// Main
'#firstHeading',
'#wikiPreview',
'#wikiDiff',
'#catlinks',
- '.hiddencats',
'#p-lang',
// Editing-related
'.templatesUsed',
@@ -59,70 +68,184 @@
// (e.g. empty #catlinks)
$copyElements.animate( { opacity: 0.4 }, 'fast' );
- $previewDataHolder = $( '<div>' );
- targetUrl = $editform.attr( 'action' );
- targetUrl += targetUrl.indexOf( '?' ) !== -1 ? '&' : '?';
- targetUrl += $.param( {
- debug: mw.config.get( 'debug' ),
+ api = new mw.Api();
+ postData = {
+ action: 'parse',
uselang: mw.config.get( 'wgUserLanguage' ),
- useskin: mw.config.get( 'skin' )
- } );
+ title: mw.config.get( 'wgPageName' ),
+ text: $textbox.textSelection( 'getContents' ),
+ summary: $summary.textSelection( 'getContents' )
+ };
- // Gather all the data from the form
- postData = $editform.formToArray();
- postData.push( {
- name: e.target.name,
- value: ''
- } );
+ if ( section !== '' ) {
+ postData.sectionpreview = '';
+ if ( section === 'new' ) {
+ postData.section = section;
+ postData.sectiontitle = postData.summary;
+ }
+ }
- // Load new preview data.
- // TODO: This should use the action=parse API instead of loading the entire page,
- // although that requires figuring out how to convert that raw data into proper HTML.
- $previewDataHolder.load( targetUrl + ' ' + copySelectors.join( ',' ), postData, function () {
- var i, $from, $next, $parent;
+ if ( isDiff ) {
+ $wikiPreview.hide();
- // Copy the contents of the specified elements from the loaded page to the real page.
- // Also copy their class attributes.
- for ( i = 0; i < copySelectors.length; i++ ) {
- $from = $previewDataHolder.find( copySelectors[i] );
+ // First PST the input, then diff it
+ postData.onlypst = '';
+ request = api.post( postData );
+ request.done( function ( response ) {
+ var postData;
+ postData = {
+ action: 'query',
+ indexpageids: '',
+ prop: 'revisions',
+ titles: mw.config.get( 'wgPageName' ),
+ rvdifftotext: response.parse.text['*'],
+ rvprop: ''
+ };
+ if ( section !== '' ) {
+ postData.rvsection = section;
+ }
+ return api.post( postData ).done( function ( result2 ) {
+ try {
+ var diffHtml = result2.query.pages[result2.query.pageids[0]]
+ .revisions[0].diff['*'];
+ $wikiDiff.find( 'table.diff tbody' ).html( diffHtml );
+ } catch ( e ) {
+ // "result.blah is undefined" error, ignore
+ mw.log.warn( e );
+ }
+ $wikiDiff.show();
+ } );
+ } );
+ } else {
+ $wikiDiff.hide();
+ $.extend( postData, {
+ pst: '',
+ preview: '',
+ prop: 'text|displaytitle|modules|categorieshtml|templates|langlinks|limitreporthtml',
+ disableeditsection: true
+ } );
+ request = api.post( postData );
+ request.done( function ( response ) {
+ var li, newList, $displaytitle, $content, $parent, $list;
+ if ( response.parse.modules ) {
+ mw.loader.load( response.parse.modules.concat(
+ response.parse.modulescripts,
+ response.parse.modulestyles,
+ response.parse.modulemessages ) );
+ }
+ if ( response.parse.displaytitle ) {
+ $displaytitle = $( $.parseHTML( response.parse.displaytitle ) );
+ $( '#firstHeading' ).msg(
+ mw.config.get( 'wgEditMessage', 'editing' ),
+ $displaytitle
+ );
+ document.title = mw.msg(
+ 'pagetitle',
+ mw.msg(
+ mw.config.get( 'wgEditMessage', 'editing' ),
+ $displaytitle.text()
+ )
+ );
+ }
+ if ( response.parse.categorieshtml ) {
+ $( '#catlinks' ).replaceWith( response.parse.categorieshtml['*'] );
+ }
+ if ( response.parse.templates ) {
+ newList = [];
+ $.each( response.parse.templates, function ( i, template ) {
+ li = $( '<li>' )
+ .append( $( '<a>' )
+ .attr( {
+ 'href': mw.util.getUrl( template['*'] ),
+ 'class': ( template.exists !== undefined ? '' : 'new' )
+ } )
+ .text( template['*'] )
+ );
+ newList.push( li );
+ } );
- if ( copySelectors[i] === '#wikiPreview' ) {
- $next = $wikiPreview.next();
- // If there is no next node, use parent instead.
- // Only query parent if needed, false otherwise.
- $parent = !$next.length && $wikiPreview.parent();
+ $editform.find( '.templatesUsed .mw-editfooter-list' ).detach().empty().append( newList ).appendTo( '.templatesUsed' );
+ }
+ if ( response.parse.limitreporthtml ) {
+ $( '.limitreport' ).html( response.parse.limitreporthtml['*'] );
+ }
+ if ( response.parse.langlinks && mw.config.get( 'skin' ) === 'vector' ) {
+ newList = [];
+ $.each( response.parse.langlinks, function ( i, langlink ) {
+ li = $( '<li>' )
+ .addClass( 'interlanguage-link interwiki-' + langlink.lang )
+ .append( $( '<a>' )
+ .attr( {
+ 'href': langlink.url,
+ 'title': langlink['*'] + ' - ' + langlink.langname,
+ 'lang': langlink.lang,
+ 'hreflang': langlink.lang
+ } )
+ .text( langlink.autonym )
+ );
+ newList.push( li );
+ } );
+ $list = $( '#p-lang ul' );
+ $parent = $list.parent();
+ $list.detach().empty().append( newList ).prependTo( $parent );
+ }
- $wikiPreview
+ if ( response.parse.text['*'] ) {
+ $content = $wikiPreview.children( '.mw-content-ltr,.mw-content-rtl' );
+ $content
.detach()
- .empty()
- .append( $from.contents() )
- .attr( 'class', $from.attr( 'class' ) );
+ .html( response.parse.text['*'] );
- mw.hook( 'wikipage.content' ).fire( $wikiPreview );
+ mw.hook( 'wikipage.content' ).fire( $content );
// Reattach
- if ( $parent ) {
- $parent.append( $wikiPreview );
- } else {
- $next.before( $wikiPreview );
- }
+ $wikiPreview.append( $content );
+
+ $wikiPreview.show();
- } else {
- $( copySelectors[i] )
- .empty()
- .append( $from.contents() )
- .attr( 'class', $from.attr( 'class' ) );
}
+ } );
+ }
+ request.done( function ( response ) {
+ var isSubject = ( section === 'new' ),
+ summaryMsg = isSubject ? 'subject-preview' : 'summary-preview';
+ if ( response.parse.parsedsummary ) {
+ $editform.find( '.mw-summary-preview' )
+ .empty()
+ .append(
+ mw.message( summaryMsg ).parse(),
+ ' ',
+ $( '<span>' ).addClass( 'comment' ).html(
+ // There is no equivalent to rawParams
+ mw.message( 'parentheses' ).escaped()
+ .replace( '$1', response.parse.parsedsummary['*'] )
+ )
+ );
}
-
- // Deprecated: Use mw.hook instead
- $( mw ).trigger( 'LivePreviewDone', [copySelectors] );
-
+ } );
+ request.always( function () {
$spinner.remove();
$copyElements.animate( {
opacity: 1
}, 'fast' );
} );
+ request.fail( function ( code, result ) {
+ var errorMsg = 'API error: ' + code;
+ if ( code === 'http' ) {
+ errorMsg = 'HTTP error: ';
+ if ( result.exception ) {
+ errorMsg += result.exception;
+ } else {
+ errorMsg += result.textStatus;
+ }
+ }
+ $errorBox = $( '<div>' )
+ .addClass( 'errorbox' )
+ .html( '<strong>' + mw.message( 'previewerrortext' ).escaped() + '</strong><br>' )
+ .append( document.createTextNode( errorMsg ) );
+ $wikiDiff.hide();
+ $wikiPreview.hide().before( $errorBox );
+ } );
}
$( function () {
@@ -138,21 +261,33 @@
// have to fish and (hopefully) put them in the right place (since skins
// can change where they are output).
- if ( !document.getElementById( 'p-lang' ) && document.getElementById( 'p-tb' ) ) {
- $( '#p-tb' ).after(
- $( '<div>' ).attr( 'id', 'p-lang' )
+ if ( !document.getElementById( 'p-lang' ) && document.getElementById( 'p-tb' ) && mw.config.get( 'skin' ) === 'vector' ) {
+ $( '.portal:last' ).after(
+ $( '<div>' ).attr( {
+ 'class': 'portal',
+ 'id': 'p-lang',
+ 'role': 'navigation',
+ 'title': mw.msg( 'tooltip-p-lang' ),
+ 'aria-labelledby': 'p-lang-label'
+ } )
+ .append( $( '<h3>' ).attr( 'id', 'p-lang-label' ).text( mw.msg( 'otherlanguages' ) ) )
+ .append( $( '<div>' ).addClass( 'body' ).append( '<ul>' ) )
);
}
if ( !$( '.mw-summary-preview' ).length ) {
- $( '.editCheckboxes' ).before(
+ $( '#wpSummary' ).after(
$( '<div>' ).addClass( 'mw-summary-preview' )
);
}
if ( !document.getElementById( 'wikiDiff' ) && document.getElementById( 'wikiPreview' ) ) {
$( '#wikiPreview' ).after(
- $( '<div>' ).attr( 'id', 'wikiDiff' )
+ $( '<div>' )
+ .hide()
+ .attr( 'id', 'wikiDiff' )
+ .html( '<table class="diff"><col class="diff-marker"/><col class="diff-content"/>' +
+ '<col class="diff-marker"/><col class="diff-content"/><tbody/></table>' )
);
}
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.stash.js b/resources/src/mediawiki.action/mediawiki.action.edit.stash.js
new file mode 100644
index 00000000..29c533d8
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.stash.js
@@ -0,0 +1,76 @@
+/*!
+ * Scripts for pre-emptive edit preparing on action=edit
+ */
+( function ( mw, $ ) {
+ $( function () {
+ var idleTimeout = 4000,
+ api = new mw.Api(),
+ pending = null,
+ $form = $( '#editform' ),
+ $text = $form.find( '#wpTextbox1' ),
+ data = {},
+ timer = null;
+
+ function stashEdit( token ) {
+ data = $form.serializeObject();
+
+ pending = api.post( {
+ action: 'stashedit',
+ token: token,
+ title: mw.config.get( 'wgPageName' ),
+ section: data.wpSection,
+ sectiontitle: '',
+ text: data.wpTextbox1,
+ contentmodel: data.model,
+ contentformat: data.format,
+ baserevid: data.parentRevId
+ } );
+ }
+
+ /* Has the edit body text changed since the last stashEdit() call? */
+ function isChanged() {
+ // Normalize line endings to CRLF, like $.fn.serializeObject does.
+ var newText = $text.val().replace( /\r?\n/g, '\r\n' );
+ return newText !== data.wpTextbox1;
+ }
+
+ function onEditChanged() {
+ if ( !isChanged() ) {
+ return;
+ }
+
+ // If a request is in progress, abort it; its payload is stale.
+ if ( pending ) {
+ pending.abort();
+ }
+
+ api.getToken( 'edit' ).then( stashEdit );
+ }
+
+ function onKeyPress( e ) {
+ // Ignore keystrokes that don't modify text, like cursor movements.
+ // See <http://stackoverflow.com/q/2284844>.
+ if ( e.which === 0 ) {
+ return;
+ }
+
+ clearTimeout( timer );
+
+ if ( pending ) {
+ pending.abort();
+ }
+
+ timer = setTimeout( onEditChanged, idleTimeout );
+ }
+
+ // We don't attempt to stash new section edits because in such cases
+ // the parser output varies on the edit summary (since it determines
+ // the new section's name).
+ if ( $form.find( 'input[name=wpSection]' ).val() === 'new' ) {
+ return;
+ }
+
+ $text.on( { change: onEditChanged, keypress: onKeyPress } );
+
+ } );
+}( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.styles.css b/resources/src/mediawiki.action/mediawiki.action.edit.styles.css
index 7148b964..4209aa1f 100644
--- a/resources/src/mediawiki.action/mediawiki.action.edit.styles.css
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.styles.css
@@ -8,14 +8,6 @@
display: block;
}
-.editOptions {
- background-color: #F0F0F0;
- border: 1px solid silver;
- border-top: none;
- padding: 1em 1em 1.5em 1em;
- margin-bottom: 2em;
-}
-
/* Adjustments to edit form elements */
.editCheckboxes {
margin-bottom: 1em;
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_bold.png
deleted file mode 100644
index e524f6cb..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_bold.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_headline.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_headline.png
deleted file mode 100644
index 398e5614..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_headline.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_italic.png
deleted file mode 100644
index 6ec73e9e..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_italic.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_link.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_link.png
deleted file mode 100644
index c9c63f6c..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_link.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_nowiki.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_nowiki.png
deleted file mode 100644
index 743ea61b..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_nowiki.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_bold.png
deleted file mode 100644
index 5c10cfe2..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_bold.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_italic.png
deleted file mode 100644
index 72209d74..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_italic.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_link.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_link.png
deleted file mode 100644
index 09c86fb1..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_link.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_bold.png
deleted file mode 100644
index 367d5bc1..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_bold.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_italic.png
deleted file mode 100644
index fdd8c9f9..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_italic.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_bold.png
deleted file mode 100644
index 75c3f109..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_bold.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_extlink.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_extlink.png
deleted file mode 100644
index 458943c1..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_extlink.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_headline.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_headline.png
deleted file mode 100644
index 9cf751d9..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_headline.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_hr.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_hr.png
deleted file mode 100644
index 47e1ca40..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_hr.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_image.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_image.png
deleted file mode 100644
index 69192965..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_image.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_italic.png
deleted file mode 100644
index 527fbd14..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_italic.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_link.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_link.png
deleted file mode 100644
index eb5634b9..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_link.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_media.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_media.png
deleted file mode 100644
index 4194ec18..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_media.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_nowiki.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_nowiki.png
deleted file mode 100644
index 2ba818de..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_nowiki.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_sig.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_sig.png
deleted file mode 100644
index fe34b3fb..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_sig.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_bold.png
deleted file mode 100644
index c54d094c..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_bold.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_headline.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_headline.png
deleted file mode 100644
index 9890d155..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_headline.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_italic.png
deleted file mode 100644
index 33f91ed6..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_italic.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_link.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_link.png
deleted file mode 100644
index 76b939e6..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_link.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_nowiki.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_nowiki.png
deleted file mode 100644
index 743ea61b..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_nowiki.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/LICENSE b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/LICENSE
deleted file mode 100644
index 47ecfe4e..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/LICENSE
+++ /dev/null
@@ -1,7 +0,0 @@
-
-button_italic.png
--------------------
-Source : http://commons.wikimedia.org/wiki/Image:Button_S_italic.png
-License: Public domain
-Author : Purodha Blissenbach, http://ksh.wikipedia.org/wiki/User:Purodha
-
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/button_italic.png
deleted file mode 100644
index 15496c08..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/button_italic.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/LICENSE b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/LICENSE
deleted file mode 100644
index bedcec66..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/LICENSE
+++ /dev/null
@@ -1,17 +0,0 @@
-button_bold.png
----------------
-Source : http://commons.wikimedia.org/wiki/Image:Button_bold_ukr.png
-License: Public domain
-Author : Alexey Belomoev
-
-button_italic.png
-------------------------
-Source : http://commons.wikimedia.org/wiki/Image:Button_italic_ukr.png
-License: Public domain
-Author : Alexey Belomoev
-
-button_link.png
------------------
-Source : http://commons.wikimedia.org/wiki/Image:Button_internal_link_ukr.png
-License: GPL
-Author : Saproj, Erik Möller
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_bold.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_bold.png
deleted file mode 100644
index eae30d98..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_bold.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_italic.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_italic.png
deleted file mode 100644
index b958d220..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_italic.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_link.png b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_link.png
deleted file mode 100644
index 12ad3731..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_link.png
+++ /dev/null
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less
deleted file mode 100644
index d65b2842..00000000
--- a/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less
+++ /dev/null
@@ -1,42 +0,0 @@
-@import "mediawiki.mixins";
-
-#mw-editbutton-bold {
- .background-image("images/@{button-bold}");
-}
-
-#mw-editbutton-italic {
- .background-image("images/@{button-italic}");
-}
-
-#mw-editbutton-link {
- .background-image("images/@{button-link}");
-}
-
-#mw-editbutton-extlink {
- .background-image("images/@{button-extlink}");
-}
-
-#mw-editbutton-headline {
- .background-image("images/@{button-headline}");
-}
-
-#mw-editbutton-image {
- .background-image("images/@{button-image}");
-}
-
-#mw-editbutton-media {
- .background-image("images/@{button-media}");
-}
-
-#mw-editbutton-nowiki {
- .background-image("images/@{button-nowiki}");
-}
-
-// Who decided to make only this single one different than the name of the data item?
-#mw-editbutton-signature {
- .background-image("images/@{button-sig}");
-}
-
-#mw-editbutton-hr {
- .background-image("images/@{button-hr}");
-}
diff --git a/resources/src/mediawiki.action/mediawiki.action.history.diff.css b/resources/src/mediawiki.action/mediawiki.action.history.diff.css
index afe92468..0887476e 100644
--- a/resources/src/mediawiki.action/mediawiki.action.history.diff.css
+++ b/resources/src/mediawiki.action/mediawiki.action.history.diff.css
@@ -1,8 +1,7 @@
-/*
-** Diff rendering
-*/
+/*!
+ * Diff rendering
+ */
table.diff {
- background-color: white;
border: none;
border-spacing: 4px;
margin: 0;
diff --git a/resources/src/mediawiki.action/mediawiki.action.history.diff.print.css b/resources/src/mediawiki.action/mediawiki.action.history.diff.print.css
new file mode 100644
index 00000000..76b5c9b7
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.history.diff.print.css
@@ -0,0 +1,16 @@
+/*!
+ * Diff rendering
+ */
+td.diff-context,
+td.diff-addedline .diffchange,
+td.diff-deletedline .diffchange {
+ background-color: transparent;
+}
+
+td.diff-addedline .diffchange {
+ text-decoration: underline;
+}
+
+td.diff-deletedline .diffchange {
+ text-decoration: line-through;
+}
diff --git a/resources/src/mediawiki.action/mediawiki.action.history.js b/resources/src/mediawiki.action/mediawiki.action.history.js
index ac48c596..2ebfe921 100644
--- a/resources/src/mediawiki.action/mediawiki.action.history.js
+++ b/resources/src/mediawiki.action/mediawiki.action.history.js
@@ -85,7 +85,8 @@ jQuery( function ( $ ) {
$copyForm.find( 'input[name^="ids["]:checked' ).prop( 'checked', false );
// Remove diff=&oldid=, change action=historysubmit to revisiondelete, remove revisiondelete
- } else if ( $historySubmitter.hasClass( 'mw-history-revisiondelete-button' ) ) {
+ } else if ( $historySubmitter.hasClass( 'mw-history-revisiondelete-button' ) ||
+ $historySubmitter.hasClass( 'mw-history-editchangetags-button' ) ) {
$copyRadios.remove();
$copyAction.val( $historySubmitter.attr( 'name' ) );
$copyForm.find( ':submit' ).remove();
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.categoryPage.less b/resources/src/mediawiki.action/mediawiki.action.view.categoryPage.less
new file mode 100644
index 00000000..387b0207
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.view.categoryPage.less
@@ -0,0 +1,11 @@
+@import "mediawiki.mixins";
+
+.mw-category {
+ .column-count(3);
+ .column-width(24em);
+ .mw-category-group {
+ li {
+ .column-break-inside-avoid;
+ }
+ }
+}
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
index 2ded40cf..2be29f09 100644
--- a/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
+++ b/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
@@ -4,9 +4,16 @@
( function ( mw, $ ) {
$( function () {
mw.util.$content.dblclick( function ( e ) {
- e.preventDefault();
- // Trigger native HTMLElement click instead of opening URL (bug 43052)
- $( '#ca-edit a' ).get( 0 ).click();
+ // Recheck preference so extensions can do a hack to disable this code.
+ if ( parseInt( mw.user.options.get( 'editondblclick' ), 10 ) ) {
+ e.preventDefault();
+ // Trigger native HTMLElement click instead of opening URL (bug 43052)
+ var $a = $( '#ca-edit a' );
+ // Not every page has an edit link (bug 57713)
+ if ( $a.length ) {
+ $a.get( 0 ).click();
+ }
+ }
} );
} );
}( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.metadata.css b/resources/src/mediawiki.action/mediawiki.action.view.metadata.css
index 2c8d2e65..9f786ecb 100644
--- a/resources/src/mediawiki.action/mediawiki.action.view.metadata.css
+++ b/resources/src/mediawiki.action/mediawiki.action.view.metadata.css
@@ -4,3 +4,13 @@
table.collapsed tr.collapsable {
display: none;
}
+
+/*
+ * Exclude user interface elements from selection.
+ */
+.mw-metadata-show-hide-extended {
+ -moz-user-select: none;
+ -webkit-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js
index 4d2c47a5..c008dfd8 100644
--- a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js
+++ b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js
@@ -30,14 +30,7 @@
data.message = $.parseHTML( mw.message( 'postedit-confirmation-saved', data.user || mw.user ).escaped() );
}
- $div = $(
- '<div class="postedit-container">' +
- '<div class="postedit">' +
- '<div class="postedit-icon postedit-icon-checkmark postedit-content"></div>' +
- '<a href="#" class="postedit-close">&times;</a>' +
- '</div>' +
- '</div>'
- );
+ $div = mw.template.get( 'mediawiki.action.view.postEdit', 'postEdit.html' ).render();
if ( typeof data.message === 'string' ) {
$div.find( '.postedit-content' ).text( data.message );
@@ -83,4 +76,4 @@
mw.cookie.set( cookieKey, null );
}
-} ( mediaWiki, jQuery ) );
+}( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.redirect.js b/resources/src/mediawiki.action/mediawiki.action.view.redirect.js
index 52e0d4e3..e66d8f69 100644
--- a/resources/src/mediawiki.action/mediawiki.action.view.redirect.js
+++ b/resources/src/mediawiki.action/mediawiki.action.view.redirect.js
@@ -11,9 +11,6 @@
fragment = null,
shouldChangeFragment, index;
- // Clear internal mw.config entries, so that no one tries to depend on them
- mw.config.set( 'wgInternalRedirectTargetUrl', null );
-
index = canonical.indexOf( '#' );
if ( index !== -1 ) {
fragment = canonical.slice( index );
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.redirectPage.css b/resources/src/mediawiki.action/mediawiki.action.view.redirectPage.css
index fdbb655f..a92f1c16 100644
--- a/resources/src/mediawiki.action/mediawiki.action.view.redirectPage.css
+++ b/resources/src/mediawiki.action/mediawiki.action.view.redirectPage.css
@@ -24,15 +24,21 @@
margin: 0;
padding: 0;
padding-left: 42px;
+ background: transparent url(images/nextredirect-ltr.png) bottom left no-repeat;
/* @embed */
- background: url(images/nextredirect-ltr.png) bottom left no-repeat;
+ background-image: -webkit-linear-gradient(transparent, transparent), url(images/nextredirect-ltr.svg);
+ /* @embed */
+ background-image: linear-gradient(transparent, transparent), url(images/nextredirect-ltr.svg);
}
/* @noflip */
.mw-content-ltr .redirectText li:first-child {
padding-left: 47px;
+ background: transparent url(images/redirect-ltr.png) bottom left no-repeat;
+ /* @embed */
+ background-image: -webkit-linear-gradient(transparent, transparent), url(images/redirect-ltr.svg);
/* @embed */
- background: url(images/redirect-ltr.png) bottom left no-repeat;
+ background-image: linear-gradient(transparent, transparent), url(images/redirect-ltr.svg);
}
/* @noflip */
@@ -41,13 +47,19 @@
margin: 0;
padding: 0;
padding-right: 42px;
+ background: transparent url(images/nextredirect-rtl.png) bottom right no-repeat;
/* @embed */
- background: url(images/nextredirect-rtl.png) bottom right no-repeat;
+ background-image: -webkit-linear-gradient(transparent, transparent), url(images/nextredirect-rtl.svg);
+ /* @embed */
+ background-image: linear-gradient(transparent, transparent), url(images/nextredirect-rtl.svg);
}
/* @noflip */
.mw-content-rtl .redirectText li:first-child {
padding-right: 47px;
+ background: transparent url(images/redirect-rtl.png) bottom right no-repeat;
+ /* @embed */
+ background-image: -webkit-linear-gradient(transparent, transparent), url(images/redirect-rtl.svg);
/* @embed */
- background: url(images/redirect-rtl.png) bottom right no-repeat;
+ background-image: linear-gradient(transparent, transparent), url(images/redirect-rtl.svg);
}
diff --git a/resources/src/mediawiki.action/templates/postEdit.html b/resources/src/mediawiki.action/templates/postEdit.html
new file mode 100644
index 00000000..dbb482a6
--- /dev/null
+++ b/resources/src/mediawiki.action/templates/postEdit.html
@@ -0,0 +1,6 @@
+<div class="postedit-container">
+ <div class="postedit">
+ <div class="postedit-icon postedit-icon-checkmark postedit-content"></div>
+ <a href="#" class="postedit-close">&times;</a>
+ </div>
+</div>