-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
executable file
·207 lines (183 loc) · 8.13 KB
/
index.html
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!DOCTYPE html>
<html lang="en-us">
<head id="head">
<meta name="theme-color" content="#00A185" />
<link href="./fonts/WiredMono/font.css" rel="stylesheet">
<title color="#fff">Git ABC*XYZ</title>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta content="width=device-width,initial-scale=1,minimal-ui,shrink-to-fit=no" name="viewport">
<meta name="pehtml" content="true">
<meta name="directory" content="css, js, img, snd">
<style>
body{font-family: wired-mono,"tungsten",proxima-nova,ProximaNova-Bold,HelveticaNeue-Bold,"Helvetica Neue Bold","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;}
</style>
<!--<script src="../script.js"></script>-->
</head>
<body id="body">
<h2 id="abtrepoheading"><element>A single Repo, available both at: </element></h2>
<div style="
float: left;
width: 50%;
"><h1 style="
background: #f34f29;
color: #fff;
">Git ABC*XYZ</h1><img src="favicon.png">
<br><p>Why having to choose a <b>single git platform</b> to rely on? Why having a <b>different README.md with different link URLs</b> for every git platform? Why <b>having to share a different URL for every git platform</b> (for your profile, a repository) if you could share a single link?!</p>
<p><u>To solve and cover all of these cases, here is our <mark>git profile/repo aggregator</mark>, gitabc.xyz!</u></p>
</div>
<div style="
float: right;
width: 40%;
">
<h4>How this magic works?</h4><p>Git ABC*XYZ is a git profile/repo aggregator. Replace <code>github.com/</code> or <code>gitlab.com/</code> by <code>gitabc.xyz/#/</code> when sharing a git repo/profile, and VOALA!</p>
<p>When clicking <code>gitabc.xyz/#/profile</code> or <code>gitabc.xyz/#/profile/repository</code>, visitor will have access to all of the git platforms where your repo/profile may be! All aggregated/centered into a single site.</p>
<h5>Spread the word:</h5>
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-size="large" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<h2>Supported sites:</h2>
<ul>
<li>Github</li>
<li>Gitlab</li>
</ul>
<hr><small>
<p>To do:</p>
<ul>
<li>Form to suggest more sites</li>
<li>Detect 404 error on repos/profiles so don't show these sites</li>
</ul>
</small>
</div>
<footer><copyright><center>(c) 2023-2024 Git ABC*XYZ by <a href="https://github.com/01VCS/" target="blank">01VCS</a> and <a href="https://danimesq.github.io/" target="blank">Daniella Mesquita</a>.</center></copyright></footer>
<script>
// PREPARE FOR HTTB MOD-REWRITTING ---->
//var count = (location.pathname.split('/').length - 1) - (location.pathname[location.pathname.length - 1] == '/' ? 1 : 0);
// thanks to https://stackoverflow.com/a/28485576/5623661
//console.log(count);
//-
//var pathArray = window.location.pathname.split('/');
//var ProfileLevel = pathArray[1];
//var RepoLevel = pathArray[2];
// thanks to https://css-tricks.com/snippets/javascript/get-url-and-url-parts-in-javascript/
//console.log(ProfileLevel);
//console.log(RepoLevel);
// <---- PREPARE FOR HTTB MOD-REWRITTING
//console.log(window.location.hash);
// thanks to https://stackoverflow.com/a/6944772/5623661 (https://github.com/nicolekc), https://usefulangle.com/post/298/javascript-url-hash
const SUPPORTEDSITES = { hub: "github.com", lab: "gitlab.com" };
// thanks to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
//console.log(SUPPORTEDSITES.hub);
//console.log(SUPPORTEDSITES.lab);
var count = (window.location.hash.split('/').length - 1) - (window.location.hash[window.location.hash.length - 1] == '/' ? 1 : 0);
// thanks to https://stackoverflow.com/a/28485576/5623661
//console.log(count);
var pathArray = window.location.hash.split('/');
var ProfileLevel = pathArray[1];
var RepoLevel = pathArray[2];
// thanks to https://css-tricks.com/snippets/javascript/get-url-and-url-parts-in-javascript/
console.log("user: ", ProfileLevel);
console.log("repo: ", RepoLevel);
// thanks to ChatGPT ---->
const githubLink = `https://${SUPPORTEDSITES.hub}/${ProfileLevel}/${RepoLevel}`;
const gitlabLink = `https://${SUPPORTEDSITES.lab}/${ProfileLevel}/${RepoLevel}`;
const githubDiv = document.createElement("div");
githubDiv.innerHTML = `<a href="${githubLink}" target="_blank"><div style="background:#00000082;display:inline-block;border-radius:10px;padding:10px;text-decoration:none;color:#171515"><img src='https://github.com/favicon.ico'> GitHub</div></a>`;
document.body.appendChild(githubDiv);
const gitlabDiv = document.createElement("div");
gitlabDiv.innerHTML = `<a href="${gitlabLink}" target="_blank"><div style="background:#e24329a3;display:inline-block;border-radius:10px;padding:10px;text-decoration:none;color:#171515"><img src='https://gitlab.com/assets/favicon-72a2cad5025aa931d6ea56c3201d1f18e68a8cd39788c7c80d5b2b82aa5143ef.png'> GitLab</div></a>`;
document.body.appendChild(gitlabDiv);
// <---- thanks to ChatGPT
//var s = document.getElementById("TOMOVE");
var t = document.getElementById("abtrepoheading");
//t.appendChild(s);
t.appendChild(githubDiv);
t.appendChild(gitlabDiv);
// from https://code-boxx.com/move-html-element-javascript/
if(count == '2'){
const gitlocationtype = "repo";
console.log("gitlocationtype:", gitlocationtype);
}
if(count == '1'){
const gitlocationtype = "profile";
console.log("gitlocationtype:", gitlocationtype);
}
if(count !== '2'){
if(count !== '1'){
const noreponoprofile = "y"
console.log("noreponoprofile: ", noreponoprofile);
}
}
//var url = 'https://gitlab.com/DaniMesq/test';
//function UrlExists(url) {
// var http = new XMLHttpRequest();
// http.open('HEAD', url, false);
// http.send();
// if (http.status != 404)
// // do something
// console.log("Gitlab repo found!");
// else
//// window.location.reload();
// console.log("Gitlab repo not found");
//}
//UrlExists(url)
//function urlExists(url, callback) {
// fetch(url, { method: 'head' })
// .then(function(status) {
// callback(status.ok)
// });
//}
//let url = 'https://gitlab.com/DaniMesq/test';
//urlExists(url, function(exists) {
// if (exists) {
// // it exists, do something
// console.log("Gitlab repo found!");
// } else {
// // it doesn't exist, do something else
// console.log("Gitlab repo not found");
// }
//});
//// Based on https://stackoverflow.com/a/18552771
//// @author Irvin Dominin <https://stackoverflow.com/u/975520>
//function UrlExists(url)
//{
// var iframe = document.createElement('iframe');
// var iframeError; // Store the iframe timeout
//
// iframe.onload = function () {
// console.log("Success on " + url);
// clearTimeout(iframeError);
// }
//
// iframeError = setTimeout(function () {
// console.log("Error on " + url)
// }, 3000);
//
// iframe.src = url;
// document.getElementsByTagName("body")[0].appendChild(iframe);
//}
//
//UrlExists('http://www.google.com/');
//UrlExists('http://www.goo000gle.com');
//UrlExists('https://gitlab.com/DaniMesq/test');
//UrlExists('https://github.com/DaniMesq/test');
//var repoheadingabt = document.getElementById('abtrepoheading');
//var text = document.createTextNode("<a href='https://github.com/" +ProfileLevel +"'" +"/" +RepoLevel);
//repoheadingabt.appendChild(text);
//document.querySelector("#abtrepoheading").innerHTML = "<a href='https://github.com/" +ProfileLevel +"'" +"/" +RepoLevel;
//document.querySelector("#abtrepoheading").innerHTML = "<a href='https://github.com/";
//function addElement() {
// // create a new div element
// const newDiv = document.createElement("div");
// const repoheadingabt = document.getElementById('abtrepoheading');
// // and give it some content
// const newContent = document.createTextNode("Hi there and greetings!");
// // add the text node to the newly created div
// repoheadingabt.appendChild(newContent);
// // add the newly created element and its content into the DOM
// const currentDiv = document.getElementById("div1");
// document.body.insertBefore(newDiv, currentDiv);
//}
//addElement()
// from https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
</script>
</body>
</html>