Several housekeeping and SEO changes; see below.

- Brought version up to 1.0, in accordance with https://stackapps.com/a/8113/7653 (Although this script's SA post needs to be edited to match).
- Scope/SEO the title. 
- Don't run on inapplicable pages.
- Link to the SA listing page. See the effect in the Tampermonkey dashboard.
- Clear NA Tampermonkey warnings.
This commit is contained in:
Brock 2018-12-03 15:27:43 -08:00 committed by GitHub
parent 578e5a3048
commit 2c2bd5b2db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,11 +1,10 @@
// ==UserScript== // ==UserScript==
// @name Improved Tag Popup // @name Stack Exchange, Improved Tag Popup
// @namespace https://github.com/Glorfindel83/ // @namespace https://github.com/Glorfindel83/
// @description Adds a link to the tag information page (wiki + excerpt) to the tag popup // @description Adds a link to the tag information page (wiki + excerpt) to the tag popup
// @author Glorfindel // @author Glorfindel
// @updateURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/improved-tag-popup/improved-tag-popup.user.js // @updateURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/improved-tag-popup/improved-tag-popup.user.js
// @downloadURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/improved-tag-popup/improved-tag-popup.user.js // @downloadURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/improved-tag-popup/improved-tag-popup.user.js
// @version 0.2
// @match *://*.stackexchange.com/* // @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/* // @match *://*.stackoverflow.com/*
// @match *://*.superuser.com/* // @match *://*.superuser.com/*
@ -13,9 +12,21 @@
// @match *://*.askubuntu.com/* // @match *://*.askubuntu.com/*
// @match *://*.stackapps.com/* // @match *://*.stackapps.com/*
// @match *://*.mathoverflow.net/* // @match *://*.mathoverflow.net/*
// @exclude *://api.stackexchange.com/*
// @exclude *://blog.*.com/*
// @exclude *://chat.*.com/*
// @exclude *://data.stackexchange.com/*
// @exclude *://elections.stackexchange.com/*
// @exclude *://openid.stackexchange.com/*
// @exclude *://stackexchange.com/*
// @grant none // @grant none
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @version 1.0
// @history 1.0 Scope/SEO title. Don't run on inapplicable pages. Link SA listing page (See Tampermonkey dashboard). Clear NA TM warnings.
// @history 0.2 Initial release
// @homepage https://stackapps.com/q/8054/7653
// ==/UserScript== // ==/UserScript==
/* global $, waitForKeyElements */
// from https://stackoverflow.com/a/21249710/4751173 // from https://stackoverflow.com/a/21249710/4751173
$.fn.ownText = function() { $.fn.ownText = function() {
@ -38,12 +49,12 @@ waitForKeyElements("div.tag-popup", function(jNode) {
// Other questions // Other questions
$(this).text("Other questions"); $(this).text("Other questions");
// More info // More info
let infoURL = "/tags/" + tagName + "/info"; let infoURL = "/tags/" + tagName + "/info";
$("<a href=\"" + infoURL + "\">More info</a>").insertBefore($(this)); $("<a href=\"" + infoURL + "\">More info</a>").insertBefore($(this));
$("<span> | </span>").insertBefore($(this)); $("<span> | </span>").insertBefore($(this));
// Edit/add info // Edit/add info
let editLink = $("<a>" + (hasInfo ? "Edit" : "Add") + " info</a>"); let editLink = $("<a>" + (hasInfo ? "Edit" : "Add") + " info</a>");
editLink.click(function() { editLink.click(function() {
@ -54,4 +65,4 @@ waitForKeyElements("div.tag-popup", function(jNode) {
editLink.insertBefore($(this)); editLink.insertBefore($(this));
$("<span> | </span>").insertBefore($(this)); $("<span> | </span>").insertBefore($(this));
}); });
}) })