function footerinit(){ footerdrag(); footerresize(); $.showSiteFooterTips(); $('.full_column').each(function(){ fullcolumninit($(this)); }) } function fullcolumninit(dom){ dom.children('.full_width').css({left:0-canv.offset().left-$.parseInteger($('#canvas').css("borderLeftWidth")),width:$('#scroll_container_bg').width()}); dom.wp_rightkey(); if(dom.is(':not(.isplate)')){ fullcolumndrag(dom); fullcolumnresize(dom); fullcolumndrop(dom); } } function footerdrag(){ var maxminusheight=0; var curcanvheight=canv.height(); var Command=Undo.Command.createModuleCommand(function(blockid,val){ var blockel=$('#'+blockid); blockel.css('top',val.top); canv.height(val.canvheight); $('#scroll_container_bg').css('height',(val.canvheight+blockel.height())+'px'); $.updateselectbgopt(); $.updatepospropblk(); $.canvasHeightChange(); },null,{returntype:'class'}); var undoobj=null; $('#site_footer').draggable({ cursor: 'move', axis: "y", start: function(event, ui){ initCanvasHeight(); var canvasminheight=canv.data('layermaxheight')||0; curcanvheight=canv.height(); maxminusheight=curcanvheight-canvasminheight; undoobj=new Command('site_footer'); undoobj.setOldVal({top:$.parseInteger($(this).css('top')),canvheight:curcanvheight}); }, drag: function(event, ui){ var topmovepx = ui.position.top - ui.originalPosition.top; if(topmovepx<0){ var delta=0-topmovepx; if(delta>maxminusheight){ var canvasminheight=canv.data('layermaxheight')||0; ui.position.top=ui.originalPosition.top-maxminusheight; canv.height(canvasminheight); $('#scroll_container_bg').css('height',(canvasminheight+$(this).height()+100)+'px'); $.showselectbgopt($(this)); $(this).triggerHandler('drag_progress',[{left:0,top:ui.position.top}]); return; } } $(this).triggerHandler('drag_progress',[{left:0,top:ui.position.top}]); canv.height(curcanvheight+topmovepx); $.showselectbgopt($(this)); $('#scroll_container_bg').css('height',(curcanvheight+topmovepx+$(this).height()+100)+'px'); }, stop:function(event, ui){ var topmovepx = ui.position.top - ui.originalPosition.top; canv.height(curcanvheight+topmovepx); $('#scroll_container_bg').css('height',(curcanvheight+topmovepx+$(this).height()+100)+'px'); $.canvasHeightChange(); correctFooterPos(); undoobj.insertWithNewVal({top:$.parseInteger($(this).css('top')),canvheight:curcanvheight+topmovepx}); undoobj=null; $(this).trigger('drag_stop',[{left:parseInt($(this).css('left')),top:parseInt($(this).css('top'))}]); } }); } function fullcolumndrag(dom){ dom.wp_drag(); } function fullcolumnresize(dom){ var createhandlefunc=function(handle){ dom.each(function(){ var hname = 'ui-resizable-'+handle; var axis = $('

'); axis.css({zIndex: 1000}); $(this).children('.full_width').append(axis); }) } var createplaceholderfunc=function(handle){ dom.each(function(){ var hname = 'placeholder-'+handle; var axis = $('
'); axis.css({zIndex: 1000}).hide(); $(this).children('.full_width').append(axis); }) } createhandlefunc('n'); createhandlefunc('s'); createplaceholderfunc('w'); createplaceholderfunc('e'); var fullcolumnbuttompos; dom.resizable({ handles: {n: '>.full_width .ui-resizable-n',s: '>.full_width .ui-resizable-s'}, noinit:true, canvascontain: '#canvas', distance: 0, concernLock:true, scroll: true, create:function(){ $(this).children('.full_width').find('.ui-resizable-handle').hide(); }, start: function(event, ui){ fullcolumnbuttompos=$.getFullColChildMaxButtom(dom); var self=$(this); var resizeundo=new ResizeCommand(self.attr('id')); var oldcssarr=['top','height']; var oldval={}; for(var i=0;i

'); axis.css({zIndex: 1000}); $('#site_footer >.full_width').append(axis); } var createplaceholderfunc=function(handle){ var hname = 'placeholder-'+handle; var axis = $('
'); axis.css({zIndex: 1000}); $('#site_footer> .full_width').append(axis); } createhandlefunc('n'); createhandlefunc('s'); createplaceholderfunc('w'); createplaceholderfunc('e'); var maxminusheight=0; var curcanvheight=canv.height(); var canvasminheight=0; var Command=Undo.Command.createModuleCommand(function(blockid,val){ var blockel=$('#'+blockid); blockel.css('top',val.top); blockel.css('height',val.height); canv.height(val.canvheight); blockel.children('.full_content,.full_width').height(val.height); $('#scroll_container_bg').css('height',(val.canvheight+blockel.height())+'px'); $.updateselectbgopt(); $.updatepospropblk(); $.canvasHeightChange(); },null,{returntype:'class'}); var undoobj=null; var resizertimer=null; $('#site_footer').resizable({ handles: {n: '>.full_width .ui-resizable-n',s: '>.full_width .ui-resizable-s'}, noinit:true, distance: 0, scroll: true, create:function(){ $(this).children('.full_width').find('.ui-resizable-handle').hide(); }, start: function(event, ui){ initCanvasHeight(); if(resizertimer){ clearTimeout(resizertimer); resizertimer=null; } canvasminheight=canv.data('layermaxheight')||0; curcanvheight=canv.height(); maxminusheight=curcanvheight-canvasminheight; undoobj=new Command('site_footer'); undoobj.setOldVal({top:$.parseInteger($(this).css('top')),canvheight:curcanvheight,height:$(this).height()}); $(this).triggerHandler('resize_progress',[{ui:ui}]); }, resize: function(event, ui){ var resizeobj=$(this).data('resizable'); var theaxis=resizeobj.axis; if(theaxis=='n'){ var changey= $(this).height()-ui.originalSize.height; if(changey>maxminusheight){ var mintop=canvasminheight; $(this).css({top:mintop,height:ui.originalSize.height+maxminusheight}); var oriscrolltop=$(this).data('resize_oriscrolltop'); $(this).scrollParent().scrollTop(oriscrolltop); $(this).children('.full_content,.full_width').height($(this).height()); canv.height(canvasminheight); $('#scroll_container_bg').css('height',(canvasminheight+$(this).height()+100)+'px'); $.showselectbgopt($(this)); return; } canv.height(curcanvheight-changey); $(this).children('.full_content,.full_width').height($(this).height()); $('#scroll_container_bg').css('height',(canv.height()+$(this).height()+100)+'px'); }else{ $(this).children('.full_content,.full_width').height($(this).height()); $('#scroll_container_bg').css('height',(canv.height()+$(this).height()+100)+'px'); } $.showselectbgopt($(this)); $(this).triggerHandler('resize_stop',[{ui:ui}]); }, stop:function(event, ui){ var self=$(this); undoobj.insertWithNewVal({top:$.parseInteger(self.css('top')),canvheight:canv.height(),height:self.height()}); undoobj=null; $.canvasHeightChange(); } }); } function fullcolumndrop(dom){ var createplaceholderfunc=function(handle){ dom.each(function(){ var hname = 'placeholder-'+handle; var axis = $('
'); axis.css({zIndex: 1000}); $(this).children('.full_content').append(axis); }) } createplaceholderfunc('n'); createplaceholderfunc('s'); createplaceholderfunc('w'); createplaceholderfunc('e'); var contentblock=dom.children('.full_content'); contentblock.children('.li-placeholder').hide(); contentblock.children('.placeholder-n').css({'border-top':'#FF9900 dashed 4px'}); contentblock.children('.placeholder-s').css({'border-bottom':'#FF9900 dashed 4px'}); contentblock.children('.placeholder-e').css({'border-right':'#FF9900 dashed 4px'}); contentblock.children('.placeholder-w').css({'border-left':'#FF9900 dashed 4px'}); contentblock.droppable({ tolerance: 'pointer', accept:'.full_column,.cstlayer', drop: function( event, ui ) { var draggable = $.ui.ddmanager.current; if($.getElementAreaInf($(draggable.element))==$.getElementAreaInf(dom)){ if(!dom.hasClass('ui-modselected')){ $(this).children('.li-placeholder').hide(); var existcolumn=$(document).data('layer_final_drop_id'); var biggercolumn=$.chooseBiggerColumn(existcolumn,dom.attr('id')); $(document).data('layer_final_drop_id',biggercolumn); } } }, over: function(event, ui){ //判断是否包含锁定元素 var has_layer_lock=false; $('.ui-modselected').each(function(){ if($(this).data('cstlayerstatus') == 'unlock' ){ has_layer_lock=true; } }); if(has_layer_lock) return; var draggable = $.ui.ddmanager.current; if($.getElementAreaInf($(draggable.element))==$.getElementAreaInf(dom)){ if(!dom.hasClass('ui-modselected')){ var thisid=dom.attr('id'); var existid=$(document).data('layer_drop_over_id'); if(thisid != existid){ var biggerid=$.chooseBiggerColumn(existid,thisid); if(biggerid == thisid){ var $this=$(this); $(this).children('.li-placeholder').show(); if(existid){ var existcolumnel = $('#'+existid); var dropobj=existcolumnel.children('.full_content').data('droppable'); dropobj['isover'] = 0; dropobj['isout'] = 1; dropobj._out.call(dropobj, event); } $(document).data('layer_drop_over_id', thisid); }else{ var dropobj1=$(this).data('droppable'); dropobj1['isover'] = 0; dropobj1['isout'] = 1; } } } } }, out: function(event, ui){ //判断是否包含锁定元素 var has_layer_lock=false; $('.ui-modselected').each(function(){ if($(this).data('cstlayerstatus') == 'unlock' ){ has_layer_lock=true; } }); if(has_layer_lock) return; var draggable = $.ui.ddmanager.current; if($.getElementAreaInf($(draggable.element))==$.getElementAreaInf(dom)){ if(!dom.hasClass('ui-modselected') ){ $(this).children('.li-placeholder').hide(); var curoverid=$(document).data('layer_drop_over_id'); if(curoverid == dom.attr('id')) $(document).removeData('layer_drop_over_id'); } } } }); } function fullcolumn_propblk_init(){ var lvtimer; for(var key in $.backgroundPropDefaults){ (function(){ var curkey=key; var otherfunc=null; if($.inArray(curkey,['bg_moveto_prevop','bg_moveto_nextop']) != -1){ var innertxt ='', lvtype = ''; switch(curkey){ case 'bg_moveto_prevop': lvtype = 'top'; innertxt = '
 
'; break; case 'bg_moveto_nextop': lvtype = 'bottom'; innertxt = '
 
'; break; } otherfunc={ mousedown:function(){ var $target = $(this) var apos =$target.offset(); var scrollctner=$('#scroll_container'); var scrolltop=scrollctner.scrollTop(); $(innertxt).appendTo(scrollctner).css({ top: function(){ return (apos.top+scrolltop - 25-39)+'px' },left: apos.left+'px' }).click(function(e){ $('#'+$.bgselectedid).wp_setorder(lvtype,$.bgselectedid); $(this).remove(); $target.removeClass('local'); e.preventDefault(); }); }, mouseup:function(){ } } } $('#'+curkey).mousedown(function(e){ var $target = $(this); $target.addClass('local'); if($('.wp-moveto_fstlevel,.wp-moveto_lstlevel').size()) $('.wp-moveto_fstlevel,.wp-moveto_lstlevel').remove(); if(otherfunc != null){ otherfunc.mousedown.apply(this); } e.preventDefault(); }).mouseup(function(e){ var self = this,$target = $(self); $target.removeClass('local'); $.backgroundPropDefaults[curkey].apply(this); if(otherfunc != null){ otherfunc.mouseup.apply(this); } e.preventDefault(); }) })(); } } (function($){ function getAllParents(el){ var parents={}; parents[el.prop('id')]='null'; var curel=el; while(true){ var parentid=$.getElementFatherid(curel); if(parentid =='none') break; parents[parentid]=curel.prop('id'); curel=$('#'+parentid); } return parents; } $.chooseBiggerColumn=function(existcolumnid,newcolumnid){ var biggercolumnid=newcolumnid; if(existcolumnid==newcolumnid) return biggercolumnid; if(existcolumnid){ var existcolumnel=$('#'+existcolumnid); var newcolumnel=$('#'+newcolumnid); var existcolumnfathers=getAllParents(existcolumnel); var newcolumnfathers=getAllParents(newcolumnel); var rootid='canvas'; if(!existcolumnfathers[rootid]) rootid='site_footer'; var existdifffather=rootid; var newdifffather=rootid; while(existdifffather == newdifffather){ existdifffather =existcolumnfathers[existdifffather]; newdifffather =newcolumnfathers[newdifffather]; if(existdifffather=='null' || newdifffather=='null') break; } if(existdifffather=='null') biggercolumnid=newcolumnid; else if(newdifffather=='null') biggercolumnid=existcolumnid; else{ var existfatherzindex=$.parseInteger($('#'+existdifffather).css('z-index')); var newfatherzindex=$.parseInteger($('#'+newdifffather).css('z-index')); if(existfatherzindex > newfatherzindex) biggercolumnid=existcolumnid; } } return biggercolumnid; } $.transferToColumn=function(dom,fathercolid){ var oldfatherid=$.getElementFatherid(dom); if(oldfatherid!=fathercolid){ var newfatherel=$('#'+fathercolid); var domabpos=dom.ab_pos('top'); var newfatherabpos=newfatherel.ab_pos('top'); var contentblock=newfatherel; if(fathercolid!='canvas') contentblock=newfatherel.children('.full_content'); dom.detach().attr('fatherid',fathercolid).css('top',(domabpos-newfatherabpos)).appendTo(contentblock); if(fathercolid=='site_footer'||fathercolid=='canvas') dom.removeAttr('fatherid'); } } $.getElementAreaInf=function(dom){ return dom.attr('inbuttom')=='1'?'site_footer':'canvas'; } $.transferToArea=function(dom,from,to,isInUndo){ var domabpos=dom.ab_pos('top'); var footertop=$.parseInteger($('#site_footer').css('top')); if(to=='site_footer'){ var curmodtop=domabpos-footertop; dom.css('top',curmodtop); dom.attr('inbuttom','1'); dom.detach().removeAttr('fatherid').appendTo($('#site_footer').children('.full_content')); if(dom.hasClass('full_column')) dom.find('.cstlayer,.full_column').attr('inbuttom','1'); }else{ var curmodtop=domabpos+footertop; dom.css('top',curmodtop); var canvheight=$('#canvas').height(); if(canvheight"+translate("Request failed!")); return false; } }); } $.curSelectableFather=function(){ var selmods=$('.ui-modselected'); if(selmods.length==0){ $(document).data('cur_selectable_father',null); return null; }else{ var fatherid=$.getElementFatherid(selmods.filter(':first')); $(document).data('cur_selectable_father',fatherid); return fatherid; } } $.getElementFatherid=function(dom){ if(dom.prop('id')=='canvas'||dom.prop('id')=='site_footer') return 'none'; var fatherid=dom.attr('fatherid'); if(!fatherid||fatherid==''){ if(dom.closest('#canvas').length>0){ fatherid='canvas'; }else if(dom.closest('#site_footer').length>0){ fatherid='site_footer'; } } return fatherid; } $.fn.ab_pos=function(direct){ var dom=$(this); if(dom.prop('id')=='canvas'||dom.prop('id')=='site_footer') return 0; if(direct=='left'||direct=='top'){ if(!dom.attr('fatherid')||dom.attr('fatherid')=='') return dom.rel_pos(direct); return dom.rel_pos(direct)+$('#'+dom.attr('fatherid')).ab_pos(direct); } } $.fn.ab_pos_cnter=function(direct){ var abpos=$(this).ab_pos(direct); if($(this).closest('#site_footer').length>0&&direct=='top'){ return abpos+$.parseInteger($('#site_footer').css(direct)); } return abpos; } $.fn.rel_pos=function(direct){ if(direct=='left'||direct=='top'){ return $.parseInteger($(this).css(direct)); } } $.getFullColChildMaxButtom=function(dom){ var parenttoppos=dom.ab_pos_cnter('top'); var maxbuttompos=parenttoppos; dom.find('.cstlayer,.full_column').each(function(){ var el=$(this); var buttompos=0; if(el.hasClass('cstlayer')) buttompos=$.divrotate.getDegreeModMaxPoint(el,null,'buttom'); else buttompos=el.ab_pos_cnter('top')+$.parseInteger(el.css('height')); if(maxbuttompos