├── .gitignore ├── src ├── msx │ └── start.json ├── index.html ├── observer.html ├── template.html ├── scripts │ ├── parcel-polyfix.ts │ ├── index.ts │ ├── content-controller.ts │ ├── template.ts │ ├── data.ts │ ├── observer.ts │ ├── search.ts │ ├── settings.ts │ └── lib │ │ └── tvx-plugin-module.min.d.ts ├── styles │ └── main.css ├── search.html └── settings.html ├── tsconfig.json ├── package.json ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .parcel-cache 3 | node_modules 4 | dist 5 | -------------------------------------------------------------------------------- /src/msx/start.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Interaction Plugin Examples (TypeScript Edition)", 3 | "version": "1.1.0", 4 | "parameter": "menu:request:interaction:init@{PREFIX}{SERVER}/index.html", 5 | "note": "For this service, Media Station X 0.1.97 or higher is needed." 6 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "ES2015", 5 | "esModuleInterop": true, 6 | "strictNullChecks": false, 7 | "noImplicitAny": true, 8 | "allowJs": true, 9 | "resolveJsonModule": true 10 | } 11 | } -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Interaction Plugin Examples (TypeScript Edition) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/observer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Observer Example Interaction Plugin (TypeScript Edition) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Template Interaction Plugin (TypeScript Edition) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/scripts/parcel-polyfix.ts: -------------------------------------------------------------------------------- 1 | let polyfixed: boolean = false; 2 | 3 | export function polyfix(): void { 4 | //Note: This function is called polyfix (instead of polyfill), because it just fixes some TV-related parcel issues (instead of providing a fulfilled implementation) 5 | if (!polyfixed) { 6 | polyfixed = true; 7 | //Add Symbol fix 8 | if (typeof Symbol == "undefined") { 9 | window.Symbol = undefined; 10 | } 11 | //Add URL fix 12 | if (typeof URL == "undefined" || !URL.prototype.hasOwnProperty("href")) { 13 | //@ts-ignore 14 | window.URL = function (url: string) { 15 | this.href = url; 16 | }; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "msx-interaction-plugin-examples", 3 | "version": "1.1.0", 4 | "description": "Media Station X - Interaction Plugin Examples", 5 | "scripts": { 6 | "clean": "rimraf dist/*.*", 7 | "start": "parcel", 8 | "build": "parcel build", 9 | "clean-build": "npm run clean && npm run build" 10 | }, 11 | "browserslist": "since 2010", 12 | "targets": { 13 | "default": { 14 | "publicUrl": "." 15 | } 16 | }, 17 | "source": [ 18 | "src/index.html", 19 | "src/observer.html", 20 | "src/search.html", 21 | "src/settings.html", 22 | "src/template.html" 23 | ], 24 | "@parcel/bundler-default": { 25 | "maxParallelRequests": 1 26 | }, 27 | "keywords": [], 28 | "author": "Benjamin Zachey", 29 | "license": "GPL-3.0-or-later", 30 | "devDependencies": { 31 | "@types/jquery": "^3.5.16", 32 | "parcel": "latest", 33 | "rimraf": "^3.0.2" 34 | }, 35 | "dependencies": { 36 | "jquery": "^3.6.4" 37 | } 38 | } -------------------------------------------------------------------------------- /src/styles/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0px; 3 | padding: 0px; 4 | font-family: sans-serif; 5 | color: white; 6 | } 7 | 8 | div, 9 | label, 10 | img, 11 | input, 12 | span, 13 | i, 14 | b, 15 | p, 16 | video, 17 | audio, 18 | object, 19 | h1, 20 | h2, 21 | h3, 22 | pre, 23 | canvas, 24 | iframe { 25 | position: absolute; 26 | margin: 0px; 27 | padding: 0px; 28 | border: 0px; 29 | } 30 | 31 | .filler { 32 | width: 100%; 33 | height: 100%; 34 | } 35 | 36 | .fullscreen { 37 | left: 0px; 38 | top: 0px; 39 | right: 0px; 40 | bottom: 0px; 41 | } 42 | 43 | .content-wrapper { 44 | left: 0px; 45 | top: 0px; 46 | width: 100%; 47 | height: 100%; 48 | } 49 | 50 | .content-screen { 51 | left: 64px; 52 | right: 64px; 53 | top: 36px; 54 | bottom: 36px; 55 | } 56 | 57 | .right-screen { 58 | left: 55%; 59 | right: 5%; 60 | top: 5%; 61 | bottom: 5%; 62 | } 63 | 64 | .log { 65 | text-align: left; 66 | font-size: 16px; 67 | font-family: monospace; 68 | } 69 | 70 | .log span { 71 | display: inline; 72 | position: relative; 73 | } 74 | 75 | .log span.changed { 76 | color: yellow; 77 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Media Station X - Interaction Plugin Examples 2 | This project contains examples of how you can use the **Media Station X** application and the corresponding **Interaction Plugin** interface to create an interactive and highly customized media client. 3 | 4 | ## Documentation Links 5 | * Media Station X: https://msx.benzac.de/info/ 6 | * Interaction Plugin: https://msx.benzac.de/wiki/index.php?title=Interaction_Plugin 7 | 8 | ## Installing 9 | ``` 10 | npm install 11 | ``` 12 | 13 | ## Testing on local dev server 14 | ``` 15 | npm run start 16 | ``` 17 | By default, the index page is available under: http://localhost:1234/index.html 18 | 19 | ### Testing in browser 20 | http://msx.benzac.de/?start=menu:request:interaction:init@http://localhost:1234/index.html 21 | 22 | ## Building for deployment 23 | ``` 24 | npm run clean-build 25 | ``` 26 | 27 | ## Deploying on local server 28 | ``` 29 | npm install --global http-server 30 | http-server ./dist --cors 31 | ``` 32 | By default, the index page is available under: http://localhost:8080/index.html 33 | 34 | ### Testing in browser 35 | http://msx.benzac.de/?start=menu:request:interaction:init@http://localhost:8080/index.html 36 | 37 | ### Testing on TV device 38 | * Copy folder `./src/msx` to `./dist/msx` 39 | * Install and launch Media Station X application on TV device 40 | * Navigate to Settings -> Start Parameter -> Setup 41 | * Enter IP address and port of your local server (e.g. `192.168.0.10:8080`) 42 | * Complete setup 43 | 44 | ## Example Screenshot 45 | ![Interaction Plugin Test](https://msx.benzac.de/info/img/github1.png) 46 | 47 | ## Hosted Example 48 | http://msx.benzac.de/?start=menu:request:interaction:init@http://msx.benzac.de/github/msx-interaction-plugin-examples/index.html 49 | -------------------------------------------------------------------------------- /src/scripts/index.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | //Interaction Plugin Examples (TypeScript Edition) 3 | /******************************************************************************/ 4 | import * as tvx from "./lib/tvx-plugin-module.min"; 5 | import { InteractionData, VideoData, AudioData, ImageData, MenuData } from "./data"; 6 | import { polyfix } from "./parcel-polyfix"; 7 | 8 | polyfix(); 9 | 10 | /******************************************************************************/ 11 | //Init Handler 12 | /******************************************************************************/ 13 | class InitHandler implements tvx.TVXInteractionPluginHandler { 14 | 15 | handleRequest(dataId: string, data: tvx.AnyObject, callback: (respData?: tvx.AnyObject) => void) { 16 | if (dataId == "init") { 17 | callback(MenuData); 18 | } else if (dataId == "interaction") { 19 | callback(InteractionData); 20 | } else if (dataId == "video") { 21 | callback(VideoData); 22 | } else if (dataId == "audio") { 23 | callback(AudioData); 24 | } else if (dataId == "image") { 25 | callback(ImageData); 26 | } else { 27 | callback(null); 28 | } 29 | } 30 | } 31 | /******************************************************************************/ 32 | 33 | /******************************************************************************/ 34 | //Setup 35 | /******************************************************************************/ 36 | tvx.PluginTools.onReady(() => { 37 | tvx.InteractionPlugin.setupHandler(new InitHandler()); 38 | tvx.InteractionPlugin.init(); 39 | }); 40 | /******************************************************************************/ -------------------------------------------------------------------------------- /src/scripts/content-controller.ts: -------------------------------------------------------------------------------- 1 | import * as tvx from "./lib/tvx-plugin-module.min"; 2 | 3 | export class ContentController { 4 | private contentWrapper: any = null; 5 | private immersiveMode: number = -1; 6 | 7 | private setupWrapper(): void { 8 | if (this.contentWrapper != null && this.contentWrapper.length > 0) { 9 | if (this.immersiveMode == 0) { 10 | //Reset wrapper 11 | this.contentWrapper.css({ 12 | left: "", 13 | top: "", 14 | width: "", 15 | height: "", 16 | marginLeft: "", 17 | marginTop: "", 18 | transform: "" 19 | }); 20 | } else if (this.immersiveMode == 1) { 21 | //Center wrapper in main frame 22 | this.contentWrapper.css({ 23 | left: "50%", 24 | top: "50%", 25 | width: tvx.Settings.SCREEN_WIDTH + "px", 26 | height: tvx.Settings.SCREEN_HEIGHT + "px", 27 | marginLeft: -Math.floor(tvx.Settings.SCREEN_WIDTH / 2) + "px", 28 | marginTop: -Math.floor(tvx.Settings.SCREEN_HEIGHT / 2) + "px", 29 | transform: tvx.Settings.ZOOM_FACTOR != 1 ? "scale(" + tvx.Settings.ZOOM_FACTOR + ")" : "" 30 | }); 31 | } 32 | } 33 | } 34 | 35 | public init(wrapper: any): void { 36 | this.contentWrapper = wrapper; 37 | } 38 | 39 | public validate(): void { 40 | tvx.InteractionPlugin.onValidatedSettings((data: tvx.AnyObject) => { 41 | if (data != null && 42 | data.info != null && 43 | data.info.application != null && 44 | data.info.application.settings != null) { 45 | this.immersiveMode = tvx.Tools.strToNum(data.info.application.settings.immersiveMode, -1); 46 | this.setupWrapper(); 47 | } 48 | }); 49 | } 50 | 51 | public handleEvent(data: tvx.AnyObject): void { 52 | if (data != null) { 53 | if (data.event == "app:resize") { 54 | //Zoom factor may have changed -> Validate settings and setup wrapper 55 | tvx.InteractionPlugin.validateSettings(() => { 56 | this.setupWrapper(); 57 | }); 58 | } else if (data.event == "settings:immersive_mode") { 59 | //Immersive mode has been changed -> Apply value and setup wrapper 60 | this.immersiveMode = tvx.Tools.strToNum(data.value, -1); 61 | this.setupWrapper(); 62 | } 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /src/scripts/template.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | //Template Interaction Plugin (TypeScript Edition) 3 | /******************************************************************************/ 4 | import $ from "jquery"; 5 | import * as tvx from "./lib/tvx-plugin-module.min"; 6 | import { ContentController } from "./content-controller"; 7 | import { polyfix } from "./parcel-polyfix"; 8 | 9 | polyfix(); 10 | 11 | /******************************************************************************/ 12 | //Template Handler 13 | /******************************************************************************/ 14 | class TemplateHandler implements tvx.TVXInteractionPluginHandler { 15 | private contentController: ContentController = new ContentController(); 16 | private logger = new tvx.Logger(); 17 | 18 | init() { 19 | this.contentController.init($(".content-wrapper")); 20 | this.logger.registerControl($("#log")); 21 | this.logger.debug("Init"); 22 | } 23 | 24 | ready() { 25 | this.contentController.validate(); 26 | this.logger.debug("Ready"); 27 | tvx.InteractionPlugin.success("Template handler ready."); 28 | } 29 | 30 | handleEvent(data: tvx.AnyObject) { 31 | this.contentController.handleEvent(data); 32 | this.logger.debug("Handle event: " + tvx.Tools.serialize(data)); 33 | } 34 | 35 | handleData(data: tvx.AnyObject) { 36 | this.logger.debug("Handle data: " + tvx.Tools.serialize(data)); 37 | } 38 | 39 | handleRequest(dataId: string, data: tvx.AnyObject, callback: (respData?: tvx.AnyObject) => void) { 40 | this.logger.debug("Handle request: " + dataId); 41 | this.logger.debug("Request data: " + tvx.Tools.serialize(data)); 42 | if (dataId == "error") { 43 | throw new Error("An error has occurred"); 44 | } 45 | if (dataId.indexOf("delayed:") == 0) { 46 | dataId = dataId.substr(8); 47 | setTimeout(() => { 48 | tvx.InteractionPlugin.executeHandler(() => { 49 | if (dataId == "error") { 50 | throw new Error("An error has occurred"); 51 | } 52 | return null; 53 | }, callback); 54 | }, 3000); 55 | } else { 56 | callback(null); 57 | } 58 | } 59 | 60 | onError(message: string, error: tvx.AnyObject): void { 61 | this.logger.error(message + ": " + error); 62 | console.error(error); 63 | } 64 | } 65 | /******************************************************************************/ 66 | 67 | /******************************************************************************/ 68 | //Setup 69 | /******************************************************************************/ 70 | tvx.PluginTools.onReady(() => { 71 | tvx.InteractionPlugin.setupHandler(new TemplateHandler()); 72 | tvx.InteractionPlugin.init(); 73 | }); 74 | /******************************************************************************/ -------------------------------------------------------------------------------- /src/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Search Example Interaction Plugin (TypeScript Edition) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/settings.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Settings Example Interaction Plugin (TypeScript Edition) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/scripts/data.ts: -------------------------------------------------------------------------------- 1 | import { MSXMenuRoot, MSXContentRoot, Tools } from "./lib/tvx-plugin-module.min"; 2 | import startData from "../msx/start.json"; 3 | 4 | /******************************************************************************/ 5 | //Interaction Data 6 | /******************************************************************************/ 7 | export const InteractionData: MSXContentRoot = { 8 | type: "list", 9 | template: { 10 | type: "separate", 11 | layout: "0,0,2,4", 12 | icon: "msx-white-soft:gamepad", 13 | color: "msx-glass" 14 | }, 15 | items: [{ 16 | title: "Template", 17 | action: "interaction:load:" + Tools.getAbsoluteUrl("template.html") 18 | }, { 19 | title: "Search Example", 20 | action: "content:request:interaction:init@" + Tools.getAbsoluteUrl("search.html") 21 | }, { 22 | title: "Settings Example", 23 | action: "content:request:interaction:init@" + Tools.getAbsoluteUrl("settings.html") 24 | }, { 25 | title: "Observer Example", 26 | action: "content:request:interaction:init@" + Tools.getAbsoluteUrl("observer.html") 27 | }, { 28 | enumerate: false, 29 | type: "button", 30 | offset: "0,0,0,-1", 31 | icon: "refresh", 32 | label: "Reload", 33 | action: "interaction:reload" 34 | }, { 35 | enumerate: false, 36 | type: "button", 37 | offset: "0,0,0,-1", 38 | icon: "highlight-off", 39 | label: "Unload", 40 | action: "interaction:unload" 41 | }] 42 | }; 43 | /******************************************************************************/ 44 | 45 | /******************************************************************************/ 46 | //Video Data 47 | /******************************************************************************/ 48 | export const VideoData: MSXContentRoot = { 49 | type: "pages", 50 | template: { 51 | tag: "Web", 52 | type: "separate", 53 | layout: "0,0,2,4", 54 | icon: "msx-white-soft:movie", 55 | color: "msx-glass" 56 | }, 57 | items: [{ 58 | title: "Video 1", 59 | playerLabel: "Video 1", 60 | action: "video:http://msx.benzac.de/media/video1.mp4" 61 | }, { 62 | title: "Video 2", 63 | playerLabel: "Video 2", 64 | action: "video:http://msx.benzac.de/media/video2.mp4" 65 | }, { 66 | title: "Video 3", 67 | playerLabel: "Video 3", 68 | action: "video:http://msx.benzac.de/media/video3.mp4" 69 | }] 70 | }; 71 | /******************************************************************************/ 72 | 73 | /******************************************************************************/ 74 | //Audio Data 75 | /******************************************************************************/ 76 | export const AudioData: MSXContentRoot = { 77 | type: "pages", 78 | template: { 79 | tag: "Web", 80 | type: "separate", 81 | layout: "0,0,2,3", 82 | icon: "msx-white-soft:music-note", 83 | color: "msx-glass" 84 | }, 85 | items: [{ 86 | background: "http://msx.benzac.de/img/bg1.jpg", 87 | title: "Audio 1", 88 | playerLabel: "Audio 1", 89 | action: "audio:http://msx.benzac.de/media/audio1.mp3" 90 | }, { 91 | background: "http://msx.benzac.de/img/bg2.jpg", 92 | title: "Audio 2", 93 | playerLabel: "Audio 2", 94 | action: "audio:http://msx.benzac.de/media/audio2.mp3" 95 | }, { 96 | background: "http://msx.benzac.de/img/bg3.jpg", 97 | title: "Audio 3", 98 | playerLabel: "Audio 3", 99 | action: "audio:http://msx.benzac.de/media/audio3.mp3" 100 | }] 101 | }; 102 | /******************************************************************************/ 103 | 104 | /******************************************************************************/ 105 | //Image Data 106 | /******************************************************************************/ 107 | export const ImageData: MSXContentRoot = { 108 | type: "pages", 109 | template: { 110 | type: "default", 111 | layout: "0,0,3,2", 112 | color: "msx-glass", 113 | imageFiller: "cover", 114 | action: "image:context" 115 | }, 116 | items: [{ 117 | titleFooter: "Image 1", 118 | image: "http://msx.benzac.de/img/bg1.jpg", 119 | imageLabel: "Image 1" 120 | }, { 121 | titleFooter: "Image 2", 122 | image: "http://msx.benzac.de/img/bg2.jpg", 123 | imageLabel: "Image 2" 124 | }, { 125 | titleFooter: "Image 3", 126 | image: "http://msx.benzac.de/img/bg3.jpg", 127 | imageLabel: "Image 3" 128 | }, { 129 | titleFooter: "Image 4", 130 | image: "http://msx.benzac.de/img/test.jpg", 131 | imageLabel: "Image 4" 132 | }] 133 | }; 134 | /******************************************************************************/ 135 | 136 | /******************************************************************************/ 137 | //Menu Data 138 | /******************************************************************************/ 139 | export const MenuData: MSXMenuRoot = { 140 | name: startData.name, 141 | version: startData.version, 142 | headline: "Interaction Plugin Test", 143 | menu: [{ 144 | icon: "gamepad", 145 | label: "Interaction", 146 | data: InteractionData 147 | }, { 148 | type: "separator" 149 | }, { 150 | icon: "video-library", 151 | label: "Videos", 152 | data: VideoData 153 | }, { 154 | icon: "library-music", 155 | label: "Audios", 156 | data: AudioData 157 | }, { 158 | icon: "photo-library", 159 | label: "Images", 160 | data: ImageData 161 | }] 162 | }; 163 | /******************************************************************************/ -------------------------------------------------------------------------------- /src/scripts/observer.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | //Observer Example Interaction Plugin (TypeScript Edition) 3 | /******************************************************************************/ 4 | import $ from "jquery"; 5 | import * as tvx from "./lib/tvx-plugin-module.min"; 6 | import { ContentController } from "./content-controller"; 7 | import { polyfix } from "./parcel-polyfix"; 8 | 9 | polyfix(); 10 | 11 | /******************************************************************************/ 12 | //Observer Handler 13 | /******************************************************************************/ 14 | class ObserverHandler implements tvx.TVXInteractionPluginHandler { 15 | private contentController: ContentController = new ContentController(); 16 | private $info: tvx.AnyObject = null; 17 | 18 | private observerData = { 19 | cache: false, 20 | flag: null, 21 | type: "list", 22 | headline: "Observer Example", 23 | transparent: true, 24 | underlay: { 25 | items: [{ 26 | type: "space", 27 | round: false, 28 | layout: "0,0,6,6", 29 | offset: "-0.75,-1,1.12,1.67", 30 | color: "msx-black-soft" 31 | }] 32 | }, 33 | template: { 34 | type: "default", 35 | layout: "0,0,2,1", 36 | area: "0,0,6,6", 37 | color: "msx-glass" 38 | }, 39 | items: this.createObserverItems() 40 | } as tvx.MSXContentRoot; 41 | 42 | private createObserverItem(index: number) { 43 | return { 44 | id: "item" + index, 45 | label: "Item " + index, 46 | action: "content:request:interaction:item" + index + ">index:" + index 47 | } as tvx.MSXContentItem; 48 | } 49 | 50 | private createObserverItems() { 51 | var items = []; 52 | for (let i = 0; i < 64; i++) { 53 | items.push(this.createObserverItem(i)); 54 | } 55 | return items as tvx.MSXContentItem[]; 56 | } 57 | 58 | private createLineStart(changed: boolean) { 59 | if (changed) { 60 | return ""; 61 | } else { 62 | return ""; 63 | } 64 | } 65 | 66 | private createLineEnd() { 67 | return "
"; 68 | } 69 | 70 | private createLine(changed: boolean, info: string, value: string) { 71 | return this.createLineStart(changed) + tvx.Tools.htmlEscape(info) + ": " + tvx.Tools.htmlEscape(value) + this.createLineEnd(); 72 | } 73 | 74 | private createEmptyLine() { 75 | return this.createLineStart(false) + this.createLineEnd(); 76 | } 77 | 78 | private showContentState(state: tvx.TVXChangedContentState) { 79 | if (this.$info != null) { 80 | this.$info.html( 81 | this.createLine(state.initChanged, "Is init state", state.init ? "Yes" : "No") + 82 | this.createEmptyLine() + 83 | this.createLine(state.startChanged, "Is start data", state.start ? "Yes" : "No") + 84 | this.createLine(state.restoredChanged, "Is restored data", state.restored ? "Yes" : "No") + 85 | this.createEmptyLine() + 86 | this.createLine(state.menuIdChanged, "Current menu ID", tvx.Tools.strTruncate(tvx.Tools.strFullCheck(state.menuId, "-"), 32)) + 87 | this.createLine(state.menuFlagChanged, "Current menu flag", tvx.Tools.strFullCheck(state.menuFlag, "-")) + 88 | this.createLine(state.menuFocusChanged, "Current menu focus", tvx.Tools.strFullCheck(state.menuFocus, "-")) + 89 | this.createLine(state.menuIndexChanged, "Current menu index", tvx.Tools.strValue(state.menuIndex)) + 90 | this.createLine(state.menuSizeChanged, "Current menu size", tvx.Tools.strValue(state.menuSize)) + 91 | this.createEmptyLine() + 92 | this.createLine(state.contentIdChanged, "Current content ID", tvx.Tools.strTruncate(tvx.Tools.strFullCheck(state.contentId, "-"), 32)) + 93 | this.createLine(state.contentFlagChanged, "Current content flag", tvx.Tools.strFullCheck(state.contentFlag, "-")) + 94 | this.createLine(state.contentFocusChanged, "Current content focus", tvx.Tools.strFullCheck(state.contentFocus, "-")) + 95 | this.createLine(state.contentIndexChanged, "Current content index", tvx.Tools.strValue(state.contentIndex)) + 96 | this.createLine(state.contentSizeChanged, "Current content size", tvx.Tools.strValue(state.contentSize)) + 97 | this.createEmptyLine() + 98 | this.createLine(state.panelIdChanged, "Current panel ID", tvx.Tools.strTruncate(tvx.Tools.strFullCheck(state.panelId, "-"), 32)) + 99 | this.createLine(state.panelFlagChanged, "Current panel flag", tvx.Tools.strFullCheck(state.panelFlag, "-")) + 100 | this.createLine(state.panelFocusChanged, "Current panel focus", tvx.Tools.strFullCheck(state.panelFocus, "-")) + 101 | this.createLine(state.panelIndexChanged, "Current panel index", tvx.Tools.strValue(state.panelIndex)) + 102 | this.createLine(state.panelSizeChanged, "Current panel size", tvx.Tools.strValue(state.panelSize)) + 103 | this.createEmptyLine() + 104 | this.createLine(state.contentVisibleChanged, "Is content visible", state.contentVisible ? "Yes" : "No") + 105 | this.createLine(state.panelVisibleChanged, "Is panel visible", state.panelVisible ? "Yes" : "No") + 106 | this.createLine(state.videoVisibleChanged, "Is video/audio visible", state.videoVisible ? "Yes" : "No") + 107 | this.createLine(state.videoActiveChanged, "Is video/audio active", state.videoActive ? "Yes" : "No") + 108 | this.createLine(state.playerVisibleChanged, "Is player visible", state.playerVisible ? "Yes" : "No") + 109 | this.createLine(state.slideshowVisibleChanged, "Is slideshow visible", state.slideshowVisible ? "Yes" : "No") + 110 | this.createLine(state.volumeVisibleChanged, "Is volume visible", state.volumeVisible ? "Yes" : "No") + 111 | this.createLine(state.logVisibleChanged, "Is log visible", state.logVisible ? "Yes" : "No") 112 | ); 113 | } 114 | } 115 | 116 | private logContentState(state: tvx.TVXChangedContentState) { 117 | if (!state.init) { 118 | if (state.contentVisibleChanged) { 119 | tvx.InteractionPlugin.debug("Content is now " + (state.contentVisible ? "visible" : "hidden")); 120 | } 121 | if (state.panelVisibleChanged) { 122 | tvx.InteractionPlugin.debug("Panel is now " + (state.panelVisible ? "visible" : "hidden")); 123 | } 124 | if (state.videoVisibleChanged) { 125 | tvx.InteractionPlugin.debug("Video/Audio is now " + (state.videoVisible ? "visible" : "hidden")); 126 | } 127 | if (state.videoActiveChanged) { 128 | tvx.InteractionPlugin.debug("Video/Audio is now " + (state.videoActive ? "active" : "inactive")); 129 | } 130 | if (state.playerVisibleChanged) { 131 | tvx.InteractionPlugin.debug("Player is now " + (state.playerVisible ? "visible" : "hidden")); 132 | } 133 | if (state.slideshowVisibleChanged) { 134 | tvx.InteractionPlugin.debug("Slideshow is now " + (state.slideshowVisible ? "visible" : "hidden")); 135 | } 136 | if (state.volumeVisibleChanged) { 137 | tvx.InteractionPlugin.debug("Volume is now " + (state.volumeVisible ? "visible" : "hidden")); 138 | } 139 | if (state.logVisibleChanged) { 140 | tvx.InteractionPlugin.debug("Log is now " + (state.logVisible ? "visible" : "hidden")); 141 | } 142 | } 143 | } 144 | 145 | init() { 146 | this.contentController.init($(".content-wrapper")); 147 | this.$info = $("#info"); 148 | } 149 | 150 | ready() { 151 | this.contentController.validate(); 152 | tvx.InteractionPlugin.addContentObserver("observer", (state: tvx.TVXChangedContentState) => { 153 | this.logContentState(state); 154 | this.showContentState(state); 155 | }); 156 | } 157 | 158 | handleEvent(data: tvx.AnyObject) { 159 | this.contentController.handleEvent(data); 160 | } 161 | 162 | handleRequest(dataId: string, data: tvx.AnyObject, callback: (respData?: tvx.AnyObject) => void) { 163 | this.observerData.flag = dataId; 164 | callback(this.observerData); 165 | } 166 | } 167 | /******************************************************************************/ 168 | 169 | /******************************************************************************/ 170 | //Setup 171 | /******************************************************************************/ 172 | tvx.PluginTools.onReady(() => { 173 | tvx.InteractionPlugin.setupHandler(new ObserverHandler()); 174 | tvx.InteractionPlugin.init(); 175 | }); 176 | /******************************************************************************/ -------------------------------------------------------------------------------- /src/scripts/search.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | //Search Example Interaction Plugin (TypeScript Edition) 3 | /******************************************************************************/ 4 | import * as tvx from "./lib/tvx-plugin-module.min"; 5 | import icons from "../data/icons.json"; 6 | import { polyfix } from "./parcel-polyfix"; 7 | 8 | polyfix(); 9 | 10 | /******************************************************************************/ 11 | //Search Constants 12 | /******************************************************************************/ 13 | const MAX_INPUT_LENGTH = 32; 14 | const MAX_PAGE_X = 12; 15 | const MAX_PAGE_Y = 6; 16 | const SEARCH_HEADLINE = "{ico:search} {INPUT}"; 17 | const RESULTS_HEADLINE = "{ITEMS} found"; 18 | /******************************************************************************/ 19 | 20 | /******************************************************************************/ 21 | //Search Handler 22 | /******************************************************************************/ 23 | class SearchHandler implements tvx.TVXInteractionPluginHandler { 24 | private searchInput = tvx.Services.urlParams.getFullStr("input", ""); 25 | private testItems: tvx.AnyObject[] = icons; 26 | private resultItems: tvx.MSXContentItem[] = null; 27 | 28 | private inputPage = { 29 | headline: null, 30 | offset: "0,0,0,0.5", 31 | items: [ 32 | this.createInputButton("A", "a", 0, 0), 33 | this.createInputButton("B", "b", 1, 0), 34 | this.createInputButton("C", "c", 2, 0), 35 | this.createInputButton("D", "d", 3, 0), 36 | this.createInputButton("E", "e", 4, 0), 37 | this.createInputButton("F", "f", 5, 0), 38 | this.createInputButton("G", "g", 6, 0), 39 | this.createInputButton("H", "h", 7, 0), 40 | this.createInputButton("I", "i", 8, 0), 41 | this.createInputButton("J", "j", 9, 0), 42 | this.createInputButton("K", "k", 10, 0), 43 | this.createInputButton("L", "l", 11, 0), 44 | this.createInputButton("M", "m", 0, 1), 45 | this.createInputButton("N", "n", 1, 1), 46 | this.createInputButton("O", "o", 2, 1), 47 | this.createInputButton("P", "p", 3, 1), 48 | this.createInputButton("Q", "q", 4, 1), 49 | this.createInputButton("R", "r", 5, 1), 50 | this.createInputButton("S", "s", 6, 1), 51 | this.createInputButton("T", "t", 7, 1), 52 | this.createInputButton("U", "u", 8, 1), 53 | this.createInputButton("V", "v", 9, 1), 54 | this.createInputButton("W", "w", 10, 1), 55 | this.createInputButton("X", "x", 11, 1), 56 | this.createInputButton("Y", "y", 0, 2), 57 | this.createInputButton("Z", "z", 1, 2), 58 | this.createInputButton("1", "1", 2, 2), 59 | this.createInputButton("2", "2", 3, 2), 60 | this.createInputButton("3", "3", 4, 2), 61 | this.createInputButton("4", "4", 5, 2), 62 | this.createInputButton("5", "5", 6, 2), 63 | this.createInputButton("6", "6", 7, 2), 64 | this.createInputButton("7", "7", 8, 2), 65 | this.createInputButton("8", "8", 9, 2), 66 | this.createInputButton("9", "9", 10, 2), 67 | this.createInputButton("0", "0", 11, 2), 68 | this.createControlButton("back", "delete", 0, 3), 69 | this.createControlButton("clear", "home|end", 4, 3), 70 | this.createControlButton("space", "space|insert", 8, 3) 71 | ] 72 | } as tvx.MSXContentPage; 73 | 74 | private search = { 75 | cache: false, 76 | type: "list", 77 | important: true, 78 | headline: null, 79 | pages: null 80 | } as tvx.MSXContentRoot; 81 | 82 | private createInputButton(input: string, key: string, x: number, y: number) { 83 | return { 84 | type: "button", 85 | layout: x + "," + y + ",1,1", 86 | label: input, 87 | key: key, 88 | action: "interaction:commit", 89 | data: { 90 | action: "search:input:" + input 91 | } 92 | } as tvx.MSXContentItem; 93 | } 94 | 95 | private createControlButton(control: string, key: string, x: number, y: number) { 96 | let label: string = null; 97 | if (control == "back") { 98 | label = "{ico:backspace}"; 99 | } else if (control == "clear") { 100 | label = "{ico:clear}"; 101 | } else if (control == "space") { 102 | label = "{ico:space-bar}"; 103 | } 104 | return { 105 | type: "button", 106 | layout: x + "," + y + ",4,1", 107 | label: label, 108 | key: key, 109 | action: "interaction:commit", 110 | data: { 111 | action: "search:control:" + control 112 | } 113 | } as tvx.MSXContentItem; 114 | } 115 | 116 | private createPages( 117 | items: tvx.AnyObject[], 118 | filterCallback: (testItem: tvx.AnyObject) => boolean, 119 | itemCallback: (resultItem: tvx.AnyObject, pageItem: tvx.MSXContentItem, index: number) => void, 120 | pageCallback: (page: tvx.MSXContentPage) => void) { 121 | let x = 0; 122 | let y = 0; 123 | let w = 1; 124 | let h = 1; 125 | let page: tvx.MSXContentPage = null; 126 | let index = 0; 127 | //Create icons 128 | if (items != null && items.length > 0) { 129 | for (let i in items) { 130 | let item = items[i]; 131 | if (filterCallback(item)) { 132 | let pageItem = { 133 | enumerate: true, 134 | type: "default", 135 | layout: x + "," + y + "," + w + "," + h, 136 | color: "msx-glass", 137 | iconSize: "small", 138 | icon: item.icon, 139 | action: "panel:data", 140 | data: { 141 | pages: [{ 142 | items: [{ 143 | type: "default", 144 | layout: "2,1,4,4", 145 | offset: "0,0,0,-0.33", 146 | color: "msx-glass", 147 | iconSize: "large", 148 | label: item.icon, 149 | icon: item.icon, 150 | action: "back" 151 | }] 152 | }] 153 | } 154 | } as tvx.MSXContentItem; 155 | itemCallback(item, pageItem, index); 156 | if (page == null) { 157 | page = { 158 | items: [] 159 | }; 160 | pageCallback(page); 161 | } 162 | page.items.push(pageItem); 163 | x += w; 164 | if (x + w > MAX_PAGE_X) { 165 | x = 0; 166 | y += h; 167 | if (y + h > MAX_PAGE_Y) { 168 | y = 0; 169 | page = null; 170 | } 171 | } 172 | index++; 173 | } 174 | } 175 | } 176 | } 177 | 178 | private handleSearchInput(input: string) { 179 | if (this.searchInput.length < MAX_INPUT_LENGTH) { 180 | this.searchInput += input; 181 | } 182 | } 183 | 184 | private handleSearchControl(control: string) { 185 | if (control == "back") { 186 | if (this.searchInput.length > 0) { 187 | this.searchInput = this.searchInput.substr(0, this.searchInput.length - 1); 188 | } 189 | } else if (control == "clear") { 190 | this.searchInput = ""; 191 | } else if (control == "space") { 192 | if (this.searchInput.length > 0 && this.searchInput.length < MAX_INPUT_LENGTH && this.searchInput[this.searchInput.length - 1] != " ") { 193 | this.searchInput += " "; 194 | } 195 | } else { 196 | tvx.InteractionPlugin.warn(`Unknown search control: '${control}'`); 197 | } 198 | } 199 | 200 | private updateSearch() { 201 | this.search.headline = SEARCH_HEADLINE.replace("{INPUT}", this.searchInput); 202 | this.search.pages = [this.inputPage]; 203 | this.resultItems = []; 204 | //Filter icons 205 | if (this.searchInput.length > 0) { 206 | let searchToken = tvx.Tools.strTrim(this.searchInput.toLowerCase()).split(" "); 207 | this.createPages(this.testItems, (testItem: tvx.AnyObject) => { 208 | let hit = 0; 209 | if (tvx.Tools.isFullStr(testItem.icon)) { 210 | for (let i = 0; i < searchToken.length; i++) { 211 | if (testItem.icon.indexOf(searchToken[i]) >= 0) { 212 | hit++; 213 | } 214 | } 215 | } 216 | return hit == searchToken.length; 217 | }, (resultItem: tvx.AnyObject, pageItem: tvx.MSXContentItem, index: number) => { 218 | this.resultItems.push(resultItem); 219 | }, (page: tvx.MSXContentPage) => { 220 | this.search.pages.push(page); 221 | }); 222 | this.inputPage.headline = RESULTS_HEADLINE.replace("{ITEMS}", this.resultItems.length + " " + (this.resultItems.length == 1 ? "Item" : "Items")); 223 | } else { 224 | this.inputPage.headline = null; 225 | } 226 | } 227 | 228 | private reloadSearch() { 229 | this.updateSearch(); 230 | tvx.InteractionPlugin.executeAction("reload:content"); 231 | } 232 | 233 | init() { 234 | //Placeholder 235 | } 236 | 237 | ready() { 238 | //Placeholder 239 | } 240 | 241 | handleData(data: tvx.AnyObject) { 242 | if (data.data != null && tvx.Tools.isFullStr(data.data.action)) { 243 | let action = data.data.action as string; 244 | if (action.indexOf("search:") == 0) { 245 | let searchAction = action.substr(7); 246 | if (searchAction.indexOf("init:") == 0) { 247 | this.searchInput = searchAction.substr(5); 248 | this.updateSearch(); 249 | } else if (searchAction.indexOf("input:") == 0) { 250 | this.handleSearchInput(searchAction.substr(6)); 251 | this.reloadSearch(); 252 | } else if (searchAction.indexOf("control:") == 0) { 253 | this.handleSearchControl(searchAction.substr(8)); 254 | this.reloadSearch(); 255 | } else if (searchAction == "reload") { 256 | this.reloadSearch(); 257 | } else { 258 | tvx.InteractionPlugin.warn(`Unknown search action: '${searchAction}'`); 259 | } 260 | } else { 261 | tvx.InteractionPlugin.warn(`Invalid search action: '${action}'`); 262 | } 263 | } else { 264 | tvx.InteractionPlugin.warn("Unknown search data"); 265 | } 266 | } 267 | 268 | handleRequest(dataId: string, data: tvx.AnyObject, callback: (respData?: tvx.AnyObject) => void) { 269 | if (dataId == "init") { 270 | this.updateSearch(); 271 | callback(this.search); 272 | } else { 273 | tvx.InteractionPlugin.warn(`Unknown request data ID: '${dataId}'`); 274 | callback(); 275 | } 276 | } 277 | } 278 | /******************************************************************************/ 279 | 280 | /******************************************************************************/ 281 | //Setup 282 | /******************************************************************************/ 283 | tvx.PluginTools.onReady(() => { 284 | tvx.InteractionPlugin.setupHandler(new SearchHandler()); 285 | tvx.InteractionPlugin.init(); 286 | }); 287 | /******************************************************************************/ 288 | -------------------------------------------------------------------------------- /src/scripts/settings.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | //Settings Example Interaction Plugin (TypeScript Edition) 3 | /******************************************************************************/ 4 | import * as tvx from "./lib/tvx-plugin-module.min"; 5 | import { polyfix } from "./parcel-polyfix"; 6 | 7 | polyfix(); 8 | 9 | /******************************************************************************/ 10 | //Settings Constants 11 | /******************************************************************************/ 12 | const RADIO_BUTTON_UNCHECKED = "msx-white-soft:radio-button-unchecked"; 13 | const RADIO_BUTTON_CHECKED = "msx-white:radio-button-checked"; 14 | const CHECK_BOX_UNCHECKED = "msx-white-soft:check-box-outline-blank"; 15 | const CHECK_BOX_CHECKED = "msx-white:check-box"; 16 | const SWITCH_UNCHECKED = "msx-glass:cancel"; 17 | const SWITCH_CHECKED = "msx-white:check-circle"; 18 | const SELECTION_CONTROL_UNCHECKED = "blank"; 19 | const SELECTION_CONTROL_CHECKED = "check"; 20 | const SPECIAL_CONTROL_CHECKED = "msx-white:adb"; 21 | const SPECIAL_CONTROL_UNCHECKED = "msx-glass:adb"; 22 | const SPECIAL_CONTROL_HEADLINE = "Special Control {txt:msx-white-soft:({ITEMS})}"; 23 | /******************************************************************************/ 24 | 25 | /******************************************************************************/ 26 | //Settings Handler 27 | /******************************************************************************/ 28 | class SettingsHandler implements tvx.TVXInteractionPluginHandler { 29 | 30 | private specialControlPanel = { 31 | cache: false, 32 | headline: SPECIAL_CONTROL_HEADLINE.replace("{ITEMS}", "0"), 33 | template: { 34 | type: "button", 35 | enumerate: false, 36 | layout: "0,0,1,1", 37 | action: "interaction:commit", 38 | data: { 39 | action: "settings:item:{context:id}" 40 | } 41 | }, 42 | items: this.createSpecialControls(48) 43 | } as tvx.MSXContentRoot; 44 | 45 | private settings = { 46 | cache: false, 47 | type: "pages", 48 | headline: "Settings Example", 49 | pages: [{ 50 | headline: "Radio Buttons", 51 | items: [{ 52 | type: "space", 53 | layout: "0,0,6,1", 54 | offset: "0,0.5,-0.25,0", 55 | headline: "{txt:msx-white-soft:Radio Button Group 0}" 56 | }, 57 | this.createRadioButton("0-0", 0, 1, true), 58 | this.createRadioButton("0-1", 0, 2, false), 59 | this.createRadioButton("0-2", 0, 3, false), 60 | this.createRadioButton("0-3", 0, 4, false), 61 | this.createRadioButton("0-4", 0, 5, false), { 62 | type: "space", 63 | layout: "6,0,6,1", 64 | offset: "0.25,0.5,-0.25,0", 65 | headline: "{txt:msx-white-soft:Radio Button Group 1}" 66 | }, 67 | this.createRadioButton("1-0", 6, 1, true), 68 | this.createRadioButton("1-1", 6, 2, false), 69 | this.createRadioButton("1-2", 6, 3, false), 70 | this.createRadioButton("1-3", 6, 4, false), 71 | this.createRadioButton("1-4", 6, 5, false)] 72 | }, { 73 | headline: "Check Boxes", 74 | items: [{ 75 | type: "space", 76 | layout: "0,0,6,1", 77 | offset: "0,0.5,-0.25,0", 78 | headline: "{txt:msx-white-soft:Check Box Group 0}" 79 | }, 80 | this.createCheckBox("0-0", 0, 1, false), 81 | this.createCheckBox("0-1", 0, 2, false), 82 | this.createCheckBox("0-2", 0, 3, false), 83 | this.createCheckBox("0-3", 0, 4, false), 84 | this.createCheckBox("0-4", 0, 5, false), { 85 | type: "space", 86 | layout: "6,0,6,1", 87 | offset: "0.25,0.5,-0.25,0", 88 | headline: "{txt:msx-white-soft:Check Box Group 1}" 89 | }, 90 | this.createCheckBox("1-0", 6, 1, false), 91 | this.createCheckBox("1-1", 6, 2, false), 92 | this.createCheckBox("1-2", 6, 3, false), 93 | this.createCheckBox("1-3", 6, 4, false), 94 | this.createCheckBox("1-4", 6, 5, false)] 95 | }, { 96 | headline: "Switches", 97 | items: [ 98 | this.createSwitch("0", 0, 0, false), 99 | this.createSwitch("1", 0, 1, false), 100 | this.createSwitch("2", 0, 2, false), 101 | this.createSwitch("3", 0, 3, false), 102 | this.createSwitch("4", 0, 4, false), 103 | this.createSwitch("5", 0, 5, false), 104 | this.createSwitch("6", 6, 0, false), 105 | this.createSwitch("7", 6, 1, false), 106 | this.createSwitch("8", 6, 2, false), 107 | this.createSwitch("9", 6, 3, false), 108 | this.createSwitch("10", 6, 4, false), 109 | this.createSwitch("11", 6, 5, false) 110 | ] 111 | }, { 112 | headline: "Selection Controls", 113 | items: [ 114 | this.createSelectionControl("0", 0, 0, this.createSelectionLabel(0), this.createSelectionLabels()), 115 | this.createSelectionControl("1", 0, 1, this.createSelectionLabel(1), this.createSelectionLabels()), 116 | this.createSelectionControl("2", 0, 2, this.createSelectionLabel(2), this.createSelectionLabels()), 117 | this.createSelectionControl("3", 0, 3, this.createSelectionLabel(3), this.createSelectionLabels()), 118 | this.createSelectionControl("4", 0, 4, this.createSelectionLabel(4), this.createSelectionLabels()), 119 | this.createSelectionControl("5", 0, 5, this.createSelectionLabel(5), this.createSelectionLabels()), 120 | this.createSelectionControl("6", 6, 0, this.createStarsLabel(0), this.createStarsLabels()), 121 | this.createSelectionControl("7", 6, 1, this.createStarsLabel(0), this.createStarsLabels()), 122 | this.createSelectionControl("8", 6, 2, this.createStarsLabel(0), this.createStarsLabels()), 123 | this.createSelectionControl("9", 6, 3, this.createStarsLabel(0), this.createStarsLabels()), 124 | this.createSelectionControl("10", 6, 4, this.createStarsLabel(0), this.createStarsLabels()), 125 | this.createSelectionControl("11", 6, 5, this.createStarsLabel(0), this.createStarsLabels()) 126 | ] 127 | }, { 128 | headline: "Special Control", 129 | items: [{ 130 | id: "special_control", 131 | type: "button", 132 | layout: "0,0,12,6", 133 | badge: "0", 134 | icon: "adb", 135 | iconSize: "large", 136 | label: "Special Control", 137 | action: "panel:request:interaction:special" 138 | }] 139 | }] 140 | } as tvx.MSXContentRoot; 141 | 142 | private createRadioButton(id: string, x: number, y: number, checked: boolean) { 143 | return { 144 | id: "radio_button_" + id, 145 | type: "control", 146 | layout: x + "," + y + ",6,1", 147 | offset: x == 6 ? "0.25,0,-0.25,0" : "0,0,-0.25,0", 148 | icon: "adb", 149 | label: "Radio Button " + id, 150 | extensionIcon: checked ? RADIO_BUTTON_CHECKED : RADIO_BUTTON_UNCHECKED, 151 | checked: checked, 152 | action: "interaction:commit", 153 | data: { 154 | action: "settings:item:radio_button_" + id 155 | } 156 | } as tvx.MSXContentItem; 157 | } 158 | 159 | private createCheckBox(id: string, x: number, y: number, checked: boolean) { 160 | return { 161 | id: "check_box_" + id, 162 | type: "control", 163 | layout: x + "," + y + ",6,1", 164 | offset: x == 6 ? "0.25,0,-0.25,0" : "0,0,-0.25,0", 165 | icon: "adb", 166 | label: "Check Box " + id, 167 | extensionIcon: checked ? CHECK_BOX_CHECKED : CHECK_BOX_UNCHECKED, 168 | checked: checked, 169 | action: "interaction:commit", 170 | data: { 171 | action: "settings:item:check_box_" + id 172 | } 173 | } as tvx.MSXContentItem; 174 | } 175 | 176 | private createSwitch(id: string, x: number, y: number, checked: boolean) { 177 | return { 178 | id: "switch_" + id, 179 | type: "control", 180 | layout: x + "," + y + ",6,1", 181 | icon: "adb", 182 | label: "Switch " + id, 183 | extensionIcon: checked ? SWITCH_CHECKED : SWITCH_UNCHECKED, 184 | checked: checked, 185 | action: "interaction:commit", 186 | data: { 187 | action: "settings:item:switch_" + id 188 | } 189 | } as tvx.MSXContentItem; 190 | } 191 | 192 | private createSelectionControl(id: string, x: number, y: number, label: string, subLabels: string[]) { 193 | let subItems: tvx.MSXContentItem[] = []; 194 | for (let i in subLabels) { 195 | subItems.push({ 196 | focus: subLabels[i] === label, 197 | extensionIcon: subLabels[i] === label ? SELECTION_CONTROL_CHECKED : SELECTION_CONTROL_UNCHECKED, 198 | label: subLabels[i] 199 | }); 200 | } 201 | return { 202 | id: "selection_control_" + id, 203 | type: "control", 204 | layout: x + "," + y + ",6,1", 205 | icon: "adb", 206 | label: "Selection Control " + id, 207 | extensionLabel: label, 208 | action: "panel:data", 209 | data: { 210 | headline: "Selection Control " + id + " Panel", 211 | template: { 212 | type: "control", 213 | enumerate: false, 214 | layout: "0,0,8,1", 215 | action: "[back|interaction:commit]", 216 | data: { 217 | action: "settings:item:selection_control_" + id, 218 | label: "{context:label}" 219 | } 220 | }, 221 | items: subItems 222 | } 223 | } as tvx.MSXContentItem; 224 | } 225 | 226 | private createSelectionLabel(index: number) { 227 | return "Label " + index; 228 | } 229 | 230 | private createSelectionLabels() { 231 | return [ 232 | this.createSelectionLabel(0), 233 | this.createSelectionLabel(1), 234 | this.createSelectionLabel(2), 235 | this.createSelectionLabel(3), 236 | this.createSelectionLabel(4), 237 | this.createSelectionLabel(5) 238 | ]; 239 | } 240 | 241 | private createStarsLabel(stars: number) { 242 | let label = ""; 243 | for (let s = 0; s < 5; s++) { 244 | if (stars > 0) { 245 | stars--; 246 | label += "{ico:msx-yellow:star}"; 247 | } else { 248 | label += "{ico:msx-white-soft:star}"; 249 | } 250 | } 251 | return label; 252 | } 253 | 254 | private createStarsLabels() { 255 | return [ 256 | this.createStarsLabel(1), 257 | this.createStarsLabel(2), 258 | this.createStarsLabel(3), 259 | this.createStarsLabel(4), 260 | this.createStarsLabel(5) 261 | ]; 262 | } 263 | 264 | private createSpecialControls(count: number) { 265 | let items: tvx.MSXContentItem[] = []; 266 | for (let i = 0; i < count; i++) { 267 | items.push({ 268 | id: "special_control_" + i, 269 | icon: SPECIAL_CONTROL_UNCHECKED, 270 | checked: false 271 | }); 272 | } 273 | return items; 274 | } 275 | 276 | private updateSettingsItem(id: string, data: tvx.AnyObject) { 277 | if (id != null) { 278 | let type = "default"; 279 | let prefix: string = null; 280 | if (id.indexOf("radio_button_0-") == 0) { 281 | type = "radioButton"; 282 | prefix = "radio_button_0-"; 283 | } else if (id.indexOf("radio_button_1-") == 0) { 284 | type = "radioButton"; 285 | prefix = "radio_button_1-"; 286 | } else if (id.indexOf("check_box_") == 0) { 287 | type = "checkBox"; 288 | } else if (id.indexOf("switch_") == 0) { 289 | type = "switch"; 290 | } else if (id.indexOf("selection_control_") == 0) { 291 | type = "selection"; 292 | } else if (id.indexOf("special_control_") == 0) { 293 | type = "special"; 294 | } 295 | for (let p in this.settings.pages) { 296 | let page = this.settings.pages[p]; 297 | for (let i in page.items) { 298 | let item = page.items[i]; 299 | if (item.id != null) { 300 | if (type == "radioButton") { 301 | if (item.id == id) { 302 | item.checked = true; 303 | item.extensionIcon = RADIO_BUTTON_CHECKED; 304 | } else if (item.id.indexOf(prefix) == 0) { 305 | item.checked = false; 306 | item.extensionIcon = RADIO_BUTTON_UNCHECKED; 307 | } 308 | } else if (type == "checkBox") { 309 | if (item.id == id) { 310 | item.checked = !item.checked; 311 | if (item.checked) { 312 | item.extensionIcon = CHECK_BOX_CHECKED; 313 | } else { 314 | item.extensionIcon = CHECK_BOX_UNCHECKED; 315 | } 316 | } 317 | } else if (type == "switch") { 318 | if (item.id == id) { 319 | item.checked = !item.checked; 320 | if (item.checked) { 321 | item.extensionIcon = SWITCH_CHECKED; 322 | } else { 323 | item.extensionIcon = SWITCH_UNCHECKED; 324 | } 325 | } 326 | } else if (type == "selection") { 327 | if (item.id == id && data.label != null) { 328 | for (let si in item.data.items) { 329 | let subItem = item.data.items[si]; 330 | if (data.label == subItem.label) { 331 | subItem.focus = true; 332 | subItem.extensionIcon = SELECTION_CONTROL_CHECKED; 333 | } else { 334 | subItem.focus = false; 335 | subItem.extensionIcon = SELECTION_CONTROL_UNCHECKED; 336 | } 337 | } 338 | item.extensionLabel = data.label; 339 | } 340 | } else if (type == "special") { 341 | if (item.id == "special_control") { 342 | let count = 0; 343 | for (let si in this.specialControlPanel.items) { 344 | let specialItem = this.specialControlPanel.items[si]; 345 | if (specialItem.id == id) { 346 | specialItem.checked = !specialItem.checked; 347 | if (specialItem.checked) { 348 | specialItem.icon = SPECIAL_CONTROL_CHECKED; 349 | } else { 350 | specialItem.icon = SPECIAL_CONTROL_UNCHECKED; 351 | } 352 | } 353 | if (specialItem.checked) { 354 | count++; 355 | } 356 | } 357 | item.badge = tvx.Tools.strValue(count); 358 | this.specialControlPanel.headline = SPECIAL_CONTROL_HEADLINE.replace("{ITEMS}", tvx.Tools.strValue(count)); 359 | tvx.InteractionPlugin.executeAction("reload:panel"); 360 | } 361 | } 362 | } 363 | } 364 | } 365 | } 366 | } 367 | 368 | private reloadSettings() { 369 | tvx.InteractionPlugin.executeAction("reload:content"); 370 | } 371 | 372 | init() { 373 | //Placeholder 374 | } 375 | 376 | ready() { 377 | //Placeholder 378 | } 379 | 380 | handleData(data: tvx.AnyObject) { 381 | if (data.data != null && tvx.Tools.isFullStr(data.data.action)) { 382 | let action = data.data.action; 383 | if (action.indexOf("settings:") == 0) { 384 | let settingsAction = action.substr(9); 385 | if (settingsAction.indexOf("item:") == 0) { 386 | this.updateSettingsItem(settingsAction.substr(5), data.data); 387 | this.reloadSettings(); 388 | } else if (settingsAction == "reload") { 389 | this.reloadSettings(); 390 | } else { 391 | tvx.InteractionPlugin.warn(`Unknown settings action: '${settingsAction}'`); 392 | } 393 | } else { 394 | tvx.InteractionPlugin.warn(`Invalid settings action: '${action}'`); 395 | } 396 | } else { 397 | tvx.InteractionPlugin.warn("Unknown settings data"); 398 | } 399 | } 400 | 401 | handleRequest(dataId: string, data: tvx.AnyObject, callback: (respData?: tvx.AnyObject) => void) { 402 | if (dataId == "init") { 403 | callback(this.settings); 404 | } else if (dataId == "special") { 405 | callback(this.specialControlPanel); 406 | } else { 407 | tvx.InteractionPlugin.warn(`Unknown request data ID: '${dataId}'`); 408 | callback(); 409 | } 410 | } 411 | } 412 | /******************************************************************************/ 413 | 414 | /******************************************************************************/ 415 | //Setup 416 | /******************************************************************************/ 417 | tvx.PluginTools.onReady(() => { 418 | tvx.InteractionPlugin.setupHandler(new SettingsHandler()); 419 | tvx.InteractionPlugin.init(); 420 | }); 421 | /******************************************************************************/ 422 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /src/scripts/lib/tvx-plugin-module.min.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for TVX Plugin v0.0.76.2 (Module) 2 | // Project: https://msx.benzac.de/info/ 3 | // Definitions by: Benjamin Zachey 4 | 5 | declare interface AnyObject { 6 | [key: string]: any; 7 | } 8 | 9 | /** MSX - Start Object 10 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Start_Object} 11 | */ 12 | declare interface MSXStart extends AnyObject { 13 | name: string; 14 | version: string; 15 | parameter: string; 16 | welcome?: string; 17 | } 18 | 19 | /** MSX - Menu Root Object 20 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Menu_Root_Object} 21 | */ 22 | declare interface MSXMenuRoot extends AnyObject { 23 | name?: string; 24 | version?: string; 25 | reference?: string; 26 | flag?: string; 27 | reuse?: boolean; 28 | cache?: boolean; 29 | restore?: boolean; 30 | refocus?: MSXRefocus | boolean; 31 | transparent?: MSXTransparent | boolean; 32 | style?: MSXMenuRootStyle; 33 | logo?: string; 34 | logoSize?: MSXMenuRootLogoSize; 35 | headline?: string; 36 | background?: string; 37 | extension?: string; 38 | dictionary?: string; 39 | menu: MSXMenuItem[]; 40 | action?: string; 41 | data?: AnyObject; 42 | ready?: MSXReady; 43 | options?: MSXContentPage | MSXContentRoot; 44 | } 45 | 46 | /** MSX - Menu Root Style 47 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Menu_Root_Object} 48 | */ 49 | declare type MSXMenuRootStyle = 50 | "default" | 51 | "flat" | 52 | "flat-separator" | 53 | "overlay" | 54 | "overlay-separator"; 55 | 56 | /** MSX - Menu Root Logo Size 57 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Menu_Root_Object} 58 | */ 59 | declare type MSXMenuRootLogoSize = 60 | "small" | 61 | "large"; 62 | 63 | /** MSX - Menu Item Object 64 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Menu_Item_Object} 65 | */ 66 | declare interface MSXMenuItem extends AnyObject { 67 | id?: string; 68 | type?: MSXMenuItemtType; 69 | display?: boolean; 70 | enable?: boolean; 71 | focus?: boolean; 72 | execute?: boolean; 73 | transparent?: MSXTransparent | boolean; 74 | icon?: string; 75 | image?: string; 76 | label?: string; 77 | background?: string; 78 | extensionIcon?: string; 79 | extensionLabel?: string; 80 | lineColor?: string; 81 | data?: string | MSXContentRoot; 82 | options?: MSXContentPage | MSXContentRoot; 83 | } 84 | 85 | /** MSX - Menu Item Type 86 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Menu_Item_Object} 87 | */ 88 | declare type MSXMenuItemtType = 89 | "default" | 90 | "separator" | 91 | "settings"; 92 | 93 | /** MSX - Content Root Object 94 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Content_Root_Object} 95 | */ 96 | declare interface MSXContentRoot extends AnyObject { 97 | name?: string; 98 | version?: string; 99 | reference?: string; 100 | flag?: string; 101 | reuse?: boolean; 102 | cache?: boolean; 103 | restore?: boolean; 104 | imortant?: boolean; 105 | wrap?: boolean; 106 | compress?: boolean; 107 | preselect?: boolean; 108 | refocus?: MSXRefocus | boolean; 109 | transparent?: MSXTransparent | boolean; 110 | type?: MSXContentRootType; 111 | preload?: MSXContentRootPreload; 112 | headline?: string; 113 | background?: string; 114 | extension?: string; 115 | dictionary?: string; 116 | template?: MSXContentItem; 117 | items?: MSXContentItem[]; 118 | pages?: MSXContentPage[]; 119 | header?: MSXContentPage; 120 | footer?: MSXContentPage; 121 | inserts?: MSXContentPage[]; 122 | overlay?: MSXContentPage; 123 | underlay?: MSXContentPage; 124 | action?: string; 125 | data?: AnyObject; 126 | ready?: MSXReady; 127 | options?: MSXContentPage | MSXContentRoot; 128 | caption?: string; 129 | captionUnderlay?: MSXContentCaptionUnderlay; 130 | } 131 | 132 | /** MSX - Content Root Type 133 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Content_Root_Object} 134 | */ 135 | declare type MSXContentRootType = 136 | "pages" | 137 | "list"; 138 | 139 | /** MSX - Content Root Preload 140 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Content_Root_Object} 141 | */ 142 | declare type MSXContentRootPreload = 143 | "none" | 144 | "next" | 145 | "prev" | 146 | "full"; 147 | 148 | /** MSX - Content Page Object 149 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Content_Page_Object} 150 | */ 151 | declare interface MSXContentPage extends AnyObject { 152 | display?: boolean; 153 | important?: boolean; 154 | wrap?: boolean; 155 | compress?: boolean; 156 | transparent?: MSXTransparent | boolean; 157 | headline?: string; 158 | background?: string; 159 | area?: string; 160 | offset?: string; 161 | position?: string; 162 | template?: MSXContentItem; 163 | items: MSXContentItem[]; 164 | action?: string; 165 | data?: AnyObject; 166 | options?: MSXContentPage | MSXContentRoot; 167 | caption?: string; 168 | captionUnderlay?: MSXContentCaptionUnderlay; 169 | } 170 | 171 | /** MSX - Content Item Object 172 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Content_Item_Object} 173 | */ 174 | declare interface MSXContentItem extends AnyObject { 175 | id?: string; 176 | type?: MSXContentItemType; 177 | key?: string; 178 | layout?: string; 179 | area?: string; 180 | offset?: string; 181 | display?: boolean; 182 | enable?: boolean; 183 | focus?: boolean; 184 | execute?: boolean; 185 | enumerate?: boolean; 186 | compress?: boolean; 187 | decompress?: boolean; 188 | shortcut?: boolean; 189 | round?: boolean; 190 | break?: string; 191 | group?: string; 192 | color?: string; 193 | title?: string; 194 | titleHeader?: string; 195 | titleFooter?: string; 196 | label?: string; 197 | icon?: string; 198 | iconSize?: MSXContentItemIconSize; 199 | headline?: string; 200 | text?: string | string[]; 201 | alignment?: string; 202 | truncation?: string; 203 | centration?: string; 204 | separation?: number; 205 | tag?: string; 206 | tagColor?: string; 207 | badge?: string; 208 | badgeColor?: string; 209 | stamp?: string; 210 | stampColor?: string; 211 | progress?: number; 212 | progressColor?: string; 213 | progressBackColor?: string; 214 | wrapperColor?: string; 215 | image?: string; 216 | imageFiller?: MSXContentItemImageFiller; 217 | imageWidth?: number; 218 | imageHeight?: number; 219 | imageOverlay?: MSXContentItemImageOverlay; 220 | imagePreload?: boolean; 221 | imageLabel?: string; 222 | imageColor?: string; 223 | imageScreenFiller?: MSXContentItemImageFiller; 224 | imageBoundary?: boolean; 225 | playerLabel?: string; 226 | background?: string; 227 | extensionIcon?: string; 228 | extensionLabel?: string; 229 | action?: string; 230 | data?: AnyObject; 231 | properties?: MSXExtendedProperties; 232 | live?: MSXLive; 233 | selection?: MSXSelection; 234 | options?: MSXContentPage | MSXContentRoot; 235 | } 236 | 237 | /** MSX - Content Item Type 238 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Content_Item_Object} 239 | */ 240 | declare type MSXContentItemType = 241 | "default" | 242 | "teaser" | 243 | "button" | 244 | "separate" | 245 | "space" | 246 | "control"; 247 | 248 | /** MSX - Content Item Icon Size 249 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Content_Item_Object} 250 | */ 251 | declare type MSXContentItemIconSize = 252 | "small" | 253 | "medium" | 254 | "large" | 255 | "extra-large"; 256 | 257 | /** MSX - Content Item Image Filler 258 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Content_Item_Object} 259 | */ 260 | declare type MSXContentItemImageFiller = 261 | "default" | 262 | "width" | 263 | "width-top" | 264 | "width-center" | 265 | "width-bottom" | 266 | "height" | 267 | "height-left" | 268 | "height-center" | 269 | "height-right" | 270 | "fit" | 271 | "cover" | 272 | "smart"; 273 | 274 | /** MSX - Content Item Image Overlay 275 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Content_Item_Object} 276 | */ 277 | declare type MSXContentItemImageOverlay = 278 | -1 | 279 | 0 | 280 | 1 | 281 | 2 | 282 | 3 | 283 | 4; 284 | 285 | /** MSX - Content Caption Underlay*/ 286 | declare type MSXContentCaptionUnderlay = 287 | -1 | 288 | 0 | 289 | 1; 290 | 291 | //** MSX - Refocus*/ 292 | declare type MSXRefocus = 293 | 0 | 294 | 1 | 295 | 2; 296 | 297 | //** MSX - Transparent*/ 298 | declare type MSXTransparent = 299 | 0 | 300 | 1 | 301 | 2; 302 | 303 | //** MSX - Round*/ 304 | declare type MSXRound = 305 | 0 | 306 | 1 | 307 | 2 | 308 | 3; 309 | 310 | //** MSX - Ready*/ 311 | declare interface MSXReady { 312 | action?: string; 313 | data?: AnyObject; 314 | } 315 | 316 | /** MSX - Live Object 317 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Live_Object} 318 | */ 319 | declare interface MSXLive extends MSXLiveProperties, MSXLiveAction { 320 | type?: MSXLiveType; 321 | from?: number; 322 | to?: number; 323 | duration?: number; 324 | delay?: number; 325 | source?: MSXLiveSource; 326 | coming?: MSXLiveStateExtended; 327 | running?: MSXLiveStateExtended; 328 | over?: MSXLiveState; 329 | execute?: MSXLiveAction; 330 | preload?: boolean; 331 | } 332 | 333 | /** MSX - Live Type 334 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Live_Object} 335 | */ 336 | declare type MSXLiveType = 337 | "schedule" | 338 | "lifetime" | 339 | "airtime" | 340 | "playback" | 341 | "setup"; 342 | 343 | /** MSX - Live Source 344 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Live_Object} 345 | */ 346 | declare type MSXLiveSource = 347 | "id" | 348 | "url" | 349 | "key" | 350 | "current" | 351 | "none"; 352 | 353 | /** MSX - Live Action 354 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Live_Object} 355 | */ 356 | declare interface MSXLiveAction { 357 | action?: string; 358 | data?: AnyObject; 359 | } 360 | 361 | /** MSX - Live Content Properties 362 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Live_Object} 363 | */ 364 | declare interface MSXLiveProperties { 365 | color?: string; 366 | title?: string; 367 | titleHeader?: string; 368 | titleFooter?: string; 369 | label?: string; 370 | icon?: string; 371 | headline?: string; 372 | text?: string | string[]; 373 | tag?: string; 374 | tagColor?: string; 375 | badge?: string; 376 | badgeColor?: string; 377 | stamp?: string; 378 | stampColor?: string; 379 | progress?: number; 380 | progressColor?: string; 381 | progressBackColor?: string; 382 | wrapperColor?: string; 383 | image?: string; 384 | extensionIcon?: string; 385 | extensionLabel?: string; 386 | } 387 | 388 | /** MSX - Live State Object 389 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Live_Object} 390 | */ 391 | declare interface MSXLiveState extends MSXLiveProperties, MSXLiveAction { 392 | execute?: MSXLiveAction; 393 | } 394 | 395 | /** MSX - Live State Object (Extended) 396 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Live_Object} 397 | */ 398 | declare interface MSXLiveStateExtended extends MSXLiveState { 399 | ready?: MSXLiveProperties; 400 | quartile1?: MSXLiveProperties; 401 | quartile2?: MSXLiveProperties; 402 | quartile3?: MSXLiveProperties; 403 | quartile4?: MSXLiveProperties; 404 | complete?: MSXLiveProperties; 405 | } 406 | 407 | /** MSX - Selection Object 408 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Selection_Object} 409 | */ 410 | declare interface MSXSelection { 411 | important?: boolean; 412 | headline?: string; 413 | background?: string; 414 | action?: string; 415 | data?: AnyObject; 416 | } 417 | 418 | /** MSX - URL Parameters 419 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=URL_Parameters} 420 | */ 421 | declare interface MSXURLParameters { 422 | [key: string]: string; 423 | } 424 | 425 | /** MSX - Extended Properties 426 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Extended_Properties} 427 | */ 428 | declare interface MSXExtendedProperties { 429 | [key: string]: string | number | boolean; 430 | } 431 | 432 | /** MSX - Dictionary Properties 433 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Dictionary_Structure} 434 | */ 435 | declare interface MSXDictionaryProperties { 436 | [key: string]: string; 437 | } 438 | 439 | /** MSX - Attached Data 440 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 441 | */ 442 | declare interface MSXAttachedData { 443 | data?: AnyObject; 444 | error?: string; 445 | } 446 | 447 | /** MSX - Attached Code 448 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 449 | */ 450 | declare interface MSXAttachedCode extends MSXAttachedData { 451 | code?: string; 452 | } 453 | 454 | /** MSX - Attached Video 455 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 456 | */ 457 | declare interface MSXAttachedVideo extends MSXAttachedData { 458 | video?: MSXAttachedVideoContainer; 459 | } 460 | 461 | /** MSX - Attached Video Container (request-dependent) 462 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 463 | */ 464 | declare interface MSXAttachedVideoContainer { 465 | info?: MSXAttachedVideoInfo; 466 | data?: MSXAttachedVideoData; 467 | resume?: MSXAttachedVideoResumeInfo; 468 | volume?: MSXAttachedVideoVolumeInfo; 469 | scene?: string; 470 | } 471 | 472 | /** MSX - Attached Video Info 473 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 474 | */ 475 | declare interface MSXAttachedVideoInfo { 476 | id: string; 477 | index: number; 478 | number: number; 479 | count: number; 480 | listIndex: number; 481 | listSize: number; 482 | type: string; 483 | url: string; 484 | label: string; 485 | background: string; 486 | customLabel: string; 487 | customBackground: string; 488 | properties: MSXExtendedProperties; 489 | } 490 | 491 | /** MSX - Attached Video Data 492 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 493 | */ 494 | declare interface MSXAttachedVideoData { 495 | state: number; 496 | position: number; 497 | duration: number; 498 | speed: number; 499 | ended: boolean; 500 | } 501 | 502 | /** MSX - Attached Video Resume Info 503 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 504 | */ 505 | declare interface MSXAttachedVideoResumeInfo { 506 | key: string; 507 | context: string; 508 | count: number; 509 | resuming: boolean; 510 | position: string; 511 | progress: number; 512 | duration: number; 513 | } 514 | 515 | /** MSX - Attached Video Volume Info 516 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 517 | */ 518 | declare interface MSXAttachedVideoVolumeInfo { 519 | type: string; 520 | level: number; 521 | muted: boolean; 522 | } 523 | 524 | /** MSX - Attached Resume Map 525 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 526 | */ 527 | declare interface MSXAttachedResumeMap extends MSXAttachedData { 528 | resume?: MSXAttachedResumeMapContainer; 529 | } 530 | 531 | /** MSX - Attached Resume Map Container 532 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 533 | */ 534 | declare interface MSXAttachedResumeMapContainer { 535 | size: number; 536 | properties: MSXExtendedProperties; 537 | } 538 | 539 | /** MSX - Attached Slider 540 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 541 | */ 542 | declare interface MSXAttachedSlider extends MSXAttachedData { 543 | slider?: MSXAttachedSliderContainer; 544 | } 545 | 546 | /** MSX - Attached Slider Container 547 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 548 | */ 549 | declare interface MSXAttachedSliderContainer { 550 | state: number; 551 | id: string; 552 | index: number; 553 | number: number; 554 | count: number; 555 | listIndex: number; 556 | listSize: number; 557 | url: string; 558 | label: string; 559 | color: string; 560 | filler: string; 561 | rotation: number; 562 | customLabel: string; 563 | customColor: string; 564 | properties: MSXExtendedProperties; 565 | } 566 | 567 | /** MSX - Attached Application Menu Button 568 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 569 | */ 570 | declare interface MSXAttachedApplicationMenuButton { 571 | action: number; 572 | keyCode: number; 573 | } 574 | 575 | /** MSX - Attached Application Settings 576 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 577 | */ 578 | declare interface MSXAttachedApplicationSettings { 579 | validateLinks: number; 580 | randomPlayback: number; 581 | slideshowInterval: number; 582 | hoverEffect: number; 583 | immersiveMode: number; 584 | roundedStyle: number; 585 | sleepTimeout: number; 586 | ejectTimeout: number; 587 | menuButton: MSXAttachedApplicationMenuButton; 588 | } 589 | 590 | /** MSX - Attached Application Info 591 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 592 | */ 593 | declare interface MSXAttachedApplicationInfo { 594 | name: string; 595 | version: string; 596 | suffix: string; 597 | settings: MSXAttachedApplicationSettings; 598 | } 599 | 600 | /** MSX - Attached Framework Setttings 601 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 602 | */ 603 | declare interface MSXAttachedFrameworkSetttings { 604 | animate: number; 605 | transform: number; 606 | input: number; 607 | remote: number; 608 | layout: string; 609 | scale: string; 610 | zoom: string, 611 | center: number; 612 | background: number; 613 | leave: number; 614 | exit: number; 615 | back: number; 616 | volume: number; 617 | busy: number; 618 | speed: number; 619 | playback: number; 620 | fullscreen: number; 621 | suspend: number; 622 | secure: number; 623 | caption: number; 624 | pointer: number; 625 | } 626 | 627 | /** MSX - Attached Framework Info 628 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 629 | */ 630 | declare interface MSXAttachedFrameworkInfo { 631 | name: string; 632 | version: string; 633 | suffix: string; 634 | settings: MSXAttachedFrameworkSetttings; 635 | } 636 | 637 | /** MSX - Attached Content State 638 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 639 | */ 640 | declare interface MSXAttachedContentState { 641 | start: boolean; 642 | restored: boolean; 643 | menuId: string; 644 | menuFlag: string; 645 | menuFocus: string; 646 | menuIndex: number; 647 | menuSize: number; 648 | contentId: string; 649 | contentFlag: string; 650 | contentFocus: string; 651 | contentIndex: number; 652 | contentSize: number; 653 | contentVisible: boolean; 654 | panelId: string; 655 | panelFlag: string; 656 | panelFocus: string; 657 | panelIndex: number; 658 | panelSize: number; 659 | panelVisible: boolean; 660 | videoVisible: boolean; 661 | videoActive: boolean; 662 | playerVisible: boolean; 663 | slideshowVisible: boolean; 664 | volumeVisible: boolean; 665 | logVisible: boolean; 666 | } 667 | 668 | /** MSX - Attached Content Info 669 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 670 | */ 671 | declare interface MSXAttachedContentInfo { 672 | name: string; 673 | version: string; 674 | flag: string; 675 | server: string; 676 | secure: boolean; 677 | parameter: string; 678 | state: MSXAttachedContentState; 679 | interaction: string; 680 | } 681 | 682 | /** MSX - Attached Dictionary Info 683 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 684 | */ 685 | declare interface MSXAttachedDictionaryInfo { 686 | url: string; 687 | name: string; 688 | version: string; 689 | size: number; 690 | } 691 | 692 | /** MSX - Attached Screen Info 693 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 694 | */ 695 | declare interface MSXAttachedScreenInfo { 696 | width: number; 697 | height: number; 698 | factor: number; 699 | zoomFactor: number; 700 | } 701 | 702 | /** MSX - Attached Time Info 703 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 704 | */ 705 | declare interface MSXAttachedTimeInfo { 706 | timestamp: number; 707 | now: number; 708 | zone: number; 709 | offset: number; 710 | zoneOffset: number; 711 | } 712 | 713 | /** MSX - Attached System Info (platform-dependent) 714 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 715 | */ 716 | declare interface MSXAttachedSystemInfo { 717 | name?: string; 718 | model?: string; 719 | manufacturer?: string; 720 | firmware?: string; 721 | version?: string; 722 | country?: string; 723 | language?: string; 724 | ipAddress?: string; 725 | macAddress?: string; 726 | networkType?: string; 727 | networkName?: string; 728 | deviceId?: string; 729 | deviceFamily?: string; 730 | deviceVersion?: string; 731 | vendorName?: string; 732 | modelName?: string; 733 | softwareVersion?: string; 734 | hardwareVersion?: string; 735 | buildVersion?: string; 736 | sdkVersion?: string; 737 | firmwareVersion?: string; 738 | serialNumber?: string; 739 | } 740 | 741 | /** MSX - Attached Info 742 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 743 | */ 744 | declare interface MSXAttachedInfo extends MSXAttachedData { 745 | info?: MSXAttachedInfoContainer; 746 | } 747 | 748 | /** MSX - Attached Info Container (request-dependent) 749 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 750 | */ 751 | declare interface MSXAttachedInfoContainer { 752 | host?: string; 753 | secure?: boolean; 754 | client?: string; 755 | platform?: string; 756 | id?: string; 757 | player?: string; 758 | userAgent?: string; 759 | application?: MSXAttachedApplicationInfo; 760 | framework?: MSXAttachedFrameworkInfo; 761 | content?: MSXAttachedContentInfo; 762 | dictionary?: MSXAttachedDictionaryInfo; 763 | screen?: MSXAttachedScreenInfo; 764 | time?: MSXAttachedTimeInfo; 765 | urlParams?: MSXURLParameters; 766 | system?: MSXAttachedSystemInfo; 767 | } 768 | 769 | /** MSX - Attached Message 770 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 771 | */ 772 | declare interface MSXAttachedMessage extends MSXAttachedData { 773 | message?: string; 774 | } 775 | 776 | /** MSX - Attached String 777 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 778 | */ 779 | declare interface MSXAttachedString extends MSXAttachedData { 780 | string?: string; 781 | } 782 | 783 | /** MSX - Attached Response 784 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 785 | */ 786 | declare interface MSXAttachedResponse extends MSXAttachedData { 787 | response?: AnyObject; 788 | } 789 | 790 | /** MSX - Attached Dictionary 791 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 792 | */ 793 | declare interface MSXAttachedDictionary extends MSXAttachedData { 794 | dictionary?: MSXAttachedDictionaryContainer; 795 | } 796 | 797 | /** MSX - Attached Dictionary Container 798 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 799 | */ 800 | declare interface MSXAttachedDictionaryContainer { 801 | name: string; 802 | version: string; 803 | size: number; 804 | properties: MSXDictionaryProperties; 805 | } 806 | 807 | /** MSX - Attached Notification 808 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 809 | */ 810 | declare interface MSXAttachedNotification extends MSXAttachedData { 811 | notification?: string; 812 | } 813 | 814 | /** MSX - Attached Generic (request-dependent) 815 | * @see: {@link https://msx.benzac.de/wiki/index.php?title=Attached_Data_Examples} 816 | */ 817 | declare interface MSXAttachedGeneric extends MSXAttachedData { 818 | code?: string; 819 | video?: MSXAttachedVideoContainer; 820 | resume?: MSXAttachedResumeMapContainer; 821 | slider?: MSXAttachedSliderContainer; 822 | info?: MSXAttachedInfoContainer; 823 | message?: string; 824 | string?: string; 825 | response?: AnyObject; 826 | dictionary?: MSXAttachedDictionaryContainer; 827 | notification?: string; 828 | } 829 | 830 | declare interface TVXSettings { 831 | readonly NAME: string; 832 | readonly SHORTCUT: string; 833 | readonly VERSION: string; 834 | readonly SUFFIX: string; 835 | DUMMY_DATE: Date; 836 | TIME_OFFSET: number; 837 | TIME_ZONE_OFFSET: number; 838 | ANIMATION_DURATION: number; 839 | ANIMATION_EASE: string; 840 | AFK_DELAY: number; 841 | SCREEN_WIDTH: number; 842 | SCREEN_HEIGHT: number; 843 | SCREEN_FACTOR: number; 844 | ZOOM_FACTOR: number; 845 | PLATFORM: string; 846 | ID: string; 847 | ANIMATE: number; 848 | TRANSFORM: number; 849 | INPUT: number; 850 | REMOTE: number; 851 | LAYOUT: string; 852 | SCALE: string; 853 | ZOOM: string; 854 | CENTER: number; 855 | BACKGROUND: number; 856 | LEAVE: number; 857 | EXIT: number; 858 | BACK: number; 859 | VOLUME: number; 860 | BUSY: number; 861 | SPEED: number; 862 | PLAYBACK: number; 863 | FULLSCREEN: number; 864 | SUSPEND: number; 865 | SECURE: number; 866 | CAPTION: number; 867 | POINTER: number; 868 | APP: any; 869 | } 870 | 871 | declare interface TVXStyles { 872 | readonly COMMON: any; 873 | readonly LOGGER: any; 874 | readonly RENDERER: any; 875 | readonly REMOTE: any; 876 | APP: any; 877 | } 878 | 879 | declare interface TVXVersion { 880 | major: number; 881 | minor: number; 882 | patch: number; 883 | } 884 | 885 | declare interface TVXTools { 886 | createVersion(version: string): TVXVersion; 887 | checkVersion(currentVersion: string, minVersion: string): boolean; 888 | createKey(length?: number, type?: number): string; 889 | isFullStr(obj: any): boolean; 890 | isBool(obj: any): boolean; 891 | isNum(obj: any): boolean; 892 | isArray(obj: any): boolean; 893 | isEmpty(obj: any): boolean; 894 | isValid(obj: any, hasValue?: boolean): boolean; 895 | isId(id: any): boolean; 896 | isJson(json: any): boolean; 897 | isHttpUrl(url: any): boolean; 898 | strValue(obj: any): string; 899 | strFullCheck(str: any, defaultValue: string): string; 900 | strTrim(str: any): string; 901 | strClear(str: any): string; 902 | strFlatten(str: any): string; 903 | strTruncate(str: any, length: number): string; 904 | strShuffle(str: any): string; 905 | strReplace(str: any, find: string, replace?: any): string; 906 | strReplaceMap(str: any, map: any): string; 907 | strToBool(str: any, defaultValue: boolean): boolean; 908 | strToNum(str: any, defaultValue: number): number; 909 | strToAction(str: any): string; 910 | strToJsonStr(str: any): string; 911 | strToUrlStr(str: any): string; 912 | strContainsToken(str: any, token: string, start?: number, end?: number): boolean; 913 | strCountToken(str: any, token: string, start?: number, end?: number): number; 914 | htmlTrim(str: string): string; 915 | htmlEscape(str: string): string; 916 | htmlUnescape(str: string): string; 917 | htmlAttrEscape(str: string): string; 918 | htmlAttrUnescape(str: string): string; 919 | htmlTextEscape(str: string): string; 920 | htmlCharacter(str: string): string; 921 | base64Encode(str: string): string; 922 | base64EncodeUrl(str: string): string; 923 | base64EncodeId(str: string): string; 924 | base64Decode(str: string): string; 925 | base64DecodeUrl(str: string): string; 926 | base64DecodeId(str: string): string; 927 | utf8Encode(str: string): string; 928 | utf8Decode(str: string): string; 929 | createHash(str: string, reverse?: boolean): number; 930 | serialize(obj: any, name?: string): string; 931 | deserialize(json: string): any; 932 | isSecureContext(): boolean; 933 | secureUrl(url: string): string; 934 | getPrefixUrl(suffix: string): string; 935 | getHostUrl(suffix: string): string; 936 | getPathUrl(suffix: string): string; 937 | getAbsoluteUrl(url: string): string; 938 | getRootPath(subPath: string, trim?: boolean): string; 939 | exprEscape( 940 | text: string, 941 | exprStart: string, 942 | exprEnd: string, 943 | textCallback: (text: string, state: any) => string, 944 | exprCallback: (expr: string, state: any) => string, 945 | completeCallback: (state: any) => string, 946 | state: any): string; 947 | } 948 | 949 | declare interface TVXDateTools { 950 | applyDictionary(dictionary: TVXDictionary): void; 951 | getTimestamp(): number; 952 | getNow(): Date; 953 | getFormatSeparator(): string; 954 | getFormattedDateStr(date: Date | number, format: string, y?: number, m?: number, d?: number): string; 955 | getDayStr(date: Date | number, y?: number, m?: number, d?: number): string; 956 | getDayLongStr(date: Date | number, y?: number, m?: number, d?: number): string; 957 | getDayFullStr(date: Date | number, y?: number, m?: number, d?: number): string; 958 | getDateStr(date: Date | number, y?: number, m?: number, d?: number): string; 959 | getDateLongStr(date: Date | number, y?: number, m?: number, d?: number): string; 960 | getFormattedTimeStr(date: Date | number, format: string, y?: number, m?: number, d?: number): string; 961 | getTimeStr(date: Date | number, h?: number, m?: number, s?: number): string; 962 | getTimeLongStr(date: Date | number, h?: number, m?: number, s?: number): string; 963 | getRecordingStr(date: Date | number): string; 964 | getFormattedDurationStr(timeInMs: number, format: string): string; 965 | getDurationStr(timeInMs: number, values?: string): string; 966 | getVideoStr(timeInMs: number, digits?: number): string; 967 | } 968 | 969 | declare interface TVXDateFormatter { 970 | toTimeStr(date: Date | number): string; 971 | toTimeLongStr(date: Date | number): string; 972 | toTimeDayStr(date: Date | number): string; 973 | toTimeDayLongStr(date: Date | number): string; 974 | toDayStr(date: Date | number): string; 975 | toDayLongStr(date: Date | number): string; 976 | toDayFullStr(date: Date | number): string; 977 | toDateStr(date: Date | number): string; 978 | toDateLongStr(date: Date | number): string; 979 | toRecordingStr(date: Date | number): string; 980 | toDayTimeStr(date: Date | number): string; 981 | toDayTimeLongStr(date: Date | number): string; 982 | toDayTimeFullStr(date: Date | number): string; 983 | toDateTimeStr(date: Date | number): string; 984 | toDateTimeLongStr(date: Date | number): string; 985 | } 986 | 987 | declare interface TVXPropertyTools { 988 | foreach(data: any, callback: (key: string, value: any) => void | boolean): void; 989 | getValue(data: any, key: string, defaultValue: any): any; 990 | get(data: any, key: string, defaultValue: string): string; 991 | getFullStr(data: any, key: string, defaultValue: string): string; 992 | getNum(data: any, ke: string, defaultValue: number): number; 993 | getBool(data: any, key: string, defaultValue: boolean): boolean; 994 | has(data: any, key: string, hasValue?: boolean): boolean; 995 | put(data: any, key: string, value: any): void; 996 | remove(data: any, key: string): void; 997 | clear(data: any): void; 998 | count(data: any): number; 999 | extend(data: any, extension: any): void; 1000 | } 1001 | 1002 | declare interface TVXVideoState { 1003 | readonly STOPPED: number; 1004 | readonly PLAYING: number; 1005 | readonly PAUSED: number; 1006 | } 1007 | 1008 | declare interface TVXAction { 1009 | readonly LEFT: number; 1010 | readonly RIGHT: number; 1011 | readonly UP: number; 1012 | readonly DOWN: number; 1013 | readonly EXECUTE: number; 1014 | readonly EXIT: number; 1015 | readonly BACK: number; 1016 | readonly MENU: number; 1017 | readonly GUIDE: number; 1018 | readonly OPTIONS: number; 1019 | readonly INFO: number; 1020 | readonly CLEAR: number; 1021 | readonly CHANNEL_LIST: number; 1022 | readonly SETTINGS: number; 1023 | readonly SEARCH: number; 1024 | readonly PLAY: number; 1025 | readonly PAUSE: number; 1026 | readonly STOP: number; 1027 | readonly NEXT_TRACK: number; 1028 | readonly PREVIOUS_TRACK: number; 1029 | readonly TOGGLE_PLAY_PAUSE: number; 1030 | readonly FORWARD: number; 1031 | readonly REWIND: number; 1032 | readonly RECORD: number; 1033 | readonly RESTART: number; 1034 | readonly MUTE: number; 1035 | readonly UNMUTE: number; 1036 | readonly TOGGLE_MUTE: number; 1037 | readonly CHANNEL_UP: number; 1038 | readonly CHANNEL_DOWN: number; 1039 | readonly VOLUME_UP: number; 1040 | readonly VOLUME_DOWN: number; 1041 | readonly RED: number; 1042 | readonly GREEN: number; 1043 | readonly YELLOW: number; 1044 | readonly BLUE: number; 1045 | readonly KEY_0: number; 1046 | readonly KEY_1: number; 1047 | readonly KEY_2: number; 1048 | readonly KEY_3: number; 1049 | readonly KEY_4: number; 1050 | readonly KEY_5: number; 1051 | readonly KEY_6: number; 1052 | readonly KEY_7: number; 1053 | readonly KEY_8: number; 1054 | readonly KEY_9: number; 1055 | readonly POWER: number; 1056 | readonly SYSTEM: number; 1057 | readonly CURSOR_ON: number; 1058 | readonly CURSOR_OFF: number; 1059 | readonly SCROLL_UP: number; 1060 | readonly SCROLL_DOWN: number; 1061 | readonly SWIPE_LEFT: number; 1062 | readonly SWIPE_RIGHT: number; 1063 | readonly SWIPE_UP: number; 1064 | readonly SWIPE_DOWN: number; 1065 | readonly SLEEP: number; 1066 | readonly WAKE_UP: number; 1067 | readonly CONNECTION_UP: number; 1068 | readonly CONNECTION_DOWN: number; 1069 | readonly DEBUG: number; 1070 | readonly UNKNOWN: number; 1071 | actionToStr(action: number): string; 1072 | strToAction(str: string): number; 1073 | isNavigationAction(action: number): boolean; 1074 | isBaseAction(action: number): boolean; 1075 | isVideoAction(action: number): boolean; 1076 | isChannelAction(action: number): boolean; 1077 | isVolumeAction(action: number): boolean; 1078 | isNumberAction(action: number): boolean; 1079 | isColorAction(action: number): boolean; 1080 | isSystemAction(action: number): boolean; 1081 | } 1082 | 1083 | declare abstract class TVXCookies { 1084 | constructor(); 1085 | set(name: string, value: any, expires?: Date | number): void; 1086 | get(name: string, defaultValue: string): string; 1087 | getFullStr(name: string, defaultValue: string): string; 1088 | getNum(name: string, defaultValue: number): number; 1089 | getBool(name: string, defaultValue: boolean): boolean; 1090 | has(name: string, hasValue?: boolean): boolean; 1091 | foreach(callback: (name: string, value: any) => void | boolean): void; 1092 | remove(name: string): void; 1093 | clear(): void; 1094 | } 1095 | 1096 | declare abstract class TVXStorage { 1097 | constructor(); 1098 | set(name: string, value: any, expires?: Date | number): void; 1099 | get(name: string, defaultValue: string): string; 1100 | getFullStr(name: string, defaultValue: string): string; 1101 | getNum(name: string, defaultValue: number): number; 1102 | getBool(name: string, defaultValue: boolean): boolean; 1103 | has(name: string, hasValue?: boolean): boolean; 1104 | foreach(callback: (name: string, value: any) => void | boolean): void; 1105 | remove(name: string): void; 1106 | clear(): void; 1107 | flush(): void; 1108 | getType(): string; 1109 | setType(type: string): void; 1110 | isReady(): boolean; 1111 | onReady(handler: () => void): void; 1112 | } 1113 | 1114 | declare abstract class TVXUrlParams { 1115 | constructor(url?: string); 1116 | set(name: string, value: any): void; 1117 | get(name: string, defaultValue: string): string; 1118 | getFullStr(name: string, defaultValue: string): string; 1119 | getNum(name: string, defaultValue: number): number; 1120 | getBool(name: string, defaultValue: boolean): boolean; 1121 | has(name: string, hasValue?: boolean): boolean; 1122 | foreach(callback: (name: string, value: any) => void | boolean): void; 1123 | remove(name: string): void; 1124 | clear(): void; 1125 | create(url: string): any; 1126 | build(encoded?: boolean, separator?: string): string; 1127 | } 1128 | 1129 | declare abstract class TVXOptions { 1130 | constructor(options: any, defaultOptions?: any); 1131 | getValue(name: string): any; 1132 | get(name: string): string; 1133 | getFullStr(name: string): string; 1134 | getNum(name: string): number; 1135 | getBool(name: string): boolean; 1136 | has(name: string, hasValue?: boolean): boolean; 1137 | } 1138 | 1139 | declare abstract class TVXObservers { 1140 | constructor(); 1141 | hasObserver(name: string): boolean; 1142 | hasObservers(): boolean; 1143 | addObserver(name: string, handler: (data: any) => void): void; 1144 | removeObserver(name: string): void; 1145 | onEvent(name: string, handler?: (data: any) => void): void; 1146 | notifyObserver(name: string, data: any): void; 1147 | notifyObservers(data: any): void; 1148 | clear(): void; 1149 | } 1150 | 1151 | declare abstract class TVXEventObservers { 1152 | constructor(); 1153 | hasObserver(eventName: string, handlerName: string): boolean; 1154 | hasObservers(eventName: string): boolean; 1155 | addObserver(eventName: string, handlerName: string, handler: (data: any) => void): void; 1156 | removeObserver(eventName: string, handlerName: string): void; 1157 | onEvent(eventName: string, handlerName: string, handler?: (data: any) => void): void; 1158 | notifyObserver(eventName: string, handlerName: string, data: any): void; 1159 | notifyObservers(eventName: string, data: any): void; 1160 | clear(eventName?: string): void; 1161 | } 1162 | 1163 | declare abstract class TVXQueue { 1164 | constructor(); 1165 | delegate: any; 1166 | execute(): void; 1167 | process(): void; 1168 | reset(): void; 1169 | push(action: string | (() => void), delay?: number): void; 1170 | isBusy(): boolean; 1171 | } 1172 | 1173 | declare abstract class TVXWorker { 1174 | constructor(size?: number, delay?: number); 1175 | size: number; 1176 | delay: number; 1177 | work(): void; 1178 | process(): void; 1179 | reset(): void; 1180 | execute(action: () => void): void; 1181 | isBusy(): boolean; 1182 | } 1183 | 1184 | declare abstract class TVXDelay { 1185 | constructor(delay?: number); 1186 | delay: number; 1187 | start(action: () => void): void; 1188 | restart(): void; 1189 | stop(): void; 1190 | finish(): void; 1191 | isBusy(): boolean; 1192 | } 1193 | 1194 | declare abstract class TVXClick { 1195 | constructor(); 1196 | click(clicked: any): number; 1197 | } 1198 | 1199 | declare interface TVXAjaxOptions { 1200 | dataType?: string; 1201 | isForm?: boolean; 1202 | withCredentials?: boolean; 1203 | accurateHeaders?: boolean; 1204 | headers?: any; 1205 | } 1206 | 1207 | declare interface TVXAjaxCallback { 1208 | success?(data: any): void; 1209 | error?(message: string): void; 1210 | } 1211 | 1212 | declare abstract class TVXAjax { 1213 | constructor(); 1214 | get(url: string, callback?: TVXAjaxCallback, options?: TVXAjaxOptions): void; 1215 | post(url: string, data: string, callback?: TVXAjaxCallback, options?: TVXAjaxOptions): void; 1216 | put(url: string, data: string, callback?: TVXAjaxCallback, options?: TVXAjaxOptions): void; 1217 | del(url: string, callback?: TVXAjaxCallback, options?: TVXAjaxOptions): void; 1218 | } 1219 | 1220 | declare interface TVXLogLevel { 1221 | readonly OFF: number; 1222 | readonly ERROR: number; 1223 | readonly WARN: number; 1224 | readonly INFO: number; 1225 | readonly DEBUG: number; 1226 | } 1227 | 1228 | declare abstract class TVXLogger { 1229 | constructor(); 1230 | level: number; 1231 | maxLines: number; 1232 | maxDebugLength: number; 1233 | maxInfoLength: number; 1234 | maxWarnLength: number; 1235 | maxErrorLength: number; 1236 | registerControl(control: any, print?: boolean): void; 1237 | unregisterControl(control: any): void; 1238 | print(): void; 1239 | clear(): void; 1240 | log(level: number, message: string): void; 1241 | debug(message: string): void; 1242 | info(message: string): void; 1243 | warn(message: string): void; 1244 | error(message: string): void; 1245 | } 1246 | 1247 | declare abstract class TVXDictionary { 1248 | constructor(); 1249 | onReady(name: string, handler?: () => void): void; 1250 | init(data: any): void; 1251 | getName(): string; 1252 | getVersion(): string; 1253 | getSize(): number; 1254 | isInitialized(): boolean; 1255 | getValueForKey(key: string, defaultValue: string): string; 1256 | getValueForExpr(expr: string): string; 1257 | getData(): any; 1258 | } 1259 | 1260 | declare abstract class TVXClock { 1261 | constructor(); 1262 | readonly delay: number; 1263 | readonly now: Date; 1264 | format: string; 1265 | isRunning(): boolean; 1266 | hasHook(name: string): boolean; 1267 | hasHooks(): boolean; 1268 | hasControl(): boolean; 1269 | clearHooks(): void; 1270 | addHook(name: string, hook: () => void): void; 1271 | removeHook(name: string): void; 1272 | onTick(name: string, hook?: () => void): void; 1273 | registerControl(control: any): void; 1274 | unregisterControl(control: any): void; 1275 | update(): void; 1276 | validate(): void; 1277 | process(): void; 1278 | start(): void; 1279 | stop(): void; 1280 | } 1281 | 1282 | declare abstract class TVXDataLoader { 1283 | constructor(); 1284 | load(url: string, cacheId: string, callback?: TVXDataLoaderCallback, options?: TVXAjaxOptions): void; 1285 | clearCache(cacheId: string): void; 1286 | clear(): void; 1287 | } 1288 | 1289 | declare interface TVXDataLoaderCallback { 1290 | success?(data: any, cached: boolean): void; 1291 | error?(message: string): void; 1292 | } 1293 | 1294 | declare interface TVXServices { 1295 | readonly logger: TVXLogger; 1296 | readonly cookies: TVXCookies; 1297 | readonly storage: TVXStorage; 1298 | readonly urlParams: TVXUrlParams; 1299 | readonly ajax: TVXAjax; 1300 | readonly loader: TVXDataLoader; 1301 | } 1302 | 1303 | declare abstract class TVXDataService { 1304 | constructor(); 1305 | onReady(name: string, handler?: TVXDataServiceEntryCallback): void; 1306 | onError(name: string, handler?: TVXDataServiceEntryCallback): void; 1307 | onCompleted(name: string, handler?: TVXDataServiceEntryCallback): void; 1308 | foreachEntry(callback: (entry: any) => void | boolean): void; 1309 | foreachError(callback: (error: any) => void | boolean): void; 1310 | getData(id: string): any; 1311 | getEntry(id: string): any; 1312 | setEntry(id: string, entry: any): void; 1313 | getError(id: string): any; 1314 | setError(id: string, error: any): void; 1315 | shouldStoreData(id: string): boolean; 1316 | createData(id: string, resp: any): void; 1317 | putData(url: string, data: string, callback?: TVXDataServiceActionCallback, options?: TVXAjaxOptions): void; 1318 | postData(url: string, data: string, callback?: TVXDataServiceActionCallback, options?: TVXAjaxOptions): void; 1319 | deleteData(url: string, callback?: TVXDataServiceActionCallback, options?: TVXAjaxOptions): void; 1320 | loadData(id: string, url: string, callback?: TVXDataServiceEntryCallback, options?: TVXAjaxOptions): void; 1321 | clearData(id: string): void; 1322 | clear(): void; 1323 | } 1324 | 1325 | declare interface TVXDataServiceActionCallback { 1326 | success?(data: any): void; 1327 | error?(message: string, status: number, reason: any): void; 1328 | } 1329 | 1330 | declare interface TVXDataServiceEntryCallback { 1331 | success?(entry: any): void; 1332 | error?(message: string, status: number, reason: any): void; 1333 | completed?(entry: any): void; 1334 | } 1335 | 1336 | declare abstract class TVXBlobService { 1337 | constructor(); 1338 | onReady(name: string, handler?: TVXBlobServiceCallback): void; 1339 | onError(name: string, handler?: TVXBlobServiceCallback): void; 1340 | onCompleted(name: string, handler?: TVXBlobServiceCallback): void; 1341 | foreachEntry(callback: (entry: any) => void | boolean): void; 1342 | foreachError(callback: (error: any) => void | boolean): void; 1343 | getBlob(id: string): any; 1344 | getUrl(id: string): string; 1345 | getEntry(id: string): any; 1346 | setEntry(id: string, entry: any): void; 1347 | getError(id: string): any; 1348 | setError(id: string, error: any): void; 1349 | executeBlob(id: string, url: string, data: string, callback?: TVXBlobServiceCallback, options?: TVXAjaxOptions): void; 1350 | loadBlob(id: string, url: string, callback?: TVXBlobServiceCallback, options?: TVXAjaxOptions): void; 1351 | clearBlob(id: string): void; 1352 | clear(): void; 1353 | } 1354 | 1355 | declare interface TVXBlobServiceCallback { 1356 | success?(entry: any): void; 1357 | error?(message: string, status: number, reason: any): void; 1358 | completed?(entry: any): void; 1359 | } 1360 | 1361 | declare abstract class TVXRequestService { 1362 | constructor(timeout?: number); 1363 | timeout: number; 1364 | startRequest(callback?: TVXRequestServiceCallback): string; 1365 | getRequestsCount(): number; 1366 | isRequestPending(id: string): boolean; 1367 | handleData(id: string, data?: any): void; 1368 | handleError(id: string, message?: string, type?: string): void; 1369 | } 1370 | 1371 | declare interface TVXRequestServiceCallback { 1372 | success?(data: any): void; 1373 | error?(message: string, type: string): void; 1374 | } 1375 | 1376 | declare abstract class TVXBusyService { 1377 | constructor(); 1378 | isBusy(): boolean; 1379 | start(clear?: boolean): void; 1380 | stop(clear?: boolean): void; 1381 | onReady(handler: () => void): void; 1382 | } 1383 | 1384 | declare interface TVXPluginTools { 1385 | createCanvas(canvasClass: string, width: number, height: number): string; 1386 | createIFrame(frameClass: string, src: string): string; 1387 | areSettingsValidated(): boolean; 1388 | invalidateSettings(): void; 1389 | validateSettings(data: MSXAttachedInfo): void; 1390 | onValidatedSettings(callback: (data: MSXAttachedInfo) => void): void; 1391 | handleSettingsEvent(data: any): void; 1392 | getFrameworkInfo(data: MSXAttachedInfo): string; 1393 | getApplicationInfo(data: MSXAttachedInfo): string; 1394 | getContentInfo(data: MSXAttachedInfo): string; 1395 | checkFramework(data: MSXAttachedInfo, minVersion: string, requiredName?: string): boolean; 1396 | checkApplication(data: MSXAttachedInfo, minVersion: string, requiredName?: string): boolean; 1397 | checkContent(data: MSXAttachedInfo, minVersion: string, requiredName?: string): boolean; 1398 | isSameContentState(state: MSXAttachedContentState, state2: MSXAttachedContentState): boolean; 1399 | createChangedContentState(currentState: TVXChangedContentState, newState: TVXChangedContentState): TVXChangedContentState; 1400 | isReady(): boolean; 1401 | onReady(handler: () => void): void; 1402 | startInitService(): void; 1403 | stopInitService(): void; 1404 | } 1405 | 1406 | declare interface TVXChangedContentState extends MSXAttachedContentState { 1407 | init: boolean; 1408 | initChanged: boolean; 1409 | startChanged: boolean; 1410 | restoredChanged: boolean; 1411 | menuIdChanged: boolean; 1412 | menuFlagChanged: boolean; 1413 | menuFocusChanged: boolean; 1414 | menuIndexChanged: boolean; 1415 | menuSizeChanged: boolean; 1416 | contentIdChanged: boolean; 1417 | contentFlagChanged: boolean; 1418 | contentFocusChanged: boolean; 1419 | contentIndexChanged: boolean; 1420 | contentSizeChanged: boolean; 1421 | contentVisibleChanged: boolean; 1422 | panelIdChanged: boolean; 1423 | panelFlagChanged: boolean; 1424 | panelFocusChanged: boolean; 1425 | panelIndexChanged: boolean; 1426 | panelSizeChanged: boolean; 1427 | panelVisibleChanged: boolean; 1428 | videoVisibleChanged: boolean; 1429 | videoActiveChanged: boolean; 1430 | playerVisibleChanged: boolean; 1431 | slideshowVisibleChanged: boolean; 1432 | volumeVisibleChanged: boolean; 1433 | logVisibleChanged: boolean; 1434 | } 1435 | 1436 | declare interface TVXDeviceId { 1437 | deviceId?: string; 1438 | error?: string; 1439 | } 1440 | 1441 | declare interface TVXPlayerButtonData { 1442 | key?: string; 1443 | icon?: string; 1444 | action?: string; 1445 | enable?: boolean; 1446 | } 1447 | 1448 | declare interface TVXVideoUpdateData { 1449 | state?: number; 1450 | position?: number; 1451 | duration?: number; 1452 | speed?: number; 1453 | ended?: boolean; 1454 | volume?: number; 1455 | muted?: boolean; 1456 | } 1457 | 1458 | /** This is the interface for a video/audio plugin. 1459 | * @see: {@link http://msx.benzac.de/info/xp/?tab=VideoPlugin} 1460 | */ 1461 | declare interface TVXVideoPlugin { 1462 | /** 1463 | * Sets up the player object (see TVXVideoPluginPlayer interface). 1464 | * @param player The player object. 1465 | */ 1466 | setupPlayer(player: TVXVideoPluginPlayer): void; 1467 | /** 1468 | * Sets the seek delay (in milliseconds). 1469 | * @param delay The delay in milliseconds. 1470 | */ 1471 | setSeekDelay(delay: number): void; 1472 | /** Gets the seek delay (in milliseconds). */ 1473 | getSeekDelay(): number; 1474 | /** 1475 | * Sets the loading delay (in milliseconds). 1476 | * @param delay The delay in milliseconds. 1477 | */ 1478 | setLoadingDelay(delay: number): void; 1479 | /** Gets the loading delay (in milliseconds). */ 1480 | getLoadingDelay(): number; 1481 | /** 1482 | * Indicates if the fullscreen mode is enabled. 1483 | * @param element The element that should be checked (e.g. the video element). If not specified (or not accessible), the global fullscreen mode is checked. 1484 | */ 1485 | isFullscreenEnabled(element?: any): boolean; 1486 | /** 1487 | * Indicates if the fullscreen mode is active. 1488 | * @param element The element that should be checked (e.g. the video element). If not specified (or not accessible), the global fullscreen mode is checked. 1489 | */ 1490 | isFullscreenActive(element?: any): boolean; 1491 | /** 1492 | * Requests the fullscreen mode for an element (returns true on success). 1493 | * @param element The element that should be displayed in fullscreen mode (e.g. the video element). 1494 | */ 1495 | requestFullscreen(element: any): boolean; 1496 | /** 1497 | * Exits the fullscreen mode (returns true on success). 1498 | * @param element The element that is displayed in fullscreen mode (e.g. the video element). If not specified (or not accessible), the global fullscreen exit function is used. 1499 | */ 1500 | exitFullscreen(element?: any): boolean; 1501 | /** 1502 | * Sets the state (see TVXVideoState interface). 1503 | * @param state The state. 1504 | * @param commit Indicates if the player values should be directly comitted (default: false). 1505 | */ 1506 | setState(state: number, commit?: boolean): void; 1507 | /** Gets the state (see TVXVideoState interface). */ 1508 | getState(): number; 1509 | /** Calls the play/pause/stop function on the player object. */ 1510 | applyState(): void; 1511 | /** 1512 | * Sets the position (in seconds) and stops the seek process. 1513 | * @param position The position in seconds. 1514 | * @param commit Indicates if the player values should be directly comitted (default: false). 1515 | */ 1516 | setPosition(position: number, commit?: boolean): void; 1517 | /** Gets the position (in seconds). */ 1518 | getPosition(): number; 1519 | /** Calls the setPosition function on the player object. */ 1520 | applyPosition(): void; 1521 | /** 1522 | * Sets the duration (in seconds). 1523 | * @param duration The duration in seconds. 1524 | * @param commit Indicates if the player values should be directly comitted (default: false). 1525 | */ 1526 | setDuration(duration: number, commit?: boolean): void; 1527 | /** Gets the duration (in seconds). */ 1528 | getDuration(): number; 1529 | /** 1530 | * Sets the speed (0.125 .. 8.0). 1531 | * @param speed The speed value from 0.125 to 8.0. 1532 | * @param commit Indicates if the player values should be directly comitted (default: false). 1533 | */ 1534 | setSpeed(speed: number, commit?: boolean): void; 1535 | /** Gets the speed (0.125 .. 8.0). */ 1536 | getSpeed(): number; 1537 | /** Calls the setSpeed function on the player object. */ 1538 | applySpeed(): void; 1539 | /** 1540 | * Sets if the player has ended. 1541 | * @param ended The ended state. 1542 | * @param commit Indicates if the player values should be directly comitted (default: false). 1543 | */ 1544 | setEnded(ended: boolean, commit?: boolean): void; 1545 | /** Indicates if the player has ended. */ 1546 | hasEnded(): boolean; 1547 | /** 1548 | * Sets the volume (0 .. 100). 1549 | * @param volume The volume level from 0 to 100. 1550 | * @param commit Indicates if the player values should be directly comitted (default: false). 1551 | */ 1552 | setVolume(volume: number, commit?: boolean): void; 1553 | /** Gets the volume (0 .. 100). */ 1554 | getVolume(): number; 1555 | /** 1556 | * Sets if the player is muted. 1557 | * @param muted The muted state. 1558 | * @param commit Indicates if the player values should be directly comitted (default: false). 1559 | */ 1560 | setMuted(muted: boolean, commit?: boolean): void; 1561 | /** Indicates if the player is muted. */ 1562 | isMuted(): boolean; 1563 | /** Calls the setVolume and setMuted function on the player object. */ 1564 | applyVolume(): void; 1565 | /** Gets the player width (in pixels). */ 1566 | getWidth(): number; 1567 | /** Gets the player height (in pixels). */ 1568 | getHeight(): number; 1569 | /** Calls the setSize function on the player object. */ 1570 | applySize(): void; 1571 | /** 1572 | * Executes any action. 1573 | * @param action Any action. 1574 | * @param data Any action-related data. 1575 | */ 1576 | executeAction(action: string, data?: AnyObject): void; 1577 | /** 1578 | * Logs a debug message. 1579 | * @param message A message. 1580 | * @param log Indicates if the message should be logged (default: true). 1581 | */ 1582 | debug(message: string, log?: boolean): void; 1583 | /** 1584 | * Logs (and shows) a success message. 1585 | * @param message A message. 1586 | * @param log Indicates if the message should be logged (default: true). 1587 | * @param show Indicates if the message should be shown (default: true). 1588 | */ 1589 | success(message: string, log?: boolean, show?: boolean): void; 1590 | /** 1591 | * Logs (and shows) an info message. 1592 | * @param message A message. 1593 | * @param log Indicates if the message should be logged (default: true). 1594 | * @param show Indicates if the message should be shown (default: true). 1595 | */ 1596 | info(message: string, log?: boolean, show?: boolean): void; 1597 | /** 1598 | * Logs (and shows) a warning message. 1599 | * @param message A message. 1600 | * @param log Indicates if the message should be logged (default: true). 1601 | * @param show Indicates if the message should be shown (default: true). 1602 | */ 1603 | warn(message: string, log?: boolean, show?: boolean): void; 1604 | /** 1605 | * Logs (and shows) an error message. 1606 | * @param message A message. 1607 | * @param log Indicates if the message should be logged (default: true). 1608 | * @param show Indicates if the message should be shown (default: true). 1609 | */ 1610 | error(message: string, log?: boolean, show?: boolean): void; 1611 | /** 1612 | * Shows (or loads) a menu (the data parameter can be a JSON or URL). 1613 | * @param data A JSON or URL. 1614 | */ 1615 | showMenu(data: MSXMenuRoot | string): void; 1616 | /** 1617 | * Shows (or loads) a content page (the data parameter can be a JSON or URL). 1618 | * @param data A JSON or URL. 1619 | */ 1620 | showContent(data: MSXContentRoot | string): void; 1621 | /** 1622 | * Shows (or loads) a panel (the data parameter can be a JSON or URL). 1623 | * @param data A JSON or URL. 1624 | */ 1625 | showPanel(data: MSXContentRoot | string): void; 1626 | /** 1627 | * Shows the player. 1628 | * @param key A remote key that should be applied (e.g. "execute", "left", "right", etc.). 1629 | */ 1630 | showPlayer(key?: string): void; 1631 | /** Shows the player action. */ 1632 | showAction(): void; 1633 | /** Hides the player. */ 1634 | hidePlayer(): void; 1635 | /** 1636 | * Sets up the player content label. 1637 | * @param label The label. If no label is set, the default label is used. 1638 | */ 1639 | setupContentLabel(label?: string): void; 1640 | /** 1641 | * Sets up an additional player extension label. 1642 | * @param label The label. If no label is set, the default label is used. 1643 | */ 1644 | setupExtensionLabel(label?: string): void; 1645 | /** 1646 | * Sets up the player position label. 1647 | * @param label The label. If no label is set, the default label is used. 1648 | */ 1649 | setupPositionLabel(label?: string): void; 1650 | /** 1651 | * Sets up the player duration label. 1652 | * @param label The label. If no label is set, the default label is used. 1653 | */ 1654 | setupDurationLabel(label?: string): void; 1655 | /** 1656 | * Sets up the player speed label. 1657 | * @param label The label. If no label is set, the default label is used. 1658 | */ 1659 | setupSpeedLabel(label?: string): void; 1660 | /** 1661 | * Sets up a player info headline (only available for extended players). 1662 | * @param headline The headline. If no headline is set, the headline is removed. 1663 | */ 1664 | setupInfoHeadline(headline?: string): void; 1665 | /** 1666 | * Sets up a player info text (only available for extended players). 1667 | * @param text The text. If no text is set, the text is removed. 1668 | */ 1669 | setupInfoText(text?: string): void; 1670 | /** 1671 | * Sets up a player info image (only available for extended players). 1672 | * @param image The image URL. If no image is set, the image is removed. 1673 | */ 1674 | setupInfoImage(image?: string): void; 1675 | /** 1676 | * Sets up the player info overlay (only available for extended players). 1677 | * @param overlay The overlay type. If no overlay is set, the default overlay is used. 1678 | */ 1679 | setupInfoOverlay(overlay?: string): void; 1680 | /** 1681 | * Sets up the size of the player info image area (only available for extended players). 1682 | * @param overlay The size of the image area. If no size is set, the default size is used. 1683 | */ 1684 | setupInfoSize(overlay?: string): void; 1685 | /** 1686 | * Enables rounded corners of the info image if the rounded style is used (only available for extended players). 1687 | */ 1688 | enableInfoRound(): void; 1689 | /** 1690 | * Disables rounded corners of the info image if the rounded style is used (only available for extended players). 1691 | */ 1692 | disableInfoRound(): void; 1693 | /** 1694 | * Sets up a custom player control action (replacement for the action that is executed if the OK key is pressed while the video/audio is in foreground). 1695 | * @param action The action. If no action is set, the default action is used. 1696 | */ 1697 | setupControlAction(action?: string): void; 1698 | /** 1699 | * Sets up a player button (all buttons except the eject button are supported). 1700 | * @param id The button ID. 1701 | * @param data The button data. If no data is set, the default button is restored. 1702 | */ 1703 | setupButton(id: string, data?: TVXPlayerButtonData): void; 1704 | /** 1705 | * Enables a player button (all buttons except the eject button are supported). 1706 | * @param id The button ID. 1707 | */ 1708 | enableButton(id: string): void; 1709 | /** 1710 | * Disables a player button (all buttons except the eject button are supported). 1711 | * @param id The button ID. 1712 | */ 1713 | disableButton(id: string): void; 1714 | /** 1715 | * Resets a player button (all buttons except the eject button are supported). 1716 | * @param id The button ID. 1717 | */ 1718 | resetButton(id: string): void; 1719 | /** 1720 | * Focuses a player button. 1721 | * @param id The button ID. 1722 | */ 1723 | focusButton(id: string): void; 1724 | /** 1725 | * Sets up the player progress position. 1726 | * @param position The position. If no position is set, the default position is used. 1727 | */ 1728 | setupProgressPosition(position?: number): void; 1729 | /** 1730 | * Sets up the player progress duration. 1731 | * @param duration The duration. If no duration is set, the default duration is used. 1732 | */ 1733 | setupProgressDuration(duration?: number): void; 1734 | /** 1735 | * Sets up the player progress color. 1736 | * @param color The color. If no color is set, the default color is used. 1737 | */ 1738 | setupProgressColor(color?: string): void; 1739 | /** 1740 | * Sets up the player progress type. 1741 | * @param type The type. If no type is set, the default type is used. 1742 | */ 1743 | setupProgressType(type?: string): void; 1744 | /** Enables the player progress marker. */ 1745 | enableProgressMarker(): void; 1746 | /** Disables the player progress marker. */ 1747 | disableProgressMarker(): void; 1748 | /** Invalidates the player progress marker (marker will be unfocused). */ 1749 | invalidateProgressMarker(): void; 1750 | /** Refreshes all player values. */ 1751 | refreshPlayer(): void; 1752 | /** Resets custom player values that have been set at runtime. */ 1753 | resetPlayer(): void; 1754 | /** 1755 | * Sets up an audio background. 1756 | * @param background The background image. 1757 | */ 1758 | setupBackground(background?: string): void; 1759 | /** 1760 | * Sets up a video/audio trigger. 1761 | * @param key The trigger key. 1762 | * @param action The trigger action. 1763 | * @param shot Indicates if the trigger should be removed when it has been executed (default: false). 1764 | */ 1765 | setupTrigger(key: string, action: string, shot?: boolean): void; 1766 | /** 1767 | * Clears a video/audio trigger. 1768 | * @param key The trigger key. 1769 | */ 1770 | clearTrigger(key: string): void; 1771 | /** Cancels an ongoing resume process. */ 1772 | cancelResume(): void; 1773 | /** 1774 | * Requests any data (e.g. "info", "video", "code", etc.). 1775 | * @param dataId The data ID. 1776 | * @param callback The callback that contains the result data. 1777 | * @param data Any request-related data. 1778 | */ 1779 | requestData(dataId: string, callback?: (data: MSXAttachedGeneric) => void, data?: AnyObject): void; 1780 | /** 1781 | * Requests a response from the interaction plugin. 1782 | * @param dataId The data ID. 1783 | * @param callback The callback that contains the result data. 1784 | * @param data Any request-related data. 1785 | */ 1786 | requestInteractionResponse(dataId: string, callback?: (data: MSXAttachedResponse) => void, data?: AnyObject): void; 1787 | /** 1788 | * Validates (or revalidates) the settings (see TVXSettings interface). 1789 | * @param callback The callback that contains the result data with the validated settings. 1790 | */ 1791 | validateSettings(callback?: (data: MSXAttachedInfo) => void): void; 1792 | /** 1793 | * Validates the settings if they are not validated (see TVXSettings interface). 1794 | * @param callback The callback that is called after completion. 1795 | */ 1796 | onValidatedSettings(callback: (data: MSXAttachedInfo) => void): void; 1797 | /** 1798 | * Triggers a custom event (that can be handled by the interaction plugin). 1799 | * @param eventId The event ID. 1800 | * @param data Any event-related data; 1801 | */ 1802 | triggerEvent(eventId: string, data?: AnyObject): void; 1803 | /** 1804 | * Sets up a local steam. 1805 | * @param baseSteam The base steam. 1806 | */ 1807 | setupSteam(baseSteam: string): void; 1808 | /** 1809 | * Creates a steam. 1810 | * @param scope The scope. 1811 | */ 1812 | createSteam(scope?: string): string; 1813 | /** 1814 | * Resolves a token. 1815 | * @param token A token. 1816 | * @param scope The scope. 1817 | */ 1818 | resolveToken(token: string, scope?: string): string; 1819 | /** 1820 | * Transforms a string. 1821 | * @param string A string. 1822 | * @param scope The scope. 1823 | */ 1824 | transformString(string: string, scope?: string): string; 1825 | /** 1826 | * Normalizes a string. 1827 | * @param string A string. 1828 | * @param scope The scope. 1829 | */ 1830 | normalizeString(string: string, scope?: string): string; 1831 | /** 1832 | * Transforms a string asynchronously. 1833 | * @param string A string. 1834 | * @param scope The scope. 1835 | * @param callback The callback that contains the result data with the transformed string. 1836 | */ 1837 | transformStringAsync(string: string, scope?: string, callback?: (data: MSXAttachedString) => void): void; 1838 | /** 1839 | * Normalizes a string asynchronously. 1840 | * @param string A string. 1841 | * @param scope The scope. 1842 | * @param callback The callback that contains the result data with the normalized string. 1843 | */ 1844 | normalizeStringAsync(string: string, scope?: string, callback?: (data: MSXAttachedString) => void): void; 1845 | /** 1846 | * Transforms a URL. 1847 | * @param url A URL. 1848 | */ 1849 | transformUrl(url: string): string; 1850 | /** 1851 | * Creates a hash key. 1852 | * @param string A string. 1853 | * @param scope The scope. 1854 | */ 1855 | createHashKey(string: string, scope?: string): string; 1856 | /** 1857 | * Clears the device ID (if it was created). 1858 | */ 1859 | clearDeviceId(): void; 1860 | /** 1861 | * Returns (or creates) the device ID. 1862 | * @param data The application info data. 1863 | */ 1864 | getDeviceId(data?: MSXAttachedInfo): string; 1865 | /** 1866 | * Requests the device ID. 1867 | * @param callback The callback that contains the result data with the device ID. 1868 | */ 1869 | requestDeviceId(callback: (data: TVXDeviceId) => void): void; 1870 | /** 1871 | * Indicates if content observers exist. 1872 | */ 1873 | hasContentObservers(): boolean; 1874 | /** 1875 | * Adds a content observer. 1876 | * @param name The handler name. 1877 | * @param handler The handler function. 1878 | */ 1879 | addContentObserver(name: string, handler: (state: TVXChangedContentState) => void): void; 1880 | /** 1881 | * Removes a content observer. 1882 | * @param name The handler name. 1883 | */ 1884 | removeContentObserver(name: string): void; 1885 | /** 1886 | * Removes all content observers. 1887 | */ 1888 | clearContentObservers(): void; 1889 | /** Initializes the player. */ 1890 | init(): void; 1891 | /** Commits all player values. */ 1892 | commit(): void; 1893 | /** Indicates if the player is initialized. */ 1894 | isInitialized(): boolean; 1895 | /** Indicates if the player is ready. */ 1896 | isReady(): boolean; 1897 | /** 1898 | * Starts the playback (calls the play and periodically the getUpdateData function on the player object). 1899 | * @param accelerate Indicates if the start should be accelerated by rapidly polling the getPosition and getDuration function on the player object (default: false). 1900 | */ 1901 | startPlayback(accelerate?: boolean): void; 1902 | /** Stops the playback. */ 1903 | stopPlayback(): void; 1904 | /** Cancels the playback. */ 1905 | cancelPlayback(): void; 1906 | /** 1907 | * Starts a loading process (shows a busy indicator after the loading delay). 1908 | * @param restart Indicates if a running loading delay should be restarted (default: true). 1909 | */ 1910 | startLoading(restart?: boolean): void; 1911 | /** Stops a loading process. */ 1912 | stopLoading(): void; 1913 | /** 1914 | * Executes a handler function and handles all errors that occur. 1915 | * @param handler A handler function that should return a data object if a callback function is also set. 1916 | * @param callback A callback function that is called with null when an error has occurred. 1917 | */ 1918 | executeHandler(handler: (() => void) | (() => AnyObject), callback?: (data?: AnyObject) => void): void; 1919 | } 1920 | 1921 | /** This interface defines the structure of a player object. */ 1922 | declare interface TVXVideoPluginPlayer { 1923 | /** Initializes the player. */ 1924 | init?(): void; 1925 | /** This function is called when the player is ready. */ 1926 | ready?(): void; 1927 | /** Plays the player. */ 1928 | play?(): void; 1929 | /** Pauses the player. */ 1930 | pause?(): void; 1931 | /** Stops the player. */ 1932 | stop?(): void; 1933 | /** Gets the duration (in seconds). */ 1934 | getDuration?(): number; 1935 | /** Gets the position (in seconds). */ 1936 | getPosition?(): number; 1937 | /** 1938 | * Sets the position (in seconds). 1939 | * @param position The position in seconds. 1940 | */ 1941 | setPosition?(position: number): void; 1942 | /** 1943 | * Sets the volume (0 .. 100). 1944 | * @param volume The volume level from 0 to 100. 1945 | */ 1946 | setVolume?(volume: number): void; 1947 | /** Gets the volume (0 .. 100). */ 1948 | getVolume?(): number; 1949 | /** 1950 | * Sets if the player is muted. 1951 | * @param muted The muted state. 1952 | */ 1953 | setMuted?(muted: boolean): void; 1954 | /** Indicates if the player is muted. */ 1955 | isMuted?(): boolean; 1956 | /** Gets the speed (0.125 .. 8.0). */ 1957 | getSpeed?(): number; 1958 | /** 1959 | * Sets the speed (0.125 .. 8.0). 1960 | * @param speed The speed value from 0.125 to 8.0. 1961 | */ 1962 | setSpeed?(speed: number): void; 1963 | /** 1964 | * Sets the window size (in pixels). 1965 | * @param width The width in pixels. 1966 | * @param height The height in pixels. 1967 | */ 1968 | setSize?(width: number, height: number): void; 1969 | /** Gets the update data (this function will be called each second). */ 1970 | getUpdateData?(): TVXVideoUpdateData; 1971 | /** 1972 | * Handles an event. The data.event property can contain following values: 1973 | * - "app:suspend" 1974 | * - "app:resume" 1975 | * - "app:sleep" 1976 | * - "app:wake" 1977 | * - "app:resize" 1978 | * - "app:connect" 1979 | * - "app:disconnect" 1980 | * - "app:time" (data.offset and data.zoneOffset properties contain the new time and zone offset) 1981 | * - "app:result" (data.id property contains the request ID, data.code property contains the result code, and data.extra property contains the extra data) 1982 | * - "video:load"* (data.info property contains the loaded video info and data.data property contains the active video data before this event occurred) 1983 | * - "video:play"* (data.data property contains the active video data before this event occurred) 1984 | * - "video:pause"* (data.data property contains the active video data before this event occurred) 1985 | * - "video:stop"* (data.data property contains the active video data before this event occurred) 1986 | * - "video:seek"* (data.position property contains the seeked position in seconds and data.data property contains the active video data before this event occurred) 1987 | * - "video:restart"* (data.data property contains the active video data before this event occurred) 1988 | * - "video:speed"* (data.speed property contains the new speed value and data.data property contains the active video data before this event occurred) 1989 | * - "video:volume"* (data.volume and data.muted properties contain the new volume level and muted state) 1990 | * - "slider:load" (data.info property contains the loaded slider info) 1991 | * - "slider:play" 1992 | * - "slider:pause" 1993 | * - "slider:stop" 1994 | * - "slider:position" (data.index, data.number, and data.listIndex properties contain the new item index, number, and list index) 1995 | * - "settings:animate" (data.value property contains the new settings value) 1996 | * - "settings:transform" (data.value property contains the new settings value) 1997 | * - "settings:input" (data.value property contains the new settings value) 1998 | * - "settings:remote" (data.value property contains the new settings value) 1999 | * - "settings:layout" (data.value property contains the new settings value) 2000 | * - "settings:scale" (data.value property contains the new settings value) 2001 | * - "settings:zoom" (data.value property contains the new settings value) 2002 | * - "settings:validate_links" (data.value property contains the new settings value) 2003 | * - "settings:random_playback" (data.value property contains the new settings value) 2004 | * - "settings:slideshow_interval" (data.value property contains the new settings value) 2005 | * - "settings:hover_effect" (data.value property contains the new settings value) 2006 | * - "settings:immersive_mode" (data.value property contains the new settings value) 2007 | * - "settings:rounded_style" (data.value property contains the new settings value) 2008 | * - "settings:menu_button" (data.action and data.keyCode properties contain the new button action and key code) 2009 | * - "custom:{EVENT_ID}" (data.data property optionally contains the event-related data) 2010 | * *Note: Video events are usually not handled by the player, since the corresponding player function is also called (e.g. play() -> "video:play"). 2011 | * @param data The event data. 2012 | */ 2013 | handleEvent?(data: AnyObject): void; 2014 | /** 2015 | * Handles any data. User-defined data is optionally available in the data.data property. 2016 | * @param data Any data. 2017 | */ 2018 | handleData?(data: AnyObject): void; 2019 | /** 2020 | * Handles a request. User-defined data is optionally available in the data.data property. 2021 | * @param dataId The data ID. 2022 | * @param data Any data. 2023 | * @param callback The callback that has to be called with the result data. 2024 | */ 2025 | handleRequest?(dataId: string, data: AnyObject, callback: (respData?: AnyObject) => void): void; 2026 | /** 2027 | * This function is called when an error has occurred. The error is already logged and shown, therefore, the error should only be evaluated here for debug purposes. 2028 | * @param message The error message. 2029 | * @param error The error object. 2030 | */ 2031 | onError?(message: string, error: AnyObject): void; 2032 | } 2033 | 2034 | /** This is the interface for an interaction plugin. 2035 | * @see: {@link http://msx.benzac.de/info/xp/?tab=InteractionPlugin} 2036 | */ 2037 | declare interface TVXInteractionPlugin { 2038 | /** 2039 | * Sets up the interaction handler (see TVXInteractionPluginHandler interface). 2040 | * @param handler The interaction handler. 2041 | */ 2042 | setupHandler(handler: TVXInteractionPluginHandler): void; 2043 | /** 2044 | * Sets the loading delay (in milliseconds). 2045 | * @param delay The delay in milliseconds. 2046 | */ 2047 | setLoadingDelay(delay: number): void; 2048 | /** Gets the loading delay (in milliseconds). */ 2049 | getLoadingDelay(): number; 2050 | /** 2051 | * Executes any action. 2052 | * @param action Any action. 2053 | * @param data Any action-related data. 2054 | */ 2055 | executeAction(action: string, data?: AnyObject): void; 2056 | /** 2057 | * Logs a debug message. 2058 | * @param message A message. 2059 | * @param log Indicates if the message should be logged (default: true). 2060 | */ 2061 | debug(message: string, log?: boolean): void; 2062 | /** 2063 | * Logs (and shows) a success message. 2064 | * @param message A message. 2065 | * @param log Indicates if the message should be logged (default: true). 2066 | * @param show Indicates if the message should be shown (default: true). 2067 | */ 2068 | success(message: string, log?: boolean, show?: boolean): void; 2069 | /** 2070 | * Logs (and shows) an info message. 2071 | * @param message A message. 2072 | * @param log Indicates if the message should be logged (default: true). 2073 | * @param show Indicates if the message should be shown (default: true). 2074 | */ 2075 | info(message: string, log?: boolean, show?: boolean): void; 2076 | /** 2077 | * Logs (and shows) a warning message. 2078 | * @param message A message. 2079 | * @param log Indicates if the message should be logged (default: true). 2080 | * @param show Indicates if the message should be shown (default: true). 2081 | */ 2082 | warn(message: string, log?: boolean, show?: boolean): void; 2083 | /** 2084 | * Logs (and shows) an error message. 2085 | * @param message A message. 2086 | * @param log Indicates if the message should be logged (default: true). 2087 | * @param show Indicates if the message should be shown (default: true). 2088 | */ 2089 | error(message: string, log?: boolean, show?: boolean): void; 2090 | /** 2091 | * Shows (or loads) a menu (the data parameter can be a JSON or URL). 2092 | * @param data A JSON or URL. 2093 | */ 2094 | showMenu(data: MSXMenuRoot | string): void; 2095 | /** 2096 | * Shows (or loads) a content page (the data parameter can be a JSON or URL). 2097 | * @param data A JSON or URL. 2098 | */ 2099 | showContent(data: MSXContentRoot | string): void; 2100 | /** 2101 | * Shows (or loads) a panel (the data parameter can be a JSON or URL). 2102 | * @param data A JSON or URL. 2103 | */ 2104 | showPanel(data: MSXContentRoot | string): void; 2105 | /** 2106 | * Requests any data (e.g. "info", "video", "code", etc.). 2107 | * @param dataId The data ID. 2108 | * @param callback The callback that contains the result data. 2109 | * @param data Any request-related data. 2110 | */ 2111 | requestData(dataId: string, callback?: (data: MSXAttachedGeneric) => void, data?: AnyObject): void; 2112 | /** 2113 | * Requests a response from the player (handled by the video/audio plugin). 2114 | * @param dataId The data ID. 2115 | * @param callback The callback that contains the result data. 2116 | * @param data Any request-related data. 2117 | */ 2118 | requestPlayerResponse(dataId: string, callback?: (data: MSXAttachedResponse) => void, data?: AnyObject): void; 2119 | /** 2120 | * Validates (or revalidates) the settings (see TVXSettings interface). 2121 | * @param callback The callback that contains the result data with the validated settings. 2122 | */ 2123 | validateSettings(callback?: (data: MSXAttachedInfo) => void): void; 2124 | /** 2125 | * Validates the settings if they are not validated (see TVXSettings interface). 2126 | * @param callback The callback that is called after completion. 2127 | */ 2128 | onValidatedSettings(callback: (data: MSXAttachedInfo) => void): void; 2129 | /** 2130 | * Triggers a custom event (that can be handled by the video/audio plugin). 2131 | * @param eventId The event ID. 2132 | * @param data Any event-related data; 2133 | */ 2134 | triggerEvent(eventId: string, data?: AnyObject): void; 2135 | /** 2136 | * Sets up a local steam. 2137 | * @param baseSteam The base steam. 2138 | */ 2139 | setupSteam(baseSteam: string): void; 2140 | /** 2141 | * Creates a steam. 2142 | * @param scope The scope. 2143 | */ 2144 | createSteam(scope?: string): string; 2145 | /** 2146 | * Resolves a token. 2147 | * @param token A token. 2148 | * @param scope The scope. 2149 | */ 2150 | resolveToken(token: string, scope?: string): string; 2151 | /** 2152 | * Transforms a string. 2153 | * @param string A string. 2154 | * @param scope The scope. 2155 | */ 2156 | transformString(string: string, scope?: string): string; 2157 | /** 2158 | * Normalizes a string. 2159 | * @param string A string. 2160 | * @param scope The scope. 2161 | */ 2162 | normalizeString(string: string, scope?: string): string; 2163 | /** 2164 | * Transforms a string asynchronously. 2165 | * @param string A string. 2166 | * @param scope The scope. 2167 | * @param callback The callback that contains the result data with the transformed string. 2168 | */ 2169 | transformStringAsync(string: string, scope?: string, callback?: (data: MSXAttachedString) => void): void; 2170 | /** 2171 | * Normalizes a string asynchronously. 2172 | * @param string A string. 2173 | * @param scope The scope. 2174 | * @param callback The callback that contains the result data with the normalized string. 2175 | */ 2176 | normalizeStringAsync(string: string, scope?: string, callback?: (data: MSXAttachedString) => void): void; 2177 | /** 2178 | * Transforms a URL. 2179 | * @param url A URL. 2180 | */ 2181 | transformUrl(url: string): string; 2182 | /** 2183 | * Creates a hash key. 2184 | * @param string A string. 2185 | * @param scope The scope. 2186 | */ 2187 | createHashKey(string: string, scope?: string): string; 2188 | /** 2189 | * Clears the device ID (if it was created). 2190 | */ 2191 | clearDeviceId(): void; 2192 | /** 2193 | * Returns (or creates) the device ID. 2194 | * @param data The application info data. 2195 | */ 2196 | getDeviceId(data?: MSXAttachedInfo): string; 2197 | /** 2198 | * Requests the device ID. 2199 | * @param callback The callback that contains the result data with the device ID. 2200 | */ 2201 | requestDeviceId(callback: (data: TVXDeviceId) => void): void; 2202 | /** 2203 | * Indicates if content observers exist. 2204 | */ 2205 | hasContentObservers(): boolean; 2206 | /** 2207 | * Adds a content observer. 2208 | * @param name The handler name. 2209 | * @param handler The handler function. 2210 | */ 2211 | addContentObserver(name: string, handler: (state: TVXChangedContentState) => void): void; 2212 | /** 2213 | * Removes a content observer. 2214 | * @param name The handler name. 2215 | */ 2216 | removeContentObserver(name: string): void; 2217 | /** 2218 | * Removes all content observers. 2219 | */ 2220 | clearContentObservers(): void; 2221 | /** Initializes the interaction plugin. */ 2222 | init(): void; 2223 | /** Indicates if the interaction plugin is initialized. */ 2224 | isInitialized(): boolean; 2225 | /** Indicates if the interaction plugin is ready. */ 2226 | isReady(): boolean; 2227 | /** 2228 | * Starts a loading process (shows a busy indicator after the loading delay). 2229 | * @param restart Indicates if a running loading delay should be restarted (default: true). 2230 | */ 2231 | startLoading(restart?: boolean): void; 2232 | /** Stops a loading process. */ 2233 | stopLoading(): void; 2234 | /** 2235 | * Executes a handler function and handles all errors that occur. 2236 | * @param handler A handler function that should return a data object if a callback function is also set. 2237 | * @param callback A callback function that is called with null when an error has occurred. 2238 | */ 2239 | executeHandler(handler: (() => void) | (() => AnyObject), callback?: (data?: AnyObject) => void): void; 2240 | } 2241 | 2242 | /** This interface defines the structure of an interaction handler. */ 2243 | declare interface TVXInteractionPluginHandler { 2244 | /** Initializes the handler. */ 2245 | init?(): void; 2246 | /** This function is called when the handler is ready. */ 2247 | ready?(): void; 2248 | /** 2249 | * Handles an event. The data.event property can contain following values: 2250 | * - "app:suspend" 2251 | * - "app:resume" 2252 | * - "app:sleep" 2253 | * - "app:wake" 2254 | * - "app:resize" 2255 | * - "app:connect" 2256 | * - "app:disconnect" 2257 | * - "app:time" (data.offset and data.zoneOffset properties contain the new time and zone offset) 2258 | * - "app:result" (data.id property contains the request ID, data.code property contains the result code, and data.extra property contains the extra data) 2259 | * - "video:load" (data.info property contains the loaded video info and data.data property contains the active video data before this event occurred) 2260 | * - "video:play" (data.data property contains the active video data before this event occurred) 2261 | * - "video:pause" (data.data property contains the active video data before this event occurred) 2262 | * - "video:stop" (data.data property contains the active video data before this event occurred) 2263 | * - "video:seek" (data.position property contains the seeked position in seconds and data.data property contains the active video data before this event occurred) 2264 | * - "video:restart" (data.data property contains the active video data before this event occurred) 2265 | * - "video:speed" (data.speed property contains the new speed value and data.data property contains the active video data before this event occurred) 2266 | * - "video:volume" (data.volume and data.muted properties contain the new volume level and muted state) 2267 | * - "slider:load" (data.info property contains the loaded slider info) 2268 | * - "slider:play" 2269 | * - "slider:pause" 2270 | * - "slider:stop" 2271 | * - "slider:position" (data.index, data.number, and data.listIndex properties contain the new item index, number, and list index) 2272 | * - "settings:animate" (data.value property contains the new settings value) 2273 | * - "settings:transform" (data.value property contains the new settings value) 2274 | * - "settings:input" (data.value property contains the new settings value) 2275 | * - "settings:remote" (data.value property contains the new settings value) 2276 | * - "settings:layout" (data.value property contains the new settings value) 2277 | * - "settings:scale" (data.value property contains the new settings value) 2278 | * - "settings:zoom" (data.value property contains the new settings value) 2279 | * - "settings:validate_links" (data.value property contains the new settings value) 2280 | * - "settings:random_playback" (data.value property contains the new settings value) 2281 | * - "settings:slideshow_interval" (data.value property contains the new settings value) 2282 | * - "settings:hover_effect" (data.value property contains the new settings value) 2283 | * - "settings:immersive_mode" (data.value property contains the new settings value) 2284 | * - "settings:rounded_style" (data.value property contains the new settings value) 2285 | * - "settings:menu_button" (data.action and data.keyCode properties contain the new button action and key code) 2286 | * - "custom:{EVENT_ID}" (data.data property optionally contains the event-related data) 2287 | * @param data The event data. 2288 | */ 2289 | handleEvent?(data: AnyObject): void; 2290 | /** 2291 | * Handles any data. User-defined data is optionally available in the data.data property. 2292 | * @param data Any data. 2293 | */ 2294 | handleData?(data: AnyObject): void; 2295 | /** 2296 | * Handles a request. User-defined data is optionally available in the data.data property. 2297 | * @param dataId The data ID. 2298 | * @param data Any data. 2299 | * @param callback The callback that has to be called with the result data. 2300 | */ 2301 | handleRequest?(dataId: string, data: AnyObject, callback: (respData?: AnyObject) => void): void; 2302 | /** 2303 | * This function is called when an error has occurred. The error is already logged and shown, therefore, the error should only be evaluated here for debug purposes. 2304 | * @param message The error message. 2305 | * @param error The error object. 2306 | */ 2307 | onError?(message: string, error: AnyObject): void; 2308 | } 2309 | 2310 | export const Settings: TVXSettings; 2311 | export const Styles: TVXStyles; 2312 | export const Tools: TVXTools; 2313 | export const DateTools: TVXDateTools; 2314 | export const DateFormatter: TVXDateFormatter; 2315 | export const PropertyTools: TVXPropertyTools; 2316 | export const VideoState: TVXVideoState; 2317 | export const Action: TVXAction; 2318 | export class Cookies extends TVXCookies { } 2319 | export class Storage extends TVXStorage { } 2320 | export class UrlParams extends TVXUrlParams { } 2321 | export class Options extends TVXOptions { } 2322 | export class Observers extends TVXObservers { } 2323 | export class EventObservers extends TVXEventObservers { } 2324 | export class Queue extends TVXQueue { } 2325 | export class Worker extends TVXWorker { } 2326 | export class Delay extends TVXDelay { } 2327 | export class Click extends TVXClick { } 2328 | export class Ajax extends TVXAjax { } 2329 | export const LogLevel: TVXLogLevel; 2330 | export class Logger extends TVXLogger { } 2331 | export class Dictionary extends TVXDictionary { } 2332 | export class Clock extends TVXClock { } 2333 | export class DataLoader extends TVXDataLoader { } 2334 | export const Services: TVXServices; 2335 | export class DataService extends TVXDataService { } 2336 | export class BlobService extends TVXBlobService { } 2337 | export class RequestService extends TVXRequestService { } 2338 | export class BusyService extends TVXBusyService { } 2339 | export const PluginTools: TVXPluginTools; 2340 | export const VideoPlugin: TVXVideoPlugin; 2341 | export const InteractionPlugin: TVXInteractionPlugin; --------------------------------------------------------------------------------