r76599 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76598‎ | r76599 | r76600 >
Date:21:51, 12 November 2010
Author:pdhanda
Status:resolved (Comments)
Tags:
Comment:
Changes to make flaggedrevs.js work with deployment branch. More coming...
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/flaggedrevs.js (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -57,11 +57,12 @@
5858 # Get JS/CSS file locations
5959 $encCssFile = htmlspecialchars( "$stylePath/flaggedrevs.css?$wgFlaggedRevStyleVersion" );
6060 $encJsFile = htmlspecialchars( "$stylePath/flaggedrevs.js?$wgFlaggedRevStyleVersion" );
61 -
 61+ $encJQueryFile = "jquery.js";
6262 # Add CSS file
6363 $linkedStyle = Html::linkedStyle( $encCssFile );
6464 $wgOut->addHeadItem( 'FlaggedRevs', $linkedStyle );
6565 # Add main JS file
 66+ $wgOut->addScriptFile( $encJQueryFile );
6667 $wgOut->addScriptFile( $encJsFile );
6768 # Add review form JS for reviewers
6869 if ( $wgUser->isAllowed( 'review' ) ) {
@@ -111,7 +112,7 @@
112113 }
113114 $globalVars['wgStableRevisionId'] = $stableId;
114115 $globalVars['wgLatestRevisionId'] = $fa->getLatest();
115 - $globalVars['wgPageId'] = $fa->getID();
 116+ //$globalVars['wgPageId'] = $fa->getID();
116117 $revisionContents = (object) array(
117118 'error' => wfMsgHtml( 'revcontents-error' ),
118119 'waiting' => wfMsgHtml( 'revcontents-waiting' )
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.js
@@ -193,19 +193,14 @@
194194 var oldRevId = diffUIParams.getElementsByTagName('input')[1].value;
195195 var origContents = contentsDiv.innerHTML;
196196 contentsDiv.innerHTML = "<span class='loading mw-small-spinner spinner'></span><span class='loading' >" + wgRevContents.waiting + "</span>";
197 - var requestArgs = 'action=parse&prop=text&format=xml';
198 - if ( window.wgLatestRevisionId == oldRevId ) {
199 - requestArgs += '&pageid=' + window.wgPageId;
200 - } else {
201 - requestArgs += '&oldid=' + oldRevId;
202 - }
203 - var call = $.ajax({
 197+ var requestArgs = 'action=parse&prop=text&format=xml&oldid=' + oldRevId;
 198+ var call = jQuery.ajax({
204199 url : wgScriptPath + '/api.php',
205200 type : "GET",
206201 data : requestArgs,
207202 dataType: "xml",
208203 success : function( result ) {
209 - contents = $(result).find("text");
 204+ contents = jQuery(result).find("text");
210205 if ( contents && contents.text() ) {
211206 contentsDiv.innerHTML = contents.text();
212207 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r76601MFT r76599, r76600demon22:07, 12 November 2010
r76604Followup to r76599. Change how jQuery is included. API call now uses page ins...pdhanda23:31, 12 November 2010

Comments

#Comment by 😂 (talk | contribs)   22:08, 12 November 2010

Wouldn't $wgOut->includeJQuery() work better than DIY? Should work with deployment too.

Status & tagging log