-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chrome 1.3 and update readme with video * New Tab Checkbox (#17) * Add files via upload * Add files via upload * New Checkbox, Save Shaded * add new site url for manifest * Removed workspace. Updated readme to add Jen and review her changes. * Update readme and fixed typo in contentjs for storage and added placeholders * readme * Create LICENSE (#19) * Update LICENSE (#21) * update manifest version --------- Co-authored-by: Jennifer Olson <[email protected]>
- Loading branch information
1 parent
b3f6f44
commit 842547f
Showing
6 changed files
with
127 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
# why-salesforce | ||
|
||
This extension allows users to create custom tabs in Setup for their most-used settings | ||
|
||
[Demo Video](https://youtu.be/BtlKRvac9ZQ) | ||
|
||
[Install on Chrome Web Store](https://chrome.google.com/webstore/detail/why-salesforce/ghakkjfjpnhpggbkfkeplbefkipfoaod) | ||
|
||
### Roadmap | ||
|
||
- [x] Ability to customize tab | ||
- [x] Salesforce SLDS | ||
- Feedback on save and delete | ||
- Update tabs onSave without refresh | ||
- Disable save button if tabs list empty | ||
- [x] Salesforce SLDS | ||
- [ ] Feedback on save and delete | ||
- [ ] Update tabs onSave without refresh | ||
- [x] Disable save button if tabs list empty | ||
- [ ] Reorder tabs | ||
- [x] Minify SLDS files | ||
- Dark mode for flows | ||
- Org specific tab customization | ||
- Highlight tab when user is on that url | ||
- Open full urls in new tab | ||
- Better solutions for waiting until Salesforce setup is completely loaded | ||
- Utils class for templates or other shared code | ||
- [ ] Dark mode for flows | ||
- [ ] Org specific tab customization | ||
- [ ] Highlight tab when user is on that url | ||
- [x] Open full urls in new tab | ||
- [ ] Better solutions for waiting until Salesforce setup is completely loaded | ||
- [ ] Utils class for templates or other shared code | ||
|
||
Contributors | ||
|
||
- [Warren Walters](https://www.linkedin.com/in/walters954/) | ||
- [Chris Rouse (Firefox port)](https://www.linkedin.com/in/chris-rouse/) | ||
- [Chris Rouse (Firefox port)](https://www.linkedin.com/in/chris-rouse/) | ||
- [Jennifer Olson](https://www.linkedin.com/in/olsonjenn05/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,84 @@ | ||
const storageKey = 'sfmWhySF'; | ||
|
||
function init(setupTabUl){ | ||
if (setupTabUl){ | ||
function init(setupTabUl) { | ||
if (setupTabUl) { | ||
let rows = []; | ||
|
||
browser.storage.sync.get([storageKey], function(items) { | ||
let rowObj = items[storageKey]; | ||
const rowObj = items[storageKey] || []; | ||
|
||
if (!rowObj) { //Did not find data inside browser storage | ||
rowObj = initTabs(); | ||
} | ||
|
||
for (const rowId in rowObj) { | ||
let row = rowObj[rowId]; | ||
rows.push(generateRowTemplate(row.tabTitle,row.url)) | ||
rows.push(generateRowTemplate(row.tabTitle, row.url, row.openInNewTab)); | ||
} | ||
setupTabUl.insertAdjacentHTML('beforeend', rows.join('')); | ||
|
||
// Add click event listeners after rows are inserted | ||
addClickEventListeners(); | ||
}); | ||
|
||
} | ||
} | ||
|
||
function delayLoadSetupTabs(count) { | ||
const setupTabUl = document.getElementsByClassName("tabBarItems slds-grid")[0]; | ||
const setupTabUl = document.getElementsByClassName("tabBarItems slds-grid")[0]; | ||
count++; | ||
|
||
if (count > 5){ | ||
if (count > 5) { | ||
console.log('Why Salesforce - failed to find setup tab.'); | ||
return; | ||
} | ||
|
||
if (!setupTabUl) { | ||
setTimeout(function() { delayLoadSetupTabs(0); }, 3000); | ||
setTimeout(function() { delayLoadSetupTabs(count); }, 3000); // Fixed to pass count correctly | ||
} else { | ||
init(setupTabUl); | ||
} | ||
} | ||
|
||
setTimeout(function() { delayLoadSetupTabs(0); }, 3000); | ||
|
||
|
||
function generateRowTemplate(tabTitle, url){ | ||
return `<li role="presentation" style="" class="oneConsoleTabItem tabItem slds-context-bar__item borderRight navexConsoleTabItem" data-aura-class="navexConsoleTabItem"> | ||
<a role="tab" tabindex="-1" title="${tabTitle}" aria-selected="false" href="${url}" class="tabHeader slds-context-bar__label-action " > | ||
<span class="title slds-truncate" >${tabTitle}</span> | ||
</a> | ||
</li>` | ||
function generateRowTemplate(tabTitle, url, openInNewTab) { | ||
const target = openInNewTab ? '_blank' : '_self'; | ||
return `<li role="presentation" class="oneConsoleTabItem tabItem slds-context-bar__item borderRight navexConsoleTabItem" data-aura-class="navexConsoleTabItem" data-url="${url}"> | ||
<a role="tab" tabindex="-1" title="${tabTitle}" aria-selected="false" href="${url}" target="${target}" class="tabHeader slds-context-bar__label-action"> | ||
<span class="title slds-truncate">${tabTitle}</span> | ||
</a> | ||
</li>`; | ||
} | ||
|
||
function initTabs(){ | ||
function initTabs() { | ||
let tabs = [ | ||
{tabTitle : 'Flow', url: '/lightning/setup/Flows/home'}, | ||
{tabTitle : 'User', url: '/lightning/setup/ManageUsers/home'} | ||
] | ||
{ tabTitle: 'Home', url: '/', openInNewTab: false }, | ||
{ tabTitle: 'Flow', url: '/lightning/setup/Flows/home', openInNewTab: true }, | ||
{ tabTitle: 'User', url: '/lightning/setup/ManageUsers/home', openInNewTab: false } | ||
]; | ||
|
||
browser.storage.sync.set({ storageKey: tabs }, function() { | ||
|
||
browser.storage.sync.set({storageKey: tabs}, function() { | ||
//TODO combine with popup.js with background service | ||
}); | ||
|
||
return tabs; | ||
} | ||
} | ||
|
||
function addClickEventListeners() { | ||
chrome.storage.sync.get([storageKey], function(items) { | ||
const rowObj = items[storageKey] || []; | ||
for (const rowId in rowObj) { | ||
let tab = rowObj[rowId]; | ||
document.querySelectorAll(`a[href="${tab.url}"]`).forEach(link => { | ||
link.addEventListener('click', function(event) { | ||
if (tab.openInNewTab) { | ||
event.preventDefault(); | ||
window.open(tab.url, '_blank'); | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters