mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-07-03 17:38:23 +00:00
feat(ToggleMenuServiceItem): parse default nav endpoint
This commit is contained in:
@@ -2,8 +2,9 @@ import Text from './misc/Text.js';
|
||||
import NavigationEndpoint from './NavigationEndpoint.js';
|
||||
|
||||
import { YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../index.js';
|
||||
|
||||
class Button extends YTNode {
|
||||
export default class Button extends YTNode {
|
||||
static type = 'Button';
|
||||
|
||||
text?: string;
|
||||
@@ -15,7 +16,7 @@ class Button extends YTNode {
|
||||
|
||||
endpoint: NavigationEndpoint;
|
||||
|
||||
constructor(data: any) {
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
|
||||
if (data.text) {
|
||||
@@ -40,6 +41,4 @@ class Button extends YTNode {
|
||||
|
||||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint || data.serviceEndpoint || data.command);
|
||||
}
|
||||
}
|
||||
|
||||
export default Button;
|
||||
}
|
||||
@@ -1,24 +1,25 @@
|
||||
import Text from './misc/Text.js';
|
||||
import NavigationEndpoint from './NavigationEndpoint.js';
|
||||
import { YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../index.js';
|
||||
|
||||
class ToggleMenuServiceItem extends YTNode {
|
||||
export default class ToggleMenuServiceItem extends YTNode {
|
||||
static type = 'ToggleMenuServiceItem';
|
||||
|
||||
text: Text;
|
||||
toggled_text: Text;
|
||||
icon_type: string;
|
||||
toggled_icon_type: string;
|
||||
endpoint: NavigationEndpoint;
|
||||
default_endpoint: NavigationEndpoint;
|
||||
toggled_endpoint: NavigationEndpoint;
|
||||
|
||||
constructor(data: any) {
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.text = new Text(data.defaultText);
|
||||
this.toggled_text = new Text(data.toggledText);
|
||||
this.icon_type = data.defaultIcon.iconType;
|
||||
this.toggled_icon_type = data.toggledIcon.iconType;
|
||||
this.endpoint = new NavigationEndpoint(data.toggledServiceEndpoint);
|
||||
this.default_endpoint = new NavigationEndpoint(data.defaultServiceEndpoint);
|
||||
this.toggled_endpoint = new NavigationEndpoint(data.toggledServiceEndpoint);
|
||||
}
|
||||
}
|
||||
|
||||
export default ToggleMenuServiceItem;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import Button from '../Button.js';
|
||||
import type { RawNode } from '../../index.js';
|
||||
|
||||
class MenuNavigationItem extends Button {
|
||||
static type = 'MenuNavigationItem';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user