Index: trunk/extensions/Push/includes/Push_Tab.php |
— | — | @@ -249,6 +249,9 @@ |
250 | 250 | protected static function getPushItem( $name, $url ) { |
251 | 251 | global $wgTitle; |
252 | 252 | |
| 253 | + static $targetId = 0; |
| 254 | + $targetId++; |
| 255 | + |
253 | 256 | return Html::rawElement( |
254 | 257 | 'tr', |
255 | 258 | array(), |
— | — | @@ -262,7 +265,11 @@ |
263 | 266 | array(), |
264 | 267 | Html::element( |
265 | 268 | 'a', |
266 | | - array( 'href' => $url . '/index.php?title=' . $wgTitle->getFullText(), 'rel' => 'nofollow' ), |
| 269 | + array( |
| 270 | + 'href' => $url . '/index.php?title=' . $wgTitle->getFullText(), |
| 271 | + 'rel' => 'nofollow', |
| 272 | + 'id' => 'targetlink' . $targetId |
| 273 | + ), |
267 | 274 | wfMsgExt( 'push-remote-page-link', 'parsemag', $wgTitle->getFullText(), $name ) |
268 | 275 | ) |
269 | 276 | ) . |
— | — | @@ -275,6 +282,7 @@ |
276 | 283 | 'class' => 'push-button', |
277 | 284 | 'pushtarget' => $url, |
278 | 285 | 'style' => 'width: 125px; height: 30px', |
| 286 | + 'targetid' => $targetId |
279 | 287 | ), |
280 | 288 | wfMsg( 'push-button-text' ) |
281 | 289 | ) |
Index: trunk/extensions/Push/includes/ext.push.tab.js |
— | — | @@ -12,11 +12,21 @@ |
13 | 13 | if ( typeof mediaWiki === 'undefined' ) { |
14 | 14 | mediaWiki = new Object(); |
15 | 15 | |
16 | | - mediaWiki.msg = function( message ) { |
17 | | - return window.wgPushMessages[message]; |
| 16 | + mediaWiki.msg = function() { |
| 17 | + message = window.wgPushMessages[arguments[0]]; |
| 18 | + |
| 19 | + for ( var i = arguments.length - 1; i > 0; i-- ) { |
| 20 | + message = message.replace( '$' + i, arguments[i] ); |
| 21 | + } |
| 22 | + |
| 23 | + return message; |
18 | 24 | } |
19 | 25 | } |
20 | 26 | |
| 27 | + $.each($(".push-button"), function(i,v) { |
| 28 | + getRemoteArticleInfo( $(v).attr( 'targetid' ), $(v).attr( 'pushtarget' ) ); |
| 29 | + }); |
| 30 | + |
21 | 31 | $('.push-button').click(function() { |
22 | 32 | this.disabled = true; |
23 | 33 | this.innerHTML = mediaWiki.msg( 'push-button-pushing' ); |
— | — | @@ -36,6 +46,27 @@ |
37 | 47 | }); |
38 | 48 | }); |
39 | 49 | |
| 50 | + function getRemoteArticleInfo( targetId, targetUrl ) { |
| 51 | + $.getJSON( |
| 52 | + targetUrl + '/api.php?callback=?', |
| 53 | + { |
| 54 | + 'action': 'query', |
| 55 | + 'format': 'json', |
| 56 | + 'prop': 'revisions', |
| 57 | + 'rvprop': 'timestamp|user|comment', |
| 58 | + 'titles': $('#pageName').attr('value'), |
| 59 | + }, |
| 60 | + function( data ) { |
| 61 | + if ( data.query ) { |
| 62 | + for ( first in data.query.pages ) break; |
| 63 | + if ( first == '-1' ) { |
| 64 | + $( '#targetlink' + targetId ).attr( {'class': 'new'} ); |
| 65 | + } |
| 66 | + } |
| 67 | + } |
| 68 | + ); |
| 69 | + } |
| 70 | + |
40 | 71 | function initiatePush( sender, pageName, targetUrl ) { |
41 | 72 | $.getJSON( |
42 | 73 | wgScriptPath + '/api.php', |