Skip to content

Commit 6055ce1

Browse files
authored
Update youtube.provider.ts
1 parent 09f7997 commit 6055ce1

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

apps/extension/src/providers/list/youtube.provider.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,41 @@ import { ProviderInterface } from "@gitroom/extension/providers/provider.interfa
33
export class YoutubeProvider implements ProviderInterface {
44
identifier = "youtube";
55
baseUrl = "https://www.youtube.com";
6-
element = `ytd-topbar-menu-button-renderer button[aria-label^="Create"]`;
6+
element = `#postiz-button`;
77
attachTo = `#end`;
88
style = "dark" as "dark";
99

1010
findIdentifier = (element: HTMLElement) => {
1111
const match = window.location.href.match(/v=([\w-]{11})/);
1212
return match ? match[1] : window.location.href;
1313
};
14+
15+
onLoad = () => {
16+
const container = document.querySelector(this.attachTo);
17+
if (!container || document.querySelector("#postiz-button")) return;
18+
19+
const button = document.createElement("button");
20+
button.id = "postiz-button";
21+
button.style.cssText = `
22+
background: none;
23+
border: none;
24+
cursor: pointer;
25+
margin-left: 8px;
26+
display: flex;
27+
align-items: center;
28+
`;
29+
30+
const img = document.createElement("img");
31+
img.src = "https://raw.githubusercontent.com/gitroomhq/postiz-app/main/assets/logo.svg";
32+
img.alt = "Postiz";
33+
img.style.cssText = "height: 24px; width: 24px;";
34+
35+
button.appendChild(img);
36+
container.appendChild(button);
37+
38+
button.addEventListener("click", () => {
39+
// Trigger Postiz UI
40+
// This should call the method that opens the Postiz interface
41+
});
42+
};
1443
}

0 commit comments

Comments
 (0)