From 282b96ddd9a84b740788c2358ec0f5fedafb7cc6 Mon Sep 17 00:00:00 2001 From: Noah Slater Date: Mon, 6 Jul 2009 00:33:50 +0000 Subject: trimmed trailing whitespace git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791350 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/couch.js | 52 ++++----- share/www/script/couch_test_runner.js | 2 +- share/www/script/futon.browse.js | 14 +-- share/www/script/jquery.couch.js | 4 +- share/www/script/jquery.form.js | 52 ++++----- share/www/script/jquery.js | 148 ++++++++++++------------- share/www/script/test/all_docs.js | 18 +-- share/www/script/test/attachment_names.js | 54 ++++----- share/www/script/test/attachment_paths.js | 12 +- share/www/script/test/attachment_views.js | 2 +- share/www/script/test/attachments.js | 30 ++--- share/www/script/test/basics.js | 16 +-- share/www/script/test/batch_save.js | 14 +-- share/www/script/test/bulk_docs.js | 8 +- share/www/script/test/changes.js | 62 +++++------ share/www/script/test/compact.js | 4 +- share/www/script/test/conflicts.js | 2 +- share/www/script/test/delayed_commits.js | 58 +++++----- share/www/script/test/design_docs.js | 12 +- share/www/script/test/design_options.js | 4 +- share/www/script/test/design_paths.js | 2 +- share/www/script/test/etags_views.js | 10 +- share/www/script/test/invalid_docids.js | 2 +- share/www/script/test/list_views.js | 32 +++--- share/www/script/test/purge.js | 26 ++--- share/www/script/test/reduce.js | 6 +- share/www/script/test/reduce_builtin.js | 12 +- share/www/script/test/reduce_false.js | 2 +- share/www/script/test/replication.js | 58 +++++----- share/www/script/test/rev_stemming.js | 36 +++--- share/www/script/test/security_validation.js | 54 ++++----- share/www/script/test/show_documents.js | 32 +++--- share/www/script/test/stats.js | 29 +++-- share/www/script/test/uuids.js | 12 +- share/www/script/test/view_collation.js | 10 +- share/www/script/test/view_errors.js | 32 +++--- share/www/script/test/view_multi_key_design.js | 2 +- share/www/script/test/view_multi_key_temp.js | 2 +- share/www/script/test/view_offsets.js | 10 +- share/www/script/test/view_pagination.js | 4 +- 40 files changed, 470 insertions(+), 471 deletions(-) (limited to 'share/www/script') diff --git a/share/www/script/couch.js b/share/www/script/couch.js index c4c1ae9f..1f6a7444 100644 --- a/share/www/script/couch.js +++ b/share/www/script/couch.js @@ -16,11 +16,11 @@ function CouchDB(name, httpHeaders) { this.name = name; this.uri = "/" + encodeURIComponent(name) + "/"; - + // The XMLHttpRequest object from the most recent request. Callers can // use this to check result http status and headers. this.last_req = null; - + this.request = function(method, uri, requestOptions) { requestOptions = requestOptions || {} requestOptions.headers = combine(requestOptions.headers, httpHeaders) @@ -48,7 +48,7 @@ function CouchDB(name, httpHeaders) { if (doc._id == undefined) doc._id = CouchDB.newUuids(1)[0]; - this.last_req = this.request("PUT", this.uri + + this.last_req = this.request("PUT", this.uri + encodeURIComponent(doc._id) + encodeOptions(options), {body: JSON.stringify(doc)}); CouchDB.maybeThrowError(this.last_req); @@ -84,7 +84,7 @@ function CouchDB(name, httpHeaders) { doc._rev = result.rev; //record rev in input document return result; } - + this.bulkSave = function(docs, options) { // first prepoulate the UUIDs for new documents var newCount = 0 @@ -119,7 +119,7 @@ function CouchDB(name, httpHeaders) { return results; } } - + this.ensureFullCommit = function() { this.last_req = this.request("POST", this.uri + "_ensure_full_commit"); CouchDB.maybeThrowError(this.last_req); @@ -130,7 +130,7 @@ function CouchDB(name, httpHeaders) { this.query = function(mapFun, reduceFun, options, keys) { var body = {language: "javascript"}; if(keys) { - body.keys = keys ; + body.keys = keys ; } if (typeof(mapFun) != "string") mapFun = mapFun.toSource ? mapFun.toSource() : "(" + mapFun.toString() + ")"; @@ -154,15 +154,15 @@ function CouchDB(name, httpHeaders) { this.view = function(viewname, options, keys) { var viewParts = viewname.split('/'); - var viewPath = this.uri + "_design/" + viewParts[0] + "/_view/" + var viewPath = this.uri + "_design/" + viewParts[0] + "/_view/" + viewParts[1] + encodeOptions(options); if(!keys) { - this.last_req = this.request("GET", viewPath); + this.last_req = this.request("GET", viewPath); } else { this.last_req = this.request("POST", viewPath, { headers: {"Content-Type": "application/json"}, body: JSON.stringify({keys:keys}) - }); + }); } if (this.last_req.status == 404) return null; @@ -183,7 +183,7 @@ function CouchDB(name, httpHeaders) { CouchDB.maybeThrowError(this.last_req); return JSON.parse(this.last_req.responseText); } - + this.viewCleanup = function() { this.last_req = this.request("POST", this.uri + "_view_cleanup"); CouchDB.maybeThrowError(this.last_req); @@ -192,17 +192,17 @@ function CouchDB(name, httpHeaders) { this.allDocs = function(options,keys) { if(!keys) { - this.last_req = this.request("GET", this.uri + "_all_docs" + encodeOptions(options)); + this.last_req = this.request("GET", this.uri + "_all_docs" + encodeOptions(options)); } else { this.last_req = this.request("POST", this.uri + "_all_docs" + encodeOptions(options), { headers: {"Content-Type": "application/json"}, body: JSON.stringify({keys:keys}) - }); + }); } CouchDB.maybeThrowError(this.last_req); return JSON.parse(this.last_req.responseText); } - + this.designDocs = function() { return this.allDocs({startkey:"_design", endkey:"_design0"}); }; @@ -210,12 +210,12 @@ function CouchDB(name, httpHeaders) { this.allDocsBySeq = function(options,keys) { var req = null; if(!keys) { - req = this.request("GET", this.uri + "_all_docs_by_seq" + encodeOptions(options)); + req = this.request("GET", this.uri + "_all_docs_by_seq" + encodeOptions(options)); } else { req = this.request("POST", this.uri + "_all_docs_by_seq" + encodeOptions(options), { headers: {"Content-Type": "application/json"}, body: JSON.stringify({keys:keys}) - }); + }); } CouchDB.maybeThrowError(req); return JSON.parse(req.responseText); @@ -226,7 +226,7 @@ function CouchDB(name, httpHeaders) { CouchDB.maybeThrowError(this.last_req); return JSON.parse(this.last_req.responseText); } - + this.setDbProperty = function(propId, propValue) { this.last_req = this.request("PUT", this.uri + propId,{ body:JSON.stringify(propValue) @@ -234,13 +234,13 @@ function CouchDB(name, httpHeaders) { CouchDB.maybeThrowError(this.last_req); return JSON.parse(this.last_req.responseText); } - + this.getDbProperty = function(propId) { this.last_req = this.request("GET", this.uri + propId); CouchDB.maybeThrowError(this.last_req); return JSON.parse(this.last_req.responseText); } - + this.setAdmins = function(adminsArray) { this.last_req = this.request("PUT", this.uri + "_admins",{ body:JSON.stringify(adminsArray) @@ -248,13 +248,13 @@ function CouchDB(name, httpHeaders) { CouchDB.maybeThrowError(this.last_req); return JSON.parse(this.last_req.responseText); } - + this.getAdmins = function() { this.last_req = this.request("GET", this.uri + "_admins"); CouchDB.maybeThrowError(this.last_req); return JSON.parse(this.last_req.responseText); } - + // Convert a options object to an url query string. // ex: {key:'value',key2:'value2'} becomes '?key="value"&key2="value2"' function encodeOptions(options) { @@ -278,26 +278,26 @@ function CouchDB(name, httpHeaders) { function toJSON(obj) { return obj !== null ? JSON.stringify(obj) : null; } - + function combine(object1, object2) { if (!object2) return object1; if (!object1) return object2; - + for (var name in object2) object1[name] = object2[name]; - + return object1; } - - + + } // this is the XMLHttpRequest object from last request made by the following // CouchDB.* functions (except for calls to request itself). // Use this from callers to check HTTP status or header values of requests. -CouchDB.last_req = null; +CouchDB.last_req = null; CouchDB.allDbs = function() { diff --git a/share/www/script/couch_test_runner.js b/share/www/script/couch_test_runner.js index c396cd16..ef7d42aa 100644 --- a/share/www/script/couch_test_runner.js +++ b/share/www/script/couch_test_runner.js @@ -12,7 +12,7 @@ // *********************** Test Framework of Sorts ************************* // -function loadScript(url) { +function loadScript(url) { if (typeof document != "undefined") document.write(''); }; diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js index e518c9ab..37afe1d4 100644 --- a/share/www/script/futon.browse.js +++ b/share/www/script/futon.browse.js @@ -49,7 +49,7 @@ var dbsOnPage = dbs.slice(offset, offset + maxPerPage); $.each(dbsOnPage, function(idx, dbName) { - $("#databases tbody.content").append("" + + $("#databases tbody.content").append("" + "" + dbName + "" + "" + @@ -504,7 +504,7 @@ resp.rows = resp.rows.reverse(); } var has_reduce_prev = resp.total_rows === undefined && (descending_reverse ? resp.rows.length > per_page : options.startkey !== undefined); - if (resp.rows !== null && (has_reduce_prev || (descending_reverse ? + if (resp.rows !== null && (has_reduce_prev || (descending_reverse ? (resp.total_rows - resp.offset > per_page) : (resp.offset > 0)))) { $("#paging a.prev").attr("href", "#" + (resp.offset - per_page)).click(function() { @@ -527,8 +527,8 @@ $("#paging a.prev").removeAttr("href"); } var has_reduce_next = resp.total_rows === undefined && (descending_reverse ? options.startkey !== undefined : resp.rows.length > per_page); - if (resp.rows !== null && (has_reduce_next || (descending_reverse ? - (resp.offset - resp.total_rows < per_page) : + if (resp.rows !== null && (has_reduce_next || (descending_reverse ? + (resp.offset - resp.total_rows < per_page) : (resp.total_rows - resp.offset > per_page)))) { $("#paging a.next").attr("href", "#" + (resp.offset + per_page)).click(function() { var opt = { @@ -967,16 +967,16 @@ } function _renderAttachmentItem(name, attachment) { - var attachmentHref = db.uri + encodeDocId(docId) + var attachmentHref = db.uri + encodeDocId(docId) + "/" + encodeAttachment(name); var li = $("
  • "); $("").text(name) .attr("href", attachmentHref) .wrapInner("").appendTo(li); - $("()").text("" + $.futon.formatSize(attachment.length) + + $("()").text("" + $.futon.formatSize(attachment.length) + ", " + attachment.content_type).addClass("info").appendTo(li); if (name == "tests.js") { - li.find('span.info').append(', open in test runner'); } _initAttachmentItem(name, attachment, li); diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index 559fafd4..3c629e1d 100644 --- a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -92,7 +92,7 @@ $.ajax({ type: "POST", url: this.uri + "_compact", contentType: "application/json", - dataType: "json", data: "", processData: false, + dataType: "json", data: "", processData: false, complete: function(req) { var resp = $.httpData(req, "json"); if (req.status == 202) { @@ -200,7 +200,7 @@ }); }); } - }); + }); } else { alert("please provide an eachApp function for allApps()"); } diff --git a/share/www/script/jquery.form.js b/share/www/script/jquery.form.js index 91eb688d..e35ef0ef 100644 --- a/share/www/script/jquery.form.js +++ b/share/www/script/jquery.form.js @@ -13,7 +13,7 @@ ;(function($) { /* - Usage Note: + Usage Note: ----------- Do not use both ajaxSubmit and ajaxForm on the same form. These functions are intended to be exclusive. Use ajaxSubmit if you want @@ -36,13 +36,13 @@ target: '#output' }); }); - + When using ajaxForm, the ajaxSubmit function will be invoked for you - at the appropriate time. + at the appropriate time. */ /** - * ajaxSubmit() provides a mechanism for immediately submitting + * ajaxSubmit() provides a mechanism for immediately submitting * an HTML form using AJAX. */ $.fn.ajaxSubmit = function(options) { @@ -73,8 +73,8 @@ $.fn.ajaxSubmit = function(options) { if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { log('ajaxSubmit: submit aborted via beforeSerialize callback'); return this; - } - + } + var a = this.formToArray(options.semantic); if (options.data) { options.extraData = options.data; @@ -82,7 +82,7 @@ $.fn.ajaxSubmit = function(options) { if(options.data[n] instanceof Array) { for (var k in options.data[n]) a.push( { name: n, value: options.data[n][k] } ) - } + } else a.push( { name: n, value: options.data[n] } ); } @@ -92,14 +92,14 @@ $.fn.ajaxSubmit = function(options) { if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { log('ajaxSubmit: submit aborted via beforeSubmit callback'); return this; - } + } // fire vetoable 'validate' event this.trigger('form-submit-validate', [a, this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); return this; - } + } var q = $.param(a); @@ -137,7 +137,7 @@ $.fn.ajaxSubmit = function(options) { found = true; // options.iframe allows user to force iframe mode - if (options.iframe || found) { + if (options.iframe || found) { // hack to fix Safari hang (thanks to Tim Molendijk for this) // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d if ($.browser.safari && options.closeKeepAlive) @@ -156,12 +156,12 @@ $.fn.ajaxSubmit = function(options) { // private function for handling file uploads (hat tip to YAHOO!) function fileUpload() { var form = $form[0]; - + if ($(':input[name=submit]', form).length) { alert('Error: Form elements must not be named "submit".'); return; } - + var opts = $.extend({}, $.ajaxSettings, options); var s = jQuery.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts); @@ -169,7 +169,7 @@ $.fn.ajaxSubmit = function(options) { var $io = $('