"use strict";$(function(){$("#side-menu>li:eq(8)").addClass("active"),Array.prototype.slice.call(document.querySelectorAll(".js-switch")).forEach(function(t){new Switchery(t,{color:"#1AB394",size:"small"})}),$("#Editorlist").selectlist("selectByValue",$("#Editor").val()),$(document).on({change:function(){$(this).prev(":hidden").val(this.checked)}},".js-switch"),$(".fileupload").fileupload({url:"/admin/uploadimg",dataType:"text",done:function(t,e){if(e.result){var i="/static/images/"+JSON.parse(e.result).files[0].name;$(this).prev("img").attr("src",i),$(this).next(":hidden").val(i)}}}),$("#btnSave").on("click",function(){var t=$(this);t.attr("disabled","disabled"),$.ajax({url:$("#postForm")[0].action,type:$("#postForm")[0].method,data:$("#postForm").serialize(),success:function(){swal({title:"保存成功！",type:"success",showConfirmButton:!1,timer:2e3})},error:function(){swal({title:"保存失败！",type:"error",showConfirmButton:!1,timer:2e3})},complete:function(){t.removeAttr("disabled")}})})});