/* 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 += '
';
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 and element.
if ( podPressHTML5 == true && (-1 != navigator.userAgent.search(/rv:([0-9]\.*[0-9]*\.*[0-9]*\.*[0-9]*)\) Gecko/gi) && true == podPress_is_v1_gtoreq_v2(RegExp.$1, '1.9.1')) || (-1 != navigator.userAgent.search(/Presto\/([0-9]\.*[0-9]*\.*[0-9]*\.*[0-9]*)/gi) && true == podPress_is_v1_gtoreq_v2(RegExp.$1, '2.5')) ) {
var maskedurl = decodeURI(strMediaFile);
var realurl = podPress_get_OrigURL(strPlayerDiv);
strResult = '<' + strTag + ' id="podpresshtml5_'+strPlayerDiv+'" controls="controls" preload="metadata"' + strAutoPlay + ' onplaying="podPress_html5_count(\'' + maskedurl + '\', this.id)">';
strResult += ' ';
var use_html5 = true;
} else {
strResult += '';
strResult += ' ';
if ( true == podPress_cortado_signed ) {
strResult += ' ';
} else {
strResult += ' ';
}
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += strAdditionalParam;
strResult += ' ';
strResult +=' ';
strResult +=' ';
strResult += '';
strResult += '';
strResult += '';
strResult += 'No Java Support.';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
var use_html5 = false;
}
if ( true == use_html5 ) {
strResult += '' + strTag + '> ';
}
break;
case 'youtube':
if(strAutoStart == 'true') {
strAutoStart = '1';
} else {
strAutoStart = '0';
}
// classid is for the Adobe Flash Player and is necessary in IE6 which inserts this object tag via innerHTML only with this classid
strResult = '';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
break;
case 'mp3':
// since 8.8.6 this is only for MP3 player of Podango (see player settings)
if(strAutoStart == 'true') {
var localCopyPlayerOptions = podPressMP3PlayerOptions+'autostart=yes&';
} else {
var localCopyPlayerOptions = podPressMP3PlayerOptions+'autostart=no&';
}
strResult = '';
if(podPressMP3PlayerWrapper) {
strResult += ' ';
strResult += '
';
}
strResult += '
';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
strResult += ' ';
if (podPressMP3PlayerWrapper) {
strResult += '
';
}
break;
}
return strResult;
}
function podPress_getfileext(strMediaFile) {
if (typeof strMediaFile == 'undefined') { return false; }
var pos = strMediaFile.lastIndexOf('\.');
pos = pos+1;
var strExt = strMediaFile.substring(pos);
strExt = strExt.toLowerCase();
return strExt;
}
function podPressShowHidePlayer(strPlayerDiv, strMediaFile, numWidth, numHeight, strAutoStart, strPreviewImg, strTitle, strArtist) {
var refPlayerDiv = document.getElementById('podPressPlayerSpace_'+strPlayerDiv);
var refPlayerDivLink = document.getElementById('podPressPlayerSpace_'+strPlayerDiv+'_PlayLink');
if(refPlayerDiv == undefined) {
return false;
}
if (strAutoStart == 'force') {
strAutoStart = 'true';
var bForceShow = true;
} else {
var bForceShow = false;
}
var strExt = podPress_getfileext(strMediaFile);
if(bForceShow == true) {
refPlayerDivLink.innerHTML=podPressText_HidePlayer;
refPlayerDivLink.parentNode.onclick = function(){ podPressShowHidePlayer(strPlayerDiv, strMediaFile, numWidth, numHeight, 'true', strPreviewImg, strTitle, strArtist); return false; };
if ( strExt == 'mp3' && podPressPlayerFile == '1pixelout_player.swf' && true == podPressMP3PlayerWrapper ) {
document.getElementById('podpress_lwc_' + strPlayerDiv).style.backgroundImage = 'url('+podPressBackendURL+'images/listen_wrapper.gif)';
document.getElementById('podpress_lwc_' + strPlayerDiv).style.display='block';
}
refPlayerDiv.parentNode.style.display='block';
refPlayerDiv.style.display='block';
} else {
if(refPlayerDivLink.innerHTML == podPressText_PlayNow) {
refPlayerDivLink.innerHTML=podPressText_HidePlayer;
if ( strExt == 'mp3' && podPressPlayerFile == '1pixelout_player.swf' && true == podPressMP3PlayerWrapper ) {
document.getElementById('podpress_lwc_' + strPlayerDiv).style.backgroundImage = 'url('+podPressBackendURL+'images/listen_wrapper.gif)';
document.getElementById('podpress_lwc_' + strPlayerDiv).style.display='block';
}
refPlayerDiv.parentNode.style.display='block';
refPlayerDiv.style.display='block';
} else {
refPlayerDivLink.innerHTML=podPressText_PlayNow;
if ( strExt == 'mp3' && podPressPlayerFile == '1pixelout_player.swf' && true == podPressMP3PlayerWrapper ) {
document.getElementById('podpress_lwc_' + strPlayerDiv).style.backgroundImage = '';
document.getElementById('podpress_lwc_' + strPlayerDiv).style.display='none';
}
refPlayerDiv.style.display='none';
refPlayerDiv.parentNode.style.display='none';
if(document.getElementById('winplayer') != undefined) {
if(document.getElementById('winplayer').controls) {
document.getElementById('winplayer').controls.stop();
}
} else {
refPlayerDiv.innerHTML='';
}
bForceShow = true;
refPlayerDivLink.parentNode.onclick = function(){ podPressShowHidePlayer(strPlayerDiv, strMediaFile, numWidth, numHeight, 'force', strPreviewImg, strTitle, strArtist); return false; };
return true;
}
}
if(strAutoStart == 'nopreview') {
refPlayerDivLink.innerHTML=podPressText_PlayNow;
if ( strExt == 'mp3' && podPressPlayerFile == '1pixelout_player.swf' && true == podPressMP3PlayerWrapper ) {
document.getElementById('podpress_lwc_' + strPlayerDiv).style.backgroundImage = '';
}
refPlayerDiv.style.display='none';
}
// WebKit supports since 525.x and Internet Explorer since 9.0 MP3 in the HTML 5 element.
if ( strExt == 'mp3' && podPressHTML5 == true && ( (-1 != navigator.userAgent.search(/Webkit\/([0-9]+\.[0-9]+)/gi) && true == podPress_is_v1_gtoreq_v2(RegExp.$1, '525')) || true == podPress_is_modern_ie() ) ) {
if ( strExt == 'mp3' && podPressPlayerFile == '1pixelout_player.swf' && true == podPressMP3PlayerWrapper ) {
var pobj = document.getElementById('podpress_lwc_' + strPlayerDiv);
pobj.innerHTML = '
';
pobj.removeAttribute('class');
pobj.style.backgroundImage = '';
}
if ( strExt == 'mp3' && podPressPlayerFile == '1pixelout_player.swf' && false == podPressMP3PlayerWrapper ) {
document.getElementById('podPressPlayerSpace_' + strPlayerDiv).parentNode.setAttribute('class', 'podpress_playerspace');
}
if ( podPressHTML5_showplayersdirectly == true || -1 != navigator.userAgent.search(/iPhone|iPod|iPad/gi) ) {
podPressenprintHTML5audio(strPlayerDiv, strMediaFile);
} else {
document.getElementById('podPressPlayerSpace_' + strPlayerDiv).innerHTML = ' ';
}
} else {
if ( strExt == 'mp3' && podPressPlayerFile == '1pixelout_player.swf' ) {
if (strAutoStart == 'true') {
var valAutostart = 'yes';
} else {
var valAutostart = 'no';
}
if ( podPressOverwriteTitleandArtist == true && typeof strTitle != 'undefined' && typeof strArtist != 'undefined' && strTitle != 'undefined' && strArtist != 'undefined' && strTitle != '' && strArtist !='' ) {
podpressAudioPlayer.embed("podPressPlayerSpace_" + strPlayerDiv, { soundFile: podPressencodeSource(strMediaFile), origSource: decodeURI(strMediaFile), encode: 'yes', width: 290, height: 24, autostart: valAutostart, titles: strTitle, artists: strArtist});
} else {
podpressAudioPlayer.embed("podPressPlayerSpace_" + strPlayerDiv, { soundFile: podPressencodeSource(strMediaFile), origSource: decodeURI(strMediaFile), encode: 'yes', width: 290, height: 24, autostart: valAutostart });
}
} else {
refPlayerDiv.innerHTML=podPressGeneratePlayer(strPlayerDiv, strMediaFile, numWidth, numHeight, strAutoStart, strPreviewImg);
}
}
}
/**podPressenprintHTML5audio - inserts the HTML5 audio element
* @param strPlayerDiv String - ID number of the target element
* @param strMediaFile String - URL of the media file
*/
function podPressenprintHTML5audio(strPlayerDiv, strMediaFile, playnow) {
if (typeof playnow != 'boolean') { var playnow = false; }
var maskedurl = decodeURI(strMediaFile);
var realurl = podPress_get_OrigURL(strPlayerDiv);
// add a background-color to the audio element in order to overwrite an effect which occurrs in Chrome/Chromium >= v10 caused by the ocasionally inherited value "background-color: transparent:"
if ( -1 != navigator.userAgent.search(/(Chrome|Chromium)\/([0-9]+\.[0-9]+)/gi) && true == podPress_is_v1_gtoreq_v2(RegExp.$2, '10') ) {
var chrome_css_helper = ' style="background-color:#262626"';
} else {
var chrome_css_helper = '';
}
if ( playnow == true ) {
document.getElementById('podPressPlayerSpace_' + strPlayerDiv).innerHTML = ' ';
} else {
document.getElementById('podPressPlayerSpace_' + strPlayerDiv).innerHTML = ' ';
}
}
/** podPressencodeSource - Encodes the given string. This function is the JS equivalent of the function with the same name of the WP Audio Player plugin (http://wpaudioplayer.com/standalone)
* @param str String - the string to encode
* @return String - the encoded string
*/
function podPressencodeSource(str) {
var str = unescape(str);
var str = encodeURIComponent(str);
var str = unescape(str);
var ntexto = '';
var codekey = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-';
for ( var i = 0; i < String(str).length; i++ ) {
var tmpstr = "0000" + Number(str.charCodeAt(i)).toString(2);
ntexto += tmpstr.substr(tmpstr.length-8, 8);
}
ntexto += "00000".substr( 0, 6-(ntexto).length % 6);
str = "";
for ( var i = 0; i < (ntexto).length-1; i += 6 ) {
str += codekey.substr( parseInt(ntexto.substr( i, 6), 2), 1 );
}
return str;
}
/** podPress_compare_v1_v2 - compares to version strings or numbers
* @param v1 String or Number
* @param v2 String or Number
* @return mixed - returns "lt" in case v1 is lower than v2, "gt" in case v1 is greater than v2, "eq" in case v1 is equal to v2 or false in case v1 and v2 are a string (which is not empty) or a number
*/
function podPress_compare_v1_v2(v1, v2) {
if ( ((typeof v1 == 'string' && false == podPress_is_emptystr(v1)) || typeof v1 == 'number') && ((typeof v2 == 'string' && false == podPress_is_emptystr(v1)) || typeof v2 == 'number') ) {
var v1_parts = String(v1).split('.');
var v2_parts = String(v2).split('.');
var l1 = v1_parts.length;
var l2 = v2_parts.length;
var minl = Math.min(l1, l2);
for (var i = 0; i < minl; i++ ) {
var l1int = parseInt(v1_parts[i]);
var l2int = parseInt(v2_parts[i]);
if ( l1int < l2int ) {
return 'lt';
} else if ( l1int > l2int ) {
return 'gt';
}
}
return 'eq';
} else {
return false;
}
}
/** podPress_is_v1_gtoreq_v2 - checks whether v1 is greater than or equal to v2 or not
* @param v1 string or number
* @param v2 string or number
* @return bool - if v1 <= v2 then it is true else it is false
*/
function podPress_is_v1_gtoreq_v2(v1, v2) {
var vc = podPress_compare_v1_v2(v1, v2);
if ('gt' == vc || 'eq' == vc) {
return true;
} else {
return false;
}
}
/** podPress_is_emptystr - checks whether a given value is an empty string or not
* @param val string
* @return bool - if v1 <= v2 then it is true else it is false
*/
function podPress_is_emptystr( val ) {
var str = String(val);
var str_trim = str.replace(/\s+$/, '');
str_trim = str_trim.replace(/^\s+/, '');
if (str_trim.length > 0) {
return false;
} else {
return true;
}
}
function podPressPopupPlayer(strPlayerDiv, strMediaFile, numWidth, numHeight, windowName, postID, strTitle, strArtist) {
var refPlayerDiv = document.getElementById('podPressPlayerSpace_'+String(strPlayerDiv));
var refPlayerDivLink = document.getElementById('podPressPlayerSpace_'+strPlayerDiv+'_PlayLink');
var strExt = podPress_getfileext(strMediaFile);
var strPreviewImg ='';
if (refPlayerDiv != undefined) {
refPlayerDivLink.innerHTML=podPressText_PlayNow;
if ( strExt == 'mp3' && podPressPlayerFile == '1pixelout_player.swf' && true == podPressMP3PlayerWrapper ) {
document.getElementById('podpress_lwc_' + strPlayerDiv).style.backgroundImage = '';
}
refPlayerDiv.style.display='none';
if(document.getElementById('winplayer') != undefined) {
if(document.getElementById('winplayer').controls) {
document.getElementById('winplayer').controls.stop();
}
} else {
if ( strExt == 'mp3' && podPressPlayerFile == '1pixelout_player.swf' ) {
var podPress_container = refPlayerDiv.parentNode;
var newdiv = document.createElement('div');
newdiv.setAttribute('id', 'podPressPlayerSpace_'+String(strPlayerDiv));
podPress_container.replaceChild(newdiv, refPlayerDiv);
} else {
refPlayerDiv.innerText = '';
}
}
//refPlayerDivLink.parentNode.onclick = function(){ podPressShowHidePlayer(strPlayerDiv, strMediaFile, numWidth, numHeight, 'force', strPreviewImg, strTitle, strArtist); return false; };
}
if (typeof windowName == 'undefined') { windowName = 'podPress'; var backto_name = podpressL10.theblog; } else { var backto_name = windowName; }
if (typeof postID != 'undefined' && Number(postID) > 0) { var backlink = podPressBlogURL + '?p=' + postID; } else { var backlink = podPressBlogURL; }
if (typeof numWidth == 'undefined') { numWidth = 320; }
if (typeof numHeight == 'undefined') { numHeight = 240; }
var strResult = '\n';
strResult += '\n';
strResult += '\n';
strResult += ''+windowName+' - Popup Player \n';
strResult += ' \n';
// WebKit supports since 525.x and Internet Explorer since 9.0 MP3 in the HTML 5 element.
if ( strExt == 'mp3' && podPressHTML5 == true && podPress_is_modern_ie() == true ) {
var is_modern_ie = true;
numWidth = numWidth + 200;
numHeight = numHeight + 50;
} else {
var is_modern_ie = false;
}
if ( strExt == 'mp3' && podPressHTML5 == true && ((-1 != navigator.userAgent.search(/Webkit\/([0-9]+\.[0-9]+)/gi) && true == podPress_is_v1_gtoreq_v2(RegExp.$1, '525')) || true == is_modern_ie ) ) {
var use_html5 = true;
strResult += '\n';
} else {
var use_html5 = false;
}
if ( strExt == 'mp3' && podPressPlayerFile == '1pixelout_player.swf' && false == use_html5) {
strResult += '\n';
strResult += '\n';
}
strResult += '\n';
strResult += '\n';
strResult += '\n';
strResult += '\n';
strResult += '
\n';
strResult += '\n';
strResult += '';
if (strExt == 'mp3' && podPressMP3PlayerWrapper) {
var windowWidth = Number(numWidth) + 65;
} else {
var windowWidth = Number(numWidth) + 20;
}
if (strExt == 'mp3') {
var windowHeight = Number(numHeight) + 50;
} else {
var windowHeight = Number(numHeight) + 70;
}
podpresswindow = window.open('about:blank', 'podPressPlayer', 'width='+String(windowWidth)+',height='+String(windowHeight)+',left=50,top=50,toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=yes');
podpressdocument = podpresswindow.document;
podpressdocument.open();
podpressdocument.write(strResult);
podpressdocument.close();
podpresswindow.focus();
if (navigator.appName == 'Microsoft Internet Explorer') {
podpresswindow.location.reload();
}
}
/** podPress_is_modern_ie - checks the current browser is an Internet Explorer 9.0 or newer
* @return bool
*/
function podPress_is_modern_ie() {
if ( -1 != navigator.userAgent.search(/Trident\/([0-9]+\.[0-9]+)/gi) && true == podPress_is_v1_gtoreq_v2(RegExp.$1, '5') && -1 != navigator.userAgent.search(/MSIE\s([0-9]+\.[0-9]+)/gi) && true == podPress_is_v1_gtoreq_v2(RegExp.$1, '9') ) {
return true;
} else {
return false;
}
}
/** podPress_get_OrigURL - get the OrigURL
* @param mixed $url - the masked url
* @return string - the real URL
*/
function podPress_get_OrigURL(strPlayerDiv) {
var realurl = document.getElementById('podPressPlayerSpace_' + strPlayerDiv + '_OrigURL').value;
if ( typeof podPressPT == 'boolean' && podPressPT == true ) {
realurl = realurl.replace(/^(https?:\/\/|http:\/\/)/, '');
realurl = 'http://www.podtrac.com/pts/redirect.mp3/' + realurl;
} else if ( typeof podPressBK == 'string' && podPressBK != '' ) {
realurl = realurl.replace(/^http:\/\//, '');
realurl = 'http://media.blubrry.com/' + podPressBK + '/'+ realurl;
}
return realurl;
}
/** podPress_html5_count - counts how many times a media file was played (HTML5)
* @param mixed $url - the masked url
* @param mixed $id - the ID of the player element
*/
function podPress_html5_count(url, id) {
if ( typeof podPressHTML5sec == 'string' && podPressHTML5sec != '' ) { // if statistics are enabled then podPressHTML5sec exists and is an not-empty string
var startTime = document.getElementById( id ).currentTime;
if (startTime < 0.1) { // count only if the player has been started at the position < 0.1 seconds
jQuery.ajax({
async: true,
url: podPressBackendURL + 'podpress_backend.php',
type: 'POST',
dataType: 'text',
data: 'action=getrealurl&url='+encodeURIComponent(url)+'&_ajax_nonce=' + podPressHTML5sec
});
}
}
}
function podPressGetBaseName(file) {
var Parts = file.split('\\');
if( Parts.length < 2 ) {
Parts = file.split('/');
}
return Parts[ Parts.length -1 ];
}