1 |
- "use strict";var MATERIAL_CATEGORY;(function(a){a.MATERIAL="\u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B",a.NEWS="\u043D\u043E\u0432\u043E\u0441\u0442\u044C",a.NOTICE="\u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D\u0438\u0435"})(MATERIAL_CATEGORY||(MATERIAL_CATEGORY={}));var MENU_CATEGORY;(function(a){a.MAIN="__main",a.TOP="__top"})(MENU_CATEGORY||(MENU_CATEGORY={}));var CLIENT_PLATFORM;(function(a){a[a.DESKTOP=9999]="DESKTOP",a[a.OLD_DESKTOP=1280]="OLD_DESKTOP",a[a.TABLET=1024]="TABLET",a[a.MOBILE=560]="MOBILE"})(CLIENT_PLATFORM||(CLIENT_PLATFORM={}));var VKKO;(function(a){var b;(function(a){function b(){document.documentElement.style.marginRight=window.innerWidth-document.documentElement.clientWidth+"px",document.documentElement.style.overflow="hidden",d++}function c(){d--,0>=d&&(document.documentElement.style.overflow="",document.documentElement.style.marginRight=null,d=0)}var d=0;a.Platform=CLIENT_PLATFORM.DESKTOP,a.BlockScroll=b;a.UnblockScroll=c})(b=a.Setting||(a.Setting={}))})(VKKO||(VKKO={}));var VKKO;(function(a){var b;(function(a){a.logError=function(a){console.log("%c ERROR ","background-color: red; color: white; font-weight: 700;",a)},a.logWarning=function(a){console.log("%c WARNING ","background-color: orange; color: white; font-weight: 700;",a)},a.logInfo=function(a){console.log("%c INFO ","background-color: green; color: white; font-weight: 700;",a)},a.GenerateHash256=function(a){void 0===a&&(a=!1);for(var b=crypto.getRandomValues(new Uint32Array(4)),c="",d=0;d<b.length;d++)c+=b[d].toString(16);return!0===a?c.toUpperCase():c};a.GenerateHashDashed=function(a){void 0===a&&(a=4);for(var b=crypto.getRandomValues(new Uint32Array(a)),c="",d=0;d<b.length;d++)c+=b[d].toString(16)+"-";return c.slice(0,c.length-1).toUpperCase()}})(b=a.Utils||(a.Utils={}))})(VKKO||(VKKO={}));var VKKO;(function(a){var b=function(){function b(){this.HARDREMOVE_TIME=100,this.AUTOREMOVE_TIME=2e3,this.REMOVING_SHORT="short",this.REMOVING_LONG="long",this.MESSAGE_COUNTER=-1,this.__MessageContainer=document.querySelector("#MessengerBox"),this.__MessageContainer||(this.__MessageContainer=document.createElement("div"),this.__MessageContainer.classList.add("messenger"),this.__MessageContainer.id="MessengerBox",document.body.append(this.__MessageContainer))}return b.prototype.removeMessage=function(b,c){void 0===b&&(b=this.HARDREMOVE_TIME),void 0===c&&(c=this.REMOVING_SHORT),this instanceof HTMLElement?(this.classList.add("removing",c),setTimeout(function(a){a.remove()},b,this)):a.Utils.logError("\u041D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435, \u0442.\u043A. \u0435\u0433\u043E \u0442\u0438\u043F \u043D\u0435 HTMLElement")},b.prototype.autoRemoveMessage=function(a){this.removeMessage.call(a,this.AUTOREMOVE_TIME,this.REMOVING_SHORT)},b.prototype.Show=function(a,b){void 0===b&&(b=1e4);var c=document.createElement("div");c.id="MessageTick"+ ++this.MESSAGE_COUNTER,c.classList.add("in");var d=document.createElement("div");d.textContent=a;var e=document.createElement("span");e.classList.add("close"),e.onclick=this.removeMessage.bind(c),c.append(e,d),this.__MessageContainer.append(c),setTimeout(function(){c.classList.remove("in")},100),setTimeout(this.autoRemoveMessage.bind(this,c),b)},b}();a.Messenger=b})(VKKO||(VKKO={}));var VKKOWork;(function(a){a.Messenger=new VKKO.Messenger})(VKKOWork||(VKKOWork={}));var VKKO;(function(a){var b=function(){function b(){if(this.__QueryCounter=0,this.__LoadAnimationElement=document.querySelector("#LoadingAnimation"),!this.__LoadAnimationElement){this.__LoadAnimationElement=document.createElement("div"),this.__LoadAnimationElement.id="LoadingAnimation",this.__LoadAnimationElement.className="loading hidden";for(var a,b=0;7>b;b++)a=document.createElement("div"),a.className="glob",a.setAttribute("style","--i:"+(b+1)),this.__LoadAnimationElement.append(a);document.body.append(this.__LoadAnimationElement)}}return b.prototype.onStartRequest=function(){0===this.__QueryCounter&&this.__LoadAnimationElement.classList.remove("hidden"),this.__QueryCounter++},b.prototype.onStopRequest=function(){this.__QueryCounter--,0>=this.__QueryCounter&&(this.__LoadAnimationElement.classList.add("hidden"),this.__QueryCounter=0)},b.prototype.POST=function(b,c,d,e,f,g){if(void 0===f&&(f=!0),void 0===g&&(g=!1),!c)return void a.Utils.logError("URI \u043D\u0435 \u0431\u044B\u043B \u043F\u0435\u0440\u0435\u0434\u0430\u043D");d||(d={});var h=new XMLHttpRequest;h.onloadstart=this.onStartRequest,h.onloadend=this.onStopRequest,h.onabort=function(){a.Utils.logWarning(c+" => \u0412\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435 \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0431\u044B\u043B\u043E \u043F\u0440\u0435\u0440\u0432\u0430\u043D\u043E..."),VKKOWork.Messenger.Show("\u0412\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435 \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0431\u044B\u043B\u043E \u043F\u0440\u0435\u0440\u0432\u0430\u043D\u043E...")},h.onerror=function(){a.Utils.logError(c+" => "+this.statusText+" "+this.status),VKKOWork.Messenger.Show("\u0412\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435 \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u043E\u0441\u044C \u043D\u0435\u0443\u0434\u0430\u0447\u0435\u0439. \u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435 \u043F\u043E\u043F\u044B\u0442\u043A\u0443. \u0415\u0441\u043B\u0438 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0430 \u0441\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F, \u043F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u0441\u043E\u043E\u0431\u0449\u0438\u0442\u0435 \u043E\u0431 \u044D\u0442\u043E\u043C \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0443 admin@ktk-45.ru")},h.ontimeout=function(){a.Utils.logError(c+" => \u0412\u0440\u0435\u043C\u044F \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0438\u0441\u0442\u0435\u043A\u043B\u043E... \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u0441 \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442\u043E\u043C"),VKKOWork.Messenger.Show("\u0412\u0440\u0435\u043C\u044F \u043E\u0436\u0438\u0434\u0430\u043D\u0438\u044F \u0437\u0430\u043F\u0440\u043E\u0441\u0430 \u0438\u0441\u0442\u0435\u043A\u043B\u043E... \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u0441 \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442\u043E\u043C")},h.onload=function(){a.Utils.logInfo(c+" => "+this.statusText+" "+this.status.toString());var d;try{d=JSON.parse(this.response)}catch(b){a.Utils.logError(b),d=null}return null===d?void 0:"Error"in d&&"boolean"==typeof d.Error?void VKKOWork.Messenger.Show(d.Error):void b(d,e)},h.open("POST",c,f),g?h.send(d):(h.setRequestHeader("Content-Type","application/json; charset=utf-8"),h.setRequestHeader("X-Requested-With","XMLHttpRequest"),h.send(JSON.stringify(d)))},b}();a.XHR=b})(VKKO||(VKKO={}));var VKKOWork;(function(a){a.XHR=new VKKO.XHR})(VKKOWork||(VKKOWork={}));var VKKO;(function(a){var b;(function(a){function b(a,b,c,d){void 0===c&&(c=null),void 0===d&&(d=null);var e=document.createElement("label"),f=document.createElement("input"),g=document.createElement("span"),h=document.createElement("span");if(e.className="checkbox",e.append(f,g,h),h.className="text",h.textContent=a,g.className="checked",f.type="checkbox",b){var i=document.querySelector("#"+b);if(i)return void VKKOWork.Messenger.Show("\u041D\u0435\u043B\u044C\u0437\u044F \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u0441 \u043F\u043E\u0432\u0442\u043E\u0440\u044F\u044E\u0449\u0438\u043C\u0441\u044F \u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440\u043E\u043C");f.id=b}if(c)for(var j in c)c.hasOwnProperty(j)&&(f.dataset[j]=c[j]);return d&&(f.onchange=d),e}a.CreateCheckbox=b})(b=a.Control||(a.Control={}))})(VKKO||(VKKO={}));var VKKO;(function(a){var b;(function(b){function c(b,c,f){var g;if(0===e?(g=document.createElement("div"),g.className="backdrop-container",document.body.append(g),a.Setting.BlockScroll()):g=document.querySelector(".backdrop-container"),null==g)return void VKKOWork.Messenger.Show("\u041E\u0439, \u0447\u0442\u043E-\u0442\u043E \u043F\u043E\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A...");var h=document.createElement("div"),i=document.createElement("div"),j=document.createElement("div"),k=document.createElement("div"),l=document.createElement("div");if(l.className="backdrop",h.className="modal",i.className="head",j.className="body",k.className="close fas fa-times",k.onclick=d.bind(k,f),h.append(k,i,j),l.append(h),g.append(l),l.style.zIndex=(e++).toString(),("string"==typeof b||b instanceof HTMLElement)&&i.append(b),c instanceof HTMLElement)for(;0<c.children.length;)j.append(c.children[0])}function d(b){var c=this.closest(".backdrop");if(c&&(c.remove(),e--),1>e){var d=document.querySelector(".backdrop-container");d&&(d.remove(),e=0,a.Setting.UnblockScroll())}b&&b()}var e=0;b.Create=c})(b=a.Modal||(a.Modal={}))})(VKKO||(VKKO={}));var VKKO;(function(a){var b=function(){function b(b,c,d){if(void 0===c&&(c=250),void 0===d&&(d=5e3),this.__SlideCount=0,this.__WidthOneSlide=0,this.__CarouselRoot=document.querySelector(b),!this.__CarouselRoot)return void a.Utils.logWarning("\u041E\u0442\u043C\u0435\u043D\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0441\u043B\u0430\u0439\u0434\u0435\u0440\u0430. \u041D\u0435\u0442 \u043A\u043E\u0440\u043D\u0435\u0432\u043E\u0433\u043E \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0430.");if(this.__Carousel=this.__CarouselRoot.querySelector(".carousel"),!this.__Carousel)return a.Utils.logWarning("\u041E\u0442\u043C\u0435\u043D\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u0441\u043B\u0430\u0439\u0434\u0435\u0440\u0430. \u041E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043E\u043A\u0441."),void this.__CarouselRoot.remove();if(this.__Slider=this.__Carousel.querySelector(".slider"),!this.__Slider)return void this.__CarouselRoot.remove();if(this.__NavigationDots=this.__Carousel.querySelector(".navigation-dots"),this.__SlideCount=this.__Slider.children.length,0==this.__SlideCount)return void this.__CarouselRoot.remove();switch(a.Setting.Platform){case CLIENT_PLATFORM.DESKTOP:this.__WidthOneSlide=this.__CarouselRoot.getBoundingClientRect().width;break;case CLIENT_PLATFORM.TABLET:break;case CLIENT_PLATFORM.MOBILE:this.__WidthOneSlide=document.documentElement.clientWidth;break;default:this.__WidthOneSlide=this.__CarouselRoot.getBoundingClientRect().width;}return this.buildNavigationDots(),this.buildButtonEvent(),1==this.__SlideCount?(this.__Slider.style.width=this.__WidthOneSlide+"px",void this.outForeground()):void(1<this.__SlideCount&&this.__Slider.prepend(this.__Slider.lastElementChild),this.__SwipeInterval=d,this.__SwipeSpeed=c,this.__Slider.style.width=this.__SlideCount*this.__WidthOneSlide+"px",this.__Slider.style.left="-"+this.__WidthOneSlide+"px",this.__Slider.onmouseover=this.stopSlider.bind(this),this.__Slider.onmouseout=this.startSlider.bind(this),this.outForeground(),this.startSlider())}return b.prototype.buildNavigationDots=function(){if(this.__NavigationDots){for(;0<this.__NavigationDots.children.length;)this.__NavigationDots.children[0].remove();for(var a,b=0;b<this.__SlideCount;b++)a=document.createElement("div"),a.dataset.slide=b.toString(),a.onclick=this.goToSlide.bind(this,a),this.__NavigationDots.append(a);0<this.__NavigationDots.children.length&&this.__NavigationDots.children[0].classList.add("active")}},b.prototype.buildButtonEvent=function(){for(var a,b=0;b<this.__Slider.children.length;b++)a=this.__Slider.children[b].querySelector(".gradient-button"),a&&(a.onclick=this.toggleSlide.bind(this,a))},b.prototype.outForeground=function(){this.__Carousel.classList.add("out"),this.__Carousel.ontransitionend=function(a){a.target.classList.remove("hide","out")}},b.prototype.goToSlide=function(a){this.stopSlider(),this.__Slider.style.transition="left "+this.__SwipeSpeed+"ms cubic-bezier(.18,.89,.32,1.28)";for(var b=this.__Slider.children[1],c=b.dataset.slide,d=a.dataset.slide;d!=c;)this.__Slider.append(this.__Slider.firstElementChild),b=this.__Slider.children[1],c=b.dataset.slide;this.__Slider.style.left="-"+2*this.__WidthOneSlide+"px",this.__Slider.ontransitionend=this.nextEndAlt.bind(this),this.switchNavigationDot()},b.prototype.switchNavigationDot=function(){var a=this.__Slider.children[1],b=+a.dataset.slide,c=this.__NavigationDots.querySelectorAll(".active");c.forEach(function(a){a.classList.remove("active")}),this.__NavigationDots.children[b].classList.add("active")},b.prototype.stopSlider=function(){clearInterval(this.__SwipeIntervalHandle),this.__SwipeIntervalHandle=void 0,this.__Slider.ontransitionend=void 0},b.prototype.startSlider=function(){this.__SwipeIntervalHandle&&clearInterval(this.__SwipeIntervalHandle),this.__SwipeIntervalHandle=setInterval(this.nextSlide.bind(this),this.__SwipeInterval),this.__Slider.ontransitionend=this.nextEnd.bind(this)},b.prototype.nextSlide=function(){this.__Slider.style.transition="left "+this.__SwipeSpeed+"ms cubic-bezier(.6,-0.28,.74,.05)",this.__Slider.style.left="-"+2*this.__WidthOneSlide+"px"},b.prototype.nextEnd=function(){this.__Slider.style.transition=null,this.__Slider.append(this.__Slider.firstElementChild),this.__Slider.style.left="-"+this.__WidthOneSlide+"px",this.switchNavigationDot()},b.prototype.nextEndAlt=function(){this.__Slider.style.transition=null,this.__Slider.style.left="-"+this.__WidthOneSlide+"px",this.startSlider()},b.prototype.toggleSlide=function(b){if(b){var c=b.closest(".slide");c&&(c.classList.contains("expand")?(c.classList.remove("expand"),b.textContent="\u0420\u0430\u0437\u0432\u0435\u0440\u043D\u0443\u0442\u044C",this.__NavigationDots.style.display=null,a.Setting.UnblockScroll()):(c.classList.add("expand"),b.textContent="\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C",this.__NavigationDots.style.display="none",a.Setting.BlockScroll()))}},b.prototype.Rebuild=function(){switch(a.Setting.Platform){case CLIENT_PLATFORM.DESKTOP:this.__WidthOneSlide=this.__CarouselRoot.getBoundingClientRect().width;break;case CLIENT_PLATFORM.TABLET:break;case CLIENT_PLATFORM.MOBILE:this.__WidthOneSlide=document.documentElement.clientWidth;break;default:this.__WidthOneSlide=this.__CarouselRoot.getBoundingClientRect().width;}this.__Slider.style.width=this.__SlideCount*this.__WidthOneSlide+"px",this.__Slider.style.left="-"+this.__WidthOneSlide+"px"},b}();a.Slider=b})(VKKO||(VKKO={}));var VKKOWork;(function(a){a.NoticeSlider=null})(VKKOWork||(VKKOWork={}));var VKKO;(function(a){var b;(function(a){function b(){}a.Init=function(a){if(null!=a){var c=document.querySelector(a);c&&(c.parentElement.nextElementSibling&&c.parentElement.nextElementSibling.classList.contains("search-list"),c.oninput=b)}}})(b=a.Search||(a.Search={}))})(VKKO||(VKKO={}));var VKKO;(function(a){var b;(function(b){function c(){clearTimeout(f),f=setTimeout(function(){a.Setting.Platform=document.documentElement.clientWidth>CLIENT_PLATFORM.MOBILE?document.documentElement.clientWidth>CLIENT_PLATFORM.TABLET?document.documentElement.clientWidth>CLIENT_PLATFORM.OLD_DESKTOP?CLIENT_PLATFORM.OLD_DESKTOP:CLIENT_PLATFORM.DESKTOP:CLIENT_PLATFORM.TABLET:CLIENT_PLATFORM.MOBILE},250)}function d(a,b){var c={Login:a.value,Password:b.value};VKKOWork.XHR.POST(function(a){a?a.Error?VKKOWork.Messenger.Show(a.Error):(VKKOWork.Messenger.Show("\u041F\u0440\u0438\u0432\u0435\u0442, "+a.Name),window.location.reload()):VKKOWork.Messenger.Show("\u0421\u0435\u0440\u0432\u0435\u0440 \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u0432\u0435\u0440\u043D\u0443\u043B :(")},"/login",c),this.closest(".modal").querySelector(".close").click()}function e(){VKKOWork.XHR.POST(function(a){null==a.Error&&window.location.reload()},"/logout")}var f;b.Init=function(){c(),setTimeout(window.FsLightbox,250),setTimeout(function(){document.body.onresize=c},500)},b.SignIn=function(){var b=document.createElement("div"),c=document.createElement("input"),e=document.createElement("input"),f=document.createElement("button"),g=1;c.type="text",c.placeholder="\u041B\u043E\u0433\u0438\u043D",c.tabIndex=g++,e.type="password",e.placeholder="\u041F\u0430\u0440\u043E\u043B\u044C",e.tabIndex=g++,e.onkeypress=function(a){13==a.keyCode&&d.call(f,c,e)},f.textContent="\u0412\u043E\u0439\u0442\u0438",f.onclick=d.bind(f,c,e),f.tabIndex=g++,b.append(c,e,f),a.Modal.Create("\u0410\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u044F",b)},b.SignOut=e})(b=a.Main||(a.Main={}))})(VKKO||(VKKO={}));var VKKO;(function(a){var b=function(){function a(){this.__Root=document.createElement("div"),this.__Root.classList.add("tree")}return a.prototype.onClickBranch=function(){if(this instanceof HTMLElement){var a=this.closest(".tree"),b=a.querySelectorAll(".selected"),c=this.parentElement;b.forEach(function(a){a!==c&&a.classList.remove("selected")}),c.classList.toggle("selected")}},a.prototype.AddBranch=function(a,b,c){var d=document.createElement("div"),e=document.createElement("div"),f=document.createElement("div");if(b)for(var g in b)b.hasOwnProperty(g)&&(d.dataset[g]=b[g]);return d.classList.add("branch"),e.classList.add("body"),f.classList.add("head"),f.textContent=a,f.onclick=this.onClickBranch,d.append(f,e),c?c.append(d):this.__Root.append(d),e},a.prototype.CreateBranch=function(a,b){return this.AddBranch(a,b).parentElement},a.prototype.InsertInto=function(a,b,c,d){d||(d=this.__Root);for(var e,f=d.children.length,g=0;g<f;g++)if(e=d.children[g],e.classList.contains("branch"))if(!(e.dataset.id&&e.dataset.id===a.toString()))e.children[1]&&e.children[1].classList.contains("body")&&this.InsertInto(a,b,c,e.children[1]);else if(e.children[1]&&e.children[1].classList.contains("body"))return void e.children[1].append(this.CreateBranch(b,c))},a.prototype.SetTo=function(a){if(a){for(;0<a.children.length;)a.children[0].remove();for(;0<this.__Root.children.length;)a.append(this.__Root.children[0]);a.classList.add("tree")}},a}();a.Tree=b})(VKKO||(VKKO={}));var VKKO;(function(a){var b;(function(b){function c(){"true"==this.dataset.active?VKKOWork.XHR.POST(function(){},"/material-delete/"+this.dataset.link):VKKOWork.XHR.POST(function(){},"/material-restore/"+this.dataset.link)}function d(){switch(this.dataset.category){case MATERIAL_CATEGORY.MATERIAL:q=MATERIAL_CATEGORY.MATERIAL;break;case MATERIAL_CATEGORY.NEWS:q=MATERIAL_CATEGORY.NEWS;break;case MATERIAL_CATEGORY.NOTICE:q=MATERIAL_CATEGORY.NOTICE;break;default:return;}var b=document.createElement("div"),c=document.createElement("input"),d=document.createElement("input"),e=document.createElement("div"),f=document.createElement("div"),h=document.createElement("div"),i=document.createElement("label"),k=document.createElement("input"),l=document.createElement("div"),m=document.createElement("button");i.append(k,l),i.className="select-file",l.className="button",l.textContent="\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0438\u044F",k.type="file",k.multiple=q!==MATERIAL_CATEGORY.NOTICE,k.accept="image/*",k.onchange=g,c.type="text",c.placeholder="\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A/\u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 (\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E)",d.type="text",d.placeholder="\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 "+q+" (\u043D\u0435 \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E)",m.textContent="\u0421\u043E\u0437\u0434\u0430\u0442\u044C",h.className="preview-images",e.id="editorjs",e.className="content-editor",q===MATERIAL_CATEGORY.MATERIAL?b.append(c,d,e,f,m):b.append(c,d,e,f,i,h,m);var n={header:{class:Header,inlineToolbar:!0,shortcut:"CMD+SHIFT+H"},list:{class:List,inlineToolbar:!0,shortcut:"CMD+SHIFT+L"},marker:{class:Marker,shortcut:"CMD+SHIFT+M"},delimiter:Delimiter,inlineCode:{class:InlineCode,shortcut:"CMD+SHIFT+C"},linkTool:LinkTool,code:CodeTool,table:{class:Table,inlineToolbar:!0,shortcut:"CMD+ALT+T"},onReady:function a(){console.log("ready")},onChange:function a(){console.log("changed")}};q===MATERIAL_CATEGORY.MATERIAL&&(n.image={class:SimpleImage,inlineCode:!0},n.embed={class:Embed,inlineToolbar:!1,config:{services:{youtube:!0}}});var o=new EditorJS({holder:e,tools:n,data:null});m.addEventListener("click",function(){o.save().then(function(a){j.call(m,c,d,a,h,k)})}),a.Modal.Create("\u0421\u043E\u0437\u0434\u0430\u0442\u044C "+q,b)}function e(){VKKOWork.XHR.POST(f,"/material-get-source/"+this.dataset.link)}function f(b){var c={};try{c.Caption=b.Data.Caption,c.Category=b.Data.Category,c.Link=b.Data.Link,c.Source=JSON.parse(b.Data.Source),c.SourceImages=JSON.parse(b.Data.SourceImages)}catch(b){return a.Utils.logError(b),void VKKOWork.Messenger.Show("\u041E\u0448\u0438\u0431\u043A\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445 \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u0430: "+b)}switch(c.Category){case MATERIAL_CATEGORY.MATERIAL:q=MATERIAL_CATEGORY.MATERIAL;break;case MATERIAL_CATEGORY.NEWS:q=MATERIAL_CATEGORY.NEWS;break;case MATERIAL_CATEGORY.NOTICE:q=MATERIAL_CATEGORY.NOTICE;break;default:return void VKKOWork.Messenger.Show("\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u0430: "+c.Category);}var d=document.createElement("div"),e=document.createElement("input"),f=document.createElement("input"),g=document.createElement("div"),h=document.createElement("div"),j=document.createElement("div"),l=document.createElement("button");e.type="text",e.placeholder="\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A/\u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 (\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E)",e.value=c.Caption,f.disabled=!0,f.type="text",f.value=c.Link,l.textContent="\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F",j.className="preview-images",g.id="editorjs",g.className="content-editor",i(j,c.SourceImages),q===MATERIAL_CATEGORY.MATERIAL?d.append(e,f,g,h,l):d.append(e,f,g,h,j,l);var m={header:{class:Header,inlineToolbar:!0,shortcut:"CMD+SHIFT+H"},list:{class:List,inlineToolbar:!0,shortcut:"CMD+SHIFT+L"},marker:{class:Marker,shortcut:"CMD+SHIFT+M"},delimiter:Delimiter,inlineCode:{class:InlineCode,shortcut:"CMD+SHIFT+C"},linkTool:LinkTool,table:{class:Table,inlineToolbar:!0,shortcut:"CMD+ALT+T"},onReady:function a(){console.log("ready")},onChange:function a(){console.log("changed")}};q===MATERIAL_CATEGORY.MATERIAL&&(m.image={class:SimpleImage,inlineCode:!0},m.embed={class:Embed,inlineToolbar:!1,config:{services:{youtube:!0}}});var n=new EditorJS({holder:g,tools:m,data:JSON.parse(b.Data.Source)});l.addEventListener("click",function(){n.save().then(function(a){k.call(l,e,f,a,j,c.SourceImages)})}),a.Modal.Create("\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C "+q,d)}function g(){var b=document.querySelector(".preview-images");if(!b)return void a.Utils.logWarning("\u042D\u043B\u0435\u043C\u0435\u043D\u0442 [.preview-images] \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D");for(var c=0,d=this.files;c<d.length;c++){var e=d[c],f=document.createElement("div");f.className="image";var g=document.createElement("img");g.src=window.URL.createObjectURL(e),g.alt=e.name,g.height=100;var h=document.createElement("label"),i=document.createElement("input");i.type="radio",i.dataset.image=e.name,i.name="preview-images";var j=document.createElement("span");f.append(g,h),h.append(i,j),b.append(f)}var k=b.querySelector("input");k.click()}function h(a){for(var b=a.split(","),c=0<=b[0].indexOf("base64")?atob(b[1]):decodeURI(b[1]),d=b[0].split(":")[1].split(";")[0],e=new Uint8Array(c.length),f=0;f<c.length;f++)e[f]=c.charCodeAt(f);return new Blob([e],{type:d})}function i(a,b){for(var c=0,d=b;c<d.length;c++){var e=d[c],f=document.createElement("div");f.className="image";var g=document.createElement("img");g.src=e.Thumb,g.height=100,a.append(f)}}function j(b,e,g,j,k){if(!b||!e||!g||!j)return void VKKOWork.Messenger.Show("\u041D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B \u043D\u0435 \u0431\u044B\u043B\u0438 \u043D\u0430\u0439\u0434\u0435\u043D\u044B, \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u043D\u043E\u0432\u043E\u0441\u0442\u044C!");if(0==b.value.length)return void VKKOWork.Messenger.Show("\u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0437\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A!");0==e.value.length&&(e.value=a.Utils.GenerateHash256());for(var l,n={Valid:"true",String:""},o=new Date,p=("00"+(o.getMonth()+1)).slice(-2),m=("00"+o.getDate()).slice(-2),d="image/"+q+"/"+o.getUTCFullYear().toString()+"-"+p+"-"+m+"/",r="thumb/"+q+"/"+o.getUTCFullYear().toString()+"-"+p+"-"+p+"/",s=new FormData,t="",u=0,v=g.blocks;u<v.length;u++)switch(l=v[u],l.type){case"paragraph":t+="<p>"+l.data.text+"</p>",n.String+=l.data.text;break;case"header":t+="<h"+l.data.level+">"+l.data.text+"</h"+l.data.level+">",n.String+=l.data.text;break;case"list":if("ordered"===l.data.style){t+="<ol>";for(var w,x=0,y=l.data.items;x<y.length;x++)w=y[x],t+="<li>"+w+"</li>",n.String+=w;t+="</ol>"}else{t+="<ul>";for(var w,z=0,A=l.data.items;z<A.length;z++)w=A[z],t+="<li>"+w+"</li>",n.String+=w;t+="</ul>"}break;case"delimiter":t+="<hr>";break;case"table":t+="<table>";for(var B,C=0,D=l.data.content;C<D.length;C++){B=D[C],t+="<tr>";for(var E,F=0,G=B;F<G.length;F++)E=G[F],t+="<td>"+E+"</td>",n.String+=E;t+="</tr>"}t+="</table>";break;case"image":var H=a.Utils.GenerateHashDashed(2)+"."+l.data.url.slice(11,l.data.url.indexOf(";"));t+="<a href=\"/"+d+H+"\" data-fslightbox=\""+e.value+"\"><img class=\"material-image\" src=\"/"+r+H+"\" /></a>";var I=document.createElement("div");I.innerHTML=l.data.caption,0<I.textContent.length&&(t+="<div class=\"material-image-caption\">"+l.data.caption+"</div>"),s.append("Files",h(l.data.url),H);break;case"embed":t+="<iframe src=\""+l.data.embed+"\" style=\"width:"+l.data.width+"px; height:"+l.data.height+"px;display:block;margin:40px auto;\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" frameborder=\"0\"></iframe>";var J=document.createElement("div");J.innerHTML=l.data.caption,0<J.textContent.length&&(t+="<div class=\"material-image-caption\">"+l.data.caption+"</div>");}var K=document.createElement("div");K.innerHTML=n.String,n.String=K.textContent,260<n.String.length&&(n.String=n.String.slice(0,260));var L={Valid:"false",String:""},M=[];if(q!=MATERIAL_CATEGORY.MATERIAL){var N=";",O=j.querySelector("input:checked");if(O){var P=O.closest(".image").querySelector("img");P&&(N=P.alt,L.String=r+N.toLowerCase(),L.Valid="true")}if(0<k.files.length){q!=MATERIAL_CATEGORY.NOTICE&&(t+="<div class=\"news-images\">");for(var Q=0;Q<k.files.length;Q++){var R=k.files.item(Q),H=R.name.toLowerCase();H=a.Utils.GenerateHashDashed(2)+H.slice(H.lastIndexOf(".")),N===R.name&&(L.String=r+H),q!=MATERIAL_CATEGORY.NOTICE&&(t+="<a href=\"/"+d+H+"\" data-fslightbox=\""+e.value+"\"><img src=\"/"+r+H+"\" alt=\""+H+"\"></a>"),s.append("Files",R,H),M.push({Image:"/"+d+H,Thumb:"/"+r+H})}q!=MATERIAL_CATEGORY.NOTICE&&(t+="</div>")}}s.set("Caption",b.value),s.set("Link",e.value),s.set("Content",t),s.set("Source",JSON.stringify(g)),s.set("SourceImages",JSON.stringify(M)),s.set("PreviewValid",n.Valid),s.set("PreviewString",n.String),s.set("ImageValid",L.Valid),s.set("ImageString",L.String),s.set("ImagePath",d),s.set("ThumbPath",r);var f=this.closest(".modal").querySelector(".close");VKKOWork.XHR.POST(function(a){a&&"Error"in a&&(null===a.Error?(VKKOWork.Messenger.Show(q+" \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0430"),f.click()):VKKOWork.Messenger.Show("\u0412\u043E\u0437\u043D\u0438\u043A\u043B\u0430 \u043E\u0448\u0438\u0431\u043A\u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u043D\u043E\u0432\u043E\u0441\u0442\u0438."+a.Error))},"/material-insert/"+q,s,null,!0,!0)}function k(b,e,f,g,j){if(!b||!e||!f||!g)return void VKKOWork.Messenger.Show("\u041D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B \u043D\u0435 \u0431\u044B\u043B\u0438 \u043D\u0430\u0439\u0434\u0435\u043D\u044B, \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u043D\u043E\u0432\u043E\u0441\u0442\u044C!");if(0==b.value.length)return void VKKOWork.Messenger.Show("\u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0437\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A!");0==e.value.length&&(e.value=a.Utils.GenerateHash256());var k={Valid:"true",String:""},l=new Date,n=("00"+(l.getMonth()+1)).slice(-2),m=("00"+l.getDate()).slice(-2),d="",o="";q==MATERIAL_CATEGORY.MATERIAL?(d="image/"+q+"/"+l.getUTCFullYear().toString()+"-"+n+"-"+m+"/",o="thumb/"+q+"/"+l.getUTCFullYear().toString()+"-"+n+"-"+n+"/"):0<j.length&&(d=j[0].Image.slice(1,j[0].Image.lastIndexOf("/")+1),o=j[0].Thumb.slice(1,j[0].Thumb.lastIndexOf("/")+1));for(var p,r=new FormData,s="",t=0,u=f.blocks;t<u.length;t++)switch(p=u[t],p.type){case"paragraph":s+="<p>"+p.data.text+"</p>",k.String+=p.data.text;break;case"header":s+="<h"+p.data.level+">"+p.data.text+"</h"+p.data.level+">",k.String+=p.data.text;break;case"list":if("ordered"===p.data.style){s+="<ol>";for(var v,w=0,x=p.data.items;w<x.length;w++)v=x[w],s+="<li>"+v+"</li>",k.String+=v;s+="</ol>"}else{s+="<ul>";for(var v,y=0,z=p.data.items;y<z.length;y++)v=z[y],s+="<li>"+v+"</li>",k.String+=v;s+="</ul>"}break;case"delimiter":s+="<hr>";break;case"table":s+="<table>";for(var A,B=0,C=p.data.content;B<C.length;B++){A=C[B],s+="<tr>";for(var D,E=0,F=A;E<F.length;E++)D=F[E],s+="<td>"+D+"</td>",k.String+=D;s+="</tr>"}s+="</table>";break;case"image":var G=a.Utils.GenerateHashDashed(2)+"."+p.data.url.slice(11,p.data.url.indexOf(";"));s+="<a href=\"/"+d+G+"\" data-fslightbox=\""+e.value+"\"><img class=\"material-image\" src=\"/"+o+G+"\" /></a>";var H=document.createElement("div");H.innerHTML=p.data.caption,0<H.textContent.length&&(s+="<div class=\"material-image-caption\">"+p.data.caption+"</div>"),r.append("Files",h(p.data.url),G);break;case"embed":s+="<iframe src=\""+p.data.embed+"\" style=\"width: "+p.data.width+"px; height: "+p.data.height+"px;\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" frameborder=\"0\"></iframe>";var I=document.createElement("div");I.innerHTML=p.data.caption,0<I.textContent.length&&(s+="<div class=\"material-image-caption\">"+p.data.caption+"</div>");}var J=document.createElement("div");if(J.innerHTML=k.String,k.String=J.textContent,260<k.String.length&&(k.String=k.String.slice(0,260)),q!=MATERIAL_CATEGORY.MATERIAL&&0<j.length){q!=MATERIAL_CATEGORY.NOTICE&&(s+="<div class=\"news-images\">");for(var K=0;K<j.length;K++)q!=MATERIAL_CATEGORY.NOTICE&&(s+="<a href=\""+j[K].Image+"\" data-fslightbox=\""+e.value+"\"><img src=\""+j[K].Thumb+"\" alt=\""+j[K].Image.slice(j[K].Image.lastIndexOf("/")+1)+"\"></a>");q!=MATERIAL_CATEGORY.NOTICE&&(s+="</div>")}r.set("Link",e.value),r.set("Caption",b.value),r.set("Content",s),r.set("Source",JSON.stringify(f)),r.set("PreviewValid",k.Valid),r.set("PreviewString",k.String),r.set("ImagePath",d),r.set("ThumbPath",o);var L=this.closest(".modal").querySelector(".close");VKKOWork.XHR.POST(function(a){a&&"Error"in a&&(null===a.Error?(VKKOWork.Messenger.Show(q+" \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0430"),L.click()):VKKOWork.Messenger.Show("\u0412\u043E\u0437\u043D\u0438\u043A\u043B\u0430 \u043E\u0448\u0438\u0431\u043A\u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u043D\u043E\u0432\u043E\u0441\u0442\u0438."+a.Error))},"/material-update/"+q,r,null,!0,!0)}var l=document.querySelector("#CreateNewsButton");l&&(l.onclick=d);var m=document.querySelector("#CreateNoticeButton");m&&(m.onclick=d);var n=document.querySelector("#CreateMaterialButton");n&&(n.onclick=d);var o=document.querySelector("#EditMaterialButton");o&&(o.onclick=e);var p=document.querySelector("#DeleteMaterialButton");p&&(p.onclick=c);var q=void 0;b.initButton=function(){var a=document.querySelectorAll(".edit-material-button"),b=!0,d=!1,f=void 0;try{for(var g,h,i=a[Symbol.iterator]();!(b=(g=i.next()).done);b=!0)h=g.value,h.onclick=e}catch(a){d=!0,f=a}finally{try{!b&&i.return&&i.return()}finally{if(d)throw f}}var j=document.querySelectorAll(".delete-material-button"),k=!0,l=!1,m=void 0;try{for(var n,o,p=j[Symbol.iterator]();!(k=(n=p.next()).done);k=!0)o=n.value,o.onclick=c}catch(a){l=!0,m=a}finally{try{!k&&p.return&&p.return()}finally{if(l)throw m}}}})(b=a.MaterialEditor||(a.MaterialEditor={}))})(VKKO||(VKKO={}));var VKKO,singIn=document.querySelector(".sign-hide"),isOver=!1,clickCount=0;singIn&&(singIn.onmouseover=function(){isOver=!0,clickCount=0},singIn.onmouseleave=function(){isOver=!1,clickCount=0},singIn.onclick=function(){isOver&&(clickCount++,5==clickCount&&(this.classList.remove("hide"),this.onmouseover=void 0,this.onmouseleave=void 0,this.onclick=VKKO.Main.SignIn))});var AddMaterialButton=document.querySelector("#AddMaterialButton");AddMaterialButton&&(AddMaterialButton.onclick=function(){var a=document.createElement("label"),b=document.createElement("input"),c=document.createElement("button"),d=document.createElement("div");a.textContent="\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B",b.type="text",c.textContent="\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C",c.onclick=function(){VKKOWork.XHR.POST(function(a){"Error"in a&&null==a.Error?VKKOWork.Messenger.Show("\u0421\u0441\u044B\u043B\u043A\u0430 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0430"):VKKOWork.Messenger.Show(a.Error)},"/set-material-list",{Link:b.value}),this.closest(".modal").querySelector(".close").click()},d.append(a,b,c),VKKO.Modal.Create("\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443 \u043D\u0430 \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B \u0432 \u043F\u043E\u043B\u0435\u0437\u043D\u0443\u044E \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044E",d)});function printTable(){var a=document.getElementById("ManageOrderPacient"),b=window.open("","new div","height=877,width=1200");b.document.write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title></title>"),b.document.write("<style>\n table {\n width: 100%;\n }\n table td {\n border: 1px solid #ccc7c7;\n -webkit-border-radius: 5px;\n border-radius: 5px;\n padding: 5px 15px 15px 5px;\n text-align: left;\n vertical-align: top;\n }\n </style></head>"),b.document.write("<body>"+a.outerHTML+"</body></html>"),b.document.close(),b.focus(),b.print()}
|