diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 080ed0a5f..81a14cb1e 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -1485,29 +1485,30 @@ jQuery(function () { }); function qsm_check_shortcode(message = null) { - // Check if message contains a video shortcode - let videoRegex = /\[video(?:(?:\ssrc="([^"]+)")|(?:\swidth="(\d+)")|(?:\sheight="(\d+)")){0,3}\s*\]/g; + let videoRegex = /\[video(?:(?:\ssrc="([^"]+)")|(?:\smp4="([^"]+)")|(?:\sm4v="([^"]+)")|(?:\swebm="([^"]+)")|(?:\sogv="([^"]+)")|(?:\swmv="([^"]+)")|(?:\sflv="([^"]+)")|(?:\swidth="(\d+)")|(?:\sheight="(\d+)")){0,3}\s*\](.*?)\[\/video\]/g; let videoMatch = message.match(videoRegex); - + if (videoMatch) { - let videoHTML = message.replace(videoRegex, function(match, src, width, height) { - return ''; + let videoHTML = message.replace(videoRegex, function(match, src, mp4, m4v, webm, ogv, wmv, flv, width, height, content) { + const videoSource = src || mp4 || m4v || webm || ogv || wmv || flv || ''; + const videoTag = ''; + return '
' + videoTag + '
'; }); - return '
' + videoHTML + '
'; + return videoHTML; } // Check if message contains an image shortcode let imageRegex = /\[img(?:(?:\ssrc="([^"]+)")|(?:\salt="([^"]+)")|(?:\swidth="(\d+)")|(?:\sheight="(\d+)")){0,4}\s*\]/g; let imageMatch = message.match(imageRegex); - + if (imageMatch) { let imageHTML = message.replace(imageRegex, function(match, src, alt, width, height) { return '' + (alt || '') + ''; }); return '
' + imageHTML + '
'; } - + return message; }