Allow star rating to be used outside of the page which has the <vote type=1 /> tag

This ability was removed in version 2.4 (r108076) in favor of using the
wgArticleId JS global, but doing so essentially broke things like the
ImageRating extension, which rely on knowing a "remote" page's ID since
wgArticleId is obviously 0 for special: pages.

Change-Id: I644cbd57c11114758f229ca052c51328513e59a1
This commit is contained in:
Jack Phoenix 2015-05-14 03:59:17 +03:00
parent 33f5015197
commit 8762715a91
2 changed files with 4 additions and 3 deletions

View file

@ -173,7 +173,7 @@ $( function() {
var that = $( this );
vote.clickVoteStars(
that.data( 'vote-the-vote' ),
mw.config.get( 'wgArticleId' ),
$( this ).data( 'page-id' ),
that.data( 'vote-id' ),
that.data( 'vote-action' )
);
@ -196,7 +196,7 @@ $( function() {
// Remove vote (rating stars)
$( 'body' ).on( 'click', '.vote-remove-stars-link', function() {
vote.unVoteStars(
mw.config.get( 'wgArticleId' ),
$( this ).data( 'page-id' ),
$( this ).data( 'vote-id' )
);
} );

View file

@ -291,7 +291,7 @@ class VoteStars extends Vote {
$output .= '<div class="rating-voted">' .
wfMessage( 'voteny-gave-this', $already_voted )->parse() .
" </div>
<a href=\"javascript:void(0);\" class=\"vote-remove-stars-link\" data-vote-id=\"{$id}\">("
<a href=\"javascript:void(0);\" class=\"vote-remove-stars-link\" data-page-id=\"{$this->PageID}\" data-vote-id=\"{$id}\">("
. wfMessage( 'voteny-remove' )->plain() .
')</a>';
}
@ -329,6 +329,7 @@ class VoteStars extends Vote {
$action = 5;
}
$output .= "<img class=\"vote-rating-star\" data-vote-the-vote=\"{$x}\"" .
" data-page-id=\"{$this->PageID}\"" .
" data-vote-id=\"{$id}\" data-vote-action=\"{$action}\" data-vote-rating=\"{$rating}\"" .
" data-vote-voted=\"{$voted}\" id=\"rating_{$id}_{$x}\"" .
" src=\"{$wgExtensionAssetsPath}/VoteNY/images/star_";