Compare commits
3 Commits
605cd93aa6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 31e99f351e | |||
| 4a44fac8cf | |||
| 5d3c76853b |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "WWCompanion",
|
"name": "WWCompanion",
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"description": "AI companion for WaterlooWorks job postings.",
|
"description": "AI companion for WaterlooWorks job postings.",
|
||||||
"permissions": ["storage", "activeTab"],
|
"permissions": ["storage", "activeTab"],
|
||||||
"host_permissions": ["https://waterlooworks.uwaterloo.ca/*"],
|
"host_permissions": ["https://waterlooworks.uwaterloo.ca/*"],
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
<button id="copyRawBtn" class="ghost" type="button">Copy Markdown</button>
|
<button id="copyRawBtn" class="ghost" type="button">Copy Markdown</button>
|
||||||
<button id="clearOutputBtn" class="ghost" type="button">Clear</button>
|
<button id="clearOutputBtn" class="ghost" type="button">Clear</button>
|
||||||
</div>
|
</div>
|
||||||
<button id="settingsBtn" class="link">Open Settings</button>
|
<button id="settingsBtn" class="link">Settings</button>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="popup.js"></script>
|
<script src="popup.js"></script>
|
||||||
|
|||||||
@@ -84,6 +84,20 @@ function applyInline(text) {
|
|||||||
)}" target="_blank" rel="noreferrer">${label}</a>`;
|
)}" target="_blank" rel="noreferrer">${label}</a>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
output = output.replace(/https?:\/\/[^\s<]+/g, (match) => {
|
||||||
|
let url = match;
|
||||||
|
let suffix = "";
|
||||||
|
while (/[),.;!?]$/.test(url)) {
|
||||||
|
suffix = url.slice(-1) + suffix;
|
||||||
|
url = url.slice(0, -1);
|
||||||
|
}
|
||||||
|
const safeUrl = sanitizeUrl(url);
|
||||||
|
if (!safeUrl) return match;
|
||||||
|
return `<a href="${escapeAttribute(
|
||||||
|
safeUrl
|
||||||
|
)}" target="_blank" rel="noreferrer">${safeUrl}</a>${suffix}`;
|
||||||
|
});
|
||||||
|
|
||||||
output = output.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
|
output = output.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
|
||||||
output = output.replace(/\*([^*]+)\*/g, "<em>$1</em>");
|
output = output.replace(/\*([^*]+)\*/g, "<em>$1</em>");
|
||||||
output = output.replace(/_([^_]+)_/g, "<em>$1</em>");
|
output = output.replace(/_([^_]+)_/g, "<em>$1</em>");
|
||||||
|
|||||||
@@ -609,7 +609,9 @@ function updateApiConfigKeyOptions() {
|
|||||||
const keys = collectApiKeys();
|
const keys = collectApiKeys();
|
||||||
const selects = apiConfigsContainer.querySelectorAll(".api-config-key-select");
|
const selects = apiConfigsContainer.querySelectorAll(".api-config-key-select");
|
||||||
selects.forEach((select) => {
|
selects.forEach((select) => {
|
||||||
const preferred = select.dataset.preferred || select.value;
|
const preferred = select.dataset.preferred || "";
|
||||||
|
const currentValue = select.value || "";
|
||||||
|
const candidate = preferred || currentValue;
|
||||||
select.innerHTML = "";
|
select.innerHTML = "";
|
||||||
if (!keys.length) {
|
if (!keys.length) {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
@@ -628,13 +630,15 @@ function updateApiConfigKeyOptions() {
|
|||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferred && keys.some((key) => key.id === preferred)) {
|
if (candidate && keys.some((key) => key.id === candidate)) {
|
||||||
select.value = preferred;
|
select.value = candidate;
|
||||||
|
select.dataset.preferred = candidate;
|
||||||
} else {
|
} else {
|
||||||
select.value = keys[0].id;
|
select.value = keys[0].id;
|
||||||
|
if (!preferred) {
|
||||||
|
select.dataset.preferred = select.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
select.dataset.preferred = select.value;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,7 +807,9 @@ function updateTaskEnvOptions() {
|
|||||||
const envs = collectEnvConfigs();
|
const envs = collectEnvConfigs();
|
||||||
const selects = tasksContainer.querySelectorAll(".task-env-select");
|
const selects = tasksContainer.querySelectorAll(".task-env-select");
|
||||||
selects.forEach((select) => {
|
selects.forEach((select) => {
|
||||||
const preferred = select.dataset.preferred || select.value;
|
const preferred = select.dataset.preferred || "";
|
||||||
|
const currentValue = select.value || "";
|
||||||
|
const candidate = preferred || currentValue;
|
||||||
select.innerHTML = "";
|
select.innerHTML = "";
|
||||||
if (!envs.length) {
|
if (!envs.length) {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
@@ -822,13 +828,15 @@ function updateTaskEnvOptions() {
|
|||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferred && envs.some((env) => env.id === preferred)) {
|
if (candidate && envs.some((env) => env.id === candidate)) {
|
||||||
select.value = preferred;
|
select.value = candidate;
|
||||||
|
select.dataset.preferred = candidate;
|
||||||
} else {
|
} else {
|
||||||
select.value = envs[0].id;
|
select.value = envs[0].id;
|
||||||
|
if (!preferred) {
|
||||||
|
select.dataset.preferred = select.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
select.dataset.preferred = select.value;
|
|
||||||
});
|
});
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
}
|
}
|
||||||
@@ -1034,7 +1042,9 @@ function updateTaskProfileOptions() {
|
|||||||
const profiles = collectProfiles();
|
const profiles = collectProfiles();
|
||||||
const selects = tasksContainer.querySelectorAll(".task-profile-select");
|
const selects = tasksContainer.querySelectorAll(".task-profile-select");
|
||||||
selects.forEach((select) => {
|
selects.forEach((select) => {
|
||||||
const preferred = select.dataset.preferred || select.value;
|
const preferred = select.dataset.preferred || "";
|
||||||
|
const currentValue = select.value || "";
|
||||||
|
const candidate = preferred || currentValue;
|
||||||
select.innerHTML = "";
|
select.innerHTML = "";
|
||||||
if (!profiles.length) {
|
if (!profiles.length) {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
@@ -1053,13 +1063,15 @@ function updateTaskProfileOptions() {
|
|||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferred && profiles.some((profile) => profile.id === preferred)) {
|
if (candidate && profiles.some((profile) => profile.id === candidate)) {
|
||||||
select.value = preferred;
|
select.value = candidate;
|
||||||
|
select.dataset.preferred = candidate;
|
||||||
} else {
|
} else {
|
||||||
select.value = profiles[0].id;
|
select.value = profiles[0].id;
|
||||||
|
if (!preferred) {
|
||||||
|
select.dataset.preferred = select.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
select.dataset.preferred = select.value;
|
|
||||||
});
|
});
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
}
|
}
|
||||||
@@ -1068,7 +1080,9 @@ function updateEnvApiOptions() {
|
|||||||
const apiConfigs = collectApiConfigs();
|
const apiConfigs = collectApiConfigs();
|
||||||
const selects = envConfigsContainer.querySelectorAll(".env-config-api-select");
|
const selects = envConfigsContainer.querySelectorAll(".env-config-api-select");
|
||||||
selects.forEach((select) => {
|
selects.forEach((select) => {
|
||||||
const preferred = select.dataset.preferred || select.value;
|
const preferred = select.dataset.preferred || "";
|
||||||
|
const currentValue = select.value || "";
|
||||||
|
const candidate = preferred || currentValue;
|
||||||
select.innerHTML = "";
|
select.innerHTML = "";
|
||||||
if (!apiConfigs.length) {
|
if (!apiConfigs.length) {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
@@ -1087,13 +1101,15 @@ function updateEnvApiOptions() {
|
|||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferred && apiConfigs.some((config) => config.id === preferred)) {
|
if (candidate && apiConfigs.some((config) => config.id === candidate)) {
|
||||||
select.value = preferred;
|
select.value = candidate;
|
||||||
|
select.dataset.preferred = candidate;
|
||||||
} else {
|
} else {
|
||||||
select.value = apiConfigs[0].id;
|
select.value = apiConfigs[0].id;
|
||||||
|
if (!preferred) {
|
||||||
|
select.dataset.preferred = select.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
select.dataset.preferred = select.value;
|
|
||||||
});
|
});
|
||||||
updateTaskEnvOptions();
|
updateTaskEnvOptions();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user