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
|
!!! 5
%html
%head
%meta{ :charset => "utf-8" }
%title= "PubChem read across"
%link{:rel=>'stylesheet', :href=>"#{'/style.css'}", :type => "text/css"}
%script{:type => "text/javascript", :src => "/jquery-1.8.2.js"}
:javascript
$(document).ready(function() { $.ajax({ url: "/cid/#{@cid}/experiments", cache: true }); });
function show(title,element,uri) {
$(element).html("<h4>"+title+"</h4>"+"Retrieving data from PubChem. This may take some time, please be patient."+"<img src=\"/spinning-wait-icons/wait30trans.gif\" alt=\"Searching PubChem\">");
$.ajax({
cache: true,
url: uri,
//timeout: 120000;
success: function(data){
data = "<h4>"+title+"</h4>"+"<button onclick='hide(\"" + title + "\",\"" + element + "\",\"" + uri + "\");'>Hide</button> <a href=\"" + uri + "/" + uri.replace("/cid/", "").replace("/",'-','g') + ".csv\"> (csv)</a>" + data;
$(element).html(data);
},
error: function(data,textStatus,message){
$(element).html(message);
}
});
}
function hide(title,element,uri) {
data = "<h4>"+title+"</h4>"+"<button onclick='show(\"" + title + "\",\"" + element + "\",\"" + uri + "\");'>Show</button>";
$(element).html(data);
}
function display(element,uri) {
$(element).html("Retrieving data from PubChem. This may take some time, please be patient."+"<img src=\"/spinning-wait-icons/wait30trans.gif\" alt=\"Searching PubChem\">");
$.ajax({
cache: true,
url: uri,
//timeout: 120000;
success: function(data){
$(element).html(data);
},
error: function(data,textStatus,message){
$(element).html(message);
}
});
}
%body
%h1 PubChem read across
%form{:name => "form", :action => '/search', :method => "GET"}
%fieldset
%label{:for => 'name'} Compound name:
%input{:type => 'text', :name => 'name', :id => 'name'}
%input{ :type => "submit", :value => "Search" }
%em This is an experimental version. Loading data from PubChem can be slow. Please use the "Back" button and retry the offending operation if you have timeout problems.
= yield
|