summaryrefslogtreecommitdiff
path: root/resources/src/mediawiki.action
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /resources/src/mediawiki.action
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'resources/src/mediawiki.action')
-rw-r--r--resources/src/mediawiki.action/images/green-checkmark.pngbin0 -> 681 bytes
-rw-r--r--resources/src/mediawiki.action/images/nextredirect-ltr.pngbin0 -> 121 bytes
-rw-r--r--resources/src/mediawiki.action/images/nextredirect-rtl.pngbin0 -> 121 bytes
-rw-r--r--resources/src/mediawiki.action/images/redirect-ltr.pngbin0 -> 128 bytes
-rw-r--r--resources/src/mediawiki.action/images/redirect-rtl.pngbin0 -> 132 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.css17
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.js54
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.css18
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js59
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.js217
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.preview.js165
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.styles.css44
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_bold.pngbin0 -> 533 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_headline.pngbin0 -> 484 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_italic.pngbin0 -> 532 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_link.pngbin0 -> 557 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_nowiki.pngbin0 -> 874 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_bold.pngbin0 -> 550 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_italic.pngbin0 -> 539 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_link.pngbin0 -> 419 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_bold.pngbin0 -> 255 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_italic.pngbin0 -> 260 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_bold.pngbin0 -> 250 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_extlink.pngbin0 -> 435 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_headline.pngbin0 -> 440 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_hr.pngbin0 -> 200 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_image.pngbin0 -> 483 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_italic.pngbin0 -> 250 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_link.pngbin0 -> 280 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_media.pngbin0 -> 728 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_nowiki.pngbin0 -> 322 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_sig.pngbin0 -> 920 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_bold.pngbin0 -> 459 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_headline.pngbin0 -> 392 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_italic.pngbin0 -> 512 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_link.pngbin0 -> 485 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_nowiki.pngbin0 -> 874 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.pngbin0 -> 368 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.pngbin0 -> 254 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_italic.pngbin0 -> 423 bytes
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_link.pngbin0 -> 278 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.css4
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.history.diff.css96
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.history.js111
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js12
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.metadata.css6
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.metadata.js45
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.postEdit.css76
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.postEdit.js86
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.redirect.js65
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.redirectPage.css53
-rw-r--r--resources/src/mediawiki.action/mediawiki.action.view.rightClickEdit.js26
55 files changed, 1220 insertions, 0 deletions
diff --git a/resources/src/mediawiki.action/images/green-checkmark.png b/resources/src/mediawiki.action/images/green-checkmark.png
new file mode 100644
index 00000000..8ec604ea
--- /dev/null
+++ b/resources/src/mediawiki.action/images/green-checkmark.png
Binary files differ
diff --git a/resources/src/mediawiki.action/images/nextredirect-ltr.png b/resources/src/mediawiki.action/images/nextredirect-ltr.png
new file mode 100644
index 00000000..cd657c33
--- /dev/null
+++ b/resources/src/mediawiki.action/images/nextredirect-ltr.png
Binary files differ
diff --git a/resources/src/mediawiki.action/images/nextredirect-rtl.png b/resources/src/mediawiki.action/images/nextredirect-rtl.png
new file mode 100644
index 00000000..b788f334
--- /dev/null
+++ b/resources/src/mediawiki.action/images/nextredirect-rtl.png
Binary files differ
diff --git a/resources/src/mediawiki.action/images/redirect-ltr.png b/resources/src/mediawiki.action/images/redirect-ltr.png
new file mode 100644
index 00000000..695f2a13
--- /dev/null
+++ b/resources/src/mediawiki.action/images/redirect-ltr.png
Binary files differ
diff --git a/resources/src/mediawiki.action/images/redirect-rtl.png b/resources/src/mediawiki.action/images/redirect-rtl.png
new file mode 100644
index 00000000..c954a2ad
--- /dev/null
+++ b/resources/src/mediawiki.action/images/redirect-rtl.png
Binary files differ
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.css b/resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.css
new file mode 100644
index 00000000..1af4a7a0
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.css
@@ -0,0 +1,17 @@
+/* Styles for collapsible lists of templates used and hidden categories */
+.mw-editfooter-toggler {
+ cursor: pointer;
+ background-position: left center;
+ padding-left: 16px;
+}
+
+.mw-editfooter-list {
+ margin-bottom: 1em;
+ margin-left: 2.5em;
+}
+
+/* Show/hide animation is incorrect if the table has a margin set. Extra
+ * "table.wikitable" is needed in the selector for CSS specificity. */
+table.wikitable.preview-limit-report {
+ margin: 0;
+}
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.js b/resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.js
new file mode 100644
index 00000000..7ae51aba
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.js
@@ -0,0 +1,54 @@
+jQuery( document ).ready( function ( $ ) {
+ var collapsibleLists, i, handleOne;
+
+ // Collapsible lists of categories and templates
+ collapsibleLists = [
+ {
+ $list: $( '.templatesUsed ul' ),
+ $toggler: $( '.mw-templatesUsedExplanation' ),
+ cookieName: 'templates-used-list'
+ },
+ {
+ $list: $( '.hiddencats ul' ),
+ $toggler: $( '.mw-hiddenCategoriesExplanation' ),
+ cookieName: 'hidden-categories-list'
+ },
+ {
+ $list: $( '.preview-limit-report-wrapper' ),
+ $toggler: $( '.mw-limitReportExplanation' ),
+ cookieName: 'preview-limit-report'
+ }
+ ];
+
+ handleOne = function ( $list, $toggler, cookieName ) {
+ var isCollapsed = $.cookie( cookieName ) !== 'expanded';
+
+ // Style the toggler with an arrow icon and add a tabIndex and a role for accessibility
+ $toggler.addClass( 'mw-editfooter-toggler' ).prop( 'tabIndex', 0 ).attr( 'role', 'button' );
+ $list.addClass( 'mw-editfooter-list' );
+
+ $list.makeCollapsible( {
+ $customTogglers: $toggler,
+ linksPassthru: true,
+ plainMode: true,
+ collapsed: isCollapsed
+ } );
+
+ $toggler.addClass( isCollapsed ? 'mw-icon-arrow-collapsed' : 'mw-icon-arrow-expanded' );
+
+ $list.on( 'beforeExpand.mw-collapsible', function () {
+ $toggler.removeClass( 'mw-icon-arrow-collapsed' ).addClass( 'mw-icon-arrow-expanded' );
+ $.cookie( cookieName, 'expanded' );
+ } );
+
+ $list.on( 'beforeCollapse.mw-collapsible', function () {
+ $toggler.removeClass( 'mw-icon-arrow-expanded' ).addClass( 'mw-icon-arrow-collapsed' );
+ $.cookie( cookieName, 'collapsed' );
+ } );
+ };
+
+ for ( i = 0; i < collapsibleLists.length; i++ ) {
+ // Pass to a function for iteration-local variables
+ handleOne( collapsibleLists[i].$list, collapsibleLists[i].$toggler, collapsibleLists[i].cookieName );
+ }
+} );
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.css b/resources/src/mediawiki.action/mediawiki.action.edit.css
new file mode 100644
index 00000000..45ba5437
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.css
@@ -0,0 +1,18 @@
+/*!
+ * Styles for elements of the editing form, loaded only when JavaScript is enabled.
+ */
+
+.mw-toolbar-editbutton {
+ width: 23px;
+ height: 22px;
+ cursor: pointer;
+ vertical-align: middle;
+ /* Cross-browser inline-block */
+ /* Firefox 2 */
+ display: -moz-inline-block;
+ /* Modern browsers */
+ display: inline-block;
+ /* IE7 */
+ zoom: 1;
+ *display: inline;
+}
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js b/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js
new file mode 100644
index 00000000..b5654400
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.editWarning.js
@@ -0,0 +1,59 @@
+/*
+ * Javascript for module editWarning
+ */
+( function ( mw, $ ) {
+ 'use strict';
+
+ $( function () {
+ var savedWindowOnBeforeUnload,
+ $wpTextbox1 = $( '#wpTextbox1' ),
+ $wpSummary = $( '#wpSummary' );
+ // Check if EditWarning is enabled and if we need it
+ if ( $wpTextbox1.length === 0 ) {
+ return true;
+ }
+ // Get the original values of some form elements
+ $wpTextbox1.add( $wpSummary ).each( function () {
+ $( this ).data( 'origtext', $( this ).val() );
+ } );
+ $( 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' );
+ }
+
+ // 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;
+ }
+ } );
+
+ // Add form submission handler
+ $( '#editform' ).submit( function () {
+ // Unbind our handlers
+ $( window ).off( '.editwarning' );
+ } );
+ } );
+
+}( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.js b/resources/src/mediawiki.action/mediawiki.action.edit.js
new file mode 100644
index 00000000..4519b049
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.js
@@ -0,0 +1,217 @@
+/**
+ * Interface for the classic edit toolbar.
+ *
+ * @class mw.toolbar
+ * @singleton
+ */
+( 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'
+ } );
+ }
+
+ $button.click( function ( e ) {
+ if ( b.onClick !== undefined ) {
+ b.onClick( e );
+ } else {
+ toolbar.insertTags( b.tagOpen, b.tagClose, b.sampleText );
+ }
+
+ return false;
+ } );
+
+ $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
new file mode 100644
index 00000000..6b212c28
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js
@@ -0,0 +1,165 @@
+/*!
+ * Live edit preview.
+ */
+( function ( mw, $ ) {
+
+ /**
+ * @ignore
+ * @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' );
+
+ $wikiPreview = $( '#wikiPreview' );
+ $editform = $( '#editform' );
+
+ // 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();
+
+ // 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',
+ '.limitreport',
+ '.mw-summary-preview'
+ ];
+ $copyElements = $( copySelectors.join( ',' ) );
+
+ // Not shown during normal preview, to be removed if present
+ $( '.mw-newarticletext' ).remove();
+
+ $spinner = $.createSpinner( {
+ size: 'large',
+ type: 'block'
+ } );
+ $wikiPreview.before( $spinner );
+ $spinner.css( {
+ marginTop: $spinner.height()
+ } );
+
+ // Can't use fadeTo because it calls show(), and we might want to keep some elements hidden
+ // (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' ),
+ uselang: mw.config.get( 'wgUserLanguage' ),
+ useskin: mw.config.get( 'skin' )
+ } );
+
+ // Gather all the data from the form
+ postData = $editform.formToArray();
+ postData.push( {
+ name: e.target.name,
+ value: ''
+ } );
+
+ // 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;
+
+ // 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] );
+
+ 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();
+
+ $wikiPreview
+ .detach()
+ .empty()
+ .append( $from.contents() )
+ .attr( 'class', $from.attr( 'class' ) );
+
+ mw.hook( 'wikipage.content' ).fire( $wikiPreview );
+
+ // Reattach
+ if ( $parent ) {
+ $parent.append( $wikiPreview );
+ } else {
+ $next.before( $wikiPreview );
+ }
+
+ } else {
+ $( copySelectors[i] )
+ .empty()
+ .append( $from.contents() )
+ .attr( 'class', $from.attr( 'class' ) );
+ }
+ }
+
+ // Deprecated: Use mw.hook instead
+ $( mw ).trigger( 'LivePreviewDone', [copySelectors] );
+
+ $spinner.remove();
+ $copyElements.animate( {
+ opacity: 1
+ }, 'fast' );
+ } );
+ }
+
+ $( function () {
+ // Do not enable on user .js/.css pages, as there's no sane way of "previewing"
+ // the scripts or styles without reloading the page.
+ if ( $( '#mw-userjsyoucanpreview' ).length || $( '#mw-usercssyoucanpreview' ).length ) {
+ return;
+ }
+
+ // The following elements can change in a preview but are not output
+ // by the server when they're empty until the preview response.
+ // TODO: Make the server output these always (in a hidden state), so we don't
+ // 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 ( !$( '.mw-summary-preview' ).length ) {
+ $( '.editCheckboxes' ).before(
+ $( '<div>' ).addClass( 'mw-summary-preview' )
+ );
+ }
+
+ if ( !document.getElementById( 'wikiDiff' ) && document.getElementById( 'wikiPreview' ) ) {
+ $( '#wikiPreview' ).after(
+ $( '<div>' ).attr( 'id', 'wikiDiff' )
+ );
+ }
+
+ // This should be moved down to '#editform', but is kept on the body for now
+ // because the LiquidThreads extension is re-using this module with only half
+ // the EditPage (doesn't include #editform presumably, bug 55463).
+ $( document.body ).on( 'click', '#wpPreview, #wpDiff', doLivePreview );
+ } );
+
+}( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.styles.css b/resources/src/mediawiki.action/mediawiki.action.edit.styles.css
new file mode 100644
index 00000000..7148b964
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.styles.css
@@ -0,0 +1,44 @@
+/*!
+ * Styles for elements of the editing form.
+ */
+
+/* General layout */
+#wpTextbox1 {
+ margin: 0;
+ 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;
+}
+
+.editCheckboxes input:first-child {
+ margin-left: 0;
+}
+
+.cancelLink {
+ margin-left: 0.5em;
+}
+
+#editpage-copywarn {
+ font-size: 0.9em;
+}
+
+#wpSummary {
+ display: block;
+ margin-top: 0;
+ margin-bottom: 0.5em;
+}
+
+.editButtons input:first-child {
+ margin-left: .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
new file mode 100644
index 00000000..e524f6cb
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_bold.png
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
new file mode 100644
index 00000000..398e5614
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_headline.png
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
new file mode 100644
index 00000000..6ec73e9e
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_italic.png
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
new file mode 100644
index 00000000..c9c63f6c
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_link.png
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
new file mode 100644
index 00000000..743ea61b
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ar/button_nowiki.png
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
new file mode 100644
index 00000000..5c10cfe2
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_bold.png
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
new file mode 100644
index 00000000..72209d74
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_italic.png
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
new file mode 100644
index 00000000..09c86fb1
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/be-tarask/button_link.png
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
new file mode 100644
index 00000000..367d5bc1
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_bold.png
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
new file mode 100644
index 00000000..fdd8c9f9
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/de/button_italic.png
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
new file mode 100644
index 00000000..75c3f109
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_bold.png
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
new file mode 100644
index 00000000..458943c1
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_extlink.png
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
new file mode 100644
index 00000000..9cf751d9
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_headline.png
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
new file mode 100644
index 00000000..47e1ca40
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_hr.png
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
new file mode 100644
index 00000000..69192965
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_image.png
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
new file mode 100644
index 00000000..527fbd14
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_italic.png
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
new file mode 100644
index 00000000..eb5634b9
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_link.png
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
new file mode 100644
index 00000000..4194ec18
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_media.png
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
new file mode 100644
index 00000000..2ba818de
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_nowiki.png
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
new file mode 100644
index 00000000..fe34b3fb
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/en/button_sig.png
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
new file mode 100644
index 00000000..c54d094c
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_bold.png
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
new file mode 100644
index 00000000..9890d155
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_headline.png
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
new file mode 100644
index 00000000..33f91ed6
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_italic.png
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
new file mode 100644
index 00000000..76b939e6
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_link.png
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
new file mode 100644
index 00000000..743ea61b
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/fa/button_nowiki.png
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
new file mode 100644
index 00000000..47ecfe4e
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/LICENSE
@@ -0,0 +1,7 @@
+
+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
new file mode 100644
index 00000000..15496c08
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ksh/button_italic.png
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
new file mode 100644
index 00000000..bedcec66
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/LICENSE
@@ -0,0 +1,17 @@
+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
new file mode 100644
index 00000000..eae30d98
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_bold.png
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
new file mode 100644
index 00000000..b958d220
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_italic.png
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
new file mode 100644
index 00000000..12ad3731
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/images/ru/button_link.png
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
new file mode 100644
index 00000000..d65b2842
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.edit.toolbar/mediawiki.action.edit.toolbar.less
@@ -0,0 +1,42 @@
+@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.css b/resources/src/mediawiki.action/mediawiki.action.history.css
new file mode 100644
index 00000000..603a9657
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.history.css
@@ -0,0 +1,4 @@
+#pagehistory li.before input[name="oldid"],
+#pagehistory li.after input[name="diff"] {
+ visibility: hidden;
+}
diff --git a/resources/src/mediawiki.action/mediawiki.action.history.diff.css b/resources/src/mediawiki.action/mediawiki.action.history.diff.css
new file mode 100644
index 00000000..afe92468
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.history.diff.css
@@ -0,0 +1,96 @@
+/*
+** Diff rendering
+*/
+table.diff {
+ background-color: white;
+ border: none;
+ border-spacing: 4px;
+ margin: 0;
+ width: 100%;
+ /* Ensure that colums are of equal width */
+ table-layout: fixed;
+}
+
+table.diff td {
+ padding: 0.33em 0.5em;
+}
+
+table.diff td.diff-marker {
+ /* Compensate padding for increased font-size */
+ padding: 0.25em;
+}
+
+table.diff col.diff-marker {
+ width: 2%;
+}
+
+table.diff col.diff-content {
+ width: 48%;
+}
+
+table.diff td div {
+ /* Force-wrap very long lines such as URLs or page-widening char strings */
+ word-wrap: break-word;
+}
+
+td.diff-otitle,
+td.diff-ntitle {
+ text-align: center;
+}
+
+td.diff-lineno {
+ font-weight: bold;
+}
+
+td.diff-marker {
+ text-align: right;
+ font-weight: bold;
+ font-size: 1.25em;
+ line-height: 1.2;
+}
+
+td.diff-addedline,
+td.diff-deletedline,
+td.diff-context {
+ font-size: 88%;
+ line-height: 1.6;
+ vertical-align: top;
+ white-space: -moz-pre-wrap;
+ white-space: pre-wrap;
+ border-style: solid;
+ border-width: 1px 1px 1px 4px;
+ border-radius: 0.33em;
+}
+
+td.diff-addedline {
+ border-color: #a3d3ff;
+}
+
+td.diff-deletedline {
+ border-color: #ffe49c;
+}
+
+td.diff-context {
+ background: #f9f9f9;
+ border-color: #e6e6e6;
+ color: #333333;
+}
+
+.diffchange {
+ font-weight: bold;
+ text-decoration: none;
+}
+
+td.diff-addedline .diffchange,
+td.diff-deletedline .diffchange {
+ border-radius: 0.33em;
+ padding: 0.25em 0;
+}
+
+td.diff-addedline .diffchange {
+ background: #d8ecff;
+}
+
+td.diff-deletedline .diffchange {
+ background: #feeec8;
+}
diff --git a/resources/src/mediawiki.action/mediawiki.action.history.js b/resources/src/mediawiki.action/mediawiki.action.history.js
new file mode 100644
index 00000000..ac48c596
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.history.js
@@ -0,0 +1,111 @@
+/*!
+ * JavaScript for History action
+ */
+jQuery( function ( $ ) {
+ var $historyCompareForm = $( '#mw-history-compare' ),
+ $historySubmitter,
+ $lis = $( '#pagehistory > li' );
+
+ /**
+ * @ignore
+ * @context {Element} input
+ * @param e {jQuery.Event}
+ */
+ function updateDiffRadios() {
+ var nextState = 'before',
+ $li,
+ $inputs,
+ $oldidRadio,
+ $diffRadio;
+
+ if ( !$lis.length ) {
+ return true;
+ }
+
+ $lis
+ .each( function () {
+ $li = $( this );
+ $inputs = $li.find( 'input[type="radio"]' );
+ $oldidRadio = $inputs.filter( '[name="oldid"]' ).eq( 0 );
+ $diffRadio = $inputs.filter( '[name="diff"]' ).eq( 0 );
+
+ $li.removeClass( 'selected between before after' );
+
+ if ( !$oldidRadio.length || !$diffRadio.length ) {
+ return true;
+ }
+
+ if ( $oldidRadio.prop( 'checked' ) ) {
+ $li.addClass( 'selected after' );
+ nextState = 'after';
+ } else if ( $diffRadio.prop( 'checked' ) ) {
+ $li.addClass( 'selected ' + nextState );
+ nextState = 'between';
+ } else {
+ // This list item has neither checked
+ // apply the appropriate class following the previous item.
+ $li.addClass( nextState );
+ }
+ } );
+
+ return true;
+ }
+
+ $lis.find( 'input[name="diff"], input[name="oldid"]' ).click( updateDiffRadios );
+
+ // Set initial state
+ updateDiffRadios();
+
+ // Prettify url output for HistoryAction submissions,
+ // to cover up action=historysubmit construction.
+
+ // Ideally we'd use e.target instead of $historySubmitter, but e.target points
+ // to the form element for submit actions, so.
+ $historyCompareForm.find( '.historysubmit' ).click( function () {
+ $historySubmitter = $( this );
+ } );
+
+ // On submit we clone the form element, remove unneeded fields in the clone
+ // that pollute the query parameter with stuff from the other "use case",
+ // and then submit the clone.
+ // Without the cloning we'd be changing the real form, which is slower, could make
+ // the page look broken for a second in slow browsers and might show the form broken
+ // again when coming back from a "next" page.
+ $historyCompareForm.submit( function ( e ) {
+ var $copyForm, $copyRadios, $copyAction;
+
+ if ( $historySubmitter ) {
+ $copyForm = $historyCompareForm.clone();
+ $copyRadios = $copyForm.find( '#pagehistory > li' ).find( 'input[name="diff"], input[name="oldid"]' );
+ $copyAction = $copyForm.find( '> [name="action"]' );
+
+ // Remove action=historysubmit and ids[..]=..
+ if ( $historySubmitter.hasClass( 'mw-history-compareselectedversions-button' ) ) {
+ $copyAction.remove();
+ $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' ) ) {
+ $copyRadios.remove();
+ $copyAction.val( $historySubmitter.attr( 'name' ) );
+ $copyForm.find( ':submit' ).remove();
+ }
+
+ // IE7 doesn't do submission from an off-DOM clone, so insert hidden into document first
+ // Also remove potentially conflicting id attributes that we don't need anyway
+ $copyForm
+ .css( 'display', 'none' )
+ .find( '[id]' )
+ .removeAttr( 'id' )
+ .end()
+ .insertAfter( $historyCompareForm )
+ .submit();
+
+ e.preventDefault();
+ return false; // Because the submit is special, return false as well.
+ }
+
+ // Continue natural browser handling other wise
+ return true;
+ } );
+} );
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
new file mode 100644
index 00000000..2ded40cf
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
@@ -0,0 +1,12 @@
+/*!
+ * Enables double-click-to-edit functionality.
+ */
+( 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();
+ } );
+ } );
+}( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.metadata.css b/resources/src/mediawiki.action/mediawiki.action.view.metadata.css
new file mode 100644
index 00000000..2c8d2e65
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.view.metadata.css
@@ -0,0 +1,6 @@
+/*!
+ * Hide collapsable rows in a collapsed table.
+ */
+table.collapsed tr.collapsable {
+ display: none;
+}
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.metadata.js b/resources/src/mediawiki.action/mediawiki.action.view.metadata.js
new file mode 100644
index 00000000..25b5acc5
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.view.metadata.js
@@ -0,0 +1,45 @@
+/*!
+ * Exif metadata display for MediaWiki file uploads
+ *
+ * Add an expand/collapse link and collapse by default if set to
+ * (with JS disabled, user will see all items)
+ *
+ * See also ImagePage.php#makeMetadataTable (creates the HTML)
+ */
+( function ( mw, $ ) {
+ $( function () {
+ var $row, $col, $link,
+ showText = mw.msg( 'metadata-expand' ),
+ hideText = mw.msg( 'metadata-collapse' ),
+ $table = $( '#mw_metadata' ),
+ $tbody = $table.find( 'tbody' );
+
+ if ( !$tbody.length || !$tbody.find( '.collapsable' ).length ) {
+ return;
+ }
+
+ $row = $( '<tr class="mw-metadata-show-hide-extended"></tr>' );
+ $col = $( '<td colspan="2"></td>' );
+
+ $link = $( '<a>', {
+ text: showText,
+ href: '#'
+ } ).click( function () {
+ if ( $table.hasClass( 'collapsed' ) ) {
+ $( this ).text( hideText );
+ } else {
+ $( this ).text( showText );
+ }
+ $table.toggleClass( 'expanded collapsed' );
+ return false;
+ } );
+
+ $col.append( $link );
+ $row.append( $col );
+ $tbody.append( $row );
+
+ // And collapse!
+ $table.addClass( 'collapsed' );
+ } );
+
+}( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.css b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.css
new file mode 100644
index 00000000..db89990d
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.css
@@ -0,0 +1,76 @@
+.postedit-container {
+ margin: 0 auto;
+ position: fixed;
+ top: 0;
+ height: 0;
+ left: 50%;
+ z-index: 1000;
+ font-size: 13px;
+}
+
+.postedit-container:hover {
+ cursor: pointer;
+}
+
+.postedit {
+ position: relative;
+ top: 0.6em;
+ left: -50%;
+ padding: .6em 3.6em .6em 1.1em;
+ line-height: 1.5625em;
+ color: #626465;
+ background-color: #f4f4f4;
+ border: 1px solid #dcd9d9;
+ text-shadow: 0 0.0625em 0 rgba(255, 255, 255, 0.5);
+ border-radius: 5px;
+ box-shadow: 0 2px 5px 0 #ccc;
+ -webkit-transition: all 0.25s ease-in-out;
+ -moz-transition: all 0.25s ease-in-out;
+ -ms-transition: all 0.25s ease-in-out;
+ -o-transition: all 0.25s ease-in-out;
+ transition: all 0.25s ease-in-out;
+}
+
+.skin-monobook .postedit {
+ top: 6em !important;
+}
+
+.postedit-faded {
+ opacity: 0;
+}
+
+.postedit-icon {
+ padding-left: 41px; /* 25 + 8 + 8 */
+ /* like min-height, but old IE compatible and keeps text vertically aligned, too */
+ line-height: 25px;
+ background-repeat: no-repeat;
+ background-position: 8px 50%;
+}
+
+.postedit-icon-checkmark {
+ /* @embed */
+ background-image: url(images/green-checkmark.png);
+ background-position: left;
+}
+
+.postedit-close {
+ position: absolute;
+ padding: 0 .8em;
+ right: 0;
+ top: 0;
+ font-size: 1.25em;
+ font-weight: bold;
+ line-height: 2.3em;
+ color: black;
+ text-shadow: 0 0.0625em 0 white;
+ text-decoration: none;
+ opacity: 0.2;
+ filter: alpha(opacity=20);
+}
+
+.postedit-close:hover {
+ color: black;
+ text-decoration: none;
+ opacity: 0.4;
+ filter: alpha(opacity=40);
+}
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js
new file mode 100644
index 00000000..4d2c47a5
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.view.postEdit.js
@@ -0,0 +1,86 @@
+( function ( mw, $ ) {
+ 'use strict';
+
+ /**
+ * @event postEdit
+ * @member mw.hook
+ * @param {Object} [data] Optional data
+ * @param {string|jQuery|Array} [data.message] Message that listeners
+ * should use when displaying notifications. String for plain text,
+ * use array or jQuery object to pass actual nodes.
+ * @param {string|mw.user} [data.user=mw.user] User that made the edit.
+ */
+
+ /**
+ * After the listener for #postEdit removes the notification.
+ *
+ * @event postEdit_afterRemoval
+ * @member mw.hook
+ */
+
+ var config = mw.config.get( [ 'wgAction', 'wgCurRevisionId' ] ),
+ // This should match EditPage::POST_EDIT_COOKIE_KEY_PREFIX:
+ cookieKey = 'PostEditRevision' + config.wgCurRevisionId,
+ cookieVal = mw.cookie.get( cookieKey ),
+ $div, id;
+
+ function showConfirmation( data ) {
+ data = data || {};
+ if ( data.message === undefined ) {
+ 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>'
+ );
+
+ if ( typeof data.message === 'string' ) {
+ $div.find( '.postedit-content' ).text( data.message );
+ } else if ( typeof data.message === 'object' ) {
+ $div.find( '.postedit-content' ).append( data.message );
+ }
+
+ $div
+ .click( fadeOutConfirmation )
+ .prependTo( 'body' );
+
+ id = setTimeout( fadeOutConfirmation, 3000 );
+ }
+
+ function fadeOutConfirmation() {
+ clearTimeout( id );
+ $div.find( '.postedit' ).addClass( 'postedit postedit-faded' );
+ setTimeout( removeConfirmation, 500 );
+
+ return false;
+ }
+
+ function removeConfirmation() {
+ $div.remove();
+ mw.hook( 'postEdit.afterRemoval' ).fire();
+ }
+
+ mw.hook( 'postEdit' ).add( showConfirmation );
+
+ if ( config.wgAction === 'view' && cookieVal ) {
+ mw.config.set( 'wgPostEdit', true );
+
+ mw.hook( 'postEdit' ).fire( {
+ // The following messages can be used here:
+ // postedit-confirmation-saved
+ // postedit-confirmation-created
+ // postedit-confirmation-restored
+ 'message': mw.msg(
+ 'postedit-confirmation-' + cookieVal,
+ mw.user
+ )
+ } );
+ mw.cookie.set( cookieKey, null );
+ }
+
+} ( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.redirect.js b/resources/src/mediawiki.action/mediawiki.action.view.redirect.js
new file mode 100644
index 00000000..52e0d4e3
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.view.redirect.js
@@ -0,0 +1,65 @@
+/*!
+ * JavaScript to update page URL when a redirect is viewed, ensuring that the
+ * page is scrolled to the id when it's a redirect with fragment.
+ *
+ * This is loaded in the top queue, so avoid unnecessary dependencies
+ * like mediawiki.Title or mediawiki.Uri.
+ */
+( function ( mw, $ ) {
+ var profile = $.client.profile(),
+ canonical = mw.config.get( 'wgInternalRedirectTargetUrl' ),
+ 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 );
+ }
+
+ // Never override the fragment if the user intended to look at a different section
+ shouldChangeFragment = fragment && !location.hash;
+
+ // Replace the whole URL if possible, otherwise just change the fragment
+ if ( canonical && history.replaceState ) {
+ if ( !shouldChangeFragment ) {
+ // If the current page view has a fragment already, don't override it
+ canonical = canonical.replace( /#.*$/, '' );
+ canonical += location.hash;
+ }
+
+ // This will also cause the browser to scroll to given fragment
+ history.replaceState( /*data=*/ history.state, /*title=*/ document.title, /*url=*/ canonical );
+
+ // …except for IE 10 and 11. Prod it with a location.hash change.
+ if ( shouldChangeFragment && profile.name === 'msie' && profile.versionNumber >= 10 ) {
+ location.hash = fragment;
+ }
+
+ } else if ( shouldChangeFragment ) {
+ if ( profile.layout === 'webkit' && profile.layoutVersion < 420 ) {
+ // Released Safari w/ WebKit 418.9.1 messes up horribly
+ // Nightlies of 420+ are ok
+ return;
+ }
+
+ location.hash = fragment;
+ }
+
+ if ( shouldChangeFragment && profile.layout === 'gecko' ) {
+ // Mozilla needs to wait until after load, otherwise the window doesn't
+ // scroll. See <https://bugzilla.mozilla.org/show_bug.cgi?id=516293>.
+ // There's no obvious way to detect this programmatically, so we use
+ // version-testing. If Firefox fixes the bug, they'll jump twice, but
+ // better twice than not at all, so make the fix hit future versions as
+ // well.
+ $( function () {
+ if ( location.hash === fragment ) {
+ location.hash = fragment;
+ }
+ } );
+ }
+
+}( mediaWiki, jQuery ) );
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.redirectPage.css b/resources/src/mediawiki.action/mediawiki.action.view.redirectPage.css
new file mode 100644
index 00000000..fdbb655f
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.view.redirectPage.css
@@ -0,0 +1,53 @@
+/*!
+ * Display neat icons on redirect pages.
+ */
+
+/* Hide, but keep accessible for screen-readers. */
+.redirectMsg p {
+ overflow: hidden;
+ height: 0;
+ zoom: 1;
+}
+
+.redirectText {
+ list-style: none none;
+ display: inline;
+ /* shared.css has some very weird directionality-specific rules for 'ul' we need to override,
+ search for "Correct directionality when page dir is different from site/user dir" */
+ margin: 0 !important;
+ padding: 0 !important;
+}
+
+/* @noflip */
+.mw-content-ltr .redirectText li {
+ display: inline;
+ margin: 0;
+ padding: 0;
+ padding-left: 42px;
+ /* @embed */
+ background: url(images/nextredirect-ltr.png) bottom left no-repeat;
+}
+
+/* @noflip */
+.mw-content-ltr .redirectText li:first-child {
+ padding-left: 47px;
+ /* @embed */
+ background: url(images/redirect-ltr.png) bottom left no-repeat;
+}
+
+/* @noflip */
+.mw-content-rtl .redirectText li {
+ display: inline;
+ margin: 0;
+ padding: 0;
+ padding-right: 42px;
+ /* @embed */
+ background: url(images/nextredirect-rtl.png) bottom right no-repeat;
+}
+
+/* @noflip */
+.mw-content-rtl .redirectText li:first-child {
+ padding-right: 47px;
+ /* @embed */
+ background: url(images/redirect-rtl.png) bottom right no-repeat;
+}
diff --git a/resources/src/mediawiki.action/mediawiki.action.view.rightClickEdit.js b/resources/src/mediawiki.action/mediawiki.action.view.rightClickEdit.js
new file mode 100644
index 00000000..ada101eb
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.view.rightClickEdit.js
@@ -0,0 +1,26 @@
+/*!
+ * JavaScript to enable right click edit functionality.
+ * When the user right-clicks in a heading, it will open the
+ * edit screen.
+ */
+jQuery( function ( $ ) {
+ // Select all h1-h6 elements that contain editsection links
+ // Don't use the ":has:(.mw-editsection a)" selector because it performs very bad.
+ // http://jsperf.com/jq-1-7-2-vs-jq-1-8-1-performance-of-mw-has/2
+ $( document ).on( 'contextmenu', 'h1, h2, h3, h4, h5, h6', function ( e ) {
+ var $edit = $( this ).find( '.mw-editsection a' );
+ if ( !$edit.length ) {
+ return;
+ }
+
+ // Headings can contain rich text.
+ // Make sure to not block contextmenu events on (other) anchor tags
+ // inside the heading (e.g. to do things like copy URL, open in new tab, ..).
+ // e.target can be the heading, but it can also be anything inside the heading.
+ if ( e.target.nodeName.toLowerCase() !== 'a' ) {
+ // Trigger native HTMLElement click instead of opening URL (bug 43052)
+ e.preventDefault();
+ $edit.get( 0 ).click();
+ }
+ } );
+} );