-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathindex.html
587 lines (494 loc) · 16.8 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
<!DOCTYPE html>
<!--
This is part of the Digital Business Card project.
This is the visual, HTML+hCard part of it, for whom doesn't have Passbook software nor
Address Book software.
Other versions of digital business cards proposed by this project
are Passbook and Address Book (VCF).
This HTML file uses Bootstrap and JQuery. It contains no personal data.
All data is located on an external file called data.json, loaded by the browser and
rendered by the JavaScript and templates on the bottom of this HTML file.
Content is rendered with Microformat's hCard tags (http://microformats.org/wiki/h-card).
Avi Alkalay
<avi at unix dot sh>
2014-10-31
Made in Brazil
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- A generic title, will be substituted by Javascript below -->
<title>Digital Business Card</title>
<!-- Be friendly with social media, specialy Facebook... -->
<!-- These meta tags must be hard coded (no JQuery) because they are read by Facebook -->
<meta property="og:type" content="profile" />
<meta property="og:title" content="Digital Business Card for Avi Alkalay" />
<meta property="og:description" content="Avi Alkalay • Full stack web & mobile solutions architect, Cloud & DevOps Advisor • IBM" />
<meta property="og:image" content="https://Avi.Alkalay.net/card/walletcard.png" />
<link rel="image_src" href="https://Avi.Alkalay.net/card/walletcard.png" />
<link rel="profile" href="http://microformats.org/profile/hcard">
<link rel="software" href="https://github.com/avibrazil/digital-business-card">
<link rel="shortcut icon" href="resources/img/vCard.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="photo.jpg">
<!-- Bootstrap -->
<!--link href="resources/css/bootstrap.min.css" rel="stylesheet"-->
<!--link href="resources/css/bootstrap-theme.min.css" rel="stylesheet"-->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- The actual business card data -->
<script src="data.json"></script>
<!-- Some customizations on top of Bootstrap -->
<style>
/* Style definitions */
body {
background-color: rgb(208,214,224);
}
@media (min-width: 660px) {
/* name, job description, department and company font sizes on windows bigger than 660px */
.n {
font-size: 2.5em;
}
.role, .org {
font-size: 1.6em;
}
}
@media (max-width: 659px) {
/* name, job description, department and company font sizes on windows smaller than 660px */
.n {
font-size: 1.6em;
}
.role, .org {
font-size: 1em;
}
}
.n {
text-shadow: .05em .05em 0 white;
font-weight: bold;
margin-top: 0;
}
.role, .organization-unit, .organization-name {
color: rgb(65,75,95);
text-shadow: .07em .07em 0 white;
}
.organization-unit, .role, .org {
font-weight: normal;
margin-top: 0;
}
.list-group-item a {
color: black;
}
.label {
text-align: right;
color: rgb(0,52,115);
font-weight: normal;
font-size: 1em;
}
.value {
overflow-x: auto;
}
#qr-code img {
width: 100%;
}
#footer hr {
border-color: grey;
margin-top: 0;
margin-bottom: .8em;
}
#footer p {
color: grey;
font-size: .8em;
}
/* --------------------------------------------- */
/* Layout and positioning definitions */
.vcard {
width: 90%;
/* This is the perfect width where the 2 columns of my (Avi) card look good */
max-width: 52.5em;
}
.gap {
height: 1em;
}
#buttons img {
width: 100%;
}
#social .label img {
height: 1.6em;
margin-top: -0.3em;
margin-bottom: -0.3em;
}
#qr-code .label {
display: block;
margin-top: 0.5em;
margin-bottom: 0;
text-align: center;
white-space: normal;
}
.container-fixed {
margin-left: auto;
margin-right: auto;
}
.list-group-item {
/* border: .07em solid grey; */
color: black;
font-weight: bold;
}
.list-group-item:first-child {
border-top-left-radius: .7em;
border-top-right-radius: .7em;
}
.list-group-item:last-child {
border-bottom-left-radius: .7em;
border-bottom-right-radius: .7em;
}
.img-rounded {
border-radius: 0.5em;
}
#footer {
padding-left: 1em;
padding-right: 1em;
}
</style>
</head>
<body>
<div class="container vcard">
<div class="section row" id="header">
<div class="row"><br/></div>
<div class="row" id="nametitle">
<div class="col-xs-4 col-sm-3 column">
<img src="photo.jpg" alt="photo" style="width: 100%" class="img-rounded img-responsive photo"/>
</div>
<div class="col-xs-8 col-sm-9 column nametitle">
<h1 class="name n"><span class="given-name"><script>document.write(obj.name.first)</script></span> <span class="family-name"><script>document.write(obj.name.last)</script></span></h1>
<h2 class="role"><script>document.write(obj.title)</script></h2>
<!--h3 class="org"><span class="organization-unit"><script>document.write(obj.department)</script></span> @
<span class="organization-name"><script>document.write(obj.company)</script></span></h3-->
</div>
</div>
<div class="row gap"></div>
<div id="buttons">
<div class="row">
<div class="col-xs-6 col-sm-3 column" id="address-book-badge">
<p class="text-center"><a href="vcard.vcf"><img src="resources/img/add-to-addressbook-badge.png" alt="Add to address book"/></a></p>
</div>
<div class="col-xs-6 col-sm-3 col-sm-offset-6 column" id="wallet-badge">
<p class="text-center"><a href="passbook.pkpass"><img src="resources/img/add-to-wallet-badge.png" alt="Add to Wallet"/></a></p>
</div>
</div>
</div>
<div class="row gap"></div>
</div>
<div class="section row" id="data">
<div id="sections" class="row">
<!-- content will be rendered dynamically here on $(document).ready() -->
<div id="section-column-1" class="col-xs-12 col-sm-6 column"></div>
<div id="section-column-2" class="hidden-xs col-sm-6 column"></div>
</div>
</div>
<div class="section row" id="footer">
<hr/>
<p class="text-center"><a href="https://github.com/avibrazil/digital-business-card">The Digital Business Card project</a> says: save trees, spread the bits, think mobile, act mobile.</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</body>
<script><!--
function toggleWalletBadge() {
var badgePass="resources/img/add-to-wallet-badge.png";
var linkPass="passbook.pkpass";
var badgeApp="resources/img/get-pass2u-badge.png";
var linkApp="https://play.google.com/store/apps/details?id=com.passesalliance.wallet";
if (/(android)/i.test(navigator.userAgent)) {
$("#wallet-badge img").each(function() {
$(this).fadeTo(3000, 1, "linear", function() {
$(this).attr("src",badgeApp);
$("#wallet-badge a" ).each(function() {$(this).attr("href",linkApp)});
})
});
}
}
function checkQRCode() {
var i = document.createElement('img');
i.onerror = function() {
// image did not load
$("#qr-code").remove();
}
i.src = $("#qr-code img").attr("src");
}
function changeHeader() {
// Check HTML <head> to see how we loded data.json
var sobj = window.JSON.stringify(obj);
sobj=sobj.split(obj.emailchar).join("@");
obj = window.JSON.parse(sobj);
document.title=obj.name.first + " " + obj.name.last + ": " + obj.title;
}
function renderData() {
var target=[document.getElementById("section-column-1")];
var columns;
var i;
if (typeof obj.columns === 'undefined') {
// Defaults.... in case its undefined in data.json
obj.columns={
"1": ["phone", "publications", "address", "mail"],
"2": ["social", "", "", "other", "qrcode"]
}
}
// a plain deep copy to be consumed...
columns = jQuery.extend(true, {}, obj.columns);
if ($(document).width() > 767) {
target.push(document.getElementById("section-column-2"));
}
for (i=0; i<target.length; i++) {
target[i].innerHTML="";
}
var all=columns["1"].length + columns["2"].length;
var currentTarget=0, currentCol=1, sect;
for (i=0; i<all; i++) {
sect=columns[currentCol].shift();
if (typeof sect !== 'undefined' && sect) {
target[currentTarget].innerHTML += tmpl(
"section_" + sect + "_template",
section=(obj.section[sect]?obj.section[sect]:1)
);
}
// Give column 2 the last chance
if (i==(all-1) && currentCol==1) i--;
currentCol = currentCol==1?2:1;
currentTarget = currentTarget==0?target.length-1:0;
}
}
$(document).ready(function() {
changeHeader();
toggleWalletBadge();
renderData();
checkQRCode();
// Define handler for window resize or device orientation change
$(window).resize(renderData);
});
-->
</script>
<script type="text/html" id="section_phone_template">
<% if (section.length) { %>
<div class="block" id="phone">
<ul class="list-group">
<% for ( var i = 0; i < section.length; i++ ) {
var protocol;
switch (section[i].label) {
case "facetime":
protocol = "facetime://";
break;
case "skype":
protocol = "skype:";
break;
case "SIP":
protocol = "sip://";
break;
case "conference":
protocol = "https://";
break;
default:
protocol = "tel://";
} %>
<li class="list-group-item">
<div class="row tel">
<div class="col-xs-3 column label type"><%=section[i].label%></div>
<div class="col-xs-9 column value">
<a class="value" href="<%=protocol%><%=section[i].value%>"><%=section[i].value%></a>
</div>
</div>
</li>
<% } %>
</ul>
</div>
<% } %>
</script>
<script type="text/html" id="section_mail_template">
<% if (section.length) { %>
<div class="block" id="mail">
<ul class="list-group">
<% for ( var i = 0; i < section.length; i++ ) { %>
<li class="list-group-item">
<div class="row">
<div class="col-xs-3 column label"><%=section[i].label%></div>
<div class="col-xs-9 column value">
<a class="mail" href="mailto:<%=section[i].value%>"><%=section[i].value%></a>
</div>
</div>
</li>
<% } %>
</ul>
</div>
<% } %>
</script>
<script type="text/html" id="section_qrcode_template">
<div class="block" id="qr-code">
<ul class="list-group">
<li class="list-group-item">
<img class="value" src="qr-code.png" alt="QR Code" title="QR Code"/>
<div class="label"><%=section[0].label%></div>
</li>
</ul>
</div>
</script>
<script type="text/html" id="section_address_template">
<% if (section.length) {
var apple = ( navigator.userAgent.match(/(Mac|iPad|iPhone|iPod)/g) ? true : false ); %>
<div class="block" id="address">
<ul class="list-group">
<% for ( var i = 0; i < section.length; i++ ) { %>
<li class="list-group-item">
<div class="row">
<div class="col-xs-3 column label"><%=section[i].label%></div>
<div class="col-xs-9 column adr value">
<% if (section[i].geo) {
if (apple) { /* Open in Maps app on Apple devices */ %>
<a href="http://maps.apple.com/?ll=<%=section[i].geo%>&z=19&q=<%=section[i].geo%>">
<% } else { %>
<a href="https://www.google.com.br/maps/@<%=section[i].geo%>,19z" targe="_new">
<% } %>
<span class="glyphicon glyphicon-map-marker" style="color: red"></span></a>
<% } %>
<% if (section[i].street) { %>
<span class="street-address"><%=section[i].street%></span><br/>
<% } %>
<% if (section[i].city) { %>
<span class="locality"><%=section[i].city%></span><% if (section[i].state) { %>,<% } %>
<% } %>
<% if (section[i].state) { %>
<span class="region"><%=section[i].state%></span><br/>
<% } %>
<% if (section[i].zip) { %>
<span class="postal-code"><%=section[i].zip%></span><br/>
<% } %>
<% if (section[i].country) { %>
<div class="country-name"><%=section[i].country%></span><br/>
<% } %>
</div>
</div>
</li>
<% } %>
</ul>
</div>
<% } %>
</script>
<script type="text/html" id="section_social_template">
<% if (section.length) { %>
<div class="block" id="social">
<ul class="list-group">
<% for ( var i = 0; i < section.length; i++ ) {
var url;
var label = '<img src="resources/img/' + section[i].label + '.png" alt="' + section[i].label + '"/>';
switch (section[i].label) {
case "twitter":
url = "https://twitter.com/" + section[i].value;
break;
case "facebook":
url = "https://facebook.com/" + section[i].value;
break;
case "google":
url = "https://plus.google.com/" + section[i].value;
break;
case "github":
url = "https://github.com/" + section[i].value;
break;
case "linkedin":
url = "https://www.linkedin.com/in/" + section[i].value;
break;
default:
label = section[i].label;
}
%>
<li class="list-group-item">
<div class="row">
<div class="col-xs-3 column label"><%=label%></div>
<div class="col-xs-9 column value">
<a href="<%=url%>"><%=section[i].value%></a>
</div>
</div>
</li>
<% } %>
</ul>
</div>
<% } %>
</script>
<script type="text/html" id="section_publications_template">
<% if (section.length) { %>
<div class="block" id="publications">
<ul class="list-group">
<% for ( var i = 0; i < section.length; i++ ) { %>
<li class="list-group-item">
<div class="row">
<div class="col-xs-3 column label"><%=section[i].label%></div>
<div class="col-xs-9 column value"><a href="<%=section[i].protocol + "://" + section[i].value%>"><%=section[i].value%></a></div>
</div>
</li>
<% } %>
</ul>
</div>
<% } %>
</script>
<script type="text/html" id="section_other_template">
<% if (section.length) { %>
<div class="block" id="other">
<ul class="list-group">
<% for ( var i = 0; i < section.length; i++ ) { %>
<li class="list-group-item">
<div class="row">
<div class="col-xs-3 column label"><%=section[i].label%></div>
<div class="col-xs-9 column value"><%=section[i].value%></div>
</div>
</li>
<% } %>
</ul>
</div>
<% } %>
</script>
<script id="template_system"><!--
// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
// http://ejohn.org/blog/javascript-micro-templating/
(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
cache[str] = cache[str] ||
tmpl(document.getElementById(str).innerHTML) :
// Generate a reusable function that will serve as a template
// generator (and which will be cached).
new Function("obj",
"var p=[],print=function(){p.push.apply(p,arguments);};" +
// Introduce the data as local variables using with(){}
"with(obj){p.push('" +
// Convert the template into pure JavaScript
str
.replace(/[\r\t\n]/g, " ")
.split("<%").join("\t")
.replace(/((^|%>)[^\t]*)'/g, "$1\r")
.replace(/\t=(.*?)%>/g, "',$1,'")
.split("\t").join("');")
.split("%>").join("p.push('")
.split("\r").join("\\'")
+ "');}return p.join('');");
// Provide some basic currying to the user
return data ? fn( data ) : fn;
};
})();
-->
</script>
<script id="google_analytics">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', obj.ganalytics, 'auto');
ga('send', 'pageview');
</script>
</html>