From 241ca41dcce0722f2e133f35985ccdb58bb97805 Mon Sep 17 00:00:00 2001 From: Eric Christensen Date: Wed, 2 Oct 2024 14:27:53 -0700 Subject: [PATCH] 1.4 --- Extension/functions.js | 7 ++++--- Extension/manifest.json | 2 +- Extension/popup.css | 5 +++-- Extension/popup.html | 2 +- README.md | 2 +- test/url_test.ts | 17 +++++++++++++++-- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Extension/functions.js b/Extension/functions.js index 20a5853..f501749 100644 --- a/Extension/functions.js +++ b/Extension/functions.js @@ -11,7 +11,6 @@ function prepSearchString(searchText) { } export function buildUrl(text) { - // use a constant if the URL is getting reused const galaxyInitialURL = "https://galaxy.epic.com/?#Search/searchWord="; const dhInitialURL = "https://datahandbook.epic.com/Search/Index?SearchWord="; const novaInitialURL = "https://nova.epic.com/"; @@ -30,8 +29,10 @@ export function buildUrl(text) { switch (firstWord.toLowerCase()) { case "sherlock": case "slg": - if (secondWord.toLowerCase() === "new") { + if (secondWord?.toLowerCase() === "new") { newURL = sherlockInitialURL + "view=slg/create"; + } else if (secondWord === undefined) { + newURL = sherlockInitialURL + "view=slg/home"; } else if (isNaN(secondWord)) { newURL = sherlockInitialURL + @@ -39,7 +40,7 @@ export function buildUrl(text) { prepSearchString(text.substring(firstWord.length + 1)); } else { newURL = - sherlockInitialURL + "view=slg/home#id=" + secondWord + "&view=1"; + sherlockInitialURL + "view=slg/search#id=" + secondWord + "&rv=0"; } break; case "ra": diff --git a/Extension/manifest.json b/Extension/manifest.json index 1dcc645..b10b1de 100644 --- a/Extension/manifest.json +++ b/Extension/manifest.json @@ -1,7 +1,7 @@ { "name": "Epic Telescope", "description": "Type 'uw ' and your search term to instantly search the Epic UserWeb. 'uw sherlock ' searches Sherlock logs.", - "version": "1.3", + "version": "1.4", "background": { "service_worker": "background.js", "type": "module" diff --git a/Extension/popup.css b/Extension/popup.css index c05b2e3..f26be77 100644 --- a/Extension/popup.css +++ b/Extension/popup.css @@ -1,5 +1,5 @@ html { - width: 700px; + min-width: max-content; background-color: #181818; color: #f7f7f7; font-family: sans-serif; @@ -7,6 +7,7 @@ html { .telescope-table { border: none; + width: 100%; border-spacing: 0; font-size: 15px; } @@ -24,7 +25,7 @@ html { .telescope-table tbody td { border: solid 1px #363636; - padding: 5px; + padding: 6px; } .telescope-table-highlight-all { overflow: hidden; diff --git a/Extension/popup.html b/Extension/popup.html index f50f9aa..4141e45 100644 --- a/Extension/popup.html +++ b/Extension/popup.html @@ -13,7 +13,7 @@ Galaxy uw `search text` - uw anesthesia smartdata elements + uw smartdata elements Sherlock Support Logs diff --git a/README.md b/README.md index 167b576..aaba5cb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -#### Version 1.3 +#### Version 1.4 Based on the amazing work of Marklannucci: [original source](https://github.com/MarkIannucci/ChromeUserWebSearchExtension). diff --git a/test/url_test.ts b/test/url_test.ts index 60e700b..b8acc3e 100644 --- a/test/url_test.ts +++ b/test/url_test.ts @@ -1,5 +1,5 @@ import { assertEquals } from "jsr:@std/assert"; -import { buildUrl } from "../extension/functions.js"; +import { buildUrl } from "../Extension/functions.js"; Deno.test("test sherlock url", () => { const output = buildUrl("sherlock nothing"); @@ -9,7 +9,7 @@ Deno.test("test sherlock url", () => { ); }); -Deno.test("test slg url", () => { +Deno.test("test slg string url", () => { const output = buildUrl("slg nothing"); assertEquals( output, @@ -17,6 +17,19 @@ Deno.test("test slg url", () => { ); }); +Deno.test("test slg empty url", () => { + const output = buildUrl("slg"); + assertEquals(output, "https://sherlock.epic.com/default.aspx?view=slg/home"); +}); + +Deno.test("test slg id url", () => { + const output = buildUrl("slg 9016152"); + assertEquals( + output, + "https://sherlock.epic.com/default.aspx?view=slg/search#id=9016152&rv=0" + ); +}); + Deno.test("test sherlock two word url", () => { const output = buildUrl("sherlock nothing nothing"); assertEquals(