- commit
- 1d9477a4af9150f4352d2135386f0b6df5ac13c3
- parent
- a59dac605a97b533beea5a8acd3f0cc7c0e51233
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2015-07-19 18:28
implement youtube thumbnail in javascript
Diffstat
| M | plutopluto/static/plutopluto.css | 6 | ++++++ |
| M | plutopluto/static/plutopluto.js | 9 | +++++++++ |
2 files changed, 15 insertions, 0 deletions
diff --git a/plutopluto/static/plutopluto.css b/plutopluto/static/plutopluto.css
@@ -64,3 +64,9 @@ body {
64 64 color: white;
65 65 background: black;
66 66 }
-1 67
-1 68 iframe.youtube,
-1 69 img[alt^="https://www.youtube"] {
-1 70 width: 480px;
-1 71 height: 360px;
-1 72 }
diff --git a/plutopluto/static/plutopluto.js b/plutopluto/static/plutopluto.js
@@ -107,4 +107,13 @@ $(document).ready(function() {
107 107 // load initial content
108 108 loadNextPage();
109 109 }});
-1 110
-1 111 // youtube video embedding
-1 112 $(document).on('click', function(event) {
-1 113 if (event.target.alt.match(/^https:\/\/www\.youtube/)) {
-1 114 var iframe = $('<iframe class="youtube">');
-1 115 iframe.target.src = event.target.alt;
-1 116 $(event.target).replace(iframe);
-1 117 }
-1 118 });
110 119 });