Skip to content

Commit

Permalink
Merge pull request #213 from codygray/cg-sim-linkification
Browse files Browse the repository at this point in the history
SIM: Make "smokey" quicklink a proper link (in addition to its normal function as a button)
  • Loading branch information
makyen committed Feb 22, 2023
2 parents 45082be + f03ae57 commit 3f6dec3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions sim/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sim/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sim",
"version": "0.7.0",
"version": "0.7.1",
"description": "Dig up information on how SmokeDetector handled a post.",
"scripts": {
"test": "xo"
Expand Down
9 changes: 7 additions & 2 deletions sim/sim.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name SIM - SmokeDetector Info for Moderators
// @namespace https://charcoal-se.org/
// @version 0.7.0
// @version 0.7.1
// @description Dig up information about how SmokeDetector handled a post.
// @author ArtOfCode
// @contributor Makyen
Expand Down Expand Up @@ -267,10 +267,11 @@
if (!id) {
return;
}
const type = $e.hasClass('question') ? 'questions' : 'a';
const apiParam = getCurrentSiteAPIParam();
const msUri = `https://metasmoke.erwaysoftware.com/api/v2.0/posts/uid/${apiParam}/${id}?key=${msAPIKey}`;
const $this = $(this);
$this.append(`<div class="flex--item"><button class="s-btn s-btn__link sim-get-info" data-request="${msUri}">Smokey</button></div>`);
$this.append(`<div class="flex--item"><a href="https://metasmoke.erwaysoftware.com/posts/by-url?url=//${location.host}/${type}/${id}" class="sim-get-info" data-request="${msUri}">Smokey</button></div>`);
/* Temporarily removed due to NATOEnhancements and this needing work
if (isNato) {
// Clean up if we are in NATO Enhancements
Expand Down Expand Up @@ -359,6 +360,10 @@
};

const getInfo = async ev => {
if (ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey) {
return;
}

ev.preventDefault();

const $tgt = $(ev.target);
Expand Down

0 comments on commit 3f6dec3

Please sign in to comment.