This repository has been archived by the owner on May 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
opendef.js
40 lines (39 loc) · 1.49 KB
/
opendef.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(function($){
JOBAD.modules.register({
info: {
'identifier': 'opendef',
'title': 'Open definition',
'author': 'Alexandru Toader',
'description': 'Open the definition of the selected ontology item',
'hasCleanNamespace': false
},
/**
@base_path base path for the planetary installation
@token string used to identify the workflow
*/
init: function(JOBADInstance, base_path, token){
this.localStore.set("base_path", base_path);
this.localStore.set("token", token);
},
contextMenuEntries: function (target) {
var cd, symbol;
var token = this.localStore.get("token");
var base_path = this.localStore.get("base_path");
if (target.is('span')) {
cd = target.attr("omdoc:cd");
symbol = target.attr("omdoc:name");
} else if (target.is('div')) {
var aux = target.attr('id');
aux = aux.substring(aux.lastIndexOf("/") + 1);
cd = aux.substring(0, aux.indexOf(".omdoc"));
symbol = aux.substring(aux.indexOf("#") + 1, aux.lastIndexOf(".def"));
}
if ((target.is('.omdoc-term') || target.attr('class') == 'node') && typeof(token) != 'undefined')
return {
"Look-up definition": function(element) {
window.open(base_path + "index.php?q=sally/showdef/" + cd + "/" + symbol + "/" + token, "_parent");
}
}
},
});
})(JOBAD.refs.$);