Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update readme with badges #3

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2024, Warren Walters

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
<a href="https://github.com/Astisme/again-why-salesforce">
<img src="https://github.com/Astisme/again-why-salesforce/blob/main/assets/icons/awsf-128.png?raw=true" align="right" title="Well hello there!" />
</a>

# Again, Why Salesforce

![Release version](https://img.shields.io/github/manifest-json/v/Astisme/again-why-salesforce?filename=manifest%2Ftemplate-manifest.json&label=Version)
![Last commit](https://img.shields.io/github/last-commit/Astisme/again-why-salesforce?labelColor=black&color=white)
![License](https://img.shields.io/github/license/astisme/again-why-salesforce)
![Code size](https://img.shields.io/github/languages/code-size/astisme/again-why-salesforce)
<!--
![Chrome users](https://img.shields.io/chrome-web-store/users/:storeId)
![Chrome stars](https://img.shields.io/chrome-web-store/stars/:storeId)
![Firefox users](https://img.shields.io/amo/users/:addonId)
![Firefox stars](https://img.shields.io/amo/stars/:addonId)
![GitHub closed issues](https://img.shields.io/github/issues-closed/astisme/again-why-salesforce)
![GitHub stars](https://img.shields.io/github/stars/astisme/again-why-salesforce)
-->

This extension allows users to create custom tabs in Setup for their most-used settings.

This is a fork of [Why Salesforce](https://www.github.com/walters954/why-salesforce).
Expand Down
25 changes: 16 additions & 9 deletions action/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ a {
}
}

.button,
button {
position: relative;
display: inline-flex;
Expand All @@ -59,13 +60,10 @@ button {
padding-bottom: 0;
padding-left: 1rem;
padding-right: 1rem;
background-clip: border-box;
border-style: solid;
border-width: 1px;
border: none;
border-radius: 0.25rem;
line-height: 1.875rem;
text-decoration: none;
white-space: none;
user-select: none;
cursor: pointer;
text-transform: none;
Expand All @@ -76,6 +74,19 @@ button {
margin-left: 0.25rem;
width: 4rem;
min-height: 2.3rem;
background-color: #e9e9ed;

&:hover {
background-color: #cccccc;
}
}

.highlight {
background-color: lightblue;

&:hover {
background-color: skyblue;
}
}

.slds-assistive-text {
Expand All @@ -91,10 +102,6 @@ button {
white-space: nowrap !important;
}

.highlight {
background-color: lightblue;
}

.hidden {
display: none;
display: none !important;
}
2 changes: 1 addition & 1 deletion action/logo.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div>
<a href="https://www.github.com/Astisme/again-why-salesforce">
<span title="Again, Why Salesforce">
<img src="../assets/icons/awsf-256.png" />
<img alt="Again, Why Salesforce logo" src="../assets/icons/awsf-256.png" />
<span class="slds-assistive-text">Again, Why Salesforce</span>
</span>
<h2>
Expand Down
2 changes: 1 addition & 1 deletion action/notSalesforceSetup.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body > div {
font-weight: normal;
}

& > button {
& > .button {
width: 10rem;
}
}
13 changes: 7 additions & 6 deletions action/notSalesforceSetup.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Again, Why Salesforce popup error</title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand All @@ -15,12 +16,12 @@
</header>
<div>
<h3>This is not a Salesforce Lightning Setup Page</h3>
<button id="login" type="button">
<a href="https://login.salesforce.com">Login to Salesforce</a>
</button>
<button id="go-setup" class="hidden highlight" type="button">
<a href="/lightning/setup">Open Setup</a>
</button>
<a id="login" class="button" href="https://login.salesforce.com">
Login to Salesforce
</a>
<a id="go-setup" class="hidden highlight button" href="/lightning/setup">
Open Setup
</a>
</div>
</body>
</html>
68 changes: 53 additions & 15 deletions action/notSalesforceSetup.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,58 @@
// deno-lint-ignore-file no-window
const authorizedDomainRegex = /^https:\/\/[a-zA-Z0-9.-]+\.lightning\.force\.com\/.*/;
const page = new URLSearchParams(window.location.search).get("url");
const textEl = document.querySelector("h3");
let text;
const sfsetupTextEl = document.querySelector("h3");

const div = document.createElement("div");
const prefix = document.createTextNode("This is not a ")
const strongEl = document.createElement("strong")
const otherText = document.createTextNode("");

sfsetupTextEl.innerText = "";
sfsetupTextEl.appendChild(div);
let insertPrefix = true;
let strongFirst = true;

if (page != null) { // we're in a salesforce page
// switch which button is shown
document.getElementById("login").classList.add("hidden");
const goSetup = document.getElementById("go-setup");
goSetup.classList.remove("hidden");
// update the button href to use the domain
const goSetupLink = goSetup.querySelector("a");
const domain = page.substring(0, page.indexOf("/lightning"));
goSetupLink.href = `${domain}/lightning/setup/SetupOneHome/home`;
// update the bold on the text
text = "This is not a Salesforce Lightning <strong>Setup Page</strong>";
let domain;

try {
domain = new URL(page).origin;
} catch(error){
strongEl.textContent = "Invalid URL";
otherText.textContent = " detected."
insertPrefix = false;
}

// domain is null if an error occurred
if(domain != null){
// Validate the domain (make sure it's a Salesforce domain)
if (!authorizedDomainRegex.test(page)) {
strongEl.textContent = "Invalid Salesforce";
otherText.textContent = " domain detected.";
insertPrefix = false;
} else {
// switch which button is shown
document.getElementById("login").classList.add("hidden");
const goSetup = document.getElementById("go-setup");
goSetup.classList.remove("hidden");
// update the button href to use the domain
goSetup.href = `${domain}/lightning/setup/SetupOneHome/home`;
// update the bold on the text
otherText.textContent = "Salesforce Lightning";
strongEl.textContent = " Setup Page"
strongFirst = false;
}
}
} else {
text = "This is not a <strong>Salesforce Lightning</strong> Setup Page";
strongEl.textContent = "Salesforce Lightning";
otherText.textContent = " Setup Page";
}
insertPrefix && div.appendChild(prefix);
if(strongFirst){
div.appendChild(strongEl);
div.appendChild(otherText)
} else {
div.appendChild(otherText)
div.appendChild(strongEl);
}
textEl.innerText = "";
textEl.insertAdjacentHTML("beforeend", text);
4 changes: 2 additions & 2 deletions action/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ body {
width: 40rem;
}

article {
div#top {
position: relative;
padding: 0;
background-color: #ffffff;
Expand Down Expand Up @@ -75,7 +75,7 @@ header {
}
}

article > div:last-child {
div#top > div:last-child {
padding: 0 !important;
margin-top: 0.75rem;
margin-bottom: 0.75rem;
Expand Down
5 changes: 3 additions & 2 deletions action/popup.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Again, Why Salesforce popup</title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand All @@ -11,7 +12,7 @@
</head>

<body>
<article>
<div id="top">
<header>
<object data="./logo.html" type="text/html"></object>
<div>
Expand Down Expand Up @@ -53,7 +54,7 @@
<tbody id="tabs"></tbody>
</table>
</div>
</article>
</div>

<template id="tr_template">
<tr class="tab" draggable="true">
Expand Down
7 changes: 6 additions & 1 deletion manifest/build-manifest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ if (browser === "firefox") {

delete manifest.minimum_chrome_version;
delete manifest.background.service_worker;
delete manifest.browser_specific_settings.safari;

} else if (browser === "chrome") {
delete manifest.browser_specific_settings;

} else if (browser === "safari") {
delete manifest.browser_specific_settings;
delete manifest.minimum_chrome_version;
delete manifest.browser_specific_settings.gecko;

} else {
console.error(
`Usage: ${process.argv[0]} ${
Expand Down
2 changes: 1 addition & 1 deletion manifest/template-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "112.0.2"
"strict_min_version": "112.0"
},
"safari": {
"strict_min_version": "14"
Expand Down
Loading