Skip to content

Instantly share code, notes, and snippets.

@rmuslimov
Created December 6, 2015 09:53
Show Gist options
  • Save rmuslimov/890b16cc9f55e4f973bb to your computer and use it in GitHub Desktop.
Save rmuslimov/890b16cc9f55e4f973bb to your computer and use it in GitHub Desktop.
Manipulate vk audio from emacs
(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