You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2014/12/10 12:08:34 UTC
[27/39] couchdb commit: updated refs/heads/master to 9950caa
http://git-wip-us.apache.org/repos/asf/couchdb/blob/78f367cf/share/www/script/jquery-ui-1.8.11.custom.min.js
----------------------------------------------------------------------
diff --git a/share/www/script/jquery-ui-1.8.11.custom.min.js b/share/www/script/jquery-ui-1.8.11.custom.min.js
deleted file mode 100644
index 45b927e..0000000
--- a/share/www/script/jquery-ui-1.8.11.custom.min.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/*!
- * jQuery UI 1.8.11
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI
- */
-(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.11",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
-NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
-"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
-if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
-"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
-d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
-c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
-b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
-;/*!
- * jQuery UI Widget 1.8.11
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Widget
- */
-(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
-a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
-e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
-this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
-widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
-enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
-;/*
- * jQuery UI Position 1.8.11
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Position
- */
-(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
-left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
-k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
-m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
-d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
-a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
-g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
-;/*
- * jQuery UI Autocomplete 1.8.11
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Autocomplete
- *
- * Depends:
- * jquery.ui.core.js
- * jquery.ui.widget.js
- * jquery.ui.position.js
- */
-(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g=
-false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
-a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
-this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
-a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
-d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
-b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
-this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
-this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
-b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
-d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
-"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
-(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
--1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.attr("scrollTop"),c=this.element.height();if(b<0)this.element.attr("scrollTop",g+b);else b>=c&&this.element.attr("scrollTop",g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},
-deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);
-e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,
-g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));
-this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
-;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/couchdb/blob/78f367cf/share/www/script/jquery.couch.js
----------------------------------------------------------------------
diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js
deleted file mode 100644
index ffbad34..0000000
--- a/share/www/script/jquery.couch.js
+++ /dev/null
@@ -1,1079 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-/**
- * @namespace
- * $.couch is used to communicate with a CouchDB server, the server methods can
- * be called directly without creating an instance. Typically all methods are
- * passed an <code>options</code> object which defines a success callback which
- * is called with the data returned from the http request to CouchDB, you can
- * find the other settings that can be used in the <code>options</code> object
- * from <a href="http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings">
- * jQuery.ajax settings</a>
- * <pre><code>$.couch.activeTasks({
- * success: function (data) {
- * console.log(data);
- * }
- * });</code></pre>
- * Outputs (for example):
- * <pre><code>[
- * {
- * "pid" : "<0.11599.0>",
- * "status" : "Copied 0 of 18369 changes (0%)",
- * "task" : "recipes",
- * "type" : "Database Compaction"
- * }
- *]</code></pre>
- */
-(function($) {
-
- $.couch = $.couch || {};
- /** @lends $.couch */
-
- /**
- * @private
- */
- function encodeDocId(docID) {
- var parts = docID.split("/");
- if (parts[0] == "_design") {
- parts.shift();
- return "_design/" + encodeURIComponent(parts.join('/'));
- }
- return encodeURIComponent(docID);
- }
-
- /**
- * @private
- */
-
- var uuidCache = [];
-
- $.extend($.couch, {
- urlPrefix: '',
-
- /**
- * You can obtain a list of active tasks by using the /_active_tasks URL.
- * The result is a JSON array of the currently running tasks, with each task
- * being described with a single object.
- * @see <a href="http://docs.couchdb.org/en/latest/api/server/common.html#
- * active-tasks">docs for /_active_tasks</a>
- * @param {ajaxSettings} options <a href="http://api.jquery.com/jQuery.ajax
- * /#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- activeTasks: function(options) {
- return ajax(
- {url: this.urlPrefix + "/_active_tasks"},
- options,
- "Active task status could not be retrieved"
- );
- },
-
- /**
- * Returns a list of all the databases in the CouchDB instance
- * @see <a href="http://docs.couchdb.org/en/latest/api/server/common.html
- * #all-dbs">docs for /_all_dbs</a>
- * @param {ajaxSettings} options <a href="http://api.jquery.com/jQuery.ajax
- * /#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- allDbs: function(options) {
- return ajax(
- {url: this.urlPrefix + "/_all_dbs"},
- options,
- "An error occurred retrieving the list of all databases"
- );
- },
-
- /**
- * View and edit the CouchDB configuration, called with just the options
- * parameter the entire config is returned, you can be more specific by
- * passing the section and option parameters, if you specify a value that
- * value will be stored in the configuration.
- * @see <a href="http://docs.couchdb.org/en/latest/api/server
- * /configuration.html#config-section-key">docs for /_config</a>
- * @param {ajaxSettings} options
- * <a href="http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings">
- * jQuery ajax settings</a>
- * @param {String} [section] the section of the config
- * @param {String} [option] the particular config option
- * @param {String} [value] value to be set
- */
- config: function(options, section, option, value) {
- var req = {url: this.urlPrefix + "/_config/"};
- if (section) {
- req.url += encodeURIComponent(section) + "/";
- if (option) {
- req.url += encodeURIComponent(option);
- }
- }
- if (value === null) {
- req.type = "DELETE";
- } else if (value !== undefined) {
- req.type = "PUT";
- req.data = toJSON(value);
- req.contentType = "application/json";
- req.processData = false
- }
-
- return ajax(req, options,
- "An error occurred retrieving/updating the server configuration"
- );
- },
-
- /**
- * Returns the session information for the currently logged in user.
- * @see <a href="http://docs.couchdb.org/en/latest/api/server/authn.html
- * #get--_session">docs for GET /_session</a>
- * @param {ajaxSettings} options
- * <a href="http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings">
- * jQuery ajax settings</a>
- */
- session: function(options) {
- options = options || {};
- return ajax({
- type: "GET", url: this.urlPrefix + "/_session",
- beforeSend: function(xhr) {
- xhr.setRequestHeader('Accept', 'application/json');
- },
- complete: function(req) {
- var resp = $.parseJSON(req.responseText);
- if (req.status == 200) {
- if (options.success) options.success(resp);
- } else if (options.error) {
- options.error(req.status, resp.error, resp.reason);
- } else {
- throw "An error occurred getting session info: " + resp.reason;
- }
- }
- });
- },
-
- /**
- * @private
- */
- userDb : function(callback) {
- return $.couch.session({
- success : function(resp) {
- var userDb = $.couch.db(resp.info.authentication_db);
- callback(userDb);
- }
- });
- },
-
- /**
- * Create a new user on the CouchDB server, <code>user_doc</code> is an
- * object with a <code>name</code> field and other information you want
- * to store relating to that user, for example
- * <code>{"name": "daleharvey"}</code>
- * @param {Object} user_doc Users details
- * @param {String} password Users password
- * @param {ajaxSettings} options
- * <a href="http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings">
- * jQuery ajax settings</a>
- */
- signup: function(user_doc, password, options) {
- options = options || {};
- user_doc.password = password;
- user_doc.roles = user_doc.roles || [];
- user_doc.type = "user";
- var user_prefix = "org.couchdb.user:";
- user_doc._id = user_doc._id || user_prefix + user_doc.name;
-
- return $.couch.userDb(function(db) {
- db.saveDoc(user_doc, options);
- });
- },
-
- /**
- * Authenticate against CouchDB, the <code>options</code> parameter is
- *expected to have <code>name</code> and <code>password</code> fields.
- * @see <a href="http://docs.couchdb.org/en/latest/api/server/authn.html
- * #post--_session">docs for POST /_session</a>
- * @param {ajaxSettings} options
- * <a href="http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings">
- * jQuery ajax settings</a>
- */
- login: function(options) {
- options = options || {};
- return $.ajax({
- type: "POST", url: this.urlPrefix + "/_session", dataType: "json",
- data: {name: options.name, password: options.password},
- beforeSend: function(xhr) {
- xhr.setRequestHeader('Accept', 'application/json');
- },
- complete: function(req) {
- var resp = $.parseJSON(req.responseText);
- if (req.status == 200) {
- if (options.success) options.success(resp);
- } else if (options.error) {
- options.error(req.status, resp.error, resp.reason);
- } else {
- throw 'An error occurred logging in: ' + resp.reason;
- }
- }
- });
- },
-
-
- /**
- * Delete your current CouchDB user session
- * @see <a href="http://docs.couchdb.org/en/latest/api/server/authn.html
- * #delete--_session">docs for DELETE /_session</a>
- * @param {ajaxSettings} options
- * <a href="http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings">
- * jQuery ajax settings</a>
- */
- logout: function(options) {
- options = options || {};
- return $.ajax({
- type: "DELETE", url: this.urlPrefix + "/_session", dataType: "json",
- username : "_", password : "_",
- beforeSend: function(xhr) {
- xhr.setRequestHeader('Accept', 'application/json');
- },
- complete: function(req) {
- var resp = $.parseJSON(req.responseText);
- if (req.status == 200) {
- if (options.success) options.success(resp);
- } else if (options.error) {
- options.error(req.status, resp.error, resp.reason);
- } else {
- throw 'An error occurred logging out: ' + resp.reason;
- }
- }
- });
- },
-
- /**
- * @namespace
- * $.couch.db is used to communicate with a specific CouchDB database
- * <pre><code>var $db = $.couch.db("mydatabase");
- *$db.allApps({
- * success: function (data) {
- * ... process data ...
- * }
- *});
- * </code></pre>
- */
- db: function(name, db_opts) {
- db_opts = db_opts || {};
- var rawDocs = {};
- function maybeApplyVersion(doc) {
- if (doc._id && doc._rev && rawDocs[doc._id] &&
- rawDocs[doc._id].rev == doc._rev) {
- // todo: can we use commonjs require here?
- if (typeof Base64 == "undefined") {
- throw 'Base64 support not found.';
- } else {
- doc._attachments = doc._attachments || {};
- doc._attachments["rev-"+doc._rev.split("-")[0]] = {
- content_type :"application/json",
- data : Base64.encode(rawDocs[doc._id].raw)
- };
- return true;
- }
- }
- }
- return /** @lends $.couch.db */{
- name: name,
- uri: this.urlPrefix + "/" + encodeURIComponent(name) + "/",
-
- /**
- * Request compaction of the specified database.
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /compact.html#db-compact">docs for /db/_compact</a>
- * @param {ajaxSettings} options
- * <a href="http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings">
- * jQuery ajax settings</a>
- */
- compact: function(options) {
- $.extend(options, {successStatus: 202});
- return ajax({
- type: "POST", url: this.uri + "_compact",
- data: "", processData: false
- },
- options,
- "The database could not be compacted"
- );
- },
-
- /**
- * Cleans up the cached view output on disk for a given view.
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /compact.html#db-view-cleanup">docs for /db/_view_cleanup</a>
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- viewCleanup: function(options) {
- $.extend(options, {successStatus: 202});
- return ajax({
- type: "POST", url: this.uri + "_view_cleanup",
- data: "", processData: false
- },
- options,
- "The views could not be cleaned up"
- );
- },
-
- /**
- * Compacts the view indexes associated with the specified design
- * document. You can use this in place of the full database compaction
- * if you know a specific set of view indexes have been affected by a
- * recent database change.
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /compact.html#db-compact-design-doc">
- * docs for /db/_compact/design-doc</a>
- * @param {String} groupname Name of design-doc to compact
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- compactView: function(groupname, options) {
- $.extend(options, {successStatus: 202});
- return ajax({
- type: "POST", url: this.uri + "_compact/" + groupname,
- data: "", processData: false
- },
- options,
- "The view could not be compacted"
- );
- },
-
- /**
- * Create a new database
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /common.html#put--db">docs for PUT /db/</a>
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- create: function(options) {
- $.extend(options, {successStatus: 201});
- return ajax({
- type: "PUT", url: this.uri, contentType: "application/json",
- data: "", processData: false
- },
- options,
- "The database could not be created"
- );
- },
-
- /**
- * Deletes the specified database, and all the documents and
- * attachments contained within it.
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /common.html#delete--db">docs for DELETE /db/</a>
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- drop: function(options) {
- return ajax(
- {type: "DELETE", url: this.uri},
- options,
- "The database could not be deleted"
- );
- },
-
- /**
- * Gets information about the specified database.
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /common.html#get--db">docs for GET /db/</a>
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- info: function(options) {
- return ajax(
- {url: this.uri},
- options,
- "Database information could not be retrieved"
- );
- },
-
- /**
- * @namespace
- * $.couch.db.changes provides an API for subscribing to the changes
- * feed
- * <pre><code>var $changes = $.couch.db("mydatabase").changes();
- *$changes.onChange = function (data) {
- * ... process data ...
- * }
- * $changes.stop();
- * </code></pre>
- */
- changes: function(since, options) {
-
- options = options || {};
- // set up the promise object within a closure for this handler
- var timeout = 100, db = this, active = true,
- listeners = [],
- xhr = null,
- promise = /** @lends $.couch.db.changes */ {
- /**
- * Add a listener callback
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /changes.html#db-changes">docs for /db/_changes</a>
- * @param {Function} fun Callback function to run when
- * notified of changes.
- */
- onChange : function(fun) {
- listeners.push(fun);
- },
- /**
- * Stop subscribing to the changes feed
- */
- stop : function() {
- active = false;
- if (xhr){
- xhr.abort();
- }
- }
- };
- // call each listener when there is a change
- function triggerListeners(resp) {
- $.each(listeners, function() {
- this(resp);
- });
- }
- // when there is a change, call any listeners, then check for
- // another change
- options.success = function(resp) {
- timeout = 100;
- if (active) {
- since = resp.last_seq;
- triggerListeners(resp);
- getChangesSince();
- }
- };
- options.error = function() {
- if (active) {
- setTimeout(getChangesSince, timeout);
- timeout = timeout * 2;
- }
- };
- // actually make the changes request
- function getChangesSince() {
- var opts = $.extend({heartbeat : 10 * 1000}, options, {
- feed : "longpoll",
- since : since
- });
- xhr = ajax(
- {url: db.uri + "_changes"+encodeOptions(opts)},
- options,
- "Error connecting to "+db.uri+"/_changes."
- );
- }
- // start the first request
- if (since) {
- getChangesSince();
- } else {
- db.info({
- success : function(info) {
- since = info.update_seq;
- getChangesSince();
- }
- });
- }
- return promise;
- },
-
- /**
- * Fetch all the docs in this db, you can specify an array of keys to
- * fetch by passing the <code>keys</code> field in the
- * <code>options</code>
- * parameter.
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /bulk-api.html#db-all-docs">docs for /db/all_docs/</a>
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- allDocs: function(options) {
- var type = "GET";
- var data = null;
- if (options["keys"]) {
- type = "POST";
- var keys = options["keys"];
- delete options["keys"];
- data = toJSON({ "keys": keys });
- }
- return ajax({
- type: type,
- data: data,
- url: this.uri + "_all_docs" + encodeOptions(options)
- },
- options,
- "An error occurred retrieving a list of all documents"
- );
- },
-
- /**
- * Fetch all the design docs in this db
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- allDesignDocs: function(options) {
- return this.allDocs($.extend(
- {startkey:"_design", endkey:"_design0"}, options));
- },
-
- /**
- * Fetch all the design docs with an index.html, <code>options</code>
- * parameter expects an <code>eachApp</code> field which is a callback
- * called on each app found.
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- allApps: function(options) {
- options = options || {};
- var self = this;
- if (options.eachApp) {
- return this.allDesignDocs({
- success: function(resp) {
- $.each(resp.rows, function() {
- self.openDoc(this.id, {
- success: function(ddoc) {
- var index, appPath, appName = ddoc._id.split('/');
- appName.shift();
- appName = appName.join('/');
- index = ddoc.couchapp && ddoc.couchapp.index;
- if (index) {
- appPath = ['', name, ddoc._id, index].join('/');
- } else if (ddoc._attachments &&
- ddoc._attachments["index.html"]) {
- appPath = ['', name, ddoc._id, "index.html"].join('/');
- }
- if (appPath) options.eachApp(appName, appPath, ddoc);
- }
- });
- });
- }
- });
- } else {
- throw 'Please provide an eachApp function for allApps()';
- }
- },
-
- /**
- * Returns the specified doc from the specified db.
- * @see <a href="http://docs.couchdb.org/en/latest/api/document
- * /common.html#get--db-docid">docs for GET /db/doc</a>
- * @param {String} docId id of document to fetch
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- * @param {ajaxSettings} ajaxOptions <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- openDoc: function(docId, options, ajaxOptions) {
- options = options || {};
- if (db_opts.attachPrevRev || options.attachPrevRev) {
- $.extend(options, {
- beforeSuccess : function(req, doc) {
- rawDocs[doc._id] = {
- rev : doc._rev,
- raw : req.responseText
- };
- }
- });
- } else {
- $.extend(options, {
- beforeSuccess : function(req, doc) {
- if (doc["jquery.couch.attachPrevRev"]) {
- rawDocs[doc._id] = {
- rev : doc._rev,
- raw : req.responseText
- };
- }
- }
- });
- }
- return ajax(
- {url: this.uri + encodeDocId(docId) + encodeOptions(options)},
- options,
- "The document could not be retrieved",
- ajaxOptions
- );
- },
-
- /**
- * Create a new document in the specified database, using the supplied
- * JSON document structure. If the JSON structure includes the _id
- * field, then the document will be created with the specified document
- * ID. If the _id field is not specified, a new unique ID will be
- * generated.
- * @see <a href="http://docs.couchdb.org/en/latest/api/document
- * /common.html#put--db-docid">docs for PUT /db/doc</a>
- * @param {String} doc document to save
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- saveDoc: function(doc, options) {
- options = options || {};
- var db = this;
- var beforeSend = fullCommit(options);
- if (doc._id === undefined) {
- var method = "POST";
- var uri = this.uri;
- } else {
- var method = "PUT";
- var uri = this.uri + encodeDocId(doc._id);
- }
- var versioned = maybeApplyVersion(doc);
- return $.ajax({
- type: method, url: uri + encodeOptions(options),
- contentType: "application/json",
- dataType: "json", data: toJSON(doc),
- beforeSend : beforeSend,
- complete: function(req) {
- var resp = $.parseJSON(req.responseText);
- if (req.status == 200 || req.status == 201 || req.status == 202) {
- doc._id = resp.id;
- doc._rev = resp.rev;
- if (versioned) {
- db.openDoc(doc._id, {
- attachPrevRev : true,
- success : function(d) {
- doc._attachments = d._attachments;
- if (options.success) options.success(resp);
- }
- });
- } else {
- if (options.success) options.success(resp);
- }
- } else if (options.error) {
- options.error(req.status, resp.error, resp.reason);
- } else {
- throw "The document could not be saved: " + resp.reason;
- }
- }
- });
- },
-
- /**
- * Save a list of documents
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /bulk-api.html#db-bulk-docs">docs for /db/_bulk_docs</a>
- * @param {Object[]} docs List of documents to save
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- bulkSave: function(docs, options) {
- var beforeSend = fullCommit(options);
- $.extend(options, {successStatus: 201, beforeSend : beforeSend});
- return ajax({
- type: "POST",
- url: this.uri + "_bulk_docs" + encodeOptions(options),
- contentType: "application/json", data: toJSON(docs)
- },
- options,
- "The documents could not be saved"
- );
- },
-
- /**
- * Deletes the specified document from the database. You must supply
- * the current (latest) revision and <code>id</code> of the document
- * to delete eg <code>removeDoc({_id:"mydoc", _rev: "1-2345"})</code>
- * @see <a href="http://docs.couchdb.org/en/latest/api/document
- * /common.html#delete--db-docid">docs for DELETE /db/doc</a>
- * @param {Object} doc Document to delete
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- removeDoc: function(doc, options) {
- return ajax({
- type: "DELETE",
- url: this.uri +
- encodeDocId(doc._id) +
- encodeOptions({rev: doc._rev})
- },
- options,
- "The document could not be deleted"
- );
- },
-
- /**
- * Remove a set of documents
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /bulk-api.html#db-bulk-docs">docs for /db/_bulk_docs</a>
- * @param {String[]} docs List of document id's to remove
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- bulkRemove: function(docs, options){
- docs.docs = $.each(
- docs.docs, function(i, doc){
- doc._deleted = true;
- }
- );
- $.extend(options, {successStatus: 201});
- return ajax({
- type: "POST",
- url: this.uri + "_bulk_docs" + encodeOptions(options),
- data: toJSON(docs)
- },
- options,
- "The documents could not be deleted"
- );
- },
-
- /**
- * The COPY command (which is non-standard HTTP) copies an existing
- * document to a new or existing document.
- * @see <a href="http://docs.couchdb.org/en/latest/api/document
- * /common.html#copy--db-docid">docs for COPY /db/doc</a>
- * @param {String[]} docId document id to copy
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- * @param {ajaxSettings} ajaxOptions <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- copyDoc: function(docId, options, ajaxOptions) {
- ajaxOptions = $.extend(ajaxOptions, {
- complete: function(req) {
- var resp = $.parseJSON(req.responseText);
- if (req.status == 201) {
- if (options.success) options.success(resp);
- } else if (options.error) {
- options.error(req.status, resp.error, resp.reason);
- } else {
- throw "The document could not be copied: " + resp.reason;
- }
- }
- });
- return ajax({
- type: "COPY",
- url: this.uri + encodeDocId(docId)
- },
- options,
- "The document could not be copied",
- ajaxOptions
- );
- },
-
- /**
- * Creates (and executes) a temporary view based on the view function
- * supplied in the JSON request.
- * @see <a href="http://docs.couchdb.org/en/latest/api/database
- * /temp-views.html#db-temp-view">docs for /db/_temp_view</a>
- * @param {Function} mapFun Map function
- * @param {Function} reduceFun Reduce function
- * @param {String} language Language the map / reduce funs are
- * implemented in
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- query: function(mapFun, reduceFun, language, options) {
- language = language || "javascript";
- if (typeof(mapFun) !== "string") {
- mapFun = mapFun.toSource ? mapFun.toSource()
- : "(" + mapFun.toString() + ")";
- }
- var body = {language: language, map: mapFun};
- if (reduceFun != null) {
- if (typeof(reduceFun) !== "string")
- reduceFun = reduceFun.toSource ? reduceFun.toSource()
- : "(" + reduceFun.toString() + ")";
- body.reduce = reduceFun;
- }
- return ajax({
- type: "POST",
- url: this.uri + "_temp_view" + encodeOptions(options),
- contentType: "application/json", data: toJSON(body)
- },
- options,
- "An error occurred querying the database"
- );
- },
-
- /**
- * Fetch a _list view output, you can specify a list of
- * <code>keys</code> in the options object to receive only those keys.
- * @see <a href="http://docs.couchdb.org/en/latest/api/ddoc/render.html
- * #db-design-design-doc-list-list-name-view-name">
- * docs for /db/_design/design-doc/_list/list/view</a>
- * @param {String} list Listname in the form of ddoc/listname
- * @param {String} view View to run list against
- * @param {Object} options CouchDB <a href="http://docs.couchdb.org/en
- * /latest/api/ddoc/views.html#get--db-_design-ddoc-_view-view">
- * View Options</a>
- * @param {ajaxSettings} ajaxOptions <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- list: function(list, view, options, ajaxOptions) {
- var list = list.split('/');
- var options = options || {};
- var type = 'GET';
- var data = null;
- if (options['keys']) {
- type = 'POST';
- var keys = options['keys'];
- delete options['keys'];
- data = toJSON({'keys': keys });
- }
- return ajax({
- type: type,
- data: data,
- url: this.uri + '_design/' + list[0] +
- '/_list/' + list[1] + '/' + view + encodeOptions(options)
- },
- ajaxOptions, 'An error occurred accessing the list'
- );
- },
-
- /**
- * Executes the specified view-name from the specified design-doc
- * design document, you can specify a list of <code>keys</code>
- * in the options object to receive only those keys.
- * @see <a href="http://docs.couchdb.org/en/latest/api/ddoc/views.html
- * #db-design-design-doc-view-view-name">docs for /db/
- * _design/design-doc/_view/name</a>
- * @param {String} name View to run list against (string should have
- * the design-doc name followed by a slash and the view name)
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- view: function(name, options) {
- var name = name.split('/');
- var options = options || {};
- var type = "GET";
- var data= null;
- if (options["keys"]) {
- type = "POST";
- var keys = options["keys"];
- delete options["keys"];
- data = toJSON({ "keys": keys });
- }
- return ajax({
- type: type,
- data: data,
- url: this.uri + "_design/" + name[0] +
- "/_view/" + name[1] + encodeOptions(options)
- },
- options, "An error occurred accessing the view"
- );
- },
-
- /**
- * Fetch an arbitrary CouchDB database property
- * @param {String} propName Property name to fetch
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- * @param {ajaxSettings} ajaxOptions <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- getDbProperty: function(propName, options, ajaxOptions) {
- return ajax({url: this.uri + propName + encodeOptions(options)},
- options,
- "The property could not be retrieved",
- ajaxOptions
- );
- },
-
- /**
- * Set an arbitrary CouchDB database property
- * @param {String} propName Property name to fetch
- * @param {String} propValue Property value to set
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- * @param {ajaxSettings} ajaxOptions <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- setDbProperty: function(propName, propValue, options, ajaxOptions) {
- return ajax({
- type: "PUT",
- url: this.uri + propName + encodeOptions(options),
- data : JSON.stringify(propValue)
- },
- options,
- "The property could not be updated",
- ajaxOptions
- );
- }
- };
- },
-
- encodeDocId: encodeDocId,
-
- /**
- * Accessing the root of a CouchDB instance returns meta information about
- * the instance. The response is a JSON structure containing information
- * about the server, including a welcome message and the version of the
- * server.
- * @see <a href="http://docs.couchdb.org/en/latest/api/server/common.html
- * #api-server-root">
- * docs for GET /</a>
- * @param {ajaxSettings} options <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- */
- info: function(options) {
- return ajax(
- {url: this.urlPrefix + "/"},
- options,
- "Server information could not be retrieved"
- );
- },
-
- /**
- * Request, configure, or stop, a replication operation.
- * @see <a href="http://docs.couchdb.org/en/latest/api/server/common.html
- * #replicate">docs for POST /_replicate</a>
- * @param {String} source Path or url to source database
- * @param {String} target Path or url to target database
- * @param {ajaxSettings} ajaxOptions <a href="http://api.jquery.com/
- * jQuery.ajax/#jQuery-ajax-settings">jQuery ajax settings</a>
- * @param {Object} repOpts Additional replication options
- */
- replicate: function(source, target, ajaxOptions, repOpts) {
- repOpts = $.extend({source: source, target: target}, repOpts);
- if (repOpts.continuous && !repOpts.cancel) {
- ajaxOptions.successStatus = 202;
- }
- return ajax({
- type: "POST", url: this.urlPrefix + "/_replicate",
- data: JSON.stringify(repOpts),
- contentType: "application/json"
- },
- ajaxOptions,
- "Replication failed"
- );
- },
-
- /**
- * Fetch a new UUID
- * @see <a href="http://docs.couchdb.org/en/latest/api/server/common.html
- * #uuids">docs for /_uuids</a>
- * @param {Integer} cacheNum Number of uuids to keep cached for future use
- */
- newUUID: function(cacheNum) {
- if (cacheNum === undefined) {
- cacheNum = 1;
- }
- if (!uuidCache.length) {
- ajax({url: this.urlPrefix + "/_uuids", data: {count: cacheNum}, async:
- false}, {
- success: function(resp) {
- uuidCache = resp.uuids;
- }
- },
- "Failed to retrieve UUID batch."
- );
- }
- return uuidCache.shift();
- }
- });
-
- /**
- * @private
- */
- function ajax(obj, options, errorMessage, ajaxOptions) {
- var timeStart;
- var defaultAjaxOpts = {
- contentType: "application/json",
- headers:{"Accept": "application/json"}
- };
-
- options = $.extend({successStatus: 200}, options);
- ajaxOptions = $.extend(defaultAjaxOpts, ajaxOptions);
- errorMessage = errorMessage || "Unknown error";
- timeStart = (new Date()).getTime();
- return $.ajax($.extend($.extend({
- type: "GET", dataType: "json", cache : maybeUseCache(),
- beforeSend: function(xhr){
- if(ajaxOptions && ajaxOptions.headers){
- for (var header in ajaxOptions.headers){
- xhr.setRequestHeader(header, ajaxOptions.headers[header]);
- }
- }
- },
- complete: function(req) {
- var reqDuration = (new Date()).getTime() - timeStart;
- try {
- var resp = $.parseJSON(req.responseText);
- } catch(e) {
- if (options.error) {
- options.error(req.status, req, e);
- } else {
- throw errorMessage + ': ' + e;
- }
- return;
- }
- if (options.ajaxStart) {
- options.ajaxStart(resp);
- }
- if (req.status == options.successStatus) {
- if (options.beforeSuccess) options.beforeSuccess(req, resp, reqDuration);
- if (options.success) options.success(resp, reqDuration);
- } else if (options.error) {
- options.error(req.status, resp && resp.error ||
- errorMessage, resp && resp.reason || "no response",
- reqDuration);
- } else {
- throw errorMessage + ": " + resp.reason;
- }
- }
- }, obj), ajaxOptions));
- }
-
- /**
- * @private
- */
- function fullCommit(options) {
- var options = options || {};
- if (typeof options.ensure_full_commit !== "undefined") {
- var commit = options.ensure_full_commit;
- delete options.ensure_full_commit;
- return function(xhr) {
- xhr.setRequestHeader('Accept', 'application/json');
- xhr.setRequestHeader("X-Couch-Full-Commit", commit.toString());
- };
- }
- }
-
- /**
- * @private
- */
- // Convert a options object to an url query string.
- // ex: {key:'value',key2:'value2'} becomes '?key="value"&key2="value2"'
- function encodeOptions(options) {
- var buf = [];
- if (typeof(options) === "object" && options !== null) {
- for (var name in options) {
- if ($.inArray(name,
- ["error", "success", "beforeSuccess", "ajaxStart"]) >= 0)
- continue;
- var value = options[name];
- if ($.inArray(name, ["key", "startkey", "endkey"]) >= 0) {
- value = toJSON(value);
- }
- buf.push(encodeURIComponent(name) + "=" + encodeURIComponent(value));
- }
- }
- return buf.length ? "?" + buf.join("&") : "";
- }
-
- /**
- * @private
- */
- function toJSON(obj) {
- return obj !== null ? JSON.stringify(obj) : null;
- }
-
- /**
- * @private
- */
- function maybeUseCache() {
- if (!navigator){
- return true;
- }
- else if (/(MSIE|Trident)/.test(navigator.userAgent)){
- return false;
- }
- return true;
- }
-
-})(jQuery);
http://git-wip-us.apache.org/repos/asf/couchdb/blob/78f367cf/share/www/script/jquery.dialog.js
----------------------------------------------------------------------
diff --git a/share/www/script/jquery.dialog.js b/share/www/script/jquery.dialog.js
deleted file mode 100644
index 02c0c49..0000000
--- a/share/www/script/jquery.dialog.js
+++ /dev/null
@@ -1,96 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-(function($) {
-
- $.fn.centerBox = function() {
- return this.each(function() {
- var s = this.style;
- s.left = (($(window).width() - $(this).width()) / 2) + "px";
- s.top = (($(window).height() - $(this).height()) / 2) + "px";
- });
- }
-
- $.showDialog = function(url, options) {
- options = options || {};
- options.load = options.load || function() {};
- options.cancel = options.cancel || function() {};
- options.validate = options.validate || function() { return true };
- options.submit = options.submit || function() {};
-
- var overlay = $('<div id="overlay" style="z-index:1001"></div>')
- .css("opacity", "0");
- var dialog = $('<div id="dialog" style="z-index:1002;position:fixed;display:none;"></div>');
- if ($.browser.msie) {
- var frame = $('<iframe id="overlay-frame" style="z-index:1000;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="javascript:false"></iframe>')
- .css("opacity", "0").appendTo(document.body);
- if (parseInt($.browser.version)<7) {
- dialog.css("position", "absolute");
- overlay.css("position", "absolute");
- $("html,body").css({width: "100%", height: "100%"});
- }
- }
- overlay.appendTo(document.body).fadeTo(100, 0.6);
- dialog.appendTo(document.body).addClass("loading").centerBox().fadeIn(400);
-
- $(document).keydown(function(e) {
- if (e.keyCode == 27) dismiss(); // dismiss on escape key
- });
- function dismiss() {
- dialog.fadeOut("fast", function() {
- $("#dialog, #overlay, #overlay-frame").remove();
- });
- $(document).unbind("keydown");
- }
- overlay.click(function() { dismiss(); });
-
- function showError(name, message) {
- var input = dialog.find(":input[name=" + name + "]");
- input.addClass("error").next("div.error").remove();
- $('<div class="error"></div>').text(message).insertAfter(input);
- }
-
- $.get(url, function(html) {
- $(html).appendTo(dialog);
- dialog.removeClass("loading").addClass("loaded").centerBox().each(function() {
- options.load(dialog.children()[0]);
- $(":input:first", dialog).each(function() { this.focus() });
- $("button.cancel", dialog).click(function() { // dismiss on cancel
- dismiss();
- options.cancel();
- });
- $("form", dialog).submit(function(e) { // invoke callback on submit
- e.preventDefault();
- dialog.find("div.error").remove().end().find(".error").removeClass("error");
- var data = {};
- $.each($("form :input", dialog).serializeArray(), function(i, field) {
- data[field.name] = field.value;
- });
- $("form :file", dialog).each(function() {
- data[this.name] = this.value; // file inputs need special handling
- });
- options.submit(data, function callback(errors) {
- if ($.isEmptyObject(errors)) {
- dismiss();
- } else {
- for (var name in errors) {
- showError(name, errors[name]);
- }
- }
- });
- return false;
- });
- });
- });
- }
-
-})(jQuery);
http://git-wip-us.apache.org/repos/asf/couchdb/blob/78f367cf/share/www/script/jquery.editinline.js
----------------------------------------------------------------------
diff --git a/share/www/script/jquery.editinline.js b/share/www/script/jquery.editinline.js
deleted file mode 100644
index b48607d..0000000
--- a/share/www/script/jquery.editinline.js
+++ /dev/null
@@ -1,114 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-(function($) {
-
- function startEditing(elem, options) {
- var editable = $(elem);
- var origHtml = editable.html();
- var origText = options.populate($.trim(editable.text()));
-
- if (!options.begin.apply(elem, [origText])) {
- return;
- }
-
- var input = options.createInput.apply(elem, [origText])
- .addClass("editinline").val(origText)
- .dblclick(function() { return false; })
- .keydown(function(evt) {
- switch (evt.keyCode) {
- case 13: { // return
- if (!input.is("textarea")) applyChange(evt.keyCode);
- break;
- }
- case 27: { // escape
- cancelChange(evt.keyCode);
- break;
- }
- case 9: { // tab
- if (!input.is("textarea")) {
- applyChange(evt.keyCode);
- return false;
- }
- }
- }
- });
- if (options.acceptOnBlur) {
- input.blur(function() {
- return applyChange();
- });
- }
-
- function applyChange(keyCode) {
- var newText = input.val();
- if (newText == origText) {
- cancelChange(keyCode);
- return true;
- }
- if ((!options.allowEmpty && !newText.length) ||
- !options.validate.apply(elem, [newText, origText])) {
- input.addClass("invalid");
- return false;
- }
- input.remove();
- tools.remove();
- options.accept.apply(elem, [newText, origText]);
- editable.removeClass("editinline-container");
- options.end.apply(elem, [keyCode]);
- return true;
- }
-
- function cancelChange(keyCode) {
- options.cancel.apply(elem, [origText]);
- editable.html(origHtml).removeClass("editinline-container");
- options.end.apply(elem, [keyCode]);
- }
-
- var tools = $("<span class='editinline-tools'></span>");
- $("<button type='button' class='apply'></button>")
- .text(options.acceptLabel).click(applyChange).appendTo(tools);
- $("<button type='button' class='cancel'></button>")
- .text(options.cancelLabel).click(cancelChange).appendTo(tools)
-
- editable.html("").append(tools).append(input)
- .addClass("editinline-container");
- options.prepareInput.apply(elem, [input[0]]);
- input.each(function() { this.focus(); this.select(); });
- }
-
- $.fn.makeEditable = function(options) {
- options = $.extend({
- allowEmpty: true,
- acceptLabel: "",
- cancelLabel: "",
- toolTip: "Double click to edit",
- acceptOnBlur: true,
-
- // callbacks
- begin: function() { return true },
- accept: function(newValue, oldValue) {},
- cancel: function(oldValue) {},
- createInput: function(value) { return $("<input type='text'>") },
- prepareInput: function(input) {},
- end: function(keyCode) {},
- populate: function(value) { return value },
- validate: function() { return true }
- }, options || {});
-
- return this.each(function() {
- $(this).attr("title", options.toolTip).dblclick(function() {
- startEditing(this, options);
- });
- });
- }
-
-})(jQuery);