Mercurial Hosting > freedit
changeset 27:6871eec2cf4c
add rumble
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Jul 2022 00:01:46 -0600 |
parents | 0837820b97fb |
children | d9d7aa2a79db |
files | src/lib/Bbcode.luan src/test/tiny.html |
diffstat | 2 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/Bbcode.luan Wed Jul 20 15:47:18 2022 -0600 +++ b/src/lib/Bbcode.luan Thu Jul 21 00:01:46 2022 -0600 @@ -104,6 +104,7 @@ local youtube_ptn1 = [[https://youtu.be/([a-zA-Z0-9_-]+)(?:\?t=([0-9]+))?]] local youtube_ptn2 = [[https://www.youtube.com/watch\?v=([a-zA-Z0-9_-]+)(?:&t=([0-9]+)s)?]] local bitchute_ptn = [[https://www.bitchute.com/video/([a-zA-Z0-9]+)/]] +local rumble_ptn = [[https://rumble.com/embed/[a-z0-9]+/\?pub=[a-z0-9]+]] function html.video(bbcode,options) local url = bbcode.contents @@ -124,6 +125,10 @@ %><iframe width="560" height="315" scrolling="no" frameborder="0" style="border: none;" src="https://www.bitchute.com/embed/<%=id%>/"></iframe><% return end + if matches(url,rumble_ptn) then + %><iframe width="560" height="315" frameborder="0" allowfullscreen src="<%=url%>"></iframe><% + return + end url = html_encode(url) %><a href="<%=url%>"><%=url%></a><% end
--- a/src/test/tiny.html Wed Jul 20 15:47:18 2022 -0600 +++ b/src/test/tiny.html Thu Jul 21 00:01:46 2022 -0600 @@ -9,6 +9,7 @@ var youtubePtn1 = new RegExp('https://youtu.be/([a-zA-Z0-9_-]+)(?:\\?t=([0-9]+))?'); var youtubePtn2 = new RegExp('https://www.youtube.com/watch\\?v=([a-zA-Z0-9_-]+)(?:\\?t=([0-9]+)s)?'); var bitchutePtn = new RegExp('https://www.bitchute.com/video/([a-zA-Z0-9]+)/'); + var rumblePtn = new RegExp('https://rumble.com/embed/[a-z0-9]+/\\?pub=[a-z0-9]+'); var url2; function media_url_resolver(data,resolve,reject) { @@ -23,6 +24,8 @@ html += '" frameborder="0" allowfullscreen></iframe>'; } else if( result = url.match(bitchutePtn) ) { 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>'; + } else if( url.match(rumblePtn) ) { + html = '<iframe data-video="'+url+'" width="560" height="315" frameborder="0" allowfullscreen src="' + url + '"></iframe>'; } else { html = '<a data-video="'+url+'" href="'+url+'">'+url+'</a>'; } @@ -37,7 +40,6 @@ tooltip: 'Code', onAction: function(api) { editor.execCommand('mceToggleFormat', false, 'code') - //api.setActive( !api.isActive() ); }, onSetup: function(api) { api.setActive(editor.formatter.match('code')); @@ -58,16 +60,14 @@ }); editor.on( 'init', function(e) {editor.focus()} ); - //editor.focus(); } tinymce.init({ selector: 'textarea', setup: tinymceSetup, - menubar: false, + //menubar: false, statusbar: false, toolbar: 'link image media | styleCode bold italic underline strikethrough superscript styleText | blockquote numlist bullist', - //block_formats: 'Paragraph=div; Header 1=h1; Header 2=h2; Header 3=h3', plugins: ['link', 'image', 'media', 'lists', 'code', 'autoresize'], autoresize_bottom_margin: 0, link_target_list: false,