Skip to content

Instantly share code, notes, and snippets.

@hamaco
Created November 18, 2012 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hamaco/4105959 to your computer and use it in GitHub Desktop.
Save hamaco/4105959 to your computer and use it in GitHub Desktop.
SpeakerDeck vimperator plugin.
(function() {
var SpeakerDeck = function() {
var doc = content.document;
if (doc.location.host !== 'speakerdeck.com') {
return liberator.echoerr('Current page is not speakerdeck.');
}
var iframe = doc.wrappedJSObject.getElementsByClassName('speakerdeck-iframe')[0];
var player = iframe.contentWindow.player;
return {
next: function() {
player.nextSlide();
},
prev: function() {
player.previousSlide();
}
}
};
commands.addUserCommand(
['speakerdeck'],
'Speaker Deck controller',
function() {},
{
subCommands: [
new Command(['n[ext]'], 'Go next page', function() SpeakerDeck().next()),
new Command(['p[rev]'], 'Go previous page', function() SpeakerDeck().prev()),
]
},
true
);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment