-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
899 lines (831 loc) · 38 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
<!DOCTYPE html>
<head>
<base href="./">
<link rel="stylesheet" type="text/css" href="template_normal.min.css?v=1.115" />
<title>Facebook Developer Circle: São Paulo</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="robots" content="noindex, nofollow" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<!--Facebook meta-->
<meta property="og:title" content="Faça parte da comunidade!" />
<meta property="og:description"
content="Participe dos eventos, aprenda sobre novas tecnologias, interaja com a comunidade e se conecte com outros devs! :)" />
<meta property="og:image" content="./devc-banner.png" />
<meta property="og:image:width" content="200" />
<meta property="og:image:height" content="200" />
<!-- Twitter Card data -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Faça parte da comunidade!">
<meta name="twitter:description"
content="Participe dos eventos, aprenda sobre novas tecnologias, interaja com a comunidade e se conecte com outros devs! :)">
<meta name="twitter:image" content="./devc-banner.png">
<meta name="twitter:image:width" content="200">
<meta name="twitter:image:height" content="200">
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="Faça parte da comunidade!">
<meta itemprop="description"
content="Participe dos eventos, aprenda sobre novas tecnologias, interaja com a comunidade e se conecte com outros devs! :)">
<meta itemprop="image" content="./devc-banner.png">
</head>
<body ng-app="app" id="dsocial-body" ng-controller="ComplexController"
class="{{isColorLight(view.code.color1) ? 'darkTheme' : 'whiteTheme'}}">
<div class="loading-welcome active welcome-screen"
ng-style="{'background-color': view.code.welcome_extra.background || view.welcome_extra.background}"
style="background-color: #ffffff">
<div class="progress">
<div class="loading-bar indeterminate" ng-style="{'background-color': view.code.color1 || view.color1}">
</div>
</div>
<div class="helper"></div>
<img id="welcomeImg" imageonload ng-src="{{view.welcome_screen || 'devc-logo.png'}}" ng-style="{
'max-width': view.code.welcome_extra.zoom *2 || view.welcome_extra.zoom *2 + 'px',
'max-height': view.code.welcome_extra.zoom *2 || view.welcome_extra.zoom *2 + 'px',
'animation-iteration-count' : view.showPreview == 'infinite' ? 'infinite' : '',
'animation-direction' : view.showPreview == 'infinite' ? 'alternate' : ''
}">
</div>
<div class="vcard-template style2" id="rootElement">
<div ng-if="!view.code.avatar && !view.code.customHeaderImage">
<div class="solid-bgd" ng-style="setSolidBgd()">
</div>
</div>
<div ng-if="view.code.avatar || view.code.customHeaderImage">
<div class="blur-bgd hidden-sm hidden-xs"
ng-style="{'background': view.code.avatar.length > 0 || view.code.customHeaderImage !=undefined ? 'url(' + (view.code.avatar.length > 0 ? view.code.avatar : view.code.customHeaderImage.url) +')' : 'none'}"
ng-class="{'blur-no-avatar':!view.code.avatar && !view.code.customHeaderImage}">
</div>
</div>
<div class="bgd-shadow"></div>
<!-- <pre>avatar_extra: {{view.code.avatar_extra | json}}</pre>-->
<!-- <pre>welcome_extra: {{view.code.welcome_extra | json}}</pre>-->
<div class="page-home page">
<div class="vcard-header">
<div class="vcard-header-wrapper">
<div class="vcard-top-info avatar-container" ng-style="setAvatarExtra()">
</div>
<div class="event-section-title"
ng-class="{'shadow-2': !view.code.avatar || !view.code.customHeaderImage}"
ng-style="getBackgroundColor();">
<div class="event-content-container">
<div class="event-title dynamicTextColor">{{view.code.title}}</div>
<div class="event-teaser mt-10 dynamicTextColor"
ng-show="view.code.teaser && (view.code.avatar || view.code.customHeaderImage)">
{{view.code.teaser}}
</div>
</div>
</div>
</div>
</div>
<div class="event-body">
<div class="vcard-body-wrapper">
<div class="vcard-body">
<div id="devent-details">
<div class="channel-container event-teaser"
ng-if="view.code.avatar == '' && !view.code.customHeaderImage && view.code.teaser">
<span class="table-cell-middle">{{view.code.teaser}}</span>
</div>
<a ng-href="{{getChannelLink(channel)}}" target="{{!loadDemo ? '_blank' : '_self'}}"
class="channel-container" id="channel-item-{{channel.name}}"
ng-click="loadDemo ? callAction($event,'channelAction') : ''"
ng-repeat="channel in view.code.channels track by $index">
<div class="table-cell-middle1 pl-55 pos-relative">
<div class="channel-bgd-{{channel.name | toIconName}}"
ng-style="{top: channel.label ? 'calc(50% - 20px)' : 'calc(50% - 15px)'}">
<i ng-if="channel.name != 'Snapchat'"
class="icon-social-{{channel.name | toIconName}}"></i>
<svg ng-if="channel.name == 'Snapchat'" version="1.1" id="Ebene_1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="40px"
height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40"
xml:space="preserve">
<g>
<path stroke-linejoin="round" stroke="black" stroke-width="1" d="M29.8,25.6c-2.9-0.5-4.2-3.5-4.2-3.6c0,0,0,0,0,0c-0.2-0.4-0.2-0.7-0.1-0.9c0.2-0.5,0.8-0.7,1.3-0.8c0.1,0,0.2-0.1,0.3-0.1
c0.7-0.3,0.9-0.6,0.9-0.8c0-0.2-0.2-0.4-0.5-0.5l0,0c-0.1,0-0.2-0.1-0.3-0.1c-0.1,0-0.2,0-0.3,0.1c-0.4,0.2-0.7,0.3-1,0.3h0
c-0.4,0-0.5-0.2-0.6-0.2c0-0.2,0-0.4,0-0.6l0-0.1c0.1-1.4,0.2-3.1-0.2-4.1c-1.3-2.9-4-3.2-4.9-3.2l0,0c0,0-0.3,0-0.4,0
c-0.8,0-3.6,0.2-4.9,3.2c-0.4,1-0.3,2.7-0.2,4.1c0,0.2,0,0.4,0,0.6c0,0-0.2,0.2-0.6,0.2c-0.3,0-0.6-0.1-1-0.3c-0.1,0-0.1,0-0.2,0
c-0.3,0-0.7,0.2-0.8,0.5c0,0.2,0,0.5,0.9,0.9c0.1,0,0.2,0.1,0.3,0.1c0.4,0.1,1.1,0.3,1.3,0.8c0.1,0.3,0.1,0.6-0.1,0.9c0,0,0,0,0,0
c-0.1,0.1-1.3,3.1-4.2,3.6c-0.1,0-0.2,0.1-0.2,0.2c0,0,0,0.1,0,0.1c0.1,0.3,0.7,0.7,2.5,1c0.2,0,0.2,0.3,0.3,0.7
c0,0.2,0.1,0.3,0.1,0.5c0.1,0.2,0.2,0.2,0.3,0.2c0.1,0,0.3,0,0.4-0.1c0.3-0.1,0.7-0.1,1.1-0.1c0.3,0,0.5,0,0.8,0.1
c0.6,0.1,1,0.4,1.6,0.8c0.7,0.5,1.5,1.1,2.7,1.1c0,0,0.1,0,0.1,0h0c0.1,0,0.1,0,0.2,0c1.2,0,1.9-0.5,2.7-1.1c0.5-0.4,1-0.7,1.5-0.8
c0.3,0,0.6-0.1,0.8-0.1c0.5,0,0.8,0.1,1.1,0.1c0.2,0,0.3,0.1,0.4,0.1h0c0.1,0,0.2-0.1,0.3-0.2c0-0.2,0.1-0.3,0.1-0.5
c0.1-0.4,0.2-0.6,0.3-0.7c1.9-0.3,2.4-0.7,2.5-1c0,0,0-0.1,0-0.1C30,25.7,29.9,25.6,29.8,25.6z" fill="white"></path>
</g>
</svg>
</div>
<div class="channel-prop-container"
ng-class="{'pull-left': channel.link && channel.label && channel.name == 'Website', 'pull-left mt-101 height-301': channel.link && !channel.label && channel.name == 'Website', 'pt-10': !channel.label}">
<span ng-if="channel.name == 'Website'">
<span ng-if="channel.label">
<div class="channel-name" ng-class="{'mb-5': channel.label}">
{{channel.label}}
</div>
<div class="channel-label">
{{getChannelNameOrLink(channel)}}
</div>
</span>
<span ng-if="!channel.label">
<div class="channel-name" ng-class="{'mb-5': channel.label}">
{{getChannelNameOrLink(channel)}}
</div>
<div class="channel-label">
{{channel.label}}
</div>
</span>
</span>
<span ng-if="channel.name != 'Website'">
<div class="channel-name" ng-class="{'mb-5': channel.label}">
{{getChannelNameOrLink(channel)}}
</div>
<div class="channel-label">
{{channel.label}}
</div>
</span>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="jquery.min.js?v=1.115"></script>
<script type="text/javascript" src="angular.rendering.min.js?v=1.115"></script>
<script type="text/javascript">
/*<![CDATA[*/
/**
* Angular connection
*/
app.loadBasePreviewController();
/**
* Replace a point with a space character
*/
app.filter('point2space', function () {
return function (input) {
if (input) {
return input.replace(/\./g, ' ');
}
}
});
/**
* Return date in number format '1490189463876'
*
* @param input - date
* */
app.filter('toDay', function () {
return function (input) {
if (input) {
var result = new Date(input).getTime();
return result || '';
} else
return '';
};
});
/**
* Return value with '-' instead of spaces
*
* @param input - string
* */
app.filter('dashEncode', function () {
return function (input) {
if (input) {
return input.replace(/ /g, "-");
} else
return ' ';
};
});
/**
* Return escape value of param
*
* @param input - string
* */
app.filter('escape', function () {
return function (input) {
if (input) {
return escape(input);
} else
return ' ';
};
});
/**
* Return icon name based on the channel name
* */
app.filter('toIconName', function () {
return function (input) {
if (input) {
return input.replace(/\s+/g, '').toLowerCase();
} else
return ' ';
};
});
/**
* Return link with the correct prefix
* */
app.filter('prefixChannel', ['$filter', function ($filter) {
return function (input, name) {
if (input) {
switch (name) {
case ('Twitter'):
return $filter('prefixURL')('www.twitter.com/' + input);
break;
case ('Instagram'):
return $filter('prefixURL')('www.instagram.com/' + input);
break;
case ('Snapchat'):
return $filter('prefixURL')('www.snapchat.com/add/' + input);
break;
case ('WeChat'):
return 'weixin://dl/chat?' + input;
break;
case ('Skype'):
return 'skype:' + input + '?add';
break;
case ('Line'):
return $filter('prefixURL')('http://line.naver.jp/ti/p/@' + input);
break;
default:
return $filter('prefixURL')(input);
break;
}
} else
return ' ';
};
}]);
/**
* Return domain of input
* */
app.filter('domain', function () {
return function (input) {
if (input.indexOf('://') >= 0) {
return input.split('/')[2]
}
return input.split('/')[0]
};
});
/**
* The QR service for the app.
* */
app.service('qr', function () {
/**
* Scroll page from buttom to top
* */
this.scrollFromBottomtoTop = function (loadDemo) {
setTimeout(function () {
if (loadDemo == true) {
$("html, body").animate({
scrollTop: $('.channel-container:last-child').offset().top
}, 0);
$("html, body").animate({
scrollTop: 0
}, 1000);
}
}, 0)
}
});
/**
* Directive
*
* When image is loaded fadeout welcome screen
* */
app.directive('imageonload', ['qr', function (qr) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.bind('load', function () {
$("#welcomeImg").fadeIn(1000);
window.setTimeout(function () {
$(".loading-welcome.welcome-screen").fadeOut();
scope.welcomeScreenScrollWindow++;
if (scope.welcomeScreenScrollWindow == 1) {
qr.scrollFromBottomtoTop(scope.loadDemo)
}
}, 2000);
});
element.bind('error', function () {});
}
};
}]);
//Override the base preview controller
app.controller('ComplexController', function ($scope, $controller, $sce, $rootScope, $filter, previewService,
$window) {
$scope.welcomeScreenScrollWindow = 0;
/**
* Get channel name from channel item
*
* @param channel
* */
$scope.getChannelLink = function (channel) {
if (!$scope.loadDemo) {
return $filter('prefixChannel')(channel.link, channel.name);
}
return '#channel-item-' + channel.name;
};
/**
* Get channel name or link to the channel based on channel info
*
* @param channel
* */
$scope.getChannelNameOrLink = function (channel) {
if (channel.name == 'Website')
if (channel.link) {
return $scope.loadDemo ? channel.link : $filter('domain')(channel.link);
} else {
return channel.name;
}
else {
return channel.name;
}
};
/**
* Set solid background for the header based on the title section height
* */
$scope.setSolidBgd = function () {
if ($scope.view.code) {
var titleSectionHeight = 142;
setTimeout(function () {
if ($scope.view.code.teaser) {
titleSectionHeight = $('.event-content-container').parent()
.outerHeight() + 60 + 128
} else
titleSectionHeight = $('.event-content-container').parent()
.outerHeight() + 60;
$('.solid-bgd').css({
'background-color': $scope.view.code.color1 ? $scope.view.code
.color1 : '#447fb6',
'height': !$scope.view.code.avatar ? titleSectionHeight + 'px' :
'420px'
})
}, 0);
}
};
/**
* Open the dialog popup
* Event is for getting the current target element
* Target:
* - shareAction: Button with got it information
* - channelAction: Button with got it information
*
* @param event - string
* @param target - string
* */
$scope.callAction = function (event, target) {
switch (target) {
case 'shareAction':
if ($scope.loadDemo) {
$scope.gotItText =
'Seus contatos podem clicar neste botão para compartilhar sua página.';
$scope.toggleDialog('gotIt', $(event.currentTarget));
}
break;
case 'channelAction':
if ($scope.loadDemo) {
$scope.gotItText =
'Ao clicar aqui, os usuários serão direcionados para o link da mídia social ou website.';
$scope.toggleDialog('gotIt', $(event.currentTarget));
}
break;
}
};
/**
* Toggle dialog
*
* @param id - string
* @param element - current target
* */
$scope.toggleDialog = function (id, element) {
if (element) {
var elem = element.context.outerHTML;
$('#' + id + ' .dialog-container .event-gotIt-button').html(elem);
}
$($('#' + id).parent()).toggleClass('fabOnTop');
$('#' + id + ' .dialog-container').toggleClass('is-visible');
$('#prime.fab').toggleClass('disabledClick');
$('#' + id + ' .fixed-blur-bgd').toggle();
};
/**
* Callback of the dialog yes/no buttons
* Can close the dialog or it can redirect to a url and close the dialog
* If the url is not defined it will use the targetUrl from the callAction button
*
* @param proceed - string
* @param url - current target
* */
$scope.dialogRedirectCallback = function (proceed, url) {
if (proceed) {
if (url) {
$window.open(url, '_blank');
} else {
if ($scope.view.code.callToAction.targetUrl.indexOf('http') < 0)
$window.open('//' + $scope.view.code.callToAction.targetUrl, '_blank');
else
$window.open($scope.view.code.callToAction.targetUrl, '_blank');
}
$scope.closeDialog();
} else {
$scope.closeDialog();
}
};
/**
* Close dialog
*
* */
$scope.closeDialog = function () {
$('.dialog-container').removeClass('is-visible');
$('#prime.fab').toggleClass('disabledClick');
$('.event-gotIt-button').html('');
$('.fixed-blur-bgd').hide();
};
/**
* Set position of the fab Button
*If we have only one fab you have to use bottom 5px!!! else use 75px as default
* @param buttonName - string
* */
$scope.setPosition = function (buttonName) {
if ($(window).innerWidth() < 667) {
var bottom = '5px',
right = '17px';
if (buttonName == 'calendar')
bottom = '5px';
if ($(window).innerWidth() < 321)
right = '-85px';
return {
'position': 'fixed',
'bottom': bottom,
'right': right,
'width': '80px'
}
}
return '';
};
//Inherrit from basePreviewController
angular.extend(this, $controller('BasePreviewController', {
$scope: $scope
}));
$scope.loadDemo = parent && typeof parent.ImHere === "function";
//Get the json data form the file
json_data = {
"form": [{
"section_design": {
"fold": false
}
}, {
"section_basic_info": {
"fold": false
}
}, {
"section_media_channels": {
"fold": false
}
}, {
"section_welcome_screen": {
"fold": false
}
}, {
"section_advance_options": {
"fold": false
}
}],
"code": {
"title": "Fa\u00e7a parte da comunidade!",
"teaser": "Participe dos eventos, aprenda sobre novas tecnologias, interaja com a comunidade e se conecte com outros devs! :)",
"channels": [{
"input_prefix_label": "URL",
"label": "Entre em nosso grupo do Facebook!",
"name": "Facebook",
"link": "https:\/\/www.facebook.com\/groups\/DevCSaoPaulo\/"
}, {
"input_prefix_label": "@",
"link": "devcsp",
"label": "Siga-nos no Instagram!",
"name": "Instagram"
}, {
"input_prefix_label": "URL",
"link": "https://www.youtube.com/channel/UC3TsOcCR48Lq-6z_G_xq-DQ/",
"label": "Siga-nos no YouTube!",
"name": "YouTube"
// }, {
// "input_prefix_label": "URL",
// "link": "https:\/\/meetup.com\/DevCSP",
// "label": "Nos acompanhe pelo Meetup.com",
// "name": "LinkedIn"
// }, {
// "input_prefix_label": "URL",
// "link": "https:\/\/meetup.com\/DevCSP",
// "label": "Nos acompanhe pelo Meetup.com",
// "name": "Twitter"
}, {
"input_prefix_label": "URL",
"link": "https:\/\/meetup.com\/DevCSP",
"label": "Meetup.com",
"name": "Website"
}],
"color1": "#447fb6",
"color2": "#e91e63",
"avatar": "devc-banner.png",
"avatar_extra": {
"zoom": 100,
"background": "#ffffff"
},
"welcome_extra": {
"zoom": 96,
"background": "#ffffff"
}
},
"showPreview": 0,
"sharing": false
};
//Upgrade old vcards created before 13.04 with show_directions parameter
if (angular.isUndefined(json_data.show_directions))
json_data.show_directions = true;
previewService.pushData(json_data);
function setAvatarBackgroundImage() {
if ($scope.view.code) {
if ($scope.view.code.avatar)
return {
'background': 'url(' + $scope.view.code.avatar + ')'
};
else return {
'height': '0px',
'background': 'none'
}
}
}
function getBackgroundColor() {
if ($scope.view.code) {
var color1 = $scope.view.code.color1 || '#607d8b';
if (!$scope.view.code.show_gradient)
return {
"background": color1
};
}
}
$scope.getBackgroundColor = getBackgroundColor;
$scope.setAvatarBackgroundImage = setAvatarBackgroundImage;
window.setTimeout(function () {
$(".loading-vcard").fadeOut();
$(".vcard-functions-wrapper a:visible:last").addClass("last-element");
}, 500);
/**
* Copy short ulr to clipboard
*
* @param elem - input element with the link
* */
$scope.ifCopySucceed = false;
$scope.copyLinkToClipboard = function (elem) {
var targetId = "_hiddenCopyText_";
var isInput = elem.tagName === "INPUT" || elem.tagName === "TEXTAREA";
var origSelectionStart, origSelectionEnd;
if (isInput) {
// can just use the original source element for the selection and copy
target = elem;
origSelectionStart = elem.selectionStart;
origSelectionEnd = elem.selectionEnd;
} else {
// must use a temporary form element for the selection and copy
target = document.getElementById(targetId);
if (!target) {
var target = document.createElement("textarea");
target.style.position = "absolute";
target.style.left = "-9999px";
target.style.top = "0";
target.id = targetId;
document.body.appendChild(target);
}
target.textContent = elem.textContent;
}
// select the content
var currentFocus = document.activeElement;
target.focus();
target.setSelectionRange(0, target.value.length);
// copy the selection
var succeed;
try {
succeed = document.execCommand("copy");
} catch (e) {
succeed = false;
}
// restore original focus
if (currentFocus && typeof currentFocus.focus === "function") {
currentFocus.focus();
}
if (isInput) {
// restore prior selection
elem.setSelectionRange(origSelectionStart, origSelectionEnd);
} else {
// clear temporary content
target.textContent = "";
}
$scope.$apply(function () {
$scope.ifCopySucceed = succeed;
});
setTimeout(function () {
$scope.$apply(function () {
$scope.ifCopySucceed = false;
});
}, 1500)
};
/**
* Set text color based on the background
*
* @param color - background color
* */
$scope.isColorLight = function (color) {
var c;
if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(color)) {
c = color.substring(1).split('');
if (c.length == 3) {
c = [c[0], c[0], c[1], c[1], c[2], c[2]];
}
c = '0x' + c.join('');
var r = (c >> 16) & 255,
g = (c >> 8) & 255,
b = c & 255;
// Counting the perceptive luminance
// human eye favors green color...
var a = 1 - (0.240 * r + 0.470 * g + 0.150 * b) / 255;
return (a < 0.4);
}
};
/**
* Watch showPreview value
*
* @param p1 - new value
* @param p2 - old value
* */
$scope.$watch("view.showPreview", function (p1, p2, p3) {
if (p1 != undefined && p1 == 'infinite') {
setTimeout(function () {
$(".loading-welcome.welcome-screen").show();
$("#welcomeImg").fadeIn(1000);
}, 500)
} else if (p1 == undefined && p2 != undefined && p2 == 'infinite') {
$("#welcomeImg").hide();
$(".loading-welcome").fadeOut();
} else if ((p1 != undefined && p2 != undefined && p1 != p2) || (p1 != undefined && p1 !=
0 && p2 == undefined && p1 != p2)) {
setTimeout(function () {
$(".loading-welcome.welcome-screen").show();
$("#welcomeImg").hide();
$("#welcomeImg").fadeIn(1000);
setTimeout(function () {
$(".loading-welcome").fadeOut();
}, 2000)
}, 500)
}
});
$scope.setAvatar = function () {
return {
'background': $scope.view.code.avatar ? 'url(' + $scope.view.code.avatar + ')' : 'none'
}
};
/**
* Set avatar background with extra options like zoom and background color
* */
$scope.setAvatarExtra = function () {
var style = {};
if ($scope.view.code) {
/*
* Apply custom header image and background color
* */
if ($scope.view.code.customHeaderImage && $scope.view.code.customHeaderImage.url) {
if ($scope.view.code.customHeaderImage.color != null) {
style = {
'background-color': $scope.view.code.customHeaderImage.color,
'-webkit-mask': 'url("' + $scope.view.code.customHeaderImage.url +
'") no-repeat 50% 50%',
'mask': 'url("' + $scope.view.code.customHeaderImage.url +
'") no-repeat 50% 50%',
'-webkit-mask-size': 'cover',
'mask-size': 'cover'
};
$('.vcard-top-info.avatar-container').css('background-color', $scope.view.code
.customHeaderImage.color);
} else
style = {
'background-image': 'url("' + $scope.view.code.customHeaderImage.url + '")',
'background-size': '100%'
}
} else if ($scope.view.code.avatar)
style = {
'background': 'url("' + $scope.view.code.avatar + '")',
'background-size': '100%!important',
'background-color': '#ffffff'
};
else
style = {
'height': '0px',
'background': 'none'
};
if ($scope.view.code.avatar_extra) {
style['background-size'] = $scope.view.code.avatar_extra.zoom + '%';
if (!($scope.view.code.customHeaderImage && $scope.view.code.customHeaderImage
.url && $scope.view.code.customHeaderImage.color != null)) {
style['background-color'] = $scope.view.code.avatar_extra.background;
}
}
}
// Convert array to string to avoid problems with vendor prefixes.
var string_style = '';
angular.forEach(style, function (value, key) {
string_style += key + ': ' + value + ';';
});
// Bad solution, but works (Alex).
$('.vcard-top-info.avatar-container').attr('style', string_style);
return {};
};
/**
* Watch avatarExtra values and set the css
* */
$scope.$watch('view.code.avatar_extra', function (newVal) {
if (newVal) {
$('.avatar-container').css({
'background-size': newVal.zoom + '%!important',
'background-color': newVal.background,
'background-position': 'center center'
});
}
});
});
if (parent && typeof parent.ImHere === "function") {
parent.ImHere();
} else {
//Only load this on standalone pages not inframe working
SocialShareKit.init();
}
/**
* Toggle fab
*
* @param id - id of the fab
*/
function toggleFab(id) {
$(id + ' .prime').toggleClass('is-active');
$(id + ' #prime').toggleClass('is-float');
$($(id).parent()).toggleClass('fabOnTop');
$('#prime.fab').toggleClass('disabledClick');
$(id + ' .fixed-blur-bgd').toggle();
$(id + ' .chat').toggleClass('is-visible');
}
$(document).ready(function () {
/**
* On window resize if width is bigger then tablet remove calendar and share mobile style
* */
$(window).resize(function () {
if (window.innerWidth >= 667) {
$('.follow-scroll.calendar-container').removeAttr('style');
$('.follow-scroll.share-container').removeAttr('style');
}
});
/**
* Close fab from close icon
* */
$('#prime, .icon-fab-close').click(function () {
var id = $($(this).closest('.fabs')).attr('id');
toggleFab('#' + id);
});
/**
* Close fab on blur bgd click
* */
$('.fixed-blur-bgd').click(function () {
if (event.target == $(this)[0]) {
$($("#prime.is-float").parent().parent()).removeClass('fabOnTop');
$('.prime').removeClass('is-active');
$('#prime').removeClass('is-float');
$('#prime.fab').removeClass('disabledClick');
$('.chat, .dialog-container').removeClass('is-visible');
$(this).hide();
}
});
/**
* Ripple effect on element
*/
var ink, d, x, y;
$(".ripplelink").click(function (e) {
if ($(this).find(".ink").length === 0) {
$(this).prepend("<span class='ink'></span>");
}
ink = $(this).find(".ink");
ink.removeClass("animate");
if (!ink.height() && !ink.width()) {
d = Math.max($(this).outerWidth(), $(this).outerHeight());
ink.css({
height: d,
width: d
});
}
x = e.pageX - $(this).offset().left - ink.width() / 2;
y = e.pageY - $(this).offset().top - ink.height() / 2;
ink.css({
top: y + 'px',
left: x + 'px'
}).addClass("animate");
});
});
/*]]>*/
</script>
</body>
</body>
</html>