[pLog-svn] r7279 - plog/branches/lifetype-1.2/js/tinymce/plugins/insertyoutube

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Mon Mar 25 14:13:15 EDT 2024


Author: jondaley
Date: 2024-03-25 14:13:15 -0400 (Mon, 25 Mar 2024)
New Revision: 7279

Modified:
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertyoutube/functions.js
Log:
support youtube 'shorts' as well

Modified: plog/branches/lifetype-1.2/js/tinymce/plugins/insertyoutube/functions.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/insertyoutube/functions.js	2024-02-19 20:38:35 UTC (rev 7278)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertyoutube/functions.js	2024-03-25 18:13:15 UTC (rev 7279)
@@ -22,6 +22,15 @@
             url = "https://www.youtube.com/embed/" + videoId;
         }
     }
+    else if( url.match( /https?:\/\/(.{2,3}\.)?youtube.com\/shorts\//i )) {
+        // and if it's a link to a normal youtube page, build the right link to the video player
+        regexp = /https?:\/\/(.{2,3}\.)?youtube.com\/shorts\/([\-0-9a-zA-z_]*)/i;
+        result = regexp.exec(url);
+        if(result){
+            videoId = result[2];
+            url = "https://www.youtube.com/embed/" + videoId;
+        }
+    }
     else {
         regexp = /.*?v=([\-0-9a-zA-z_]*).*/i;
         result = regexp.exec(url);



More information about the pLog-svn mailing list