{"size": 1279, "ext": "js", "max_stars_repo_path": "packages/code/cmd/browser/cmd_youtube.js", "max_stars_repo_name": "zakaihamilton/screens", "max_stars_repo_stars_event_min_datetime": "2017-05-29T08:11:52.000Z", "max_stars_repo_stars_event_max_datetime": "2018-05-24T15:11:25.000Z", "max_issues_repo_path": "packages/code/cmd/browser/cmd_youtube.js", "max_issues_repo_name": "zakaihamilton/screens", "max_issues_repo_issues_event_min_datetime": "2019-03-27T19:08:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-13T19:56:41.000Z", "max_forks_repo_path": "packages/code/cmd/browser/cmd_youtube.js", "max_forks_repo_name": "zakaihamilton/screens", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": 14, "max_forks_count": null, "avg_line_length": 34.5675675676, "max_line_length": 109, "alphanum_fraction": 0.483971853}
/*
    @author Zakai Hamilton
    @component CmdYoutube
*/

screens.cmd.youtube = function CmdYoutube(me, { core, ui }) {
    me.cmd = function (terminal, args) {
        if (args.length < 2) {
            core.property.set(terminal, "print", "youtube: title video_id");
            core.property.set(terminal, "print", "example: youtube \"The Computer Chronicles\" YewNEAIkbG4");
            core.cmd.exit(terminal);
            return;
        }
        var youtube_id = args[2];
        youtube_id = youtube_id.replace("https://youtu.be/", "");
        me.log("youtube_id:" + youtube_id);
        ui.element.create({
            "title": args[1],
            "ui.style.left": "550px",
            "ui.style.top": "200px",
            "ui.style.width": "300px",
            "ui.style.height": "300px",
            "icon": "youtube",
            "ui.basic.elements": [
                {
                    "ui.element.component": "widget.embed",
                    "ui.basic.src": "https://www.youtube.com/embed/" + youtube_id + "?ecver=1",
                    "ui.attribute.allowFullScreen": "",
                    "ui.style.width": "100%",
                    "ui.style.height": "100%"
                }
            ]
        });
        core.cmd.exit(terminal);
    };
};
