Skip to content

Instantly share code, notes, and snippets.

@ba3r
Created December 9, 2010 19:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ba3r/735218 to your computer and use it in GitHub Desktop.
Save ba3r/735218 to your computer and use it in GitHub Desktop.
subtitle any video using universalsubtitles.org
/* Universal Subtitles v0.72a */
CmdUtils.CreateCommand({
names: ["subtitle"],
description: "Add subtitles to any web video using open standards.",
help: "Open a video or select an URL and type subtitle",
author: {
name: "Michael Baer",
homepage: "http://twitter.com/shaytards",
},
license: "GPL",
homepage: "http://universalsubtitles.org",
icon: "http://a2.twimg.com/profile_images/788922918/Universal-Subtitles_mini.png",
execute: function() {
var win = CmdUtils.getWindow();
var sel = win.getSelection().encodeURI();
if (sel.length < 3) {var videoURL = win.location.href;} else {var videoURL = sel;}
Utils.openUrlInBrowser("http://universalsubtitles.org/videos/create/" + videoURL)
title: win.document.title,
},
preview: function preview(pblock) {
var win = CmdUtils.getWindow();
var sel = win.getSelection().toString().slice(0, 30);
if (!sel) {var videoTitle = win.document.title;} else {var videoTitle = sel;}
pblock.innerHTML = "Subtitle this video " + videoTitle.bold() ;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment