forked from cBioPortal/cbioportal-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
my-index.ejs
99 lines (88 loc) · 3.56 KB
/
my-index.ejs
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
<!DOCTYPE html>
<html class="cbioportal-frontend">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<link rel="icon" href="/images/cbioportal_icon.png"/>
<title>cBioPortal for Cancer Genomics</title>
<script>
window.devContext = true;
// @ts-ignore: ENV_* are defined in webpack.config.js
// genomeNexusApiUrl : ENV_GENOME_NEXUS_URL,
window.frontendConfig = {
//configurationServiceUrl:"http://localhost:8080/config_service.jsp",
//frontendUrl:'//'+window.location.host + '/',
//apiRoot: 'http://www.cbioportal.org/rc',
//sessionServiceUrl:'http://www.cbioportal.org/rc/api-legacy/proxy/session/',
// custom_tabs:[
// {
// "title": "Custom Tab",
// "location": "RESULTS_PAGE",
// "mountCallbackName": "renderCustomTab1",
// "pathsToJs":["http:127.0.0.1:8081/customTab1.js"],
// "showWithMultipleStudies": true,
// "customParameters": { example:1 },
// "unmountOnHide":false
// }
// ],
serverConfig:{}
};
</script>
<script src="/reactapp/common.bundle.js"></script>
<link href="/reactapp/prefixed-bootstrap.min.css" rel="stylesheet"></link>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />
</head>
<body>
<div id="reactRoot"></div>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?aab9f43048b3553eabfd8eb96ec00360";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<script>
window.addEventListener('message', (event) => {
const data = event.data;
function interceptClickEvent(e) {
var target = e.target || e.srcElement;
if (target.tagName === 'A') {
let url = new URL(target.getAttribute('href'));
//put your logic here...
if (url.hostname == 'data.3steps.cn') {
target.setAttribute('target', '_self');
console.log('interceptClickEvent: ', target);
} else {
target.setAttribute('target', '_blank');
console.log('interceptClickEvent(Set _blank): ', target);
}
}
};
if (data.resizeIframe && data.iframeId && data.element) {
// TODO: This is a trick way, another best way?
const element = document.querySelector('#mainColumn');
if (element) {
element.setAttribute('style', 'min-height: unset;');
}
const pageHeight = document.querySelector(data.element).clientHeight;
console.log('resizeIframe: ', pageHeight, document.querySelector(data.element).getBoundingClientRect());
window.parent.postMessage({ iframeId: data.iframeId, pageHeight: pageHeight }, "*");
}
if (data.hideHeader) {
let style = '.cbioportal-frontend .pageTopContainer { display: none !important; }';
var css = document.createElement('style');
css.type = 'text/css';
css.appendChild(document.createTextNode(style));
document.head.appendChild(css);
//listen for link click events at the document level
if (document.addEventListener) {
document.addEventListener('click', interceptClickEvent);
} else if (document.attachEvent) {
document.attachEvent('onclick', interceptClickEvent);
}
}
});
</script>
</body>
</html>