-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.html
executable file
·175 lines (154 loc) · 10.9 KB
/
profile.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
<html>
<head>
<title>maker.rocks</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://unpkg.com/notie/dist/notie.min.css">
<link rel="stylesheet" href="style.css?v=3">
<link rel="shortcut icon" href="img/emoji.png">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js"></script>
<script src="https://rawcdn.githack.com/nfrasser/linkify-shim/a6caa8d338d07551c842f4f6f71a1015948542bb/linkify.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body class="profile">
<div id="app">
<link v-if="data.productHuntImageURL || data.twitterUsername" rel="shortcut icon" v-bind:href="data.productHuntImageURL || `https://avatars.io/twitter/${data.twitterUsername}`">
<header v-bind:class="myProfile ? 'contains-nav' : ''">
<h1 class="logo"><a href="/"><img src="img/emoji.png" alt=""> <span class="logo-text">maker.rocks</span></a></h1>
<nav v-if="myProfile">
<a class="btn" href="/home">Edit profile</a>
</nav>
</header>
<aside class="not-found hero" style="display: none">
<h1 class="logo">Maker not found 🤔</h1>
<h2>This person does not exist! Maybe they're a ghost…</h2>
<a class="btn" href="/">Back to home</a>
</aside>
<aside class="loading" v-bind:style="`opacity: 0; pointer-events: none`">
<h1>Loading a cool maker!</h1>
</aside>
<main class="profile-grid">
<section class="main-info">
<img v-if="data.productHuntImageURL || data.twitterUsername" v-bind:src="data.productHuntImageURL || `https://avatars.io/twitter/${data.twitterUsername}`" class="profile-image">
<div class="profile-text">
<h1 class="name" v-if="data.productHuntName || data.twitterName">{{data.productHuntName || data.twitterName}}</h1>
<p class="bio" v-if="data.bio" v-html="data.bio"></p>
<div class="profile-links">
<a v-if="typeof personalWebsite !== 'undefined'" v-bind:href="personalWebsite" target="_blank"><i class="icon fa fa-globe"></i></a>
<a v-if="typeof personalBlog !== 'undefined'" v-bind:href="personalBlog" target="_blank"><i class="icon fa fa-pencil-alt"></i></a>
<a v-if="typeof twitterUsername !== 'undefined'" v-bind:href="`https://twitter.com/${twitterUsername}`" target="_blank"><i class="icon fab fa-twitter"></i></a>
<a v-if="typeof productHuntUsername !== 'undefined'" v-bind:href="`https://www.producthunt.com/@${productHuntUsername}`" target="_blank"><i class="icon fab fa-product-hunt"></i></a>
<a v-if="typeof wipUsername !== 'undefined'" v-bind:href="`https://wip.chat/@${wipUsername}`" target="_blank"><span class="emoji icon">🚧</span></a>
<a v-if="typeof makerlogUsername !== 'undefined'" v-bind:href="`https://getmakerlog.com/@${makerlogUsername}`" target="_blank"><i class="icon fas fa-check-circle"></i></a>
<a v-if="typeof twitchUsername !== 'undefined'" v-bind:href="`https://www.twitch.tv/${twitchUsername}`" target="_blank"><i class="icon fab fa-twitch"></i></a>
<a v-if="typeof youtubeURL !== 'undefined'" v-bind:href="`${youtubeURL}`" target="_blank"><i class="icon fab fa-youtube"></i></a>
<a v-if="typeof mediumUsername !== 'undefined'" v-bind:href="`https://medium.com/@${mediumUsername}`" target="_blank"><i class="icon fab fa-medium"></i></a>
<a v-if="typeof devtoUsername !== 'undefined'" v-bind:href="`https://dev.to/${devtoUsername}`" target="_blank"><i class="icon fab fa-dev"></i></a>
<a v-if="typeof telegramUsername !== 'undefined'" v-bind:href="`https://t.me/${telegramUsername}`" target="_blank"><i class="icon fab fa-telegram"></i></a>
<a v-if="typeof patreonUsername !== 'undefined'" v-bind:href="`https://www.patreon.com/${patreonUsername}`" target="_blank"><i class="icon fab fa-patreon"></i></a>
<a v-if="typeof bmcUsername !== 'undefined'" v-bind:href="`https://www.buymeacoffee.com/${bmcUsername}`" target="_blank"><i class="icon fa fa-coffee"></i></a>
<a v-if="typeof gitHubUsername !== 'undefined'" v-bind:href="`https://github.com/${gitHubUsername}`" target="_blank"><i class="icon fab fa-github"></i></a>
<a v-if="typeof linkedinUsername !== 'undefined'" v-bind:href="`https://www.linkedin.com/in/${linkedinUsername}`" target="_blank"><i class="icon fab fa-linkedin"></i></a>
<a v-if="typeof publicEmail !== 'undefined'" v-bind:href="`mailto:${publicEmail}`" target="_blank"><i class="icon fa fa-envelope"></i></a>
</div>
</div>
</section>
<section class="tasks" v-if="(typeof makerlogTasks !== 'undefined' && makerlogTasks.length > 0) || (typeof wipTasks !== 'undefined' && wipTasks.length > 0)">
<h2>Recently completed tasks</h2>
<h3 class="streak sub" v-if="taskStreak > 0">🔥 {{taskStreak}} day streak!!</h3>
<div class="task" v-for="task in tasks">
<span class="task-text">✅ {{task.message}}</span>
<img class="task-image" v-if="task.image" :src="task.image">
</div>
</section>
<section class="products" v-if="typeof productHuntProducts !== 'undefined' && productHuntProducts.length > 0">
<h2>Products launched</h2>
<h3 class="total-upvotes sub">🔼 {{productHuntTotalVotes}} total upvotes • {{productHuntAverageVotes}} average</h3>
<div class="product" v-for="product in productHuntProducts">
<a v-bind:href="product.websiteURL" target="_blank"><h3 class="name"><img v-bind:src="product.thumbnailURL" class="thumbnail">{{product.name}} <span class="votes"><i class="fa fa-caret-up"></i> {{product.votes}}</span></h3></a>
<h4 class="tagline">{{product.tagline}}</h4>
</div>
</section>
<section class="repos" v-if="typeof gitHubRepos !== 'undefined' && gitHubRepos.length > 0">
<h2>GitHub Repositories</h2>
<h3 class="total-stars sub">🌟 {{gitHubTotalStars}} total stars • {{gitHubAverageStars}} average</h3>
<div class="repo" v-for="repo in gitHubRepos">
<a v-bind:href="repo.url" target="_blank"><h3 class="name">{{repo.name}} <span class="stars"><i class="fa fa-star"></i> {{repo.stars}}</span></h3></a>
<h4 class="description">{{repo.description && repo.description.length > 0 ? repo.description : `No description.`}}</h4>
</div>
</section>
</main>
</div>
</body>
</html>
<script>
var username = window.location.hostname !== 'localhost' ? window.location.pathname.replace('/','').replace('.html','') : 'ethan';
var myProfile = false;
var data = {};
var vm;
fetch('https://functions.maker.rocks/getpageinfo', {method: 'POST', body: JSON.stringify({
username: username
})}).then(r => r.json()).then(res => {
console.log(res);
if(res.code === 'USER_NOT_FOUND') {
document.querySelector('.not-found').style.display = 'flex';
} else {
for(var i = 0; i < Object.keys(res).length; i++) {
data[Object.keys(res)[i]] = res[Object.keys(res)[i]];
}
// Calculate additional data keys here
data.tasks = (typeof data.makerlogTasks !== 'undefined' && data.makerlogTasks.length > 0 ? data.makerlogTasks : (typeof data.wipTasks !== 'undefined' ? data.wipTasks : []));
data.taskStreak = (typeof data.makerlogTasks !== 'undefined' && data.makerlogTasks.length > 0 ? data.makerlogStreak : (typeof data.wipTasks !== 'undefined' ? data.wipStreak : []));
vm = new Vue({
el: '#app',
data: data
});
if(data.productHuntName) {
document.head.querySelector('title').innerHTML = `${data.productHuntName} — maker.rocks 🤘`;
}
if(data.productHuntImageURL) {
document.head.querySelector('link[rel="shortcut icon"]').href = data.productHuntImageURL;
}
if(data.profileHue) {
document.querySelector('html').setAttribute('style', `--theme-hue: ${data.profileHue}; ${document.querySelector('html').getAttribute('style')}`);
}
var taskElements = document.querySelectorAll('.profile-grid section.tasks .task .task-text');
for(var i = 0; i < taskElements.length; i++) {
var taskElement = taskElements[i];
taskElement.innerHTML = addLinks(taskElement.innerText);
}
}
})
.catch(err => {
document.querySelector('aside.loading').style.background = 'var(--sub-red-color)';
document.querySelector('aside.loading h1').style.color = 'white';
document.querySelector('aside.loading h1').innerText = 'Error... ' + err;
});
if(typeof localStorage.username !== 'undefined' && localStorage.username !== 'undefined') {
myProfile = username === localStorage.username;
} else {
fetch('https://functions.maker.rocks/getmetadata', {method: 'POST', body: JSON.stringify({
username: localStorage.username,
code: localStorage.code
})}).then(r => r.json()).then(res => {
console.log(res.username);
localStorage.username = res.username;
myProfile = username === localStorage.username;
});
}
function addLinks(string) {
var links = linkify.find(string);
for(var i = 0; i < links.length; i++) {
var link = links[i];
string = string.replace(link.value, `<a href="${link.href}" target="_blank">${link.value}</a>`);
}
return string;
}
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-103555680-7"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-103555680-7');
</script>