/* podpress.js | podPress - JS scripts for the frontend and the Admin Site */ /** * podPress_https_check - checks whether the request is an https request and adjusts the protocol if necessary (will change only URLs with the siteurl at the begining) * @package podPress * @since 8.8.10.14 * @param String url - an full URL with protocol abbrevation * @return String url - the URL with the protocol of the current request */ function podPress_https_check(url) { var siteurl_without_protocol = podPressBlogURL.match(/^https?:\/\//i, url); var url_without_protocol = podPressBlogURL.replace(siteurl_without_protocol, ''); var siteurl_regexp = new RegExp( url_without_protocol, 'i' ); if ( -1 != url.search(siteurl_regexp) ) { return url.replace(/^http:/i, window.location.protocol); } else { return url; } } function podPressShowVideoPreview (strPlayerDiv, strMediaFile, numWidth, numHeight, strPreviewImg) { var refPlayerDiv = document.getElementById('podPressPlayerSpace_'+strPlayerDiv); if(refPlayerDiv == undefined) { return false; } refPlayerDiv.innerHTML = podPressGenerateVideoPreview (strPlayerDiv, strMediaFile, numWidth, numHeight, strPreviewImg); } function podPressGenerateVideoPreview (strPlayerDiv, strMediaFile, numWidth, numHeight, strPreviewImg, bPreviewOnly) { if (typeof numWidth == 'undefined') { numWidth = 320; } if (typeof numHeight == 'undefined') { numHeight = 240; } if (typeof strPreviewImg == 'undefined') { strPreviewImg = podPressDefaultPreviewImage; } if (typeof bPreviewOnly == 'undefined') { bPreviewOnly = false; } if (false == bPreviewOnly) { var strOnclick= ' onclick="javascript:podPressShowHidePlayer('+strPlayerDiv+', \''+strMediaFile+'\', '+numWidth+', '+numHeight+', \'force\'); return false;"'; } else { var strOnclick= ''; // for a preview of this preview player at the player settings page on the admin pages } var strResult = ''; strResult += '
'; strResult += '
'; strResult += ' '; strResult += ' '; strResult += ' '; strResult += '
'; if (25 < Number(numHeight)) { // if the height value is smaller than 25 px then create a player preview without an cover or chapter image strResult += '
'; strResult += ' '; strResult += ' previewImg'; strResult += ' '; strResult += '
'; } strResult += '
'; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += '
'; strResult += '
'; return String(strResult); } function podPressGeneratePlayer(strPlayerDiv, strMediaFile, numWidth, numHeight, strAutoStart, strPreviewImg) { if (typeof numWidth == 'undefined' || numWidth == 0) { var numWidth = 320; } if (typeof numHeight == 'undefined') { var numHeight = 240; } if (typeof strAutoStart == 'undefined') { var strAutoStart = 'false'; } if(strAutoStart == 'nopreview') { return ''; } var lenOfMedia = strMediaFile.length; if(strMediaFile.substring(lenOfMedia-8, lenOfMedia) == '.youtube') { var strExt = 'youtube'; strMediaFile = strMediaFile.substring(0, lenOfMedia-8) } else if(strMediaFile.substring(lenOfMedia-8, lenOfMedia) == '.torrent') { var strExt = 'torrent'; } else if(strMediaFile.substring(lenOfMedia-3, lenOfMedia-2) == '.') { var strExt = strMediaFile.substring(lenOfMedia-2, lenOfMedia); } else if(strMediaFile.substring(lenOfMedia-4, lenOfMedia-3) == '.') { var strExt = strMediaFile.substring(lenOfMedia-3, lenOfMedia); } else { var strExt = ''; } strExt = strExt.toLowerCase(); if ( '' == strExt ) { return ''; } if ( strExt != 'mp3' && strExt != 'youtube' && strExt != '' && strAutoStart == 'false' ) { return podPressGenerateVideoPreview(strPlayerDiv, strMediaFile, numWidth, numHeight, strPreviewImg); } var strResult = ''; switch (strExt) { case 'm4v': case 'm4a': case 'avi': case 'mpeg': case 'mpg': case 'mp4': case 'qt': case 'mov': switch (strExt) { case 'm4v': var strMimeType = 'video/x-m4v'; break; case 'm4a': var strMimeType = 'audio/x-m4a'; break; case 'avi': var strMimeType = 'video/avi'; break; case 'mpeg': case 'mpg': var strMimeType = 'video/mpeg'; break; case 'mp4': var strMimeType = 'audio/mpeg'; break; case 'qt': case 'mov': var strMimeType = 'video/quicktime'; break; } strAutoStart = false; numHeight = String(Number(numHeight)+ 18); // add up the height of the player controls strResult = ''; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += '
'; break; case 'wma': case 'wmv': case 'asf': numHeight = String(Number(numHeight)+ 44); // add up the height of the player controls strResult = ''; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += '
'; break; case 'swf': if(strAutoStart == 'true') { strAutoStart = ''; } else { strAutoStart = ' play="false"'; } strResult = ''; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += '
'; break; case 'flv': if(strAutoStart == 'true') { strAutoStart = ''; } else { strAutoStart = '&autoStart=false'; } strResult = ''; strResult += ''; strResult += ''; strResult += ''; strResult += ''; strResult += ''; strResult += ''; break; case '.rm': strResult = ''; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ' '; strResult += ''; break; case 'ogv': case 'ogg': var strAdditionalParam = ''; if ( 'ogg' == strExt ) { var strVideo ='false'; var strAudio ='true'; var strTag = 'audio'; if ( 0 == Number(numHeight) ) { numHeight = '24'; } } else { var strVideo ='true'; var strAudio ='true'; var strTag = 'video'; strAdditionalParam = ''; if ( 0 == Number(numHeight) ) { numHeight = '240'; } } if ( strAutoStart == 'true' ) { var strAutoPlay = ' autoplay="autoplay"'; } else { var strAutoPlay = ''; } // Gecko since 1.9.1 and Presto since 2.5 support OGG Audio and Video in the HTML 5