Spaces:
Running
Running
added comments
Browse files- ai_models.html +34 -14
ai_models.html
CHANGED
@@ -11,6 +11,7 @@
|
|
11 |
</head>
|
12 |
<body>
|
13 |
|
|
|
14 |
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
|
15 |
<a class="navbar-brand" href="#">PARROT</a>
|
16 |
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
|
@@ -29,6 +30,7 @@
|
|
29 |
|
30 |
<button id="topBtn" onclick="topFunction()">β</button>
|
31 |
|
|
|
32 |
<div class="container mt-5">
|
33 |
<div class="row">
|
34 |
<div class="col-lg-11">
|
@@ -80,12 +82,24 @@
|
|
80 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
81 |
<script src="modelData.js"></script>
|
82 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
function scrollFunction() {
|
84 |
-
console.log(mybutton.id);
|
85 |
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) { mybutton.style.display = "block";}
|
86 |
else { mybutton.style.display = "none";}
|
87 |
}
|
88 |
|
|
|
89 |
function topFunction() {
|
90 |
document.body.scrollTop = 0;
|
91 |
document.documentElement.scrollTop = 0;
|
@@ -93,20 +107,29 @@
|
|
93 |
|
94 |
function AI_ModelTableCreate(dataSection,id) {
|
95 |
tbl = document.getElementById(id.concat("Table"));
|
96 |
-
N_iterations = Math.max(dataModel.seg.length,dataModel.dose.length);
|
97 |
|
98 |
-
|
|
|
|
|
|
|
99 |
const tr = tbl.insertRow();
|
|
|
|
|
100 |
if (i < dataSection.length) {
|
|
|
101 |
tr.setAttribute("class", "clickable");
|
102 |
tr.setAttribute('data-href','#'.concat(id.concat(i.toString())))
|
|
|
103 |
for (let j = 0; j < 2; j++) {
|
104 |
const td = tr.insertCell();
|
105 |
-
|
|
|
106 |
if (j === 0) {td.appendChild(document.createTextNode(dataSection[i].location));}
|
107 |
else {td.appendChild(document.createTextNode(dataSection[i].architecture));}
|
108 |
}
|
109 |
}
|
|
|
|
|
110 |
else {
|
111 |
const td = tr.insertCell();
|
112 |
td.appendChild(document.createTextNode("β"))
|
@@ -117,6 +140,7 @@
|
|
117 |
function AI_ModelCardsCreate(dataSection,id) {
|
118 |
renderSection = document.getElementById(id.concat("Cards"));
|
119 |
|
|
|
120 |
for (let i = 0; i < dataSection.length; i++) {
|
121 |
canvas = document.createElement('div');
|
122 |
canvas.setAttribute('class','row')
|
@@ -125,16 +149,19 @@
|
|
125 |
div = document.createElement('div');
|
126 |
div.setAttribute('id',id.concat(i.toString()))
|
127 |
div.style.padding = "50px";
|
128 |
-
|
|
|
129 |
canvas.appendChild(div)
|
130 |
renderSection.appendChild(canvas)
|
131 |
}
|
132 |
}
|
133 |
|
134 |
function getModelCard(dataSection,id) {
|
|
|
135 |
for(let i = 0; i < dataSection.length; i++) {
|
136 |
var apiUrl = dataSection[i].url
|
137 |
|
|
|
138 |
$.ajax({
|
139 |
url: apiUrl,
|
140 |
method: 'GET',
|
@@ -147,18 +174,11 @@
|
|
147 |
});
|
148 |
}
|
149 |
}
|
|
|
|
|
150 |
let mybutton = document.getElementById("topBtn");
|
151 |
window.onscroll = function() {scrollFunction()};
|
152 |
|
153 |
-
getModelCard(dataModel.seg,'seg');
|
154 |
-
getModelCard(dataModel.dose,'dose');
|
155 |
-
|
156 |
-
AI_ModelTableCreate(dataModel.seg,'seg');
|
157 |
-
AI_ModelTableCreate(dataModel.dose,'dose');
|
158 |
-
|
159 |
-
AI_ModelCardsCreate(dataModel.seg,'seg');
|
160 |
-
AI_ModelCardsCreate(dataModel.dose,'dose');
|
161 |
-
|
162 |
$(".clickable").click(function(){
|
163 |
window.location = $(this).data("href");
|
164 |
});
|
|
|
11 |
</head>
|
12 |
<body>
|
13 |
|
14 |
+
<!--navbar-->
|
15 |
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
|
16 |
<a class="navbar-brand" href="#">PARROT</a>
|
17 |
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
|
|
|
30 |
|
31 |
<button id="topBtn" onclick="topFunction()">β</button>
|
32 |
|
33 |
+
<!--main-->
|
34 |
<div class="container mt-5">
|
35 |
<div class="row">
|
36 |
<div class="col-lg-11">
|
|
|
82 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
83 |
<script src="modelData.js"></script>
|
84 |
<script>
|
85 |
+
function init() {
|
86 |
+
getModelCard(dataModel.seg,'seg');
|
87 |
+
getModelCard(dataModel.dose,'dose');
|
88 |
+
|
89 |
+
AI_ModelTableCreate(dataModel.seg,'seg');
|
90 |
+
AI_ModelTableCreate(dataModel.dose,'dose');
|
91 |
+
|
92 |
+
AI_ModelCardsCreate(dataModel.seg,'seg');
|
93 |
+
AI_ModelCardsCreate(dataModel.dose,'dose');
|
94 |
+
}
|
95 |
+
|
96 |
+
//displays the button if the user scrolls 50px at least
|
97 |
function scrollFunction() {
|
|
|
98 |
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) { mybutton.style.display = "block";}
|
99 |
else { mybutton.style.display = "none";}
|
100 |
}
|
101 |
|
102 |
+
//reset users position on the page
|
103 |
function topFunction() {
|
104 |
document.body.scrollTop = 0;
|
105 |
document.documentElement.scrollTop = 0;
|
|
|
107 |
|
108 |
function AI_ModelTableCreate(dataSection,id) {
|
109 |
tbl = document.getElementById(id.concat("Table"));
|
|
|
110 |
|
111 |
+
// equalizes both table's length
|
112 |
+
N_row = Math.max(dataModel.seg.length,dataModel.dose.length);
|
113 |
+
|
114 |
+
for (let i = 0; i < N_row; i++) {
|
115 |
const tr = tbl.insertRow();
|
116 |
+
|
117 |
+
// creates a filled row
|
118 |
if (i < dataSection.length) {
|
119 |
+
// data-href contains the id of the model which is linked to it (eg: data-href="#x" will transfer the user to the component with id="x")
|
120 |
tr.setAttribute("class", "clickable");
|
121 |
tr.setAttribute('data-href','#'.concat(id.concat(i.toString())))
|
122 |
+
|
123 |
for (let j = 0; j < 2; j++) {
|
124 |
const td = tr.insertCell();
|
125 |
+
|
126 |
+
// fills in the cells the data assiociated to it
|
127 |
if (j === 0) {td.appendChild(document.createTextNode(dataSection[i].location));}
|
128 |
else {td.appendChild(document.createTextNode(dataSection[i].architecture));}
|
129 |
}
|
130 |
}
|
131 |
+
|
132 |
+
// creates an empty row
|
133 |
else {
|
134 |
const td = tr.insertCell();
|
135 |
td.appendChild(document.createTextNode("β"))
|
|
|
140 |
function AI_ModelCardsCreate(dataSection,id) {
|
141 |
renderSection = document.getElementById(id.concat("Cards"));
|
142 |
|
143 |
+
// defines et sets attribute for each divs containing the modelcard
|
144 |
for (let i = 0; i < dataSection.length; i++) {
|
145 |
canvas = document.createElement('div');
|
146 |
canvas.setAttribute('class','row')
|
|
|
149 |
div = document.createElement('div');
|
150 |
div.setAttribute('id',id.concat(i.toString()))
|
151 |
div.style.padding = "50px";
|
152 |
+
|
153 |
+
// adds the structure to the section
|
154 |
canvas.appendChild(div)
|
155 |
renderSection.appendChild(canvas)
|
156 |
}
|
157 |
}
|
158 |
|
159 |
function getModelCard(dataSection,id) {
|
160 |
+
// gets the url of each model card, that are stocked in "modelData.js"
|
161 |
for(let i = 0; i < dataSection.length; i++) {
|
162 |
var apiUrl = dataSection[i].url
|
163 |
|
164 |
+
// download the model card and upload it in the created divs in AI_ModelCardsCreate() function
|
165 |
$.ajax({
|
166 |
url: apiUrl,
|
167 |
method: 'GET',
|
|
|
174 |
});
|
175 |
}
|
176 |
}
|
177 |
+
|
178 |
+
// triggers
|
179 |
let mybutton = document.getElementById("topBtn");
|
180 |
window.onscroll = function() {scrollFunction()};
|
181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
$(".clickable").click(function(){
|
183 |
window.location = $(this).data("href");
|
184 |
});
|