draw.js 2.5 KB

1
  1. $(function(){var f=!1,a=null,e=$("\x3cdiv style\x3d'background-color:#fff;display:none;margin-bottom:8px;' id\x3d'zwfpos'\x3e\x3c/div\x3e");$.fn.bindDraw=function(d){$(this).mousedown(function(b){if(!$("#kskm_titleinput").attr("disabled")){var c=$(this).parents(d.drawSelect).first()[0];a=c;a.selector=d.drawSelect;if(!$("#pup_upbox").is(":visible")){f=!0;$(c).after(e);e.show().css({height:$(c).height(),width:$(c).width()});$(c).css({position:"absolute",opacity:.5,width:$(c).width(),zIndex:99,marginLeft:0,left:$(c).offset().left,top:$(c).offset().top}).attr("initLeft",$(c).offset().left);$(b.srcElement||b.target).parent().parent().addClass("input_blue");var h=$(c).offset();c.pos={left:b.clientX-h.left,top:b.clientY-h.top+$(window).scrollTop()};$(c).find("[contenteditable]").blur();$("body").append(c);b.cancelBubble?b.cancelBubble=!0:b.stopPropagation();return!1}}}).parent().parent().mouseup(function(b){f&&(f=!1,$("#zwfpos").is(":visible")&&(e.after(a),$("body").append(e.hide()),$(a).css({position:"",opacity:"",marginLeft:"",width:"",top:"",left:""}),a.style.zoom="",window.IS_MOVE&&(window.moveData&&window.moveData(a),window.IS_MOVE=!1)),$(".input_blue").removeClass("input_blue").find("input").css("-webkit-user-select",""))})};$(document).mousemove(function(d){if(f){var b=$(window).scrollTop();$(a).css({left:d.clientX-a.pos.left,top:d.clientY-a.pos.top+b});var c=d.clientY-a.pos.top+b;e.siblings(a.selector).each(function(a,b){var d=$(this).offset().top;if(d>c+20&&0==a)return $(this).before(e),window.IS_MOVE=!0,!1;if(c<d&&c>d-$(this).height()/2)return $(this).after(e),window.IS_MOVE=!0,!1});return!1}})});function animate(f,a,e,d,b,c,h){var g=$.browser;if(g.mozilla)a="-moz-"+a;else if(g.safari)a="-webkit-"+a;else if(g.msie&&0<=navigator.appVersion.indexOf("MSIE 9.0"))a="-ms-"+a;else{"function"==typeof c&&c();return}b+=b%15;g=parseFloat(e.substring(e.indexOf("(")+1,e.indexOf(")")));d=parseFloat(d.substring(d.indexOf("(")+1,d.indexOf(")")));var n=(d-g)/b*15,k="",l=e.replace(/\([\d\.]+\)/,"(-)").split("-");0<e.indexOf("deg")&&(k="deg",l=e.replace(/\([\d\.]+deg\)/,"(-)").split("-"));a={start:e,startNum:g,endNum:d,step:n,i:0,time:15,attr:a,speed:b,clearId:null,tmpArrs:l,startNum2:g};h||(a.endNum>=a.startNum?f.css("opacity","0").fadeTo(b,1):f.fadeTo(b,0));var m=function(a){if(a.i*a.time>a.speed)"function"==typeof c&&c();else{var b=a.startNum2+a.step;a.startNum2=b;a.endNum>=a.startNum?b>a.endNum&&(b=a.endNum):b<a.endNum&&(b=a.endNum);b+=k;f.css(a.attr,a.tmpArrs[0]+b+a.tmpArrs[1]);a.clearId=setTimeout(function(){m(a)},a.time);a.i++}};clearTimeout(a.clearId);m(a)};