bookmarklets.html 1.6 KB

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