Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get_ontology(id) {
return new Promise((resolve, reject) => {
/**
* @see http://www.cropontology.org/api
*/
$.ajax({
type: "GET",
url: "http://www.cropontology.org/get-ontology-roots/" + id,
async: true,
crossDomain: true,
dataType: "json",
success: (data) => {
resolve(data[0]);
},
error: (jqXHR, textStatus, errorThrown) => {
reject(errorThrown);
}
});
get_ontology_upload_url() {
return new Promise((resolve, reject) => {
$.ajax({
type: "GET",
url: "http://www.cropontology.org/obo-upload-url",
async: true,
crossDomain: true,
dataType: "json",
success: (data) => {
resolve(data);
},
error: (jqXHR, textStatus, errorThrown) => {
reject(errorThrown);
}
});
});
}
API.fire(this, 'onClose')
this.closing = true
if (this.options.animation.close === null || this.options.animation.close === false) {
this.promises.close = new Promise(resolve => {
resolve()
})
} else if (typeof this.options.animation.close === 'function') {
this.promises.close = new Promise(
this.options.animation.close.bind(this)
)
} else {
Utils.addClass(this.barDom, this.options.animation.close)
this.promises.close = new Promise(resolve => {
Utils.addListener(this.barDom, Utils.animationEndEvents, () => {
if (this.options.force) {
Utils.remove(this.barDom)
} else {
API.ghostFix(this)
}
resolve()
})
})
}
this.promises.close.then(() => {
API.closeFlow(this)
API.handleModalClose(this)
})
get_community_website_feed() {
return new Promise((resolve, reject) => {
/**
* @see https://developers.google.com/gdata/docs/json
*/
let feed = [];
$.ajax({
type: "GET",
url: "https://sites.google.com/feeds/content/cgxchange.org/cropontologycommunity",
data: {
alt: "json"
},
async: true,
crossDomain: true,
dataType: "json",
success: (data) => {
let
/**
log_user(user_data) {
return new Promise((resolve, reject) => {
$.ajax({
type: "POST",
url: "http://www.cropontology.org/login",
data: user_data,
async: true,
crossDomain: true,
dataType: "json",
success: (data) => {
resolve(data);
},
error: (jqXHR, textStatus, errorThrown) => {
reject(errorThrown);
}
});
});
}
get_ontologies_data(id) {
return new Promise((resolve, reject) => {
/**
* @see http://www.cropontology.org/api
*/
$.ajax({
type: "GET",
url: "common/ontologies_data.json",
dataType: "json",
success: (data) => {
if(data[id] !== undefined) {
resolve(data[id]);
}
},
error: (jqXHR, textStatus, errorThrown) => {
reject(errorThrown);
}
});
get_ontology_comments(id) {
return new Promise((resolve, reject) => {
/**
* @see http://www.cropontology.org/api
*/
$.ajax({
type: "GET",
url: "http://www.cropontology.org/get-comments-onto/?ontoId=" + id,
async: true,
crossDomain: true,
dataType: "json",
success: (data) => {
resolve(data);
},
error: (jqXHR, textStatus, errorThrown) => {
reject(errorThrown);
}
});
get_login() {
return new Promise((resolve, reject) => {
/**
* @see http://www.cropontology.org/api
*/
$.ajax({
type: "GET",
url: "http://www.cropontology.org/login",
data: {
alt: "json"
},
async: true,
crossDomain: true,
dataType: "json",
success: (data) => {
if(data.username !== undefined && data.username !== "") {
resolve(data);
} else {
post(method, payload) {
const sf = this.getServiceFramework();
return new Promise((callback, errorCallback) => {
sf.post(method, payload, callback, function onError(error) {
errorCallback(getErrorMessageFromXHRError(error));
});
});
}
}