-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfsprofile.js
109 lines (93 loc) · 4.59 KB
/
cfsprofile.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
var height = 500;
var width = 1000;
var xAxis = 100;
var yAxis = 100;
var ArticleContent = "";
gadgets.sciverse.subscribeHighlightedText('subscribeHighlighted', callbackHighlight);
// hoverMe - Opens a hover window with the specified height, width, and location
function hoverMe() {
// Get the message which will be displayed in the hover window.
var message = "Hello World";
// Get the height, width, and location for the hover window.
var location = {
height:height,
width:width,
x:xAxis,
y:yAxis
};
var paramsJson = {msg:message};
gadgets.sciverse.showHoverView(paramsJson, location, hoverCallback);
}
/**
* hoverCallback - callback method for showHoverView. Called after a hover window
* is opened. Passed the 'hoverId' which is a unique identifier for the hover window opened.
* The 'hoverId' can be used to close the individual window.
*/
function hoverCallback(hoverId) {
gadgets.window.adjustHeight();
}
function callbackHighlight(term, posx, posy) {
if (/\s/g.test(term)) {
alert("There are whitespaces in the highlighted text");
return(0);
}
alert("IntelliSense will now search for:" + term);
//Get the message which will be displayed in the hover window.
NCBIidURL = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=protein&term=" + term + "+E.Coli+1000&usehistory=y";
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",NCBIidURL,false);
xmlhttp.send();
xmlIDs = xmlhttp.responseXML;
WebEnv = xmlIDs.getElementsByTagName("WebEnv")[0].childNodes[0].nodeValue;
QueryKey = xmlIDs.getElementsByTagName("QueryKey")[0].childNodes[0].nodeValue;
NCBIsumURL ="http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=protein&WebEnv=" + WebEnv + "&query_key=" + QueryKey;
xmlhttp.open("GET",NCBIsumURL,false);
xmlhttp.send();
xmlSummary = xmlhttp.responseText;
//gadgets.sciverse.getArticleContent(getContentCallback);
//LinnaeusURL = "http://linnaeus.smith.man.ac.uk:8080/axis2/services/linnaeus/tag?text=" + ArticleContent;
//xmlhttp.open("GET",LinnaeusURL,false);
//xmlOrganisms = xmlhttp.responseXML;
//Organisms = xmlOrganisms.getElementsByTagName("ax25:text")[0].childNodes[0].nodeValue;
var message = xmlSummary;
var location = {
height:height,
width:width,
x:posx,
y:posy
};
var paramsJson = {msg:message};
gadgets.sciverse.showHoverView(paramsJson, location, hoverCallback);
gadgets.sciverse.getArticleContent(ArticleContentCallback);
if (ArticleContent!= null) {
alert("NOT EMPTY!");
//document.write=response;
}
else
{
alert ("EMPTY!");
}
}
function ArticleContentCallback(response){
ArticleContent = response;
/* if (response != null) {
alert("NOT EMPTY!");
//document.write=response;
}
else
{
alert ("EMPTY!");
}
return(response);
// Tells gadget to resize itself
// gadgets.window.adjustHeight();*/
}
//Resize the gadget on load
gadgets.util.registerOnLoadHandler(function() {gadgets.window.adjustHeight();});