Created
December 6, 2015 09:53
-
-
Save rmuslimov/890b16cc9f55e4f973bb to your computer and use it in GitHub Desktop.
Manipulate vk audio from emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq | |
chrome-vk-player-base | |
"tell application \"Google Chrome\" | |
repeat with current_tab in (tabs of front window) | |
set has_vk_player_mark to execute current_tab javascript \"!!document.getElementById('gp')\" | |
if has_vk_player_mark then | |
if URL of current_tab contains \"vk.com\" and has_vk_player_mark then | |
%s | |
end if | |
end if | |
end repeat | |
end tell") | |
(defun chrome-vk-next () | |
(interactive) | |
(do-applescript | |
(format chrome-vk-player-base "set URL of current_tab to \"javascript:audioPlayer.nextTrack();\""))) | |
(defun chrome-vk-prev () | |
(interactive) | |
(do-applescript | |
(format chrome-vk-player-base "set URL of current_tab to \"javascript:audioPlayer.prevTrack();\""))) | |
(global-set-key (kbd "C-c i n") 'chrome-vk-next) | |
(global-set-key (kbd "C-c i p") 'chrome-vk-prev) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment