"+message,type,"top-right");return}Notification.requestPermission(function(result){if(result==="granted"){console.log("Notification: "+result);try{var notification=new Notification(title,{body:message,icon:icon?icon:"https://cdn1.iconfinder.com/data/icons/hawcons/32/698558-icon-47-note-important-512.png",image:image?image:""});if(url){notification.onclick=function(e){e.preventDefault();window.open(url,"_blank")}}}catch(err){WPDM.notify(""+title+"
"+message,type,"top-right");console.log("Notification API error: "+err)}}else{WPDM.notify(""+title+"
"+message,type,"top-right");console.log("Notification: "+result)}})},notify:function(message,type,position,autoclose){var $=jQuery;if(type===undefined||!type)type="info";if(position===undefined||!position)position="top-right";if(type==="danger")type="error";var notifycont=position.indexOf("#")>=0?position:"#wpdm-notify-"+position;if($(notifycont).length==0)$("body").prepend("
");var notif=$(""+message+"
");$(notifycont).append(notif);$(notif).fadeIn();if(autoclose!==undefined){setTimeout(function(){$(notif).animate({opacity:0},1e3,function(){$(this).slideUp()})},autoclose)}return $(notif)},floatify:function(html,position){var $=jQuery;if(position===undefined||!position)position="top-right";var floatifycont="#wpdm-floatify-"+position;if($(floatifycont).length==0)$("body").prepend("");var floatify=$(""+html+"
");$(floatifycont).append(floatify);$(floatify).animate({marginRight:"0px"});return $(floatify)},blockUI:function(element,xhr){jQuery(element).addClass("blockui");if(xhr)xhr.addEventListener("load",function(){jQuery(element).removeClass("blockui")})},unblockUI:function(element){jQuery(element).removeClass("blockui")},overlay:function(element,html){var $=jQuery;var overlaycontent=$("");$(element).addClass("wpdm-overlay").append(overlaycontent);$(overlaycontent).fadeIn();$("body").on("click",".wpdm-overlay-close",function(){$(overlaycontent).fadeOut(function(){$(this).remove()})});return $(overlaycontent)},confirm:function(heading,content,buttons){var html,$=jQuery;var modal_id="__boot_popup_"+WPDM.uniqueID();$("#w3eden__boot_popup").remove();var _buttons="";if(buttons){_buttons='\n"}html='\n'+'
\n'+'
\n'+' \n"+'
\n'+" "+content+"\n"+"
\n"+_buttons+"
\n"+"
\n"+"
";$("body").append(html);$("#"+modal_id).modal("show");$.each(buttons,function(i,button){var id="btx_"+i;$("#"+id).unbind("click");$("#"+id).bind("click",function(){button.callback.call($("#"+modal_id));return !1})});return $("#"+modal_id)},audioUI:function(audio){var $=jQuery,song_length,song_length_m,song_length_s;var player_html='';if(audio.duration!==Infinity){song_length=parseInt(audio.duration);song_length_m=parseInt(song_length/60);song_length_s=song_length-song_length_m*60;song_length_m=song_length_m>9?song_length_m:"0"+song_length_m;song_length_s=song_length_s>9?song_length_s:"0"+song_length_s}else{song_length_m="--";song_length_s="--";audio.addEventListener("durationchange",function(e){console.log(this.duration);if(this.duration!==Infinity){song_length=parseInt(this.duration);song_length_m=parseInt(song_length/60);song_length_s=song_length-song_length_m*60;song_length_m=song_length_m>9?song_length_m:"0"+song_length_m;song_length_s=song_length_s>9?song_length_s:"0"+song_length_s;$("#mins").html(song_length_m+":"+song_length_s);next(song_length)}},!1)}if($("#wpdm-audio-player-ui").length===0){$("body").append(player_html);$("#wpdm-audio-player-ui").slideDown();$("#mins").html(song_length_m+":"+song_length_s);$("body").on("click","#wpdm-audio-player-ui .progress",function(e){let value=e.offsetX*100/this.clientWidth;var played=parseInt(song_length*value/100);var played_m=parseInt(played/60);var played_s=played-played_m*60;played_m=played_m>9?played_m:"0"+played_m;played_s=played_s>9?played_s:"0"+played_s;$("#played").html(played_m+":"+played_s);audio.currentTime=song_length*value/100;$(this).find(".progress-bar").css("width",value+"%")});$("body").on("click","#wpdm-btn-backward",function(){let value=parseInt($("#wpdm-audio-player-ui .progress-bar").css("width"))/parseInt($("#wpdm-audio-player-ui .progress").css("width"))*100-10;if(value<0)value=0;var played=parseInt(song_length*value/100);var played_m=parseInt(played/60);var played_s=played-played_m*60;played_m=played_m>9?played_m:"0"+played_m;played_s=played_s>9?played_s:"0"+played_s;$("#played").html(played_m+":"+played_s);audio.currentTime=song_length*value/100;$("#wpdm-audio-player-ui .progress-bar").css("width",value+"%")});$("body").on("click","#wpdm-btn-forward",function(){let value=parseInt($("#wpdm-audio-player-ui .progress-bar").css("width"))/parseInt($("#wpdm-audio-player-ui .progress").css("width"))*100+10;if(value>100)value=100;var played=parseInt(song_length*value/100);var played_m=parseInt(played/60);var played_s=played-played_m*60;played_m=played_m>9?played_m:"0"+played_m;played_s=played_s>9?played_s:"0"+played_s;$("#played").html(played_m+":"+played_s);audio.currentTime=song_length*value/100;$("#wpdm-audio-player-ui .progress-bar").css("width",value+"%")});$("#wpdm-btn-volumctrl").on("click",function(){$(this).next(".volumctrl").toggle()});$("body").on("click",".btn-play",function(){if($(this).find(".fa").hasClass("fa-play")){$(this).find(".fa").addClass("fa-pause").removeClass("fa-play");$(this).data("state","playing");audio.play()}else{$(this).find(".fa").addClass("fa-play").removeClass("fa-pause");$(this).data("state","paused");audio.pause()}});$("body").on("change","#wpdm-audio-volume",function(){audio.volume=this.value})}$("#mins").html(song_length_m+":"+song_length_s);audio.addEventListener("play",function(){$("#wpdm-btn-play").find(".fa").addClass("fa-pause").removeClass("fa-play")});audio.addEventListener("pause",function(){$("#wpdm-btn-play").find(".fa").addClass("fa-play").removeClass("fa-pause")});audio.addEventListener("timeupdate",function(e){var song_length=parseInt(audio.duration);var time_now=audio.currentTime;var percent=time_now/song_length*100;if(percent>100)percent=100;$("#wpdm-audio-progress").css("width",percent+"%");var played=parseInt(time_now);var played_m=parseInt(played/60);var played_s=played-played_m*60;played_m=played_m>9?played_m:"0"+played_m;played_s=played_s>9?played_s:"0"+played_s;$("#played").html(played_m+":"+played_s)})}};jQuery(function($){var $body=$("body");$body.on("click",".wpdm-notify, .wpdm-floatify",function(){$(this).animate({opacity:0},1e3,function(){$(this).slideUp()})});$body.on("click",".dismis-on-click",function(){$(this).slideUp()});$body.on("click",".wpdm-download-link.wpdm-download-locked",function(e){e.preventDefault();hideLockFrame();var parentWindow=document.createElement("a");parentWindow.href=document.referrer.toString();var __sep="?";if(wpdm_url.home.indexOf("?")>0)__sep="&";if(parentWindow.hostname===window.location.hostname||1)$(window.parent.document.body).append("");else window.parent.postMessage({task:"showiframe",iframe:""},"*")});$body.on("click",".wpdm-download-link.download-on-click[data-downloadurl]",function(e){e.preventDefault();if(this.target==="_blank")window.open($(this).data("downloadurl"));else window.location.href=$(this).data("downloadurl")});$body.on("click",".__wpdm_playvideo",function(e){e.preventDefault();$("#__wpdm_videoplayer").children("source").attr("src",$(this).data("video"));console.log("loading...");var vid=document.getElementById("__wpdm_videoplayer");vid.onloadeddata=function(){console.log("loaded....")};$("#__wpdm_videoplayer").get(0).load()});$body.on("change",".terms_checkbox",function(e){if($(this).is(":checked"))$("#wpdm-filelist-"+$(this).data("pid")+" .btn.inddl, #xfilelist .btn.inddl").removeAttr("disabled");else $("#wpdm-filelist-"+$(this).data("pid")+" .btn.inddl, #xfilelist .btn.inddl").attr("disabled","disabled")});$body.on("click",".wpdm-social-lock",function(e){try{_PopupCenter($(this).data("url"),"Social Lock",600,400)}catch(e){}});var $input_group_input=$(".input-group input");$input_group_input.on("focus",function(){$(this).parent(".input-group").find(".input-group-addon").addClass("input-group-addon-active")});$input_group_input.on("blur",function(){$(this).parent().find(".input-group-addon").removeClass("input-group-addon-active")});$body.on("click","button.btn.inddl",function(e){e.preventDefault();var tis=this;if($(this).data("dlurl")!==undefined){location.href=$(this).data("dlurl");return}$.post(wpdm_rest_url("validate-filepass"),{wpdmfileid:$(tis).data("pid"),wpdmfile:$(tis).data("file"),actioninddlpvr:1,filepass:$($(tis).data("pass")).val()},function(res){if(res.success===!0){var dlurl=res.downloadurl;$(tis).data("dlurl",dlurl);wpdm_boot_popup(wpdm_strings.pass_var,"",[{label:"Close",class:"btn btn-secondary",callback:function(){this.modal("hide");return !1}}])}else{alert(res.msg)}})});$body.on("click",".wpdm-indir",function(e){e.preventDefault();WPDM.blockUI("#xfilelist");$("#xfilelist").load(location.href,{action:"wpdmfilelistcd",pid:$(this).data("pid"),cd:$(this).data("dir")},function(res){WPDM.unblockUI("#xfilelist")})});$body.on("click",".role-tabs a",function(e){$(".role-tabs a").removeClass("active");$(this).addClass("active")});$body.on("click",".btn-wpdm-a2f",function(e){var a2fbtn=$(this);$.post(wpdm_url.ajax,{action:"wpdm_addtofav",pid:$(this).data("package")},function(res){if(a2fbtn.hasClass("btn-secondary"))a2fbtn.removeClass("btn-secondary").addClass("btn-danger").html(a2fbtn.data("rlabel"));else a2fbtn.removeClass("btn-danger").addClass("btn-secondary").html(a2fbtn.data("alabel"))})});$body.on("click",".wpdm-btn-play",function(e){e.preventDefault();if($("#wpdm-audio-player").length===0){var player=document.createElement("audio");player.id="wpdm-audio-player";player.controls="controls";player.autoplay=1;player.type="audio/mpeg";$("body").append(player)}player=$("#wpdm-audio-player");var btn=$(this);if(btn.data("state")==="stop"||!btn.data("state")){player.css("display","none");player.attr("src",$(this).data("song")+"&play=song.mp3")}if(btn.data("state")==="playing"){$(this).data("state","paused");player.trigger("pause");$(this).html("");return !1}if(btn.data("state")==="paused"){$(this).data("state","playing");player.trigger("play");$(".wpdm-btn-play").html("");$(this).html("");return !1}$(".wpdm-btn-play").data("state","stop");$(".wpdm-btn-play").html("");btn.html("");player.unbind("loadedmetadata");player.on("loadedmetadata",function(){console.log("Playing "+this.src+", for: "+this.duration+"seconds.");btn.html("");btn.data("state","playing");WPDM.audioUI(this)});document.getElementById("wpdm-audio-player").onended=function(){btn.html("");btn.data("state","stop")}});$(".wpdm_remove_empty").remove();var file_frame,dfield;$body.on("click",".wpdm-media-upload",function(event){event.preventDefault();dfield=$($(this).attr("rel"));if(file_frame){file_frame.open();return}file_frame=wp.media.frames.file_frame=wp.media({title:$(this).data("uploader_title"),button:{text:$(this).data("uploader_button_text")},multiple:!1});file_frame.on("select",function(){attachment=file_frame.state().get("selection").first().toJSON();dfield.val(attachment.url)});file_frame.open()});$body.on("click",".btn-image-selector",function(event){event.preventDefault();dfield=$($(this).attr("rel"));var dfield_h=$($(this).attr("rel")+"_hidden");if(file_frame){file_frame.open();return}file_frame=wp.media.frames.file_frame=wp.media({title:$(this).data("uploader_title"),button:{text:$(this).data("uploader_button_text")},multiple:!1});file_frame.on("select",function(){attachment=file_frame.state().get("selection").first().toJSON();dfield.attr("src",attachment.url);dfield_h.val(attachment.url)});file_frame.open()});$body.on("click",".pagination.async a, .__wpdm_load_async",function(e){e.preventDefault();var _cont=$(this).data("container");$(_cont).addClass("blockui");$.get(this.href,function(res){$(_cont).html($(res).find(_cont).html());$(_cont).removeClass("blockui")})});$body.on("keyup",".wpdm-pack-search-file",function(){var value=$(this).val().toLowerCase();var filelist_item=$(this).data("filelist")+" tr";$(filelist_item).filter(function(){$(this).toggle($(this).text().toLowerCase().indexOf(value)>-1)})});$(".__wpdm_submit_async").on("submit",function(e){e.preventDefault();var _cont=$(this).data("container");$(_cont).addClass("blockui");$(this).ajaxSubmit({success:function(response){$(_cont).html($(response).find(_cont).html());$(_cont).removeClass("blockui")}})});var unlocked=[];$(".wpdm-filelist-area[data-termlock]").on("mouseover",function(){try{if(unlocked[$(this).data("packageid")]===1)return}catch(e){}$("#term-panel-"+$(this).data("packageid")).fadeIn("fast")});$(".terms_checkbox").on("click",function(){if($(this).is(":checked")){unlocked[$(this).data("pid")]=1;$("#term-panel-"+$(this).data("pid")).fadeOut("fast");$(".download_footer_"+$(this).data("pid")).slideDown()}else $(".download_footer_"+$(this).data("pid")).slideUp()});$formcontrol=$(".input-wrapper input");$formcontrol.on("focus",function(){$(".input-wrapper").removeClass("input-focused");$(this).parent(".input-wrapper").addClass("input-focused")});$formcontrol.on("change",function(){$(".input-wrapper").removeClass("input-focused");$(this).parent(".input-wrapper").addClass("input-focused");if($(this).val()!=="")$(this).parent(".input-wrapper").addClass("input-withvalue");else $(this).parent(".input-wrapper").removeClass("input-withvalue")})});function _PopupCenter(url,title,w,h){var dualScreenLeft=window.screenLeft!=undefined?window.screenLeft:screen.left;var dualScreenTop=window.screenTop!=undefined?window.screenTop:screen.top;var width=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width;var height=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;var left=width/2-w/2+dualScreenLeft;var top=height/2-h/2+dualScreenTop;var newWindow=window.open(url,title,"scrollbars=yes, width="+w+", height="+h+", top="+top+", left="+left);if(window.focus){newWindow.focus()}return !1}function generatepass(id){wpdm_pass_target="#"+id;jQuery("#generatepass").modal("show")}function hideLockFrame(){jQuery("#wpdm-lock-frame").remove()}function wpdm_bootModal(heading,content,width){var html;if(!width)width=400;jQuery("#w3eden__bootModal").remove();html='\n'+'
\n'+'
\n'+' \n"+'
\n'+" "+content+"\n"+"
\n"+' \n"+"
\n"+"
\n"+"
";jQuery("body").append(html);jQuery("#__bootModal").modal("show")}function wpdm_boot_popup(heading,content,buttons){var html,$=jQuery;$("#w3eden__boot_popup").remove();var _buttons="";if(buttons){_buttons='\n"}html='";$("body").append(html);$("#__boot_popup").modal("show");$.each(buttons,function(i,button){var id="btx_"+i;$("#"+id).unbind("click");$("#"+id).bind("click",function(){button.callback.call($("#__boot_popup"));return !1})});return $("#__boot_popup")}function wpdm_iframe_modal(url,closebutton){var iframe,$=jQuery;if(url==="close"){$("#wpdm_iframe_modal").remove();$("#ifcb").remove();$("body").removeClass("wpdm-iframe-modal-open");return !1}var closebutton_html="";if(closebutton!==undefined&&closebutton===!0)closebutton_html="";iframe=''+closebutton_html;$("body").append(iframe).addClass("wpdm-iframe-modal-open");$("#wpdm_iframe_modal").fadeIn()}