From 4a977ee6b01ab0f055c76ed32d2dadc23e9d4160 Mon Sep 17 00:00:00 2001 From: Glorfindel Date: Sat, 23 Dec 2017 16:55:24 +0100 Subject: [PATCH] Why No Bounty v0.3: README + minor UI updates --- why-no-bounty/README.md | 12 ++++++++++++ why-no-bounty/why-no-bounty.user.js | 12 ++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 why-no-bounty/README.md diff --git a/why-no-bounty/README.md b/why-no-bounty/README.md new file mode 100644 index 0000000..0478cf3 --- /dev/null +++ b/why-no-bounty/README.md @@ -0,0 +1,12 @@ +# Why No Bounty? + +This userscript adds some information below a question (at the usual location of the +'start a bounty' link) about *why* you can't start a bounty. Inspired by +[this feature request](https://meta.stackexchange.com/q/151395/295232) by Shadow Wizard. + +## Installation + +- Make sure you have Tampermonkey (for Chrome) or Violentmonkey (for Firefox) installed. + +- Install the userscript with +[this direct link](https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/why-no-bounty/why-no-bounty.user.js). \ No newline at end of file diff --git a/why-no-bounty/why-no-bounty.user.js b/why-no-bounty/why-no-bounty.user.js index 93dc128..d33afa5 100644 --- a/why-no-bounty/why-no-bounty.user.js +++ b/why-no-bounty/why-no-bounty.user.js @@ -3,7 +3,7 @@ // @namespace https://github.com/Glorfindel83/ // @description Adds information to a question indicating why you can't start a bounty. // @author Glorfindel -// @version 0.2 +// @version 0.3 // @match *://*.stackexchange.com/* // @match *://*.stackoverflow.com/* // @match *://*.superuser.com/* @@ -30,12 +30,12 @@ var addInformation = function (message) { $("#question > table > tbody").append("" - + "bounty not possible: " + message + ""); + + "bounty not possible: " + message + ""); }; // Meta site? if (window.location.host != "meta.stackexchange.com" && window.location.host.contains("meta")) { - addInformation("meta sites don't have bounties"); + addInformation("meta sites don't allow bounties"); return; } @@ -96,12 +96,12 @@ var highestBounty = parseInt(summaries[0].find("div.bounty-indicator").replace("+", ""), 10); minimumBounty = highestBounty * 2; if (minimumBounty > 500) { - addInformation("last bounty was " + highestBounty + " which cannot be doubled"); + addInformation("the last bounty was " + highestBounty + " which cannot be doubled"); return; } } if (reputation < minimumBounty) { - addInformation("minimum bounty (" + minimumBounty + ") higher than reputation (" + reputation + ")"); + addInformation("the minimum bounty (" + minimumBounty + ") is higher than your reputation (" + reputation + ")"); return; } @@ -109,7 +109,7 @@ $.get("https://" + window.location.host + "/users/current?tab=bounties&sort=active", function (data) { var activeCount = parseInt($(data).find("#user-tab-bounties h1 span.count").text(), 10); if (activeCount >= 3) { - addInformation("you have " + activeCount + " currently active bounties"); + addInformation("you currently have " + activeCount + " active bounties"); return; } });