From 6c87aeee6931decbaed0680ead1bafeb7a66a5bd Mon Sep 17 00:00:00 2001 From: MatmaRex Date: Mon, 29 Jul 2013 02:33:43 +0200 Subject: [PATCH] mediawiki.action.edit.preview: Assorted fixes * Fix some typos * Load mediawiki.action.history.diff as a RL dependency, not via mw.loader.load * Get rid of inappropriate uses of .prop() Change-Id: I4ff0fd1f946644ac651fe6c7b645236124d6d770 --- resources/Resources.php | 1 + .../mediawiki.action.edit.preview.js | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/resources/Resources.php b/resources/Resources.php index 6352843fd8..508aabf34b 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -738,6 +738,7 @@ return array( 'dependencies' => array( 'jquery.form', 'jquery.spinner', + 'mediawiki.action.history.diff', ), ), 'mediawiki.action.history' => array( diff --git a/resources/mediawiki.action/mediawiki.action.edit.preview.js b/resources/mediawiki.action/mediawiki.action.edit.preview.js index 0566a87c66..ca71a997a9 100644 --- a/resources/mediawiki.action/mediawiki.action.edit.preview.js +++ b/resources/mediawiki.action/mediawiki.action.edit.preview.js @@ -78,8 +78,8 @@ } ); // Load new preview data. - // TODO: This should use the action=parse API instead of loading the entire page - // Though that requires figuring out how to convert that raw data into proper HTML. + // 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; // Copy the contents of the specified elements from the loaded page to the real page. @@ -113,32 +113,29 @@ } // The following elements can change in a preview but are not output - // by the server when they're empty until the preview reponse. + // 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( - $( '
' ).prop( 'id', 'p-lang' ) + $( '
' ).attr( 'id', 'p-lang' ) ); } if ( !$( '.mw-summary-preview' ).length ) { $( '.editCheckboxes' ).before( - $( '
' ).prop( 'className', 'mw-summary-preview' ) + $( '
' ).addClass( 'mw-summary-preview' ) ); } if ( !document.getElementById( 'wikiDiff' ) && document.getElementById( 'wikiPreview' ) ) { $( '#wikiPreview' ).after( - $( '
' ).prop( 'id', 'wikiDiff') + $( '
' ).attr( 'id', 'wikiDiff') ); } - // Make sure diff styles are loaded - mw.loader.load( 'mediawiki.action.history.diff' ); - $( document.body ).on( 'click', '#wpPreview, #wpDiff', doLivePreview ); } ); -- 2.20.1