Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- Yiddish and Tamil translations
- advanced option to show custom message in Preferences

### Changed
- remove flags in Welcome window
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ Note that this will disable graphical way of opening Stretchly Preferences. To a
#### Show tray menu in Strict Mode
If you want to show tray menu even while in Strict mode, set `showTrayMenuInStrictMode` to `true`.

#### Show custom message in Preferences
If you want to show custom message in Preferences, set `customPreferencesMessage` to string of your liking. This might be useful for corporate installations.

## Contributor Preferences

*Stretchly* is free but you can support it by contributing code, translations or money. You will be rewarded by getting access to **Contributor Preferences**, ability to **Sync Preferences**, chat on **Discord** and more!
Expand Down
13 changes: 13 additions & 0 deletions app/css/preferences.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ body > div > :last-child {
width: 32px;
}

.custom-message {
background: var(--nav-bg);
border-radius: 0 0 0 4px;
box-shadow: var(--box-shadow);
display: block;
font-size: 13px;
padding: 8px 16px;
position: sticky;
top: 56px;
margin: 0;
z-index: 9;
}

body > .hidden,
.heart > .hidden {
display: none;
Expand Down
15 changes: 11 additions & 4 deletions app/preferences-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ window.onload = async (e) => {
setWindowHeight()
setTimeout(() => { eventsAttached = true }, 500)

if (settings.customPreferencesMessage) {
const customMessageDiv = document.createElement('div');
customMessageDiv.className = 'custom-message';
customMessageDiv.textContent = settings.customPreferencesMessage;
document.querySelector('.navigation').parentNode.insertBefore(customMessageDiv, document.querySelector('.navigation').nextSibling);
}

if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
const imagesWithDarkVersion = document.querySelectorAll('[data-has-dark-version]')
imagesWithDarkVersion.forEach(image => {
Expand Down Expand Up @@ -139,13 +146,13 @@ window.onload = async (e) => {
})
event.target.closest('a').classList.add('active')

document.querySelectorAll('body > div').forEach(section => {
const toBeDisplayed =
document.querySelector(`.${event.target.closest('[data-section]').getAttribute('data-section')}`)
const toBeDisplayed = document.querySelector(`.${event.target.closest('[data-section]').getAttribute('data-section')}`)
document.querySelectorAll('body > div:not(.custom-message)').forEach(section => {
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The selector hardcodes the .custom-message class which creates tight coupling. Consider using a data attribute or a more semantic approach to exclude the custom message from section hiding logic.

Suggested change
document.querySelectorAll('body > div:not(.custom-message)').forEach(section => {
document.querySelectorAll('body > div:not([data-exclude="true"])').forEach(section => {

Copilot uses AI. Check for mistakes.
if (section !== toBeDisplayed) {
section.classList.add('hidden')
} else {
section.classList.remove('hidden')
}
toBeDisplayed.classList.remove('hidden')
})

setSameWidths()
Expand Down
3 changes: 2 additions & 1 deletion app/utils/defaultSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ export default {
skipToNextMiniBreakShortcut: '',
skipToNextLongBreakShortcut: '',
resetBreaksShortcut: '',
showTrayMenuInStrictMode: false
showTrayMenuInStrictMode: false,
customPreferencesMessage: ''
}
Loading