[vendor][s]: clear out unused vendor libraries (couch2, microevent, sammy).
* traverse and hotkeys also are not currently used but they may be used again in future so left in.
This commit is contained in:
85
vendor/jquery.couch2.js
vendored
85
vendor/jquery.couch2.js
vendored
@@ -1,85 +0,0 @@
|
|||||||
(function($) {
|
|
||||||
|
|
||||||
window.couch = {};
|
|
||||||
|
|
||||||
var defaults = {
|
|
||||||
headers: {"Accept":"application/json"},
|
|
||||||
dataType:"json",
|
|
||||||
contentType: "application/json",
|
|
||||||
type: "GET",
|
|
||||||
url: "/"
|
|
||||||
};
|
|
||||||
|
|
||||||
couch.errors = {
|
|
||||||
forbidden: "You aren't allowed to do that."
|
|
||||||
}
|
|
||||||
|
|
||||||
couch.responseError = function(response) {
|
|
||||||
if(_.isArray(response) && (response.length > 0) ) response = response[0];
|
|
||||||
if (response.error) return couch.errors[response.error];
|
|
||||||
}
|
|
||||||
|
|
||||||
couch.request = function(opts) {
|
|
||||||
var ajaxOpts = $.extend({}, defaults, opts)
|
|
||||||
, dfd = $.Deferred()
|
|
||||||
;
|
|
||||||
|
|
||||||
$.ajax(ajaxOpts).then(
|
|
||||||
function(successResponse) {
|
|
||||||
var error = couch.responseError(successResponse);
|
|
||||||
if (error) app.emitter.emit(error, 'error');
|
|
||||||
dfd.resolve(successResponse);
|
|
||||||
},
|
|
||||||
function(errorResponse) {
|
|
||||||
app.emitter.emit("Fatal XHR Error", 'error');
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return dfd.promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
couch.get = function(url) {
|
|
||||||
return couch.request({url:url, type:'GET'});
|
|
||||||
};
|
|
||||||
|
|
||||||
couch.login = function(credentials) {
|
|
||||||
return couch.request({
|
|
||||||
url: "/_session",
|
|
||||||
type: 'POST',
|
|
||||||
data: JSON.stringify({name: credentials.username, password: credentials.password})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
couch.logout = function() {
|
|
||||||
return couch.request({url: "/_session", type: 'DELETE'});
|
|
||||||
}
|
|
||||||
|
|
||||||
couch.session = function() {
|
|
||||||
return couch.request({url: "/_session"});
|
|
||||||
}
|
|
||||||
|
|
||||||
couch.db = function(name, couchRoot) {
|
|
||||||
if(!couchRoot) couchRoot = "";
|
|
||||||
return {
|
|
||||||
name: name,
|
|
||||||
uri: couchRoot + "/" + encodeURIComponent(name) + "/",
|
|
||||||
|
|
||||||
get: function(id) {
|
|
||||||
return couch.request({url:this.uri + id, type:"GET"});
|
|
||||||
},
|
|
||||||
|
|
||||||
put: function(id, data) {
|
|
||||||
return couch.request({url:this.uri + id, type:"PUT", data:data});
|
|
||||||
},
|
|
||||||
|
|
||||||
designDocs: function(opts) {
|
|
||||||
return couch.request($.extend(defaults, {
|
|
||||||
url: this.uri + "_all_docs",
|
|
||||||
data: {startkey:'"_design/"', endkey:'"_design0"', include_docs:true}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
})(jQuery);
|
|
||||||
50
vendor/microevent.js
vendored
50
vendor/microevent.js
vendored
@@ -1,50 +0,0 @@
|
|||||||
/**
|
|
||||||
* MicroEvent - to make any js object an event emitter (server or browser)
|
|
||||||
*
|
|
||||||
* - pure javascript - server compatible, browser compatible
|
|
||||||
* - dont rely on the browser doms
|
|
||||||
* - super simple - you get it immediatly, no mistery, no magic involved
|
|
||||||
*
|
|
||||||
* - create a MicroEventDebug with goodies to debug
|
|
||||||
* - make it safer to use
|
|
||||||
*/
|
|
||||||
|
|
||||||
var MicroEvent = function(){}
|
|
||||||
MicroEvent.prototype = {
|
|
||||||
on : function(event, fct){
|
|
||||||
this._events = this._events || {};
|
|
||||||
this._events[event] = this._events[event] || [];
|
|
||||||
this._events[event].push(fct);
|
|
||||||
},
|
|
||||||
clear : function(event, fct){
|
|
||||||
this._events = this._events || {};
|
|
||||||
if( event in this._events === false ) return;
|
|
||||||
this._events[event].splice(this._events[event].indexOf(fct), 1);
|
|
||||||
},
|
|
||||||
trigger : function(event /* , args... */){
|
|
||||||
this._events = this._events || {};
|
|
||||||
if( event in this._events === false ) return;
|
|
||||||
for(var i = 0; i < this._events[event].length; i++){
|
|
||||||
this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* mixin will delegate all MicroEvent.js function in the destination object
|
|
||||||
*
|
|
||||||
* - require('MicroEvent').mixin(Foobar) will make Foobar able to use MicroEvent
|
|
||||||
*
|
|
||||||
* @param {Object} the object which will support MicroEvent
|
|
||||||
*/
|
|
||||||
MicroEvent.mixin = function(destObject){
|
|
||||||
var props = ['on', 'clear', 'trigger'];
|
|
||||||
for(var i = 0; i < props.length; i ++){
|
|
||||||
destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// export in common js
|
|
||||||
if( typeof module !== "undefined" && ('exports' in module)){
|
|
||||||
module.exports = MicroEvent
|
|
||||||
}
|
|
||||||
5
vendor/sammy-0.6.3.min.js
vendored
5
vendor/sammy-0.6.3.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user