UNPKG

dzxstatic

Version:

The static files of Discuz! X

1 lines 2.46 kB
var drag=new Drag;drag.extend({getBlocksTimer:"",blocks:[],blockDefaultClass:[],frameDefaultClass:[],setSampleMenu:function(){this.addMenu("block","数据",'drag.openBlockEdit(event,"data")'),this.addMenu("block","更新","drag.blockForceUpdate(event)")},openBlockEdit:function(e,t){t="data"==t?"data":"block";var i=(e=Util.event(e)).aim.id.replace("cmd_portal_block_","");this.removeMenu(),showWindow("showblock","portal.php?mod=portalcp&ac=block&op="+t+"&bid="+i+"&tpl="+document.diyform.template.value,"get",-1)},getBlockData:function(e){var t=this.dragObj.id,i=t;return-1!=t.indexOf("portal_block_")?i=0:t=0,showWindow("showblock","portal.php?mod=portalcp&ac=block&op=block&classname="+e+"&bid="+t+"&eleid="+i+"&tpl="+document.diyform.template.value,"get",-1),drag.initPosition(),this.fn="",!0},stopSlide:function(e){if("undefined"==typeof slideshow||void 0===slideshow.entities)return!1;var t=$C("slidebox",$(e));if(t&&t.length>0&&t[0].id){var i=slideshow.entities[t[0].id].timer;i&&clearTimeout(i),slideshow.entities[t[0].id]=""}},init:function(e){return this.initCommon(),$("samplepanel").innerHTML='可直接管理模块数据 [<a href="javascript:;" onclick="spaceDiy.cancel();return false;" class="xi2">退出</a>]',this.setSampleMode(e),this.initSample(),!0},setClose:function(){},blockForceUpdate:function(e,t){if("string"!=typeof e)var i=(e=Util.event(e)).aim.id.replace("cmd_","");else i=e;if(null==$(i))return!1;var n=i.replace("portal_block_",""),o=$(i+"_content");o||((o=document.createElement("div")).id=i+"_content",o.className=this.contentClass),this.stopSlide(i);var a=Util.getFinallyStyle(o,"height");o.style.lineHeight="auto"==a?"":"0px"==a?"20px":a;var l=o.innerHTML;o.innerHTML="<center>正在加载内容...</center>",(new Ajax).get("portal.php?mod=portalcp&ac=block&op=getblock&forceupdate=1&inajax=1&bid="+n+"&tpl="+document.diyform.template.value,(function(e){if(-1!=e.indexOf("errorhandle_"))o.innerHTML=l,runslideshow(),showDialog("抱歉,您没有权限添加或编辑模块","alert"),doane();else{var n=document.createElement("div");n.innerHTML=e,o.parentNode.removeChild(o),$(i).innerHTML=n.childNodes[0].innerHTML,evalscript(e),-1!=e.indexOf("runslideshow()")&&runslideshow(),drag.initPosition(),t&&drag.getBlocks()}}))}});var spaceDiy=new DIY;function succeedhandle_diyform(e,t,i){return"1"==i.rejs&&(document.diyform.rejs.value="",parent.$("preview_form").submit()),spaceDiy.enablePreviewButton(),!1}spaceDiy.init(1);