From 8762715a918db6c40320c3802f256c4774985dde Mon Sep 17 00:00:00 2001 From: Jack Phoenix Date: Thu, 14 May 2015 03:59:17 +0300 Subject: [PATCH] Allow star rating to be used outside of the page which has the 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 --- Vote.js | 4 ++-- VoteClass.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Vote.js b/Vote.js index 70226cd..09444da 100644 --- a/Vote.js +++ b/Vote.js @@ -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' ) ); } ); diff --git a/VoteClass.php b/VoteClass.php index dd45593..db720b1 100644 --- a/VoteClass.php +++ b/VoteClass.php @@ -291,7 +291,7 @@ class VoteStars extends Vote { $output .= '
' . wfMessage( 'voteny-gave-this', $already_voted )->parse() . "
- (" + PageID}\" data-vote-id=\"{$id}\">(" . wfMessage( 'voteny-remove' )->plain() . ')'; } @@ -329,6 +329,7 @@ class VoteStars extends Vote { $action = 5; } $output .= "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_";