2 * (C) Copyright 2012 Scott Jaderholm
4 * Use, modification, and distribution are subject to the terms specified in the
8 require("content-buffer.js");
10 define_keymap("youtube_player_keymap", $display_name = "youtube-player");
12 function youtube_player_click_command (selector, error_message) {
15 var elem = buf.document.querySelector(selector);
17 dom_node_click(elem, 1, 1);
19 I.minibuffer.message(error_message + ", ensure html5 is enabled for youtube by visiting http://youtube.com/html5");
23 interactive("youtube-player-play-or-pause",
24 "Click the Youtube html5 player play/pause button.",
25 youtube_player_click_command("button.html5-pause-button, button.html5-play-button",
26 "No play or pause button found"));
28 interactive("youtube-player-mute",
29 "Click the Youtube html5 player mute button.",
30 youtube_player_click_command("button.html5-volume-button",
31 "No mute button found"));
33 interactive("youtube-player-fullscreen",
34 "Click the Youtube html5 player fullscreen button.",
35 youtube_player_click_command("button.html5-fullscreen-button",
36 "No fullscreen button found"));
38 define_key(youtube_player_keymap, "C-c return", "youtube-player-play-or-pause");
39 define_key(youtube_player_keymap, "C-c C-m", "youtube-player-mute");
40 define_key(youtube_player_keymap, "C-c C-f", "youtube-player-fullscreen");
42 define_keymaps_page_mode("youtube-player-mode",
43 build_url_regexp($domain = "youtube", $allow_www = true),
44 { normal: youtube_player_keymap },
45 $display_name = "Youtube-Player");
47 page_mode_activate(youtube_player_mode);
49 provide("youtube-player");