src/ZKEACMS.WebHost/wwwroot/js/admin.min.js

(完整代码) 8KB

/*! http://www.zkea.net/
 * Copyright (c) ZKEASOFT. All rights reserved.
 * http://www.zkea.net/licenses */
$((function(){function popoverImage(ele){$("input.select-image",ele).popover({trigger:"focus",html:!0,title:"图片预览",content:function(){var url=$(this).val();return url?(0===url.indexOf("~")&&(url=url.replace("~",location.origin)),"<div style='width:244px;'><img src='"+url+"'/></div>"):null},placement:"bottom"}).trigger("change").parent().addClass("loading")}if($(".accordion-group>a").click((function(){var className="active",a=$(this),div_inner=a.nextAll(".accordion-inner");return a.hasClass("active")?(a.removeClass("active"),div_inner.hide(200)):(a.addClass("active"),div_inner.show(200)),!1})),$(document).on("click",".cancel",(function(){window.history.back()})).on("click",".publish",(function(){return!!confirm("确认要发布吗?")})).on("click","input[type=submit]",(function(){return $("#ActionType").val($(this).data("value")),!0})).on("click",".input-group .glyphicon.glyphicon-search",(function(){var obj=$(this);window.top.Easy.ShowUrlWindow({url:obj.parent().siblings("input.form-control").data("url"),width:obj.parent().siblings("input.form-control").data("width")||800,onLoad:function(box){var win=this;$(this.document).find("#confirm").click((function(){var target=obj.parent().siblings("input.form-control"),selectValue=win.GetSelected();if("object"==typeof selectValue){if(target.val(selectValue.value),selectValue.additional){var form=target.closest("form"),nameArray=target.attr("name").split(".");for(var p in selectValue.additional)if(selectValue.additional.hasOwnProperty(p)){nameArray[nameArray.length-1]=p;var name=nameArray.join(".");$('[name="'+name+'"]',form).val(selectValue.additional[p])}}}else target.val(selectValue);box.close(),target.trigger("change")})),$(this.document).on("click",".confirm",(function(){var target=obj.parent().siblings("input.form-control");target.val($(this).data("result")),box.close(),target.trigger("change")}))}})})).on("click",".form-group select#ZoneId",(function(){var obj=$(this);if("ZONE-X"!=obj.val()){var url="/admin/Layout/SelectZone?layoutId="+$(".hide #LayoutId").val()+"&pageId="+$(".hide #PageId").val()+"&zoneId="+obj.val();window.top.Easy.ShowUrlWindow({url:url,width:1e3,title:"选择区域",onLoad:function(box){var win=this;$(this.document).find("#confirm").click((function(){obj.val(win.GetSelected()),box.close()}))}})}})).on("click",".custom-style-editor",(function(){window.top.Easy.ShowUrlWindow({url:"/admin/StyleEditor/Edit",width:1024,title:"编辑样式",onLoad:function(box){box.addClass("loaded")},isDialog:!1}),$(".WeiWindow.BoxShadow").addClass("StyleEditor")})).on("click",".form-group select.select",(function(){var obj=$(this);window.top.Easy.ShowUrlWindow({url:obj.data("url")+"?selected="+obj.val(),width:obj.data("width")||800,onLoad:function(box){var win=this;$(this.document).find("#confirm").click((function(){obj.val(win.GetSelected()),box.close(),obj.trigger("change")})),$(this.document).on("click",".confirm",(function(){obj.val($(this).data("result")),box.close(),obj.trigger("change")}))}})})).on("submit","form",(function(){Easy.Block()})),$(".form-group select#ZoneId,.form-group select.select").on("mousedown",!1),$(".form-group select#ZoneId").each((function(){"ZONE-X"==$(this).val()&&$(this).closest(".form-group").hide()})),$.fn.datetimepicker&&$(".Date:not(input[type=hidden])").each((function(){$(this).prop("readonly")||$(this).prop("disabled")||($(this).datetimepicker({locale:"zh-CN",format:$(this).attr("JsDateFormat")}),$(this).closest(".input-group").find(".glyphicon-calendar").click((function(){$(this).closest(".input-group").find("input").focus()})))})),$(document).on("click",".nav.nav-tabs a",(function(){return $(this).tab("show"),!1})),$(".nav.nav-tabs").each((function(){var shown=!1;$("li",this).each((function(){$(this).hasClass("active")&&($(this).removeClass("active"),$("a",this).tab("show"),shown=!0)})),shown||($("li:first a",this).tab("show"),location.hash&&$("li a[href='"+location.hash+"']",this).tab("show"))})),$("#StyleClass.form-control").popover({trigger:"focus",html:!0,title:"自定义样式用法",content:function(){for(var activeClass=[{name:"边框",value:"border"},{name:"文字居中",value:"align-center"},{name:"文字右对齐",value:"align-right"},{name:"图片边框",value:"image-border"},{name:"阴影",value:"box-shadow"},{name:"图片圆形",value:"image-circle"},{name:"取消外边距",value:"full"},{name:"居中容器",value:"container"}],html="<p clss='text-nowrap'>直接写样式例:<code>style=\"color:#fff\"</code></p><p>预定义样式:<ol>",i=0;i<activeClass.length;i++)html+="<li>"+activeClass[i].name+":<code>"+activeClass[i].value+"</code></li>";return html+="</ol></p>"},placement:"bottom"}),$(document).on("change","input.select-image",(function(){var url=$(this).val();url&&0!=url.indexOf("~/")&&0!=url.indexOf("/")&&0!=url.replace("http://","").replace("https://","").indexOf(window.location.hostname)?0==$(this).siblings(".image-local").length&&$('<div class="input-group-addon image-local"><span class="glyphicon glyphicon-floppy-open upload-external"></span></div>').insertAfter($(this)):$(this).siblings(".image-local").remove()})),$(document).on("list.added",(function(e){popoverImage(e.target)})),popoverImage(document),$(document).on("click",".image-local .upload-external",(function(){var group=$(this).closest(".input-group");group.addClass("processing"),$.post("/admin/Media/DownLoadExternalImage",{images:[group.find("input").val()]},(function(data){if(data)for(var i=0;i<data.length;i++)group.find("input").val(data[i].value).trigger("change");group.removeClass("processing")}),"json")})),document.addEventListener){function sliceUpload(target,file,start,result){var url="/admin/media/upload";start>0&&(url="/admin/media/appendfile");var end=start+1e6;end>file.size&&(end=file.size),target.parentNode.classList.add("processing"),target.value="...";var xhr=new XMLHttpRequest;xhr.open("POST",url),end==file.size?xhr.onload=function(data){target.parentNode.classList.remove("processing");var result=JSON.parse(data.target.response);result.id&&(target.value="~"+result.url,$(target).blur().focus())}:xhr.onload=function(e){var result=JSON.parse(e.target.response);result&&sliceUpload(target,file,end,result)},xhr.onerror=function(){target.parentNode.classList.remove("processing"),target.value="Error!"};var formData=new FormData;formData.append("file",file.slice(start,end),file.name),formData.append("folder","Images"),formData.append("size",file.size),result&&(formData.append("id",result.id),formData.append("position",start)),xhr.send(formData)}document.addEventListener("paste",(function(e){if(e.target.className&&e.target.className.indexOf("select-image")>=0){var target=e.target,cbData;if(e.clipboardData?cbData=e.clipboardData:window.clipboardData&&(cbData=window.clipboardData),cbData&&cbData.items)for(var i=0;i<cbData.items.length;i++)if(-1!==cbData.items[i].type.indexOf("image")){var file;sliceUpload(target,cbData.items[i].getAsFile(),0);break}}}))}$(".input-group .glyphicon.glyphicon-play").click((function(){var url=$(this).closest(".input-group").find(".form-control").val();url&&(0===url.indexOf("~")&&(url=url.replace("~",location.origin)),Easy.ShowUrlWindow({url:"/admin/widget/playvideo?url="+encodeURIComponent(url),width:800,height:450}))}));var mainMenu=$("#main-menu");if(mainMenu.length>0){var currentSelect,match=0;$("a.menu-item",mainMenu).each((function(){var href=$(this).attr("href");href&&0===location.pathname.toLocaleLowerCase().indexOf(href.toLowerCase())&&href.length>match&&(currentSelect=$(this),match=href.length)})),currentSelect&&currentSelect.size()&&(currentSelect.addClass("active"),currentSelect.parent().hasClass("accordion-inner")&&(currentSelect.parent().show(),currentSelect.parent().prev().addClass("active")));var scroll=$(".menu-item.active",mainMenu).offset().top-mainMenu.offset().top,leftMenu=document.querySelector("#left-menu");function setHeight(){leftMenu.style.height=window.innerHeight-133+"px"}setHeight();var scrollBar=window.Scrollbar.init(leftMenu);$(window).on("resize",(function(){Easy.Processor(setHeight,500)})),scroll>0&&(scrollBar.scrollTop=scroll/2)}$.fn.select2&&$("select[multiple='multiple']").select2(),$(".dy-editor:visible").trigger("init-editor")}));

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。