As others have stated, I too agree with this feature-request. I don't really see any harm in allowing this.
I did a little digging and found the code that handles fetching the vote counts, the following is a portion of that code.
$score
.html(html)
.unbind('click')
.data('bound', false)
.css('cursor', 'default')
.attr('title', (function(n) {
return n.upCount == 1 && n.downCount == 1 ? n.upCount + " up / " + n.downCount + " down" : n.upCount == 1 ? n.upCount + " up / " + n.downCount + " down" : (n.downCount == 1, n.upCount + " up / " + n.downCount + " down")
})({
upCount: Math.abs(+json.up),
downCount: Math.abs(+json.down)
}));
As you can see the click event is unbound to prevent further action.
Overall, I think this would be pretty simple to fix..
- Remove to call to unbind the click event
- Wire up a click event on the vote scores that replaces the counts with the score
I took the liberty of writing up a fix for it up real quick.
var fetchVoteCounts = function($score) {
if (loadingVotes) return;
loadingVotes = true;
var postId = fetchVoteCountsPostId($score);
$score.addSpinner();
$.ajax({
type: 'GET',
url: '/posts/{postId}/vote-counts'.formatUnicorn({
postId: postId
}),
dataType: "json",
success: function(json) {
StackExchange.helpers.removeMessages();
var html =
'<div class="vote-count" style="color:green">' + json.up + '</div>' +
'<div class="vote-count-separator"></div>' +
'<div class="vote-count" style="color:maroon">' + json.down + '</div>';
$score
.html(html)
.data('bound', false)
.css('cursor', 'default')
.attr('title', (function(n) {
return n.upCount == 1 && n.downCount == 1 ? n.upCount + " up / " + n.downCount + " down" : n.upCount == 1 ? n.upCount + " up / " + n.downCount + " down" : (n.downCount == 1, n.upCount + " up / " + n.downCount + " down")
})({
upCount: Math.abs(+json.up),
downCount: Math.abs(+json.down)
}));
$score.find('.vote-count').on('click', function() {
$score
.empty()
.text(Math.abs(+json.up) - Math.abs(+json.down))
.attr('title', 'View upvote and downvote totals');
});
},
error: function(res, textStatus, errorThrown) {
$score.removeSpinner().parent().showErrorMessage((res.responseText && res.responseText.length < 100 ? res.responseText : "An error occurred during vote count fetch"), {
transient: res.status == 409
}); // fade away throttle errors
},
complete: function() {
loadingVotes = false;
}
});
};
If adding this feature-request is out of the question, here is a UserScript that toggles that vote counts and rebinds the click events.
// ==UserScript==
// @name Toggle Vote Count
// @version 1.0
// @author ᴉʞuǝ
// @namespace https://github.com/enki-code
// @match *://*.stackoverflow.com/questions/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
'use strict';
(function($) {
$(document).ajaxComplete(function(event, request, settings) {
if(settings.url.indexOf('vote-counts') > -1){
$('.vote-count-post div').one('click', function(){
var $vote = $(this).parent(),
upvotes = +$vote.find('div:first-child').text(),
downvotes = +$vote.find('div:nth-child(3)').text(),
score = Math.abs(upvotes) - Math.abs(downvotes);
var $score = $('<span/>', {
text: score,
class: 'vote-count-post',
title: 'View upvote and downvote totals',
style: 'cursor: pointer;',
itemprop: 'upvoteCount'
});
$vote.replaceWith($score);
StackExchange.vote.bindFetchVoteCounts();
});
}
});
}(jQuery));
End result:
