Mercurial Hosting > freedit
comparison src/test/tiny.html @ 27:6871eec2cf4c
add rumble
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Jul 2022 00:01:46 -0600 |
parents | 0837820b97fb |
children | d9d7aa2a79db |
comparison
equal
deleted
inserted
replaced
26:0837820b97fb | 27:6871eec2cf4c |
---|---|
7 </style> | 7 </style> |
8 <script> | 8 <script> |
9 var youtubePtn1 = new RegExp('https://youtu.be/([a-zA-Z0-9_-]+)(?:\\?t=([0-9]+))?'); | 9 var youtubePtn1 = new RegExp('https://youtu.be/([a-zA-Z0-9_-]+)(?:\\?t=([0-9]+))?'); |
10 var youtubePtn2 = new RegExp('https://www.youtube.com/watch\\?v=([a-zA-Z0-9_-]+)(?:\\?t=([0-9]+)s)?'); | 10 var youtubePtn2 = new RegExp('https://www.youtube.com/watch\\?v=([a-zA-Z0-9_-]+)(?:\\?t=([0-9]+)s)?'); |
11 var bitchutePtn = new RegExp('https://www.bitchute.com/video/([a-zA-Z0-9]+)/'); | 11 var bitchutePtn = new RegExp('https://www.bitchute.com/video/([a-zA-Z0-9]+)/'); |
12 var rumblePtn = new RegExp('https://rumble.com/embed/[a-z0-9]+/\\?pub=[a-z0-9]+'); | |
12 var url2; | 13 var url2; |
13 | 14 |
14 function media_url_resolver(data,resolve,reject) { | 15 function media_url_resolver(data,resolve,reject) { |
15 let html; | 16 let html; |
16 let url = data.url; | 17 let url = data.url; |
21 if( result[2] ) | 22 if( result[2] ) |
22 html += '?start=' + result[2] | 23 html += '?start=' + result[2] |
23 html += '" frameborder="0" allowfullscreen></iframe>'; | 24 html += '" frameborder="0" allowfullscreen></iframe>'; |
24 } else if( result = url.match(bitchutePtn) ) { | 25 } else if( result = url.match(bitchutePtn) ) { |
25 html = '<iframe data-video="'+url+'" width="560" height="315" scrolling="no" frameborder="0" style="border: none;" src="https://www.bitchute.com/embed/' + result[1] + '/"></iframe>'; | 26 html = '<iframe data-video="'+url+'" width="560" height="315" scrolling="no" frameborder="0" style="border: none;" src="https://www.bitchute.com/embed/' + result[1] + '/"></iframe>'; |
27 } else if( url.match(rumblePtn) ) { | |
28 html = '<iframe data-video="'+url+'" width="560" height="315" frameborder="0" allowfullscreen src="' + url + '"></iframe>'; | |
26 } else { | 29 } else { |
27 html = '<a data-video="'+url+'" href="'+url+'">'+url+'</a>'; | 30 html = '<a data-video="'+url+'" href="'+url+'">'+url+'</a>'; |
28 } | 31 } |
29 resolve({ html: html }); | 32 resolve({ html: html }); |
30 } | 33 } |
35 editor.ui.registry.addToggleButton('styleCode', { | 38 editor.ui.registry.addToggleButton('styleCode', { |
36 icon: 'sourcecode', | 39 icon: 'sourcecode', |
37 tooltip: 'Code', | 40 tooltip: 'Code', |
38 onAction: function(api) { | 41 onAction: function(api) { |
39 editor.execCommand('mceToggleFormat', false, 'code') | 42 editor.execCommand('mceToggleFormat', false, 'code') |
40 //api.setActive( !api.isActive() ); | |
41 }, | 43 }, |
42 onSetup: function(api) { | 44 onSetup: function(api) { |
43 api.setActive(editor.formatter.match('code')); | 45 api.setActive(editor.formatter.match('code')); |
44 let changed = editor.formatter.formatChanged('code', api.setActive); | 46 let changed = editor.formatter.formatChanged('code', api.setActive); |
45 return function() { changed.unbind(); }; | 47 return function() { changed.unbind(); }; |
56 ]) | 58 ]) |
57 } | 59 } |
58 }); | 60 }); |
59 | 61 |
60 editor.on( 'init', function(e) {editor.focus()} ); | 62 editor.on( 'init', function(e) {editor.focus()} ); |
61 //editor.focus(); | |
62 } | 63 } |
63 | 64 |
64 tinymce.init({ | 65 tinymce.init({ |
65 selector: 'textarea', | 66 selector: 'textarea', |
66 setup: tinymceSetup, | 67 setup: tinymceSetup, |
67 menubar: false, | 68 //menubar: false, |
68 statusbar: false, | 69 statusbar: false, |
69 toolbar: 'link image media | styleCode bold italic underline strikethrough superscript styleText | blockquote numlist bullist', | 70 toolbar: 'link image media | styleCode bold italic underline strikethrough superscript styleText | blockquote numlist bullist', |
70 //block_formats: 'Paragraph=div; Header 1=h1; Header 2=h2; Header 3=h3', | |
71 plugins: ['link', 'image', 'media', 'lists', 'code', 'autoresize'], | 71 plugins: ['link', 'image', 'media', 'lists', 'code', 'autoresize'], |
72 autoresize_bottom_margin: 0, | 72 autoresize_bottom_margin: 0, |
73 link_target_list: false, | 73 link_target_list: false, |
74 link_title: false, | 74 link_title: false, |
75 image_description: false, | 75 image_description: false, |