Remove unused Javascript functions
})();
// }}}
- /***************************************************
- apis(...) - Combine multiple AJAX calls
-
- ***************************************************/
- exported.apis = (function () { // {{{
- return function (options) {
- var failed = false;
- var nwait = 0;
- var data = {};
-
- var e = 'An unknown error has occurred.';
- if (typeof(options.error) === 'string') {
- e = options.error;
- delete options.error;
- }
-
- if (!('error' in options)) {
- options.error = function (xhr) {
- if (xhr.status == 0) {
- return; /* jquery was aborted; no point in erroring... */
- }
- $('#main').template('error', {
- http: xhr.status + ' ' + xhr.statusText,
- response: xhr.responseText,
- message: e,
- });
- };
- }
-
- var done = function () {
- if (failed) {
- options.error(failed); /* failed is an xhr */
- } else {
- options.success(data);
- }
- };
-
- for (var key in options.multiplex) {
- (function (k) {
- nwait++;
- api({
- type: options.multiplex[k].type,
- url: options.multiplex[k].url.replace(/^\+/, options.base),
- data: options.multiplex[k].data,
- error: function (xhr) { failed = xhr; },
- success: function (dat) { data[k] = dat; },
- complete: function () {
- nwait--; if (nwait <= 0) { done() }
- }
- }, nwait > 1);
- })(key);
- }
- };
- })();
- // }}}
-
-
- /***************************************************
- website() - Return the base URL of this SHIELD, per document.location
-
- ***************************************************/
- exported.website = function () { // {{{
- return document.location.toString().replace(/#.*/, '').replace(/\/$/, '');
- }
- // }}}
-
/***************************************************
$(...).serializeObject()
/***************************************************
$(...).userlookup(sel) - wire up a user lookup field
-
-
***************************************************/
$.fn.userlookup = function (sel, opts) { // {{{
opts = $.extend({}, {
