stuff_to_do_plugin 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYRIGHT.txt +18 -0
- data/CREDITS.txt +6 -0
- data/GPL.txt +339 -0
- data/README.rdoc +61 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/app/controllers/stuff_to_do_controller.rb +161 -0
- data/app/helpers/stuff_to_do_helper.rb +88 -0
- data/app/models/stuff_to_do.rb +208 -0
- data/app/models/stuff_to_do_filter.rb +32 -0
- data/app/models/stuff_to_do_mailer.rb +16 -0
- data/app/views/settings/_stuff_to_do_settings.html.erb +27 -0
- data/app/views/stuff_to_do/_issue.html.erb +16 -0
- data/app/views/stuff_to_do/_item.html.erb +5 -0
- data/app/views/stuff_to_do/_left_panes.html.erb +51 -0
- data/app/views/stuff_to_do/_panes.html.erb +11 -0
- data/app/views/stuff_to_do/_project.html.erb +6 -0
- data/app/views/stuff_to_do/_right_panes.html.erb +25 -0
- data/app/views/stuff_to_do/_time_grid.html.erb +113 -0
- data/app/views/stuff_to_do/_time_grid_form.html.erb +32 -0
- data/app/views/stuff_to_do/index.html.erb +44 -0
- data/app/views/stuff_to_do_mailer/recommended_below_threshold.erb +3 -0
- data/app/views/stuff_to_do_mailer/recommended_below_threshold.text.html.rhtml +1 -0
- data/assets/images/b.png +0 -0
- data/assets/images/bl.png +0 -0
- data/assets/images/br.png +0 -0
- data/assets/images/closelabel.gif +0 -0
- data/assets/images/loading.gif +0 -0
- data/assets/images/tl.png +0 -0
- data/assets/images/tr.png +0 -0
- data/assets/javascripts/facebox.js +319 -0
- data/assets/javascripts/jquery-1.2.6.min.js +32 -0
- data/assets/javascripts/jquery-ui.js +2839 -0
- data/assets/javascripts/jquery.contextMenu.js +212 -0
- data/assets/javascripts/semantic.cache +15 -0
- data/assets/javascripts/stuff-to-do.js +270 -0
- data/assets/javascripts/ui/build.xml +24 -0
- data/assets/javascripts/ui/effects.blind.js +49 -0
- data/assets/javascripts/ui/effects.bounce.js +78 -0
- data/assets/javascripts/ui/effects.clip.js +54 -0
- data/assets/javascripts/ui/effects.core.js +510 -0
- data/assets/javascripts/ui/effects.drop.js +50 -0
- data/assets/javascripts/ui/effects.explode.js +79 -0
- data/assets/javascripts/ui/effects.fold.js +55 -0
- data/assets/javascripts/ui/effects.highlight.js +48 -0
- data/assets/javascripts/ui/effects.pulsate.js +55 -0
- data/assets/javascripts/ui/effects.scale.js +180 -0
- data/assets/javascripts/ui/effects.shake.js +57 -0
- data/assets/javascripts/ui/effects.slide.js +50 -0
- data/assets/javascripts/ui/effects.transfer.js +59 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-ar.js +26 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-bg.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-ca.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-cs.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-da.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-de.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-eo.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-es.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-fa.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-fi.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-fr.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-he.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-hr.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-hu.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-hy.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-id.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-is.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-it.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-ja.js +26 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-ko.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-lt.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-lv.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-nl.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-no.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-pl.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-pt-BR.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-ro.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-ru.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-sk.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-sl.js +26 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-sq.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-sv.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-th.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-tr.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-uk.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-zh-CN.js +25 -0
- data/assets/javascripts/ui/i18n/ui.datepicker-zh-TW.js +25 -0
- data/assets/javascripts/ui/svn.log +11 -0
- data/assets/javascripts/ui/ui.accordion.js +400 -0
- data/assets/javascripts/ui/ui.core.js +533 -0
- data/assets/javascripts/ui/ui.datepicker.js +1754 -0
- data/assets/javascripts/ui/ui.dialog.js +630 -0
- data/assets/javascripts/ui/ui.draggable.js +696 -0
- data/assets/javascripts/ui/ui.droppable.js +314 -0
- data/assets/javascripts/ui/ui.progressbar.js +114 -0
- data/assets/javascripts/ui/ui.resizable.js +805 -0
- data/assets/javascripts/ui/ui.selectable.js +266 -0
- data/assets/javascripts/ui/ui.slider.js +552 -0
- data/assets/javascripts/ui/ui.sortable.js +1012 -0
- data/assets/javascripts/ui/ui.tabs.js +572 -0
- data/assets/stylesheets/stuff_to_do.css +216 -0
- data/config/locales/bg.yml +18 -0
- data/config/locales/ca-fr.yml +18 -0
- data/config/locales/cs.yml +16 -0
- data/config/locales/da.yml +16 -0
- data/config/locales/de.yml +18 -0
- data/config/locales/en.yml +24 -0
- data/config/locales/es.yml +19 -0
- data/config/locales/fr.yml +17 -0
- data/config/locales/hu.yml +16 -0
- data/config/locales/it.yml +16 -0
- data/config/locales/ja.yml +18 -0
- data/config/locales/ko.yml +18 -0
- data/config/locales/lt.yml +18 -0
- data/config/locales/nl.yml +20 -0
- data/config/locales/pt-BR.yml +18 -0
- data/config/locales/ru.yml +19 -0
- data/config/locales/sv.yml +19 -0
- data/config/locales/tr.yml +18 -0
- data/config/routes.rb +3 -0
- data/init.rb +54 -0
- data/lang/bg.yml +17 -0
- data/lang/ca-fr.yml +17 -0
- data/lang/cs.yml +15 -0
- data/lang/da.yml +15 -0
- data/lang/de.yml +17 -0
- data/lang/en.yml +21 -0
- data/lang/es.yml +18 -0
- data/lang/fr.yml +16 -0
- data/lang/hu.yml +15 -0
- data/lang/it.yml +15 -0
- data/lang/ja.yml +17 -0
- data/lang/ko.yml +17 -0
- data/lang/lt.yml +17 -0
- data/lang/pt-br.yml +17 -0
- data/lang/ru.yml +15 -0
- data/lang/sv.yml +18 -0
- data/lang/tr.yml +17 -0
- data/lib/redmine_stuff_to_do/stuff_to_do_compatibility.rb +15 -0
- data/lib/stuff_to_do_array_patch.rb +8 -0
- data/lib/stuff_to_do_issue_patch.rb +57 -0
- data/lib/stuff_to_do_project_patch.rb +31 -0
- data/lib/stuff_to_do_user_patch.rb +10 -0
- data/rails/init.rb +1 -0
- data/spec/controllers/stuff_to_do_controller_add_to_time_grid_spec.rb +58 -0
- data/spec/controllers/stuff_to_do_controller_index_spec.rb +155 -0
- data/spec/controllers/stuff_to_do_controller_remove_from_time_grid_spec.rb +56 -0
- data/spec/controllers/stuff_to_do_controller_reorder_spec.rb +179 -0
- data/spec/controllers/stuff_to_do_controller_save_time_entries_spec.rb +56 -0
- data/spec/controllers/stuff_to_do_private_methods_spec.rb +82 -0
- data/spec/lib/stuff_to_do_issue_patch_spec.rb +60 -0
- data/spec/lib/stuff_to_do_project_patch_spec.rb +50 -0
- data/spec/lib/stuff_to_do_user_patch_spec.rb +8 -0
- data/spec/models/stuff_to_do_filter_spec.rb +3 -0
- data/spec/models/stuff_to_do_mailer_spec.rb +42 -0
- data/spec/models/stuff_to_do_spec.rb +426 -0
- data/spec/sanity_spec.rb +7 -0
- data/spec/spec_helper.rb +130 -0
- metadata +211 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery 1.2.6 - New Wave Javascript
|
3
|
+
*
|
4
|
+
* Copyright (c) 2008 John Resig (jquery.com)
|
5
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
6
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
7
|
+
*
|
8
|
+
* $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
|
9
|
+
* $Rev: 5685 $
|
10
|
+
*/
|
11
|
+
(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
|
12
|
+
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
|
13
|
+
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
|
14
|
+
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
|
15
|
+
return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
|
16
|
+
this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
|
17
|
+
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
|
18
|
+
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
|
19
|
+
script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
|
20
|
+
for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
|
21
|
+
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
|
22
|
+
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
|
23
|
+
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
|
24
|
+
while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
|
25
|
+
while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
|
26
|
+
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
|
27
|
+
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
|
28
|
+
xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
|
29
|
+
jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
|
30
|
+
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
|
31
|
+
s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
|
32
|
+
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
|
@@ -0,0 +1,2839 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery UI 1.6rc2
|
3
|
+
*
|
4
|
+
* Includes:
|
5
|
+
* * UI Core
|
6
|
+
* * Draggable
|
7
|
+
* * Dropable
|
8
|
+
* * Sortable
|
9
|
+
* * Effects Core
|
10
|
+
* * Effect Highlight
|
11
|
+
*
|
12
|
+
*
|
13
|
+
*
|
14
|
+
* Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
|
15
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
16
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
17
|
+
*
|
18
|
+
* http://docs.jquery.com/UI
|
19
|
+
*/
|
20
|
+
;(function($) {
|
21
|
+
|
22
|
+
/** jQuery core modifications and additions **/
|
23
|
+
|
24
|
+
var _remove = $.fn.remove;
|
25
|
+
$.fn.remove = function() {
|
26
|
+
$("*", this).add(this).triggerHandler("remove");
|
27
|
+
return _remove.apply(this, arguments );
|
28
|
+
};
|
29
|
+
|
30
|
+
function isVisible(element) {
|
31
|
+
function checkStyles(element) {
|
32
|
+
var style = element.style;
|
33
|
+
return (style.display != 'none' && style.visibility != 'hidden');
|
34
|
+
}
|
35
|
+
|
36
|
+
var visible = checkStyles(element);
|
37
|
+
|
38
|
+
(visible && $.each($.dir(element, 'parentNode'), function() {
|
39
|
+
return (visible = checkStyles(this));
|
40
|
+
}));
|
41
|
+
|
42
|
+
return visible;
|
43
|
+
}
|
44
|
+
|
45
|
+
$.extend($.expr[':'], {
|
46
|
+
data: function(a, i, m) {
|
47
|
+
return $.data(a, m[3]);
|
48
|
+
},
|
49
|
+
|
50
|
+
// TODO: add support for object, area
|
51
|
+
tabbable: function(a, i, m) {
|
52
|
+
var nodeName = a.nodeName.toLowerCase();
|
53
|
+
|
54
|
+
return (
|
55
|
+
// in tab order
|
56
|
+
a.tabIndex >= 0 &&
|
57
|
+
|
58
|
+
( // filter node types that participate in the tab order
|
59
|
+
|
60
|
+
// anchor tag
|
61
|
+
('a' == nodeName && a.href) ||
|
62
|
+
|
63
|
+
// enabled form element
|
64
|
+
(/input|select|textarea|button/.test(nodeName) &&
|
65
|
+
'hidden' != a.type && !a.disabled)
|
66
|
+
) &&
|
67
|
+
|
68
|
+
// visible on page
|
69
|
+
isVisible(a)
|
70
|
+
);
|
71
|
+
}
|
72
|
+
});
|
73
|
+
|
74
|
+
$.keyCode = {
|
75
|
+
BACKSPACE: 8,
|
76
|
+
CAPS_LOCK: 20,
|
77
|
+
COMMA: 188,
|
78
|
+
CONTROL: 17,
|
79
|
+
DELETE: 46,
|
80
|
+
DOWN: 40,
|
81
|
+
END: 35,
|
82
|
+
ENTER: 13,
|
83
|
+
ESCAPE: 27,
|
84
|
+
HOME: 36,
|
85
|
+
INSERT: 45,
|
86
|
+
LEFT: 37,
|
87
|
+
NUMPAD_ADD: 107,
|
88
|
+
NUMPAD_DECIMAL: 110,
|
89
|
+
NUMPAD_DIVIDE: 111,
|
90
|
+
NUMPAD_ENTER: 108,
|
91
|
+
NUMPAD_MULTIPLY: 106,
|
92
|
+
NUMPAD_SUBTRACT: 109,
|
93
|
+
PAGE_DOWN: 34,
|
94
|
+
PAGE_UP: 33,
|
95
|
+
PERIOD: 190,
|
96
|
+
RIGHT: 39,
|
97
|
+
SHIFT: 16,
|
98
|
+
SPACE: 32,
|
99
|
+
TAB: 9,
|
100
|
+
UP: 38
|
101
|
+
};
|
102
|
+
|
103
|
+
// $.widget is a factory to create jQuery plugins
|
104
|
+
// taking some boilerplate code out of the plugin code
|
105
|
+
// created by Scott González and Jörn Zaefferer
|
106
|
+
function getter(namespace, plugin, method, args) {
|
107
|
+
function getMethods(type) {
|
108
|
+
var methods = $[namespace][plugin][type] || [];
|
109
|
+
return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
|
110
|
+
}
|
111
|
+
|
112
|
+
var methods = getMethods('getter');
|
113
|
+
if (args.length == 1 && typeof args[0] == 'string') {
|
114
|
+
methods = methods.concat(getMethods('getterSetter'));
|
115
|
+
}
|
116
|
+
return ($.inArray(method, methods) != -1);
|
117
|
+
}
|
118
|
+
|
119
|
+
$.widget = function(name, prototype) {
|
120
|
+
var namespace = name.split(".")[0];
|
121
|
+
name = name.split(".")[1];
|
122
|
+
|
123
|
+
// create plugin method
|
124
|
+
$.fn[name] = function(options) {
|
125
|
+
var isMethodCall = (typeof options == 'string'),
|
126
|
+
args = Array.prototype.slice.call(arguments, 1);
|
127
|
+
|
128
|
+
// prevent calls to internal methods
|
129
|
+
if (isMethodCall && options.substring(0, 1) == '_') {
|
130
|
+
return this;
|
131
|
+
}
|
132
|
+
|
133
|
+
// handle getter methods
|
134
|
+
if (isMethodCall && getter(namespace, name, options, args)) {
|
135
|
+
var instance = $.data(this[0], name);
|
136
|
+
return (instance ? instance[options].apply(instance, args)
|
137
|
+
: undefined);
|
138
|
+
}
|
139
|
+
|
140
|
+
// handle initialization and non-getter methods
|
141
|
+
return this.each(function() {
|
142
|
+
var instance = $.data(this, name);
|
143
|
+
|
144
|
+
// constructor
|
145
|
+
(!instance && !isMethodCall &&
|
146
|
+
$.data(this, name, new $[namespace][name](this, options)));
|
147
|
+
|
148
|
+
// method call
|
149
|
+
(instance && isMethodCall && $.isFunction(instance[options]) &&
|
150
|
+
instance[options].apply(instance, args));
|
151
|
+
});
|
152
|
+
};
|
153
|
+
|
154
|
+
// create widget constructor
|
155
|
+
$[namespace][name] = function(element, options) {
|
156
|
+
var self = this;
|
157
|
+
|
158
|
+
this.widgetName = name;
|
159
|
+
this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
|
160
|
+
this.widgetBaseClass = namespace + '-' + name;
|
161
|
+
|
162
|
+
this.options = $.extend({},
|
163
|
+
$.widget.defaults,
|
164
|
+
$[namespace][name].defaults,
|
165
|
+
$.metadata && $.metadata.get(element)[name],
|
166
|
+
options);
|
167
|
+
|
168
|
+
this.element = $(element)
|
169
|
+
.bind('setData.' + name, function(e, key, value) {
|
170
|
+
return self._setData(key, value);
|
171
|
+
})
|
172
|
+
.bind('getData.' + name, function(e, key) {
|
173
|
+
return self._getData(key);
|
174
|
+
})
|
175
|
+
.bind('remove', function() {
|
176
|
+
return self.destroy();
|
177
|
+
});
|
178
|
+
|
179
|
+
this._init();
|
180
|
+
};
|
181
|
+
|
182
|
+
// add widget prototype
|
183
|
+
$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
|
184
|
+
|
185
|
+
// TODO: merge getter and getterSetter properties from widget prototype
|
186
|
+
// and plugin prototype
|
187
|
+
$[namespace][name].getterSetter = 'option';
|
188
|
+
};
|
189
|
+
|
190
|
+
$.widget.prototype = {
|
191
|
+
_init: function() {},
|
192
|
+
destroy: function() {
|
193
|
+
this.element.removeData(this.widgetName);
|
194
|
+
},
|
195
|
+
|
196
|
+
option: function(key, value) {
|
197
|
+
var options = key,
|
198
|
+
self = this;
|
199
|
+
|
200
|
+
if (typeof key == "string") {
|
201
|
+
if (value === undefined) {
|
202
|
+
return this._getData(key);
|
203
|
+
}
|
204
|
+
options = {};
|
205
|
+
options[key] = value;
|
206
|
+
}
|
207
|
+
|
208
|
+
$.each(options, function(key, value) {
|
209
|
+
self._setData(key, value);
|
210
|
+
});
|
211
|
+
},
|
212
|
+
_getData: function(key) {
|
213
|
+
return this.options[key];
|
214
|
+
},
|
215
|
+
_setData: function(key, value) {
|
216
|
+
this.options[key] = value;
|
217
|
+
|
218
|
+
if (key == 'disabled') {
|
219
|
+
this.element[value ? 'addClass' : 'removeClass'](
|
220
|
+
this.widgetBaseClass + '-disabled');
|
221
|
+
}
|
222
|
+
},
|
223
|
+
|
224
|
+
enable: function() {
|
225
|
+
this._setData('disabled', false);
|
226
|
+
},
|
227
|
+
disable: function() {
|
228
|
+
this._setData('disabled', true);
|
229
|
+
},
|
230
|
+
|
231
|
+
_trigger: function(type, e, data) {
|
232
|
+
var eventName = (type == this.widgetEventPrefix
|
233
|
+
? type : this.widgetEventPrefix + type);
|
234
|
+
e = e || $.event.fix({ type: eventName, target: this.element[0] });
|
235
|
+
return this.element.triggerHandler(eventName, [e, data], this.options[type]);
|
236
|
+
}
|
237
|
+
};
|
238
|
+
|
239
|
+
$.widget.defaults = {
|
240
|
+
disabled: false
|
241
|
+
};
|
242
|
+
|
243
|
+
|
244
|
+
/** jQuery UI core **/
|
245
|
+
|
246
|
+
$.ui = {
|
247
|
+
plugin: {
|
248
|
+
add: function(module, option, set) {
|
249
|
+
var proto = $.ui[module].prototype;
|
250
|
+
for(var i in set) {
|
251
|
+
proto.plugins[i] = proto.plugins[i] || [];
|
252
|
+
proto.plugins[i].push([option, set[i]]);
|
253
|
+
}
|
254
|
+
},
|
255
|
+
call: function(instance, name, args) {
|
256
|
+
var set = instance.plugins[name];
|
257
|
+
if(!set) { return; }
|
258
|
+
|
259
|
+
for (var i = 0; i < set.length; i++) {
|
260
|
+
if (instance.options[set[i][0]]) {
|
261
|
+
set[i][1].apply(instance.element, args);
|
262
|
+
}
|
263
|
+
}
|
264
|
+
}
|
265
|
+
},
|
266
|
+
cssCache: {},
|
267
|
+
css: function(name) {
|
268
|
+
if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
|
269
|
+
var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
|
270
|
+
|
271
|
+
//if (!$.browser.safari)
|
272
|
+
//tmp.appendTo('body');
|
273
|
+
|
274
|
+
//Opera and Safari set width and height to 0px instead of auto
|
275
|
+
//Safari returns rgba(0,0,0,0) when bgcolor is not set
|
276
|
+
$.ui.cssCache[name] = !!(
|
277
|
+
(!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) ||
|
278
|
+
!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
|
279
|
+
);
|
280
|
+
try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){}
|
281
|
+
return $.ui.cssCache[name];
|
282
|
+
},
|
283
|
+
disableSelection: function(el) {
|
284
|
+
return $(el)
|
285
|
+
.attr('unselectable', 'on')
|
286
|
+
.css('MozUserSelect', 'none')
|
287
|
+
.bind('selectstart.ui', function() { return false; });
|
288
|
+
},
|
289
|
+
enableSelection: function(el) {
|
290
|
+
return $(el)
|
291
|
+
.attr('unselectable', 'off')
|
292
|
+
.css('MozUserSelect', '')
|
293
|
+
.unbind('selectstart.ui');
|
294
|
+
},
|
295
|
+
hasScroll: function(e, a) {
|
296
|
+
|
297
|
+
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
298
|
+
if ($(e).css('overflow') == 'hidden') { return false; }
|
299
|
+
|
300
|
+
var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
|
301
|
+
has = false;
|
302
|
+
|
303
|
+
if (e[scroll] > 0) { return true; }
|
304
|
+
|
305
|
+
// TODO: determine which cases actually cause this to happen
|
306
|
+
// if the element doesn't have the scroll set, see if it's possible to
|
307
|
+
// set the scroll
|
308
|
+
e[scroll] = 1;
|
309
|
+
has = (e[scroll] > 0);
|
310
|
+
e[scroll] = 0;
|
311
|
+
return has;
|
312
|
+
}
|
313
|
+
};
|
314
|
+
|
315
|
+
|
316
|
+
/** Mouse Interaction Plugin **/
|
317
|
+
|
318
|
+
$.ui.mouse = {
|
319
|
+
_mouseInit: function() {
|
320
|
+
var self = this;
|
321
|
+
|
322
|
+
this.element.bind('mousedown.'+this.widgetName, function(e) {
|
323
|
+
return self._mouseDown(e);
|
324
|
+
});
|
325
|
+
|
326
|
+
// Prevent text selection in IE
|
327
|
+
if ($.browser.msie) {
|
328
|
+
this._mouseUnselectable = this.element.attr('unselectable');
|
329
|
+
this.element.attr('unselectable', 'on');
|
330
|
+
}
|
331
|
+
|
332
|
+
this.started = false;
|
333
|
+
},
|
334
|
+
|
335
|
+
// TODO: make sure destroying one instance of mouse doesn't mess with
|
336
|
+
// other instances of mouse
|
337
|
+
_mouseDestroy: function() {
|
338
|
+
this.element.unbind('.'+this.widgetName);
|
339
|
+
|
340
|
+
// Restore text selection in IE
|
341
|
+
($.browser.msie
|
342
|
+
&& this.element.attr('unselectable', this._mouseUnselectable));
|
343
|
+
},
|
344
|
+
|
345
|
+
_mouseDown: function(e) {
|
346
|
+
// we may have missed mouseup (out of window)
|
347
|
+
(this._mouseStarted && this._mouseUp(e));
|
348
|
+
|
349
|
+
this._mouseDownEvent = e;
|
350
|
+
|
351
|
+
var self = this,
|
352
|
+
btnIsLeft = (e.which == 1),
|
353
|
+
elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
|
354
|
+
if (!btnIsLeft || elIsCancel || !this._mouseCapture(e)) {
|
355
|
+
return true;
|
356
|
+
}
|
357
|
+
|
358
|
+
this.mouseDelayMet = !this.options.delay;
|
359
|
+
if (!this.mouseDelayMet) {
|
360
|
+
this._mouseDelayTimer = setTimeout(function() {
|
361
|
+
self.mouseDelayMet = true;
|
362
|
+
}, this.options.delay);
|
363
|
+
}
|
364
|
+
|
365
|
+
if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
|
366
|
+
this._mouseStarted = (this._mouseStart(e) !== false);
|
367
|
+
if (!this._mouseStarted) {
|
368
|
+
e.preventDefault();
|
369
|
+
return true;
|
370
|
+
}
|
371
|
+
}
|
372
|
+
|
373
|
+
// these delegates are required to keep context
|
374
|
+
this._mouseMoveDelegate = function(e) {
|
375
|
+
return self._mouseMove(e);
|
376
|
+
};
|
377
|
+
this._mouseUpDelegate = function(e) {
|
378
|
+
return self._mouseUp(e);
|
379
|
+
};
|
380
|
+
$(document)
|
381
|
+
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
382
|
+
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
383
|
+
|
384
|
+
return false;
|
385
|
+
},
|
386
|
+
|
387
|
+
_mouseMove: function(e) {
|
388
|
+
// IE mouseup check - mouseup happened when mouse was out of window
|
389
|
+
if ($.browser.msie && !e.button) {
|
390
|
+
return this._mouseUp(e);
|
391
|
+
}
|
392
|
+
|
393
|
+
if (this._mouseStarted) {
|
394
|
+
this._mouseDrag(e);
|
395
|
+
return false;
|
396
|
+
}
|
397
|
+
|
398
|
+
if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
|
399
|
+
this._mouseStarted =
|
400
|
+
(this._mouseStart(this._mouseDownEvent, e) !== false);
|
401
|
+
(this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e));
|
402
|
+
}
|
403
|
+
|
404
|
+
return !this._mouseStarted;
|
405
|
+
},
|
406
|
+
|
407
|
+
_mouseUp: function(e) {
|
408
|
+
$(document)
|
409
|
+
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
410
|
+
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
411
|
+
|
412
|
+
if (this._mouseStarted) {
|
413
|
+
this._mouseStarted = false;
|
414
|
+
this._mouseStop(e);
|
415
|
+
}
|
416
|
+
|
417
|
+
return false;
|
418
|
+
},
|
419
|
+
|
420
|
+
_mouseDistanceMet: function(e) {
|
421
|
+
return (Math.max(
|
422
|
+
Math.abs(this._mouseDownEvent.pageX - e.pageX),
|
423
|
+
Math.abs(this._mouseDownEvent.pageY - e.pageY)
|
424
|
+
) >= this.options.distance
|
425
|
+
);
|
426
|
+
},
|
427
|
+
|
428
|
+
_mouseDelayMet: function(e) {
|
429
|
+
return this.mouseDelayMet;
|
430
|
+
},
|
431
|
+
|
432
|
+
// These are placeholder methods, to be overriden by extending plugin
|
433
|
+
_mouseStart: function(e) {},
|
434
|
+
_mouseDrag: function(e) {},
|
435
|
+
_mouseStop: function(e) {},
|
436
|
+
_mouseCapture: function(e) { return true; }
|
437
|
+
};
|
438
|
+
|
439
|
+
$.ui.mouse.defaults = {
|
440
|
+
cancel: null,
|
441
|
+
distance: 1,
|
442
|
+
delay: 0
|
443
|
+
};
|
444
|
+
|
445
|
+
})(jQuery);
|
446
|
+
/*
|
447
|
+
* jQuery UI Draggable 1.6rc2
|
448
|
+
|
449
|
+
*
|
450
|
+
* Copyright (c) 2008 Paul Bakaus
|
451
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
452
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
453
|
+
*
|
454
|
+
* http://docs.jquery.com/UI/Draggables
|
455
|
+
*
|
456
|
+
* Depends:
|
457
|
+
* ui.core.js
|
458
|
+
*/
|
459
|
+
(function($) {
|
460
|
+
|
461
|
+
$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
|
462
|
+
|
463
|
+
getHandle: function(e) {
|
464
|
+
|
465
|
+
var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
|
466
|
+
$(this.options.handle, this.element)
|
467
|
+
.find("*")
|
468
|
+
.andSelf()
|
469
|
+
.each(function() {
|
470
|
+
if(this == e.target) handle = true;
|
471
|
+
});
|
472
|
+
|
473
|
+
return handle;
|
474
|
+
|
475
|
+
},
|
476
|
+
|
477
|
+
createHelper: function() {
|
478
|
+
|
479
|
+
var o = this.options;
|
480
|
+
var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone() : this.element);
|
481
|
+
|
482
|
+
if(!helper.parents('body').length)
|
483
|
+
helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
|
484
|
+
|
485
|
+
if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
|
486
|
+
helper.css("position", "absolute");
|
487
|
+
|
488
|
+
return helper;
|
489
|
+
|
490
|
+
},
|
491
|
+
|
492
|
+
|
493
|
+
_init: function() {
|
494
|
+
|
495
|
+
if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
|
496
|
+
this.element[0].style.position = 'relative';
|
497
|
+
|
498
|
+
(this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-draggable"));
|
499
|
+
(this.options.disabled && this.element.addClass('ui-draggable-disabled'));
|
500
|
+
|
501
|
+
this._mouseInit();
|
502
|
+
|
503
|
+
},
|
504
|
+
|
505
|
+
_mouseCapture: function(e) {
|
506
|
+
|
507
|
+
var o = this.options;
|
508
|
+
|
509
|
+
if (this.helper || o.disabled || $(e.target).is('.ui-resizable-handle'))
|
510
|
+
return false;
|
511
|
+
|
512
|
+
//Quit if we're not on a valid handle
|
513
|
+
this.handle = this.getHandle(e);
|
514
|
+
if (!this.handle)
|
515
|
+
return false;
|
516
|
+
|
517
|
+
return true;
|
518
|
+
|
519
|
+
},
|
520
|
+
|
521
|
+
_mouseStart: function(e) {
|
522
|
+
|
523
|
+
var o = this.options;
|
524
|
+
|
525
|
+
//Create and append the visible helper
|
526
|
+
this.helper = this.createHelper();
|
527
|
+
|
528
|
+
//If ddmanager is used for droppables, set the global draggable
|
529
|
+
if($.ui.ddmanager)
|
530
|
+
$.ui.ddmanager.current = this;
|
531
|
+
|
532
|
+
/*
|
533
|
+
* - Position generation -
|
534
|
+
* This block generates everything position related - it's the core of draggables.
|
535
|
+
*/
|
536
|
+
|
537
|
+
this.margins = { //Cache the margins
|
538
|
+
left: (parseInt(this.element.css("marginLeft"),10) || 0),
|
539
|
+
top: (parseInt(this.element.css("marginTop"),10) || 0)
|
540
|
+
};
|
541
|
+
|
542
|
+
this.cssPosition = this.helper.css("position"); //Store the helper's css position
|
543
|
+
this.offset = this.element.offset(); //The element's absolute position on the page
|
544
|
+
this.offset = { //Substract the margins from the element's absolute offset
|
545
|
+
top: this.offset.top - this.margins.top,
|
546
|
+
left: this.offset.left - this.margins.left
|
547
|
+
};
|
548
|
+
|
549
|
+
this.offset.click = { //Where the click happened, relative to the element
|
550
|
+
left: e.pageX - this.offset.left,
|
551
|
+
top: e.pageY - this.offset.top
|
552
|
+
};
|
553
|
+
|
554
|
+
//Calling this method cached the next parents that have scrollTop / scrollLeft attached
|
555
|
+
this.cacheScrollParents();
|
556
|
+
|
557
|
+
|
558
|
+
this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); //Get the offsetParent and cache its position
|
559
|
+
if(this.offsetParent[0] == document.body && $.browser.mozilla) po = { top: 0, left: 0 }; //Ugly FF3 fix
|
560
|
+
this.offset.parent = { //Store its position plus border
|
561
|
+
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
|
562
|
+
left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
|
563
|
+
};
|
564
|
+
|
565
|
+
//This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
|
566
|
+
if(this.cssPosition == "relative") {
|
567
|
+
var p = this.element.position();
|
568
|
+
this.offset.relative = {
|
569
|
+
top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollTopParent.scrollTop(),
|
570
|
+
left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollLeftParent.scrollLeft()
|
571
|
+
};
|
572
|
+
} else {
|
573
|
+
this.offset.relative = { top: 0, left: 0 };
|
574
|
+
}
|
575
|
+
|
576
|
+
//Generate the original position
|
577
|
+
this.originalPosition = this._generatePosition(e);
|
578
|
+
|
579
|
+
//Cache the helper size
|
580
|
+
this.cacheHelperProportions();
|
581
|
+
|
582
|
+
//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
|
583
|
+
if(o.cursorAt)
|
584
|
+
this.adjustOffsetFromHelper(o.cursorAt);
|
585
|
+
|
586
|
+
//Cache later used stuff
|
587
|
+
$.extend(this, {
|
588
|
+
PAGEY_INCLUDES_SCROLL: (this.cssPosition == "absolute" && (!this.scrollTopParent[0].tagName || (/(html|body)/i).test(this.scrollTopParent[0].tagName))),
|
589
|
+
PAGEX_INCLUDES_SCROLL: (this.cssPosition == "absolute" && (!this.scrollLeftParent[0].tagName || (/(html|body)/i).test(this.scrollLeftParent[0].tagName))),
|
590
|
+
OFFSET_PARENT_NOT_SCROLL_PARENT_Y: this.scrollTopParent[0] != this.offsetParent[0] && !(this.scrollTopParent[0] == document && (/(body|html)/i).test(this.offsetParent[0].tagName)),
|
591
|
+
OFFSET_PARENT_NOT_SCROLL_PARENT_X: this.scrollLeftParent[0] != this.offsetParent[0] && !(this.scrollLeftParent[0] == document && (/(body|html)/i).test(this.offsetParent[0].tagName))
|
592
|
+
});
|
593
|
+
|
594
|
+
if(o.containment)
|
595
|
+
this.setContainment();
|
596
|
+
|
597
|
+
|
598
|
+
//Call plugins and callbacks
|
599
|
+
this._propagate("start", e);
|
600
|
+
|
601
|
+
//Recache the helper size
|
602
|
+
this.cacheHelperProportions();
|
603
|
+
|
604
|
+
//Prepare the droppable offsets
|
605
|
+
if ($.ui.ddmanager && !o.dropBehaviour)
|
606
|
+
$.ui.ddmanager.prepareOffsets(this, e);
|
607
|
+
|
608
|
+
this.helper.addClass("ui-draggable-dragging");
|
609
|
+
this._mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
|
610
|
+
return true;
|
611
|
+
},
|
612
|
+
|
613
|
+
cacheScrollParents: function() {
|
614
|
+
|
615
|
+
this.scrollTopParent = function(el) {
|
616
|
+
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
|
617
|
+
return $(document);
|
618
|
+
}(this.helper);
|
619
|
+
this.scrollLeftParent = function(el) {
|
620
|
+
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
|
621
|
+
return $(document);
|
622
|
+
}(this.helper);
|
623
|
+
|
624
|
+
},
|
625
|
+
|
626
|
+
adjustOffsetFromHelper: function(obj) {
|
627
|
+
if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left;
|
628
|
+
if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
|
629
|
+
if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top;
|
630
|
+
if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
|
631
|
+
},
|
632
|
+
|
633
|
+
cacheHelperProportions: function() {
|
634
|
+
this.helperProportions = {
|
635
|
+
width: this.helper.outerWidth(),
|
636
|
+
height: this.helper.outerHeight()
|
637
|
+
};
|
638
|
+
},
|
639
|
+
|
640
|
+
setContainment: function() {
|
641
|
+
|
642
|
+
var o = this.options;
|
643
|
+
if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
|
644
|
+
if(o.containment == 'document' || o.containment == 'window') this.containment = [
|
645
|
+
0 - this.offset.relative.left - this.offset.parent.left,
|
646
|
+
0 - this.offset.relative.top - this.offset.parent.top,
|
647
|
+
$(o.containment == 'document' ? document : window).width() - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
|
648
|
+
($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
|
649
|
+
];
|
650
|
+
|
651
|
+
if(!(/^(document|window|parent)$/).test(o.containment)) {
|
652
|
+
var ce = $(o.containment)[0];
|
653
|
+
var co = $(o.containment).offset();
|
654
|
+
var over = ($(ce).css("overflow") != 'hidden');
|
655
|
+
|
656
|
+
this.containment = [
|
657
|
+
co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left,
|
658
|
+
co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top,
|
659
|
+
co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
|
660
|
+
co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
|
661
|
+
];
|
662
|
+
}
|
663
|
+
|
664
|
+
},
|
665
|
+
|
666
|
+
|
667
|
+
_convertPositionTo: function(d, pos) {
|
668
|
+
|
669
|
+
if(!pos) pos = this.position;
|
670
|
+
var mod = d == "absolute" ? 1 : -1;
|
671
|
+
|
672
|
+
return {
|
673
|
+
top: (
|
674
|
+
pos.top // the calculated relative position
|
675
|
+
+ this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
|
676
|
+
+ this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
|
677
|
+
- (this.cssPosition == "fixed" || this.PAGEY_INCLUDES_SCROLL || this.OFFSET_PARENT_NOT_SCROLL_PARENT_Y ? 0 : this.scrollTopParent.scrollTop()) * mod // The offsetParent's scroll position, not if the element is fixed
|
678
|
+
+ (this.cssPosition == "fixed" ? $(document).scrollTop() : 0) * mod
|
679
|
+
+ this.margins.top * mod //Add the margin (you don't want the margin counting in intersection methods)
|
680
|
+
),
|
681
|
+
left: (
|
682
|
+
pos.left // the calculated relative position
|
683
|
+
+ this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
|
684
|
+
+ this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
|
685
|
+
- (this.cssPosition == "fixed" || this.PAGEX_INCLUDES_SCROLL || this.OFFSET_PARENT_NOT_SCROLL_PARENT_X ? 0 : this.scrollLeftParent.scrollLeft()) * mod // The offsetParent's scroll position, not if the element is fixed
|
686
|
+
+ (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0) * mod
|
687
|
+
+ this.margins.left * mod //Add the margin (you don't want the margin counting in intersection methods)
|
688
|
+
)
|
689
|
+
};
|
690
|
+
},
|
691
|
+
_generatePosition: function(e) {
|
692
|
+
|
693
|
+
var o = this.options;
|
694
|
+
var position = {
|
695
|
+
top: (
|
696
|
+
e.pageY // The absolute mouse position
|
697
|
+
- this.offset.click.top // Click offset (relative to the element)
|
698
|
+
- this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
|
699
|
+
- this.offset.parent.top // The offsetParent's offset without borders (offset + border)
|
700
|
+
+ (this.cssPosition == "fixed" || this.PAGEY_INCLUDES_SCROLL || this.OFFSET_PARENT_NOT_SCROLL_PARENT_Y ? 0 : this.scrollTopParent.scrollTop()) // The offsetParent's scroll position, not if the element is fixed
|
701
|
+
- (this.cssPosition == "fixed" ? $(document).scrollTop() : 0)
|
702
|
+
),
|
703
|
+
left: (
|
704
|
+
e.pageX // The absolute mouse position
|
705
|
+
- this.offset.click.left // Click offset (relative to the element)
|
706
|
+
- this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
|
707
|
+
- this.offset.parent.left // The offsetParent's offset without borders (offset + border)
|
708
|
+
+ (this.cssPosition == "fixed" || this.PAGEX_INCLUDES_SCROLL || this.OFFSET_PARENT_NOT_SCROLL_PARENT_X ? 0 : this.scrollLeftParent.scrollLeft()) // The offsetParent's scroll position, not if the element is fixed
|
709
|
+
- (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0)
|
710
|
+
)
|
711
|
+
};
|
712
|
+
|
713
|
+
if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options
|
714
|
+
|
715
|
+
/*
|
716
|
+
* - Position constraining -
|
717
|
+
* Constrain the position to a mix of grid, containment.
|
718
|
+
*/
|
719
|
+
if(this.containment) {
|
720
|
+
if(position.left < this.containment[0]) position.left = this.containment[0];
|
721
|
+
if(position.top < this.containment[1]) position.top = this.containment[1];
|
722
|
+
if(position.left > this.containment[2]) position.left = this.containment[2];
|
723
|
+
if(position.top > this.containment[3]) position.top = this.containment[3];
|
724
|
+
}
|
725
|
+
|
726
|
+
if(o.grid) {
|
727
|
+
var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];
|
728
|
+
position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
|
729
|
+
|
730
|
+
var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];
|
731
|
+
position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
|
732
|
+
}
|
733
|
+
|
734
|
+
return position;
|
735
|
+
},
|
736
|
+
_mouseDrag: function(e) {
|
737
|
+
|
738
|
+
//Compute the helpers position
|
739
|
+
this.position = this._generatePosition(e);
|
740
|
+
this.positionAbs = this._convertPositionTo("absolute");
|
741
|
+
|
742
|
+
//Call plugins and callbacks and use the resulting position if something is returned
|
743
|
+
this.position = this._propagate("drag", e) || this.position;
|
744
|
+
|
745
|
+
if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
|
746
|
+
if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
|
747
|
+
if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
|
748
|
+
|
749
|
+
return false;
|
750
|
+
},
|
751
|
+
_mouseStop: function(e) {
|
752
|
+
|
753
|
+
//If we are using droppables, inform the manager about the drop
|
754
|
+
var dropped = false;
|
755
|
+
if ($.ui.ddmanager && !this.options.dropBehaviour)
|
756
|
+
var dropped = $.ui.ddmanager.drop(this, e);
|
757
|
+
|
758
|
+
if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
|
759
|
+
var self = this;
|
760
|
+
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10) || 500, function() {
|
761
|
+
self._propagate("stop", e);
|
762
|
+
self._clear();
|
763
|
+
});
|
764
|
+
} else {
|
765
|
+
this._propagate("stop", e);
|
766
|
+
this._clear();
|
767
|
+
}
|
768
|
+
|
769
|
+
return false;
|
770
|
+
},
|
771
|
+
_clear: function() {
|
772
|
+
this.helper.removeClass("ui-draggable-dragging");
|
773
|
+
if(this.options.helper != 'original' && !this.cancelHelperRemoval) this.helper.remove();
|
774
|
+
//if($.ui.ddmanager) $.ui.ddmanager.current = null;
|
775
|
+
this.helper = null;
|
776
|
+
this.cancelHelperRemoval = false;
|
777
|
+
},
|
778
|
+
|
779
|
+
// From now on bulk stuff - mainly helpers
|
780
|
+
plugins: {},
|
781
|
+
uiHash: function(e) {
|
782
|
+
return {
|
783
|
+
helper: this.helper,
|
784
|
+
position: this.position,
|
785
|
+
absolutePosition: this.positionAbs,
|
786
|
+
options: this.options
|
787
|
+
};
|
788
|
+
},
|
789
|
+
_propagate: function(n,e) {
|
790
|
+
$.ui.plugin.call(this, n, [e, this.uiHash()]);
|
791
|
+
if(n == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
|
792
|
+
return this.element.triggerHandler(n == "drag" ? n : "drag"+n, [e, this.uiHash()], this.options[n]);
|
793
|
+
},
|
794
|
+
destroy: function() {
|
795
|
+
if(!this.element.data('draggable')) return;
|
796
|
+
this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable ui-draggable-dragging ui-draggable-disabled');
|
797
|
+
this._mouseDestroy();
|
798
|
+
}
|
799
|
+
}));
|
800
|
+
|
801
|
+
$.extend($.ui.draggable, {
|
802
|
+
defaults: {
|
803
|
+
appendTo: "parent",
|
804
|
+
axis: false,
|
805
|
+
cancel: ":input",
|
806
|
+
delay: 0,
|
807
|
+
distance: 1,
|
808
|
+
helper: "original",
|
809
|
+
scope: "default",
|
810
|
+
cssNamespace: "ui"
|
811
|
+
}
|
812
|
+
});
|
813
|
+
|
814
|
+
$.ui.plugin.add("draggable", "cursor", {
|
815
|
+
start: function(e, ui) {
|
816
|
+
var t = $('body');
|
817
|
+
if (t.css("cursor")) ui.options._cursor = t.css("cursor");
|
818
|
+
t.css("cursor", ui.options.cursor);
|
819
|
+
},
|
820
|
+
stop: function(e, ui) {
|
821
|
+
if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);
|
822
|
+
}
|
823
|
+
});
|
824
|
+
|
825
|
+
$.ui.plugin.add("draggable", "zIndex", {
|
826
|
+
start: function(e, ui) {
|
827
|
+
var t = $(ui.helper);
|
828
|
+
if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");
|
829
|
+
t.css('zIndex', ui.options.zIndex);
|
830
|
+
},
|
831
|
+
stop: function(e, ui) {
|
832
|
+
if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);
|
833
|
+
}
|
834
|
+
});
|
835
|
+
|
836
|
+
$.ui.plugin.add("draggable", "opacity", {
|
837
|
+
start: function(e, ui) {
|
838
|
+
var t = $(ui.helper);
|
839
|
+
if(t.css("opacity")) ui.options._opacity = t.css("opacity");
|
840
|
+
t.css('opacity', ui.options.opacity);
|
841
|
+
},
|
842
|
+
stop: function(e, ui) {
|
843
|
+
if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);
|
844
|
+
}
|
845
|
+
});
|
846
|
+
|
847
|
+
$.ui.plugin.add("draggable", "iframeFix", {
|
848
|
+
start: function(e, ui) {
|
849
|
+
$(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() {
|
850
|
+
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
|
851
|
+
.css({
|
852
|
+
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
|
853
|
+
position: "absolute", opacity: "0.001", zIndex: 1000
|
854
|
+
})
|
855
|
+
.css($(this).offset())
|
856
|
+
.appendTo("body");
|
857
|
+
});
|
858
|
+
},
|
859
|
+
stop: function(e, ui) {
|
860
|
+
$("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
|
861
|
+
}
|
862
|
+
});
|
863
|
+
|
864
|
+
|
865
|
+
|
866
|
+
$.ui.plugin.add("draggable", "scroll", {
|
867
|
+
start: function(e, ui) {
|
868
|
+
var o = ui.options;
|
869
|
+
var i = $(this).data("draggable");
|
870
|
+
o.scrollSensitivity = o.scrollSensitivity || 20;
|
871
|
+
o.scrollSpeed = o.scrollSpeed || 20;
|
872
|
+
|
873
|
+
i.overflowY = function(el) {
|
874
|
+
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
|
875
|
+
return $(document);
|
876
|
+
}(this);
|
877
|
+
i.overflowX = function(el) {
|
878
|
+
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
|
879
|
+
return $(document);
|
880
|
+
}(this);
|
881
|
+
|
882
|
+
if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();
|
883
|
+
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();
|
884
|
+
|
885
|
+
},
|
886
|
+
drag: function(e, ui) {
|
887
|
+
|
888
|
+
var o = ui.options, scrolled = false;
|
889
|
+
var i = $(this).data("draggable");
|
890
|
+
|
891
|
+
if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
|
892
|
+
if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
|
893
|
+
i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop + o.scrollSpeed;
|
894
|
+
if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)
|
895
|
+
i.overflowY[0].scrollTop = scrolled = i.overflowY[0].scrollTop - o.scrollSpeed;
|
896
|
+
|
897
|
+
} else {
|
898
|
+
if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)
|
899
|
+
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
900
|
+
if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
|
901
|
+
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
902
|
+
}
|
903
|
+
|
904
|
+
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
|
905
|
+
if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
|
906
|
+
i.overflowX[0].scrollLeft = scrolled = i.overflowX[0].scrollLeft + o.scrollSpeed;
|
907
|
+
if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity)
|
908
|
+
i.overflowX[0].scrollLeft = scrolled = i.overflowX[0].scrollLeft - o.scrollSpeed;
|
909
|
+
} else {
|
910
|
+
if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)
|
911
|
+
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
912
|
+
if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
|
913
|
+
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
914
|
+
}
|
915
|
+
|
916
|
+
if(scrolled !== false)
|
917
|
+
$.ui.ddmanager.prepareOffsets(i, e);
|
918
|
+
|
919
|
+
}
|
920
|
+
});
|
921
|
+
|
922
|
+
|
923
|
+
$.ui.plugin.add("draggable", "snap", {
|
924
|
+
start: function(e, ui) {
|
925
|
+
|
926
|
+
var inst = $(this).data("draggable");
|
927
|
+
inst.snapElements = [];
|
928
|
+
|
929
|
+
$(ui.options.snap.constructor != String ? ( ui.options.snap.items || ':data(draggable)' ) : ui.options.snap).each(function() {
|
930
|
+
var $t = $(this); var $o = $t.offset();
|
931
|
+
if(this != inst.element[0]) inst.snapElements.push({
|
932
|
+
item: this,
|
933
|
+
width: $t.outerWidth(), height: $t.outerHeight(),
|
934
|
+
top: $o.top, left: $o.left
|
935
|
+
});
|
936
|
+
});
|
937
|
+
|
938
|
+
},
|
939
|
+
drag: function(e, ui) {
|
940
|
+
|
941
|
+
var inst = $(this).data("draggable");
|
942
|
+
var d = ui.options.snapTolerance || 20;
|
943
|
+
|
944
|
+
var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width,
|
945
|
+
y1 = ui.absolutePosition.top, y2 = y1 + inst.helperProportions.height;
|
946
|
+
|
947
|
+
for (var i = inst.snapElements.length - 1; i >= 0; i--){
|
948
|
+
|
949
|
+
var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
|
950
|
+
t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
|
951
|
+
|
952
|
+
//Yes, I know, this is insane ;)
|
953
|
+
if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
|
954
|
+
if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, null, $.extend(inst.uiHash(), { snapItem: inst.snapElements[i].item })));
|
955
|
+
inst.snapElements[i].snapping = false;
|
956
|
+
continue;
|
957
|
+
}
|
958
|
+
|
959
|
+
if(ui.options.snapMode != 'inner') {
|
960
|
+
var ts = Math.abs(t - y2) <= d;
|
961
|
+
var bs = Math.abs(b - y1) <= d;
|
962
|
+
var ls = Math.abs(l - x2) <= d;
|
963
|
+
var rs = Math.abs(r - x1) <= d;
|
964
|
+
if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
|
965
|
+
if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
|
966
|
+
if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
|
967
|
+
if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
|
968
|
+
}
|
969
|
+
|
970
|
+
var first = (ts || bs || ls || rs);
|
971
|
+
|
972
|
+
if(ui.options.snapMode != 'outer') {
|
973
|
+
var ts = Math.abs(t - y1) <= d;
|
974
|
+
var bs = Math.abs(b - y2) <= d;
|
975
|
+
var ls = Math.abs(l - x1) <= d;
|
976
|
+
var rs = Math.abs(r - x2) <= d;
|
977
|
+
if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
|
978
|
+
if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
|
979
|
+
if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
|
980
|
+
if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
|
981
|
+
}
|
982
|
+
|
983
|
+
if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
|
984
|
+
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, null, $.extend(inst.uiHash(), { snapItem: inst.snapElements[i].item })));
|
985
|
+
inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
|
986
|
+
|
987
|
+
};
|
988
|
+
|
989
|
+
}
|
990
|
+
});
|
991
|
+
|
992
|
+
$.ui.plugin.add("draggable", "connectToSortable", {
|
993
|
+
start: function(e,ui) {
|
994
|
+
|
995
|
+
var inst = $(this).data("draggable");
|
996
|
+
inst.sortables = [];
|
997
|
+
$(ui.options.connectToSortable).each(function() {
|
998
|
+
if($.data(this, 'sortable')) {
|
999
|
+
var sortable = $.data(this, 'sortable');
|
1000
|
+
inst.sortables.push({
|
1001
|
+
instance: sortable,
|
1002
|
+
shouldRevert: sortable.options.revert
|
1003
|
+
});
|
1004
|
+
sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache
|
1005
|
+
sortable._propagate("activate", e, inst);
|
1006
|
+
}
|
1007
|
+
});
|
1008
|
+
|
1009
|
+
},
|
1010
|
+
stop: function(e,ui) {
|
1011
|
+
|
1012
|
+
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
|
1013
|
+
var inst = $(this).data("draggable");
|
1014
|
+
|
1015
|
+
$.each(inst.sortables, function() {
|
1016
|
+
if(this.instance.isOver) {
|
1017
|
+
this.instance.isOver = 0;
|
1018
|
+
inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
|
1019
|
+
this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
|
1020
|
+
if(this.shouldRevert) this.instance.options.revert = true; //revert here
|
1021
|
+
this.instance._mouseStop(e);
|
1022
|
+
|
1023
|
+
//Also propagate receive event, since the sortable is actually receiving a element
|
1024
|
+
this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance.ui(), { sender: inst.element })], this.instance.options["receive"]);
|
1025
|
+
|
1026
|
+
this.instance.options.helper = this.instance.options._helper;
|
1027
|
+
} else {
|
1028
|
+
this.instance._propagate("deactivate", e, inst);
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
});
|
1032
|
+
|
1033
|
+
},
|
1034
|
+
drag: function(e,ui) {
|
1035
|
+
|
1036
|
+
var inst = $(this).data("draggable"), self = this;
|
1037
|
+
|
1038
|
+
var checkPos = function(o) {
|
1039
|
+
|
1040
|
+
var l = o.left, r = l + o.width,
|
1041
|
+
t = o.top, b = t + o.height;
|
1042
|
+
|
1043
|
+
return (l < (this.positionAbs.left + this.offset.click.left) && (this.positionAbs.left + this.offset.click.left) < r
|
1044
|
+
&& t < (this.positionAbs.top + this.offset.click.top) && (this.positionAbs.top + this.offset.click.top) < b);
|
1045
|
+
};
|
1046
|
+
|
1047
|
+
$.each(inst.sortables, function(i) {
|
1048
|
+
|
1049
|
+
if(checkPos.call(inst, this.instance.containerCache)) {
|
1050
|
+
|
1051
|
+
//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
|
1052
|
+
if(!this.instance.isOver) {
|
1053
|
+
this.instance.isOver = 1;
|
1054
|
+
|
1055
|
+
//Now we fake the start of dragging for the sortable instance,
|
1056
|
+
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
|
1057
|
+
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
|
1058
|
+
this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
|
1059
|
+
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
|
1060
|
+
this.instance.options.helper = function() { return ui.helper[0]; };
|
1061
|
+
|
1062
|
+
e.target = this.instance.currentItem[0];
|
1063
|
+
this.instance._mouseCapture(e, true);
|
1064
|
+
this.instance._mouseStart(e, true, true);
|
1065
|
+
|
1066
|
+
//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
|
1067
|
+
this.instance.offset.click.top = inst.offset.click.top;
|
1068
|
+
this.instance.offset.click.left = inst.offset.click.left;
|
1069
|
+
this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
|
1070
|
+
this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
|
1071
|
+
|
1072
|
+
inst._propagate("toSortable", e);
|
1073
|
+
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
|
1077
|
+
if(this.instance.currentItem) this.instance._mouseDrag(e);
|
1078
|
+
|
1079
|
+
} else {
|
1080
|
+
|
1081
|
+
//If it doesn't intersect with the sortable, and it intersected before,
|
1082
|
+
//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
|
1083
|
+
if(this.instance.isOver) {
|
1084
|
+
this.instance.isOver = 0;
|
1085
|
+
this.instance.cancelHelperRemoval = true;
|
1086
|
+
this.instance.options.revert = false; //No revert here
|
1087
|
+
this.instance._mouseStop(e, true);
|
1088
|
+
this.instance.options.helper = this.instance.options._helper;
|
1089
|
+
|
1090
|
+
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
|
1091
|
+
this.instance.currentItem.remove();
|
1092
|
+
if(this.instance.placeholder) this.instance.placeholder.remove();
|
1093
|
+
|
1094
|
+
inst._propagate("fromSortable", e);
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
};
|
1098
|
+
|
1099
|
+
});
|
1100
|
+
|
1101
|
+
}
|
1102
|
+
});
|
1103
|
+
|
1104
|
+
$.ui.plugin.add("draggable", "stack", {
|
1105
|
+
start: function(e,ui) {
|
1106
|
+
var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) {
|
1107
|
+
return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min);
|
1108
|
+
});
|
1109
|
+
|
1110
|
+
$(group).each(function(i) {
|
1111
|
+
this.style.zIndex = ui.options.stack.min + i;
|
1112
|
+
});
|
1113
|
+
|
1114
|
+
this[0].style.zIndex = ui.options.stack.min + group.length;
|
1115
|
+
}
|
1116
|
+
});
|
1117
|
+
|
1118
|
+
})(jQuery);
|
1119
|
+
/*
|
1120
|
+
* jQuery UI Droppable 1.6rc2
|
1121
|
+
|
1122
|
+
*
|
1123
|
+
* Copyright (c) 2008 Paul Bakaus
|
1124
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
1125
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
1126
|
+
*
|
1127
|
+
* http://docs.jquery.com/UI/Droppables
|
1128
|
+
*
|
1129
|
+
* Depends:
|
1130
|
+
* ui.core.js
|
1131
|
+
* ui.draggable.js
|
1132
|
+
*/
|
1133
|
+
(function($) {
|
1134
|
+
|
1135
|
+
$.widget("ui.droppable", {
|
1136
|
+
|
1137
|
+
_setData: function(key, value) {
|
1138
|
+
|
1139
|
+
if(key == 'accept') {
|
1140
|
+
this.options.accept = value && $.isFunction(value) ? value : function(d) {
|
1141
|
+
return d.is(accept);
|
1142
|
+
};
|
1143
|
+
} else {
|
1144
|
+
$.widget.prototype._setData.apply(this, arguments);
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
},
|
1148
|
+
|
1149
|
+
_init: function() {
|
1150
|
+
|
1151
|
+
var o = this.options, accept = o.accept;
|
1152
|
+
this.isover = 0; this.isout = 1;
|
1153
|
+
|
1154
|
+
this.options.accept = this.options.accept && $.isFunction(this.options.accept) ? this.options.accept : function(d) {
|
1155
|
+
return d.is(accept);
|
1156
|
+
};
|
1157
|
+
|
1158
|
+
//Store the droppable's proportions
|
1159
|
+
this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
|
1160
|
+
|
1161
|
+
// Add the reference and positions to the manager
|
1162
|
+
$.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || [];
|
1163
|
+
$.ui.ddmanager.droppables[this.options.scope].push(this);
|
1164
|
+
|
1165
|
+
(this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-droppable"));
|
1166
|
+
|
1167
|
+
},
|
1168
|
+
plugins: {},
|
1169
|
+
ui: function(c) {
|
1170
|
+
return {
|
1171
|
+
draggable: (c.currentItem || c.element),
|
1172
|
+
helper: c.helper,
|
1173
|
+
position: c.position,
|
1174
|
+
absolutePosition: c.positionAbs,
|
1175
|
+
options: this.options,
|
1176
|
+
element: this.element
|
1177
|
+
};
|
1178
|
+
},
|
1179
|
+
destroy: function() {
|
1180
|
+
var drop = $.ui.ddmanager.droppables[this.options.scope];
|
1181
|
+
for ( var i = 0; i < drop.length; i++ )
|
1182
|
+
if ( drop[i] == this )
|
1183
|
+
drop.splice(i, 1);
|
1184
|
+
|
1185
|
+
this.element
|
1186
|
+
.removeClass("ui-droppable-disabled")
|
1187
|
+
.removeData("droppable")
|
1188
|
+
.unbind(".droppable");
|
1189
|
+
},
|
1190
|
+
_over: function(e) {
|
1191
|
+
|
1192
|
+
var draggable = $.ui.ddmanager.current;
|
1193
|
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
1194
|
+
|
1195
|
+
if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
1196
|
+
$.ui.plugin.call(this, 'over', [e, this.ui(draggable)]);
|
1197
|
+
this.element.triggerHandler("dropover", [e, this.ui(draggable)], this.options.over);
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
},
|
1201
|
+
_out: function(e) {
|
1202
|
+
|
1203
|
+
var draggable = $.ui.ddmanager.current;
|
1204
|
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
1205
|
+
|
1206
|
+
if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
1207
|
+
$.ui.plugin.call(this, 'out', [e, this.ui(draggable)]);
|
1208
|
+
this.element.triggerHandler("dropout", [e, this.ui(draggable)], this.options.out);
|
1209
|
+
}
|
1210
|
+
|
1211
|
+
},
|
1212
|
+
_drop: function(e,custom) {
|
1213
|
+
|
1214
|
+
var draggable = custom || $.ui.ddmanager.current;
|
1215
|
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
|
1216
|
+
|
1217
|
+
var childrenIntersection = false;
|
1218
|
+
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
|
1219
|
+
var inst = $.data(this, 'droppable');
|
1220
|
+
if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
|
1221
|
+
childrenIntersection = true; return false;
|
1222
|
+
}
|
1223
|
+
});
|
1224
|
+
if(childrenIntersection) return false;
|
1225
|
+
|
1226
|
+
if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
1227
|
+
$.ui.plugin.call(this, 'drop', [e, this.ui(draggable)]);
|
1228
|
+
this.element.triggerHandler("drop", [e, this.ui(draggable)], this.options.drop);
|
1229
|
+
return this.element;
|
1230
|
+
}
|
1231
|
+
|
1232
|
+
return false;
|
1233
|
+
|
1234
|
+
},
|
1235
|
+
_activate: function(e) {
|
1236
|
+
|
1237
|
+
var draggable = $.ui.ddmanager.current;
|
1238
|
+
$.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]);
|
1239
|
+
if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate);
|
1240
|
+
|
1241
|
+
},
|
1242
|
+
_deactivate: function(e) {
|
1243
|
+
|
1244
|
+
var draggable = $.ui.ddmanager.current;
|
1245
|
+
$.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]);
|
1246
|
+
if(draggable) this.element.triggerHandler("dropdeactivate", [e, this.ui(draggable)], this.options.deactivate);
|
1247
|
+
|
1248
|
+
}
|
1249
|
+
});
|
1250
|
+
|
1251
|
+
$.extend($.ui.droppable, {
|
1252
|
+
defaults: {
|
1253
|
+
disabled: false,
|
1254
|
+
tolerance: 'intersect',
|
1255
|
+
scope: 'default',
|
1256
|
+
cssNamespace: 'ui'
|
1257
|
+
}
|
1258
|
+
});
|
1259
|
+
|
1260
|
+
$.ui.intersect = function(draggable, droppable, toleranceMode) {
|
1261
|
+
|
1262
|
+
if (!droppable.offset) return false;
|
1263
|
+
|
1264
|
+
var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
|
1265
|
+
y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
|
1266
|
+
var l = droppable.offset.left, r = l + droppable.proportions.width,
|
1267
|
+
t = droppable.offset.top, b = t + droppable.proportions.height;
|
1268
|
+
|
1269
|
+
switch (toleranceMode) {
|
1270
|
+
case 'fit':
|
1271
|
+
return (l < x1 && x2 < r
|
1272
|
+
&& t < y1 && y2 < b);
|
1273
|
+
break;
|
1274
|
+
case 'intersect':
|
1275
|
+
return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
|
1276
|
+
&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
|
1277
|
+
&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
|
1278
|
+
&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
|
1279
|
+
break;
|
1280
|
+
case 'pointer':
|
1281
|
+
return (l < ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left) && ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left) < r
|
1282
|
+
&& t < ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top) && ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top) < b);
|
1283
|
+
break;
|
1284
|
+
case 'touch':
|
1285
|
+
return (
|
1286
|
+
(y1 >= t && y1 <= b) || // Top edge touching
|
1287
|
+
(y2 >= t && y2 <= b) || // Bottom edge touching
|
1288
|
+
(y1 < t && y2 > b) // Surrounded vertically
|
1289
|
+
) && (
|
1290
|
+
(x1 >= l && x1 <= r) || // Left edge touching
|
1291
|
+
(x2 >= l && x2 <= r) || // Right edge touching
|
1292
|
+
(x1 < l && x2 > r) // Surrounded horizontally
|
1293
|
+
);
|
1294
|
+
break;
|
1295
|
+
default:
|
1296
|
+
return false;
|
1297
|
+
break;
|
1298
|
+
}
|
1299
|
+
|
1300
|
+
};
|
1301
|
+
|
1302
|
+
/*
|
1303
|
+
This manager tracks offsets of draggables and droppables
|
1304
|
+
*/
|
1305
|
+
$.ui.ddmanager = {
|
1306
|
+
current: null,
|
1307
|
+
droppables: { 'default': [] },
|
1308
|
+
prepareOffsets: function(t, e) {
|
1309
|
+
|
1310
|
+
var m = $.ui.ddmanager.droppables[t.options.scope];
|
1311
|
+
var type = e ? e.type : null; // workaround for #2317
|
1312
|
+
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
|
1313
|
+
|
1314
|
+
droppablesLoop: for (var i = 0; i < m.length; i++) {
|
1315
|
+
|
1316
|
+
if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element,(t.currentItem || t.element)))) continue; //No disabled and non-accepted
|
1317
|
+
for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
|
1318
|
+
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
|
1319
|
+
|
1320
|
+
m[i].offset = m[i].element.offset();
|
1321
|
+
m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
|
1322
|
+
|
1323
|
+
if(type == "dragstart" || type == "sortactivate") m[i]._activate.call(m[i], e); //Activate the droppable if used directly from draggables
|
1324
|
+
|
1325
|
+
}
|
1326
|
+
|
1327
|
+
},
|
1328
|
+
drop: function(draggable, e) {
|
1329
|
+
|
1330
|
+
var dropped = false;
|
1331
|
+
$.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
|
1332
|
+
|
1333
|
+
if(!this.options) return;
|
1334
|
+
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
|
1335
|
+
dropped = this._drop.call(this, e);
|
1336
|
+
|
1337
|
+
if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
1338
|
+
this.isout = 1; this.isover = 0;
|
1339
|
+
this._deactivate.call(this, e);
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
});
|
1343
|
+
return dropped;
|
1344
|
+
|
1345
|
+
},
|
1346
|
+
drag: function(draggable, e) {
|
1347
|
+
|
1348
|
+
//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
|
1349
|
+
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, e);
|
1350
|
+
|
1351
|
+
//Run through all droppables and check their positions based on specific tolerance options
|
1352
|
+
|
1353
|
+
$.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
|
1354
|
+
|
1355
|
+
if(this.options.disabled || this.greedyChild || !this.visible) return;
|
1356
|
+
var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
|
1357
|
+
|
1358
|
+
var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
|
1359
|
+
if(!c) return;
|
1360
|
+
|
1361
|
+
var parentInstance;
|
1362
|
+
if (this.options.greedy) {
|
1363
|
+
var parent = this.element.parents(':data(droppable):eq(0)');
|
1364
|
+
if (parent.length) {
|
1365
|
+
parentInstance = $.data(parent[0], 'droppable');
|
1366
|
+
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
|
1367
|
+
}
|
1368
|
+
}
|
1369
|
+
|
1370
|
+
// we just moved into a greedy child
|
1371
|
+
if (parentInstance && c == 'isover') {
|
1372
|
+
parentInstance['isover'] = 0;
|
1373
|
+
parentInstance['isout'] = 1;
|
1374
|
+
parentInstance._out.call(parentInstance, e);
|
1375
|
+
}
|
1376
|
+
|
1377
|
+
this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
|
1378
|
+
this[c == "isover" ? "_over" : "_out"].call(this, e);
|
1379
|
+
|
1380
|
+
// we just moved out of a greedy child
|
1381
|
+
if (parentInstance && c == 'isout') {
|
1382
|
+
parentInstance['isout'] = 0;
|
1383
|
+
parentInstance['isover'] = 1;
|
1384
|
+
parentInstance._over.call(parentInstance, e);
|
1385
|
+
}
|
1386
|
+
});
|
1387
|
+
|
1388
|
+
}
|
1389
|
+
};
|
1390
|
+
|
1391
|
+
/*
|
1392
|
+
* Droppable Extensions
|
1393
|
+
*/
|
1394
|
+
|
1395
|
+
$.ui.plugin.add("droppable", "activeClass", {
|
1396
|
+
activate: function(e, ui) {
|
1397
|
+
$(this).addClass(ui.options.activeClass);
|
1398
|
+
},
|
1399
|
+
deactivate: function(e, ui) {
|
1400
|
+
$(this).removeClass(ui.options.activeClass);
|
1401
|
+
},
|
1402
|
+
drop: function(e, ui) {
|
1403
|
+
$(this).removeClass(ui.options.activeClass);
|
1404
|
+
}
|
1405
|
+
});
|
1406
|
+
|
1407
|
+
$.ui.plugin.add("droppable", "hoverClass", {
|
1408
|
+
over: function(e, ui) {
|
1409
|
+
$(this).addClass(ui.options.hoverClass);
|
1410
|
+
},
|
1411
|
+
out: function(e, ui) {
|
1412
|
+
$(this).removeClass(ui.options.hoverClass);
|
1413
|
+
},
|
1414
|
+
drop: function(e, ui) {
|
1415
|
+
$(this).removeClass(ui.options.hoverClass);
|
1416
|
+
}
|
1417
|
+
});
|
1418
|
+
|
1419
|
+
})(jQuery);
|
1420
|
+
/*
|
1421
|
+
* jQuery UI Sortable 1.6rc2
|
1422
|
+
|
1423
|
+
*
|
1424
|
+
* Copyright (c) 2008 Paul Bakaus
|
1425
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
1426
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
1427
|
+
*
|
1428
|
+
* http://docs.jquery.com/UI/Sortables
|
1429
|
+
*
|
1430
|
+
* Depends:
|
1431
|
+
* ui.core.js
|
1432
|
+
*/
|
1433
|
+
(function($) {
|
1434
|
+
|
1435
|
+
function contains(a, b) {
|
1436
|
+
var safari2 = $.browser.safari && $.browser.version < 522;
|
1437
|
+
if (a.contains && !safari2) {
|
1438
|
+
return a.contains(b);
|
1439
|
+
}
|
1440
|
+
if (a.compareDocumentPosition)
|
1441
|
+
return !!(a.compareDocumentPosition(b) & 16);
|
1442
|
+
while (b = b.parentNode)
|
1443
|
+
if (b == a) return true;
|
1444
|
+
return false;
|
1445
|
+
};
|
1446
|
+
|
1447
|
+
$.widget("ui.sortable", $.extend({}, $.ui.mouse, {
|
1448
|
+
_init: function() {
|
1449
|
+
|
1450
|
+
var o = this.options;
|
1451
|
+
this.containerCache = {};
|
1452
|
+
this.element.addClass("ui-sortable");
|
1453
|
+
|
1454
|
+
//Get the items
|
1455
|
+
this.refresh();
|
1456
|
+
|
1457
|
+
//Let's determine if the items are floating
|
1458
|
+
this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
|
1459
|
+
|
1460
|
+
//Let's determine the parent's offset
|
1461
|
+
this.offset = this.element.offset();
|
1462
|
+
|
1463
|
+
//Initialize mouse events for interaction
|
1464
|
+
this._mouseInit();
|
1465
|
+
|
1466
|
+
},
|
1467
|
+
plugins: {},
|
1468
|
+
ui: function(inst) {
|
1469
|
+
return {
|
1470
|
+
helper: (inst || this)["helper"],
|
1471
|
+
placeholder: (inst || this)["placeholder"] || $([]),
|
1472
|
+
position: (inst || this)["position"],
|
1473
|
+
absolutePosition: (inst || this)["positionAbs"],
|
1474
|
+
options: this.options,
|
1475
|
+
element: this.element,
|
1476
|
+
item: (inst || this)["currentItem"],
|
1477
|
+
sender: inst ? inst.element : null
|
1478
|
+
};
|
1479
|
+
},
|
1480
|
+
|
1481
|
+
_propagate: function(n,e,inst, noPropagation) {
|
1482
|
+
$.ui.plugin.call(this, n, [e, this.ui(inst)]);
|
1483
|
+
if(!noPropagation) this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);
|
1484
|
+
},
|
1485
|
+
|
1486
|
+
serialize: function(o) {
|
1487
|
+
|
1488
|
+
var items = this._getItemsAsjQuery(o && o.connected);
|
1489
|
+
var str = []; o = o || {};
|
1490
|
+
|
1491
|
+
$(items).each(function() {
|
1492
|
+
var res = ($(this.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
|
1493
|
+
if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
|
1494
|
+
});
|
1495
|
+
|
1496
|
+
return str.join('&');
|
1497
|
+
|
1498
|
+
},
|
1499
|
+
|
1500
|
+
toArray: function(o) {
|
1501
|
+
|
1502
|
+
var items = this._getItemsAsjQuery(o && o.connected);
|
1503
|
+
var ret = [];
|
1504
|
+
|
1505
|
+
items.each(function() { ret.push($(this).attr(o.attr || 'id')); });
|
1506
|
+
return ret;
|
1507
|
+
|
1508
|
+
},
|
1509
|
+
|
1510
|
+
/* Be careful with the following core functions */
|
1511
|
+
_intersectsWith: function(item) {
|
1512
|
+
var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,
|
1513
|
+
y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height;
|
1514
|
+
var l = item.left, r = l + item.width,
|
1515
|
+
t = item.top, b = t + item.height;
|
1516
|
+
|
1517
|
+
var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
|
1518
|
+
var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
|
1519
|
+
|
1520
|
+
if(this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) {
|
1521
|
+
return isOverElement;
|
1522
|
+
} else {
|
1523
|
+
|
1524
|
+
return (l < x1 + (this.helperProportions.width / 2) // Right Half
|
1525
|
+
&& x2 - (this.helperProportions.width / 2) < r // Left Half
|
1526
|
+
&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
|
1527
|
+
&& y2 - (this.helperProportions.height / 2) < b ); // Top Half
|
1528
|
+
|
1529
|
+
}
|
1530
|
+
},
|
1531
|
+
|
1532
|
+
_intersectsWithEdge: function(item) {
|
1533
|
+
var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,
|
1534
|
+
y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height;
|
1535
|
+
|
1536
|
+
var l = item.left, r = l + item.width,
|
1537
|
+
t = item.top, b = t + item.height;
|
1538
|
+
|
1539
|
+
var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
|
1540
|
+
var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
|
1541
|
+
|
1542
|
+
if(this.options.tolerance == "pointer" || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) {
|
1543
|
+
if(!isOverElement) return false;
|
1544
|
+
|
1545
|
+
if(this.floating) {
|
1546
|
+
if ((x1 + dxClick) > l && (x1 + dxClick) < l + item.width/2) return 2;
|
1547
|
+
if ((x1 + dxClick) > l + item.width/2 && (x1 + dxClick) < r) return 1;
|
1548
|
+
} else {
|
1549
|
+
var height = item.height;
|
1550
|
+
var direction = y1 - this.updateOriginalPosition.top < 0 ? 2 : 1; // 2 = up
|
1551
|
+
|
1552
|
+
if (direction == 1 && (y1 + dyClick) < t + height/2) { return 2; } // up
|
1553
|
+
else if (direction == 2 && (y1 + dyClick) > t + height/2) { return 1; } // down
|
1554
|
+
}
|
1555
|
+
|
1556
|
+
} else {
|
1557
|
+
if (!(l < x1 + (this.helperProportions.width / 2) // Right Half
|
1558
|
+
&& x2 - (this.helperProportions.width / 2) < r // Left Half
|
1559
|
+
&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
|
1560
|
+
&& y2 - (this.helperProportions.height / 2) < b )) return false; // Top Half
|
1561
|
+
|
1562
|
+
if(this.floating) {
|
1563
|
+
if(x2 > l && x1 < l) return 2; //Crosses left edge
|
1564
|
+
if(x1 < r && x2 > r) return 1; //Crosses right edge
|
1565
|
+
} else {
|
1566
|
+
if(y2 > t && y1 < t) return 1; //Crosses top edge
|
1567
|
+
if(y1 < b && y2 > b) return 2; //Crosses bottom edge
|
1568
|
+
}
|
1569
|
+
}
|
1570
|
+
|
1571
|
+
return false;
|
1572
|
+
|
1573
|
+
},
|
1574
|
+
|
1575
|
+
refresh: function() {
|
1576
|
+
this._refreshItems();
|
1577
|
+
this.refreshPositions();
|
1578
|
+
},
|
1579
|
+
|
1580
|
+
_getItemsAsjQuery: function(connected) {
|
1581
|
+
|
1582
|
+
var self = this;
|
1583
|
+
var items = [];
|
1584
|
+
var queries = [];
|
1585
|
+
|
1586
|
+
if(this.options.connectWith && connected) {
|
1587
|
+
for (var i = this.options.connectWith.length - 1; i >= 0; i--){
|
1588
|
+
var cur = $(this.options.connectWith[i]);
|
1589
|
+
for (var j = cur.length - 1; j >= 0; j--){
|
1590
|
+
var inst = $.data(cur[j], 'sortable');
|
1591
|
+
if(inst && inst != this && !inst.options.disabled) {
|
1592
|
+
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper"), inst]);
|
1593
|
+
}
|
1594
|
+
};
|
1595
|
+
};
|
1596
|
+
}
|
1597
|
+
|
1598
|
+
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]);
|
1599
|
+
|
1600
|
+
for (var i = queries.length - 1; i >= 0; i--){
|
1601
|
+
queries[i][0].each(function() {
|
1602
|
+
items.push(this);
|
1603
|
+
});
|
1604
|
+
};
|
1605
|
+
|
1606
|
+
return $(items);
|
1607
|
+
|
1608
|
+
},
|
1609
|
+
|
1610
|
+
_removeCurrentsFromItems: function() {
|
1611
|
+
|
1612
|
+
var list = this.currentItem.find(":data(sortable-item)");
|
1613
|
+
|
1614
|
+
for (var i=0; i < this.items.length; i++) {
|
1615
|
+
|
1616
|
+
for (var j=0; j < list.length; j++) {
|
1617
|
+
if(list[j] == this.items[i].item[0])
|
1618
|
+
this.items.splice(i,1);
|
1619
|
+
};
|
1620
|
+
|
1621
|
+
};
|
1622
|
+
|
1623
|
+
},
|
1624
|
+
|
1625
|
+
_refreshItems: function() {
|
1626
|
+
|
1627
|
+
this.items = [];
|
1628
|
+
this.containers = [this];
|
1629
|
+
var items = this.items;
|
1630
|
+
var self = this;
|
1631
|
+
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element), this]];
|
1632
|
+
|
1633
|
+
if(this.options.connectWith) {
|
1634
|
+
for (var i = this.options.connectWith.length - 1; i >= 0; i--){
|
1635
|
+
var cur = $(this.options.connectWith[i]);
|
1636
|
+
for (var j = cur.length - 1; j >= 0; j--){
|
1637
|
+
var inst = $.data(cur[j], 'sortable');
|
1638
|
+
if(inst && inst != this && !inst.options.disabled) {
|
1639
|
+
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element), inst]);
|
1640
|
+
this.containers.push(inst);
|
1641
|
+
}
|
1642
|
+
};
|
1643
|
+
};
|
1644
|
+
}
|
1645
|
+
|
1646
|
+
for (var i = queries.length - 1; i >= 0; i--){
|
1647
|
+
queries[i][0].each(function() {
|
1648
|
+
$.data(this, 'sortable-item', queries[i][1]); // Data for target checking (mouse manager)
|
1649
|
+
items.push({
|
1650
|
+
item: $(this),
|
1651
|
+
instance: queries[i][1],
|
1652
|
+
width: 0, height: 0,
|
1653
|
+
left: 0, top: 0
|
1654
|
+
});
|
1655
|
+
});
|
1656
|
+
};
|
1657
|
+
|
1658
|
+
},
|
1659
|
+
|
1660
|
+
refreshPositions: function(fast) {
|
1661
|
+
|
1662
|
+
//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
|
1663
|
+
if(this.offsetParent) {
|
1664
|
+
var po = this.offsetParent.offset();
|
1665
|
+
this.offset.parent = { top: po.top + this.offsetParentBorders.top, left: po.left + this.offsetParentBorders.left };
|
1666
|
+
}
|
1667
|
+
|
1668
|
+
for (var i = this.items.length - 1; i >= 0; i--){
|
1669
|
+
|
1670
|
+
//We ignore calculating positions of all connected containers when we're not over them
|
1671
|
+
if(this.items[i].instance != this.currentContainer && this.currentContainer && this.items[i].item[0] != this.currentItem[0])
|
1672
|
+
continue;
|
1673
|
+
|
1674
|
+
var t = this.options.toleranceElement ? $(this.options.toleranceElement, this.items[i].item) : this.items[i].item;
|
1675
|
+
|
1676
|
+
if(!fast) {
|
1677
|
+
this.items[i].width = t[0].offsetWidth;
|
1678
|
+
this.items[i].height = t[0].offsetHeight;
|
1679
|
+
}
|
1680
|
+
|
1681
|
+
var p = t.offset();
|
1682
|
+
this.items[i].left = p.left;
|
1683
|
+
this.items[i].top = p.top;
|
1684
|
+
|
1685
|
+
};
|
1686
|
+
|
1687
|
+
if(this.options.custom && this.options.custom.refreshContainers) {
|
1688
|
+
this.options.custom.refreshContainers.call(this);
|
1689
|
+
} else {
|
1690
|
+
for (var i = this.containers.length - 1; i >= 0; i--){
|
1691
|
+
var p =this.containers[i].element.offset();
|
1692
|
+
this.containers[i].containerCache.left = p.left;
|
1693
|
+
this.containers[i].containerCache.top = p.top;
|
1694
|
+
this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
|
1695
|
+
this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
|
1696
|
+
};
|
1697
|
+
}
|
1698
|
+
|
1699
|
+
},
|
1700
|
+
|
1701
|
+
destroy: function() {
|
1702
|
+
this.element
|
1703
|
+
.removeClass("ui-sortable ui-sortable-disabled")
|
1704
|
+
.removeData("sortable")
|
1705
|
+
.unbind(".sortable");
|
1706
|
+
this._mouseDestroy();
|
1707
|
+
|
1708
|
+
for ( var i = this.items.length - 1; i >= 0; i-- )
|
1709
|
+
this.items[i].item.removeData("sortable-item");
|
1710
|
+
},
|
1711
|
+
|
1712
|
+
_createPlaceholder: function(that) {
|
1713
|
+
|
1714
|
+
var self = that || this, o = self.options;
|
1715
|
+
|
1716
|
+
if(!o.placeholder || o.placeholder.constructor == String) {
|
1717
|
+
var className = o.placeholder;
|
1718
|
+
o.placeholder = {
|
1719
|
+
element: function() {
|
1720
|
+
var el = $(document.createElement(self.currentItem[0].nodeName)).addClass(className || "ui-sortable-placeholder")[0];
|
1721
|
+
|
1722
|
+
if(!className) {
|
1723
|
+
el.style.visibility = "hidden";
|
1724
|
+
document.body.appendChild(el);
|
1725
|
+
el.innerHTML = self.currentItem[0].innerHTML;
|
1726
|
+
document.body.removeChild(el);
|
1727
|
+
};
|
1728
|
+
|
1729
|
+
return el;
|
1730
|
+
},
|
1731
|
+
update: function(container, p) {
|
1732
|
+
if(className && !o.forcePlaceholderSize) return;
|
1733
|
+
if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
|
1734
|
+
if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
|
1735
|
+
}
|
1736
|
+
};
|
1737
|
+
}
|
1738
|
+
|
1739
|
+
self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem))
|
1740
|
+
self.currentItem.parent()[0].appendChild(self.placeholder[0]);
|
1741
|
+
self.placeholder[0].parentNode.insertBefore(self.placeholder[0], self.currentItem[0]);
|
1742
|
+
o.placeholder.update(self, self.placeholder);
|
1743
|
+
},
|
1744
|
+
|
1745
|
+
_contactContainers: function(e) {
|
1746
|
+
for (var i = this.containers.length - 1; i >= 0; i--){
|
1747
|
+
|
1748
|
+
if(this._intersectsWith(this.containers[i].containerCache)) {
|
1749
|
+
if(!this.containers[i].containerCache.over) {
|
1750
|
+
|
1751
|
+
|
1752
|
+
if(this.currentContainer != this.containers[i]) {
|
1753
|
+
|
1754
|
+
//When entering a new container, we will find the item with the least distance and append our item near it
|
1755
|
+
var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top'];
|
1756
|
+
for (var j = this.items.length - 1; j >= 0; j--) {
|
1757
|
+
if(!contains(this.containers[i].element[0], this.items[j].item[0])) continue;
|
1758
|
+
var cur = this.items[j][this.containers[i].floating ? 'left' : 'top'];
|
1759
|
+
if(Math.abs(cur - base) < dist) {
|
1760
|
+
dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
|
1761
|
+
}
|
1762
|
+
}
|
1763
|
+
|
1764
|
+
if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
|
1765
|
+
continue;
|
1766
|
+
|
1767
|
+
this.currentContainer = this.containers[i];
|
1768
|
+
itemWithLeastDistance ? this.options.sortIndicator.call(this, e, itemWithLeastDistance, null, true) : this.options.sortIndicator.call(this, e, null, this.containers[i].element, true);
|
1769
|
+
this._propagate("change", e); //Call plugins and callbacks
|
1770
|
+
this.containers[i]._propagate("change", e, this); //Call plugins and callbacks
|
1771
|
+
|
1772
|
+
//Update the placeholder
|
1773
|
+
this.options.placeholder.update(this.currentContainer, this.placeholder);
|
1774
|
+
|
1775
|
+
}
|
1776
|
+
|
1777
|
+
this.containers[i]._propagate("over", e, this);
|
1778
|
+
this.containers[i].containerCache.over = 1;
|
1779
|
+
}
|
1780
|
+
} else {
|
1781
|
+
if(this.containers[i].containerCache.over) {
|
1782
|
+
this.containers[i]._propagate("out", e, this);
|
1783
|
+
this.containers[i].containerCache.over = 0;
|
1784
|
+
}
|
1785
|
+
}
|
1786
|
+
|
1787
|
+
};
|
1788
|
+
},
|
1789
|
+
|
1790
|
+
_mouseCapture: function(e, overrideHandle) {
|
1791
|
+
|
1792
|
+
if(this.options.disabled || this.options.type == 'static') return false;
|
1793
|
+
|
1794
|
+
//We have to refresh the items data once first
|
1795
|
+
this._refreshItems();
|
1796
|
+
|
1797
|
+
//Find out if the clicked node (or one of its parents) is a actual item in this.items
|
1798
|
+
var currentItem = null, self = this, nodes = $(e.target).parents().each(function() {
|
1799
|
+
if($.data(this, 'sortable-item') == self) {
|
1800
|
+
currentItem = $(this);
|
1801
|
+
return false;
|
1802
|
+
}
|
1803
|
+
});
|
1804
|
+
if($.data(e.target, 'sortable-item') == self) currentItem = $(e.target);
|
1805
|
+
|
1806
|
+
if(!currentItem) return false;
|
1807
|
+
if(this.options.handle && !overrideHandle) {
|
1808
|
+
var validHandle = false;
|
1809
|
+
|
1810
|
+
$(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == e.target) validHandle = true; });
|
1811
|
+
if(!validHandle) return false;
|
1812
|
+
}
|
1813
|
+
|
1814
|
+
this.currentItem = currentItem;
|
1815
|
+
this._removeCurrentsFromItems();
|
1816
|
+
return true;
|
1817
|
+
|
1818
|
+
},
|
1819
|
+
|
1820
|
+
createHelper: function(e) {
|
1821
|
+
|
1822
|
+
var o = this.options;
|
1823
|
+
var helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : (o.helper == "original" ? this.currentItem : this.currentItem.clone());
|
1824
|
+
|
1825
|
+
if (!helper.parents('body').length)
|
1826
|
+
$(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); //Add the helper to the DOM if that didn't happen already
|
1827
|
+
|
1828
|
+
return helper;
|
1829
|
+
|
1830
|
+
},
|
1831
|
+
|
1832
|
+
_mouseStart: function(e, overrideHandle, noActivation) {
|
1833
|
+
|
1834
|
+
var o = this.options;
|
1835
|
+
this.currentContainer = this;
|
1836
|
+
|
1837
|
+
//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
|
1838
|
+
this.refreshPositions();
|
1839
|
+
|
1840
|
+
//Create and append the visible helper
|
1841
|
+
this.helper = this.createHelper(e);
|
1842
|
+
|
1843
|
+
/*
|
1844
|
+
* - Position generation -
|
1845
|
+
* This block generates everything position related - it's the core of draggables.
|
1846
|
+
*/
|
1847
|
+
|
1848
|
+
this.margins = { //Cache the margins
|
1849
|
+
left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
|
1850
|
+
top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
|
1851
|
+
};
|
1852
|
+
|
1853
|
+
this.offset = this.currentItem.offset(); //The element's absolute position on the page
|
1854
|
+
this.offset = { //Substract the margins from the element's absolute offset
|
1855
|
+
top: this.offset.top - this.margins.top,
|
1856
|
+
left: this.offset.left - this.margins.left
|
1857
|
+
};
|
1858
|
+
|
1859
|
+
this.offset.click = { //Where the click happened, relative to the element
|
1860
|
+
left: e.pageX - this.offset.left,
|
1861
|
+
top: e.pageY - this.offset.top
|
1862
|
+
};
|
1863
|
+
|
1864
|
+
this.offsetParent = this.helper.offsetParent(); //Get the offsetParent and cache its position
|
1865
|
+
var po = this.offsetParent.offset();
|
1866
|
+
|
1867
|
+
this.offsetParentBorders = {
|
1868
|
+
top: (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
|
1869
|
+
left: (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
|
1870
|
+
};
|
1871
|
+
|
1872
|
+
this.offset.parent = { //Store its position plus border
|
1873
|
+
top: po.top + this.offsetParentBorders.top,
|
1874
|
+
left: po.left + this.offsetParentBorders.left
|
1875
|
+
};
|
1876
|
+
|
1877
|
+
this.updateOriginalPosition = this.originalPosition = this._generatePosition(e); //Generate the original position
|
1878
|
+
this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; //Cache the former DOM position
|
1879
|
+
|
1880
|
+
//If o.placeholder is used, create a new element at the given position with the class
|
1881
|
+
this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size
|
1882
|
+
|
1883
|
+
|
1884
|
+
if(o.helper == "original") {
|
1885
|
+
this._storedCSS = { position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left"), clear: this.currentItem.css("clear") };
|
1886
|
+
} else {
|
1887
|
+
this.currentItem.hide(); //Hide the original, won't cause anything bad this way
|
1888
|
+
}
|
1889
|
+
|
1890
|
+
//Position it absolutely and add a helper class
|
1891
|
+
this.helper
|
1892
|
+
.css({ position: 'absolute', clear: 'both' })
|
1893
|
+
.addClass('ui-sortable-helper');
|
1894
|
+
|
1895
|
+
//Create the placeholder
|
1896
|
+
this._createPlaceholder();
|
1897
|
+
|
1898
|
+
//Call plugins and callbacks
|
1899
|
+
this._propagate("start", e);
|
1900
|
+
|
1901
|
+
//Recache the helper size
|
1902
|
+
if(!this._preserveHelperProportions)
|
1903
|
+
this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };
|
1904
|
+
|
1905
|
+
if(o.cursorAt) {
|
1906
|
+
if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left;
|
1907
|
+
if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right;
|
1908
|
+
if(o.cursorAt.top != undefined) this.offset.click.top = o.cursorAt.top;
|
1909
|
+
if(o.cursorAt.bottom != undefined) this.offset.click.top = this.helperProportions.height - o.cursorAt.bottom;
|
1910
|
+
}
|
1911
|
+
|
1912
|
+
/*
|
1913
|
+
* - Position constraining -
|
1914
|
+
* Here we prepare position constraining like grid and containment.
|
1915
|
+
*/
|
1916
|
+
|
1917
|
+
if(o.containment) {
|
1918
|
+
if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
|
1919
|
+
if(o.containment == 'document' || o.containment == 'window') this.containment = [
|
1920
|
+
0 - this.offset.parent.left,
|
1921
|
+
0 - this.offset.parent.top,
|
1922
|
+
$(o.containment == 'document' ? document : window).width() - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
|
1923
|
+
($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
|
1924
|
+
];
|
1925
|
+
|
1926
|
+
if(!(/^(document|window|parent)$/).test(o.containment)) {
|
1927
|
+
var ce = $(o.containment)[0];
|
1928
|
+
var co = $(o.containment).offset();
|
1929
|
+
var over = ($(ce).css("overflow") != 'hidden');
|
1930
|
+
|
1931
|
+
this.containment = [
|
1932
|
+
co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.parent.left,
|
1933
|
+
co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.parent.top,
|
1934
|
+
co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.currentItem.css("marginRight"),10) || 0),
|
1935
|
+
co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.currentItem.css("marginBottom"),10) || 0)
|
1936
|
+
];
|
1937
|
+
}
|
1938
|
+
}
|
1939
|
+
|
1940
|
+
//Post 'activate' events to possible containers
|
1941
|
+
if(!noActivation) {
|
1942
|
+
for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._propagate("activate", e, this); }
|
1943
|
+
}
|
1944
|
+
|
1945
|
+
//Prepare possible droppables
|
1946
|
+
if($.ui.ddmanager)
|
1947
|
+
$.ui.ddmanager.current = this;
|
1948
|
+
|
1949
|
+
if ($.ui.ddmanager && !o.dropBehaviour)
|
1950
|
+
$.ui.ddmanager.prepareOffsets(this, e);
|
1951
|
+
|
1952
|
+
this.dragging = true;
|
1953
|
+
|
1954
|
+
this._mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
|
1955
|
+
return true;
|
1956
|
+
|
1957
|
+
|
1958
|
+
},
|
1959
|
+
|
1960
|
+
_convertPositionTo: function(d, pos) {
|
1961
|
+
if(!pos) pos = this.position;
|
1962
|
+
var mod = d == "absolute" ? 1 : -1;
|
1963
|
+
return {
|
1964
|
+
top: (
|
1965
|
+
pos.top // the calculated relative position
|
1966
|
+
+ this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
|
1967
|
+
- (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) * mod // The offsetParent's scroll position
|
1968
|
+
+ this.margins.top * mod //Add the margin (you don't want the margin counting in intersection methods)
|
1969
|
+
),
|
1970
|
+
left: (
|
1971
|
+
pos.left // the calculated relative position
|
1972
|
+
+ this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
|
1973
|
+
- (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) * mod // The offsetParent's scroll position
|
1974
|
+
+ this.margins.left * mod //Add the margin (you don't want the margin counting in intersection methods)
|
1975
|
+
)
|
1976
|
+
};
|
1977
|
+
},
|
1978
|
+
|
1979
|
+
_generatePosition: function(e) {
|
1980
|
+
|
1981
|
+
var o = this.options;
|
1982
|
+
var position = {
|
1983
|
+
top: (
|
1984
|
+
e.pageY // The absolute mouse position
|
1985
|
+
- this.offset.click.top // Click offset (relative to the element)
|
1986
|
+
- this.offset.parent.top // The offsetParent's offset without borders (offset + border)
|
1987
|
+
+ (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) // The offsetParent's scroll position, not if the element is fixed
|
1988
|
+
),
|
1989
|
+
left: (
|
1990
|
+
e.pageX // The absolute mouse position
|
1991
|
+
- this.offset.click.left // Click offset (relative to the element)
|
1992
|
+
- this.offset.parent.left // The offsetParent's offset without borders (offset + border)
|
1993
|
+
+ (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) // The offsetParent's scroll position, not if the element is fixed
|
1994
|
+
)
|
1995
|
+
};
|
1996
|
+
|
1997
|
+
if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options
|
1998
|
+
|
1999
|
+
/*
|
2000
|
+
* - Position constraining -
|
2001
|
+
* Constrain the position to a mix of grid, containment.
|
2002
|
+
*/
|
2003
|
+
if(this.containment) {
|
2004
|
+
if(position.left < this.containment[0]) position.left = this.containment[0];
|
2005
|
+
if(position.top < this.containment[1]) position.top = this.containment[1];
|
2006
|
+
if(position.left > this.containment[2]) position.left = this.containment[2];
|
2007
|
+
if(position.top > this.containment[3]) position.top = this.containment[3];
|
2008
|
+
}
|
2009
|
+
|
2010
|
+
if(o.grid) {
|
2011
|
+
var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];
|
2012
|
+
position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
|
2013
|
+
|
2014
|
+
var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];
|
2015
|
+
position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
|
2016
|
+
}
|
2017
|
+
|
2018
|
+
return position;
|
2019
|
+
},
|
2020
|
+
|
2021
|
+
_mouseDrag: function(e) {
|
2022
|
+
|
2023
|
+
//Compute the helpers position
|
2024
|
+
this.position = this._generatePosition(e);
|
2025
|
+
this.positionAbs = this._convertPositionTo("absolute");
|
2026
|
+
|
2027
|
+
//Call the internal plugins
|
2028
|
+
$.ui.plugin.call(this, "sort", [e, this.ui()]);
|
2029
|
+
|
2030
|
+
//Regenerate the absolute position used for position checks
|
2031
|
+
this.positionAbs = this._convertPositionTo("absolute");
|
2032
|
+
|
2033
|
+
//Set the helper's position
|
2034
|
+
this.helper[0].style.left = this.position.left+'px';
|
2035
|
+
this.helper[0].style.top = this.position.top+'px';
|
2036
|
+
|
2037
|
+
//Rearrange
|
2038
|
+
for (var i = this.items.length - 1; i >= 0; i--) {
|
2039
|
+
var intersection = this._intersectsWithEdge(this.items[i]);
|
2040
|
+
if(!intersection) continue;
|
2041
|
+
|
2042
|
+
if(this.items[i].item[0] != this.currentItem[0] //cannot intersect with itself
|
2043
|
+
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != this.items[i].item[0] //no useless actions that have been done before
|
2044
|
+
&& !contains(this.placeholder[0], this.items[i].item[0]) //no action if the item moved is the parent of the item checked
|
2045
|
+
&& (this.options.type == 'semi-dynamic' ? !contains(this.element[0], this.items[i].item[0]) : true)
|
2046
|
+
) {
|
2047
|
+
|
2048
|
+
this.updateOriginalPosition = this._generatePosition(e);
|
2049
|
+
|
2050
|
+
this.direction = intersection == 1 ? "down" : "up";
|
2051
|
+
this.options.sortIndicator.call(this, e, this.items[i]);
|
2052
|
+
this._propagate("change", e); //Call plugins and callbacks
|
2053
|
+
break;
|
2054
|
+
}
|
2055
|
+
}
|
2056
|
+
|
2057
|
+
//Post events to containers
|
2058
|
+
this._contactContainers(e);
|
2059
|
+
|
2060
|
+
//Interconnect with droppables
|
2061
|
+
if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
|
2062
|
+
|
2063
|
+
//Call callbacks
|
2064
|
+
this.element.triggerHandler("sort", [e, this.ui()], this.options["sort"]);
|
2065
|
+
|
2066
|
+
return false;
|
2067
|
+
|
2068
|
+
},
|
2069
|
+
|
2070
|
+
_rearrange: function(e, i, a, hardRefresh) {
|
2071
|
+
|
2072
|
+
a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
|
2073
|
+
|
2074
|
+
//Various things done here to improve the performance:
|
2075
|
+
// 1. we create a setTimeout, that calls refreshPositions
|
2076
|
+
// 2. on the instance, we have a counter variable, that get's higher after every append
|
2077
|
+
// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
|
2078
|
+
// 4. this lets only the last addition to the timeout stack through
|
2079
|
+
this.counter = this.counter ? ++this.counter : 1;
|
2080
|
+
var self = this, counter = this.counter;
|
2081
|
+
|
2082
|
+
window.setTimeout(function() {
|
2083
|
+
if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
|
2084
|
+
},0);
|
2085
|
+
|
2086
|
+
},
|
2087
|
+
|
2088
|
+
_mouseStop: function(e, noPropagation) {
|
2089
|
+
|
2090
|
+
//If we are using droppables, inform the manager about the drop
|
2091
|
+
if ($.ui.ddmanager && !this.options.dropBehaviour)
|
2092
|
+
$.ui.ddmanager.drop(this, e);
|
2093
|
+
|
2094
|
+
if(this.options.revert) {
|
2095
|
+
var self = this;
|
2096
|
+
var cur = self.placeholder.offset();
|
2097
|
+
|
2098
|
+
$(this.helper).animate({
|
2099
|
+
left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
|
2100
|
+
top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
|
2101
|
+
}, parseInt(this.options.revert, 10) || 500, function() {
|
2102
|
+
self._clear(e);
|
2103
|
+
});
|
2104
|
+
} else {
|
2105
|
+
this._clear(e, noPropagation);
|
2106
|
+
}
|
2107
|
+
|
2108
|
+
return false;
|
2109
|
+
|
2110
|
+
},
|
2111
|
+
|
2112
|
+
_clear: function(e, noPropagation) {
|
2113
|
+
|
2114
|
+
//We first have to update the dom position of the actual currentItem
|
2115
|
+
if(!this._noFinalSort) this.placeholder.before(this.currentItem);
|
2116
|
+
this._noFinalSort = null;
|
2117
|
+
|
2118
|
+
if(this.options.helper == "original")
|
2119
|
+
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
|
2120
|
+
else
|
2121
|
+
this.currentItem.show();
|
2122
|
+
|
2123
|
+
if(this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) this._propagate("update", e, null, noPropagation); //Trigger update callback if the DOM position has changed
|
2124
|
+
if(!contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
|
2125
|
+
this._propagate("remove", e, null, noPropagation);
|
2126
|
+
for (var i = this.containers.length - 1; i >= 0; i--){
|
2127
|
+
if(contains(this.containers[i].element[0], this.currentItem[0])) {
|
2128
|
+
this.containers[i]._propagate("update", e, this, noPropagation);
|
2129
|
+
this.containers[i]._propagate("receive", e, this, noPropagation);
|
2130
|
+
}
|
2131
|
+
};
|
2132
|
+
};
|
2133
|
+
|
2134
|
+
//Post events to containers
|
2135
|
+
for (var i = this.containers.length - 1; i >= 0; i--){
|
2136
|
+
this.containers[i]._propagate("deactivate", e, this, noPropagation);
|
2137
|
+
if(this.containers[i].containerCache.over) {
|
2138
|
+
this.containers[i]._propagate("out", e, this);
|
2139
|
+
this.containers[i].containerCache.over = 0;
|
2140
|
+
}
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
this.dragging = false;
|
2144
|
+
if(this.cancelHelperRemoval) {
|
2145
|
+
this._propagate("beforeStop", e, null, noPropagation);
|
2146
|
+
this._propagate("stop", e, null, noPropagation);
|
2147
|
+
return false;
|
2148
|
+
}
|
2149
|
+
|
2150
|
+
this._propagate("beforeStop", e, null, noPropagation);
|
2151
|
+
|
2152
|
+
this.placeholder.remove();
|
2153
|
+
if(this.options.helper != "original") this.helper.remove(); this.helper = null;
|
2154
|
+
this._propagate("stop", e, null, noPropagation);
|
2155
|
+
|
2156
|
+
return true;
|
2157
|
+
|
2158
|
+
}
|
2159
|
+
}));
|
2160
|
+
|
2161
|
+
$.extend($.ui.sortable, {
|
2162
|
+
getter: "serialize toArray",
|
2163
|
+
defaults: {
|
2164
|
+
helper: "original",
|
2165
|
+
tolerance: "guess",
|
2166
|
+
distance: 1,
|
2167
|
+
delay: 0,
|
2168
|
+
scroll: true,
|
2169
|
+
scrollSensitivity: 20,
|
2170
|
+
scrollSpeed: 20,
|
2171
|
+
cancel: ":input",
|
2172
|
+
items: '> *',
|
2173
|
+
zIndex: 1000,
|
2174
|
+
dropOnEmpty: true,
|
2175
|
+
appendTo: "parent",
|
2176
|
+
sortIndicator: $.ui.sortable.prototype._rearrange,
|
2177
|
+
scope: "default",
|
2178
|
+
forcePlaceholderSize: false
|
2179
|
+
}
|
2180
|
+
});
|
2181
|
+
|
2182
|
+
/*
|
2183
|
+
* Sortable Extensions
|
2184
|
+
*/
|
2185
|
+
|
2186
|
+
$.ui.plugin.add("sortable", "cursor", {
|
2187
|
+
start: function(e, ui) {
|
2188
|
+
var t = $('body');
|
2189
|
+
if (t.css("cursor")) ui.options._cursor = t.css("cursor");
|
2190
|
+
t.css("cursor", ui.options.cursor);
|
2191
|
+
},
|
2192
|
+
beforeStop: function(e, ui) {
|
2193
|
+
if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);
|
2194
|
+
}
|
2195
|
+
});
|
2196
|
+
|
2197
|
+
$.ui.plugin.add("sortable", "zIndex", {
|
2198
|
+
start: function(e, ui) {
|
2199
|
+
var t = ui.helper;
|
2200
|
+
if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");
|
2201
|
+
t.css('zIndex', ui.options.zIndex);
|
2202
|
+
},
|
2203
|
+
beforeStop: function(e, ui) {
|
2204
|
+
if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);
|
2205
|
+
}
|
2206
|
+
});
|
2207
|
+
|
2208
|
+
$.ui.plugin.add("sortable", "opacity", {
|
2209
|
+
start: function(e, ui) {
|
2210
|
+
var t = ui.helper;
|
2211
|
+
if(t.css("opacity")) ui.options._opacity = t.css("opacity");
|
2212
|
+
t.css('opacity', ui.options.opacity);
|
2213
|
+
},
|
2214
|
+
beforeStop: function(e, ui) {
|
2215
|
+
if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);
|
2216
|
+
}
|
2217
|
+
});
|
2218
|
+
|
2219
|
+
$.ui.plugin.add("sortable", "scroll", {
|
2220
|
+
start: function(e, ui) {
|
2221
|
+
var o = ui.options;
|
2222
|
+
var i = $(this).data("sortable");
|
2223
|
+
|
2224
|
+
i.overflowY = function(el) {
|
2225
|
+
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
|
2226
|
+
return $(document);
|
2227
|
+
}(i.currentItem);
|
2228
|
+
i.overflowX = function(el) {
|
2229
|
+
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
|
2230
|
+
return $(document);
|
2231
|
+
}(i.currentItem);
|
2232
|
+
|
2233
|
+
if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();
|
2234
|
+
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();
|
2235
|
+
|
2236
|
+
},
|
2237
|
+
sort: function(e, ui) {
|
2238
|
+
|
2239
|
+
var o = ui.options;
|
2240
|
+
var i = $(this).data("sortable");
|
2241
|
+
|
2242
|
+
if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
|
2243
|
+
if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
|
2244
|
+
i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;
|
2245
|
+
if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)
|
2246
|
+
i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;
|
2247
|
+
} else {
|
2248
|
+
if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)
|
2249
|
+
$(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
2250
|
+
if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
|
2251
|
+
$(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
2252
|
+
}
|
2253
|
+
|
2254
|
+
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
|
2255
|
+
if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
|
2256
|
+
i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;
|
2257
|
+
if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity)
|
2258
|
+
i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;
|
2259
|
+
} else {
|
2260
|
+
if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)
|
2261
|
+
$(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
2262
|
+
if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
|
2263
|
+
$(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
2264
|
+
}
|
2265
|
+
|
2266
|
+
}
|
2267
|
+
});
|
2268
|
+
|
2269
|
+
$.ui.plugin.add("sortable", "axis", {
|
2270
|
+
sort: function(e, ui) {
|
2271
|
+
|
2272
|
+
var i = $(this).data("sortable");
|
2273
|
+
|
2274
|
+
if(ui.options.axis == "y") i.position.left = i.originalPosition.left;
|
2275
|
+
if(ui.options.axis == "x") i.position.top = i.originalPosition.top;
|
2276
|
+
|
2277
|
+
}
|
2278
|
+
});
|
2279
|
+
|
2280
|
+
})(jQuery);
|
2281
|
+
/*
|
2282
|
+
* jQuery UI Effects 1.6rc2
|
2283
|
+
|
2284
|
+
*
|
2285
|
+
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
2286
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
2287
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
2288
|
+
*
|
2289
|
+
* http://docs.jquery.com/UI/Effects/
|
2290
|
+
*/
|
2291
|
+
;(function($) {
|
2292
|
+
|
2293
|
+
$.effects = $.effects || {}; //Add the 'effects' scope
|
2294
|
+
|
2295
|
+
$.extend($.effects, {
|
2296
|
+
save: function(el, set) {
|
2297
|
+
for(var i=0;i<set.length;i++) {
|
2298
|
+
if(set[i] !== null) $.data(el[0], "ec.storage."+set[i], el[0].style[set[i]]);
|
2299
|
+
}
|
2300
|
+
},
|
2301
|
+
restore: function(el, set) {
|
2302
|
+
for(var i=0;i<set.length;i++) {
|
2303
|
+
if(set[i] !== null) el.css(set[i], $.data(el[0], "ec.storage."+set[i]));
|
2304
|
+
}
|
2305
|
+
},
|
2306
|
+
setMode: function(el, mode) {
|
2307
|
+
if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
|
2308
|
+
return mode;
|
2309
|
+
},
|
2310
|
+
getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
|
2311
|
+
// this should be a little more flexible in the future to handle a string & hash
|
2312
|
+
var y, x;
|
2313
|
+
switch (origin[0]) {
|
2314
|
+
case 'top': y = 0; break;
|
2315
|
+
case 'middle': y = 0.5; break;
|
2316
|
+
case 'bottom': y = 1; break;
|
2317
|
+
default: y = origin[0] / original.height;
|
2318
|
+
};
|
2319
|
+
switch (origin[1]) {
|
2320
|
+
case 'left': x = 0; break;
|
2321
|
+
case 'center': x = 0.5; break;
|
2322
|
+
case 'right': x = 1; break;
|
2323
|
+
default: x = origin[1] / original.width;
|
2324
|
+
};
|
2325
|
+
return {x: x, y: y};
|
2326
|
+
},
|
2327
|
+
createWrapper: function(el) {
|
2328
|
+
if (el.parent().attr('id') == 'fxWrapper')
|
2329
|
+
return el;
|
2330
|
+
var props = {width: el.outerWidth({margin:true}), height: el.outerHeight({margin:true}), 'float': el.css('float')};
|
2331
|
+
el.wrap('<div id="fxWrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
|
2332
|
+
var wrapper = el.parent();
|
2333
|
+
if (el.css('position') == 'static'){
|
2334
|
+
wrapper.css({position: 'relative'});
|
2335
|
+
el.css({position: 'relative'});
|
2336
|
+
} else {
|
2337
|
+
var top = el.css('top'); if(isNaN(parseInt(top))) top = 'auto';
|
2338
|
+
var left = el.css('left'); if(isNaN(parseInt(left))) left = 'auto';
|
2339
|
+
wrapper.css({ position: el.css('position'), top: top, left: left, zIndex: el.css('z-index') }).show();
|
2340
|
+
el.css({position: 'relative', top:0, left:0});
|
2341
|
+
}
|
2342
|
+
wrapper.css(props);
|
2343
|
+
return wrapper;
|
2344
|
+
},
|
2345
|
+
removeWrapper: function(el) {
|
2346
|
+
if (el.parent().attr('id') == 'fxWrapper')
|
2347
|
+
return el.parent().replaceWith(el);
|
2348
|
+
return el;
|
2349
|
+
},
|
2350
|
+
setTransition: function(el, list, factor, val) {
|
2351
|
+
val = val || {};
|
2352
|
+
$.each(list,function(i, x){
|
2353
|
+
unit = el.cssUnit(x);
|
2354
|
+
if (unit[0] > 0) val[x] = unit[0] * factor + unit[1];
|
2355
|
+
});
|
2356
|
+
return val;
|
2357
|
+
},
|
2358
|
+
animateClass: function(value, duration, easing, callback) {
|
2359
|
+
|
2360
|
+
var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
|
2361
|
+
var ea = (typeof easing == "object" ? easing : null);
|
2362
|
+
|
2363
|
+
return this.each(function() {
|
2364
|
+
|
2365
|
+
var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
|
2366
|
+
if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
|
2367
|
+
if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }
|
2368
|
+
|
2369
|
+
//Let's get a style offset
|
2370
|
+
var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
|
2371
|
+
if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
|
2372
|
+
var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
|
2373
|
+
if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);
|
2374
|
+
|
2375
|
+
// The main function to form the object for animation
|
2376
|
+
for(var n in newStyle) {
|
2377
|
+
if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
|
2378
|
+
&& n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
|
2379
|
+
&& newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
|
2380
|
+
&& (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
|
2381
|
+
&& (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
|
2382
|
+
) offset[n] = newStyle[n];
|
2383
|
+
}
|
2384
|
+
|
2385
|
+
that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
|
2386
|
+
// Change style attribute back to original. For stupid IE, we need to clear the damn object.
|
2387
|
+
if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
|
2388
|
+
if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
|
2389
|
+
if(cb) cb.apply(this, arguments);
|
2390
|
+
});
|
2391
|
+
|
2392
|
+
});
|
2393
|
+
}
|
2394
|
+
});
|
2395
|
+
|
2396
|
+
//Extend the methods of jQuery
|
2397
|
+
$.fn.extend({
|
2398
|
+
//Save old methods
|
2399
|
+
_show: $.fn.show,
|
2400
|
+
_hide: $.fn.hide,
|
2401
|
+
__toggle: $.fn.toggle,
|
2402
|
+
_addClass: $.fn.addClass,
|
2403
|
+
_removeClass: $.fn.removeClass,
|
2404
|
+
_toggleClass: $.fn.toggleClass,
|
2405
|
+
// New ec methods
|
2406
|
+
effect: function(fx,o,speed,callback) {
|
2407
|
+
return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: o || {}, duration: speed, callback: callback }) : null;
|
2408
|
+
},
|
2409
|
+
show: function() {
|
2410
|
+
if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])))
|
2411
|
+
return this._show.apply(this, arguments);
|
2412
|
+
else {
|
2413
|
+
var o = arguments[1] || {}; o['mode'] = 'show';
|
2414
|
+
return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
|
2415
|
+
}
|
2416
|
+
},
|
2417
|
+
hide: function() {
|
2418
|
+
if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])))
|
2419
|
+
return this._hide.apply(this, arguments);
|
2420
|
+
else {
|
2421
|
+
var o = arguments[1] || {}; o['mode'] = 'hide';
|
2422
|
+
return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
|
2423
|
+
}
|
2424
|
+
},
|
2425
|
+
toggle: function(){
|
2426
|
+
if(!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])) || (arguments[0].constructor == Function))
|
2427
|
+
return this.__toggle.apply(this, arguments);
|
2428
|
+
else {
|
2429
|
+
var o = arguments[1] || {}; o['mode'] = 'toggle';
|
2430
|
+
return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
|
2431
|
+
}
|
2432
|
+
},
|
2433
|
+
addClass: function(classNames,speed,easing,callback) {
|
2434
|
+
return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
|
2435
|
+
},
|
2436
|
+
removeClass: function(classNames,speed,easing,callback) {
|
2437
|
+
return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
|
2438
|
+
},
|
2439
|
+
toggleClass: function(classNames,speed,easing,callback) {
|
2440
|
+
return speed ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames);
|
2441
|
+
},
|
2442
|
+
morph: function(remove,add,speed,easing,callback) {
|
2443
|
+
return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
|
2444
|
+
},
|
2445
|
+
switchClass: function() {
|
2446
|
+
return this.morph.apply(this, arguments);
|
2447
|
+
},
|
2448
|
+
// helper functions
|
2449
|
+
cssUnit: function(key) {
|
2450
|
+
var style = this.css(key), val = [];
|
2451
|
+
$.each( ['em','px','%','pt'], function(i, unit){
|
2452
|
+
if(style.indexOf(unit) > 0)
|
2453
|
+
val = [parseFloat(style), unit];
|
2454
|
+
});
|
2455
|
+
return val;
|
2456
|
+
}
|
2457
|
+
});
|
2458
|
+
|
2459
|
+
/*
|
2460
|
+
* jQuery Color Animations
|
2461
|
+
* Copyright 2007 John Resig
|
2462
|
+
* Released under the MIT and GPL licenses.
|
2463
|
+
*/
|
2464
|
+
|
2465
|
+
// We override the animation for all of these color styles
|
2466
|
+
jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
|
2467
|
+
jQuery.fx.step[attr] = function(fx){
|
2468
|
+
if ( fx.state == 0 ) {
|
2469
|
+
fx.start = getColor( fx.elem, attr );
|
2470
|
+
fx.end = getRGB( fx.end );
|
2471
|
+
}
|
2472
|
+
|
2473
|
+
fx.elem.style[attr] = "rgb(" + [
|
2474
|
+
Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
|
2475
|
+
Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
|
2476
|
+
Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
|
2477
|
+
].join(",") + ")";
|
2478
|
+
}
|
2479
|
+
});
|
2480
|
+
|
2481
|
+
// Color Conversion functions from highlightFade
|
2482
|
+
// By Blair Mitchelmore
|
2483
|
+
// http://jquery.offput.ca/highlightFade/
|
2484
|
+
|
2485
|
+
// Parse strings looking for color tuples [255,255,255]
|
2486
|
+
function getRGB(color) {
|
2487
|
+
var result;
|
2488
|
+
|
2489
|
+
// Check if we're already dealing with an array of colors
|
2490
|
+
if ( color && color.constructor == Array && color.length == 3 )
|
2491
|
+
return color;
|
2492
|
+
|
2493
|
+
// Look for rgb(num,num,num)
|
2494
|
+
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
|
2495
|
+
return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
|
2496
|
+
|
2497
|
+
// Look for rgb(num%,num%,num%)
|
2498
|
+
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
|
2499
|
+
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
|
2500
|
+
|
2501
|
+
// Look for #a0b1c2
|
2502
|
+
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
|
2503
|
+
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
|
2504
|
+
|
2505
|
+
// Look for #fff
|
2506
|
+
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
|
2507
|
+
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
|
2508
|
+
|
2509
|
+
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
|
2510
|
+
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
|
2511
|
+
return colors['transparent']
|
2512
|
+
|
2513
|
+
// Otherwise, we're most likely dealing with a named color
|
2514
|
+
return colors[jQuery.trim(color).toLowerCase()];
|
2515
|
+
}
|
2516
|
+
|
2517
|
+
function getColor(elem, attr) {
|
2518
|
+
var color;
|
2519
|
+
|
2520
|
+
do {
|
2521
|
+
color = jQuery.curCSS(elem, attr);
|
2522
|
+
|
2523
|
+
// Keep going until we find an element that has color, or we hit the body
|
2524
|
+
if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
|
2525
|
+
break;
|
2526
|
+
|
2527
|
+
attr = "backgroundColor";
|
2528
|
+
} while ( elem = elem.parentNode );
|
2529
|
+
|
2530
|
+
return getRGB(color);
|
2531
|
+
};
|
2532
|
+
|
2533
|
+
// Some named colors to work with
|
2534
|
+
// From Interface by Stefan Petre
|
2535
|
+
// http://interface.eyecon.ro/
|
2536
|
+
|
2537
|
+
var colors = {
|
2538
|
+
aqua:[0,255,255],
|
2539
|
+
azure:[240,255,255],
|
2540
|
+
beige:[245,245,220],
|
2541
|
+
black:[0,0,0],
|
2542
|
+
blue:[0,0,255],
|
2543
|
+
brown:[165,42,42],
|
2544
|
+
cyan:[0,255,255],
|
2545
|
+
darkblue:[0,0,139],
|
2546
|
+
darkcyan:[0,139,139],
|
2547
|
+
darkgrey:[169,169,169],
|
2548
|
+
darkgreen:[0,100,0],
|
2549
|
+
darkkhaki:[189,183,107],
|
2550
|
+
darkmagenta:[139,0,139],
|
2551
|
+
darkolivegreen:[85,107,47],
|
2552
|
+
darkorange:[255,140,0],
|
2553
|
+
darkorchid:[153,50,204],
|
2554
|
+
darkred:[139,0,0],
|
2555
|
+
darksalmon:[233,150,122],
|
2556
|
+
darkviolet:[148,0,211],
|
2557
|
+
fuchsia:[255,0,255],
|
2558
|
+
gold:[255,215,0],
|
2559
|
+
green:[0,128,0],
|
2560
|
+
indigo:[75,0,130],
|
2561
|
+
khaki:[240,230,140],
|
2562
|
+
lightblue:[173,216,230],
|
2563
|
+
lightcyan:[224,255,255],
|
2564
|
+
lightgreen:[144,238,144],
|
2565
|
+
lightgrey:[211,211,211],
|
2566
|
+
lightpink:[255,182,193],
|
2567
|
+
lightyellow:[255,255,224],
|
2568
|
+
lime:[0,255,0],
|
2569
|
+
magenta:[255,0,255],
|
2570
|
+
maroon:[128,0,0],
|
2571
|
+
navy:[0,0,128],
|
2572
|
+
olive:[128,128,0],
|
2573
|
+
orange:[255,165,0],
|
2574
|
+
pink:[255,192,203],
|
2575
|
+
purple:[128,0,128],
|
2576
|
+
violet:[128,0,128],
|
2577
|
+
red:[255,0,0],
|
2578
|
+
silver:[192,192,192],
|
2579
|
+
white:[255,255,255],
|
2580
|
+
yellow:[255,255,0],
|
2581
|
+
transparent: [255,255,255]
|
2582
|
+
};
|
2583
|
+
|
2584
|
+
/*
|
2585
|
+
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
2586
|
+
*
|
2587
|
+
* Uses the built in easing capabilities added In jQuery 1.1
|
2588
|
+
* to offer multiple easing options
|
2589
|
+
*
|
2590
|
+
* TERMS OF USE - jQuery Easing
|
2591
|
+
*
|
2592
|
+
* Open source under the BSD License.
|
2593
|
+
*
|
2594
|
+
* Copyright © 2008 George McGinley Smith
|
2595
|
+
* All rights reserved.
|
2596
|
+
*
|
2597
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
2598
|
+
* are permitted provided that the following conditions are met:
|
2599
|
+
*
|
2600
|
+
* Redistributions of source code must retain the above copyright notice, this list of
|
2601
|
+
* conditions and the following disclaimer.
|
2602
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
2603
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
2604
|
+
* provided with the distribution.
|
2605
|
+
*
|
2606
|
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
2607
|
+
* or promote products derived from this software without specific prior written permission.
|
2608
|
+
*
|
2609
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
2610
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
2611
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
2612
|
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
2613
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
2614
|
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
2615
|
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
2616
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
2617
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
2618
|
+
*
|
2619
|
+
*/
|
2620
|
+
|
2621
|
+
// t: current time, b: begInnIng value, c: change In value, d: duration
|
2622
|
+
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
2623
|
+
|
2624
|
+
jQuery.extend( jQuery.easing,
|
2625
|
+
{
|
2626
|
+
def: 'easeOutQuad',
|
2627
|
+
swing: function (x, t, b, c, d) {
|
2628
|
+
//alert(jQuery.easing.default);
|
2629
|
+
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
2630
|
+
},
|
2631
|
+
easeInQuad: function (x, t, b, c, d) {
|
2632
|
+
return c*(t/=d)*t + b;
|
2633
|
+
},
|
2634
|
+
easeOutQuad: function (x, t, b, c, d) {
|
2635
|
+
return -c *(t/=d)*(t-2) + b;
|
2636
|
+
},
|
2637
|
+
easeInOutQuad: function (x, t, b, c, d) {
|
2638
|
+
if ((t/=d/2) < 1) return c/2*t*t + b;
|
2639
|
+
return -c/2 * ((--t)*(t-2) - 1) + b;
|
2640
|
+
},
|
2641
|
+
easeInCubic: function (x, t, b, c, d) {
|
2642
|
+
return c*(t/=d)*t*t + b;
|
2643
|
+
},
|
2644
|
+
easeOutCubic: function (x, t, b, c, d) {
|
2645
|
+
return c*((t=t/d-1)*t*t + 1) + b;
|
2646
|
+
},
|
2647
|
+
easeInOutCubic: function (x, t, b, c, d) {
|
2648
|
+
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
2649
|
+
return c/2*((t-=2)*t*t + 2) + b;
|
2650
|
+
},
|
2651
|
+
easeInQuart: function (x, t, b, c, d) {
|
2652
|
+
return c*(t/=d)*t*t*t + b;
|
2653
|
+
},
|
2654
|
+
easeOutQuart: function (x, t, b, c, d) {
|
2655
|
+
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
2656
|
+
},
|
2657
|
+
easeInOutQuart: function (x, t, b, c, d) {
|
2658
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
2659
|
+
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
2660
|
+
},
|
2661
|
+
easeInQuint: function (x, t, b, c, d) {
|
2662
|
+
return c*(t/=d)*t*t*t*t + b;
|
2663
|
+
},
|
2664
|
+
easeOutQuint: function (x, t, b, c, d) {
|
2665
|
+
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
2666
|
+
},
|
2667
|
+
easeInOutQuint: function (x, t, b, c, d) {
|
2668
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
2669
|
+
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
2670
|
+
},
|
2671
|
+
easeInSine: function (x, t, b, c, d) {
|
2672
|
+
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
2673
|
+
},
|
2674
|
+
easeOutSine: function (x, t, b, c, d) {
|
2675
|
+
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
2676
|
+
},
|
2677
|
+
easeInOutSine: function (x, t, b, c, d) {
|
2678
|
+
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
2679
|
+
},
|
2680
|
+
easeInExpo: function (x, t, b, c, d) {
|
2681
|
+
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
2682
|
+
},
|
2683
|
+
easeOutExpo: function (x, t, b, c, d) {
|
2684
|
+
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
2685
|
+
},
|
2686
|
+
easeInOutExpo: function (x, t, b, c, d) {
|
2687
|
+
if (t==0) return b;
|
2688
|
+
if (t==d) return b+c;
|
2689
|
+
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
2690
|
+
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
2691
|
+
},
|
2692
|
+
easeInCirc: function (x, t, b, c, d) {
|
2693
|
+
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
2694
|
+
},
|
2695
|
+
easeOutCirc: function (x, t, b, c, d) {
|
2696
|
+
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
2697
|
+
},
|
2698
|
+
easeInOutCirc: function (x, t, b, c, d) {
|
2699
|
+
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
2700
|
+
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
2701
|
+
},
|
2702
|
+
easeInElastic: function (x, t, b, c, d) {
|
2703
|
+
var s=1.70158;var p=0;var a=c;
|
2704
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
2705
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
2706
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
2707
|
+
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
2708
|
+
},
|
2709
|
+
easeOutElastic: function (x, t, b, c, d) {
|
2710
|
+
var s=1.70158;var p=0;var a=c;
|
2711
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
2712
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
2713
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
2714
|
+
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
2715
|
+
},
|
2716
|
+
easeInOutElastic: function (x, t, b, c, d) {
|
2717
|
+
var s=1.70158;var p=0;var a=c;
|
2718
|
+
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
2719
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
2720
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
2721
|
+
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
2722
|
+
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
2723
|
+
},
|
2724
|
+
easeInBack: function (x, t, b, c, d, s) {
|
2725
|
+
if (s == undefined) s = 1.70158;
|
2726
|
+
return c*(t/=d)*t*((s+1)*t - s) + b;
|
2727
|
+
},
|
2728
|
+
easeOutBack: function (x, t, b, c, d, s) {
|
2729
|
+
if (s == undefined) s = 1.70158;
|
2730
|
+
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
2731
|
+
},
|
2732
|
+
easeInOutBack: function (x, t, b, c, d, s) {
|
2733
|
+
if (s == undefined) s = 1.70158;
|
2734
|
+
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
2735
|
+
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
2736
|
+
},
|
2737
|
+
easeInBounce: function (x, t, b, c, d) {
|
2738
|
+
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
2739
|
+
},
|
2740
|
+
easeOutBounce: function (x, t, b, c, d) {
|
2741
|
+
if ((t/=d) < (1/2.75)) {
|
2742
|
+
return c*(7.5625*t*t) + b;
|
2743
|
+
} else if (t < (2/2.75)) {
|
2744
|
+
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
2745
|
+
} else if (t < (2.5/2.75)) {
|
2746
|
+
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
2747
|
+
} else {
|
2748
|
+
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
2749
|
+
}
|
2750
|
+
},
|
2751
|
+
easeInOutBounce: function (x, t, b, c, d) {
|
2752
|
+
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
2753
|
+
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
2754
|
+
}
|
2755
|
+
});
|
2756
|
+
|
2757
|
+
/*
|
2758
|
+
*
|
2759
|
+
* TERMS OF USE - EASING EQUATIONS
|
2760
|
+
*
|
2761
|
+
* Open source under the BSD License.
|
2762
|
+
*
|
2763
|
+
* Copyright © 2001 Robert Penner
|
2764
|
+
* All rights reserved.
|
2765
|
+
*
|
2766
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
2767
|
+
* are permitted provided that the following conditions are met:
|
2768
|
+
*
|
2769
|
+
* Redistributions of source code must retain the above copyright notice, this list of
|
2770
|
+
* conditions and the following disclaimer.
|
2771
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
2772
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
2773
|
+
* provided with the distribution.
|
2774
|
+
*
|
2775
|
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
2776
|
+
* or promote products derived from this software without specific prior written permission.
|
2777
|
+
*
|
2778
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
2779
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
2780
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
2781
|
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
2782
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
2783
|
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
2784
|
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
2785
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
2786
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
2787
|
+
*
|
2788
|
+
*/
|
2789
|
+
|
2790
|
+
})(jQuery);
|
2791
|
+
/*
|
2792
|
+
* jQuery UI Effects Highlight 1.6rc2
|
2793
|
+
|
2794
|
+
*
|
2795
|
+
* Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
|
2796
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
2797
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
2798
|
+
*
|
2799
|
+
* http://docs.jquery.com/UI/Effects/Highlight
|
2800
|
+
*
|
2801
|
+
* Depends:
|
2802
|
+
* effects.core.js
|
2803
|
+
*/
|
2804
|
+
;(function($) {
|
2805
|
+
|
2806
|
+
$.effects.highlight = function(o) {
|
2807
|
+
|
2808
|
+
return this.queue(function() {
|
2809
|
+
|
2810
|
+
// Create element
|
2811
|
+
var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
|
2812
|
+
|
2813
|
+
// Set options
|
2814
|
+
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
|
2815
|
+
var color = o.options.color || "#ffff99"; // Default highlight color
|
2816
|
+
var oldColor = el.css("backgroundColor");
|
2817
|
+
|
2818
|
+
// Adjust
|
2819
|
+
$.effects.save(el, props); el.show(); // Save & Show
|
2820
|
+
el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
|
2821
|
+
|
2822
|
+
// Animation
|
2823
|
+
var animation = {backgroundColor: oldColor };
|
2824
|
+
if (mode == "hide") animation['opacity'] = 0;
|
2825
|
+
|
2826
|
+
// Animate
|
2827
|
+
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
2828
|
+
if(mode == "hide") el.hide();
|
2829
|
+
$.effects.restore(el, props);
|
2830
|
+
if (mode == "show" && jQuery.browser.msie) this.style.removeAttribute('filter');
|
2831
|
+
if(o.callback) o.callback.apply(this, arguments);
|
2832
|
+
el.dequeue();
|
2833
|
+
}});
|
2834
|
+
|
2835
|
+
});
|
2836
|
+
|
2837
|
+
};
|
2838
|
+
|
2839
|
+
})(jQuery);
|