19

I figured I'd ask here before making an Evan Carroll out of myself.

I really like the statistics found here:

http://elections.stackexchange.com/#serverfault

enter image description here

Short of nominating myself, is there a way to see these concise statistics about oneself?

I looked around on data.se but didn't find a query that fit and I'm not versed enough on data.se to create the query.

I know there is some, if not all, of this on your profile, but I like this nice concise view.

In the StackApps URL for the page someone asked basically the same thing I'm asking.

And the same URL states that the app has:

  • Ability to add arbitrary users to the lineup, for comparison with the candidates

(and I have no desire to ask this over on meta.SE...so if nobody here knows, I'll live without it)

  • Please nominate yourself again... if there are more than 10 nominees, there's a chance to bump Evan out of the actual election. – Ward Nov 21 '14 at 17:50
  • @Ward - I don't think I should force a primary just for the sake of doing so. But I seriously doubt Evan is going to get more than a few votes tops. – TheCleaner Nov 21 '14 at 21:06
8

As far as I know there is no page for this. You could however copy-paste some Javascript code into your browser which will show it for you. With a little copy and pasting and under 10 lines of non pasted code :)

The Javascript on the page is not obfuscated so easy to read. With minor adjustments you can copy-paste some of the code and have it display for the users you want. The code is also available on Github which might also mean that it's possible to host it for yourself? (not sure)

As for the copy and paste code, see this link, simply adjust the parameter (user_ids, you can get the id from your profile on this website) and run it on the election page.

In chrome you can open the Javascript console with one of the following options:

  • control + shift + j keyboard shortcut
  • Right click on a page, inspect element, console
  • The three-stripe button near the top right, then more tools, Javascript console.

In Firefox you can open the console with one of the following options:

  • The tree stripe button, then developer, then webconsole.
  • Right click on a page, Inspect, then click console.
  • Control + shift + k keyboard shortcut

In Internet explorer:

  • Right click on a object on the page, inspect element. Then click the console icon.
  • Press F12 to open developer tools and then click the console icon.
  • Click the gear icon, then click developer tools, then the console icon.

In Internet explorer you will have to enter it in the grey box and then click the green triangle button (the one which looks like a play button), or press control+enter. Instead of the console button you can also just press Control+2.

  • 2
    Which 10 lines? We're sysadmins, not JavaScript developers! – Michael Hampton Nov 20 '14 at 23:59
  • here :) Just replace the user_ids. Its made to work on the election page, so it will probally not work on other pages. – user254948 Nov 21 '14 at 0:18
  • 1
    So how do I apply your JavaScript code into a browser? Step by step maybe? – masegaloeh Nov 21 '14 at 3:37
  • In chrome, right click somewhere in the page, inspect element. Open up the tab Console, paste it in there and press enter. You can also press control+shift+j to open the console or click the 3 stripe button, more tools, javascript console :) – user254948 Nov 21 '14 at 9:37
  • 3
    You should add your comments to your answer and format it as such. It's worthy of an upvote. – TheCleaner Nov 21 '14 at 14:14
  • Adjusted. I didn't include the code here though as I can't find an option to hide the code by default, and pasting 100+ lines would make the post look pretty messy. – user254948 Nov 21 '14 at 19:19
  • Thank you kind user254948 ;) – TheCleaner Nov 21 '14 at 21:50
  • 1
    Hi, it seems the pastebin link was broken. can you update this answer with new code? – masegaloeh Aug 29 '15 at 5:15
7

So the the link of original answer was dead, so I would like to add another solution. Basically the technique was similar: inject javascript snippet into election page. To do this I create bookmarklet with the following javascript code.

javascript:void%20function(){var%20e=prompt(%22Please%20enter%20your%20Server%20Fault%20user%20ID%22,%221%22),a=parseInt(e,10);jQuery.ajaxSetup({dataFilter:function(e){var%20t=JSON.parse(e);return%20t.candidates%26%26(t.candidates={},t.candidates[a]={user_id:a,text:%22%22,nominated_order:1,elected:!1}),JSON.stringify(t)}}),$(%22li[data-sitename='serverfault']%20a%22).click()}();

Step by step:

  1. Get your Server Fault user ID from your the URL on profile page.
  2. Open your browser and enable Bookmarks Bar (Chrome, Firefox, Opera).
  3. Drag this dummy links My Stats to Bookmarks Bar.
  4. Edit the bookmark (Right click new bookmark item, and click Edit/Properties), replace the URL/Address/Location field with above javascript code.
  5. Go to election candidates statistic page. Click the Bookmarklet and enter your Server Fault user ID to run the script.

Disclaimer: tested on Firefox, Opera and Chrome.


And here the original code

var user_input = prompt("Please enter your Server Fault user ID", "1");
var sf_id = parseInt(user_input, 10);
jQuery.ajaxSetup({dataFilter: function(data) {
    var dataOO = JSON.parse(data);
    if (dataOO.candidates) {
        dataOO['candidates'] = {};
        dataOO['candidates'][sf_id] = {"user_id": sf_id, "text": "", "nominated_order":1, "elected":false};;
    }
    return JSON.stringify(dataOO);
  }
});
$( "li[data-sitename='serverfault'] a" ).click()

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .