Skip to content

Commit

Permalink
1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ericarthurc committed Oct 2, 2024
1 parent 9ba6944 commit 241ca41
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
7 changes: 4 additions & 3 deletions Extension/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand All @@ -30,16 +29,18 @@ 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 +
"view=slg/search#txt=" +
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":
Expand Down
2 changes: 1 addition & 1 deletion Extension/manifest.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
5 changes: 3 additions & 2 deletions Extension/popup.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
html {
width: 700px;
min-width: max-content;
background-color: #181818;
color: #f7f7f7;
font-family: sans-serif;
}

.telescope-table {
border: none;
width: 100%;
border-spacing: 0;
font-size: 15px;
}
Expand All @@ -24,7 +25,7 @@ html {

.telescope-table tbody td {
border: solid 1px #363636;
padding: 5px;
padding: 6px;
}
.telescope-table-highlight-all {
overflow: hidden;
Expand Down
2 changes: 1 addition & 1 deletion Extension/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<tr>
<td>Galaxy</td>
<td>uw `search text`</td>
<td>uw anesthesia smartdata elements</td>
<td>uw smartdata elements</td>
</tr>
<tr>
<td>Sherlock Support Logs</td>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img align="center" width="60" src="./.github/telescope.png"/>

#### Version 1.3
#### Version 1.4

Based on the amazing work of Marklannucci: [original source](https://github.com/MarkIannucci/ChromeUserWebSearchExtension).

Expand Down
17 changes: 15 additions & 2 deletions test/url_test.ts
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -9,14 +9,27 @@ Deno.test("test sherlock url", () => {
);
});

Deno.test("test slg url", () => {
Deno.test("test slg string url", () => {
const output = buildUrl("slg nothing");
assertEquals(
output,
"https://sherlock.epic.com/default.aspx?view=slg/search#txt=nothing"
);
});

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(
Expand Down

0 comments on commit 241ca41

Please sign in to comment.