Skip to content

Instantly share code, notes, and snippets.

@kunicmarko20
Last active May 22, 2018 07:47
Show Gist options
  • Save kunicmarko20/956b86e49d364648db4618339f964b7b to your computer and use it in GitHub Desktop.
Save kunicmarko20/956b86e49d364648db4618339f964b7b to your computer and use it in GitHub Desktop.
Helper Scripts for non mac Keyboard
# F3 - Mission Control
do shell script "/Applications/Mission\\ Control.app/Contents/MacOS/Mission\\ Control"
# Next Youtube video in Google Chrome
tell application "Google Chrome"
repeat with t in tabs of windows
tell t
if URL starts with "http://www.youtube.com/watch" or URL starts with "https://www.youtube.com/watch" then
execute javascript "
var player = document.getElementById('movie_player') || document.getElementsByTagName('embed')[0];
if (player) {
document.getElementsByClassName('ytp-next-button')[0].click()
}
"
exit repeat
end if
end tell
end repeat
end tell
# Previous Youtube video in Google Chrome
tell application "Google Chrome"
repeat with t in tabs of windows
tell t
if URL starts with "http://www.youtube.com/watch" or URL starts with "https://www.youtube.com/watch" then
execute javascript "window.history.back();"
exit repeat
end if
end tell
end repeat
end tell
# Play/Pause Youtube in Google Chrome
tell application "Google Chrome"
repeat with t in tabs of windows
tell t
if URL starts with "http://www.youtube.com/watch" or URL starts with "https://www.youtube.com/watch" then
execute javascript "
var player = document.getElementById('movie_player') || document.getElementsByTagName('embed')[0];
if (player) {
document.getElementsByClassName('ytp-play-button')[0].click();
}
"
exit repeat
end if
end tell
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment