-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
1041 lines (923 loc) · 35.1 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
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Use title if it's in the page YAML frontmatter -->
<title>soonsnap :: share just-taken photos with people standing next to you</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui">
<meta name="theme-color" content="#2A8DCB">
<link rel="icon" type="image/png" href="/icon-16.png">
<link rel="manifest" href="/manifest.json">
<link href='http://fonts.googleapis.com/css?family=Bitter:400,700' rel='stylesheet' type='text/css'>
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="icon-144.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="icon-114.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="icon-72.png">
<link rel="apple-touch-icon-precomposed" href="icon-57.png">
</head>
<style type="text/css">
html,
button,
input,
select,
textarea {
color: #222;
}
body {
font-size: 1em;
line-height: 1.4;
}
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
img {
vertical-align: middle;
}
fieldset {
border: 0;
margin: 0;
padding: 0;
}
textarea {
resize: vertical;
}
.chromeframe {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
/* ==========================================================================
Custom styles
========================================================================== */
html, body {
padding: 0;
margin: 0;
}
/*----- Header -----*/
#header {
position:fixed;
font-family: "Bitter", sans-serif;
font-size: 1em;
font-weight: 400;
top: 0;
z-index:1;
height:48px;
width:100%;
color:white;
background-color: #2A8DCB;
box-shadow:0 0 2px 0 rgba(0,0,0,0.4);
}
.header-items {
width: 90%;
float: left;
margin-left: 5%;
}
.header-title, .header-link {
float: left;
display: block;
color: white;
height: 32px;
line-height: 48px;
margin-left: 0.8em;
padding-left: 0.8em;
padding-right: 0.8em;
text-shadow:0px 1px rgba(0,0,0,0.2);
text-decoration: none;
}
.header-link:hover {
opacity: 0.7;
transition:ease 200ms;
-webkit-transition:ease 200ms;
}
.header-link:active {
opacity: 0.7;
}
.header-emblem {
float: right;
display: inline-block;
opacity:1.0;
height: 32px;
margin: 0.7em 2em auto 2em;
}
.header-emblem:hover {
opacity: 0.7;
transition:ease 200ms;
-webkit-transition:ease 200ms;
}
.logo {
float: left;
display: inline-block;
margin-top:8px;
margin-left: 0.5em;
height:32px;
}
/*------ Page -----*/
.page {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
padding-top: 64px;
background: #f3f3f3;
width: 100%;
display: none;
}
.page.active {
display: block;
transition:ease-in 200ms;
}
.page-content {
position: absolute;
margin: auto 5%;
width: 90%;
font-family: "Bitter", sans-serif;
font-weight: 400;
font-size: 1.5em;
text-align: center;
background-color: transparent;
color: #555;
text-shadow:0px 1px rgba(255,255,255,0.6);
}
.secret-key {
font-size: 2.5em;
font-weight: 400;
padding: 0;
line-height: 1em;
margin: 20px 0;
}
.secret-key small {
font-size: 0.2em;
}
.receive-title {
font-family: "Bitter", sans-serif;
text-shadow:0px 1px rgba(255,255,255,0.6);
font-weight: 400;
padding-top: 24px;
}
.key {
font-family: "Bitter", sans-serif;
font-weight: 400;
color: #555;
font-size: 2em;
margin: 0 auto;
text-align: center;
width: 40%;
display: block;
background-color: #fff;
margin-top: 32px;
padding: 0.25em;
border-radius: 4px;
box-shadow:inset 0 4px 0 0 rgba(0,0,0,0.2);
}
#wait_for_transmission a, #front button {
position: absolute;
margin: auto 5%;
width: 90%;
-webkit-border-radius:4px;
-moz-border-radius:4px;
border-radius:4px;
box-shadow:inset 0 -4px 0 0 rgba(0,0,0,0.2);
outline: none;
border: none;
padding-bottom: 4px;
text-decoration: none;
}
#wait_for_transmission button:active, #front button:active {
box-shadow:inset 0 4px 0 0 rgba(0,0,0,0.2);
padding-top: 4px;
}
.button-text {
display: block;
font-family: "Bitter", sans-serif;
font-weight: 400;
font-size:1.5em;
line-height:2em;
font-weight:400;
text-align:center;
text-decoration:none;
text-shadow:0px 1px rgba(0, 0, 0, 0.3);
color:white;
}
.button-icon-fill {
fill:#fff;
}
.button-icon-shadow {
fill:#000;
opacity:0.2;
}
label.file-input-button {
margin: auto 5%;
width: 90%;
padding-top: 15%;
padding-bottom: 15.2%;
font-family: "Bitter", sans-serif;
font-weight: 400;
font-size: 1.5em;
text-align:center;
text-decoration:none;
text-shadow:0px 1px rgba(0, 0, 0, 0.3);
color:white;
display: inline-block;
background: #E63D4E;
-webkit-border-radius:4px;
-moz-border-radius:4px;
border-radius:4px;
box-shadow:inset 0 -4px 0 0 rgba(0,0,0,0.2);
outline: none;
border: none;
position: absolute;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
cursor: pointer;
}
label.file-input-button:active {
box-shadow:inset 0 4px 0 0 rgba(0,0,0,0.2);
padding-top: 15.2%;
padding-bottom: 15%;
}
label.file-input-button input {
display: block;
-moz-opacity:0;
filter:alpha(opacity: 0);
opacity:0;
cursor:pointer;
}
.custom-file-input {
color: transparent;
outline: none;
border:none;
}
#receive {
height: 50%;
background: #F58735;
}
#send_another {
position: absolute;
margin: auto 5%;
width: 90%;
-webkit-border-radius:4px;
-moz-border-radius:4px;
border-radius:4px;
box-shadow:inset 0 -4px 0 0 rgba(0,0,0,0.2);
outline: none;
border: none;
padding-top: 10px;
padding-bottom: 14px;
background: #E63D4E;
}
#send_another:active {
box-shadow:inset 0 4px 0 0 rgba(0,0,0,0.2);
padding-top: 14px;
padding-bottom: 10px;
}
#wait_for_transmission #download {
background: #0F9D58;
top: 0;
height: 30%;
margin-top: 70px;
}
#wait_for_transmission #download .button-text {
position: absolute;
top: 110px;
width: 100%;
text-align: center;
}
#wait_for_transmission .no-download-attr {
top: 0;
height: 30%;
font-family: "Bitter", sans-serif;
font-size: 1.3em;
padding: 5px;
text-align: center;
}
#wait_for_transmission .waiting {
font-family: "Bitter", sans-serif;
font-size: 2em;
text-align: center;
}
#send {
top: 65%;
height: 30%;
background: #E63D4E;
font-size: 0.6em;
}
/*--- Keypad Buttons ---*/
.buttons button {
position: absolute;
width: 22%;
height: 11%;
font-family: "Bitter", sans-serif;
font-weight: 400;
font-size: 2em;
text-align: center;
-webkit-border-radius:0.125em;
-moz-border-radius:0.125em;
border-radius:0.125em;
box-shadow:inset 0 -0.125em 0 0 rgba(0,0,0,0.2);
outline: none;
border: none;
padding-bottom: 0.125em;
background-color: #777;
color:white;
}
.buttons h2, .buttons h3 {
position: absolute;
text-align: center;
left: 2%;
right: 2%;
}
.buttons h2 {
top: 2%;
}
.buttons h3 {
top: 18%;
}
.buttons button:nth-of-type(-n+20) { top: 87%; }
.buttons button:nth-of-type(-n+16) { top: 74%; }
.buttons button:nth-of-type(-n+12) { top: 61%; }
.buttons button:nth-of-type(-n+8) { top: 48%; }
.buttons button:nth-of-type(-n+4) { top: 35%; }
.buttons button:nth-of-type(4n+1) { left: 2%; }
.buttons button:nth-of-type(4n+2) { left: 26%; }
.buttons button:nth-of-type(4n+3) { left: 50%; }
.buttons button:nth-of-type(4n) { left: 74%; }
/*----- received Image -----*/
.received-image {
width: 90%;
border-radius: 0.5em;
position: absolute;
top: 30%;
margin: 80px 5% 0;
text-align: center;
bottom: 5%;
}
.received-image img {
max-width: 100%;
max-height: 100%;
}
/*----- Modal Dialog -----*/
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.3);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 200ms ease-in;
-moz-transition: opacity 200ms ease-in;
transition: opacity 200ms ease-in;
pointer-events: none;
}
.modal:target {
opacity:1;
pointer-events: auto;
}
.modal > div {
font-family: "Bitter", sans-serif;
font-weight: 400;
width: 70%;
position: relative;
font-size: 1em;
line-height: 1.6em;
margin: 15% auto;
padding:1em 2em;
border-radius: 0.5em;
color: #555;
background: #fff;
box-shadow: 0 5px 10px -5px rgba(0,0,0,0.8);
}
.modal > div a {
color: #2A8DCB;
text-decoration: none;
outline: none;
border:none;
}
.modal > div a:hover {
opacity: 0.7;
}
.close, a .close {
position: absolute;
float: right;
top:-12px;
left:-12px;
height: 24px;
width: 24px;
text-decoration: none;
outline: none;
border:none;
}
.close-icon-fill {
fill:#fff;
}
.close-icon-back {
fill:#000;
opacity:0.8;
}
#wait_for_transmission.waiting .waiting { display: block; }
#wait_for_transmission.waiting .completed { display: none; }
#wait_for_transmission.completed .waiting { display: none; }
#wait_for_transmission.completed .completed { display: block; }
body.supports-download-attr #wait_for_transmission.completed a#download { display: block; }
body.supports-download-attr #wait_for_transmission p.no-download-attr { display: none; }
body.not-supports-download-attr #wait_for_transmission a#download { display: none; }
body.not-supports-download-attr #wait_for_transmission.completed p.no-download-attr { display: block; }
#sendp2 p {
-webkit-transition: all 600ms ease;
-moz-transition: all 600ms ease;
-ms-transition: all 600ms ease;
transition: all 600ms ease;
}
#sendp2.sending .sending {
height: auto;
}
#sendp2.sending .received:not(.sending) {
opacity: 0;
}
#sendp2.end-sending .sending:not(.received) {
height: 1px !important;
margin: 1px;
overflow: hidden;
}
#sendp2.end-sending .received {
opacity: 1;
}
#sendp2.received .sending:not(.received) {
display: none;
}
.buttons button.backspace {
left: auto;
right: 4%;
top: 96px;
height: 60px;
text-align: center;
padding: 0;
background-color: #E63D4E;
}
#loader {
text-align: center;
}
.invisible {
display: none;
}
#loader span {
display: inline-block;
vertical-align: middle;
width: 10px;
height: 10px;
margin: 50px auto;
background: #333;
border-radius: 50px;
-webkit-animation: loader 0.9s infinite alternate;
-moz-animation: loader 0.9s infinite alternate;
}
#loader span:nth-of-type(2) {
-webkit-animation-delay: 0.3s;
-moz-animation-delay: 0.3s;
}
#loader span:nth-of-type(3) {
-webkit-animation-delay: 0.6s;
-moz-animation-delay: 0.6s;
}
@-webkit-keyframes loader {
0% {
width: 10px;
height: 10px;
opacity: 0.9;
-webkit-transform: translateY(0);
}
100% {
width: 24px;
height: 24px;
opacity: 0.1;
-webkit-transform: translateY(-21px);
}
}
@-moz-keyframes loader {
0% {
width: 10px;
height: 10px;
opacity: 0.9;
-moz-transform: translateY(0);
}
100% {
width: 24px;
height: 24px;
opacity: 0.1;
-moz-transform: translateY(-21px);
}
}
</style>
<body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>
<![endif]-->
<!-- Header -->
<div id="header">
<div class="header-items">
<a href="/"><span class="logo">
<svg height="32" width="32" version="1.1" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: relative;" >
<path
class="button-icon-shadow"
d="m15 3.6562c-4.6717 0-8.4928 3.5703-8.9375 8.125-2.3087 0.443-4.0625 2.438-4.0625 4.875 0 2.7613 2.2387 5 5 5v-3.906c-0.5876-0.322-1-0.936-1-1.656v-0.1875c0-1.056 0.8502-1.906 1.9062-1.906h16.188c1.056 0 1.906 0.85 1.906 1.906v0.1875c0 0.72011-0.41241 1.3338-1 1.6562v3.5938c2.8775-0.87112 5-3.5273 5-6.6875 0-3.866-3.134-7-7-7-0.16867 0-0.33433 0.0505-0.5 0.0625-1.607-2.4566-4.345-4.0618-7.5-4.0618zm-6 11.344h-1v14c0 0.554 0.446 1 1 1h14c0.554 0 1-0.446 1-1v-14h-1zm1 1h12v10h-12zm4 3-3 3v3h10v-3l-2-2-2 2z" />
<path
class="button-icon-fill"
d="m15 2.6562c-4.6717 0-8.4928 3.5703-8.9375 8.125-2.3087 0.443-4.0625 2.438-4.0625 4.875 0 2.7613 2.2387 5 5 5v-3.906c-0.5876-0.322-1-0.936-1-1.656v-0.1875c0-1.056 0.8502-1.906 1.9062-1.906h16.188c1.056 0 1.906 0.85 1.906 1.906v0.1875c0 0.72011-0.41241 1.3338-1 1.6562v3.5938c2.8775-0.87112 5-3.5273 5-6.6875 0-3.866-3.134-7-7-7-0.16867 0-0.33433 0.0505-0.5 0.0625-1.607-2.4566-4.345-4.0618-7.5-4.0618zm-6 11.344h-1v14c0 0.554 0.446 1 1 1h14c0.554 0 1-0.446 1-1v-14h-1zm1 1h12v10h-12zm4 3-3 3v3h10v-3l-2-2-2 2z" />
</svg>
</span></a>
<a class="header-link" href="/">soonsnap</a>
<a class="header-emblem" href="#about">
<svg height="24" width="24" version="1.1" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: relative;" >
<path
class="button-icon-shadow"
d="m 11.63,3.01 c 3.2833,-0.18391 6.1881,2.339 6.372,5.6223 -2e-4,2.8014 -0.75506,3.8417 -3.186,5.6848 -0.38168,0.28715 -0.65089,0.50097 -0.74965,0.62471 -0.0987,0.12414 -0.0624,0.0666 -0.0624,0.0624 0.014,1.0561 -0.94281,1.999 -1.999,1.999 -1.05619,0 -2.013,-0.94293 -1.9991,-1.999 0,-1.0043 0.44827,-1.886 0.93706,-2.4988 0.48879,-0.61297 0.98214,-1.0323 1.4368,-1.3744 0.40791,-0.32097 0.92123,-0.76872 1.3744,-1.3119 0.18691,-0.22409 0.25788,-0.61503 0.24988,-0.87459 v -0.0624 c -0.0632,-1.1259 -0.99805,-1.9373 -2.124,-1.8741 -1.12595,0.0632 -1.9373,0.87311 -1.8741,1.999 0,1.9991 -1.999,1.9991 -1.999,1.9991 0,0 -1.9991,0 -1.9991,-1.9991 -0.18391,-3.2833 2.339,-5.813 5.6223,-5.9972 z m 0.37483,15.992 c 1.104,0 1.999,0.89502 1.999,1.999 0,1.10398 -0.89501,1.9991 -1.999,1.9991 -1.10399,0 -1.9991,-0.89502 -1.9991,-1.9991 0,-1.104 0.89502,-1.999 1.9991,-1.999 z" />
<path
class="button-icon-fill"
d="m 11.63,2.01 c 3.2833,-0.18391 6.1881,2.339 6.372,5.6223 -2e-4,2.8014 -0.75506,3.8417 -3.186,5.6848 -0.38168,0.28715 -0.65089,0.50097 -0.74965,0.62471 -0.0987,0.12414 -0.0624,0.0666 -0.0624,0.0624 0.014,1.0561 -0.94281,1.999 -1.999,1.999 -1.05619,0 -2.013,-0.94293 -1.9991,-1.999 0,-1.0043 0.44827,-1.886 0.93706,-2.4988 0.48879,-0.61297 0.98214,-1.0323 1.4368,-1.3744 0.40791,-0.32097 0.92123,-0.76872 1.3744,-1.3119 0.18691,-0.22409 0.25788,-0.61503 0.24988,-0.87459 v -0.0624 c -0.0632,-1.1259 -0.99805,-1.9373 -2.124,-1.8741 -1.12595,0.0632 -1.9373,0.87311 -1.8741,1.999 0,1.9991 -1.999,1.9991 -1.999,1.9991 0,0 -1.9991,0 -1.9991,-1.9991 -0.18391,-3.2833 2.339,-5.813 5.6223,-5.9972 z m 0.37483,15.992 c 1.104,0 1.999,0.89502 1.999,1.999 0,1.10398 -0.89501,1.9991 -1.999,1.9991 -1.10399,0 -1.9991,-0.89502 -1.9991,-1.9991 0,-1.104 0.89502,-1.999 1.9991,-1.999 z" />
</svg>
</a>
</div>
</div>
<!-- Front -->
<div id="front" class="page active">
<!-- Receive Button -->
<button id="receive">
<svg height="96" width="96" version="1.1" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: relative;" >
<path
class="button-icon-shadow"
d="m51 8c-9.465 0-17.679 4.816-22.5 12.188-0.497-0.036-0.994-0.188-1.5-0.188-11.598 0-21 9.402-21 21 0 9.871 6.821 18.158 16 20.406v-10.968c-1.221-1.096-2-2.66-2-4.438 0-3.324 2.676-6 6-6h44c3.324 0 6 2.676 6 6 0 1.778-0.779 3.342-2 4.438v11.562h1c8.284 0 15-6.716 15-15 0-7.312-5.262-13.297-12.188-14.625-1.334-13.664-12.797-24.375-26.812-24.375zm-25 34c-1.108 0-2 0.892-2 2v44c0 1.108 0.892 2 2 2h44c1.108 0 2-0.892 2-2v-44c0-1.108-0.892-2-2-2h-44zm6 8h32v28h-32v-28zm11 6v9h-5l10 11 10-11h-5v-9h-10z" />
<path
class="button-icon-fill"
d="m51 7c-9.465 0-17.679 4.816-22.5 12.188-0.497-0.036-0.994-0.188-1.5-0.188-11.598 0-21 9.402-21 21 0 9.871 6.821 18.158 16 20.406v-10.968c-1.221-1.096-2-2.66-2-4.438 0-3.324 2.676-6 6-6h44c3.324 0 6 2.676 6 6 0 1.778-0.779 3.342-2 4.438v11.562h1c8.284 0 15-6.716 15-15 0-7.312-5.262-13.297-12.188-14.625-1.334-13.664-12.797-24.375-26.812-24.375zm-25 34c-1.108 0-2 0.892-2 2v44c0 1.108 0.892 2 2 2h44c1.108 0 2-0.892 2-2v-44c0-1.108-0.892-2-2-2h-44zm6 8h32v28h-32v-28zm11 6v9h-5l10 11 10-11h-5v-9h-10z" />
</svg>
<span class="button-text">Receive a photo</span>
</button>
<!-- Send Button -->
<button id="send">
<svg height="96" width="96" version="1.1" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: relative;" >
<path
class="button-icon-shadow"
d="m45 8c-14.015 0-25.478 10.711-26.812 24.375-6.926 1.328-12.188 7.313-12.188 14.625 0 8.284 6.716 15 15 15h1v-11.562c-1.221-1.096-2-2.66-2-4.438 0-3.324 2.676-6 6-6h44c3.324 0 6 2.676 6 6 0 1.778-0.779 3.342-2 4.438v10.968c9.179-2.248 16-10.535 16-20.406 0-11.598-9.402-21-21-21-0.506 0-1.003 0.152-1.5 0.188-4.821-7.372-13.035-12.188-22.5-12.188zm-19 34c-1.108 0-2 0.892-2 2v44c0 1.108 0.892 2 2 2h44c1.108 0 2-0.892 2-2v-44c0-1.108-0.892-2-2-2h-44zm6 8h32v28h-32v-28zm16 4l-10 11h5v9h10v-9h5l-10-11z" />
<path
class="button-icon-fill"
d="m45 7c-14.015 0-25.478 10.711-26.812 24.375-6.926 1.328-12.188 7.313-12.188 14.625 0 8.284 6.716 15 15 15h1v-11.562c-1.221-1.096-2-2.66-2-4.438 0-3.324 2.676-6 6-6h44c3.324 0 6 2.676 6 6 0 1.778-0.779 3.342-2 4.438v10.968c9.179-2.248 16-10.535 16-20.406 0-11.598-9.402-21-21-21-0.506 0-1.003 0.152-1.5 0.188-4.821-7.372-13.035-12.188-22.5-12.188zm-19 34c-1.108 0-2 0.892-2 2v44c0 1.108 0.892 2 2 2h44c1.108 0 2-0.892 2-2v-44c0-1.108-0.892-2-2-2h-44zm6 8h32v28h-32v-28zm16 4l-10 11h5v9h10v-9h5l-10-11z" />
</svg>
<span class="button-text">Send a photo to someone next to you</span></button>
</div>
<!-- About Dialog -->
<div id="about" class="modal">
<div>
<a href="#" class="close">
<span><svg height="24" width="24" version="1.1" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: relative;" >
<path
class="close-icon-back"
d="M 23,12 A 11,11 0 0 1 1,12 11,11 0 1 1 23,12 z" />
<path
class="close-icon-fill"
d="M 12,0 C 5.3726,0 0,5.3726 0,12 0,18.627 5.3726,24 12,24 18.627,24 24,18.627 24,12 24,5.3726 18.627,0 12,0 z m 0,2 C 17.523,2 22,6.4772 22,12 22,17.523 17.523,22 12,22 6.4772,22 2,17.523 2,12 2,6.4772 6.4772,2 12,2 z M 8,8 V 9 C 8,9.277 8.1005,9.538 8.2812,9.7188 L 10.562,12 8.2812,14.281 C 8.1005,14.462 8.0994,14.741 8,15 v 1 h 1 c 0.277,0 0.538,-0.1005 0.71875,-0.28125 l 2.2812,-2.281 2.281,2.281 c 0.181,0.181 0.454,0.201 0.719,0.281 h 1 v -1 c 0,-0.277 -0.1005,-0.538 -0.28125,-0.71875 L 13.4377,12 15.7187,9.7188 C 15.8997,9.538 15.9997,9.277 15.9997,9 V 8 h -1 c -0.277,0 -0.538,0.1005 -0.719,0.2812 L 11.9997,10.562 9.7185,8.2812 C 9.5377,8.1005 9.2767,8 8.9997,8 z" />
</svg></span>
</a>
<h1>soonsnap</h1>
<p>Share just-taken photos with people standing next to you.</p>
<p>Soonsnap is <a href="https://github.com/stuartlangridge/pubphoto">open source</a> & is licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache License 2.0</a></p>
<p>Created by <a href="http://kryogenix.org" target="_blank">Stuart Langridge</a> & designed by <a href="http://snwh.org" target="_blank">Sam Hewitt</a></p>
</div>
</div>
<!-- Waiting -->
<div id="wait_for_transmission" class="page waiting">
<p class="waiting">Waiting for the photo...</p>
<a id="download" class="completed" href="#" download="image.jpg">
<svg height="96" width="96" version="1.1" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: absolute; left: 50%; margin-left: -48px; top: 5px;" >
<path
class="button-icon-shadow"
d="m51 8c-9.465 0-17.679 4.816-22.5 12.188-0.497-0.036-0.994-0.188-1.5-0.188-11.598 0-21 9.402-21 21 0 9.871 6.821 18.158 16 20.406v-10.968c-1.221-1.096-2-2.66-2-4.438 0-3.324 2.676-6 6-6h44c3.324 0 6 2.676 6 6 0 1.778-0.779 3.342-2 4.438v11.562h1c8.284 0 15-6.716 15-15 0-7.312-5.262-13.297-12.188-14.625-1.334-13.664-12.797-24.375-26.812-24.375zm-25 34c-1.108 0-2 0.892-2 2v44c0 1.108 0.892 2 2 2h44c1.108 0 2-0.892 2-2v-44c0-1.108-0.892-2-2-2h-44zm6 8h32v28h-32v-28zm11 6v9h-5l10 11 10-11h-5v-9h-10z" />
<path
class="button-icon-fill"
d="m51 7c-9.465 0-17.679 4.816-22.5 12.188-0.497-0.036-0.994-0.188-1.5-0.188-11.598 0-21 9.402-21 21 0 9.871 6.821 18.158 16 20.406v-10.968c-1.221-1.096-2-2.66-2-4.438 0-3.324 2.676-6 6-6h44c3.324 0 6 2.676 6 6 0 1.778-0.779 3.342-2 4.438v11.562h1c8.284 0 15-6.716 15-15 0-7.312-5.262-13.297-12.188-14.625-1.334-13.664-12.797-24.375-26.812-24.375zm-25 34c-1.108 0-2 0.892-2 2v44c0 1.108 0.892 2 2 2h44c1.108 0 2-0.892 2-2v-44c0-1.108-0.892-2-2-2h-44zm6 8h32v28h-32v-28zm11 6v9h-5l10 11 10-11h-5v-9h-10z" />
</svg>
<span class="button-text">Save Photo</span></a>
<p class="no-download-attr completed">Press & hold the image to save it to your device.</p>
<div class="received-image"><img></div>
</div>
<!-- Send Page 1 -->
<div id="sendp1" class="page">
<label class="file-input-button">Take or Choose a Photo<input class="xcustom-file-input" type="file" xcapture="camera" xcapture accept="image/*" id="cameraInput"></label>
</div></a>
<!-- Send Page 2 -->
<div id="sendp2" class="page sending">
<div class="page-content">
<p class="sending">Tell the recipient of your photo to go to soonsnap.com, press "Receive a Photo",
then enter their secret key: </p>
<p class="secret-key sending">x</p>
<p id="send_status" class="sending received">Waiting for them to start…
<div id="loader" class="">
<span></span>
<span></span>
<span></span>
</div>
</p>
<div id="send_another" class="invisible"><a href="/" class="received button-text">Send another photo?</a></div>
</div>
</div>
<!-- Error -->
<div id="server-error" class="page">
<div class="page-content">
<p>There was a problem. :-(</p>
<p id="error-message"></p>
<p><a href="/">Start again</a></p>
</div>
</div>
<!-- Scripts -->
<script src="/socket.io/socket.io.js"></script>
<script src="/megapix-image.js"></script>
<script>
(function () {
if (typeof window.Element === "undefined" || "classList" in document.documentElement) return;
var prototype = Array.prototype,
push = prototype.push,
splice = prototype.splice,
join = prototype.join;
function DOMTokenList(el) {
this.el = el;
// The className needs to be trimmed and split on whitespace
// to retrieve a list of classes.
var classes = el.className.replace(/^\s+|\s+$/g,'').split(/\s+/);
for (var i = 0; i < classes.length; i++) {
push.call(this, classes[i]);
}
};
DOMTokenList.prototype = {
add: function(token) {
if(this.contains(token)) return;
push.call(this, token);
this.el.className = this.toString();
},
contains: function(token) {
return this.el.className.indexOf(token) != -1;
},
item: function(index) {
return this[index] || null;
},
remove: function(token) {
if (!this.contains(token)) return;
for (var i = 0; i < this.length; i++) {
if (this[i] == token) break;
}
splice.call(this, i, 1);
this.el.className = this.toString();
},
toString: function() {
return join.call(this, ' ');
},
toggle: function(token) {
if (!this.contains(token)) {
this.add(token);
} else {
this.remove(token);
}
return this.contains(token);
}
};
window.DOMTokenList = DOMTokenList;
function defineElementGetter (obj, prop, getter) {
if (Object.defineProperty) {
Object.defineProperty(obj, prop,{
get : getter
});
} else {
obj.__defineGetter__(prop, getter);
}
}
defineElementGetter(Element.prototype, 'classList', function () {
return new DOMTokenList(this);
});
})();
document.body.classList.add("download" in document.createElement("a") ? "supports-download-attr" : "not-supports-download-attr");
var CHARS = "0123456789ACFHNRUWXY".split("");
var CODE_LENGTH = 4;
var BUTTONS_PAGES = [];
for (var codechar=0; codechar < CODE_LENGTH; codechar++) {
var rp = document.createElement("div");
rp.className = "page buttons";
var h2 = document.createElement("h2");
var h1 = document.createElement("h1");
h2.className = "receive-title";
h1.className = "key";
h2.appendChild(document.createTextNode("Enter your secret key."));
h1.appendChild(document.createTextNode(Array(CODE_LENGTH+1).join("_").split("").join(" ")));
rp.appendChild(h2);
rp.appendChild(h1);
rp.setAttribute("id", "receivep" + (codechar + 1));
document.body.appendChild(rp);
BUTTONS_PAGES.push(rp);
}
CHARS.forEach(function(c) {
var buttons = [];
for (var codechar=0; codechar < CODE_LENGTH; codechar++) {
var b = document.createElement("button");
b.appendChild(document.createTextNode(c));
BUTTONS_PAGES[codechar].appendChild(b);
buttons.push(b);
(function(index) {
function clickhdl(e) {
e.preventDefault();
if (index < (buttons.length-1)) {
// this is an interim button. Update the printed key on each page
BUTTONS_PAGES.forEach(function(page) {
var key = page.querySelector("h1.key");
key.innerHTML = key.innerHTML.replace("_", c);
});
// Hide all later buttons
for (var hidebutton=index; hidebutton < buttons.length; hidebutton++) {
buttons[hidebutton].style.display = "none";
buttons[hidebutton].classList.add("hidden");
}
// and move on to the next page
BUTTONS_PAGES[index].classList.remove("active");
BUTTONS_PAGES[index+1].classList.add("active");
} else {
// this is the last button
BUTTONS_PAGES.forEach(function(page) {
var key = page.querySelector("h1.key");
key.innerHTML = key.innerHTML.replace("_", c);
});
BUTTONS_PAGES[index].classList.remove("active");
document.getElementById("wait_for_transmission").classList.add("active");
var slot = BUTTONS_PAGES[index].querySelector("h1.key").innerHTML.replace(/ /g, "");
console.log("Sending request_from_slot to slot", slot);
socket.emit("request_from_slot", {slot:slot});
console.log("Now waiting for transmission");
}
}
b.addEventListener("click", clickhdl, false);
b.addEventListener("touchstart", clickhdl, false);
})(codechar);
}
});
for (var codechar=0; codechar < CODE_LENGTH; codechar++) {
// backspace button
if (codechar > 0) {
console.log("creating backspace button");
var backspace = document.createElement("button");
backspace.innerHTML = "×";
backspace.className = "backspace";
BUTTONS_PAGES[codechar].appendChild(backspace);
function bshdl(e) {
e.preventDefault();
Array.prototype.slice.call(document.querySelectorAll("h1.key")).forEach(function(key) {
key.firstChild.nodeValue = Array(CODE_LENGTH+1).join("_").split("").join(" ");
});
document.querySelector(".page.active").classList.remove("active");
Array.prototype.slice.call(document.querySelectorAll("button.hidden")).forEach(function(hb) {
hb.style.display = "block";
hb.classList.remove("hidden");
});
BUTTONS_PAGES[0].classList.add("active");
}
backspace.addEventListener("click", bshdl, false);
backspace.addEventListener("touchstart", bshdl, false);
}
}
function serverErrorHandler(data) {
document.getElementById("error-message").innerHTML = data.text;
document.querySelector(".page.active").classList.remove("active");
document.getElementById("server-error").classList.add("active");
}
function socketErrorHandler(data) {
console.log("got socket error! " + JSON.stringify(data));
}
var socket = io.connect('/');
socket.on("servererror", serverErrorHandler);
socket.on("error", socketErrorHandler);
function sendhdl(e) {
e.preventDefault();
// show send screen
document.getElementById("front").classList.remove("active");
document.getElementById("sendp1").classList.add("active");
// set up socket
socket.on('slot_answer', function (data) {
document.querySelector(".secret-key").innerHTML = '"' + data.slot.split("").join(" ") + '"';
console.log("slot answer after", (new Date().getTime()) - now); now = (new Date()).getTime();
console.log("got a slot answer", data, "and now waiting for transmit_now");
socket.on('transmit_now', function () {
socket.on('got_all', function () {
document.getElementById("send_status").firstChild.nodeValue = "Received OK!";
document.getElementById("loader").classList.add("invisible");
var sendp2 = document.getElementById("sendp2");
// set explicit heights so that the transition works
[].slice.call(sendp2.querySelectorAll("p")).forEach(function(p) {
p.style.height = p.offsetHeight + "px";
});
sendp2.classList.remove("sending");
sendp2.classList.add("end-sending");
setTimeout(function() {
sendp2.classList.remove("end-sending");
sendp2.classList.add("received");
}, 600);
document.getElementById("send_another").classList.remove("invisible");
});
document.getElementById("send_status").firstChild.nodeValue = "Sending...";
console.log("got transmit_now; now transmitting data url");
var slices = dataurl.match(/.{1,10240}/g);
for (var i=0; i<slices.length; i++) {
socket.emit("transmission", {seq: i+1, of: slices.length, data: slices[i]});
}
});
});
}
document.getElementById("send").addEventListener("click", sendhdl, false);
document.getElementById("send").addEventListener("touchstart", sendhdl, false);
if(!("url" in window) && ("webkitURL" in window)) { window.URL = window.webkitURL; }
var dataurl, now;
var ci = document.getElementById("cameraInput");
ci.addEventListener("change", function(e) {
now = (new Date()).getTime(); console.log("change fired at", now);
if (e.target.files.length == 1 && e.target.files[0].type.indexOf("image/") == 0) {
document.querySelector(".secret-key").innerHTML = '<small>calculating…</small>';
document.getElementById("sendp1").classList.remove("active");
document.getElementById("sendp2").classList.add("active");
var img = new Image();
img.onload = function() {
console.log("img onload after", (new Date().getTime()) - now); now = (new Date()).getTime();
// fit image into 500x500 box
var targetwidth = 500, targetheight = 500;
var scalex1 = targetwidth, scaley1 = img.naturalHeight * targetwidth / img.naturalWidth,
scalex2 = img.naturalWidth * targetheight / img.naturalHeight, scaley2 = targetheight,
destwidth, destheight;
if (scalex2 > targetwidth) {
destwidth = Math.floor(scalex1), destheight = Math.floor(scaley1);
} else {
destwidth = Math.floor(scalex2), destheight = Math.floor(scaley2);
}
var c = document.createElement("canvas");
c.style.marginLeft = "10px";
c.style.position = "absolute";
c.style.border="3px solid red";
c.style.zIndex = "9";
//document.body.appendChild(c);
var ctx = c.getContext("2d");
c.width = destwidth;
c.height = destheight;
// Use megapiximage shim because iOS screws up image scaling in canvases. Le sigh.
var mp = new MegaPixImage(img);
mp.render(c, {width: destwidth, height: destheight});
dataurl = c.toDataURL("image/jpeg", 0.7);
//alert(img.naturalWidth + "," + img.naturalHeight + " : " + destwidth + "," + destheight + ", l:" + dataurl.length);
console.log("requesting slot after", (new Date().getTime()) - now); now = (new Date()).getTime();
socket.emit("request_slot");
var ii = document.createElement("img");
ii.style.marginLeft = "50px";
ii.style.position = "absolute";
ii.style.border="3px solid red";
ii.style.zIndex = "9";
ii.src = dataurl;
//document.body.appendChild(ii);
}
img.src = URL.createObjectURL(e.target.files[0]);
}
}, false);