diff --git a/dev/ReviewSidebarLink.user.js b/dev/ReviewSidebarLink.user.js
index 9d4f673..052dace 100644
--- a/dev/ReviewSidebarLink.user.js
+++ b/dev/ReviewSidebarLink.user.js
@@ -1,19 +1,20 @@
// ==UserScript==
// @name Review Sidebar Link
// @description Adds a link to the "reviews" to the sidebar of posts.
-// @version 0.1.1
+// @version 0.1.2
// @author Cody Gray
// @homepage https://github.com/codygray/so-userscripts
//
// @updateURL https://github.com/codygray/so-userscripts/raw/master/ReviewSidebarLink.user.js
// @downloadURL https://github.com/codygray/so-userscripts/raw/master/ReviewSidebarLink.user.js
//
-// @include https://*stackoverflow.com/*
-// @include https://*serverfault.com/*
-// @include https://*superuser.com/*
-// @include https://*askubuntu.com/*
-// @include https://*mathoverflow.net/*
-// @include https://*.stackexchange.com/*
+// @match *://*.stackoverflow.com/*
+// @match *://*.serverfault.com/*
+// @match *://*.superuser.com/*
+// @match *://*.askubuntu.com/*
+// @match *://*.mathoverflow.net/*
+// @match *://*.stackexchange.com/*
+// @match *://*.stackapps.com/*
//
// @exclude *chat.*
// @exclude *blog.*
@@ -48,10 +49,10 @@ $(document).ready(function(e)
var $modMenu = $(data);
// Determine how many reviews the post has.
- var $reviews = $modMenu.find('input[name="mod-actions"][value="show-reviews"]');
+ var $reviews = $modMenu.find('input[id="se-mod-menu-action-show-reviews"]');
if (!$reviews.disabled)
{
- var reviewsCount = $reviews.siblings('.action-name').find('.mod-flag-indicator').text().trim().split(' ')[0];
+ var reviewsCount = $reviews.parents().find('label[for="se-mod-menu-action-show-reviews"] span.s-badge').text();
if (reviewsCount !== '')
{
// If the post has reviews...
@@ -68,15 +69,16 @@ $(document).ready(function(e)
var $reviewsHistory = $(data);
// Only count this review queue if it has had a non-zero count of reviews.
- var actualReviewsCount = 0;
+ var activeReviewsCount = 0;
var reviewTooltip = 'Reviews:\n';
var $reviewsTable = $reviewsHistory.find('#content table.sorter tbody tr').each(function()
{
var $tr = $(this);
var queue = $tr.find('td:nth-child(1)').text();
- var count = $tr.find('td:nth-child(4)').text();
- actualReviewsCount += (parseInt(count, 10) > 0);
- reviewTooltip += (' ' + queue + '\t' + count + '\n');
+ var dequeued = $tr.find('td:nth-child(4)').text();
+ var count = $tr.find('td:nth-child(5)').text();
+ activeReviewsCount += (!dequeued);
+ reviewTooltip += (' ' + queue + ' \t' + count + (dequeued ? " [completed]" : "") + '\n');
});
// Build the reviews link.
@@ -87,29 +89,13 @@ $(document).ready(function(e)
'' +
- actualReviewsCount +
+ '' +'' +
+ (activeReviewsCount ? activeReviewsCount : '') +
'';
- // Determine where to insert the link (after flags, before comments, or at end).
- var $flagsLink = $votingContainer.find('[data-shortcut="F"]');
- if ($flagsLink.length !== 0)
- {
- $flagsLink.after(reviewsLink);
- }
- else
- {
- var $deletedCommentsLink = $votingContainer.find('[data-shortcut="D"]');
- if ($deletedCommentsLink !== 0)
- {
- $deletedCommentsLink.before(reviewsLink);
- }
- else
- {
- $votingContainer.append(reviewsLink);
- }
- }
+ // insert the link after the timeline
+ $votingContainer.find('[data-shortcut="T"]').after(reviewsLink);
}
});
}
@@ -118,6 +104,7 @@ $(document).ready(function(e)
});
});
+ // this next stuff no longer seems to work - the review summary is not available this way now?
if (window.location.pathname.endsWith('/show-reviews'))
{
// Iterate through each review queue.