Skip to content

Commit

Permalink
Исправлены функции расширения после очередных изменений сайта.
Browse files Browse the repository at this point in the history
  • Loading branch information
awers24 committed Nov 4, 2024
1 parent a9b362f commit e5f0dfa
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vk-music-saver",
"version": "1.3.0",
"version": "1.3.1",
"type": "module",
"scripts": {
"dev": "cross-env NODE_OPTIONS=\"--import=tsx/esm\" webpack serve --config webpack.config.ts --env --dev",
Expand Down
4 changes: 2 additions & 2 deletions src/elements/createDownloadAudioButton/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

// плеер музыки
:global(.AudioPlayerBlock__root),
:global([class^='AudioPlayerUserControlsContainer-module__userButtonsContainer--']) {
:global([class*='AudioPlayerUserControlsContainer__userButtonsContainer--']) {
.DownloadAudioButton {
transition: opacity 0.15s ease-out;
opacity: 1;
Expand Down Expand Up @@ -117,7 +117,7 @@
}
}

:global([class*='AudioRow-module__root']) {
:global([class*='AudioRow__root']) {
.DownloadAudioButton {
display: flex;
flex-direction: row-reverse;
Expand Down
8 changes: 3 additions & 5 deletions src/interactions/onAddAudioRowReact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type CallbackFunc = (el: HTMLElement, audio: AudioAudio | null) => void;

const interaction = new InteractionListener<CallbackFunc>();

const AUDIO_ROW_SELECTOR = '[class*="AudioRow-module__root"]';
const AUDIO_ROW_SELECTOR = '[class*="AudioRow__root"]';

const findApiAudio = (el: HTMLElement): AudioAudio | null => {
const { props: audioRowProps } = getReactAttrs(el);
Expand Down Expand Up @@ -50,9 +50,7 @@ const onCallback = (el: HTMLElement) => {
};

const findAudioList = async () => {
for (const items of document.querySelectorAll<ObservedHTMLElement>(
'[class*="AudioListItems-module__root--"] > div'
)) {
for (const items of document.querySelectorAll<ObservedHTMLElement>('[class*="AudioListItems__root--"] > div')) {
if (items._vms_mbs) continue;

items._vms_mbs = new MutationObserver((mutations) => {
Expand All @@ -79,7 +77,7 @@ const findAudioList = async () => {
};

const findAllAudioRows = async (retry = 0) => {
if (document.querySelector(`.vkui__root .vkuiFlex [class*="Skeleton-module__skeleton"]`)) {
if (document.querySelector(`.vkui__root .vkuiFlex [class*="Skeleton__skeleton"]`)) {
await delay(1000);
return findAllAudioRows(retry + 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getAudioPlayerUserControlsContainer = async (root: HTMLElement, retryCount
}

const container = root.querySelector<HTMLElement>(
'[class^="AudioPlayerUserControlsContainer-module__userButtonsContainer--"]'
'[class*="AudioPlayerUserControlsContainer__userButtonsContainer--"]'
);

if (!container) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/audioPage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const initAudioPage = () => {

onOpenPlaylistPage(() => {
for (const wrap of document.querySelectorAll<HTMLElement>(
'[data-testid="audioplayerblocksectionslayout"],[class*="AudioPlayerBlockSectionsLayout-module__root"]'
'[data-testid="audioplayerblocksectionslayout"],[class*="AudioPlayerBlockSectionsLayout__root"]'
)) {
onAddPlayer(wrap);
}
Expand Down
8 changes: 4 additions & 4 deletions src/modules/audioPlaylist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ const injectToAudioPlaylistPageNew = async (retry = 0) => {
const spaRoot = document.getElementById('spa_root');
if (!spaRoot) return;

if (spaRoot.querySelector(`[class*="Skeleton-module__skeleton"]`)) {
if (spaRoot.querySelector(`[class*="Skeleton__skeleton"]`)) {
await delay(1000);
return injectToAudioPlaylistPageNew(retry + 1);
}

const actions = spaRoot.querySelector<DownloadTargetElement>('[class*="AudioListHeader-module__actions--"]');
const actions = spaRoot.querySelector<DownloadTargetElement>('[class*="AudioListHeader__actions--"]');
if (!actions) return;
if (actions.vms_down_inj) return;
actions.vms_down_inj = true;
Expand Down Expand Up @@ -179,13 +179,13 @@ const injectToAudioPlaylistPageNew = async (retry = 0) => {
};

const injectToAudioPlaylistModalNew = async (playlistFullId: string, retry = 0) => {
if (document.querySelector(`.vkui__root .vkuiFlex [class*="Skeleton-module__skeleton"]`)) {
if (document.querySelector(`.vkui__root .vkuiFlex [class*="Skeleton__skeleton"]`)) {
await delay(1000);
return injectToAudioPlaylistModalNew(playlistFullId, retry + 1);
}

for (const actions of document.querySelectorAll<DownloadTargetElement>(
'[class*="AudioListModalHeader-module__actions--"]'
'[class*="AudioListModalHeader__actions--"]'
)) {
if (!actions) return;
if (actions.vms_down_inj) return;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/injectDownloadButtonInAudioRow/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const onAddReactRow = async (audioRow: HTMLElement, audio: AudioAudio | null) =>
return;
}

const actions = audioRow.querySelector<RowInnerElement>('[class*="AudioRow-module__actions--"]');
const actions = audioRow.querySelector<RowInnerElement>('[class*="AudioRow__actions--"]');
if (!actions) return;
if (actions._vms_inj) return;
actions._vms_inj = true;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/showBitrateNearDuration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const onAddRow = async (row: HTMLElement) => {
const onAddRowReact = async (row: HTMLElement, audio: AudioAudio | null) => {
if (!audio) return;

const rowAfter = row.querySelector<HTMLElement>(`[class*="AudioRow-module__after--"]`);
const rowAfter = row.querySelector<HTMLElement>(`[class*="AudioRow__after--"]`);
if (!rowAfter) return;

if (rowAfter.getElementsByClassName(styles.audioRow__bitrate).length) {
Expand Down

0 comments on commit e5f0dfa

Please sign in to comment.