Blame
|
1 | # Youtube Tag |
||||||
| 2 | ||||||||
|
3 | Trying to see if I can get youtube tags to get replaced with iframes, like this: `<youtube>dQw4w9WgXcQ</youtube>` |
||||||
|
4 | |||||||
| 5 | <youtube>dQw4w9WgXcQ</youtube> |
|||||||
|
6 | |||||||
| 7 | Seems to work perfectly. I'm using the code snippet below: |
|||||||
| 8 | ||||||||
| 9 | ```js |
|||||||
| 10 | document.addEventListener("DOMContentLoaded", function() { |
|||||||
| 11 | const youtubeTags = document.querySelectorAll("youtube"); |
|||||||
| 12 | ||||||||
| 13 | youtubeTags.forEach(tag => { |
|||||||
| 14 | const videoId = tag.textContent.trim(); |
|||||||
| 15 | if (videoId) { |
|||||||
| 16 | const iframe = document.createElement("iframe"); |
|||||||
| 17 | iframe.width = "560"; |
|||||||
| 18 | iframe.height = "315"; |
|||||||
| 19 | iframe.src = `https://www.youtube.com/embed/${videoId}`; |
|||||||
| 20 | iframe.frameBorder = "0"; |
|||||||
| 21 | iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"; |
|||||||
| 22 | iframe.allowFullscreen = true; |
|||||||
| 23 | ||||||||
| 24 | tag.parentNode.replaceChild(iframe, tag); |
|||||||
| 25 | } |
|||||||
| 26 | }); |
|||||||
| 27 | }); |
|||||||
| 28 | ``` |
|||||||
|
29 | |||||||
| 30 | If you want to add a youtube video, just `<youtube>VIDEO_ID</youtube>` will work! |
|||||||
|
31 | |||||||
|
32 | # Tetris Tag |
||||||
| 33 | ||||||||
|
34 | You can easily create tetris boards using `<tetris>` tags! |
||||||
|
35 | |||||||
|
36 | <tetris> |
||||||
| 37 | ttt |
|||||||
| 38 | .t. |
|||||||
| 39 | </tetris> |
|||||||
| 40 | ||||||||
|
41 | ```html |
||||||
| 42 | <tetris> |
|||||||
|
43 | ttt |
||||||
|
44 | .t. |
||||||
| 45 | </tetris> |
|||||||
| 46 | ``` |
|||||||
| 47 | ||||||||
|
48 | Here's a more complex example. |
||||||
| 49 | ||||||||
|
50 | <tetris> |
||||||
| 51 | .......... |
|||||||
| 52 | ..ll....ss |
|||||||
| 53 | ...lzz.ssi |
|||||||
| 54 | jj.lgzzooi |
|||||||
| 55 | j..ggggooi |
|||||||
| 56 | j..ggggggi |
|||||||
| 57 | gg.ggggggg |
|||||||
| 58 | gg.ggggggg |
|||||||
| 59 | </tetris> |
|||||||
| 60 | ||||||||
|
61 | ```html |
||||||
| 62 | <tetris> |
|||||||
|
63 | .......... |
||||||
| 64 | ..ll....ss |
|||||||
| 65 | ...lzz.ssi |
|||||||
| 66 | jj.lgzzooi |
|||||||
| 67 | j..ggggooi |
|||||||
| 68 | j..ggggggi |
|||||||
| 69 | gg.ggggggg |
|||||||
|
70 | gg.ggggggg |
||||||
| 71 | </tetris> |
|||||||
| 72 | ``` |
|||||||
| 73 | ||||||||
|
74 | A big yellow. |
||||||
| 75 | ||||||||
| 76 | <tetris> |
|||||||
| 77 | ...lll... |
|||||||
| 78 | ..l...l.. |
|||||||
| 79 | ..l...l.. |
|||||||
| 80 | ..l...l.. |
|||||||
| 81 | ..l...l.. |
|||||||
| 82 | ..l...l.. |
|||||||
| 83 | ..l...l.. |
|||||||
| 84 | ..l...l.. |
|||||||
| 85 | ..l...l.. |
|||||||
|
86 | .oo...oo. |
||||||
| 87 | o..olo..o |
|||||||
| 88 | o..o.o..o |
|||||||
| 89 | .oo...oo. |
|||||||
|
90 | </tetris> |
||||||
| 91 | ||||||||
|
92 | Let's try tetris pieces in a table? |
||||||
| 93 | ||||||||
| 94 | | Image | Name | |
|||||||
| 95 | |:-----------------------------------------------------:|:----:| |
|||||||
| 96 | |  | T | |
|||||||
| 97 | |  | L | |
|||||||
| 98 | ||||||||
| 99 | ||||||||
| 100 | ||||||||
|
101 | # Furigana?? |
||||||
| 102 | ||||||||
| 103 | <h3><ruby>明日<rp>(</rp><rt>あした</rt><rp>)</rp></ruby></h3> |
|||||||
