Skip to content

Commit

Permalink
Various minor updates / #536 #539 #546
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoudkooi committed Oct 10, 2024
1 parent c1bc5ae commit 6b655a4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# CHANGELOG.md
## 8.2.1.0 (2024-10-10)
Fixes / changes:
- Hide search in studio when navigator collapsed (Issue #536)
- Prevent WindowsKey-S to save record (Meta key in windows) (LinkedIn Company Page DM)
- Allow encodedquery to have hyphen (-) in encodedquery (Follow up on issue #460 via Slack)
- Allow /rnd command on portal assesment page (Discussion #539)
- Change the goto link behavior in the diff editor (Issue #546 / Slack)
- I plan to add the reporting source of issues i.e. Slack, LinkedIn CDM, LinkedIn PDM in the changelog.

## 8.2.0.3 (2024-09-25)
Fixes / changes:
- Hide search in studio when navigator collapsed (Issue #536)
Expand Down
7 changes: 4 additions & 3 deletions inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ function snuSlashCommandAddListener() {


if ((targeturl.includes("sysparm_query=") || !snuslashcommands.hasOwnProperty(shortcut)) && snuOperators.some(opp => (query + (e.key.length == 1 ? e.key : "")).includes(opp))) { //detect encodedquery and replace if found
let encodedQ = query.split('-')[0]; //encodedquery should be first, switches should work #460
let encodedQ = query.split(/(?<!\s)-/)[0]; //encodedquery should be first, switches should work #460
targeturl = targeturl.replace(/sysparm_query=(.*)/g, "sysparm_query=" + encodeURIComponent(encodedQ) + (e.key.length == 1 ? e.key : ""));
switchText = '<br />Encodedquery detected<br /><br /><br /> Switches:<br />';
}
Expand Down Expand Up @@ -3523,8 +3523,9 @@ function snuSetShortCuts() {
//a few specific for forms
if (typeof g_form != 'undefined') {
mySysId = g_form.getUniqueValue();
var snuIsMac = navigator.userAgent.toLowerCase().includes('mac');
var action;
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() == "s") { //cmd-s
if ((event.ctrlKey || event.metaKey && snuIsMac) && event.key.toLowerCase() == "s") { //cmd-s

event.preventDefault();

Expand Down Expand Up @@ -4133,7 +4134,7 @@ function snuSlashCommandInfoText(msg, addText) {

function snuFillFields(query) {

if (location.search.includes("sc_cat_item") && location.search.includes("id=")) {
if ((location.search.includes("sc_cat_item") || document.querySelector('sp-assessment-layout')) && location.search.includes("id=")) {
snuSetRandomPortal(query, 0);
return;
}
Expand Down
16 changes: 14 additions & 2 deletions js/monaco/diff.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
let hasLoaded = false;
let leftXml;
let theme;
let tabId;

chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
{
Expand Down Expand Up @@ -42,6 +43,8 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {

} else if (message.event == 'fetchdiff1') {

tabId = sender.tab.id;

document.querySelector('#left').innerHTML = getMessage(message.command, sender.tab);
document.querySelector('#right').innerHTML = '<h3>Use /diff2 from instance to compare other version.</h3>';

Expand All @@ -56,6 +59,8 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
.then(response => response.text())
.then(data => { //this needs a proper async await...

if(tabId == sender.tab.id) sender.tab.id = null; //remove the goto tab link if same tab

document.querySelector('#right').innerHTML = getMessage(message.command, sender.tab);
document.title = 'Diff Loaded!';

Expand All @@ -75,11 +80,18 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
});

function getMessage(data, tab) {
console.log(tab?.id);
return `
<h3><img class='favicon' src='${tab.favIconUrl}' alt='favicon' />${data.displayValue} <a href='#${tab.id}' class='callingtab'>goto tab</a></h3>
<h3><img class='favicon' src='${tab.favIconUrl}' alt='favicon' />${data.displayValue}
${tab?.id ? `<a class='callingtab' href='#${tab.id}'>goto tab</a>` : ''}
</h3>
<label sty>Instance: </label><span>${data.host}</span><br />
<label>Record: </label><span>${data.tableName} - ${data.sysId}</span>
<label>Record: </label>
<span>${data.tableName} - ${data.sysId}
<a href='${data.url.replace('&XML=','')}' target='_blank' title="Open record in new tab">⤴</a>
</span>
`;

}

function createEditor(original, modified, lang) {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"short_name": "SN Utils",
"description": "Productivity tools for ServiceNow. (Personal work, not affiliated to ServiceNow)",
"author": "Arnoud Kooi / arnoudkooi.com",
"version": "8.2.0.3",
"version": "8.2.1.0",
"manifest_version": 3,
"permissions": [
"activeTab",
Expand Down

0 comments on commit 6b655a4

Please sign in to comment.