Skip to content

Commit

Permalink
music detection fixed & internationalized
Browse files Browse the repository at this point in the history
  • Loading branch information
ImprovedTube committed Mar 24, 2023
1 parent 97962ae commit 5da5d51
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion js&css/web-accessible/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ImprovedTube.ytElementsHandler = function (node) {
}
} else if (name === 'META') {
if (node.getAttribute('itemprop') === 'genre') {
ImprovedTube.genre = node.content;
ImprovedTube.category = node.content;
}
if (node.getAttribute('name') === 'keywords') {
ImprovedTube.keywords = node.content;
Expand Down
2 changes: 1 addition & 1 deletion js&css/web-accessible/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ImprovedTube.init = function () {

document.addEventListener('yt-navigate-finish', function () {
ImprovedTube.pageType();
ImprovedTube.commentsSidebarPosition();
ImprovedTube.commentsSidebar();

if (ImprovedTube.elements.player && ImprovedTube.elements.player.setPlaybackRate) {
ImprovedTube.videoPageUpdate();
Expand Down
2 changes: 1 addition & 1 deletion js&css/web-accessible/www.youtube.com/appearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ ImprovedTube.playerRemainingDuration = function () {
/*------------------------------------------------------------------------------
4.2.1.6 Comments position to sidebar
------------------------------------------------------------------------------*/
ImprovedTube.commentsSidebarPosition=()=>{ if(ImprovedTube.storage.comments_sidebar_position){
ImprovedTube.commentsSidebar=()=>{ if(ImprovedTube.storage.comments_sidebar){
document.querySelector("#columns").appendChild(document.querySelector("#comments"));

if(window.matchMedia("(max-width: 1598px)").matches)
Expand Down
12 changes: 6 additions & 6 deletions js&css/web-accessible/www.youtube.com/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ ImprovedTube.playerPlaybackSpeed = function (change) {
if (this.storage.player_forced_playback_speed === true) {
if (player.getVideoData().isLive === false &&
(this.storage.player_force_speed_on_music === true ||
(document.querySelector('h3#title')?.innerText !== 'Music'
&& (ImprovedTube.genre !== 'Music' || /interview|back[- ]?stage/i.test(ImprovedTube.keywords + ImprovedTube.title) )
&& !/official (music )?video|lyrics|cover[\)\]]|[\(\[]cover|cover version|karaoke|(sing|play)[- ]?along/i.test(ImprovedTube.title + ImprovedTube.keywords)
&& location.href.indexOf('music') === -1
)
document.querySelector('h3#title')?.innerText !== 'Music' // (=buyable/registered music table)
|| (
(ImprovedTube.elements.category !== 'Music' && !/official (music )?video|lyrics|cover[\)\]]|[\(\[]cover|cover version|karaok|(sing|play)[- ]?along|卡拉OK|卡拉OK|الكاريوكيкараоке|カラオケ|노래방/i.test(ImprovedTube.elements.title + ImprovedTube.elements.keywords)
) || /do[ck]u|interv[iyj]|back[- ]?stage|インタビュー|entrevista|面试|面試|회견|wawancara|مقابلة|интервью|entretien|기록한 것|记录|記錄|ドキュメンタリ|وثائقي|документальный/i.test(ImprovedTube.elements.keywords + ImprovedTube.elements.title)
) // && location.href.indexOf('music') === -1 // (=only running on www.youtube.com anyways)
)) {
player.setPlaybackRate(Number(option));
video.playbackRate = Number(option);
Expand Down Expand Up @@ -394,7 +394,7 @@ ImprovedTube.playerAds = function (parent) {
button.click(); document.querySelector("*[target-id*='engagement-panel-ads']").remove(); document.querySelector(".ytd-ad-slot-renderer").remove();
}
} else if (this.storage.player_ads === 'block_music') {
if (ImprovedTube.elements.genre === 'music') {
if (ImprovedTube.elements.category === 'music') {
button.click(); document.querySelector("*[target-id*='engagement-panel-ads']").remove(); document.querySelector(".ytd-ad-slot-renderer").remove();
}
}
Expand Down
2 changes: 1 addition & 1 deletion menu/skeleton-parts/appearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ extension.skeleton.main.layers.section.appearance.on.click.comments = {
},
comments_sidebar_position: {
component: "switch",
text: "SidebarPosition",
text: "sidebar",
},
squared_user_images: {
component: 'switch',
Expand Down

0 comments on commit 5da5d51

Please sign in to comment.