您的位置:68399皇家赌场 > 企业邮局 > 【澳门皇家赌场】QQ邮箱的壹个文本编辑器代码

【澳门皇家赌场】QQ邮箱的壹个文本编辑器代码

发布时间:2019-11-24 03:14编辑:企业邮局浏览(154)

    /* *JavaScriptVirtualKeyboard(ATM-stylenumpadvariant),version2.3 * *Copyright2006-2007DmitriyKhudorozhkov * *Thissoftwareisprovided"as-is",withoutanyexpressorimpliedwarranty. *Innoeventwilltheauthorbeheldliableforanydamagesarisingfromthe *useofthissoftware. * *Permissionisgrantedtoanyonetousethissoftwareforanypurpose, *includingcommercialapplications,andtoalteritandredistributeit *freely,subjecttothefollowingrestrictions: * *1.Theoriginofthissoftwaremustnotbemisrepresented;youmustnot *claimthatyouwrotetheoriginalsoftware.Ifyouusethissoftware *inaproduct,anacknowledgmentintheproductdocumentationwouldbe *appreciatedbutisnotrequired. * *2.Alteredsourceversionsmustbeplainlymarkedassuch,andmustnotbe *misrepresentedasbeingtheoriginalsoftware. * *3.Thisnoticemaynotberemovedoralteredfromanysourcedistribution. * *-DmitriyKhudorozhkov,kh_dmitry2001@mail.ru */ functionVATMpad(container_id,callback_ref,font_name,font_size, font_color,bg_color,key_color,border_color, show_click,click_font_color,click_bg_color, click_border_color,do_embed) { returnthis._construct(container_id,callback_ref,font_name,font_size, font_color,bg_color,key_color,border_color, show_click,click_font_color,click_bg_color, click_border_color,do_embed); } VATMpad.prototype={ kbArray:[], _setup_event:function(elem,eventType,handler) { return(elem.attachEvent?elem.attachEvent("on" eventType,handler):((elem.addEventListener)?elem.addEventListener(eventType,handler,false):null)); }, _start_flash:function { functiongetColor { if,s//trytodetectMozilla-stylergbvalue. { switch { case1:returnparseInt; case2:returnparseInt; case3:returnparseInt; default:return0; } } else//standardway returnstr.length==4?parseInt str.substr:parseInt,16); } functiongetR {returngetColor;} functiongetG {returngetColor;} functiongetB {returngetColor;} varel=in_el.time?in_el:(in_el.company&&in_el.company.time?in_el.company:null); if { el.time=0; clearInterval; } varvkb=this; varftc=vkb.fontcolor,bgc=vkb.keycolor,brc=vkb.bordercolor; //Specialfixesforsimple/dead/modifierkeys: if ftc=vkb.deadcolor; if(((in_el.innerHTML=="Shift")&&vkb.Shift)||((in_el.innerHTML=="Caps")&&vkb.Caps)||((in_el.innerHTML=="AltGr")&&vkb.AltGr)) bgc=vkb.lic; //Extractbasecolorvalues: varfr=getR,fb=getB,kg=getG; varbr=getR,bb=getB; //Extractflashcolorvalues: varf_r=getR,f_g=getG,f_b=getB; vark_r=getR,k_g=getG,k_b=getB; varb_r=getR,b_g=getG,b_b=getB; var_shift_colors=function() { functiondec2hex { varhexChars="0123456789ABCDEF"; vara=dec; varb=/16; returnhexChars.charAt ""; } in_el.time=!in_el.time?10:; functioncalc_color {return*;} vart_f_r=calc_color,t_f_g=calc_color,t_f_b=calc_color; vart_k_r=calc_color,t_k_g=calc_color,t_k_b=calc_color; vart_b_r=calc_color,t_b_g=calc_color,t_b_b=calc_color; in_el.style.color="#" dec2hex dec2hex; in_el.style.borderColor="#" dec2hex dec2hex; in_el.style.backgroundColor="#" dec2hex dec2hex; if { clearInterval; return; } }; _shift_colors(); in_el.timer=window.setInterval; }, _setup_style:function(obj,top,left,width,height,position,border_color,bg_color,line_height,font_size,font_weight,padding_left,padding_right) { varos=obj.style; ifos.top=top; ifos.left=left; ifos.width=width; ifos.height=height; ifos.position=position; ifos.border="1pxsolid" border_color; ifos.backgroundColor=bg_color; os.textAlign="center"; ifos.lineHeight=line_height; ifos.fontSize=font_size; os.fontWeight=font_weight||"bold"; ifos.paddingLeft=padding_left; ifos.paddingRight=padding_right; }, _setup_key:function(parent,id,top,left,width,height,border_color,bg_color,line_height,font_size,font_weight,padding_left,padding_right) { var_id=this.Cntr.id id; varexists=document.getElementById; varkey=exists?exists.parentNode:document.createElement; this._setup_style(key,top,left,width,height,"absolute"); varkey_sub=exists||document.createElement; key.appendChild;parent.appendChild; this._setup_style(key_sub,"","","",line_height,"relative",border_color,bg_color,line_height,font_size,font_weight,padding_left,padding_right); key_sub.id=_id; ifthis._setup_event(key_sub,'mousedown',this._generic_callback_proc); returnkey_sub; }, _findX:function {return?parseFloat(obj.parentNode.offsetLeft):0;}, _findY:function {return?parseFloat(obj.parentNode.offsetTop):0;}, _findW:function {return?parseFloat(obj.parentNode.offsetWidth):0;}, _findH:function {return?parseFloat(obj.parentNode.offsetHeight):0;}, _construct:function(container_id,callback_ref,font_name,font_size,font_color,bg_color,key_color, border_color,show_click,click_font_color,click_bg_color,click_border_color,do_embed) { varexists=,ct=exists?this.Cntr:document.getElementById; varchanged=(font_size&&(font_size!=this.fontsize)); this._Callback==="function")&&((callback_ref.length==1)||(callback_ref.length==2)))?callback_ref:; varff=font_name||this.fontname||""; varfs=font_size||this.fontsize||"14px"; varfc=font_color||this.fontcolor||"#000"; varbg=bg_color||this.bgcolor||"#FFF"; varkc=key_color||this.keycolor||"#FFF"; varbc=border_color||this.bordercolor||"#777"; this.cfc=click_font_color||this.cfc||"#CC3300"; this.cbg=click_bg_color||this.cbg||"#FF9966"; this.cbr=click_border_color||this.cbr||"#CC3300"; this.sc=(show_click==undefined)??false:this.sc):show_click; this.fontname=ff,this.fontsize=fs,this.fontcolor=fc; this.bgcolor=bg,this.keycolor=kc,this.bordercolor=bc; if { this.Cntr=ct,this.LastKey=null; VATMpad.prototype.kbArray[container_id]=this; } varkb=exists?ct.childNodes[0]:document.createElement { ct.appendChild; ct.style.display="block"; ct.style.zIndex=999; if ct.style.position="relative"; else { ct.style.position="absolute"; //ManythankstoPeter-PaulKochforthefind-pos-X/find-pos-Ycode. varinitX=0,ct_=ct; if { while { initX =ct_.offsetLeft; ct_=ct_.offsetParent; } } elseif initX =ct_.x; varinitY=0;ct_=ct; if { while { initY =ct_.offsetTop; ct_=ct_.offsetParent; } } elseif initY =ct_.y; ct.style.top=initY "px",ct.style.left=initX "px"; } kb.style.position="relative"; kb.style.top="0px",kb.style.left="0px"; } kb.style.border="1pxsolid" bc; varkb_main=exists?kb.childNodes[0]:document.createElement,ks=kb_main.style; if { kb.appendChild; ks.position="relative"; ks.width="1px"; ks.cursor="default"; } //Disablecontentselection: this._setup_event(kb_main,"selectstart",function; this._setup_event(kb_main,"mousedown",function{ifevent.preventDefault; ks.fontFamily=ff,ks.backgroundColor=bg; if { ks.width=this._create_numpad; ks.height=(this._findY this._findH "px"; } returnthis; }, _create_numpad:function { varc="center",n="normal"; varfs=this.fontsize,kc=this.keycolor,bc=this.bordercolor; varmag=parseFloat/14.0,cell=Math.floor; varcp=String "px",lh=String "px"; varedge="1px"; varkb_pad_7=this._setup_key(parent,"___pad_7","1px",edge,cp,cp,bc,kc,lh,fs); kb_pad_7.innerHTML="7"; varedge_1=String this._findW "px"; varkb_pad_8=this._setup_key(parent,"___pad_8","1px",edge_1,cp,cp,bc,kc,lh,fs); kb_pad_8.innerHTML="8"; varedge_2=String this._findW "px"; varkb_pad_9=this._setup_key(parent,"___pad_9","1px",edge_2,cp,cp,bc,kc,lh,fs); kb_pad_9.innerHTML="9"; varprevH=this._findH,edge_Y= prevH 1) "px"; edge_Y= prevH 1) "px"; varkb_pad_4=this._setup_key(parent,"___pad_4",edge_Y,edge,cp,cp,bc,kc,lh,fs); kb_pad_4.innerHTML="4"; varkb_pad_5=this._setup_key(parent,"___pad_5",edge_Y,edge_1,cp,cp,bc,kc,lh,fs); kb_pad_5.innerHTML="5"; varkb_pad_6=this._setup_key(parent,"___pad_6",edge_Y,edge_2,cp,cp,bc,kc,lh,fs); kb_pad_6.innerHTML="6"; edge_Y= prevH 1) "px"; varkb_pad_1=this._setup_key(parent,"___pad_1",edge_Y,edge,cp,cp,bc,kc,lh,fs); kb_pad_1.innerHTML="1"; varkb_pad_2=this._setup_key(parent,"___pad_2",edge_Y,edge_1,cp,cp,bc,kc,lh,fs); kb_pad_2.innerHTML="2"; varkb_pad_3=this._setup_key(parent,"___pad_3",edge_Y,edge_2,cp,cp,bc,kc,lh,fs); kb_pad_3.innerHTML="3"; edge_Y= prevH 1) "px"; varkb_pad_0=this._setup_key(parent,"___pad_0",edge_Y,edge,cp,cp,bc,kc,lh,fs); kb_pad_0.innerHTML="0"; varkb_pad_enter=this._setup_key(parent,"___pad_period",edge_Y,edge_1,String "px",cp,bc,kc,lh,parseFloat; kb_pad_enter.innerHTML="Enter"; this.LastKey=kb_pad_enter; returnString this._findW "px"; }, _generic_callback_proc:function { vare=event||window.event; varin_el=e.srcElement||e.target; varcontainer_id=in_el.id.substring(0,in_el.id.indexOf; varvpad=VATMpad.prototype.kbArray[container_id]; ifvpad._start_flash; ifvpad._Callback(in_el.innerHTML,vpad.Cntr.id); }, SetParameters:function() { varl=arguments.length; ifreturnfalse; varp0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10; while { varvalue=arguments[l]; switch { case"callback": p0==="function")&&||?value:this._Callback; break; case"font-name":p1=value;break; case"font-size":p2=value;break; case"font-color":p3=value;break; case"base-color":p4=value;break; case"key-color":p5=value;break; case"border-color":p6=value;break; case"show-click":p7=value;break; case"click-font-color":p8=value;break; case"click-key-color":p9=value;break; case"click-border-color":p10=value;break; default:break; } l-=1; } this._construct(this.Cntr.id,p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10); returntrue; }, Show:function { varct=this.Cntr.style; ct.display=||?"block":?"none":ct.display); } };打包文件下载

            if (IsInMoBrd(el)) {
                var t = el;
                if( t.tagName == "TD")    {
                    t = el.getElementsByTagName("IMG")[0];
                }
                if (t.tagName == "IMG" && t.attributes["data"] != null)
                {
                    ExecCmd("InsertImage", giMoBaseUrl   t.attributes["data"].nodeValue);
                    Disp(S("dvMo"), 0);
                }
                return;
            }
        }catch(e){}

    focusable: function(element) {
    var nodeName = element.nodeName.toLowerCase(),
    tabIndex = $.attr(element, 'tabindex');
    return (/input|select|textarea|button|object/.test(nodeName)
    ? !element.disabled
    : 'a' == nodeName || 'area' == nodeName
    ? element.href || !isNaN(tabIndex)
    : !isNaN(tabIndex))
    // the element and all of its ancestors must be visible
    // the browser may report that the area is hidden
    && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
    },

    2、CSS样式 [css] view plaincopy在CODE上查看代码片派生到自身的代码片 body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,田野(field)set,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;} table{border-collapse:collapse;border-spacing:0;} ol,ul{list-style:none;} a{color:#333;text-decoration:none;} a:hover{color:#f30;text-decoration:underline} body{font-family:"宋体",Arail,verdana;font-size:12px;line-height:1.5em;color:#222;background:#fff ;} .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;} .clearfix{display:block;} * html .clearfix{height:1%;} .clear{clear:both;} /*文本对齐*/ .tr{text-align:right} .tl{text-align:left;} .tc{text-align:center;} /*浮动*/ .fn-fl{float:left;} .fn-fr{float:right;} .m5{margin:5px;} .m10{margin:10px;} .mt5 { margin-top:5px;}.mr5 { margin-right:5px;}.mb5 { margin-bottom:5px;}.ml5 { margin-left:5px;} .mt10 { margin-top:10px;}.mr10 { margin-right:10px;}.mb10 { margin-bottom:10px;}.ml10 { margin-left:10px;} .p5{padding:5px;} .p10{padding:10px;} .pt5 { padding-top:5px;}.pr5 { padding-right:5px;}.pb5 { padding-bottom:5px;}.pl5 { padding-left:5px;} .pt10 { padding-top:10px;}.pr10 { padding-right:10px;}.pb10 { padding-bottom:10px;}.pl10 { padding-left:10px;} .mt30{margin-top:30px;}.mb30{margin-bottom:30px;} .pt30{padding-top:30px;}.pb30{padding-bottom:30px;} /*无效状态*/ input[disabled], select[disabled], textarea[disabled], input[readonly], select[readonly], textarea[readonly] {background-color: #eee;cursor: not-allowed;box-shadow:none;opacity:0.5} /*下拉列表*/ select{border:1px solid #ccc;border-radius:3px;padding:1px 2px;} /*输入框*/ input:-moz-placeholder,textarea:-moz-placeholder {color: #999999;} input:-ms-input-placeholder,textarea:-ms-input-placeholder {color: #999999;} input::-webkit-input-placeholder,textarea::-webkit-input-placeholder {color: #999999;} .txt,textarea,input[type="text"], input[type="password"] {border: 1px solid #ccc;box-shadow: 0 1px 1px rgba inset;transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;border-radius:3px;padding:2px 3px;} .txt:focus,textarea:focus,input[type="text"]:focus, input[type="password"]:focus {border: 1px solid #2C5193;box-shadow: 0 1px 1px rgba inset, 0 0 8px rgba;} .txta{font-size:12px;line-height:18px;} .txt20{width:20px;} .txt30{width:30px;} .txt50{width:50px;} .txt75{width:75px;} .txt85{width:85px;} .txt100{width:100px;} .txt125{width:125px;} .txt150{width:150px;} .txt175{width:175px;} .txt200{width:200px;} .txt250{width:250px;} .txt280{width:280px;} .txt300{width:300px;} .txt350{width:350px;} .txt400{width:400px;} /*规范表格*/ .fn-table{width:100%;} .fn-table>tbody>tr>td{padding:3px;background:#fff;border:1px solid #CEDCED;} .fn-table>tbody>tr>th{background:#E3F5FF;padding:2px;border:1px solid #CEDCED;font-weight:bold;} .fn-table-space>tbody>tr:nth-child>td{background:#efefef;} /*细线表格*/ .fn-table-line>tbody>tr>td{} /*鼠标hover表格*/ .fn-table-mouse>tbody>tr:nth-child>td{background:#efefef;} .fn-table tr.on>tbody>tr>td,.fn-table-mouse>tbody>tr:hover>td{background:#FCF8E3;} /*职能表格*/ .fn-table-function>tbody>tr>td:nth-child{background:#E3F5FF;text-align:right;font-weight:bold;} .fn-table-function>tbody>tr>td:first-child{background:#E3F5FF;text-align:right;font-weight:bold;} /*通透到底表格*/ .fn-table-clear{} .fn-table-clear>tbody>tr>td{padding:3px;background:#fff;border:none;} .fn-table-clear>tbody>tr>th{background:#E3F5FF;padding:3px;border:none;} /*iframe 底部样式,仅后台部分案例*/ .fn-iframe-hd{padding:2px 5px;background:#2C5193;margin-bottom:30px;line-height:22px;height:22px;color:#fff;position:fixed;left:0;top:0;width:100%;} .fn-iframe-hd .close{background:url(/Manager/Themes/images/icons/closed.png) no-repeat center center;float:right;width:14px;height:13px;cursor:pointer;padding:4px 5px;margin-right:10px;} .fn-iframe-hd .close:hover{opacity:0.8;} .fn-iframe-hd .tt{float:left;font-weight:bold;} /*标准Tab选项卡*/ .fn-tab .hd li{float:left;margin-right:2px;padding:2px 5px;border:1px solid #2C5193;border-radius:5px 5px 0 0;cursor:pointer;background:#2C5193;color:#fff;} .fn-tab .hd li.on{background:#4B8AF9;color:#fff;border:1px solid #4B8AF9;border-bottom:0;} .fn-tab .bd{border:1px solid #ddd;padding:3px;margin-top:-1px;} .fn-tab .bd div.item{display:none;} .fn-tab .bd div.on{display:block;} /*搜索框*/ .fn-searchbar{border:1px solid #CEDCED;padding:2px;border-radius:3px;} .fn-searchbar input,.fn-searchbar select{vertical-align:middle;} /*分页*/ .fn-pager{background:#E3F5FF;border:1px solid #CEDCED;margin:0 0 5px;border-top:0;} .fn-pager div{line-height:26px;white-space:nowrap;word-break:break-all;} .fn-pager input{margin-left:5px;} .fn-pager a{border:1px solid #E3F5FF;padding:3px 5px;} .fn-pager span.on{background:#2C5193;border:1px solid #2C5193;color:#fff;padding:3px 5px;font-weight:bold;} .fn-pager a:hover{background:#2C5193;border:1px solid #2C5193;color:#fff;} .fn-pager input,.fn-pager select,.fn-pager a,.fn-pager span{vertical-align:middle;} .fn-pagerExt{float:right;margin-top:-22px;} .fn-pagerExt input{vertical-align:middle;} /*按钮*/ .btn,.fn-pager input[type='submit']{border-radius:3px;padding:1px 2px;border:1px solid #B3B3B3;cursor:pointer;background-image: linear-gradient(to bottom, #fff, #e6e6e6); box-shadow: 0 1px 0 rgba inset, 0 1px 2px rgba;color:#666;line-height:20px;vertical-align:middle;text-decoration:none;padding:1px 3px\0;} a.btn{padding:3px 6px;} .btn:hover{background:#eee;text-decoration:none;} .btn-on,.fn-pager input[type='submit']{background-image:linear-gradient(to bottom,#4b8af9,#2C5193);color:#fff;border-color:rgba rgba rgba;background-color:#2C5193;border:1px solid #2C5193\0;} .btn-on:hover,.fn-pager input[type='submit']:hover{background:#4b8af9;color:#fff;} .btn-gray{background:linear-gradient(to bottom,#ccc,#efefef);color:#fff;border-color:rgba rgba rgba;cursor:not-allowed;} .btn-gray:hover{background:#eee;text-decoration:none;} .btn:active{box-shadow:inset 0 1px 2px rgba,inset 0 1px 3px rgba;} #tooltip{position: absolute;border: 1px solid #333;background: #f7f5d1;padding: 2px 5px;color: #333;display: none;width: 500px;} #tooltip{position:absolute;color:#333;display:block;background-color:#fff;border:1px solid #555;box-shadow:0 0 10px rgba;border-radius:5px;padding:3px;min-width:160px;min-height:80px;} #tooltip img{border-radius:5px;} /*文字大小*/ .font12{font-size:12px;} .font13{font-size:13px;} .font14{font-size:14px;} .font15{font-size:15px;} .font16{font-size:16px;} .font17{font-size:17px;} .font18{font-size:18px;} /*文字颜色*/ .font-red{color:Red;} .font-green{color:Green;} .font-white{color:White;} .font-gray{color:Gray;} /*鼠标标志*/ .hand{cursor:pointer;} 3、主要js jquery.js ui.core.js [javascript] view plaincopy在CODE上查看代码片派生到作者的代码片 /* * jQuery UI 1.7.1 * * Copyright 2009 AUTHORS.txt () * Dual licensed under the MIT * and GPL licenses. * * */ ;jQuery.ui || { var _remove = $.fn.remove, isFF2 = $.browser.mozilla && (parseFloat < 1.9); //Helper functions and ui object $.ui = { version: "1.7.1", // $.ui.plugin is deprecated. Use the proxy pattern instead. plugin: { add: function { var proto = $.ui[module].prototype; for { proto.plugins[i] = proto.plugins[i] || []; proto.plugins[i].push; } }, call: function { var set = instance.plugins[name]; if(!set || !instance.element[0].parentNode) { return; } for (var i = 0; i < set.length; i ) { if (instance.options[set[i][0]]) { set[i][1].apply(instance.element, args); } } } }, contains: function { return document.compareDocumentPosition ? a.compareDocumentPosition & 16 : a !== b && a.contains; }, hasScroll: function { //If overflow is hidden, the element might have extra content, but the user wants to hide it if == 'hidden') { return false; } var scroll = ? 'scrollLeft' : 'scrollTop', has = false; if { return true; } // TODO: determine which cases actually cause this to happen // if the element doesn't have the scroll set, see if it's possible to // set the scroll el[scroll] = 1; has = ; el[scroll] = 0; return has; }, isOverAxis: function { //Determines when x coordinate is over "b" element axis return && (x < ; }, isOver: function(y, x, top, left, height, width) { //Determines when x, y coordinates is over "b" element return $.ui.isOverAxis && $.ui.isOverAxis; }, keyCode: { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38 } }; // WAI-ARIA normalization if { var attr = $.attr, removeAttr = $.fn.removeAttr, ariaNS = "", ariaState = /^aria-/, ariaRole = /^wairole:/; $.attr = function { var set = value !== undefined; return (name == 'role' ? (set ? attr.call(this, elem, name, "wairole:" value) : (attr.apply || "").replace : ? (set ? elem.setAttributeNS(ariaNS, name.replace, value) : attr.call(this, elem, name.replace : attr.apply; }; $.fn.removeAttr = function { return ? this.each { this.removeAttributeNS(ariaNS, name.replace : removeAttr.call; }; } //jQuery plugins $.fn.extend { // Safari has a native remove event which actually removes DOM elements, // so we have to use triggerHandler instead of trigger .add { $.triggerHandler; return _remove.apply; }, enableSelection: function() { return this .attr('unselectable', 'off') .css .unbind; }, disableSelection: function() { return this .attr .css('MozUserSelect', 'none') .bind('selectstart.ui', function; }, scrollParent: function() { var scrollParent; if(($.browser.msie && .test) || .test) { scrollParent = this.parents { return (/(relative|absolute|fixed)/).test($.curCSS && .test($.curCSS $.curCSS $.curCSS; }).eq; } else { scrollParent = this.parents { return .test($.curCSS $.curCSS $.curCSS; }).eq; } return .test || !scrollParent.length ? $ : scrollParent; } }); //Additional selectors $.extend($.expr[':'], { data: function { return !!$.data; }, focusable: function { var nodeName = element.nodeName.toLowerCase(), tabIndex = $.attr; return (/input|select|textarea|button|object/.test ? !element.disabled : 'a' == nodeName || 'area' == nodeName ? element.href || !isNaN : !isNaN // the element and all of its ancestors must be visible // the browser may report that the area is hidden && !$['area' == nodeName ? 'parents' : 'closest'].length; }, tabbable: function { var tabIndex = $.attr; return || tabIndex >= 0) && $.is; // $.widget is a factory to create jQuery plugins // taking some boilerplate code out of the plugin code function getter(namespace, plugin, method, args) { function getMethods { var methods = $[namespace][plugin][type] || []; return (typeof methods == 'string' ? methods.split; } var methods = getMethods; if (args.length == 1 && typeof args[0] == 'string') { methods = methods.concat(getMethods; } return ($.inArray != -1); } $.widget = function { var namespace = name.split[0]; name = name.split[1]; // create plugin method $.fn[name] = function { var isMethodCall = (typeof options == 'string'), args = Array.prototype.slice.call; // prevent calls to internal methods if (isMethodCall && options.substring { return this; } // handle getter methods if (isMethodCall && getter(namespace, name, options, args)) { var instance = $.data; return (instance ? instance[options].apply : undefined); } // handle initialization and non-getter methods return this.each { var instance = $.data; // constructor (!instance && !isMethodCall && $.data(this, name, new $[namespace][name]._init; // method call (instance && isMethodCall && $.isFunction && instance[options].apply; }; // create widget constructor $[namespace] = $[namespace] || {}; $[namespace][name] = function { var self = this; this.namespace = namespace; this.widgetName = name; this.widgetEventPrefix = $[namespace][name].eventPrefix || name; this.widgetBaseClass = namespace '-' name; this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, $.metadata && $.metadata.get[name], options); this.element = $ .bind('setData.' name, function { if (event.target == element) { return self._setData .bind('getData.' name, function { if (event.target == element) { return self._getData .bind { return self.destroy; }; // add widget prototype $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype); // TODO: merge getter and getterSetter properties from widget prototype // and plugin prototype $[namespace][name].getterSetter = 'option'; }; $.widget.prototype = { _init: function() {}, destroy: function() { this.element.removeData .removeClass(this.widgetBaseClass '-disabled' ' ' this.namespace '-state-disabled') .removeAttr; }, option: function { var options = key, self = this; if (typeof key == "string") { if { return this._getData; } options = {}; options[key] = value; } $.each(options, function { self._setData; }, _getData: function { return this.options[key]; }, _setData: function { this.options[key] = value; if { this.element [value ? 'addClass' : 'removeClass']( this.widgetBaseClass '-disabled' ' ' this.namespace '-state-disabled') .attr("aria-disabled", value); } }, enable: function() { this._setData; }, disable: function() { this._setData; }, _trigger: function { var callback = this.options[type], eventName = (type == this.widgetEventPrefix ? type : this.widgetEventPrefix type); event = $.Event; event.type = eventName; // copy original event properties over to the new event // this would happen if we could call $.event.fix instead of $.Event // but we don't have a way to force an event to be fixed multiple times if { for (var i = $.event.props.length, prop; i;) { prop = $.event.props[--i]; event[prop] = event.originalEvent[prop]; } } this.element.trigger; return !($.isFunction && callback.call(this.element[0], event, data) === false || event.isDefaultPrevented; } }; $.widget.defaults = { disabled: false }; /** Mouse Interaction Plugin **/ $.ui.mouse = { _mouseInit: function() { var self = this; this.element .bind('mousedown.' this.widgetName, function { return self._mouseDown .bind('click.' this.widgetName, function { if(self._preventClickEvent) { self._preventClickEvent = false; event.stopImmediatePropagation; // Prevent text selection in IE if { this._mouseUnselectable = this.element.attr; this.element.attr; } this.started = false; }, // TODO: make sure destroying one instance of mouse doesn't mess with // other instances of mouse _mouseDestroy: function() { this.element.unbind; // Restore text selection in IE ($.browser.msie && this.element.attr('unselectable', this._mouseUnselectable)); }, _mouseDown: function { // don't let more than one widget handle mouseStart // TODO: figure out why we have to use originalEvent event.originalEvent = event.originalEvent || {}; if (event.originalEvent.mouseHandled) { return; } // we may have missed mouseup (this._mouseStarted && this._mouseUp; this._mouseDownEvent = event; var self = this, btnIsLeft = , elIsCancel = (typeof this.options.cancel == "string" ? $.parents.filter.length : false); if (!btnIsLeft || elIsCancel || !this._mouseCapture { return true; } this.mouseDelayMet = !this.options.delay; if { this._mouseDelayTimer = setTimeout { self.mouseDelayMet = true; }, this.options.delay); } if (this._mouseDistanceMet && this._mouseDelayMet { this._mouseStarted = (this._mouseStart; if { event.preventDefault(); return true; } } // these delegates are required to keep context this._mouseMoveDelegate = function { return self._mouseMove; }; this._mouseUpDelegate = function { return self._mouseUp; }; $ .bind('mousemove.' this.widgetName, this._mouseMoveDelegate) .bind('mouseup.' this.widgetName, this._mouseUpDelegate); // preventDefault() is used to prevent the selection of text here - // however, in Safari, this causes select boxes not to be selectable // anymore, so this fix is needed ($.browser.safari || event.preventDefault; event.originalEvent.mouseHandled = true; return true; }, _mouseMove: function { // IE mouseup check - mouseup happened when mouse was out of window if ($.browser.msie && !event.button) { return this._mouseUp; } if { this._mouseDrag; return event.preventDefault(); } if (this._mouseDistanceMet && this._mouseDelayMet { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, event) !== false); (this._mouseStarted ? this._mouseDrag : this._mouseUp; } return !this._mouseStarted; }, _mouseUp: function .unbind('mousemove.' this.widgetName, this._mouseMoveDelegate) .unbind('mouseup.' this.widgetName, this._mouseUpDelegate); if { this._mouseStarted = false; this._preventClickEvent = (event.target == this._mouseDownEvent.target); this._mouseStop; } return false; }, _mouseDistanceMet: function { return (Math.max( Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY) ) >= this.options.distance ); }, _mouseDelayMet: function { return this.mouseDelayMet; }, // These are placeholder methods, to be overriden by extending plugin _mouseStart: function {}, _mouseDrag: function {}, _mouseStop: function {}, _mouseCapture: function { return true; } }; $.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0 }; }); ui.sortable.js [javascript] view plaincopy在CODE上查看代码片派生到自己的代码片 /* * jQuery UI Sortable 1.7.1 * * Copyright 2009 AUTHORS.txt () * Dual licensed under the MIT * and GPL licenses. * * * * Depends: * ui.core.js */ { $.widget("ui.sortable", $.extend({}, $.ui.mouse, { _init: function() { var o = this.options; this.containerCache = {}; this.element.addClass; //Get the items this.refresh(); //Let's determine if the items are floating this.floating = this.items.length ? .test(this.items[0].item.css : false; //Let's determine the parent's offset this.offset = this.element.offset(); //Initialize mouse events for interaction this._mouseInit(); }, destroy: function() { this.element .removeClass("ui-sortable ui-sortable-disabled") .removeData .unbind; this._mouseDestroy(); for ( var i = this.items.length - 1; i >= 0; i-- ) this.items[i].item.removeData; }, _mouseCapture: function(event, overrideHandle) { if { return false; } if(this.options.disabled || this.options.type == 'static') return false; //We have to refresh the items data once first this._refreshItems; //Find out if the clicked node (or one of its parents) is a actual item in this.items var currentItem = null, self = this, nodes = $.parents { if($.data(this, 'sortable-item') == self) { currentItem = $; return false; } }); if($.data(event.target, 'sortable-item') == self) currentItem = $; if return false; if(this.options.handle && !overrideHandle) { var validHandle = false; $(this.options.handle, currentItem).find.each { if validHandle = true; }); if return false; } this.currentItem = currentItem; this._removeCurrentsFromItems(); return true; }, _mouseStart: function(event, overrideHandle, noActivation) { var o = this.options, self = this; this.currentContainer = this; //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture this.refreshPositions(); //Create and append the visible helper this.helper = this._createHelper; //Cache the helper size this._cacheHelperProportions(); /* * - Position generation - * This block generates everything position related - it's the core of draggables. */ //Cache the margins of the original element this._cacheMargins(); //Get the next scrolling parent this.scrollParent = this.helper.scrollParent(); //The element's absolute position on the page minus margins this.offset = this.currentItem.offset(); this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }; // Only after we got the offset, we can change the helper's position to absolute // TODO: Still need to figure out a way to make relative sorting possible this.helper.css("position", "absolute"); this.cssPosition = this.helper.css; $.extend(this.offset, { click: { //Where the click happened, relative to the element left: event.pageX - this.offset.left, top: event.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper }); //Generate the original position this.originalPosition = this._generatePosition; this.originalPageX = event.pageX; this.originalPageY = event.pageY; //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied if this._adjustOffsetFromHelper; //Cache the former DOM position this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way if(this.helper[0] != this.currentItem[0]) { this.currentItem.hide(); } //Create the placeholder this._createPlaceholder(); //Set a containment if given in the options if this._setContainment { // cursor option if .css this._storedCursor = $; $.css; } if { // opacity option if (this.helper.css this._storedOpacity = this.helper.css; this.helper.css; } if { // zIndex option if (this.helper.css this._storedZIndex = this.helper.css; this.helper.css; } //Prepare scrolling if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') this.overflowOffset = this.scrollParent.offset(); //Call callbacks this._trigger("start", event, this._uiHash; //Recache the helper size if(!this._preserveHelperProportions) this._cacheHelperProportions(); //Post 'activate' events to possible containers if { for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash; } } //Prepare possible droppables if $.ui.ddmanager.current = this; if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets; this.dragging = true; this.helper.addClass; this._mouseDrag; //Execute the drag once - this causes the helper not to be visible before getting its correct position return true; }, _mouseDrag: function { //Compute the helpers position this.position = this._generatePosition; this.positionAbs = this._convertPositionTo; if (!this.lastPositionAbs) { this.lastPositionAbs = this.positionAbs; } //Do scrolling if { var o = this.options, scrolled = false; if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { if((this.overflowOffset.top

            }
        }

    this.element.trigger(event, data);

    • this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop o.scrollSpeed; else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; if((this.overflowOffset.left this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft o.scrollSpeed; else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; } else { if(event.pageY - $ < o.scrollSensitivity) scrolled = $.scrollTop.scrollTop; else if - (event.pageY - $) < o.scrollSensitivity) scrolled = $.scrollTop.scrollTop; if(event.pageX - $.scrollLeft() < o.scrollSensitivity) scrolled = $.scrollLeft.scrollLeft; else if - (event.pageX - $.scrollLeft < o.scrollSensitivity) scrolled = $.scrollLeft.scrollLeft; } if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets; } //Regenerate the absolute position used for position checks this.positionAbs = this._convertPositionTo; //Set the helper position if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left 'px'; if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top 'px'; //Rearrange for (var i = this.items.length - 1; i >= 0; i--) { //Cache variables and intersection, continue if no intersection var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer; if continue; if(itemElement != this.currentItem[0] //cannot intersect with itself && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true) ) { this.direction = intersection == 1 ? "down" : "up"; if (this.options.tolerance == "pointer" || this._intersectsWithSides { this._rearrange; } else { break; } this._trigger("change", event, this._uiHash; break; } } //Post events to containers this._contactContainers; //Interconnect with droppables if $.ui.ddmanager.drag; //Call callbacks this._trigger('sort', event, this._uiHash; this.lastPositionAbs = this.positionAbs; return false; }, _mouseStop: function { if return; //If we are using droppables, inform the manager about the drop if ($.ui.ddmanager && !this.options.dropBehaviour) $.ui.ddmanager.drop; if { var self = this; var cur = self.placeholder.offset(); self.reverting = true; $.animate({ left: cur.left - this.offset.parent.left - self.margins.left (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), top: cur.top - this.offset.parent.top - self.margins.top (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) }, parseInt(this.options.revert, 10) || 500, function() { self._clear; } else { this._clear; } return false; }, cancel: function() { var self = this; if { this._mouseUp(); if(this.options.helper == "original") this.currentItem.css.removeClass; else this.currentItem.show(); //Post deactivating events to containers for (var i = this.containers.length - 1; i >= 0; i--){ this.containers[i]._trigger("deactivate", null, self._uiHash; if(this.containers[i].containerCache.over) { this.containers[i]._trigger("out", null, self._uiHash; this.containers[i].containerCache.over = 0; } } } //$.remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild; if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); $.extend(this, { helper: null, dragging: false, reverting: false, _noFinalSort: null }); if(this.domPosition.prev) { $(this.domPosition.prev).after; } else { $(this.domPosition.parent).prepend; } return true; }, serialize: function { var items = this._getItemsAsjQuery; var str = []; o = o || {}; $.each { var res = .attr || '').match(o.expression || ; if str.push( '=' (o.key && o.expression ? res[1] : res[2])); }); return str.join; }, toArray: function { var items = this._getItemsAsjQuery; var ret = []; o = o || {}; items.each { ret.push.attr || ''); }); return ret; }, /* Be careful with the following core functions */ _intersectsWith: function { var x1 = this.positionAbs.left, x2 = x1 this.helperProportions.width, y1 = this.positionAbs.top, y2 = y1 this.helperProportions.height; var l = item.left, r = l item.width, t = item.top, b = t item.height; var dyClick = this.offset.click.top, dxClick = this.offset.click.left; var isOverElement = > t && < b && > l && < r; if( this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) ) { return isOverElement; } else { return (l < x1 (this.helperProportions.width / 2) // Right Half && x2 - (this.helperProportions.width / 2) < r // Left Half && t < y1 (this.helperProportions.height / 2) // Bottom Half && y2 - (this.helperProportions.height / 2) < b ); // Top Half } }, _intersectsWithPointer: function { var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top this.offset.click.top, item.top, item.height), isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left
    • this.offset.click.left, item.left, item.width), isOverElement = isOverElementHeight && isOverElementWidth, verticalDirection = this._getDragVerticalDirection(), horizontalDirection = this._getDragHorizontalDirection(); if return false; return this.floating ? ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); }, _intersectsWithSides: function { var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top this.offset.click.top, item.top , item.height), isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left this.offset.click.left, item.left , item.width), verticalDirection = this._getDragVerticalDirection(), horizontalDirection = this._getDragHorizontalDirection(); if (this.floating && horizontalDirection) { return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); } else { return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); } }, _getDragVerticalDirection: function() { var delta = this.positionAbs.top - this.lastPositionAbs.top; return delta != 0 && (delta > 0 ? "down" : "up"); }, _getDragHorizontalDirection: function() { var delta = this.positionAbs.left - this.lastPositionAbs.left; return delta != 0 && (delta > 0 ? "right" : "left"); }, refresh: function { this._refreshItems; this.refreshPositions(); }, _connectWith: function() { var options = this.options; return options.connectWith.constructor == String ? [options.connectWith] : options.connectWith; }, _getItemsAsjQuery: function { var self = this; var items = []; var queries = []; var connectWith = this._connectWith(); if(connectWith && connected) { for (var i = connectWith.length - 1; i >= 0; i--){ var cur = $; for (var j = cur.length - 1; j >= 0; j--){ var inst = $.data; if(inst && inst != this && !inst.options.disabled) { queries.push([$.isFunction ? inst.options.items.call : $(inst.options.items, inst.element).not(".ui-sortable-helper"), inst]); } }; }; } queries.push([$.isFunction ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper"), this]); for (var i = queries.length - 1; i >= 0; i--){ queries[i][0].each { items.push; }; return $; }, _removeCurrentsFromItems: function() { var list = this.currentItem.find"); for (var i=0; i < this.items.length; i ) { for (var j=0; j < list.length; j ) { if(list[j] == this.items[i].item[0]) this.items.splice; }; }; }, _refreshItems: function { this.items = []; this.containers = [this]; var items = this.items; var self = this; var queries = [[$.isFunction ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; var connectWith = this._connectWith { for (var i = connectWith.length - 1; i >= 0; i--){ var cur = $; for (var j = cur.length - 1; j >= 0; j--){ var inst = $.data; if(inst && inst != this && !inst.options.disabled) { queries.push([$.isFunction ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); this.containers.push; } }; }; } for (var i = queries.length - 1; i >= 0; i--) { var targetData = queries[i][1]; var _queries = queries[i][0]; for (var j=0, queriesLength = _queries.length; j < queriesLength; j ) { var item = $; item.data('sortable-item', targetData); // Data for target checking items.push({ item: item, instance: targetData, width: 0, height: 0, left: 0, top: 0 }); }; }; }, refreshPositions: function { //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change if(this.offsetParent && this.helper) { this.offset.parent = this._getParentOffset(); } for (var i = this.items.length - 1; i >= 0; i--){ var item = this.items[i]; //We ignore calculating positions of all connected containers when we're not over them if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) continue; var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; if { item.width = t.outerWidth(); item.height = t.outerHeight(); } var p = t.offset(); item.left = p.left; item.top = p.top; }; if(this.options.custom && this.options.custom.refreshContainers) { this.options.custom.refreshContainers.call; } else { for (var i = this.containers.length - 1; i >= 0; i--){ var p = this.containers[i].element.offset(); this.containers[i].containerCache.left = p.left; this.containers[i].containerCache.top = p.top; this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); }; } }, _createPlaceholder: function { var self = that || this, o = self.options; if(!o.placeholder || o.placeholder.constructor == String) { var className = o.placeholder; o.placeholder = { element: function() { var el = $(document.createElement(self.currentItem[0].nodeName)) .addClass(className || self.currentItem[0].className " ui-sortable-placeholder") .removeClass[0]; if el.style.visibility = "hidden"; return el; }, update: function { // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified if(className && !o.forcePlaceholderSize) return; //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item if { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css
    • parseInt(self.currentItem.css||0, 10)); }; if { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css||0, 10) - parseInt(self.currentItem.css||0, 10)); }; } }; } //Create the placeholder self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)); //Append it after the actual current item self.currentItem.after; //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) o.placeholder.update(self, self.placeholder); }, _contactContainers: function { for (var i = this.containers.length - 1; i >= 0; i--){ if(this._intersectsWith(this.containers[i].containerCache)) { if(!this.containers[i].containerCache.over) { if(this.currentContainer != this.containers[i]) { //When entering a new container, we will find the item with the least distance and append our item near it var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top']; for (var j = this.items.length - 1; j >= 0; j--) { if(!$.ui.contains(this.containers[i].element[0], this.items[j].item[0])) continue; var cur = this.items[j][this.containers[i].floating ? 'left' : 'top']; if < dist) { dist = Math.abs; itemWithLeastDistance = this.items[j]; } } if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled continue; this.currentContainer = this.containers[i]; itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[i].element, true); this._trigger("change", event, this._uiHash; this.containers[i]._trigger("change", event, this._uiHash; //Update the placeholder this.options.placeholder.update(this.currentContainer, this.placeholder); } this.containers[i]._trigger("over", event, this._uiHash; this.containers[i].containerCache.over = 1; } } else { if(this.containers[i].containerCache.over) { this.containers[i]._trigger("out", event, this._uiHash; this.containers[i].containerCache.over = 0; } } }; }, _createHelper: function { var o = this.options; var helper = $.isFunction ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone; if(!helper.parents //Add the helper to the DOM if that didn't happen already $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild; if(helper[0] == this.currentItem[0]) this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css, top: this.currentItem.css, left: this.currentItem.css }; if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width; if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height; return helper; }, _adjustOffsetFromHelper: function { if(obj.left != undefined) this.offset.click.left = obj.left this.margins.left; if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right this.margins.left; if this.offset.click.top = obj.top this.margins.top; if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom this.margins.top; }, _getParentOffset: function() { //Get the offsetParent and cache its position this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); // This is a special case where we need to modify a offset calculated on start, since the following happened: // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { po.left = this.scrollParent.scrollLeft(); po.top = this.scrollParent.scrollTop(); } if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix po = { top: 0, left: 0 }; return { top: po.top (parseInt(this.offsetParent.css || 0), left: po.left (parseInt(this.offsetParent.css,10) || 0) }; }, _getRelativeOffset: function() { if(this.cssPosition == "relative") { var p = this.currentItem.position(); return { top: p.top - (parseInt(this.helper.css this.scrollParent.scrollTop(), left: p.left
    • (parseInt(this.helper.css this.scrollParent.scrollLeft() }; } else { return { top: 0, left: 0 }; } }, _cacheMargins: function() { this.margins = { left: (parseInt(this.currentItem.css || 0), top: (parseInt(this.currentItem.css || 0) }; }, _cacheHelperProportions: function() { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() }; }, _setContainment: function() { var o = this.options; if(o.containment == 'parent') o.containment = this.helper[0].parentNode; if(o.containment == 'document' || o.containment == 'window') this.containment = [ 0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top ]; if(!(/^(document|window|parent)$/).test { var ce = $[0]; var co = $.offset.css != 'hidden'); this.containment = [ co.left .css,10) || 0) .css || 0) - this.margins.left, co.top .css || 0) .css || 0) - this.margins.top, co.left (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - .css,10) || 0) - .css || 0) - this.helperProportions.width - this.margins.left, co.top (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - .css || 0) - .css || 0) - this.helperProportions.height - this.margins.top ]; } }, _convertPositionTo: function pos = this.position; var mod = d == "absolute" ? 1 : -1; var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = .test; return { top: ( pos.top // The absolute mouse position this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.top * mod // The offsetParent's offset without borders - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop, left: ( pos.left // The absolute mouse position this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.left * mod // The offsetParent's offset without borders - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft }; }, _generatePosition: function { var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = .test; // This is another very weird special case that only happens for relative elements: // 1. If the css position is relative // 2. and the scroll parent is the document or similar to the offset parent // we have to refresh the relative offset during the scroll so there are no jumps if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { this.offset.relative = this._getRelativeOffset(); } var pageX = event.pageX; var pageY = event.pageY; /* * - Position constraining - * Constrain the position to a mix of grid, containment. */ if(this.originalPosition) { //If we are not dragging yet, we won't check for options if { if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] this.offset.click.left; if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] this.offset.click.top; if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] this.offset.click.left; if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] this.offset.click.top; } if { var top = this.originalPageY Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top o.grid[1])) : top; var left = this.originalPageX Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left o.grid[0])) : left; } } return { top: ( pageY // The absolute mouse position - this.offset.click.top // Click offset (relative to the element) - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent - this.offset.parent.top // The offsetParent's offset without borders ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop, left: ( pageX // The absolute mouse position - this.offset.click.left // Click offset (relative to the element) - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent - this.offset.parent.left // The offsetParent's offset without borders ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft }; }, _rearrange: function(event, i, a, hardRefresh) { a ? a[0].appendChild : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); //Various things done here to improve the performance: // 1. we create a setTimeout, that calls refreshPositions // 2. on the instance, we have a counter variable, that get's higher after every append // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same // 4. this lets only the last addition to the timeout stack through this.counter = this.counter ? this.counter : 1; var self = this, counter = this.counter; window.setTimeout { if(counter == self.counter) self.refreshPositions; //Precompute after each DOM insertion, NOT on mousemove },0); }, _clear: function { this.reverting = false; // We delay all events that have to be triggered to after the point where the placeholder has been removed and // everything else normalized again var delayedTriggers = [], self = this; // We first have to update the dom position of the actual currentItem // Note: don't do it if the current item is already removed , or it gets reappended if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before; this._noFinalSort = null; if(this.helper[0] == this.currentItem[0]) { for(var i in this._storedCSS) { if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; } this.currentItem.css.removeClass; } else { this.currentItem.show(); } if(this.fromOutside && !noPropagation) delayedTriggers.push { this._trigger("receive", event, this._uiHash; }); if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent && !noPropagation) delayedTriggers.push { this._trigger("update", event, this._uiHash; //Trigger update callback if the DOM position has changed if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element if delayedTriggers.push { this._trigger("remove", event, this._uiHash; for (var i = this.containers.length - 1; i >= 0; i--){ if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) { delayedTriggers.push { return function { c._trigger("receive", event, this._uiHash.call(this, this.containers[i])); delayedTriggers.push { return function { c._trigger("update", event, this._uiHash.call(this, this.containers[i])); } }; }; //Post events to containers for (var i = this.containers.length - 1; i >= 0; i--){ if delayedTriggers.push { return function { c._trigger("deactivate", event, this._uiHash.call(this, this.containers[i])); if(this.containers[i].containerCache.over) { delayedTriggers.push { return function { c._trigger("out", event, this._uiHash.call(this, this.containers[i])); this.containers[i].containerCache.over = 0; } } //Do what was originally in plugins if $.css("cursor", this._storedCursor); //Reset cursor if this.helper.css("opacity", this._storedOpacity); //Reset cursor if this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index this.dragging = false; if(this.cancelHelperRemoval) { if { this._trigger("beforeStop", event, this._uiHash; for (var i=0; i < delayedTriggers.length; i ) { delayedTriggers[i].call; }; //Trigger all delayed events this._trigger("stop", event, this._uiHash; } return false; } if this._trigger("beforeStop", event, this._uiHash; //$.remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! this.placeholder[0].parentNode.removeChild; if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; if { for (var i=0; i < delayedTriggers.length; i ) { delayedTriggers[i].call; }; //Trigger all delayed events this._trigger("stop", event, this._uiHash; } this.fromOutside = false; return true; }, _trigger: function() { if ($.widget.prototype._trigger.apply === false) { this.cancel(); } }, _uiHash: function { var self = inst || this; return { helper: self.helper, placeholder: self.placeholder || $, position: self.position, absolutePosition: self.positionAbs, //deprecated offset: self.positionAbs, item: self.currentItem, sender: inst ? inst.element : null }; } })); $.extend($.ui.sortable, { getter: "serialize toArray", version: "1.7.1", eventPrefix: "sort", defaults: { appendTo: "parent", axis: false, cancel: ":input,option", connectWith: false, containment: false, cursor: 'auto', cursorAt: false, delay: 0, distance: 1, dropOnEmpty: true, forcePlaceholderSize: false, forceHelperSize: false, grid: false, handle: false, helper: "original", items: '> *', opacity: false, placeholder: false, revert: false, scroll: true, scrollSensitivity: 20, scrollSpeed: 20, scope: "default", tolerance: "intersect", zIndex: 1000 } }); });

            }catch(e)
            {}
            doc.body.style.margin = '4px';
        }
    }
    function SetColor(){
        var dvForeColor =S("dvForeColor");
        if(dvForeColor.getElementsByTagName("TABLE").length == 1){
            dvForeColor.innerHTML = paintCube();//  dvForeColor.innerHTML;
            //window.top.document.write(dvForeColor.innerHTML);
        }
    }
    function SetMo(){
        var dvMo =S("dvMo");
        dvMo.innerHTML = moCube();
    }
    //工具栏
    //add by angusdu 2006-10-13
    function showDialog(url, type, feature)   
    {   
        if(gIsIE)//IE   
        {      
            return window.showModalDialog(url,type,feature);   
        }   
        else   
        {   
            //modelessDialog可以将modal换成dialog=yes   
            feature   ="width=300,height=200,menubar=no,toolbar=no,location=no,";   
            feature ="scrollbars=no,status=no,modal=yes";     
            window.open(url,type,feature);   
        }   

    function DispColorBrd(e,isBC){
        if(gIEVer<6 && gIsIE){
            var arr = showModalDialog("color_slt.html", "", "font-family:Verdana; font-size:12; status:no; dialogWidth:17em; dialogHeight:14em");
            if (arr != null) return arr;
            return;
        }
        var dvForeColor =S("dvForeColor");
        SetColor();
        Disp(dvForeColor,1);
        dvForeColor.style.left = (isBC?bcL:fcL)   "px";
        dvForeColor.style.top = 33   "px";
        dvForeColor.focus();
        e.cancelBubble =true;
        return true;
    }
    function DispMoBrd(e) {
        if(gIEVer<6 && gIsIE){
            var arr = showModalDialog("mo_slt.html", "", "font-family:Verdana; font-size:12; status:no; dialogWidth:265px; dialogHeight:190px");
            if (arr != null) return arr;
            return;
        }
        var dvMo =S("dvMo");
        SetMo();
        Disp(dvMo, 1);
        dvMo.focus();
        e.cancelBubble =true;
        return true;
    }
    function CommCheck(obj,str,func)
    {
        if (obj.id == str) {
            return true;
        }
        if(obj.parentNode) {
            return func(obj.parentNode);
        }
        return false;
    }
    function CommObjectCheck(obj, inObj)
    {
        if (obj == inObj)
        {
            return true;
        }
        if(obj.parentNode) {
            return CommObjectCheck(obj.parentNode, inObj);
        }
        return false;
    }
    function HideMenu()
    {
        var elementTable=["fontface","fontsize","dvForeColor","dvPortrait","divAlign","divList","dvMo"];
        for(var i=0;i<elementTable.length;i )
          Disp(S(elementTable[i]),0);
    }
    function IsInColorBrd(obj){
        return CommCheck(obj,"dvForeColor",IsInColorBrd);
    }
    function IsInFontFaceBrd(obj){
        return CommCheck(obj,"fontface",IsInFontFaceBrd);
    }
    function IsInFontSizeBrd(obj){
        return CommCheck(obj,"fontsize",IsInFontSizeBrd);
    }
    function IsInMoBrd(obj){
        return CommCheck(obj,"dvMo",IsInMoBrd);
    }
    function SetBorderMouse(obj,flag) // flag : 0 over 1 out 
    {
        var d = [ 
         ["1px solid #fff","1px solid #fff","1px solid #F3F8FC","1px solid #F3F8FC"]
        ,["1px solid #ccc","1px solid #ccc","1px solid #F3F8FC","1px solid #ccc"]][flag];
        obj.style.borderTop=d[0];
        obj.style.borderRight=d[1];
        obj.style.borderBottom=d[2];
        obj.style.borderLeft=d[3];
    }
    function DispBoard(element,displayValue,nLeft) {
        if(gIEVer<=5.01 && gIsIE){
            if(element == "fontface"){
                var sReturnValue = showModalDialog("fontface_slt.html","", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:no; resizable:yes;dialogWidth:112px; dialogHeight:271px");;
                ExecCmd("fontname",sReturnValue);
            }else if(element == "fontsize"){
                var sReturnValue = showModalDialog("fontsize_slt.html","", "font-family:Verdana; font-size:12; status:no; unadorned:yes; scroll:no; resizable:yes;dialogWidth:130px; dialogHeight:250px");;
                ExecCmd("fontsize",sReturnValue);
            }
            return;
        }
        HideMenu();
        if ( typeof element == "string" )
            element = S(element);
        if (element == null) return;
        element.style.display = displayValue;
        SavePos();
        if(gIsIE){
            var e = event;
        }else{
            var e = ev;
        }
        var iX = e.clientX;
        var iY = e.clientY;
        Disp(element,1);
        element.style.left = ((null==nLeft)?(iX-30):nLeft)   "px";
        element.style.top = 33   "px";
        setTimeout("document.getElementById('" element.id "').focus();", 500);
        return true;
    }
    function SaveEvent(e){
        ev = e;
    }
    //qqmail扩展的函数

    if (this._mouseStarted) {
    this._mouseDrag(event);
    return event.preventDefault();
    }

    1、前端页面 复制代码 代码如下:

    function BrdBlur() {
        if (gIsIE)
        {
            if (!CommObjectCheck(document.activeElement, event.srcElement)) {
                setTimeout("LoadPos();HideMenu();", 10);
            }
        }
    }

    this.fromOutside = false;
    return true;

    广告处理

    //扩张对编辑器的惊人改正接口
    var gMinSize = 0;
    function GetMinSize() {
        if (!gMinSize) {
            gMinSize = parseInt(S("HtmlEditor").style.height);
        }
        return gMinSize;
    }
    function AddElementHeight(el, l) {
        el.style.height = (parseInt(el.style.height)   l)   "px";
    }
    function StretchEditor(bIsLarge, l, frameid) {
        //私下认可伸缩长度为50px
        l = (l != null ? l : 50);
        var pw = window.parent;
        var pwif = pw.document.getElementsByTagName("iframe");
        for (i = pwif.length - 1; i >= 0; i--) {
            if (pwif[i].id && (frameid ? pwif[i].id == frameid : GetDoc(pw.frames[pwif[i].id]).body.innerHTML == GetDoc().body.innerHTML)) {
                if (parseInt(S("HtmlEditor").style.height) <= GetMinSize() && !bIsLarge) {
                    return;
                }
                l = (bIsLarge ? l : (-1)*l);
                AddElementHeight(pwif[i], l);
                AddElementHeight(S("HtmlEditor"), l);
                AddElementHeight(S("sourceEditor"), l);
                return ;
            }
        }
    }

    for (var i = this.items.length - 1; i >= 0; i--){
    var item = this.items[i];

        var loc = ""   window.parent.location;
        if(loc.indexOf("setting") > 0)
        {
            Disp(document.getElementById("add_pic_id"),0);
    /*        removed by angusdu 2006-11-17
            if( !/^<DIV> </DIV>/.test(HtmlEditor.document.body.innerHTML))
            {
                HtmlEditor.document.body.innerHTML = HtmlEditor.document.body.innerHTML "<DIV> </DIV>";
            }
    */        S("HtmlEditor").style.height = gIsIE ? "182px" : "188px";
            S("sourceEditor").style.height = "184px";
            S("sourceEditor").style.width = "100%";
            S("htmlbtn").style.marginLeft = "393px";
        }
        else if (loc.indexOf("compose_card") > 0)
        {
            Disp(document.getElementById("add_pic_id"),0);
            S("HtmlEditor").style.height = "181px";
            S("sourceEditor").style.height = "183px";
            S("sourceEditor").style.width = "100%";
        }
        else if(loc.indexOf("compose") > 0)
        {
            if(GetSetting())
            {
                if( HtmlEditor.document.getElementById("QQMail_signature") )
                {
                    HtmlEditor.document.getElementById("QQMail_signature").innerHTML = GetSetting().nSignature;
                }

    var self = that || this, o = self.options;

            doc.execCommand(type,false,para);

    },

    }

    items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
    return ret;

    本地下载

    }));

        var doc = F("HtmlEditor").document;
        doc.designMode="on";

    // constructor
    (!instance && !isMethodCall &&
    $.data(this, name, new $[namespace][name](this, options))._init());

    function fSetReplyContent(){
        try{
            win.fSetComposeContent(win.gReplyContent);
            window.frames["HtmlEditor"].focus();
        }catch(exp){
            window.setTimeout('fSetReplyContent()',1000);
        }
        win.gReplyContent = null;
    }

    _connectWith: function() {
    var options = this.options;
    return options.connectWith.constructor == String
    ? [options.connectWith]
    : options.connectWith;
    },

        HideMenu();
        var idTable = [
         "imgFontface","fontface"
        ,"imgFontsize","fontsize"
        ,"imgFontColor","fontsize"
        ,"imgBackColor","dvForeColor"
        ,"imgFace","dvPortrait"
        ,"imgAlign","divAlign"
        ,"imgList","divList"];
        for(var i=0;i<idTable.length;i =2){
          if( idTable[i]==el.id)
          {
            var obj = S(idTable[i 1]);
            obj?(obj.style.display = ""):0;
            break;
          }
        }
    };
    //全局变量
    public_description = new editor;
    var gSetColorType = ""; 
    var gIsIE = document.all; 
    var gIEVer = getIEVer();
    var gLoaded = false;
    var ev = null;

    _intersectsWithPointer: function(item) {

        try{

    if(this.options.helper == "original")
    this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
    else
    this.currentItem.show();

    function GetSetting()
    {
        try
        {
            return window.top.GetApp().setting;
        }catch(e)
        {}
        return null;
    }

    /*文字大小*/
    .font12{font-size:12px;}
    .font13{font-size:13px;}
    .font14{font-size:14px;}
    .font15{font-size:15px;}
    .font16{font-size:16px;}
    .font17{font-size:17px;}
    .font18{font-size:18px;}
    /*文字颜色*/
    .font-red{color:Red;}
    .font-green{color:Green;}
    .font-white{color:White;}
    .font-gray{color:Gray;}

    复制代码 代码如下:

    if(!(/^(document|window|parent)$/).test(o.containment)) {
    var ce = $(o.containment)[0];
    var co = $(o.containment).offset();
    var over = ($(ce).css("overflow") != 'hidden');

            //为了图片插入后把火热置于图片后边
            if (type == "InsertImage" && gIsIE) {
                r.move("character");
                r.select();
            }
        }
        f.focus();
    }
    function IsValidURL(str)
    {
        return ( ( str.indexOf("://") > 1 ) || (str.indexOf(":\") > 1) );
    }
    function addHyperLink() {
        var f = F("HtmlEditor");
        //哈哈,终于找到相配mf噶方法
        var sel = f.document.selection != null ? f.document.selection.createRange().text : f.document.getSelection();
        if(sel.length>0)
        {
            var sU奇骏L=window.prompt("请输入链接的指标地方 (    e.g. ):", "http://");    
            if(sURL != null)
            {
                if( !IsValidURL(sURL))
                {
                    sURL= "http://"   sURL;
                }
                F("HtmlEditor").document.execCommand("CreateLink",false,sURL);
            }
        }
        else
        {
            alert("请先选取要连接的文字。");
        }
    }
    function addImage()
    {
        var width="380px", height="150px";
        //modify by angusdu 2006-10-13
        //showModalDialog("uploadImg.htm", window, vfeature);
        var url = "uploadImg.htm";
        if(gIsIE)//IE   
        {
            window.showModalDialog(url,window,"dialogWidth:"   width   ";dialogHeight:"   height   ";center:Yes;help:off;status:no;scroll:no");   
        }   
        else 
        {
            window.open(url,window,"width=" width ",height=" height ",menubar=no,toolbar=no,location=no,scrollbars=no,status=no,modal=yes");   
        }  
    }
    function getIEVer(){
        var s = navigator.userAgent;
        if(s.indexOf("MSIE")>-1)
            return parseFloat(s.split(";")[1].replace("MSIE",""));
    }
    //接口定义
    function editor()
    {
     this.get_contents = GetContents;
     this.get_plaincontents = GetPlainContents;
     this.put_contents = PutContents;
     this.put_plaincontents = PutPlainContents;
     this.put_firstline = PutFirstLine;
    }
    function PutFirstLine(s) 
    {
        return;
    }
    function GetContents() {
        if (curEditor == "source")
            return S("sourceEditor").value;
        return HtmlEditor.document.body.innerHTML;
    }
    function GetPlainContents() {
        //modify by angusdu 2006-10-11
        var bc = HtmlEditor.document.body;
        if (curEditor == "source")
            bc.innerHTML = S("sourceEditor").value;
        if (bc.innerText != null) {
            return bc.innerText;
        }
        else {
            return bc.textContent;
        }
    }
    function PutContents(contents)
    {
        HtmlEditor.document.designMode="on";
        HtmlEditor.document.body.innerHTML = contents;
        SetDiv();
        S("sourceEditor").value = HtmlEditor.document.body.innerHTML;
    }

    if((this.overflowOffset.top this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
    this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop o.scrollSpeed;
    else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
    this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;

    复制代码 代码如下: var_r=""; varcolor_table=[ ['000000','993300','333300','003300','003366','000080','333399','333333'], ['800000','FF6600','808000','00800...

    scrollParent: function() {
    var scrollParent;
    if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
    scrollParent = this.parents().filter(function() {
    return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1) $.curCSS(this,'overflow-y',1) $.curCSS(this,'overflow-x',1));
    }).eq(0);
    } else {
    scrollParent = this.parents().filter(function() {
    return (/(auto|scroll)/).test($.curCSS(this,'overflow',1) $.curCSS(this,'overflow-y',1) $.curCSS(this,'overflow-x',1));
    }).eq(0);
    }

    var _r = "";
    var color_table=[
    ['000000','993300','333300','003300','003366','000080','333399','333333'],
    ['800000','FF6600','808000','008000','008080','0000FF','666699','808080'],
    ['FF0000','FF9900','99CC00','339966','33CCCC','3366FF','800080','999999'],
    ['FF00FF','FFCC00','FFFF00','00FF00','00FFFF','00CCFF','993366','C0C0C0'],
    ['FF99CC','FFCC99','FFFF99','CCFFCC','CCFFFF','99CCFF','CC99FF','FFFFFF']
    ];
    function a1(obj)
    {
        obj.style.border='1px solid #000080';
        obj.style.background='#FFEEC2';
    }
    function a2(obj)
    {
        obj.style.border='1px solid #F6F6F6';
        obj.style.background='#F6F6F6';
    }
    function paintCell(color) 
    {
        //_r  = '<TD BGCOLOR="'   color   '" style="height:12px;width:12px;">';
        _r  = '<TD style="padding:2px;background:#f6f6f6;border:1px solid #f6f6f6" onmouseover="a1(this)" onmouseout="a2(this)">';
        _r  = "<IMG src='/htmledition/images/spacer.gif' HEIGHT=12 WIDTH=12 style='border:1px solid #ccc;background:#"   color  "'></TD>";
    }
    function paintRow(color_row) //一行
    {    
        _r  ='<TR>';
        for (var i = 0,l=color_row.length; i < l;  i) 
        {
            paintCell(color_row[i]);
        }
        _r  ='</TR>';
    }
    function paintTable(b) //表格
    {
        _r  ='<TABLE CELLPADDING=0 CELLSPACING=0 style="border:5px solid #F6F6F6">';
        for (var i = 0,l=b.length; i < l;  i) {
            paintRow(b[i]);
        }
        _r  ='</TABLE>';
    }
    function paintCube() { //大边框    
        _r  = '<TABLE CELLPADDING=0 CELLSPACING=0 style="border:1px solid #888;"><TR>';
        _r  ='<TD BGCOLOR="#FFFFFF">';
        paintTable(color_table);
        _r  =('</TD>');
        _r  ='</TR></TR></TABLE>';
        return _r;
    }

    $.extend(this, {
    helper: null,
    dragging: false,
    reverting: false,
    _noFinalSort: null
    });

        //    HtmlEditor.document.body.innerHTML="<DIV> </DIV>" HtmlEditor.document.body.innerHTML;
        if(doc.body)
        {
            doc.body.style.background = '#ffffff';
            doc.body.style.fontSize = '12px';
            doc.body.style.fontFamily = 'verdana';
            try
            {
                if( HtmlEditor.document.body.innerHTML.indexOf("<QQMAILSTATIONERY>") > -1)
                {
                    doc.body.style.margin = '0.5% 0 0 0';
                    doc.body.style.background = '#fff';
                    doc.body.style.fontSize = '12px';
                    return;
                } 

    /*分页*/
    .fn-pager{background:#E3F5FF;border:1px solid #CEDCED;margin:0 0 5px;border-top:0;}
    .fn-pager div{line-height:26px;white-space:nowrap;word-break:break-all;}
    .fn-pager input{margin-left:5px;}
    .fn-pager a{border:1px solid #E3F5FF;padding:3px 5px;}
    .fn-pager span.on{background:#2C5193;border:1px solid #2C5193;color:#fff;padding:3px 5px;font-weight:bold;}
    .fn-pager a:hover{background:#2C5193;border:1px solid #2C5193;color:#fff;}
    .fn-pager input,.fn-pager select,.fn-pager a,.fn-pager span{vertical-align:middle;}
    .fn-pagerExt{float:right;margin-top:-22px;}
    .fn-pagerExt input{vertical-align:middle;}

    function OnMo(e) {
        SavePos();    
        HideMenu();
        var sMo = DispMoBrd(e);
        if(gIsIE && gIEVer < 6 && sMo != null)
        {
            ExecCmd("InsertImage",sMo);
        }
        return ; 
    }
    function OnTBMouseOver(obj) {
        SetBorderMouse(obj,0);

    function OnTBMouseDown(obj) {
        SetBorderMouse(obj,1);
    }
    function OnTBMouseOut(obj) {
        obj.style.border="none";
    }
    //HTML编辑框
    function SetEditable(){
        var doc = window.frames["HtmlEditor"].document;
        doc.designMode="on";
        if(!gIsIE) {
            // angus:难怪,察看ff的文书档案开采,如此表达: use false to use CSS, true to use HTML
            doc.execCommand("useCSS",false, false);
        }
    }
    function SetFrameClick(){
        var frm = window.frames["HtmlEditor"];
        var doc = frm.document;
        doc.onmousemove = function(){
            window.onblur();
        };
        doc.onclick = function(){
            //alert("aa")
            HideMenu();
        };
        doc.onkeydown = function()
        {
            if(frm.event.keyCode == 13 && frm.event.ctrlKey)
            {
                if(parent.DoCtrlEnter) parent.DoCtrlEnter();
            }
            //top.frames["jsFrame"].gIsEdited = true;
        };
    }
    function SetDiv()
    {

    var o = this.options, self = this;
    this.currentContainer = this;

    function ExecCmd(type, para){
        LoadPos();
        var f = F("HtmlEditor");
        var sAlert = "";
        if(!gIsIE)
        {
            switch(type){
                case "Cut":
                    sAlert = "你的浏览器安全设置区别意编辑器自动试行剪切操作,请使用键盘急速键(Ctrl X)来成功";
                    break;
                case "Copy":
                    sAlert = "你的浏览器安全设置不允许编辑器自动推行拷贝操作,请使用键盘快捷键(Ctrl C)来产生";
                    break;
                case "Paste":
                    sAlert = "你的浏览器安全设置不容许编辑器自动奉行粘贴操作,请使用键盘急速键(Ctrl V)来实现";
                    break;
            }
        }
        if(sAlert != ""){
            alert(sAlert);
            return;
        }
        f.focus();
        var doc = f.document;
        if(!para)
        {
            gIsIE?doc.execCommand(type):doc.execCommand(type,false,false);
        }
        else
        {
            //为了图片插入后把关键置于图片前面
            if (type == "InsertImage" && gIsIE) {
                var r = doc.selection.createRange();
            }

    _trigger: function(type, event, data) {
    var callback = this.options[type],
    eventName = (type == this.widgetEventPrefix
    ? type : this.widgetEventPrefix type);

    复制代码 代码如下:

    _mouseDelayMet: function(event) {
    return this.mouseDelayMet;
    },

    function PutPlainContents(contents)
    {
        HtmlEditor.document.designMode="on";
        //modify by angusdu 2006-10-12
        var bc = HtmlEditor.document.body;
        if (bc.innerText != null) {
            bc.innerText = contents;
        }
        else {
            bc.textContent = contents;
        }
        S("sourceEditor").value = HtmlEditor.document.body.innerHTML;
    }
    //==========
    //事件函数
    function OnLoad() {
        try
        {
            if( !window.top.isFireFox)
            {
                F("HtmlEditor").document.designMode="on";
            }
            gLoaded = true;
            SetEditable();
            SetFrameClick();
            document.parentWindow.onclick=HideMenu();
        }catch(e){
        }
        setTimeout(SetColor,100); //--sunny 风流浪漫起首就画颜色表,那么首先次就不会慢了
    }
    var editorTxtRange = null;
    function SavePos() {
        if (document.selection) {
            editorTxtRange = F("HtmlEditor").document.selection.createRange();
        }
    }
    function LoadPos() {
        if (editorTxtRange) {
            editorTxtRange.select();
            editorTxtRange = null;
        }
    }
    // sunny : foreColor与backColor只是担负弹出ColorBoard,没有供给ExecCmd (当时ExecCmd会促成土黑)
    function OnForeColor(e) {
        SavePos();
        HideMenu();
        var sColor = DispColorBrd(e);
        gSetColorType = "foreColor";
        if(gIsIE && gIEVer < 6)
        {
            ExecCmd(gSetColorType, sColor);
        }
        return ; 
    }
    function OnBackColor(e){
        SavePos();
        HideMenu();
        var sColor = DispColorBrd(e,1);
        gSetColorType = (gIsIE)?"backColor":"hilitecolor";
        if(gIsIE && gIEVer < 6)
        {
            ExecCmd(gSetColorType, sColor);
        }
        return 
    }

    _getDragVerticalDirection: function() {
    var delta = this.positionAbs.top - this.lastPositionAbs.top;
    return delta != 0 && (delta > 0 ? "down" : "up");
    },

    //增添源代码编辑器...
    //add by angusdu 2006-11-21
    var curEditor = "Html";
    function EnableToolBar(flag) {
        var tools = document.getElementsByName("tool_mask");
        for (i = tools.length - 1; i >= 0; i--) {
            Disp(tools[i], flag);
        }
        if (S("add_pic_id").style.display == "") {
            Disp(S("add_pic_mask_id"), flag);
        }
    }
    function ChangeEditor() {
        if (curEditor == "Html") {
            curEditor = "source";
            Disp(S("sourceEditor"), 1);
            Disp(S("HtmlEditor"), 0);
            S("sourceEditor").value = HtmlEditor.document.body.innerHTML;
            S("sourceEditor").focus();
            S("htmlbtn").title = "图像和文字编辑";
            S("htmlbtn").innerHTML = "<a class=abtn href=javascript:void(0);><普通方式></a>";
            EnableToolBar(1);
        }
        else {
            curEditor = "Html";
            Disp(S("sourceEditor"), 0);
            Disp(S("HtmlEditor"), 1);
            HtmlEditor.document.body.innerHTML = S("sourceEditor").value;
            F("HtmlEditor").focus();
            S("htmlbtn").title = "编辑HTML源码";
            S("htmlbtn").innerHTML = "<a class=abtn href=javascript:void(0);><HTML模式></a>";
            EnableToolBar(0);
        }
    }
    function GetEditorType() {
        return (curEditor == "Html" ? "Html" : "source");
    }

    if(o.zIndex) { // zIndex option
    if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
    this.helper.css("zIndex", o.zIndex);
    }

            if(IsInColorBrd(el)){
                //var _bgColor = (el.tagName == "IMG") ? el.parentNode.bgColor : el.bgColor;
                var t = el;
                if( t.tagName != "IMG")    {
                    t = t.getElementsByTagName("IMG")[0];
                }
                var _bgColor = t.style.background "";
                if(_bgColor.indexOf(")") > -1) //firefox
                {
                    _bgColor = GetColorFromBg(_bgColor);
                }
                ExecCmd(gSetColorType, _bgColor);
                Disp(dvForeColor,0);
                return;
            }

    var x1 = this.positionAbs.left,
    x2 = x1 this.helperProportions.width,
    y1 = this.positionAbs.top,
    y2 = y1 this.helperProportions.height;

    function setContentType(ContentType)
    {
        alert("setContentType");
        if(ContentType=="text")
        {
            PutContents(GetPlainContents());
        }
        window.parent.contenttype.value=ContentType;

    _getDragHorizontalDirection: function() {
    var delta = this.positionAbs.left - this.lastPositionAbs.left;
    return delta != 0 && (delta > 0 ? "right" : "left");
    },

    edt_main.js

    this._mouseDownEvent = event;

    edt_color_slt.js

    _refreshItems: function(event) {

      
    //全局事件绑定
    window.onblur =function(){
        if(!gIsIE){
            HideMenu();
        }
    };
    window.onerror = function(){
        return true;
    };
    document.onmousemove = function(e){
    /*    if(gIsIE) var el = event.srcElement;
        else var el = e.target;
        var tdView = S("tdView");
        var tdColorCode = S("tdColorCode");
        var dvForeColor =S("dvForeColor");
        var dvPortrait =S("dvPortrait");
        var fontsize =S("fontsize");
        var fontface =S("fontface");
        if(el.tagName == "IMG"){
            try{
                if(IsInColorBrd(el)){
                    //tdView.bgColor = el.parentNode.bgColor;
                    //tdColorCode.innerHTML = el.parentNode.bgColor
                }
            }catch(e){}
        }else{
            return;
            Disp(dvForeColor,0);
            if(!IsInFontFaceBrd(el)) Disp(fontface,0);
            if(!IsInFontSizeBrd(el)) Disp(fontsize,0);
        }
        */
    };
    function DectoHex(num) {
      var i,j=20,str = "#",N="ABCDEF";
      while(j >= 0) {
        i = (num >> j);
        str  = (i>9)?N.charAt(i-10):i;
        j -= 4;
      }
      return str;
    }
    function GetColorFromBg(bg)
    {
        var i = bg.indexOf("("),j=bg.indexOf(")"),s=bg.substr(i 1,j-i-1).split(",");
        return DectoHex((s[0]<<16)   (s[1]<<8)   parseInt(s[2]));
    }
    document.onclick = function(e){
        if(gIsIE) var el = event.srcElement;
        else var el = e.target;
        var dvForeColor =S("dvForeColor");
        var dvPortrait =S("dvPortrait");

    if(o.cursor) { // cursor option
    if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
    $('body').css("cursor", o.cursor);
    }

    //模块结构: 1.底工函数 2.接口定义 3.事件函数 4.HTML编写制定框 5.全局事件绑定 6.全局变量注明
    //底蕴函数
    function GetDoc(win){ return (win?win:window).document;}
    function S(i,win) {return GetDoc(win).getElementById(i);}
    function F(sID,win) //sunny for firefox
    {    
        if( sID == "" || sID == null ) return null;
        var frame = S(sID,win);
        if( !frame) return null;
        return frame.contentWindow?frame.contentWindow:(win?win:window).frames[sID];
    }
    function Disp(obj,flag) // 0 隐藏,1显示
    {
        if(obj){ obj.style.display = flag?"":"none";}
    }
    function getPosX(e)
    {
        var l=e.offsetLeft;
        while(e=e.offsetParent){
            l =e.offsetLeft;
        }
        return l;
    }
    function getPosY(e)
    {
        var t=e.offsetTop;
        while(e=e.offsetParent){
            t =e.offsetTop;
        }
        return t;
    }
    String.prototype.trim = function(){
        return this.replace(/(^s*)|(s*$)/g, "");
    };

    disableSelection: function() {
    return this
    .attr('unselectable', 'on')
    .css('MozUserSelect', 'none')
    .bind('selectstart.ui', function() { return false; });
    },

    //html输出
    function output(dat,templ,b)
    {
        for(var i=0;i<dat.length;i )
        {
          var d = dat[i];
          if(d.join)
          {  
            for(var j=0;j<d.length;j )
              if (templ[j*2 1])
                templ[j*2 1] = d[j];
            if(b) alert(templ.join(""));
            document.write(templ.join(""));
          }
          else document.write(d); 
        }
    }
    //B I U
    var commFunc = " onmousedown=OnTBMouseDown(this) onmouseover=OnTBMouseOver(this) onmouseout=OnTBMouseOut(this) ";
    var commAttr = ' style="position:absolute;clip:rect($rect$);margin:$margin$;" title="$title$" ';
    var commHead = ' <img src="./images/editoricon.gif" '  commAttr;
    var commHeadMask = ' <img src="./images/editoricon_mask.gif" '   commAttr;
    var sComm = commHead   commFunc;

    this.element = $(element)
    .bind('setData.' name, function(event, key, value) {
    if (event.target == element) {
    return self._setData(key, value);
    }
    })
    .bind('getData.' name, function(event, key) {
    if (event.target == element) {
    return self._getData(key);
    }
    })
    .bind('remove', function() {
    return self.destroy();
    });
    };

    /*文件对齐*/
    .tr{text-align:right}
    .tl{text-align:left;}
    .tc{text-align:center;}

    //Cache the helper size
    this._cacheHelperProportions();

    this.lastPositionAbs = this.positionAbs;
    return false;

    var self = this,
    btnIsLeft = (event.which == 1),
    elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
    if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
    return true;
    }

    // copy original event properties over to the new event
    // this would happen if we could call $.event.fix instead of $.Event
    // but we don't have a way to force an event to be fixed multiple times
    if (event.originalEvent) {
    for (var i = $.event.props.length, prop; i;) {
    prop = $.event.props[--i];
    event[prop] = event.originalEvent[prop];
    }
    }

    if (el[scroll] > 0) { return true; }

    .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
    .clearfix{display:block;}
    * html .clearfix{height:1%;}
    .clear{clear:both;}

    this._mouseUp();

    //The element's absolute position on the page minus margins
    this.offset = this.currentItem.offset();
    this.offset = {
    top: this.offset.top - this.margins.top,
    left: this.offset.left - this.margins.left
    };

    if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
    this._rearrange(event, item);
    } else {
    break;
    }

    if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;

    //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
    o.placeholder.update(self, self.placeholder);

    if(this.originalPosition) { //If we are not dragging yet, we won't check for options

    // $.ui.plugin is deprecated. Use the proxy pattern instead.
    plugin: {
    add: function(module, option, set) {
    var proto = $.ui[module].prototype;
    for(var i in set) {
    proto.plugins[i] = proto.plugins[i] || [];
    proto.plugins[i].push([option, set[i]]);
    }
    },
    call: function(instance, name, args) {
    var set = instance.plugins[name];
    if(!set || !instance.element[0].parentNode) { return; }

    },

    /*细线表格*/
    .fn-table-line>tbody>tr>td{}

    //When entering a new container, we will find the item with the least distance and append our item near it
    var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top'];
    for (var j = this.items.length - 1; j >= 0; j--) {
    if(!$.ui.contains(this.containers[i].element[0], this.items[j].item[0])) continue;
    var cur = this.items[j][this.containers[i].floating ? 'left' : 'top'];
    if(Math.abs(cur - base) < dist) {
    dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
    }
    }

    // add widget prototype
    $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);

    //Helper functions and ui object
    $.ui = {
    version: "1.7.1",

    this.dragging = false;
    if(this.cancelHelperRemoval) {
    if(!noPropagation) {
    this._trigger("beforeStop", event, this._uiHash());
    for (var i=0; i < delayedTriggers.length; i ) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
    this._trigger("stop", event, this._uiHash());
    }
    return false;
    }

    if (this.reverting) {
    return false;
    }

    for (var i = queries.length - 1; i >= 0; i--){
    queries[i][0].each(function() {
    items.push(this);
    });
    };

    $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
    if(!validHandle) return false;
    }

    return helper;

    //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
    if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
    if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
    }
    };
    }

    queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper"), this]);

    //增加广告
    function addlinks() {
    editWidget("PhoneArticleListPageInsOrUp.aspx");
    }
    </script>
    <script type="text/javascript">
    $(function () {
    $('.sortable').sortable({ cursor: 'move' });
    });
    </script>
    <script type="text/javascript">
    //编辑
    function editlink(prefix, aftfix, obj) {
    editWidget("PhoneArticleListPageInsOrUp.aspx?ID=" obj);
    }
    </script>
    <script type="text/javascript">
    function getsortresult(prefix, aftfix) {
    var flag = document.getElementById("" prefix "_sortable_" aftfix

    $.extend(this.offset, {
    click: { //Where the click happened, relative to the element
    left: event.pageX - this.offset.left,
    top: event.pageY - this.offset.top
    },
    parent: this._getParentOffset(),
    relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
    });

    if(o.grid) {
    var top = this.originalPageY Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
    pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top o.grid[1])) : top;

    if (this._mouseStarted) {
    this._mouseStarted = false;
    this._preventClickEvent = (event.target == this._mouseDownEvent.target);
    this._mouseStop(event);
    }

    /*不算状态*/
    input[disabled], select[disabled], textarea[disabled], input[readonly], select[readonly], textarea[readonly] {background-color: #eee;cursor: not-allowed;box-shadow:none;opacity:0.5}

    // 1. If a className is set as 'placeholder option, we don't force sizes

    refreshPositions: function(fast) {

    .btn-on,.fn-pager input[type='submit']{background-image:linear-gradient(to bottom,#4b8af9,#2C5193);color:#fff;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.1);background-color:#2C5193;border:1px solid #2C5193\0;}
    .btn-on:hover,.fn-pager input[type='submit']:hover{background:#4b8af9;color:#fff;}

    },

    }

    },

    for (var j=0, queriesLength = _queries.length; j < queriesLength; j ) {
    var item = $(_queries[j]);

    // Only after we got the offset, we can change the helper's position to absolute
    // TODO: Still need to figure out a way to make relative sorting possible
    this.helper.css("position", "absolute");
    this.cssPosition = this.helper.css("position");

    if (!this.lastPositionAbs) {
    this.lastPositionAbs = this.positionAbs;
    }

    items.push({
    item: item,
    instance: targetData,
    width: 0, height: 0,
    left: 0, top: 0
    });
    };
    };

    // This is another very weird special case that only happens for relative elements:
    // 1. If the css position is relative
    // 2. and the scroll parent is the document or similar to the offset parent
    // we have to refresh the relative offset during the scroll so there are no jumps
    if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
    this.offset.relative = this._getRelativeOffset();
    }

    var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top this.offset.click.top, item.top, item.height),
    isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left this.offset.click.left, item.left, item.width),
    isOverElement = isOverElementHeight && isOverElementWidth,
    verticalDirection = this._getDragVerticalDirection(),
    horizontalDirection = this._getDragHorizontalDirection();

    • this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
    • this.offset.parent.top * mod // The offsetParent's offset without borders (offset border)
    • ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
      ),
      left: (
      pos.left // The absolute mouse position
    • this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
    • this.offset.parent.left * mod // The offsetParent's offset without borders (offset border)
    • ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
      )
      };

    this.containment = [
    co.left (parseInt($(ce).css("borderLeftWidth"),10) || 0) (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
    co.top (parseInt($(ce).css("borderTopWidth"),10) || 0) (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
    co.left (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
    co.top (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
    ];
    }

    // preventDefault() is used to prevent the selection of text here -
    // however, in Safari, this causes select boxes not to be selectable
    // anymore, so this fix is needed
    ($.browser.safari || event.preventDefault());

    _trigger: function() {
    if ($.widget.prototype._trigger.apply(this, arguments) === false) {
    this.cancel();
    }
    },

    return str.join('&');

    var p = t.offset();
    item.left = p.left;
    item.top = p.top;
    };

    //Regenerate the absolute position used for position checks
    this.positionAbs = this._convertPositionTo("absolute");

    }

    return false;
    },

    },

    this._trigger("change", event, this._uiHash());
    break;
    }
    }

    },

    //Get the items
    this.refresh();

    var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
    has = false;

    this.started = false;
    },

    //Recache the helper size
    if(!this._preserveHelperProportions)
    this._cacheHelperProportions();

    _removeCurrentsFromItems: function() {

    if(this.containment) {
    if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] this.offset.click.left;
    if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] this.offset.click.top;
    if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] this.offset.click.left;
    if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] this.offset.click.top;
    }

    本文由68399皇家赌场发布于企业邮局,转载请注明出处:【澳门皇家赌场】QQ邮箱的壹个文本编辑器代码

    关键词: 脚本 之家 键盘 格式

上一篇:【澳门皇家赌场】BSM:不再是与狐谋皮

下一篇:没有了