diff --git a/you-earned-this-badge/README.md b/you-earned-this-badge/README.md new file mode 100644 index 0000000..6f837ec --- /dev/null +++ b/you-earned-this-badge/README.md @@ -0,0 +1,20 @@ +# You've Earned This Badge, but when and where? + +This userscript turns the checkmarks in the badge list (which indicate you've earned a +specific badge) to links to your *personal* badge page, where you can see when and where +you earned the badge + + ![](badge-list.png) + + ![](badge.png) + +## Installation + +- Make sure you have Tampermonkey (for Chrome) or Greasemonkey (for Firefox) installed. + +- Install the userscript with +[this direct link](https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/you-earned-this-badge/you-earned-this-badge.user.js). + +## Support + +- Stack Apps \ No newline at end of file diff --git a/you-earned-this-badge/badge-list.png b/you-earned-this-badge/badge-list.png new file mode 100644 index 0000000..a3a44b4 Binary files /dev/null and b/you-earned-this-badge/badge-list.png differ diff --git a/you-earned-this-badge/badge-page.png b/you-earned-this-badge/badge-page.png new file mode 100644 index 0000000..54361b5 Binary files /dev/null and b/you-earned-this-badge/badge-page.png differ diff --git a/you-earned-this-badge/you-earned-this-badge.user.js b/you-earned-this-badge/you-earned-this-badge.user.js new file mode 100644 index 0000000..6eeb393 --- /dev/null +++ b/you-earned-this-badge/you-earned-this-badge.user.js @@ -0,0 +1,30 @@ +// ==UserScript== +// @name You've earned this badge, but when and where? +// @namespace https://github.com/Glorfindel83/ +// @description Adds a link in the badges page to show your personal badge page for that badge. +// @author Glorfindel +// @updateURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/you-earned-this-badge/you-earned-this-badge.user.js +// @downloadURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/you-earned-this-badge/you-earned-this-badge.user.js +// @version 0.1 +// @match *://*.stackexchange.com/help/badges* +// @match *://*.stackoverflow.com/help/badges* +// @match *://*.superuser.com/help/badges* +// @match *://*.serverfault.com/help/badges* +// @match *://*.askubuntu.com/help/badges* +// @match *://*.stackapps.com/help/badges* +// @match *://*.mathoverflow.net/help/badges* +// @grant none +// ==/UserScript== + +(function () { + 'use strict'; + + $("span.badge-earned-check").each(function() { + var parent = $(this).parent(); + var url = parent.next().find("a").prop("href") + "?userid=" + + /\/users\/(\d+)/g.exec($("a.my-profile").prop("href"))[1]; + var anchor = $(""); + anchor.append($(this)); + parent.append(anchor); + }); +}) (); \ No newline at end of file