File: /home/mobilech/alliancelaptoptraining.com.np/wp-content/plugins/html5-video-player/build/admin.js
(()=>{"use strict";var t;(t=jQuery)(document).ready(function(){t(".h5vp_import_data").on("click",function(e){e.preventDefault(),t.ajax({url:window.h5vpAdmin?.ajaxUrl,data:{action:"h5vp_import_data_ajax"},success:t=>{const e=JSON.parse(t);!0===e?.success&&(location.href=location.href+"?h5vp-import=success")}})}),t(".h5vp_player_type .csf-fieldset .csf--button-group .csf--button").on("click",function(){const e=this;setTimeout(()=>{t(".h5vp_player_type_controls").addClass("h5vp_player_controls_click_trigger newclassbro"),t(".h5vp_player_controls_click_trigger").removeClass("h5vp_player_type_controls");const n=t(e).parent(".csf--button-group").find(".csf--active input").val();t('.h5vp_player_controls_click_trigger .csf-fieldset .csf--button-group .csf--button input[value="'+n+'"]').parent().trigger("click"),t(".h5vp_player_controls_click_trigger").removeClass("h5vp_player_controls_click_trigger")},100),setTimeout(()=>{t(".newclassbro").addClass("h5vp_player_type_controls")},1e3)}),t(".h5vp_player_type_controls .csf-fieldset .csf--button-group .csf--button").on("click",function(){const e=this;setTimeout(()=>{t(".h5vp_player_type").addClass("h5vp_player_click_trigger"),t(".h5vp_player_controls_click_trigger").removeClass("h5vp_player_type");const n=t(e).parent(".csf--button-group").find(".csf--active input").val();t('.h5vp_player_click_trigger .csf-fieldset .csf--button-group .csf--button input[value="'+n+'"]').parent().trigger("click"),t(".h5vp_player_click_trigger").removeClass("h5vp_player_click_trigger")},100),setTimeout(()=>{t(".h5vp_player_click_trigger").addClass("h5vp_player_type")},1e3)}),t(".h5vp_duplicate_player").on("click",function(e){e.preventDefault(),t.post(h5vpAdmin.ajaxUrl,{action:"h5vp_dulicate_player",postid:t(this).data("postid"),security:t(this).attr("security")},function(t){if(t.success){let t=window.location.href;t=t.split("?").length>1?t+"&duplicate=success&h5vp_nonce="+window.h5vpAdmin.nonce:t+"?duplicate=success&h5vp_nonce="+window.h5vpAdmin.nonce,window.location.href=t}else alert(t.data?.message)})}),-1!=window.location.href.search("duplicate=success")&&window.history.pushState({urlPath:"edit.php?post_type=videoplayer"},"","edit.php?post_type=videoplayer"),t(document).on("click",".h5vp_front_shortcode input",function(e){e.preventDefault();let n=t(this).parent().find("input")[0];n.select(),n.setSelectionRange(0,30),document.execCommand("copy"),t(this).parent().find(".htooltip").text("Copied Successfully!")}),t(document).on("mouseout",".h5vp_front_shortcode input",function(){t(this).parent().find(".htooltip").text("Copy To Clipboard")}),t(document).on("click",".h5vp_shortcode_copy_btn",function(e){e.preventDefault();const n=t(this).data("clipboard-text");if(navigator.clipboard)navigator.clipboard.writeText(n);else{const t=document.createElement("input");t.value=n,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}"icon"==t(this).data("type")?(t(this).css("width","18px"),setTimeout(()=>{t(this).css("width","22px")},200)):(t(this).text("Copied!"),setTimeout(()=>{t(this).text(n)},2e3))}),t(".h5vp_show_password").on("click",function(){"password"==t(this).parent().find("input").attr("type")?t(this).parent().find("input").attr("type","text"):t(this).parent().find("input").attr("type","password")}),t(".h5vp-analytics table tr").on("click",function(){const t=this.getAttribute("to"),e=location.href.match(/(.+)&page=analytics/g);t&&e&&(location.href=e[0]+`&${t}`)});const e=document.getElementById("myChart"),n={type:"line",data:{labels:e&&e.getAttribute("data-labels")&&JSON.parse(e.getAttribute("data-labels")),datasets:[{label:"Views",backgroundColor:"rgb(255, 99, 132)",borderColor:"rgb(255, 99, 132)",color:"rgb(255, 99, 132)",data:e&&e.getAttribute("data-data")&&JSON.parse(e.getAttribute("data-data")),tension:.4}]},options:{},plugins:[{id:e&&e.getAttribute("id"),beforeDraw:t=>{const e=t.canvas.getContext("2d");e.save(),e.globalCompositeOperation="destination-over",e.fillStyle="#fff",e.fillRect(0,0,t.width,t.height),e.restore()}}]};if(e){var o=new Chart(e,n);e.setAttribute("data-labels",""),e.setAttribute("data-data",""),o.fillStyle="#fff"}const i=document.getElementById("h5vp_srt_convert_button");function a(t){for(var e="",n=t.split(/\n/);n.length>3;){for(var o=3;o<n.length;o++)n[2]+="\n"+n[o];n.splice(3,n.length-3)}var i=0;if(!n[0].match(/\d+:\d+:\d+/)&&n[1].match(/\d+:\d+:\d+/)&&(e+=n[0].match(/\w+/)+"\n",i+=1),!n[i].match(/\d+:\d+:\d+/))return"";var a=n[i].match(/(\d+):(\d+):(\d+)(?:,?\.?(\d+))?\s*-?-?>?,?\s*(\d+):(\d+):(\d+)(?:,?\.?(\d+))?/);return a?(e+=a[1]+":"+a[2]+":"+a[3]+"."+a[4]+" --\x3e "+a[5]+":"+a[6]+":"+a[7]+"."+a[8]+"\n",n[i+=1]&&(e+=n[i],n[i+1]?(e+="\n",e+=n[i+1]+"\n\n"):e+="\n\n"),e):""}i&&(i.onclick=async t=>{t.preventDefault();const e=document.getElementById("h5vp_srt_file");if(!e)return;const n=e.value,o=await fetch(n),i=await o.blob();if(i){var r=new FileReader;r.readAsText(i,"UTF-8"),r.onload=function(t){const o=t.target?.result;if("string"!=typeof o)return;const i=function(t){var e=t.replace(/\r+/g,""),n=(e=e.replace(/^\s+|\s+$/g,"")).split("\n\n"),o="";if(n.length>0){o+="WEBVTT\n\n";for(var i=0;i<n.length;i+=1)o+=a(n[i])}return o}(o);var r,c,s;r=n.substring(n.lastIndexOf("/")+1).split(".").slice(0,-1).join(".")+".vtt",c=i,(s=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(c)),s.setAttribute("download",r),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),e.value=""},r.onerror=function(){}}});const r=document.querySelectorAll(".h5vp_export_button");Object.values(r).map(e=>{const n=e.getAttribute("data-id");e.addEventListener("click",function(e){e.preventDefault(),t.ajax({url:h5vpAdmin?.ajaxUrl,data:{action:"h5vp_export_data",id:n,nonce:h5vpAdmin?.nonce},method:"POST",success:t=>{const e=window.URL.createObjectURL(new Blob([t],{type:"application/json"})),o=document.createElement("a");o.href=e,o.setAttribute("download",`video-player-${n}.json`),document.body.appendChild(o),o.click(),document.body.removeChild(o)}})})});const c=document.querySelector(".h5vp_import_form");if(!c)return;const s=c.querySelector("form"),l=c.querySelector(".close"),d=c.querySelector(".h5vp-import-notice");l?.addEventListener("click",function(){c.style.display="none"}),s?.addEventListener("submit",function(e){e.preventDefault();const n=s.querySelector(".h5vp_import_file");if(n.files&&n.files[0]){var o=new FileReader;o.readAsText(n.files[0],"UTF-8"),o.onload=function(e){const o=e.target?.result;t.ajax({url:h5vpAdmin?.ajaxUrl,data:{action:"h5vp_import_data",id:null,content:o},method:"POST",success:()=>{d.style.display="block",n.value="",setTimeout(()=>{window.importReload&&window.location.reload(),c.style.display="none"},1e3)}})},o.onerror=function(){console.warn("error importing")}}});const p=document.querySelectorAll(".h5vp_import_button");Object.values(p).map(t=>{t.addEventListener("click",function(e){e.preventDefault(),window.id=t.getAttribute("data-id"),window.importReload=t.getAttribute("data-reload"),d.style.display="none",c.style.display="block"})})}),document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{document.querySelectorAll(".h5vp_aws_notice .notice-dismiss").forEach(t=>{t.addEventListener("click",e=>{e.preventDefault();const n=t.closest(".h5vp_aws_notice"),o=n?.getAttribute("data-nonce"),i={nonce:o};window.wp.ajax&&wp.ajax.post("h5vp_dismiss_aws_notice",i).then(()=>{n?.remove()})})})},100)})})();