contexmenu dynamic
This commit is contained in:
1 parent
d1f18b9476
commit
27dbd6552c
12 files changed
+118
-142
No files matched your search
@@ -1340,12 +1340,13 @@ background-position:-1px -670px
|
||||
list-style: none;
|
||||
}
|
||||
#searchNotebookForList {
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
color: #ccc;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background-color: #37485e;
|
||||
}
|
||||
#searchNotebookForList:focus {
|
||||
outline: none !important;
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
box-shadow: none;
|
||||
}
|
||||
.label-default {
|
||||
@@ -1358,3 +1359,6 @@ background-position:-1px -670px
|
||||
#myShareNotebooks .folderBody {
|
||||
background: none;
|
||||
}
|
||||
.tmpzTreeMove_arrow {
|
||||
color: #fff;
|
||||
}
|
||||
@@ -1169,12 +1169,13 @@ background-position:-1px -670px
|
||||
|
||||
//----------------------
|
||||
#searchNotebookForList {
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
color: #ccc;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background-color: @leftBgColor;
|
||||
&:focus {
|
||||
outline: none !important;
|
||||
box-shadow: none;
|
||||
outline: none !important;
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
.label-default {
|
||||
@@ -1187,3 +1188,6 @@ background-position:-1px -670px
|
||||
#myShareNotebooks .folderBody {
|
||||
background: none;
|
||||
}
|
||||
.tmpzTreeMove_arrow {
|
||||
color: #fff;
|
||||
}
|
||||
@@ -1,18 +1,7 @@
|
||||
/*-------------------------------------
|
||||
zTree Style
|
||||
|
||||
version: 3.4
|
||||
author: Hunter.z
|
||||
email: hunter.z@263.net
|
||||
website: http://code.google.com/p/jquerytree/
|
||||
|
||||
-------------------------------------*/
|
||||
|
||||
.ztree * {padding:0; margin:0; font-size:12px;}
|
||||
.ztree {margin:0; padding:5px; color:#333}
|
||||
.ztree li{padding:0; margin:0; list-style:none; line-height:14px; text-align:left; white-space:nowrap; outline:0}
|
||||
.ztree li ul{ margin:0; padding:0 0 0 18px}
|
||||
.ztree li ul.line{ background:url(./img/line_conn.gif) 0 0 repeat-y;}
|
||||
|
||||
.ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; height:17px; color:#333; background-color: transparent;
|
||||
text-decoration:none; vertical-align:top; display: block;
|
||||
@@ -21,67 +10,25 @@ website: http://code.google.com/p/jquerytree/
|
||||
.ztree li a:hover {text-decoration:underline}
|
||||
.ztree li a.curSelectedNode {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
|
||||
.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
|
||||
|
||||
/* 拖动到上面 */
|
||||
.ztree li a.tmpTargetNode_inner {
|
||||
padding-top:0px; background-color:#316AC5;
|
||||
color:white; height:30px; border:1px #316AC5 solid;
|
||||
padding-top:0px;
|
||||
background-color:#316AC5;
|
||||
color:white; height:30px;
|
||||
border:1px #316AC5 solid;
|
||||
opacity:0.8; filter:alpha(opacity=80)
|
||||
}
|
||||
.ztree li a.tmpTargetNode_prev {}
|
||||
.ztree li a.tmpTargetNode_next {}
|
||||
|
||||
.ztree li span {line-height:16px; margin-right:2px}
|
||||
.ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle;
|
||||
border:0 none; cursor: pointer;outline:none;
|
||||
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
|
||||
background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")}
|
||||
|
||||
.ztree li span.button.chk {width:13px; height:13px; margin:0 3px 0 0; cursor: auto}
|
||||
.ztree li span.button.chk.checkbox_false_full {background-position:0 0}
|
||||
.ztree li span.button.chk.checkbox_false_full_focus {background-position:0 -14px}
|
||||
.ztree li span.button.chk.checkbox_false_part {background-position:0 -28px}
|
||||
.ztree li span.button.chk.checkbox_false_part_focus {background-position:0 -42px}
|
||||
.ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px}
|
||||
.ztree li span.button.chk.checkbox_true_full {background-position:-14px 0}
|
||||
.ztree li span.button.chk.checkbox_true_full_focus {background-position:-14px -14px}
|
||||
.ztree li span.button.chk.checkbox_true_part {background-position:-14px -28px}
|
||||
.ztree li span.button.chk.checkbox_true_part_focus {background-position:-14px -42px}
|
||||
.ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px}
|
||||
.ztree li span.button.chk.radio_false_full {background-position:-28px 0}
|
||||
.ztree li span.button.chk.radio_false_full_focus {background-position:-28px -14px}
|
||||
.ztree li span.button.chk.radio_false_part {background-position:-28px -28px}
|
||||
.ztree li span.button.chk.radio_false_part_focus {background-position:-28px -42px}
|
||||
.ztree li span.button.chk.radio_false_disable {background-position:-28px -56px}
|
||||
.ztree li span.button.chk.radio_true_full {background-position:-42px 0}
|
||||
.ztree li span.button.chk.radio_true_full_focus {background-position:-42px -14px}
|
||||
.ztree li span.button.chk.radio_true_part {background-position:-42px -28px}
|
||||
.ztree li span.button.chk.radio_true_part_focus {background-position:-42px -42px}
|
||||
.ztree li span.button.chk.radio_true_disable {background-position:-42px -56px}
|
||||
|
||||
border:0 none; cursor: pointer;outline:none;}
|
||||
.ztree li span.button.switch {width:18px; height:18px}
|
||||
.ztree li span.button.root_open{background-position:-92px -54px}
|
||||
.ztree li span.button.root_close{background-position:-74px -54px}
|
||||
.ztree li span.button.roots_open{background-position:-92px 0}
|
||||
.ztree li span.button.roots_close{background-position:-74px 0}
|
||||
.ztree li span.button.center_open{background-position:-92px -18px}
|
||||
.ztree li span.button.center_close{background-position:-74px -18px}
|
||||
.ztree li span.button.bottom_open{background-position:-92px -36px}
|
||||
.ztree li span.button.bottom_close{background-position:-74px -36px}
|
||||
.ztree li span.button.noline_open{background-position:-92px -72px}
|
||||
.ztree li span.button.noline_close{background-position:-74px -72px}
|
||||
.ztree li span.button.root_docu{ background:none;}
|
||||
.ztree li span.button.roots_docu{background-position:-56px 0}
|
||||
.ztree li span.button.center_docu{background-position:-56px -18px}
|
||||
.ztree li span.button.bottom_docu{background-position:-56px -36px}
|
||||
.ztree li span.button.noline_docu{ background:none;}
|
||||
|
||||
.ztree li span.button.ico_open{margin-right:2px; background-position:-110px -16px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.ico_close{margin-right:2px; background-position:-110px 0; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.ico_docu{margin-right:2px; background-position:-110px -32px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle}
|
||||
|
||||
.ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
|
||||
.ztree li span.button.ico_open{margin-right:2px; background-position:-110px -16px; vertical-align:top;
|
||||
}
|
||||
.ztree li span.button.ico_close{margin-right:2px; background-position:-110px 0; vertical-align:top; }
|
||||
.ztree li span.button.ico_docu{margin-right:2px; background-position:-110px -32px; vertical-align:top; }
|
||||
.ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; }
|
||||
.ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; }
|
||||
|
||||
ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
|
||||
|
||||
@@ -94,16 +41,6 @@ span.tmpzTreeMove_arrow {
|
||||
ul.ztree.zTreeDragUL {z-index: 333;margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden;
|
||||
background-color:cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
|
||||
.zTreeMask {z-index:1000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
|
||||
|
||||
/* level style*/
|
||||
/*.ztree li span.button.level0 {
|
||||
display:none;
|
||||
}
|
||||
.ztree li ul.level0 {
|
||||
padding:0;
|
||||
background:none;
|
||||
}*/
|
||||
|
||||
.ztree li ul{ margin:0; padding:0}
|
||||
.ztree li {line-height:30px;}
|
||||
.ztree > li {
|
||||
@@ -120,7 +57,7 @@ ul.ztree.zTreeDragUL {z-index: 333;margin:0; padding:0; position:absolute; width
|
||||
|
||||
.ztree li a.level0 span {font-size: 14px;}
|
||||
.ztree li span.button {
|
||||
background-image: none; /* url("./img/left_menuForOutLook.png"); */
|
||||
background-image: none;
|
||||
}
|
||||
.ztree li span.button.switch.level0 {width: 20px;}
|
||||
.ztree li span.button.switch.level1 {width: 20px;}
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(jQuery)}})(function($){var pluses=/\+/g;function encode(s){return config.raw?s:encodeURIComponent(s)}function decode(s){return config.raw?s:decodeURIComponent(s)}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value))}function parseCookieValue(s){if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")}try{s=decodeURIComponent(s.replace(pluses," "));return config.json?JSON.parse(s):s}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value}var config=$.cookie=function(key,value,options){if(value!==undefined&&!$.isFunction(value)){options=$.extend({},config.defaults,options);if(typeof options.expires==="number"){var days=options.expires,t=options.expires=new Date;t.setTime(+t+days*864e5)}return document.cookie=[encode(key),"=",stringifyCookieValue(value),options.expires?"; expires="+options.expires.toUTCString():"",options.path?"; path="+options.path:"",options.domain?"; domain="+options.domain:"",options.secure?"; secure":""].join("")}var result=key?undefined:{};var cookies=document.cookie?document.cookie.split("; "):[];for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split("=");var name=decode(parts.shift());var cookie=parts.join("=");if(key&&key===name){result=read(cookie,value);break}if(!key&&(cookie=read(cookie))!==undefined){result[name]=cookie}}return result};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)===undefined){return false}$.cookie(key,"",$.extend({},options,{expires:-1}));return!$.cookie(key)}});if(typeof jQuery==="undefined"){throw new Error("Bootstrap requires jQuery")}+function($){"use strict";function transitionEnd(){var el=document.createElement("bootstrap");var transEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var name in transEndEventNames){if(el.style[name]!==undefined){return{end:transEndEventNames[name]}}}}$.fn.emulateTransitionEnd=function(duration){var called=false,$el=this;$(this).one($.support.transition.end,function(){called=true});var callback=function(){if(!called)$($el).trigger($.support.transition.end)};setTimeout(callback,duration);return this};$(function(){$.support.transition=transitionEnd()})}(jQuery);+function($){"use strict";var dismiss='[data-dismiss="alert"]';var Alert=function(el){$(el).on("click",dismiss,this.close)};Alert.prototype.close=function(e){var $this=$(this);var selector=$this.attr("data-target");if(!selector){selector=$this.attr("href");selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,"")}var $parent=$(selector);if(e)e.preventDefault();if(!$parent.length){$parent=$this.hasClass("alert")?$this:$this.parent()}$parent.trigger(e=$.Event("close.bs.alert"));if(e.isDefaultPrevented())return;$parent.removeClass("in");function removeElement(){$parent.trigger("closed.bs.alert").remove()}$.support.transition&&$parent.hasClass("fade")?$parent.one($.support.transition.end,removeElement).emulateTransitionEnd(150):removeElement()};var old=$.fn.alert;$.fn.alert=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.alert");if(!data)$this.data("bs.alert",data=new Alert(this));if(typeof option=="string")data[option].call($this)})};$.fn.alert.Constructor=Alert;$.fn.alert.noConflict=function(){$.fn.alert=old;return this};$(document).on("click.bs.alert.data-api",dismiss,Alert.prototype.close)}(jQuery);+function($){"use strict";var Button=function(element,options){this.$element=$(element);this.options=$.extend({},Button.DEFAULTS,options)};Button.DEFAULTS={loadingText:"loading..."};Button.prototype.setState=function(state){var d="disabled";var $el=this.$element;var val=$el.is("input")?"val":"html";var data=$el.data();state=state+"Text";if(!data.resetText)$el.data("resetText",$el[val]());$el[val](data[state]||this.options[state]);setTimeout(function(){state=="loadingText"?$el.addClass(d).attr(d,d):$el.removeClass(d).removeAttr(d)},0)};Button.prototype.toggle=function(){var $parent=this.$element.closest('[data-toggle="buttons"]');if($parent.length){var $input=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");if($input.prop("type")==="radio")$parent.find(".active").removeClass("active")}this.$element.toggleClass("active")};var old=$.fn.button;$.fn.button=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.button");var options=typeof option=="object"&&option;if(!data)$this.data("bs.button",data=new Button(this,options));if(option=="toggle")data.toggle();else if(option)data.setState(option)})};$.fn.button.Constructor=Button;$.fn.button.noConflict=function(){$.fn.button=old;return this};$(document).on("click.bs.button.data-api","[data-toggle^=button]",function(e){var $btn=$(Line truncated
|
||||
})};$.fn.tab.Constructor=Tab;$.fn.tab.noConflict=function(){$.fn.tab=old;return this};$(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(e){e.preventDefault();$(this).tab("show")})}(jQuery);+function($){"use strict";var Affix=function(element,options){this.options=$.extend({},Affix.DEFAULTS,options);this.$window=$(window).on("scroll.bs.affix.data-api",$.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",$.proxy(this.checkPositionWithEventLoop,this));this.$element=$(element);this.affixed=this.unpin=null;this.checkPosition()};Affix.RESET="affix affix-top affix-bottom";Affix.DEFAULTS={offset:0};Affix.prototype.checkPositionWithEventLoop=function(){setTimeout($.proxy(this.checkPosition,this),1)};Affix.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var scrollHeight=$(document).height();var scrollTop=this.$window.scrollTop();var position=this.$element.offset();var offset=this.options.offset;var offsetTop=offset.top;var offsetBottom=offset.bottom;if(typeof offset!="object")offsetBottom=offsetTop=offset;if(typeof offsetTop=="function")offsetTop=offset.top();if(typeof offsetBottom=="function")offsetBottom=offset.bottom();var affix=this.unpin!=null&&scrollTop+this.unpin<=position.top?false:offsetBottom!=null&&position.top+this.$element.height()>=scrollHeight-offsetBottom?"bottom":offsetTop!=null&&scrollTop<=offsetTop?"top":false;if(this.affixed===affix)return;if(this.unpin)this.$element.css("top","");this.affixed=affix;this.unpin=affix=="bottom"?position.top-scrollTop:null;this.$element.removeClass(Affix.RESET).addClass("affix"+(affix?"-"+affix:""));if(affix=="bottom"){this.$element.offset({top:document.body.offsetHeight-offsetBottom-this.$element.height()})}};var old=$.fn.affix;$.fn.affix=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.affix");var options=typeof option=="object"&&option;if(!data)$this.data("bs.affix",data=new Affix(this,options));if(typeof option=="string")data[option]()})};$.fn.affix.Constructor=Affix;$.fn.affix.noConflict=function(){$.fn.affix=old;return this};$(window).on("load",function(){$('[data-spy="affix"]').each(function(){var $spy=$(this);var data=$spy.data();data.offset=data.offset||{};if(data.offsetBottom)data.offset.bottom=data.offsetBottom;if(data.offsetTop)data.offset.top=data.offsetTop;$spy.affix(data)})})}(jQuery);var LEA={};var Notebook={cache:{}};var Note={cache:{}};var Tag={};var Notebook={};var Share={};var Converter;var MarkdownEditor;var ScrollLink;function trimLeft(str,substr){if(!substr||substr==" "){return $.trim(str)}while(str.indexOf(substr)==0){str=str.substring(substr.length)}return str}function json(str){return eval("("+str+")")}function t(){var args=arguments;if(args.length<=1){return args[0]}var text=args[0];if(!text){return text}var pattern="LEAAEL";text=text.replace(/\?/g,pattern);for(var i=1;i<=args.length;++i){text=text.replace(pattern,args[i])}return text}function arrayEqual(a,b){a=a||[];b=b||[];return a.join(",")==b.join(",")}function isArray(obj){return Object.prototype.toString.call(obj)==="[object Array]"}function isEmpty(obj){if(!obj){return true}if(isArray(obj)){if(obj.length==0){return true}}return false}function getFormJsonData(formId){var data=formArrDataToJson($("#"+formId).serializeArray());return data}function formArrDataToJson(arrData){var datas={};var arrObj={};for(var i in arrData){var attr=arrData[i].name;var value=arrData[i].value;if(attr.substring(attr.length-2,attr.length)=="[]"){attr=attr.substring(0,attr.length-2);if(arrObj[attr]==undefined){arrObj[attr]=[value]}else{arrObj[attr].push(value)}continue}datas[attr]=value}return $.extend(datas,arrObj)}function formSerializeDataToJson(formSerializeData){var arr=formSerializeData.split("&");var datas={};var arrObj={};for(var i=0;i<arr.length;++i){var each=arr[i].split("=");var attr=decodeURI(each[0]);var value=decodeURI(each[1]);if(attr.substring(attr.length-2,attr.length)=="[]"){attr=attr.substring(0,attr.length-2);if(arrObj[attr]==undefined){arrObj[attr]=[value]}else{arrObj[attr].push(value)}continue}datas[attr]=value}return $.extend(datas,arrObj)}function _ajaxCallback(ret,successFunc,failureFunc){if(ret===true||ret=="true"||typeof ret=="object"){if(ret&&typeof ret=="object"){if(ret.Msg=="NOTLOGIN"){alert("你还没有登录, 请先登录!");return}}if(typeof successFunc=="function"){successFunc(ret)}}else{if(typeof failureFunc=="function"){failureFunc(ret)}else{alert("error!")}}}function _ajax(type,url,param,successFunc,failureFunc,async){log("-------------------ajax:");log(url);log(param);if(typeof async=="undefined"){async=true}else{async=false}$.ajax({type:type,url:url,data:param,async:async,success:function(ret){_ajaxCallback(ret,successFunc,failureFunc)},error:function(ret){_ajaxCallback(ret,successFunc,failureFunc)}})}function ajaxGet(url,param,successFunc,failureFunc,async){_ajax("GET",url,param,successFunc,failureFunc,async)}function ajaxPost(url,param,successFunc,failLine truncated
|
||||
})};$.fn.tab.Constructor=Tab;$.fn.tab.noConflict=function(){$.fn.tab=old;return this};$(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(e){e.preventDefault();$(this).tab("show")})}(jQuery);+function($){"use strict";var Affix=function(element,options){this.options=$.extend({},Affix.DEFAULTS,options);this.$window=$(window).on("scroll.bs.affix.data-api",$.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",$.proxy(this.checkPositionWithEventLoop,this));this.$element=$(element);this.affixed=this.unpin=null;this.checkPosition()};Affix.RESET="affix affix-top affix-bottom";Affix.DEFAULTS={offset:0};Affix.prototype.checkPositionWithEventLoop=function(){setTimeout($.proxy(this.checkPosition,this),1)};Affix.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var scrollHeight=$(document).height();var scrollTop=this.$window.scrollTop();var position=this.$element.offset();var offset=this.options.offset;var offsetTop=offset.top;var offsetBottom=offset.bottom;if(typeof offset!="object")offsetBottom=offsetTop=offset;if(typeof offsetTop=="function")offsetTop=offset.top();if(typeof offsetBottom=="function")offsetBottom=offset.bottom();var affix=this.unpin!=null&&scrollTop+this.unpin<=position.top?false:offsetBottom!=null&&position.top+this.$element.height()>=scrollHeight-offsetBottom?"bottom":offsetTop!=null&&scrollTop<=offsetTop?"top":false;if(this.affixed===affix)return;if(this.unpin)this.$element.css("top","");this.affixed=affix;this.unpin=affix=="bottom"?position.top-scrollTop:null;this.$element.removeClass(Affix.RESET).addClass("affix"+(affix?"-"+affix:""));if(affix=="bottom"){this.$element.offset({top:document.body.offsetHeight-offsetBottom-this.$element.height()})}};var old=$.fn.affix;$.fn.affix=function(option){return this.each(function(){var $this=$(this);var data=$this.data("bs.affix");var options=typeof option=="object"&&option;if(!data)$this.data("bs.affix",data=new Affix(this,options));if(typeof option=="string")data[option]()})};$.fn.affix.Constructor=Affix;$.fn.affix.noConflict=function(){$.fn.affix=old;return this};$(window).on("load",function(){$('[data-spy="affix"]').each(function(){var $spy=$(this);var data=$spy.data();data.offset=data.offset||{};if(data.offsetBottom)data.offset.bottom=data.offsetBottom;if(data.offsetTop)data.offset.top=data.offsetTop;$spy.affix(data)})})}(jQuery);var LEA={};var Notebook={cache:{}};var Note={cache:{}};var Tag={};var Notebook={};var Share={};var Converter;var MarkdownEditor;var ScrollLink;function trimLeft(str,substr){if(!substr||substr==" "){return $.trim(str)}while(str.indexOf(substr)==0){str=str.substring(substr.length)}return str}function json(str){return eval("("+str+")")}function t(){var args=arguments;if(args.length<=1){return args[0]}var text=args[0];if(!text){return text}var pattern="LEAAEL";text=text.replace(/\?/g,pattern);for(var i=1;i<=args.length;++i){text=text.replace(pattern,args[i])}return text}function arrayEqual(a,b){a=a||[];b=b||[];return a.join(",")==b.join(",")}function isArray(obj){return Object.prototype.toString.call(obj)==="[object Array]"}function isEmpty(obj){if(!obj){return true}if(isArray(obj)){if(obj.length==0){return true}}return false}function getFormJsonData(formId){var data=formArrDataToJson($("#"+formId).serializeArray());return data}function formArrDataToJson(arrData){var datas={};var arrObj={};for(var i in arrData){var attr=arrData[i].name;var value=arrData[i].value;if(attr.substring(attr.length-2,attr.length)=="[]"){attr=attr.substring(0,attr.length-2);if(arrObj[attr]==undefined){arrObj[attr]=[value]}else{arrObj[attr].push(value)}continue}datas[attr]=value}return $.extend(datas,arrObj)}function formSerializeDataToJson(formSerializeData){var arr=formSerializeData.split("&");var datas={};var arrObj={};for(var i=0;i<arr.length;++i){var each=arr[i].split("=");var attr=decodeURI(each[0]);var value=decodeURI(each[1]);if(attr.substring(attr.length-2,attr.length)=="[]"){attr=attr.substring(0,attr.length-2);if(arrObj[attr]==undefined){arrObj[attr]=[value]}else{arrObj[attr].push(value)}continue}datas[attr]=value}return $.extend(datas,arrObj)}function _ajaxCallback(ret,successFunc,failureFunc){if(ret===true||ret=="true"||typeof ret=="object"){if(ret&&typeof ret=="object"){if(ret.Msg=="NOTLOGIN"){alert("你还没有登录, 请先登录!");return}}if(typeof successFunc=="function"){successFunc(ret)}}else{if(typeof failureFunc=="function"){failureFunc(ret)}else{alert("error!")}}}function _ajax(type,url,param,successFunc,failureFunc,async){log("-------------------ajax:");log(url);log(param);if(typeof async=="undefined"){async=true}else{async=false}$.ajax({type:type,url:url,data:param,async:async,success:function(ret){_ajaxCallback(ret,successFunc,failureFunc)},error:function(ret){_ajaxCallback(ret,successFunc,failureFunc)}})}function ajaxGet(url,param,successFunc,failureFunc,async){_ajax("GET",url,param,successFunc,failureFunc,async)}function ajaxPost(url,param,successFunc,failLine truncated
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
Note.curNoteId="";Note.interval="";Note.itemIsBlog='<div class="item-blog"><i class="fa fa-bold" title="blog"></i></div><div class="item-setting"><i class="fa fa-cog" title="setting"></i></div>';Note.itemTplNoImg='<div href="#" class="item ?" noteId="?">';Note.itemTplNoImg+=Note.itemIsBlog+'<div class="item-desc" style="right: 0;"><p class="item-title">?</p><p class="item-text"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-calendar"></i> <span class="updated-time">?</span> <br /><span class="desc">?</span></p></div></div>';Note.itemTpl='<div href="#" class="item ?" noteId="?"><div class="item-thumb" style=""><img src="?"/></div>';Note.itemTpl+=Note.itemIsBlog+'<div class="item-desc" style=""><p class="item-title">?</p><p class="item-text"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-calendar"></i> <span class="updated-time">?</span> <br /><span class="desc">?</span></p></div></div>';Note.newItemTpl='<div href="#" class="item item-active ?" fromUserId="?" noteId="?">';Note.newItemTpl+=Note.itemIsBlog+'<div class="item-desc" style="right: 0px;"><p class="item-title">?</p><p class="item-text"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-calendar"></i> <span class="updated-time">?</span><br /><span class="desc">?</span></p></div></div>';Note.noteItemListO=$("#noteItemList");Note.cacheByNotebookId={all:{}};Note.notebookIds={};Note.isReadOnly=false;Note.intervalTime=6e5;Note.startInterval=function(){Note.interval=setInterval(function(){log("自动保存开始...");changedNote=Note.curChangedSaveIt(false)},Note.intervalTime)};Note.stopInterval=function(){clearInterval(Note.interval);setTimeout(function(){Note.startInterval()},Note.intervalTime)};Note.addNoteCache=function(note){Note.cache[note.NoteId]=note;Note.clearCacheByNotebookId(note.NotebookId)};Note.setNoteCache=function(content,clear){if(!Note.cache[content.NoteId]){Note.cache[content.NoteId]=content}else{$.extend(Note.cache[content.NoteId],content)}if(clear==undefined){clear=true}if(clear){Note.clearCacheByNotebookId(content.NotebookId)}};Note.clearCacheByNotebookId=function(notebookId){if(notebookId){Note.cacheByNotebookId[notebookId]={};Note.cacheByNotebookId["all"]={};Note.notebookIds[notebookId]=true}};Note.notebookHasNotes=function(notebookId){var notes=Note.getNotesByNotebookId(notebookId);return!isEmpty(notes)};Note.getNotesByNotebookId=function(notebookId,sortBy,isAsc){if(!sortBy){sortBy="UpdatedTime"}if(isAsc=="undefined"){isAsc=false}if(!notebookId){notebookId="all"}if(!Note.cacheByNotebookId[notebookId]){return[]}if(Note.cacheByNotebookId[notebookId][sortBy]){return Note.cacheByNotebookId[notebookId][sortBy]}else{}var notes=[];var sortBys=[];for(var i in Note.cache){if(!i){continue}var note=Note.cache[i];if(note.IsTrash||note.IsShared){continue}if(notebookId=="all"||note.NotebookId==notebookId){notes.push(note)}}notes.sort(function(a,b){var t1=a[sortBy];var t2=b[sortBy];if(isAsc){if(t1<t2){return-1}else if(t1>t2){return 1}}else{if(t1<t2){return 1}else if(t1>t2){return-1}}return 0});Note.cacheByNotebookId[notebookId][sortBy]=notes;return notes};Note.renderNotesAndFirstOneContent=function(ret){if(!isArray(ret)){return}Note.renderNotes(ret);if(!isEmpty(ret[0])){Note.changeNote(ret[0].NoteId)}else{}};Note.curHasChanged=function(force){if(force==undefined){force=true}var cacheNote=Note.cache[Note.curNoteId]||{};var title=$("#noteTitle").val();var tags=Tag.getTags();var contents=getEditorContent(cacheNote.IsMarkdown);var content,preview;var contentText;if(isArray(contents)){content=contents[0];preview=contents[1];contentText=content;if(content&&previewIsEmpty(preview)){preview=Converter.makeHtml(content)}if(!content){preview=""}cacheNote.Preview=preview}else{content=contents;try{contentText=$(content).text()}catch(e){}}var hasChanged={hasChanged:false,IsNew:cacheNote.IsNew,IsMarkdown:cacheNote.IsMarkdown,FromUserId:cacheNote.FromUserId,NoteId:cacheNote.NoteId,NotebookId:cacheNote.NotebookId};if(hasChanged.IsNew){$.extend(hasChanged,cacheNote)}if(cacheNote.Title!=title){hasChanged.hasChanged=true;hasChanged.Title=title;if(!hasChanged.Title){}}if(!arrayEqual(cacheNote.Tags,tags)){hasChanged.hasChanged=true;hasChanged.Tags=tags}if(force&&cacheNote.Content!=content||!force&&$(cacheNote.Content).text()!=contentText){hasChanged.hasChanged=true;hasChanged.Content=content;var c=preview||content;hasChanged.Desc=Note.genDesc(c);hasChanged.ImgSrc=Note.getImgSrc(c);hasChanged.Abstract=Note.genAbstract(c)}else{log("text相同");log(cacheNote.Content==content)}hasChanged["UserId"]=cacheNote["UserId"]||"";return hasChanged};Note.genDesc=function(content){if(!content){return""}var token="ALEALE";content=content.replace(/<\/p>/g,token);content=content.replace(/<\/div>/g,token);content=content.replace(/<\/?.+?>/g," ");pattern=new RegExp(token,"g");content=content.replace(pattern,"<br />");content=content.replace(/<br \/>( *)<br \/>/g,"<br />");content=content.replaLine truncated
|
||||
Note.curNoteId="";Note.interval="";Note.itemIsBlog='<div class="item-blog"><i class="fa fa-bold" title="blog"></i></div><div class="item-setting"><i class="fa fa-cog" title="setting"></i></div>';Note.itemTplNoImg='<div href="#" class="item ?" noteId="?">';Note.itemTplNoImg+=Note.itemIsBlog+'<div class="item-desc" style="right: 0;"><p class="item-title">?</p><p class="item-text"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-calendar"></i> <span class="updated-time">?</span> <br /><span class="desc">?</span></p></div></div>';Note.itemTpl='<div href="#" class="item ?" noteId="?"><div class="item-thumb" style=""><img src="?"/></div>';Note.itemTpl+=Note.itemIsBlog+'<div class="item-desc" style=""><p class="item-title">?</p><p class="item-text"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-calendar"></i> <span class="updated-time">?</span> <br /><span class="desc">?</span></p></div></div>';Note.newItemTpl='<div href="#" class="item item-active ?" fromUserId="?" noteId="?">';Note.newItemTpl+=Note.itemIsBlog+'<div class="item-desc" style="right: 0px;"><p class="item-title">?</p><p class="item-text"><i class="fa fa-book"></i> <span class="note-notebook">?</span> <i class="fa fa-calendar"></i> <span class="updated-time">?</span><br /><span class="desc">?</span></p></div></div>';Note.noteItemListO=$("#noteItemList");Note.cacheByNotebookId={all:{}};Note.notebookIds={};Note.isReadOnly=false;Note.intervalTime=6e5;Note.startInterval=function(){Note.interval=setInterval(function(){log("自动保存开始...");changedNote=Note.curChangedSaveIt(false)},Note.intervalTime)};Note.stopInterval=function(){clearInterval(Note.interval);setTimeout(function(){Note.startInterval()},Note.intervalTime)};Note.addNoteCache=function(note){Note.cache[note.NoteId]=note;Note.clearCacheByNotebookId(note.NotebookId)};Note.setNoteCache=function(content,clear){if(!Note.cache[content.NoteId]){Note.cache[content.NoteId]=content}else{$.extend(Note.cache[content.NoteId],content)}if(clear==undefined){clear=true}if(clear){Note.clearCacheByNotebookId(content.NotebookId)}};Note.clearCacheByNotebookId=function(notebookId){if(notebookId){Note.cacheByNotebookId[notebookId]={};Note.cacheByNotebookId["all"]={};Note.notebookIds[notebookId]=true}};Note.notebookHasNotes=function(notebookId){var notes=Note.getNotesByNotebookId(notebookId);return!isEmpty(notes)};Note.getNotesByNotebookId=function(notebookId,sortBy,isAsc){if(!sortBy){sortBy="UpdatedTime"}if(isAsc=="undefined"){isAsc=false}if(!notebookId){notebookId="all"}if(!Note.cacheByNotebookId[notebookId]){return[]}if(Note.cacheByNotebookId[notebookId][sortBy]){return Note.cacheByNotebookId[notebookId][sortBy]}else{}var notes=[];var sortBys=[];for(var i in Note.cache){if(!i){continue}var note=Note.cache[i];if(note.IsTrash||note.IsShared){continue}if(notebookId=="all"||note.NotebookId==notebookId){notes.push(note)}}notes.sort(function(a,b){var t1=a[sortBy];var t2=b[sortBy];if(isAsc){if(t1<t2){return-1}else if(t1>t2){return 1}}else{if(t1<t2){return 1}else if(t1>t2){return-1}}return 0});Note.cacheByNotebookId[notebookId][sortBy]=notes;return notes};Note.renderNotesAndFirstOneContent=function(ret){if(!isArray(ret)){return}Note.renderNotes(ret);if(!isEmpty(ret[0])){Note.changeNote(ret[0].NoteId)}else{}};Note.curHasChanged=function(force){if(force==undefined){force=true}var cacheNote=Note.cache[Note.curNoteId]||{};var title=$("#noteTitle").val();var tags=Tag.getTags();var contents=getEditorContent(cacheNote.IsMarkdown);var content,preview;var contentText;if(isArray(contents)){content=contents[0];preview=contents[1];contentText=content;if(content&&previewIsEmpty(preview)){preview=Converter.makeHtml(content)}if(!content){preview=""}cacheNote.Preview=preview}else{content=contents;try{contentText=$(content).text()}catch(e){}}var hasChanged={hasChanged:false,IsNew:cacheNote.IsNew,IsMarkdown:cacheNote.IsMarkdown,FromUserId:cacheNote.FromUserId,NoteId:cacheNote.NoteId,NotebookId:cacheNote.NotebookId};if(hasChanged.IsNew){$.extend(hasChanged,cacheNote)}if(cacheNote.Title!=title){hasChanged.hasChanged=true;hasChanged.Title=title;if(!hasChanged.Title){}}if(!arrayEqual(cacheNote.Tags,tags)){hasChanged.hasChanged=true;hasChanged.Tags=tags}if(force&&cacheNote.Content!=content||!force&&$(cacheNote.Content).text()!=contentText){hasChanged.hasChanged=true;hasChanged.Content=content;var c=preview||content;hasChanged.Desc=Note.genDesc(c);hasChanged.ImgSrc=Note.getImgSrc(c);hasChanged.Abstract=Note.genAbstract(c)}else{log("text相同");log(cacheNote.Content==content)}hasChanged["UserId"]=cacheNote["UserId"]||"";return hasChanged};Note.genDesc=function(content){if(!content){return""}var token="ALEALE";content=content.replace(/<\/p>/g,token);content=content.replace(/<\/div>/g,token);content=content.replace(/<\/?.+?>/g," ");pattern=new RegExp(token,"g");content=content.replace(pattern,"<br />");content=content.replace(/<br \/>( *)<br \/>/g,"<br />");content=content.replaLine truncated
|
||||
@@ -1152,6 +1152,7 @@ Note.copyNote = function(target, data, isShared) {
|
||||
});
|
||||
}
|
||||
|
||||
// 这里速度不慢, 很快
|
||||
Note.getContextNotebooks = function(notebooks) {
|
||||
var moves = [];
|
||||
var copys = [];
|
||||
@@ -1166,9 +1167,12 @@ Note.getContextNotebooks = function(notebooks) {
|
||||
move.items = mc[0];
|
||||
copy.items = mc[1];
|
||||
copy2.items = mc[2];
|
||||
$.extend(move, {type: "group", width: 150});
|
||||
$.extend(copy, {type: "group", width: 150});
|
||||
$.extend(copy2, {type: "group", width: 150});
|
||||
move.type = "group";
|
||||
move.width = 150;
|
||||
copy.type = "group";
|
||||
copy.width = 150;
|
||||
copy2.type = "group";
|
||||
copy2.width = 150;
|
||||
}
|
||||
moves.push(move);
|
||||
copys.push(copy);
|
||||
@@ -1187,6 +1191,7 @@ Note.initContextmenu = function() {
|
||||
// 得到可移动的notebook
|
||||
var notebooks = Notebook.everNotebooks;
|
||||
var mc = self.getContextNotebooks(notebooks);
|
||||
|
||||
var notebooksMove = mc[0];
|
||||
var notebooksCopy = mc[1];
|
||||
self.notebooksCopy = mc[2];
|
||||
@@ -1269,6 +1274,7 @@ Note.initContextmenu = function() {
|
||||
return this.id != "target3";
|
||||
}
|
||||
|
||||
// 这里很慢!!
|
||||
Note.contextmenu = $("#noteItemList .item-my").contextmenu(noteListMenu);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
Notebook.curNotebookId="";Notebook.cache={};Notebook.notebooks=[];Notebook.notebookNavForListNote="";Notebook.notebookNavForNewNote="";Notebook.setCache=function(notebook){var notebookId=notebook.NotebookId;if(!notebookId){return}if(!Notebook.cache[notebookId]){Notebook.cache[notebookId]={}}$.extend(Notebook.cache[notebookId],notebook)};Notebook.getCurNotebookId=function(){return Notebook.curNotebookId};Notebook.getNotebook=function(notebookId){return Notebook.cache[notebookId]};Notebook.getNotebookTitle=function(notebookId){var notebook=Notebook.cache[notebookId];if(notebook){return notebook.Title}else{return"未知"}};Notebook.getTreeSetting=function(isSearch,isShare){var noSearch=!isSearch;var self=this;function addDiyDom(treeId,treeNode){var spaceWidth=5;var switchObj=$("#"+treeId+" #"+treeNode.tId+"_switch"),icoObj=$("#"+treeId+" #"+treeNode.tId+"_ico");switchObj.remove();icoObj.before(switchObj);if(!isShare){if(!Notebook.isAllNotebookId(treeNode.NotebookId)&&!Notebook.isTrashNotebookId(treeNode.NotebookId)){icoObj.after($('<span class="fa notebook-setting" title="setting"></span>'))}}else{if(!Share.isDefaultNotebookId(treeNode.NotebookId)){icoObj.after($('<span class="fa notebook-setting" title="setting"></span>'))}}if(treeNode.level>1){var spaceStr="<span style='display: inline-block;width:"+spaceWidth*treeNode.level+"px'></span>";switchObj.before(spaceStr)}}function beforeDrag(treeId,treeNodes){for(var i=0,l=treeNodes.length;i<l;i++){if(treeNodes[i].drag===false){return false}}return true}function beforeDrop(treeId,treeNodes,targetNode,moveType){return targetNode?targetNode.drop!==false:true}function onDrop(e,treeId,treeNodes,targetNode,moveType){var treeNode=treeNodes[0];if(!targetNode){return}var parentNode;var treeObj=self.tree;var ajaxData={curNotebookId:treeNode.NotebookId};if(moveType=="inner"){parentNode=targetNode}else{parentNode=targetNode.getParentNode()}if(!parentNode){var nodes=treeObj.getNodes()}else{ajaxData.parentNotebookId=parentNode.NotebookId;var nextLevel=parentNode.level+1;function filter(node){return node.level==nextLevel}var nodes=treeObj.getNodesByFilter(filter,false,parentNode)}ajaxData.siblings=[];for(var i in nodes){var notebookId=nodes[i].NotebookId;if(!Notebook.isAllNotebookId(notebookId)&&!Notebook.isTrashNotebookId(notebookId)){ajaxData.siblings.push(notebookId)}}ajaxPost("/notebook/dragNotebooks",{data:JSON.stringify(ajaxData)});Notebook.changeNav()}if(!isShare){var onClick=function(e,treeId,treeNode){var notebookId=treeNode.NotebookId;Notebook.changeNotebook(notebookId)};var onDblClick=function(e){var notebookId=$(e.target).attr("notebookId");if(!Notebook.isAllNotebookId(notebookId)&&!Notebook.isTrashNotebookId(notebookId)){self.updateNotebookTitle(e.target)}}}else{var onClick=function(e,treeId,treeNode){var notebookId=treeNode.NotebookId;var fromUserId=$(e.target).closest(".friend-notebooks").attr("fromUserId");Share.changeNotebook(fromUserId,notebookId)};var onDblClick=null}var setting={view:{showLine:false,showIcon:false,selectedMulti:false,dblClickExpand:false,addDiyDom:addDiyDom},data:{key:{name:"Title",children:"Subs"}},edit:{enable:true,showRemoveBtn:false,showRenameBtn:false,drag:{isMove:noSearch,prev:noSearch,inner:noSearch,next:noSearch}},callback:{beforeDrag:beforeDrag,beforeDrop:beforeDrop,onDrop:onDrop,onClick:onClick,onDblClick:onDblClick,beforeRename:function(treeId,treeNode,newName,isCancel){if(newName==""){if(treeNode.IsNew){self.tree.removeNode(treeNode);return true}return false}if(treeNode.Title==newName){return true}if(treeNode.IsNew){var parentNode=treeNode.getParentNode();var parentNotebookId=parentNode?parentNode.NotebookId:"";self.doAddNotebook(treeNode.NotebookId,newName,parentNotebookId)}else{self.doUpdateNotebookTitle(treeNode.NotebookId,newName)}return true}}};if(isSearch){}return setting};Notebook.allNotebookId="0";Notebook.trashNotebookId="-1";Notebook.curNotebookIsTrashOrAll=function(){return Notebook.curNotebookId==Notebook.trashNotebookId||Notebook.curNotebookId==Notebook.allNotebookId};Notebook.renderNotebooks=function(notebooks){var self=this;if(!notebooks||typeof notebooks!="object"||notebooks.length<0){notebooks=[]}notebooks=[{NotebookId:Notebook.allNotebookId,Title:getMsg("all"),drop:false,drag:false}].concat(notebooks);notebooks.push({NotebookId:Notebook.trashNotebookId,Title:getMsg("trash"),drop:false,drag:false});Notebook.notebooks=notebooks;self.tree=$.fn.zTree.init($("#notebookList"),self.getTreeSetting(),notebooks);var $notebookList=$("#notebookList");$notebookList.hover(function(){if(!$(this).hasClass("showIcon")){$(this).addClass("showIcon")}},function(){$(this).removeClass("showIcon")});if(!isEmpty(notebooks)){Notebook.curNotebookId=notebooks[0].NotebookId;self.cacheAllNotebooks(notebooks)}Notebook.renderNav();Notebook.changeNotebookNavForNewNote(notebooks[0].NotebookId)};Notebook.cacheAllNotebooks=function(notebooks){var self=this;for(var i in notebooks){var notebook=notebooks[i];Notebook.cache[notebook.NotebookId]=noteLine truncated
|
||||
Notebook.curNotebookId="";Notebook.cache={};Notebook.notebooks=[];Notebook.notebookNavForListNote="";Notebook.notebookNavForNewNote="";Notebook.setCache=function(notebook){var notebookId=notebook.NotebookId;if(!notebookId){return}if(!Notebook.cache[notebookId]){Notebook.cache[notebookId]={}}$.extend(Notebook.cache[notebookId],notebook)};Notebook.getCurNotebookId=function(){return Notebook.curNotebookId};Notebook.getNotebook=function(notebookId){return Notebook.cache[notebookId]};Notebook.getNotebookTitle=function(notebookId){var notebook=Notebook.cache[notebookId];if(notebook){return notebook.Title}else{return"未知"}};Notebook.getTreeSetting=function(isSearch,isShare){var noSearch=!isSearch;var self=this;function addDiyDom(treeId,treeNode){var spaceWidth=5;var switchObj=$("#"+treeId+" #"+treeNode.tId+"_switch"),icoObj=$("#"+treeId+" #"+treeNode.tId+"_ico");switchObj.remove();icoObj.before(switchObj);if(!isShare){if(!Notebook.isAllNotebookId(treeNode.NotebookId)&&!Notebook.isTrashNotebookId(treeNode.NotebookId)){icoObj.after($('<span class="fa notebook-setting" title="setting"></span>'))}}else{if(!Share.isDefaultNotebookId(treeNode.NotebookId)){icoObj.after($('<span class="fa notebook-setting" title="setting"></span>'))}}if(treeNode.level>1){var spaceStr="<span style='display: inline-block;width:"+spaceWidth*treeNode.level+"px'></span>";switchObj.before(spaceStr)}}function beforeDrag(treeId,treeNodes){for(var i=0,l=treeNodes.length;i<l;i++){if(treeNodes[i].drag===false){return false}}return true}function beforeDrop(treeId,treeNodes,targetNode,moveType){return targetNode?targetNode.drop!==false:true}function onDrop(e,treeId,treeNodes,targetNode,moveType){var treeNode=treeNodes[0];if(!targetNode){return}var parentNode;var treeObj=self.tree;var ajaxData={curNotebookId:treeNode.NotebookId};if(moveType=="inner"){parentNode=targetNode}else{parentNode=targetNode.getParentNode()}if(!parentNode){var nodes=treeObj.getNodes()}else{ajaxData.parentNotebookId=parentNode.NotebookId;var nextLevel=parentNode.level+1;function filter(node){return node.level==nextLevel}var nodes=treeObj.getNodesByFilter(filter,false,parentNode)}ajaxData.siblings=[];for(var i in nodes){var notebookId=nodes[i].NotebookId;if(!Notebook.isAllNotebookId(notebookId)&&!Notebook.isTrashNotebookId(notebookId)){ajaxData.siblings.push(notebookId)}}ajaxPost("/notebook/dragNotebooks",{data:JSON.stringify(ajaxData)});setTimeout(function(){Notebook.changeNav()},100)}if(!isShare){var onClick=function(e,treeId,treeNode){var notebookId=treeNode.NotebookId;Notebook.changeNotebook(notebookId)};var onDblClick=function(e){var notebookId=$(e.target).attr("notebookId");if(!Notebook.isAllNotebookId(notebookId)&&!Notebook.isTrashNotebookId(notebookId)){self.updateNotebookTitle(e.target)}}}else{var onClick=function(e,treeId,treeNode){var notebookId=treeNode.NotebookId;var fromUserId=$(e.target).closest(".friend-notebooks").attr("fromUserId");Share.changeNotebook(fromUserId,notebookId)};var onDblClick=null}var setting={view:{showLine:false,showIcon:false,selectedMulti:false,dblClickExpand:false,addDiyDom:addDiyDom},data:{key:{name:"Title",children:"Subs"}},edit:{enable:true,showRemoveBtn:false,showRenameBtn:false,drag:{isMove:noSearch,prev:noSearch,inner:noSearch,next:noSearch}},callback:{beforeDrag:beforeDrag,beforeDrop:beforeDrop,onDrop:onDrop,onClick:onClick,onDblClick:onDblClick,beforeRename:function(treeId,treeNode,newName,isCancel){if(newName==""){if(treeNode.IsNew){self.tree.removeNode(treeNode);return true}return false}if(treeNode.Title==newName){return true}if(treeNode.IsNew){var parentNode=treeNode.getParentNode();var parentNotebookId=parentNode?parentNode.NotebookId:"";self.doAddNotebook(treeNode.NotebookId,newName,parentNotebookId)}else{self.doUpdateNotebookTitle(treeNode.NotebookId,newName)}return true}}};if(isSearch){}return setting};Notebook.allNotebookId="0";Notebook.trashNotebookId="-1";Notebook.curNotebookIsTrashOrAll=function(){return Notebook.curNotebookId==Notebook.trashNotebookId||Notebook.curNotebookId==Notebook.allNotebookId};Notebook.renderNotebooks=function(notebooks){var self=this;if(!notebooks||typeof notebooks!="object"||notebooks.length<0){notebooks=[]}notebooks=[{NotebookId:Notebook.allNotebookId,Title:getMsg("all"),drop:false,drag:false}].concat(notebooks);notebooks.push({NotebookId:Notebook.trashNotebookId,Title:getMsg("trash"),drop:false,drag:false});Notebook.notebooks=notebooks;self.tree=$.fn.zTree.init($("#notebookList"),self.getTreeSetting(),notebooks);var $notebookList=$("#notebookList");$notebookList.hover(function(){if(!$(this).hasClass("showIcon")){$(this).addClass("showIcon")}},function(){$(this).removeClass("showIcon")});if(!isEmpty(notebooks)){Notebook.curNotebookId=notebooks[0].NotebookId;self.cacheAllNotebooks(notebooks)}Notebook.renderNav();Notebook.changeNotebookNavForNewNote(notebooks[0].NotebookId)};Notebook.cacheAllNotebooks=function(notebooks){var self=this;for(var i in notebooks){var notebook=notebooks[i];Notebook.cacLine truncated
|
||||
@@ -95,14 +95,14 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
// 成为子节点, 那么只需要得到targetNode下所有的子结点即可
|
||||
if(moveType == "inner") {
|
||||
parentNode = targetNode;
|
||||
// 在targetNode之前或之后,
|
||||
// 那么: 1) 需要将该parentNode下所有的node重新排序即可; 2) treeNodes[0]为parentNode的子
|
||||
} else {
|
||||
parentNode = targetNode.getParentNode();
|
||||
}
|
||||
|
||||
// 在targetNode之前或之后,
|
||||
// 那么: 1) 需要将该parentNode下所有的node重新排序即可; 2) treeNodes[0]为parentNode的子
|
||||
if(!parentNode) {
|
||||
var nodes = treeObj.getNodes();
|
||||
var nodes = treeObj.getNodes(); // 得到所有nodes
|
||||
} else {
|
||||
ajaxData.parentNotebookId = parentNode.NotebookId;
|
||||
var nextLevel = parentNode.level+1;
|
||||
@@ -119,9 +119,13 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
ajaxData.siblings.push(notebookId);
|
||||
}
|
||||
}
|
||||
|
||||
ajaxPost("/notebook/dragNotebooks", {data: JSON.stringify(ajaxData)});
|
||||
|
||||
Notebook.changeNav();
|
||||
// 这里慢!
|
||||
setTimeout(function() {
|
||||
Notebook.changeNav();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
if(!isShare) {
|
||||
@@ -303,6 +307,7 @@ Notebook.searchNotebookForList = function(key) {
|
||||
$notebookList.hide();
|
||||
|
||||
var notebooks = self.tree.getNodesByParamFuzzy("Title", key);
|
||||
log('search');
|
||||
log(notebooks);
|
||||
if(isEmpty(notebooks)) {
|
||||
$search.html("");
|
||||
@@ -353,7 +358,6 @@ Notebook.everNavForNewNote = "";
|
||||
Notebook.everNotebooks = [];
|
||||
Notebook.changeNav = function() {
|
||||
var self = Notebook;
|
||||
|
||||
var notebooks = Notebook.tree.getNodes();
|
||||
var pureNotebooks = notebooks.slice(1, -1); // 不含新和垃圾
|
||||
var html = self.getChangedNotebooks(pureNotebooks);
|
||||
@@ -364,8 +368,12 @@ Notebook.changeNav = function() {
|
||||
$("#notebookNavForNewNote").html(html);
|
||||
|
||||
// 移动, 复制重新来, 因为nav变了, 移动至-----的notebook导航也变了
|
||||
// 这里速度很慢
|
||||
var t1 = (new Date()).getTime();
|
||||
Note.initContextmenu();
|
||||
Share.initContextmenu(Note.notebooksCopy);
|
||||
var t2 = (new Date()).getTime();
|
||||
log(t2-t1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
background-clip: padding-box;
|
||||
overflow: scroll;
|
||||
}
|
||||
.b-m-split {
|
||||
height: 6px;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
LEA.cmroot=1;(function($){function returnfalse(){return false}$.fn.contextmenu=function(option){var cmroot="contextmenu"+LEA.cmroot;LEA.cmroot++;option=$.extend({alias:cmroot,width:150},option);var ruleName=null,target=null,groups={},mitems={},actions={},showGroups=[],itemTpl='<div class="b-m-$[type]" unselectable="on"><div class="clearfix"><div class="b-m-icon pull-left"><i class="fa $[faIcon]"></i>$[imgIcon]</div><div class="pull-left"><span class="c-text" unselectable="on">$[text]</span></div></div></div>';itemNoIconTpl="<div class='b-m-$[type]' unselectable=on><nobr unselectable=on><span align='absmiddle'></span><span class='c-text' unselectable=on>$[text]</span></nobr></div>";var gTemplet=$("<div/>").addClass("b-m-mpanel").attr("unselectable","on").css("display","none");var iTemplet=$("<div/>").addClass("b-m-item").attr("unselectable","on");var sTemplet=$("<div/>").addClass("b-m-split");var buildGroup=function(obj){groups[obj.alias]=this;this.gidx=obj.alias;this.id=obj.alias;if(obj.disable){this.disable=obj.disable;this.className="b-m-idisable"}$(this).width(obj.width).click(function(){}).mousedown(returnfalse).appendTo($("body"));obj=null;return this};var buildItem=function(obj){var T=this;T.title=obj.text;T.idx=obj.alias;T.gidx=obj.gidx;T.data=obj;var imgIcon="";if(obj.icon){imgIcon='<img src="'+obj.icon+'"/>'}obj.imgIcon=imgIcon;if(obj.icon){T.innerHTML=itemTpl.replace(/\$\[([^\]]+)\]/g,function(){return obj[arguments[1]]})}else{T.innerHTML=itemTpl.replace(/\$\[([^\]]+)\]/g,function(){return obj[arguments[1]]})}if(obj.disable){T.disable=obj.disable;T.className="b-m-idisable"}obj.items&&(T.group=true);obj.action&&(actions[obj.alias]=obj.action);mitems[obj.alias]=T;T=obj=null;return this};var addItems=function(gidx,items,parentAlias){var tmp=null;for(var i=0;i<items.length;i++){if(items[i].type=="splitLine"){tmp=sTemplet.clone()[0]}else{if(!items[i].alias){if(parentAlias){items[i].alias=parentAlias+"."+items[i].text}else{items[i].alias=items[i].text}}items[i].gidx=gidx;if(items[i].type=="group"&&!items[i].action){buildGroup.apply(gTemplet.clone()[0],[items[i]]);arguments.callee(items[i].alias,items[i].items,items[i].alias);items[i].type="arrow";tmp=buildItem.apply(iTemplet.clone()[0],[items[i]])}else{if(items[i].type=="group"){buildGroup.apply(gTemplet.clone()[0],[items[i]]);arguments.callee(items[i].alias,items[i].items,items[i].alias);items[i].type="arrow";tmp=buildItem.apply(iTemplet.clone()[0],[items[i]])}else{items[i].type="ibody";tmp=buildItem.apply(iTemplet.clone()[0],[items[i]])}var thisItem=items[i];(function(thisItem,tmp){$(tmp).click(function(e){if(!this.disable){if($.isFunction(actions[this.idx])){actions[this.idx].call(this,target,thisItem)}hideMenuPane();$(target).removeClass("contextmenu-hover")}return false})})(thisItem,tmp)}$(tmp).bind("contextmenu",returnfalse).hover(overItem,outItem)}groups[gidx].appendChild(tmp);tmp=items[i]=items[i].items=null}gidx=items=null};var overItem=function(e){if(this.disable)return false;hideMenuPane.call(groups[this.gidx]);if(this.group){var pos=$(this).offset();var width=$(this).outerWidth();showMenuGroup.apply(groups[this.idx],[pos,width])}this.className="b-m-ifocus";return false};var outItem=function(e){if(this.disable)return false;if(!this.group){this.className="b-m-item"}return false};var showMenuGroup=function(pos,width){var bwidth=$("body").width();var bheight=document.documentElement.clientHeight;var mwidth=$(this).outerWidth();var mheight=$(this).outerHeight();pos.left=pos.left+width+mwidth>bwidth?pos.left-mwidth<0?0:pos.left-mwidth:pos.left+width;pos.top=pos.top+mheight>bheight?pos.top-mheight+(width>0?25:0)<0?0:pos.top-mheight+(width>0?25:0):pos.top;$(this).css(pos).show();showGroups.push(this.gidx)};var hideMenuPane=function(){var alias=null;for(var i=showGroups.length-1;i>=0;i--){if(showGroups[i]==this.gidx)break;alias=showGroups.pop();groups[alias].style.display="none";mitems[alias]&&(mitems[alias].className="b-m-item")}};function applyRule(rule){for(var i in mitems)disable(i,!rule.disable);for(var i=0;i<rule.items.length;i++)disable(rule.items[i],rule.disable);ruleName=rule.name}function disable(alias,disabled){var item=mitems[alias];if(!item||!item.lastChild){return}item.className=(item.disable=item.lastChild.disabled=disabled)?"b-m-idisable":"b-m-item"}function showMenu(e,menutarget){target=menutarget;showMenuGroup.call(groups[cmroot],{left:e.pageX,top:e.pageY},0);if(!$(target).hasClass("item-active")){$(target).addClass("contextmenu-hover")}$(document).one("click",function(){hideMenuPane();$(target).removeClass("contextmenu-hover")})}var $root=$("#"+option.alias);var root=null;if($root.length==0){root=buildGroup.apply(gTemplet.clone()[0],[option]);root.applyrule=applyRule;root.showMenu=showMenu;addItems(option.alias,option.items)}else{root=$root[0]}function onShowMenu(e){var bShowContext=option.onContextMenu&&$.isFunction(option.onContextMenu)?option.onContextMenu.call(this,e):true;if(bShowContext){if(option.onShow&&$.isFunction(optionLine truncated
|
||||
LEA.cmroot=1;(function($){function returnfalse(){return false}$.fn.contextmenu=function(option){var cmroot="contextmenu"+LEA.cmroot;LEA.cmroot++;option=$.extend({alias:cmroot,width:150},option);var ruleName=null,target=null,groups={},mitems={},actions={},showGroups=[],itemTpl='<div class="b-m-$[type]" unselectable="on"><div class="clearfix"><div class="b-m-icon pull-left"><i class="fa $[faIcon]"></i>$[imgIcon]</div><div class="pull-left"><span class="c-text" unselectable="on">$[text]</span></div></div></div>';itemNoIconTpl="<div class='b-m-$[type]' unselectable=on><nobr unselectable=on><span align='absmiddle'></span><span class='c-text' unselectable=on>$[text]</span></nobr></div>";var gTemplet=$("<div/>").addClass("b-m-mpanel").attr("unselectable","on").css("display","none");var iTemplet=$("<div/>").addClass("b-m-item").attr("unselectable","on");var sTemplet=$("<div/>").addClass("b-m-split");var $body=$("body");var itemsCache={};var buildGroup=function(obj){groups[obj.alias]=this;this.gidx=obj.alias;this.id=obj.alias;if(obj.disable){this.disable=obj.disable;this.className="b-m-idisable"}$(this).width(obj.width).click(function(){}).mousedown(returnfalse).appendTo($body);obj=null;return this};var buildItem=function(obj){var T=this;T.title=obj.text;T.idx=obj.alias;T.gidx=obj.gidx;T.data=obj;var imgIcon="";if(obj.icon){imgIcon='<img src="'+obj.icon+'"/>'}obj.imgIcon=imgIcon;if(obj.icon){T.innerHTML=itemTpl.replace(/\$\[([^\]]+)\]/g,function(){return obj[arguments[1]]})}else{T.innerHTML=itemTpl.replace(/\$\[([^\]]+)\]/g,function(){return obj[arguments[1]]})}if(obj.disable){T.disable=obj.disable;T.className="b-m-idisable"}obj.items&&(T.group=true);obj.action&&(actions[obj.alias]=obj.action);mitems[obj.alias]=T;T=obj=null;return this};var addItems=function(gidx,items,parentAlias){var tmp=null;var len=items.length;for(var i=0;i<len;i++){var item=items[i];if(item.type=="splitLine"){tmp=sTemplet.clone()[0]}else{if(!item.alias){if(parentAlias){item.alias=parentAlias+"."+item.text}else{item.alias=item.text}}item.gidx=gidx;if(item.type=="group"&&!item.action){buildGroup.apply(gTemplet.clone()[0],[item]);itemsCache[item.alias]=item.items;item.type="arrow";tmp=buildItem.apply(iTemplet.clone()[0],[item])}else{if(item.type=="group"){buildGroup.apply(gTemplet.clone()[0],[item]);itemsCache[item.alias]=item.items;item.type="arrow";tmp=buildItem.apply(iTemplet.clone()[0],[item])}else{item.type="ibody";tmp=buildItem.apply(iTemplet.clone()[0],[item])}var thisItem=item;(function(thisItem,tmp){$(tmp).click(function(e){if(!this.disable){if($.isFunction(actions[this.idx])){actions[this.idx].call(this,target,thisItem)}hideMenuPane();$(target).removeClass("contextmenu-hover")}return false})})(thisItem,tmp)}$(tmp).bind("contextmenu",returnfalse).hover(overItem,outItem)}groups[gidx].appendChild(tmp);tmp=item=item.items=null}gidx=items=null};var overItem=function(e){if(this.disable)return false;hideMenuPane.call(groups[this.gidx]);if(this.group){var pos=$(this).offset();var width=$(this).outerWidth();showMenuGroup.apply(groups[this.idx],[pos,width,this])}this.className="b-m-ifocus";return false};var outItem=function(e){if(this.disable)return false;if(!this.group){this.className="b-m-item"}return false};var showMenuGroup=function(pos,width,t){var $this=$(this);if($this.html()==""){addItems(t.idx,itemsCache[t.idx],t.idx)}var bwidth=$body.width();var bheight=document.documentElement.clientHeight-10;bheight=bheight<0?100:bheight;var mwidth=$(this).outerWidth();var mheight=$(this).outerHeight()-10;mheight=mheight<0?100:mheight;var mwidth=$(this).outerWidth();pos.left=pos.left+width+mwidth>bwidth?pos.left-mwidth<0?0:pos.left-mwidth:pos.left+width;pos.top=pos.top+mheight>bheight?pos.top-mheight+(width>0?25:0)<0?0:pos.top-mheight+(width>0?25:0):pos.top;$(this).css(pos).show().css("max-height",bheight);showGroups.push(this.gidx)};var hideMenuPane=function(){var alias=null;for(var i=showGroups.length-1;i>=0;i--){if(showGroups[i]==this.gidx)break;alias=showGroups.pop();groups[alias].style.display="none";mitems[alias]&&(mitems[alias].className="b-m-item")}};function applyRule(rule){for(var i in mitems)disable(i,!rule.disable);for(var i=0;i<rule.items.length;i++)disable(rule.items[i],rule.disable);ruleName=rule.name}function disable(alias,disabled){var item=mitems[alias];if(!item||!item.lastChild){return}item.className=(item.disable=item.lastChild.disabled=disabled)?"b-m-idisable":"b-m-item"}function showMenu(e,menutarget){target=menutarget;showMenuGroup.call(groups[cmroot],{left:e.pageX,top:e.pageY},0);if(!$(target).hasClass("item-active")){$(target).addClass("contextmenu-hover")}$(document).one("click",function(){hideMenuPane();$(target).removeClass("contextmenu-hover")})}var $root=$("#"+option.alias);var root=null;if($root.length==0){root=buildGroup.apply(gTemplet.clone()[0],[option]);root.applyrule=applyRule;root.showMenu=showMenu;addItems(option.alias,option.items)}else{root=$root[0]}function onShowMenu(e){var bShowContext=option.onContextMenu&&Line truncated
|
||||
@@ -12,8 +12,12 @@ LEA.cmroot = 1;
|
||||
var gTemplet = $("<div/>").addClass("b-m-mpanel").attr("unselectable", "on").css("display", "none");
|
||||
var iTemplet = $("<div/>").addClass("b-m-item").attr("unselectable", "on");
|
||||
var sTemplet = $("<div/>").addClass("b-m-split");
|
||||
var $body = $("body");
|
||||
|
||||
var itemsCache = {}; // idx => items
|
||||
|
||||
//build group item, which has sub items
|
||||
var buildGroup = function(obj) {
|
||||
var buildGroup = function(obj) { // this = $("")对象, obj=item
|
||||
groups[obj.alias] = this;
|
||||
this.gidx = obj.alias;
|
||||
this.id = obj.alias;
|
||||
@@ -21,7 +25,7 @@ LEA.cmroot = 1;
|
||||
this.disable = obj.disable;
|
||||
this.className = "b-m-idisable";
|
||||
}
|
||||
$(this).width(obj.width).click(function(){}).mousedown(returnfalse).appendTo($("body"));
|
||||
$(this).width(obj.width).click(function(){}).mousedown(returnfalse).appendTo($body);
|
||||
|
||||
obj = null;
|
||||
return this;
|
||||
@@ -59,42 +63,47 @@ LEA.cmroot = 1;
|
||||
//add new items
|
||||
var addItems = function(gidx, items, parentAlias) {
|
||||
var tmp = null;
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].type == "splitLine") {
|
||||
//split line
|
||||
var len = items.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var item = items[i];
|
||||
if (item.type == "splitLine") {
|
||||
tmp = sTemplet.clone()[0];
|
||||
} else {
|
||||
// life, alias可以不需要, 从text取, 但必须唯一
|
||||
if(!items[i].alias) {
|
||||
if(!item.alias) {
|
||||
if(parentAlias) {
|
||||
items[i].alias = parentAlias + "." + items[i].text; // 移动.Hadoop
|
||||
item.alias = parentAlias + "." + item.text; // 移动.Hadoop
|
||||
} else {
|
||||
items[i].alias = items[i].text;
|
||||
item.alias = item.text;
|
||||
}
|
||||
// log(items[i].alias);
|
||||
// log(item.alias);
|
||||
}
|
||||
items[i].gidx = gidx;
|
||||
if (items[i].type == "group" && !items[i].action) {
|
||||
item.gidx = gidx;
|
||||
if (item.type == "group" && !item.action) {
|
||||
//group
|
||||
buildGroup.apply(gTemplet.clone()[0], [items[i]]);
|
||||
arguments.callee(items[i].alias, items[i].items, items[i].alias); // life 传上级的alias, 避免重复
|
||||
items[i].type = "arrow";
|
||||
tmp = buildItem.apply(iTemplet.clone()[0], [items[i]]);
|
||||
buildGroup.apply(gTemplet.clone()[0], [item]);
|
||||
itemsCache[item.alias] = item.items;
|
||||
// 递归调用, 可以动态生成?
|
||||
// arguments.callee(item.alias, item.items, item.alias); // life 传上级的alias, 避免重复
|
||||
item.type = "arrow";
|
||||
tmp = buildItem.apply(iTemplet.clone()[0], [item]);
|
||||
} else {
|
||||
// 如果group有action还是可以点击的 life
|
||||
if(items[i].type == "group") {
|
||||
if(item.type == "group") {
|
||||
//group
|
||||
buildGroup.apply(gTemplet.clone()[0], [items[i]]);
|
||||
arguments.callee(items[i].alias, items[i].items, items[i].alias); // life 传上级的alias, 避免重复
|
||||
items[i].type = "arrow";
|
||||
tmp = buildItem.apply(iTemplet.clone()[0], [items[i]]);
|
||||
buildGroup.apply(gTemplet.clone()[0], [item]);
|
||||
itemsCache[item.alias] = item.items;
|
||||
// 递归调用
|
||||
// arguments.callee(item.alias, item.items, item.alias); // life 传上级的alias, 避免重复
|
||||
item.type = "arrow";
|
||||
tmp = buildItem.apply(iTemplet.clone()[0], [item]);
|
||||
} else {
|
||||
//normal item
|
||||
items[i].type = "ibody";
|
||||
tmp = buildItem.apply(iTemplet.clone()[0], [items[i]]);
|
||||
item.type = "ibody";
|
||||
tmp = buildItem.apply(iTemplet.clone()[0], [item]);
|
||||
}
|
||||
//
|
||||
var thisItem = items[i];
|
||||
var thisItem = item;
|
||||
|
||||
// 点击item
|
||||
// 用闭包来存储变量
|
||||
@@ -116,15 +125,15 @@ LEA.cmroot = 1;
|
||||
|
||||
}(thisItem, tmp));
|
||||
|
||||
|
||||
} //end if
|
||||
$(tmp).bind("contextmenu", returnfalse).hover(overItem, outItem);
|
||||
}
|
||||
groups[gidx].appendChild(tmp);
|
||||
tmp = items[i] = items[i].items = null;
|
||||
tmp = item = item.items = null;
|
||||
} //end for
|
||||
gidx = items = null;
|
||||
};
|
||||
// hover
|
||||
var overItem = function(e) {
|
||||
//menu item is disabled
|
||||
if (this.disable)
|
||||
@@ -134,11 +143,12 @@ LEA.cmroot = 1;
|
||||
if (this.group) {
|
||||
var pos = $(this).offset();
|
||||
var width = $(this).outerWidth();
|
||||
showMenuGroup.apply(groups[this.idx], [pos, width]);
|
||||
showMenuGroup.apply(groups[this.idx], [pos, width, this]);
|
||||
}
|
||||
this.className = "b-m-ifocus";
|
||||
return false;
|
||||
};
|
||||
// hover out
|
||||
//menu loses focus
|
||||
var outItem = function(e) {
|
||||
//disabled item
|
||||
@@ -150,15 +160,26 @@ LEA.cmroot = 1;
|
||||
} //Endif
|
||||
return false;
|
||||
};
|
||||
//show menu group at specified position
|
||||
var showMenuGroup = function(pos, width) {
|
||||
var bwidth = $("body").width();
|
||||
var bheight = document.documentElement.clientHeight;
|
||||
|
||||
// 显示group, 这里可以动态生成
|
||||
// show menu group at specified position
|
||||
var showMenuGroup = function(pos, width, t) {
|
||||
var $this = $(this); // dom 对象
|
||||
// 没有东西, 那么生成之, 动态生成 life [ok]
|
||||
if($this.html() == "") {
|
||||
addItems(t.idx, itemsCache[t.idx], t.idx);
|
||||
}
|
||||
var bwidth = $body.width();
|
||||
// var bheight = $body.height();
|
||||
var bheight = document.documentElement.clientHeight-10;
|
||||
bheight = bheight < 0 ? 100 : bheight;
|
||||
var mwidth = $(this).outerWidth();
|
||||
var mheight = $(this).outerHeight()-10;
|
||||
mheight = mheight < 0 ? 100 : mheight;
|
||||
var mwidth = $(this).outerWidth();
|
||||
var mheight = $(this).outerHeight();
|
||||
pos.left = (pos.left + width + mwidth > bwidth) ? (pos.left - mwidth < 0 ? 0 : pos.left - mwidth) : pos.left + width;
|
||||
pos.top = (pos.top + mheight > bheight) ? (pos.top - mheight + (width > 0 ? 25 : 0) < 0 ? 0 : pos.top - mheight + (width > 0 ? 25 : 0)) : pos.top;
|
||||
$(this).css(pos).show();
|
||||
$(this).css(pos).show().css("max-height", bheight);
|
||||
showGroups.push(this.gidx);
|
||||
};
|
||||
//to hide menu
|
||||
@@ -217,27 +238,13 @@ LEA.cmroot = 1;
|
||||
root = buildGroup.apply(gTemplet.clone()[0], [option]);
|
||||
root.applyrule = applyRule;
|
||||
root.showMenu = showMenu;
|
||||
// 这里很费时
|
||||
addItems(option.alias, option.items);
|
||||
}
|
||||
else {
|
||||
root = $root[0];
|
||||
}
|
||||
|
||||
/*
|
||||
var me = $(this).each(function() {
|
||||
return $(this).bind('contextmenu', function(e) {
|
||||
var bShowContext = (option.onContextMenu && $.isFunction(option.onContextMenu)) ? option.onContextMenu.call(this, e) : true;
|
||||
if (bShowContext) {
|
||||
if (option.onShow && $.isFunction(option.onShow)) {
|
||||
option.onShow.call(this, root);
|
||||
}
|
||||
root.showMenu(e, this);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
function onShowMenu(e) {
|
||||
var bShowContext = (option.onContextMenu && $.isFunction(option.onContextMenu)) ? option.onContextMenu.call(this, e) : true;
|
||||
if (bShowContext) {
|
||||
@@ -261,8 +268,10 @@ LEA.cmroot = 1;
|
||||
if (option.rule) {
|
||||
applyRule(option.rule);
|
||||
}
|
||||
/*
|
||||
gTemplet = iTemplet = sTemplet = itemTpl = buildGroup = buildItem = null;
|
||||
addItems = overItem = outItem = null;
|
||||
*/
|
||||
//CollectGarbage();
|
||||
|
||||
var out = {
|
||||
@@ -270,8 +279,6 @@ LEA.cmroot = 1;
|
||||
me.unbind("contextmenu");
|
||||
},
|
||||
showMenu: function(e, target) {
|
||||
log(e);
|
||||
log(target);
|
||||
onShowMenu.call(target, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2555,6 +2555,7 @@
|
||||
if (node.parentTId) view.expandCollapseParentNode(this.setting, node.getParentNode(), true);
|
||||
view.editNode(this.setting, node)
|
||||
}
|
||||
|
||||
zTreeTools.moveNode = function(targetNode, node, moveType, isSilent) {
|
||||
if (!node) return node;
|
||||
if (targetNode && !targetNode.isParent && this.setting.data.keep.leaf && moveType === consts.move.TYPE_INNER) {
|
||||
@@ -2661,6 +2662,7 @@
|
||||
if (tools.uCanDo(setting)) {
|
||||
doc.bind("mousemove", _docMouseMove);
|
||||
}
|
||||
// 拖动
|
||||
function _docMouseMove(event) {
|
||||
//avoid start drag after click node
|
||||
if (root.dragFlag == 0 && Math.abs(mouseDownX - event.clientX) < setting.edit.drag.minMoveSize
|
||||
@@ -2994,6 +2996,7 @@
|
||||
}
|
||||
var newNodes = isCopy ? tools.clone(nodes) : nodes;
|
||||
|
||||
// 这里速度慢
|
||||
function dropCallback() {
|
||||
if (isOtherTree) {
|
||||
if (!isCopy) {
|
||||
@@ -3019,6 +3022,7 @@
|
||||
if (isCopy && moveType == consts.move.TYPE_INNER) {
|
||||
view.addNodes(targetSetting, dragTargetNode, newNodes);
|
||||
} else {
|
||||
// 这里
|
||||
if (isCopy) {
|
||||
view.addNodes(targetSetting, dragTargetNode.getParentNode(), newNodes);
|
||||
}
|
||||
@@ -3036,6 +3040,7 @@
|
||||
view.selectNodes(targetSetting, newNodes);
|
||||
$$(newNodes[0], setting).focus().blur();
|
||||
|
||||
// 这里非常耗时!!! 原因是ajax自定义方法
|
||||
setting.treeObj.trigger(consts.event.DROP, [event, targetSetting.treeId, newNodes, dragTargetNode, moveType, isCopy]);
|
||||
}
|
||||
|
||||
@@ -3240,6 +3245,7 @@
|
||||
root.noSelection = false;
|
||||
root.curEditNode = node;
|
||||
},
|
||||
// 这里, 速度慢
|
||||
moveNode: function(setting, targetNode, node, moveType, animateFlag, isSilent) {
|
||||
var root = data.getRoot(setting),
|
||||
childKey = setting.data.key.children;
|
||||
@@ -3302,7 +3308,6 @@
|
||||
} else if (targetObj.get(0) && moveType == consts.move.TYPE_NEXT) {
|
||||
targetObj.after(nodeDom);
|
||||
}
|
||||
|
||||
//repair the data after move
|
||||
var i,l,
|
||||
tmpSrcIndex = -1,
|
||||
@@ -3412,6 +3417,10 @@
|
||||
if (!isSilent) {
|
||||
view.expandCollapseParentNode(setting, node.getParentNode(), true, animateFlag);
|
||||
}
|
||||
|
||||
// 这里打印一直就好了
|
||||
setTimeout(function() {
|
||||
}, 10);
|
||||
},
|
||||
removeEditBtn: function(setting, node) {
|
||||
$$(node, consts.id.EDIT, setting).unbind().remove();
|
||||
|
||||
Reference in new issue
Block a user