관리-도구
편집 파일: main.min.js
"use strict";var html=document.documentElement,body=document.querySelector("body");function hideLoader(){let e=document.getElementById("preloader");e&&e.remove()}window.addEventListener("load",function(){hideLoader(),this.document.getElementById("app-drawer")&&document.getElementById("app-menu-scrollbar").querySelector(".scrollbar-track-x").remove()});const mob=document.querySelectorAll("[data-offcanvas-id]");mob.forEach(function(e){let t=e.getAttribute("data-offcanvas-id"),l=document.querySelector(`#${t}`),n=document.querySelector(`.${t}-inner`),a=l.querySelector(`.${t}-close`);e.addEventListener("click",()=>{l.classList.contains(...["invisible","opacity-0"])&&l.classList.remove(...["invisible","opacity-0"]),n.classList.contains(...["translate-x-full","rtl:-translate-x-full"])&&n.classList.remove(...["translate-x-full","rtl:-translate-x-full"]),body.classList.add("overflow-hidden")}),a&&a.addEventListener("click",()=>{l.classList.contains(...["invisible","opacity-0"])||l.classList.add(...["invisible","opacity-0"]),n.classList.contains(...["translate-x-full","rtl:-translate-x-full"])||n.classList.add(...["translate-x-full","rtl:-translate-x-full"]),body.classList.contains("overflow-hidden")&&body.classList.remove("overflow-hidden")}),l.addEventListener("click",function(e){e.target===this&&e.target!==n&&(l.classList.contains(...["invisible","opacity-0"])||l.classList.add(...["invisible","opacity-0"]),n.classList.contains(...["translate-x-full","rtl:-translate-x-full"])||n.classList.add(...["translate-x-full","rtl:-translate-x-full"]),body.classList.contains("overflow-hidden")&&body.classList.remove("overflow-hidden"))})});let option={continuousScrolling:!1,alwaysShowTracks:!0};function allCheck(e,t){Array.from(document.querySelectorAll(`.${t}`)).forEach(t=>{e.target.checked?t.checked=!0:t.checked=!1})}function uploadFile(){document.querySelectorAll(".file-src").forEach(function(e){e.onchange=function(){new FileReader,e.closest(".file-container").querySelector(".file-name").innerHTML=`${e.files.length} ${fileUploadedText}`}})}document.querySelector("[data-scrollbar]")&&Scrollbar.initAll(option),document.querySelectorAll('[href="#"]').forEach(e=>{e.addEventListener("click",e=>e.preventDefault())}),document.getElementById("choices-input")&&new Choices(document.getElementById("choices-input"),{removeItemButton:!0,maxItemCount:3,duplicateItemsAllowed:!1,allowHTML:!0}),document.getElementById("color-picker")&&document.getElementById("color-picker").addEventListener("change",()=>{document.querySelector(".color-value").textContent=document.getElementById("color-picker").value}),function e(){let t=document.querySelectorAll(".counter-value");t.length&&t.forEach(e=>{let t=e.getAttribute("data-value"),l=t/300,n=0;function a(e,t,l){return String(e).length<l?Array(l-String(e).length+1).join(t)+String(e):e}function r(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}let i=()=>{(n+=l)<t?(e.innerText=a(r(n.toFixed(0)),"0","2"),setTimeout(i,1)):e.innerText=a(r(t),"0","2")};i()})}(),uploadFile();const inputTypeToggler=document.querySelectorAll(".inputTypeToggle");function readFile(e){if(e.files&&e.files[0]){var t=new FileReader;t.onload=function(t){let l=` <div class="img-thumb-wrapper"> <img class="img-thumb" width="100" src="${t.target.result}"/> </div>`,n=$(e).parent().parent(),a=$(n).find(".preview-zone");(a=$(a).find(".box").find(".box-body").html("")).append(l),$(".remove").click(function(){$(this).parent(".img-thumb-wrapper").remove()})},t.readAsDataURL(e.files[0])}}function logErrorMsg(e){$.each(e,function(e,t){$("."+e+"_err").text(t).fadeIn().delay(5e3).fadeOut("slow")})}function ajaxSearchSuggestion(e,t,l,n){$.ajax({url:l,method:"GET",data:{key:e,search_type:n},success:function(e){$(t).parent().find(".search-show").fadeIn(),$(t).parent().find(".search-show").html(e)}})}function openStep(e,t){let l,n=document.getElementsByClassName("tabcontent"),a=document.getElementsByClassName("tablinks");for(l=0;l<n.length;l++)n[l].style.display="none";for(l=0;l<a.length;l++)a[l].className=a[l].className.replace(" active","");document.getElementById(t).style.display="block",e.currentTarget.className+=" active"}function addProfileSocialMedia(){let e=document.querySelector(".profile-social-media-container"),t=` <div class="flex gap-4 removeable-parent"> <div class="grow flex flex-col gap-2"> <input type="text" placeholder="Facebook" class="form-input"> <input type="url" placeholder="https://www.facebook.com/" class="form-input"> </div> <button type="button" class="btn-icon btn-danger-icon-light size-10 shrink-0 dk-theme-card-square remove-parent-button"> <i class="ri-delete-bin-line text-inherit"></i> </button> </div> `;e.insertAdjacentHTML("beforeend",t),removeInfoItem()}function removeInfoItem(){document.querySelectorAll(".remove-parent-button").forEach(e=>{e.addEventListener("click",function(){this.closest(".removeable-parent").remove()})})}inputTypeToggler.forEach(function(e){e.addEventListener("change",function(){this.parentElement.parentElement.children[0].type=this.checked?"text":"password"})}),$(document).on("change",".dropzone-image",function(){readFile(this)}),$(".img-thumb-wrapper .remove").click(function(){$(this).parent(".img-thumb-wrapper").remove()}),$(function(){window.File&&window.FileList&&window.FileReader?$(".multiple-image").on("change",function(e){let t=$(this),l=$(t).parent().parent();var n=e.target.files;let a=n.length,r=$(l).find(".gallery-preview-zone");r=$(r).find(".box").find(".box-body");for(var i=0;i<a;i++){var o=n[i],s=new FileReader;s.onload=function(e){$(`<div class="img-thumb-wrapper"> <button class="remove"> <i class="ri-close-line text-inherit text-[13px]"></i> </button> <img class="img-thumb" width="100" src="${e.target.result}" title="${e.target.name}"/> </div> `).appendTo(r),$(".remove").click(function(){$(this).parent(".img-thumb-wrapper").remove()})},s.readAsDataURL(o)}}):alert("Your browser doesn't support to File API"),$(document).on("click",".multiple-image-remove",function(){let e=$(this),t=$(this).data("action");$.ajax({url:t,type:"GET",dataType:"JSON",success:function(t){"success"==t.status&&$(e).parent(".img-thumb-wrapper").remove()},error:function(e){Command:toastr.error("Not Found")}})}),$(".singleSelect").select2({width:"100%",id:"-1"}),$(".selectFilterCategory").select2({placeholder:selectCategory,width:"100%"}),$(".selectFilterInstructor").select2({placeholder:selectInstructor,width:"100%"}),$(".permission-list").select2({width:"100%",placeholder:selectPermission}),$(".role-list").select2({width:"100%",placeholder:selectRole})}),$(".summernote").summernote({placeholder:`${textAreaPlaceholder}...`,tabsize:2,height:220,toolbar:[["style",["style"]],["fontsize",["fontsize"]],["font",["bold","italic","underline","clear"]],["fontname",["fontname"]],["color",["color"]],["para",["paragraph"]],["height",["height"]],["insert",["hr","link"]],],styleTags:["p","h1","h2","h3","h4","h5","h6"],lineHeights:["0.5","1.0","1.1","1.2","1.3","1.4"],fontSizes:["8","9","10","11","12","13","14","15","16","18","24","36","48","64","82","150",]}),$(document).on("keyup",".search-suggestion",function(){let e=$(this),t=$(this).val(),l=$(e).data("search-type"),n=baseUrl+"/searching-suggestion";""!=t&&ajaxSearchSuggestion(t,e,n,l),$(e).parent().find(".search-show").html("")}),$(document).on("click",".search-data li",function(e){e.preventDefault();let t=$(this);t.parent().parent().parent().find("#searchInput").val($(this).text()),t.parent().parent().parent().find(".search-show").fadeOut()}),removeInfoItem();const textEditorButton=document.querySelectorAll("[data-editor-class]");textEditorButton.forEach(e=>{let t=e.getAttribute("data-editor-class");e.addEventListener("click",()=>{let l=document.querySelector(`.${t}`);try{e.classList.toggle("active"),l.readOnly=!l.readOnly,l.focus()}catch(n){alert(`Can not find editor with '${t}' class.`)}})});const copyButton=document.querySelectorAll("[data-copy-button]");copyButton.forEach(e=>{e.addEventListener("click",()=>{let t=e.querySelector(".text").innerText;e.classList.toggle("active"),e.querySelector(".text").innerText="Copied!",setTimeout(()=>{e.setAttribute("disabled","disabled")},100),setTimeout(()=>{e.classList.toggle("active"),e.querySelector(".text").innerText=t,e.removeAttribute("disabled")},1500)})});