// 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. // Usage: The passed in function is called when the page is ready. // CouchApp passes in the app object, which takes care of linking to // the proper database, and provides access to the CouchApp helpers. // $.couch.app(function(app) { // app.db.view(...) // ... // }); (function($) { function Design(db, name, code) { this.doc_id = "_design/"+name; if (code) { this.code_path = this.doc_id + "/" + code; } else { this.code_path = this.doc_id; } this.view = function(view, opts) { db.view(name+'/'+view, opts); }; this.list = function(list, view, opts) { db.list(name+'/'+list, view, opts); }; } function docForm() { alert("docForm has been moved to vendor/couchapp/lib/docForm.js, use app.require to load") }; function resolveModule(path, names, parents, current) { parents = parents || []; if (names.length === 0) { if (typeof current != "string") { throw ["error","invalid_require_path", 'Must require a JavaScript string, not: '+(typeof current)]; } return [current, parents]; } var n = names.shift(); if (n == '..') { parents.pop(); var pp = parents.pop(); if (!pp) { throw ["error", "invalid_require_path", path]; } return resolveModule(path, names, parents, pp); } else if (n == '.') { var p = parents.pop(); if (!p) { throw ["error", "invalid_require_path", path]; } return resolveModule(path, names, parents, p); } else { parents = []; } if (!current[n]) { throw ["error", "invalid_require_path", path]; } parents.push(current); return resolveModule(path, names, parents, current[n]); } function makeRequire(ddoc) { var moduleCache = []; function getCachedModule(name, parents) { var key, i, len = moduleCache.length; for (i=0;i>> 0; if (typeof fun != "function") throw new TypeError(); var thisp = arguments[1]; for (var i = 0; i < len; i++) { if (i in this) fun.call(thisp, this[i], i, this); } }; } if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; }