Skip to content

Commit

Permalink
v6.4 - Various Optimizations, Improvements & Fixes
Browse files Browse the repository at this point in the history
- Use dialog element for SuperModal with improved routing capability for back button support.
- Display discovery items randomly.
- Search results now filter livestreams and shorts.
- Fix Favorites Set & Reset.
- More Efficient Image Error Handling / Removed Piped Thumbnail Dependency for stream items.
- Avoid adding unnecessary data in Library.
- Added ability to add to favorites from superModal.
- Avoid >50min streams from discovery.
- Several Code Optimizations.
- Added Icons for Library Tools.
- List Container's Open In YT button now shows channel/playlist name directly instead of the 'open in yt' text.
- IntersectionObserver for loading more items in a list instead of onscroll event listener.
  • Loading branch information
n-ce authored Oct 31, 2023
1 parent 14fe871 commit 726f60e
Show file tree
Hide file tree
Showing 23 changed files with 323 additions and 248 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

## Changelog

**v6.4**:
- Import, Export Library
- Various Fixes & Optimizations

**v6.3**:
- Library (Discover, History, Favorites, Playlists)
- Channel Support
Expand Down
77 changes: 49 additions & 28 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
<i class="ri-settings-line"></i>
<p>Settings</p>
</a>
<a id="/list" class="hide"><br>
<p>List</p>
<a href="/list" id="/list" class="hide">
<p>list</p>
</a>
</nav>
<main>
Expand All @@ -65,7 +65,7 @@
<img height="100%" width="100%" crossorigin="anonymous" alt="Current Playing Media Thumbnail">

<div id="metadata">
<a id="title" href="" target="_blank">ytify 6.3</a>
<a id="title" href="" target="_blank">ytify 6.4</a>
<a id="author" href="" target="_blank">Channel</a>
<select id="bitrateSelector">
<option value="">Bitrate</option>
Expand All @@ -87,7 +87,7 @@
<section id="upcoming">
<span id="queuetools">
<button>
<i class="ri-delete-bin-7-line"></i> Clear
<i class="ri-close-line"></i> Clear
</button>
<button>
<i class="ri-shuffle-line"></i> Shuffle
Expand Down Expand Up @@ -133,13 +133,16 @@ <h1>search results show here</h1>
</section>

<section id="library">

<details id="discover">
<summary>
<i class="ri-compass-3-line"></i> Discover
</summary>
<button>Clear All</button>
<button>Remove</button>
<button>
<i class="ri-close-line"></i> Clear All
</button>
<button>
<i class="ri-subtract-line"></i> Remove
</button>
<div>
<h2>Listen more to discover more.</h2>
</div>
Expand All @@ -149,21 +152,39 @@ <h2>Listen more to discover more.</h2>
<summary>
<i class="ri-history-line"></i> History
</summary>
<button>Clear All</button>
<button>Remove</button>
<button>
<i class="ri-close-line"></i> Clear All
</button>
<button>
<i class="ri-subtract-line"></i> Remove
</button>
<div></div>
</details>

<details id="favorites">
<summary>
<i class="ri-heart-fill"></i> Favorites
</summary>
<button>Clear All</button>
<button>Remove</button>
<button>Enqueue</button>
<button>
<i class="ri-close-line"></i> Clear All
</button>
<button>
<i class="ri-subtract-line"></i> Remove
</button>
<button>
<i class="ri-list-check-2"></i> Enqueue
</button>
<div></div>
</details>

<br>
<div>
<label id="importBtn" for="upload">
<i class="ri-login-circle-line"></i> Import</label>
<input type="file" id="upload" class="hide">
<label id="exportBtn">
<i class="ri-logout-circle-line"></i> Export</label>
</div>
<br>
</section>


Expand All @@ -172,6 +193,15 @@ <h2>Listen more to discover more.</h2>
<label for="pipedInstances">Piped Instance</label>
<select id="pipedInstances"></select>
</span>
<span>
<label for="roundnessChanger">UI Roundness</label>
<select id="roundnessChanger">
<option value="none">None</option>
<option value="1vmin">Light</option>
<option value="2vmin" selected>Medium</option>
<option value="4vmin">Heavy</option>
</select>
</span>
<span>
<label for="themeSelector">Theming Scheme</label><select id="themeSelector">
<option value="auto">System</option>
Expand All @@ -185,17 +215,8 @@ <h2>Listen more to discover more.</h2>
<toggle-switch id="qualitySwitch">Highest Quality Audio</toggle-switch>
<toggle-switch id="suggestionsSwitch" checked>Display Search Suggestions</toggle-switch>

<span>
<label for="roundnessChanger">UI Roundness</label>
<select id="roundnessChanger">
<option value="none">None</option>
<option value="1vmin">Light</option>
<option value="2vmin" selected>Medium</option>
<option value="4vmin">Heavy</option>
</select>
</span>

<a href="/" id="deleteButton">Clear All Stored Data</a>
<a href="/" id="deleteButton">Clear all data</a>

<a href="https://github.com/n-ce/ytify/" target="_blank">View on Github</a>

Expand All @@ -208,7 +229,6 @@ <h2>Listen more to discover more.</h2>

</section>


<section id="list">
<span id="listTools">
<button id="playAllBtn">
Expand All @@ -230,7 +250,6 @@ <h1>playlist or channel items show here</h1>
</div>
</section>


<footer>

<span>
Expand Down Expand Up @@ -267,7 +286,7 @@ <h1>playlist or channel items show here</h1>
</footer>
</main>

<div id="superModal" class="hide">
<dialog id="superModal">
<ul>
<li><i class="ri-play-line"></i>Play Now</li>
<li><i class="ri-list-check-2"></i>Enqueue</li>
Expand All @@ -276,14 +295,16 @@ <h1>playlist or channel items show here</h1>
<select id="playlistSelector">
<option>Add To Playlist</option>
<option value="+pl">Create New Playlist</option>
<option value="favorites">Favorites</option>
</select>
</li>
<li><i class="ri-rfid-line"></i>Start Radio</li>
<li><i class="ri-download-2-line"></i>Download</li>
<li><i class="ri-youtube-line"></i>View Channel</li>
</ul>
</div>
</dialog>

<script src="/src/scripts/main.ts" type="module"></script>
</body>

</html>
</html>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ytify",
"private": true,
"version": "6.3.X",
"version": "6.4.X",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
Binary file modified public/remixicon.woff2
Binary file not shown.
11 changes: 10 additions & 1 deletion src/components/streamItem.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ span {

slot {
font-size: medium;
height: 50%;
height: 55%;
width: auto;
display: flex;
overflow: hidden;
word-break: break-all;
text-overflow: clip;
}

div {
Expand Down Expand Up @@ -86,6 +87,10 @@ div {
flex-direction: column;
}

#author {
height: auto;
text-overflow: clip;
}


@media(orientation:landscape) {
Expand All @@ -96,4 +101,8 @@ div {
flex-direction: row;
justify-content: space-between;
}

#author {
height: initial;
}
}
31 changes: 9 additions & 22 deletions src/components/streamItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,12 @@ customElements.define('stream-item', class extends HTMLElement {
thumbnail.crossOrigin = 'anonymous';
thumbnail.id = 'thumbnail';
thumbnail.loading = 'lazy';
thumbnail.addEventListener('error', () => {
const quality = thumbnail.src.includes('hq720') ? 'hqdefault' : 'hq720';
thumbnail.src = imgUrl(
<string>this.dataset.id,
quality);
});
thumbnail.addEventListener('load', () => {
const backupImg = this.dataset.pipedImg;
if (thumbnail.naturalWidth === 120 && backupImg) {
thumbnail.src = backupImg;
return;
}
['span', '#metadata'].forEach(_ => (<HTMLElement>root.querySelector(_)).style.opacity = '1');
});
thumbnail.onerror = () =>
thumbnail.src = 'https://corsproxy.io?' + encodeURIComponent(`https://i.ytimg.com/vi/${this.dataset.id}/mqdefault.jpg`);
thumbnail.onload = () =>
thumbnail.naturalWidth === 120 ?
thumbnail.src = thumbnail.src.replace('.webp', '.jpg').replace('vi_webp', 'vi') :
['span', '#metadata'].forEach(_ => (<HTMLElement>root.querySelector(_)).style.opacity = '1');

const duration = $('p');
duration.id = 'duration';
Expand All @@ -54,9 +46,7 @@ customElements.define('stream-item', class extends HTMLElement {

const author = $('p');
author.id = 'author';
avatar.addEventListener('error', () => {
avatar.src = blankImage;
});
avatar.onerror = () => avatar.src = blankImage;

const viewsXuploaded = $('p');
viewsXuploaded.id = 'viewsXuploaded';
Expand All @@ -78,14 +68,11 @@ customElements.define('stream-item', class extends HTMLElement {
const author = <HTMLParagraphElement>root.getElementById('author');
const viewsXuploaded = <HTMLParagraphElement>root.getElementById('viewsXuploaded');

if (!getSaved('img') && data.thumbnail) {
data.pipedImg = data.thumbnail;
if (!getSaved('img')) {
thumbnail.src = imgUrl(<string>data.id, 'mqdefault');

data.avatar ?
avatar.src = data.avatar :
avatar.style.display = 'none';

}
else thumbnail.src = blankImage;

Expand All @@ -97,6 +84,6 @@ customElements.define('stream-item', class extends HTMLElement {
author.textContent = data.author;

if (data.views)
viewsXuploaded.textContent = data.views + (data.uploaded ? ' • ' + data.uploaded : '');
viewsXuploaded.textContent = data.views + (data.uploaded ? ' • ' + data.uploaded.replace('Streamed ', '') : '');
}
})
6 changes: 5 additions & 1 deletion src/lib/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const suggestions = <HTMLUListElement>document.getElementById('suggestion

export const suggestionsSwitch = <HTMLSelectElement>document.getElementById('suggestionsSwitch');

export const superModal = <HTMLDivElement>document.getElementById('superModal');
export const superModal = <HTMLDialogElement>document.getElementById('superModal');

export const upcomingBtn = <HTMLAnchorElement>document.getElementById('/upcoming');

Expand All @@ -33,5 +33,9 @@ export const subtitleSelector = <HTMLSelectElement>document.getElementById('subt
export const subtitleTrack = <HTMLTrackElement>audio.firstElementChild;

export const favButton = <HTMLInputElement>document.getElementById('favButton');

export const favIcon = <HTMLLabelElement>favButton.nextElementSibling;
// Add To Playlist Selector
export const atpSelector = <HTMLSelectElement>document.getElementById('playlistSelector');

export const [playAllBtn, enqueueBtn, saveListBtn, openInYtBtn] = <HTMLCollectionOf<HTMLButtonElement>>(<HTMLSpanElement>document.getElementById('listTools')).children;
Loading

1 comment on commit 726f60e

@n-ce
Copy link
Owner Author

@n-ce n-ce commented on 726f60e Oct 31, 2023

Choose a reason for hiding this comment

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

Forgot to mention, it also adds ability to import and export library.

Please sign in to comment.