summaryrefslogtreecommitdiff
path: root/tools/bookmarklets.html (plain)
blob: 6034b57575ca8d227190f393f0b39f641b74937f
1<!DOCTYPE html>
2<html lang="en">
3<head>
4<!--
5 This file is part of FFmpeg.
6
7 All scripts contained in this file can be considered public domain.
8 -->
9<title>FFmpeg bookmarklets</title>
10<meta charset="UTF-8">
11<script type="text/javascript">
12function convert(js) {
13 js = js.replace(/\/\*.*?\*\//g, ""); /* comments */
14 js = js.replace(/\s+/g, " ");
15 js = js.replace(/\s+\z/, "");
16 js = "(function(){" + js + "})();void 0";
17 return "javascript:" + escape(js);
18}
19function init() {
20 var pre = document.getElementsByTagName("pre");
21 for (var i = 0; pre.length > i; i++) {
22 document.getElementById(pre[i].id + "-link").href = convert(pre[i].textContent);
23 }
24}
25</script>
26<style type="text/css">
27pre { border: solid black 1px; padding: 0.2ex; font-size: 80% }
28</style>
29</head>
30<body onload="init()">
31
32<h1>Introduction</h1>
33<p>The scripts in this page are
34<a href="http://en.wikipedia.org/wiki/Bookmarklet">bookmarklets</a>: store
35their link version in a bookmark, and later activate the bookmark on a page
36to run the script.</p>
37
38<h1>TED Talks captions</h1>
39<p><a id="ted_talks_captions-link" href="#">Get links to the captions</a></p>
40
41<pre id="ted_talks_captions">
42d = window.open("", "sub", "width=256,height=512,resizable=yes,scrollbars=yes").document;
43l = document.getElementById("languageCode").getElementsByTagName("option");
44for (i = 1; i &lt; l.length ; i++) {
45 d.body.appendChild(p = d.createElement("p"));
46 p.appendChild(a = d.createElement("a"));
47 a.appendChild(d.createTextNode(l[i].textContent));
48 a.href="http://www.ted.com/talks/subtitles/id/" + talkID+"/lang/" + l[i].value;
49}
50</pre>
51
52</body>
53</html>
54