No images in this repository’s iceberg at this time
Download raw (4.5 KB)
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>OSP works</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<style>
img {
max-width: 200px;
max-height: 200px;
float: left;
}
.archived {
background-color: gray;
}
.repo {
display: flex;
}
.iceberg, .processus {
width: 50%;
}
</style>
</head>
<body>
<h1>Works</h1>
<div class="filters">
View through:
<ul>
<li><a href="#" id="filter-commit">Last update</a></li>
<li><a href="works-fonts.html" id="filter-fonts">Fonts</a></li>
<li><a href="#" id="filter-images">Images</a></li>
<li><a href="#" id="filter-readme">Description</a></li>
<li><a href="#" id="filter-tree">Diagram</a></li>
</ul>
</div>
<script type="text/javascript" charset="utf-8">
let body = document.querySelector('body');
var gitlab_url = "http://gitlab.constantvzw.org";
var user_name = "osp";
var repos = [448,]
for (i=0; i < repos.length; i++) {
let repo = document.createElement('div'),
title = document.createElement('h2'),
iceberg = document.createElement('div'),
processus = document.createElement('div');
iceberg_h3 = document.createElement('h3'),
processus_h3 = document.createElement('h3');
repo.classList.add("repo");
title.classList.add("repo-title");
iceberg.classList.add('iceberg');
processus.classList.add('processus');
iceberg_h3.innerHTML = "Iceberg";
processus_h3.innerHTML = "Processus";
repo.appendChild(title);
processus.appendChild(processus_h3);
repo.appendChild(processus);
iceberg.appendChild(iceberg_h3);
repo.appendChild(iceberg);
body.appendChild(repo);
getMetadata(i, repos[i], repo);
let processus_url = "https://gitlab.constantvzw.org/api/v4/projects/" + repos[i] + "/repository/tree?path=processus";
let iceberg_url = "https://gitlab.constantvzw.org/api/v4/projects/" + repos[i] + "/repository/tree?path=iceberg";
getImages(i, repos[i], repo, processus_url, processus);
getImages(i, repos[i], repo, iceberg_url, iceberg);
}
// METADATA ///////////////////////////////
function getMetadata(i, repoID, repoElt) {
let repo_url = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID;
fetch(repo_url)
.then(function(resp){
//console.log(resp);
//console.log(resp.json());
return resp.json();
})
.then(function(data){
let title = repoElt.querySelector('.repo-title');
name = data.name.split(".").slice(1);
title.innerHTML = name.replace(",", ".");
if (data.default_branch == "archive"){
repoElt.classList.add("archived");
}
})
}
// COMMITS ///////////////////////////////
function getImages(i, repoID, repoElt, fetchURL, imageElt){
console.log(fetchURL);
fetch(fetchURL)
.then(function(resp){
return resp.json();
})
.then(function(data){
let title = repoElt.querySelector('.repo-title:first-child').innerHTML;
return data.map(function(image) {
let img = document.createElement('img'),
filename = document.createElement('p');
project_path = [gitlab_url, user_name, "work." + title].join('/');
img.src = project_path + "/raw/master/" + image.path;
filename.innerHTML = image.name;
imageElt.appendChild(filename);
imageElt.appendChild(img);
})
})
//.catch(function(error) {
// console.log(JSON.stringify(error));
//});
}
// END COMMITS
</script>
<script type="text/javascript" charset="utf-8" src="pad.js"> </script>
</body>
</html>