-
Notifications
You must be signed in to change notification settings - Fork 25
/
cardlist.html
1185 lines (1140 loc) · 42.8 KB
/
cardlist.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>
<html>
<head>
<style type="text/css">
:root {
--cr-toolbar-height: 56px;
--paper-icon-button-ink-color: white;
--md-background-color: #e62117;
--md-background-color-dark: #ba1b12;
--md-loading-message-color: #6e6e6e;
--md-toolbar-color: var(--md-background-color);
--search-color: #ffffff;
--search-color-darker: #dddddd;
}
html, body {
overflow-x: hidden;
}
body {
position: relative
}
#topBar{
display: flex;
background-color: var(--md-toolbar-color);
height: var(--cr-toolbar-height);
align-items: center;
color: var(--paper-icon-button-ink-color);
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
z-index: 999;
}
#topBarContent{
display: flex;
height: var(--cr-toolbar-height);
align-items: center;
z-index: 999;
width: 100%;
}
#title{
margin-left: 16px;
font-size: 123%;
font-weight: 400;
flex: 1;
}
#titleicon{
height: 32px;
}
#titleicon img,#titleicon svg{
margin-left: 16px;
height: 32px;
border-radius: 40px;
}
#topBarButtons{
text-align: right;
margin-right: 8px;
height: 32px;
}
#topBarButtons .button{
margin-top: 0px;
margin-right: 0px;
padding: 0px;
padding-right: 8px;
padding-left: 8px;
height: 32px;
}
#topBarButtons .button:hover {
transform: translateY(0px);
box-shadow: 0px 0px 0px #777;
}
#topBarButtons .button img{
width: 32px;
border-radius: 40px;
pointer-events: none;
}
#topBarButtons .button svg{
width: 32px;
height: 32px;
border-radius: 40px;
pointer-events: none;
fill: var(--search-color);
}
body {
font-family: Roboto, 'Segoe UI', Tahoma, sans-serif;
margin: 0px;
}
.card {
background: #fff;
border-radius: 2px;
display: inline-block;
margin: 4px;
margin-left: 4px;
margin-right: 4px;
position: relative;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
}
.card:hover {
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
}
.hidden{
display: none !important;
}
.invisible{
visibility: hidden !important;
}
#content{
display: flex;
flex-direction: column;
height: 100vh;
}
#results{
display: flex;
flex-direction: row;
flex-wrap: wrap;
overflow: auto;
flex: 1;
justify-content: space-around;
align-items: center;
}
/*#results .result:first-child {
margin-top: 8px;
}*/
.result{
//width: 100%;
padding: 24px;
cursor: pointer;
display: flex;
flex-direction: column;
}
.result .right{
display: flex;
flex-direction: column;
justify-content: center;
flex: 1;
}
.animated{
animation: move 0.5s ease forwards;
}
.result *{
pointer-events: none;
}
.result .button{
pointer-events: auto;
}
.result .thumbnailWrapper{
width: 100%;
display: flex;
justify-content: center;
flex-grow: 1;
}
.result .thumbnail{
max-height: 350px;
display: block;
max-width: 100%;
height: auto;
justify-self: center;
object-fit: contain;
}
.result .righttop{
display: flex;
}
.result .title{
font-size: 22px;
}
.result .titleright{
font-size: 22px;
text-align: right;
flex: 1;
}
.result .bottom{
display: flex;
margin: 8px;
}
.result .cardicon{
width: 50px;
height: 50px;
border-radius: 50px;
margin-right: 16px;
object-fit: cover;
//align-self: center;
}
.result .rightbottom{
display: flex;
margin-top: 8px;
font-size: 16px;
color: #666;
}
.result .subTextLeft{
margin-right: 8px;
}
.result .subTextRight{
margin-left: 8px;
}
.button {
display: inline-block;
text-align: center;
padding: 8px;
color: white;
transition: 300ms ease-in-out;
cursor: pointer;
margin-top: 8px;
margin-right: 4px;
}
.button:hover {
transform: translateY(-3px);
box-shadow: 0px 2px 20px #777;
}
.green {
background-color: var(--md-background-color);
border-bottom: 3px solid var(--md-background-color-dark);
}
#search{
margin-left: 8px;
flex-grow: 1;
display: flex;
align-content: center;
align-self: center;
justify-content: center;
}
#search svg{
fill: var(--search-color);
height: 32px;
width: 32px;
cursor: pointer;
align-self: center;
}
*::-webkit-input-placeholder {
color: var(--search-color-darker);
}
#searchinput {
font-size: 123%;
display: block;
width: 100%;
padding: 10px 5px;
background: rgba(0, 0, 0, 0);
border: none;
outline: none;
color: var(--search-color);
/*
* IMPORTANT PART HERE
*/
/* 2 imgs : 1px gray line (normal state) AND 2px green line (focus state) */
//background-image: linear-gradient(to bottom, #1abc9c, #1abc9c), linear-gradient(to bottom, silver, silver);
/* sizes for the 2 images (default state) */
background-size: 0 2px, 100% 1px;
/* positions for the 2 images. Change both "50%" to "0%" or "100%" and tri again */
background-position: 50% 100%, 50% 100%;
/* animation solely on background-size */
transition: background-size 0.3s cubic-bezier(0.64, 0.09, 0.08, 1);
margin-left: 16px;
}
#searchinput:focus {
/* sizes for the 2 images (focus state) */
background-size: 100% 2px, 100% 1px;
outline: none;
}
@keyframes move {
from {
transform: translate(120%, 0px);
}
to {
transform: translate(0px, 0px);
}
}
.ripple{
overflow:hidden;
}
.ripple-effect{
position: absolute;
border-radius: 50%;
width: 50px;
height: 50px;
background: white;
animation: ripple-animation 2s;
}
@keyframes ripple-animation {
from {
transform: scale(1);
opacity: 0.4;
}
to {
transform: scale(100);
opacity: 0;
}
}
#swipedetector{
position: fixed;
width: 5px;
background-color: transparent;
height: 100vh;
}
#drawer{
position: fixed;
width: 80%;
left: -40vh;
z-index: 10000;
background-color: white;
transition: 1s;
height: 100vh;
animation: 500ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
display: flex;
flex-direction: column;
animation-name: drawer_close;
overflow-y: auto;
}
.draweritem{
cursor: pointer;
display: flex;
height: 48px;
align-items: center;
}
.draweritem *{
pointer-events: none;
}
.draweritem .icon{
margin-left: 16px;
width: 40px
}
.draweritem .icon img{
width: 24px;
height: 24px;
}
.draweritem .label{
margin-left: 16px;
font-size: 18px;
flex: 1;
}
#userinfo{
padding-top: 24px;
padding-left: 16px;
height: 124px;
color: #ffffff;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
}
#usertext{
height: 64px;
display: flex;
flex-direction: column;
justify-content: center;
font-size: 16px;
}
#username{
}
#usernick{
font-size: 90%;
}
#userimage{
}
#userimage img{
border-radius: 5000px;
height: 56px;
width: 56px;
}
</style>
<title>Card List</title>
<meta name="autotoolswebscreen" type="variablejs" group="Title" id="titleFromTasker" label="Title" description="Title to show at the top." hint="YouTube" />
<meta name="autotoolswebscreen" type="variablejs" group="Title" id="titleIcon" label="Title Icon" description="Icon to show on the left of the title" isIcon="true" />
<meta name="autotoolswebscreen" type="variablejs" group="Title" id="titleButtonIcon" label="Title Buttons Icons" description="List of icons to show on the right of the title, aligned to the right of the screen" isIcons="true" />
<meta name="autotoolswebscreen" type="variablejs" group="Title" id="titleButtonCommand" label="Title Button Commands" description="List of commands, one for each title button." />
<meta name="autotoolswebscreen" type="variablejs" subtype="boolean" group="Search" id="titleSearch" label="Title Search" description="If enabled, will add a search button on the top right which can filter the cards." />
<meta name="autotoolswebscreen" type="variablejs" group="Search" id="titleSearchColor" label="Search Color" description="Set the color of the search icon" isColor="true" defaultValue="#ffffff" />
<meta name="autotoolswebscreen" type="variablejs" subtype="boolean" group="Search" id="searchShouldFilter" label="Filter With Search" description="Enable to make the cards be filtered by what you search for" defaultValue="true" />
<meta name="autotoolswebscreen" type="variablejs" group="Search" id="titleSearchCommandPrefix" label="Command Prefix" description="Set the prefix for when search is submitted" defaultValue="search" />
<meta name="autotoolswebscreen" type="variablejs" subtype="boolean" group="Navigation Drawer" id="drawerEnable" label="Enable Drawer" description="If enabled and not title icon is set, will use the hamburger icon by default" />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerItemLabel" label="Item Labels" description="List of items to add to the drawer" />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerItemIcon" label="Item Icons" description="List of icons for the drawer items" isIcons="true" />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerItemCommand" label="Item Commands" description="List of commands, one for each label" />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerItemCommandPrefix" label="Commands Prefix" description="If set will attach 'prefix=:=' to each command on the list" />
<meta name="autotoolswebscreen" type="variablejs" subtype="boolean" group="Navigation Drawer" id="drawerShowUser" label="Show User" description="If enabled, will show user info in the drawer. You can override pieces of it with the values below." />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerCover" label="Cover" description="Background for the top section in the drawer" isImage="true" />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerCoverColor" label="Cover Color" description="Instead of an image you can set a color as the background" isColor="true" />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerIcon" label="Icon" description="Icon for the top section in the drawer" isIcon="true" />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerTitle" label="Title" description="Title for the top section in the drawer" />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerSubtitle" label="Subtitle" description="Subtitle for the top section in the drawer" />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerCommand" label="Cover Command" description="AutoApps Command to be sent when clicking the top section in the drawer." />
<meta name="autotoolswebscreen" type="variablejs" group="Navigation Drawer" id="drawerWidth" label="Drawer Width" description="If no unit used, assumed to be pixels. Can use % to specify width related to the screen size" defaultValue="80%" />
<meta name="autotoolswebscreen" type="variablejs" group="Cards" id="cardTitle" label="Card Titles" description="List of titles, one for each card" />
<meta name="autotoolswebscreen" type="variablejs" group="Cards" id="cardTitleRight" label="Card Subtitle" description="List of subtitles, one for each card. Appear on the right of the title, aligned to the right" />
<meta name="autotoolswebscreen" type="variablejs" group="Cards" id="cardSubtextLeft" label="Card Subtext Left" description="List of texts to appear below the title, on the left, one for each card" />
<meta name="autotoolswebscreen" type="variablejs" group="Cards" id="cardSubtextRight" label="Card Subtext Right" description="List of texts to appear below the title, on the right, one for each card" />
<meta name="autotoolswebscreen" type="variablejs" group="Cards" id="cardCommand" label="Card Commands" description="List of commands, one for each card" />
<meta name="autotoolswebscreen" type="variablejs" group="Cards" id="cardCommandPrefix" label="Commands Prefix" description="If set will attach 'prefix=:=' to each command on the list" />
<meta name="autotoolswebscreen" type="variablejs" group="Cards" id="cardIcon" label="Card Icons" description="List of icons, one for each card. Will appear on the left of the title if set" isIcons="true" />
<meta name="autotoolswebscreen" type="variablejs" group="Cards" id="cardImage" label="Card Images" description="List of images, one for each card. Will appear above the title is set." isImages="true" />
<meta name="autotoolswebscreen" type="variablejs" group="Card Buttons" id="cardButton" label="Card Buttons" description="List of Button Labels that should appear on each card" />
<meta name="autotoolswebscreen" type="variablejs" group="Card Buttons" id="buttonCommand" label="Button Commands" description="List of commands, one for each button. Will add as a sufix to each card command." />
<meta name="autotoolswebscreen" type="variablejs" group="Colors" id="backgroundColor" label="Background Color" description="Background Color for the screen" isColor="true" />
<meta name="autotoolswebscreen" type="variablejs" group="Colors" id="cardBackgroundColor" label="Card Background Color" description="Background Color for the cards" isColor="true">
<meta name="autotoolswebscreen" type="variablejs" group="Colors" id="accentColor" label="Accent Color" description="Accent Color for the screen" isColor="true"/>
<meta name="autotoolswebscreen" type="variablejs" group="Layout" id="maxWidth" label="Max Card Width" description="Set the max width of the cards in either % or absolute value" hint="ie. 100% or 300" defaultValue="100%"/>
<meta name="autotoolswebscreen" type="variablejs" group="Layout" id="minWidth" label="Min Card Width" description="Set the min width of the cards in either % or absolute value" hint="ie. 30% or 150" />
<meta name="autotoolswebscreen" type="variablejs" group="Layout" id="maxHeight" label="Max Image Height" description="Set the max height of the images in the cards in pixels. This will control the height of the cards." hint="350" defaultValue="350"/>
<meta name="autotoolswebscreen" type="variablejs" group="Layout" id="titleTextSize" label="Title Text Size" description="Set the size of the text for the title" hint="22" defaultValue="22"/>
<meta name="autotoolswebscreen" type="variablejs" group="Layout" id="subtitleTextSize" label="Subtitle Text Size" description="Set the size of the text for the subtitle" hint="22" defaultValue="22"/>
<meta name="autotoolswebscreen" type="variablejs" group="Layout" id="cardPadding" label="Card Padding" description="Set the padding inside the card" hint="24" defaultValue="24"/>
<meta name="autotoolswebscreen" type="variablejs" group="Layout" id="cardAlign" label="Card Alignment" description="Define how the cards align vertically" options="Top,Center,Bottom" defaultValue="Center" />
<meta name="autotoolswebscreen" type="variablejs" group="Other" id="itemSeparator" label="Item Separator" description="Set which characters separates each item in the various lists" hint="," defaultValue=","/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</head>
<body>
<div class="result card hidden invisible">
<div class="thumbnailWrapper"><img class="thumbnail" /></div>
<div class="bottom">
<img class="cardicon" />
<div class="right">
<div class="righttop">
<div class="title">title</div>
<div class="titleright hidden">title right</div>
</div>
<div class="rightbottom">
<div class="subTextLeft"></div>
<div class="subTextSeparator"> • </div>
<div class="subTextRight"></div>
</div>
</div>
</div>
<div class="buttons"></div>
</div>
<div href="#" class="button ripple hidden">Google</div>
<div class="topBarButton button hidden">
<img />
</div>
<div id="swipedetector">
</div>
<div id="drawer" class="hidden">
<div id="userinfo" class="hidden">
<div id="userimage"><img /></div>
<div id="usertext">
<div id="username"></div>
<div id="usernick"></div>
</div>
</div>
<div id="draweritems"></div>
</div>
<div class="draweritem hidden">
<div class="icon"><img /></div>
<div class="label"></div>
</div>
<div id="content">
<div id="topBar" class="hidden">
<div id="search" class="hidden"><svg id="searchBackButton" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z" /></svg><input type="text" id="searchinput" placeholder="Search" /></div>
<div id="topBarContent">
<div id="titleicon" class="hidden"><img /><svg id="defaultTitleIcon" class="hidden" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /></svg></div>
<div id="title">Hello</div>
<div id="topBarButtons">
<div class="topBarButton button hidden" id="buttonsearch">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg>
</div>
</div>
</div>
</div>
<div id="results"></div>
</div>
<script type="text/javascript">
if(!window["AutoTools"]){
var AutoTools = {};
}
AutoTools.sendCommand = function(command, prefix, hapticFeedback){
if(!command){
return;
}
if(!prefix){
prefix = null;
}
console.log("Sending command: " + command+";"+prefix);
AutoToolsAndroid.sendCommand(command, prefix, hapticFeedback);
}
AutoTools.shadeBlendConvert = function(p, from, to) {
if(typeof(p)!="number"||p<-1||p>1||typeof(from)!="string"||(from[0]!='r'&&from[0]!='#')||(typeof(to)!="string"&&typeof(to)!="undefined"))return null;
var sbcRip=function(d){
var l=d.length,RGB=new Object();
if(l>9){
d=d.split(",");
if(d.length<3||d.length>4)return null;
RGB[0]=i(d[0].slice(4)),RGB[1]=i(d[1]),RGB[2]=i(d[2]),RGB[3]=d[3]?parseFloat(d[3]):-1;
}else{
if(l==8||l==6||l<4)return null;
if(l<6)d="#"+d[1]+d[1]+d[2]+d[2]+d[3]+d[3]+(l>4?d[4]+""+d[4]:"");
d=i(d.slice(1),16),RGB[0]=d>>16&255,RGB[1]=d>>8&255,RGB[2]=d&255,RGB[3]=l==9||l==5?r(((d>>24&255)/255)*10000)/10000:-1;
}
return RGB;}
var i=parseInt,r=Math.round,h=from.length>9,h=typeof(to)=="string"?to.length>9?true:to=="c"?!h:false:h,b=p<0,p=b?p*-1:p,to=to&&to!="c"?to:b?"#000000":"#FFFFFF",f=sbcRip(from),t=sbcRip(to);
if(!f||!t)return null;
if(h)return "rgb("+r((t[0]-f[0])*p+f[0])+","+r((t[1]-f[1])*p+f[1])+","+r((t[2]-f[2])*p+f[2])+(f[3]<0&&t[3]<0?")":","+(f[3]>-1&&t[3]>-1?r(((t[3]-f[3])*p+f[3])*10000)/10000:t[3]<0?f[3]:t[3])+")");
else return "#"+(0x100000000+(f[3]>-1&&t[3]>-1?r(((t[3]-f[3])*p+f[3])*255):t[3]>-1?r(t[3]*255):f[3]>-1?r(f[3]*255):255)*0x1000000+r((t[0]-f[0])*p+f[0])*0x10000+r((t[1]-f[1])*p+f[1])*0x100+r((t[2]-f[2])*p+f[2])).toString(16).slice(f[3]>-1||t[3]>-1?1:3);
};
AutoTools.increaseBrightnessRule = function(rule, propertyName, percent, darken){
var originalColor = rule.style.getPropertyValue(propertyName);
if(!originalColor){
return;
}
originalColor = originalColor.trim();
var newColor = AutoTools.shadeBlendConvert(percent/100,originalColor);
rule.style.setProperty(propertyName, newColor);
return newColor;
};
AutoTools.isSet = value => {
value = window[value];
if(!value){
return false;
}
var toClass = {}.toString.call(value);
if(toClass == "[object Boolean]"){
return value;
}
return toClass == "[object String]";
};
AutoTools.fieldsToObject = (...fields) => {
var first = fields[0];
var result = [];
/*if(!AutoTools.isSet(first)){
return result;
}*/
var length = null;
var separator = ",";
if(AutoTools.isSet("itemSeparator")){
separator = itemSeparator;
}
for(var field of fields){
if(!AutoTools.isSet(field)){
continue;
}
var value = window[field];
var split = value.split(separator);
if(length == null){
length = split.length;
}
for (var i = 0; i < length; i++) {
if(result.length<=i){
result.push({});
}
var current = result[i];
current[field] = split[i];
}
}
return result;
};
/*var cardButtons = "Chrome Grande";
//var cardTitle = "One,Two";
var cardTitle = "One|Two|Three|Four|Five|Six|Seven";
var cardTitleRight = "1|2|3|4";
var cardCommand = "1|2|3|4|5";
var cardCommandPrefix = "test";
var cardSubtextLeft = "1,2";
var cardSubtextRight = "right";
//var titleIcon = "https://help.geogebra.org/public/attachments/6b999afc674ff37e10b4bf753c56c88a.png";
var cardIcon = "http://www.magazine-hd.com/apps/wp/wp-content/uploads/2016/11/Vaiana-poster.jpg|https://www.wired.com/images_blogs/gadgetlab/2010/09/enhanced-buzz-27651-1283950556-2.jpg";
var cardImage = "http://www.magazine-hd.com/apps/wp/wp-content/uploads/2016/11/Vaiana-poster.jpg|http://img.youtube.com/vi/0-JHq2wjB9c/mqdefault.jpg|https://thumbs.dreamstime.com/z/ferrari-show-day-super-wide-angle-01-14344459.jpg|https://s-media-cache-ak0.pinimg.com/736x/af/99/70/af99702a93bc7868a6e455358af764af.jpg";
var titleButtonIcon = "https://help.geogebra.org/public/attachments/6b999afc674ff37e10b4bf753c56c88a.png|https://www.wired.com/images_blogs/gadgetlab/2010/09/enhanced-buzz-27651-1283950556-2.jpg|https://help.geogebra.org/public/attachments/6b999afc674ff37e10b4bf753c56c88a.png|https://www.wired.com/images_blogs/gadgetlab/2010/09/enhanced-buzz-27651-1283950556-2.jpg";
var titleButtonCommand = "title button|onter";
var cardButton = "Play";
var buttonCommand = "pppp";
var titleFromTasker = "Super Card List with a big title";
//var maxWidth = "100%";
var minWidth = "30%";
var maxHeight = "550";
//var autoWidth = true;
//var accentColor = "#43A047";
var titleTextSize = "12";
//var subtitleTextSize = "42";
var cardPadding = "0";
var cardAlign = "Center";
var itemSeparator = "|";
//var backgroundColor = "#00ffff00";
var titleSearch = false;
var titleSearchCommandPrefix = "search";
var searchShouldFilter = true;
//var titleSearchColor = "#ffffff";
var drawerEnable = true;
var drawerItemIcon = titleButtonIcon;
var drawerItemLabel = "Item 1|Item 2 super big text oh yeah baby|Item 3|Item 2|Item 3|Item 2|Item 3|Item 2|Item 3|Item 2|Item 3|Item 2|Item 3|Item 2|Item 3";
//var drawerItemCommand = "Command 1|Command 2";
var drawerItemCommandPrefix = "drawer";
//var drawerShowUser = true;
//var drawerCover = "http://www.magazine-hd.com/apps/wp/wp-content/uploads/2016/11/Vaiana-poster.jpg";
var drawerCoverColor = "#ffff00";
var drawerIcon = "https://help.geogebra.org/public/attachments/6b999afc674ff37e10b4bf753c56c88a.png";
var drawerTitle = "Super Movie!!";
var drawerSubtitle = "...mega movie...";
var drawerCommand = "Super Movie!!";
var drawerWidth = "60%";
var userInformation = {
"kind": "plus#person",
"nickname": "joaomgcd",
"gender": "male",
"emails": [
{
"type": "account"
}
],
"urls": [
{
"value": "http://picasaweb.google.pt/joaomgcd",
"type": "otherProfile",
"label": "Picasa Web Albums"
},
{
"value": "http://twitter.com/joaomgcd",
"type": "otherProfile",
"label": "joaomgcd"
}
],
"objectType": "person",
"id": "101282964483894346750",
"displayName": "João Dias (joaomgcd)",
"name": {
"familyName": "Dias",
"givenName": "João"
},
"url": "https://plus.google.com/+JoãoDias",
"image": {
"url": "https://lh6.googleusercontent.com/-pBTqkVlB_yM/AAAAAAAAAAI/AAAAAAACBJU/rhUhuApUc7Q/photo.jpg?sz=50",
"isDefault": false
},
"isPlusUser": true,
"language": "en",
"ageRange": {
"min": 21
},
"circledByCount": 3483,
"verified": false,
"cover": {
"layout": "banner",
"coverPhoto": {
"url": "https://lh3.googleusercontent.com/QR4QQ0sUW-euw83RtgyESZSx9R-ErGdARQ5TmeGNURhVKN6IBzzXmy-52o5tEPTw2wTqEMiLSOR0Zw=s630-fcrop64=1,0000319eff92f1e6",
"height": 705,
"width": 940
},
"coverInfo": {
"topImageOffset": 0,
"leftImageOffset": 0
}
}
};
AutoTools.getUserInfo = () => userInformation;*/
function swipedetect(el, callback){
var touchsurface = el,
swipedir,
startX,
startY,
distX,
distY,
threshold = 50, //required min distance traveled to be considered swipe
restraint = 100, // maximum distance allowed at the same time in perpendicular direction
allowedTime = 300, // maximum time allowed to travel that distance
elapsedTime,
startTime,
handleswipe = callback || function(swipedir){}
touchsurface.addEventListener('touchstart', function(e){
var touchobj = e.changedTouches[0]
swipedir = 'none'
dist = 0
startX = touchobj.pageX
startY = touchobj.pageY
startTime = new Date().getTime() // record time when finger first makes contact with surface
//e.preventDefault()
}, false)
touchsurface.addEventListener('touchend', function(e){
var touchobj = e.changedTouches[0]
distX = touchobj.pageX - startX // get horizontal dist traveled by finger while in contact with surface
distY = touchobj.pageY - startY // get vertical dist traveled by finger while in contact with surface
elapsedTime = new Date().getTime() - startTime // get time elapsed
if (elapsedTime <= allowedTime){ // first condition for awipe met
if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint){ // 2nd condition for horizontal swipe met
swipedir = (distX < 0)? 'Left' : 'Right' // if dist traveled is negative, it indicates left swipe
}
else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint){ // 2nd condition for vertical swipe met
swipedir = (distY < 0)? 'Up' : 'Down' // if dist traveled is negative, it indicates up swipe
}
}
handleswipe(swipedir)
//e.preventDefault()
}, false)
}
var showError = error => document.write(error);
var hide = element => element.classList.add("hidden");
var show = element => element.classList.remove("hidden");
var toggleShow = element => element.classList.toggle("hidden");
var findRootRule = () => {
for(var sheet of document.styleSheets){
if(sheet.cssRules[0].selectorText == ":root"){
return sheet.cssRules[0];
}
}
}
var inputFromTasker = AutoTools.fieldsToObject("cardTitle","cardTitleRight","cardSubtextLeft","cardSubtextRight","cardIcon","cardImage", "cardCommand", "cardCommandPrefix");
var closeDrawer = () => {
if(drawerElement.style.webkitAnimationName == "drawer_open"){
show(drawerElement);
drawerElement.style.webkitAnimationName ="drawer_close";
}
}
var openDrawer = () => {
show(drawerElement);
drawerElement.style.webkitAnimationName ="drawer_open";
}
var toggleDrawer = () => {
if(drawerElement.style.webkitAnimationName == "drawer_open"){
closeDrawer();
}else{
openDrawer();
}
/*if(drawerElement.classList.contains("closed")){
show(drawerWrapperElement);
}else{
setTimeout(()=>{
if(drawerElement.classList.contains("closed")){
hide(drawerWrapperElement);
}
},1000);
}
drawerElement.classList.toggle("closed");*/
}
var titleIconWrapper = document.querySelector("#titleicon");
var drawerElement = document.querySelector("#drawer");
var drawerItemsElement = document.querySelector("#draweritems");
var swipeDetectElement = document.querySelector("#swipedetector");
if(AutoTools.isSet("drawerEnable") && drawerEnable){
swipedetect(drawerElement,type=>{
if(type=="Left"){
closeDrawer();
}
});
swipedetect(swipeDetectElement,direction=>direction == "Right" ? openDrawer() : null);
var shouldShowUser = false;
var shouldGetUserInfo = false;
if(AutoTools.isSet("drawerShowUser") && drawerShowUser){
shouldShowUser = true;
shouldGetUserInfo = true;
}
if(!AutoTools.isSet("drawerCover")){
drawerCover = null;
}
if(!AutoTools.isSet("drawerCoverColor")){
drawerCoverColor = null;
}
if(!AutoTools.isSet("drawerIcon")){
drawerIcon = null;
}
if(!AutoTools.isSet("drawerTitle")){
drawerTitle = null;
}
if(!AutoTools.isSet("drawerSubtitle")){
drawerSubtitle = null;
}
if(!AutoTools.isSet("drawerCommand")){
drawerCommand = null;
}
if(!AutoTools.isSet("drawerWidth")){
drawerWidth = "80%";
}
if(!isNaN(new Number(drawerWidth))){
drawerWidth = drawerWidth+"px";
}
drawerWidth = drawerWidth.replace("%","vw");
var animationSheet = document.createElement('style');
animationSheet.innerHTML = `
@keyframes drawer_open {
from {
transform: translate(0px, 0px);
}
to {
transform: translate(${drawerWidth}, 0px);
}
}
@keyframes drawer_close {
from {
transform: translate(${drawerWidth}, 0px);
}
to {
transform: translate(0px, 0px);
}
}`;
document.head.appendChild(animationSheet);
drawerElement.style["width"] = drawerWidth;
drawerElement.style["left"] = "-"+drawerWidth;
var testDrawerValue = value => value ? true : false;
shouldShowUser |= testDrawerValue(drawerCover) || testDrawerValue(drawerCoverColor) || testDrawerValue(drawerIcon) || testDrawerValue(drawerTitle) || testDrawerValue(drawerSubtitle);
var userInfoElement = document.querySelector("#userinfo");
if(shouldShowUser){
var userInfoLocal = null;
var getUserInfo = () => {
if(!userInfoLocal && shouldGetUserInfo){
userInfoLocal = AutoTools.getUserInfo();
}
return userInfoLocal;
}
var getValueForDrawer = (drawerValue,fromUserInfo) => {
try{
return drawerValue ? drawerValue : (userInfo ? fromUserInfo(userInfo) : null);
}catch(e){
return null;
}
}
var propOrHide = (elementQuery,prop,drawerValue,fromUserInfo) =>{
var value = getValueForDrawer(drawerValue,fromUserInfo);
var element = userInfoElement.querySelector(elementQuery);
if(value){
element[prop] = value;
}else{
hide(element);
}
}
var srcOrHide = (elementQuery,drawerValue,fromUserInfo) =>{
propOrHide(elementQuery,"src",drawerValue,fromUserInfo);
}
var innerHtmlOrHide = (elementQuery,drawerValue,fromUserInfo) =>{
propOrHide(elementQuery,"innerHTML",drawerValue,fromUserInfo);
}
var userInfo = getUserInfo();
show(userInfoElement);
var coverImage = getValueForDrawer(drawerCover, userInfo=> userInfo.cover.coverPhoto.url);
if(coverImage){
userInfoElement.style.backgroundImage = `url('${coverImage}')`;
}else{
userInfoElement.style["background-color"] = drawerCoverColor;
}
srcOrHide("#userimage img", drawerIcon, userInfo=> userInfo.image.url);
innerHtmlOrHide("#username", drawerTitle, userInfo=> userInfo.name.givenName + " " + userInfo.name.familyName);
innerHtmlOrHide("#usernick", drawerSubtitle, userInfo=> userInfo.nickname);
if(drawerCommand){
userInfoElement.onclick = e => AutoTools.sendCommand(drawerCommand);
}
}else{
hide(userInfoElement);
}
drawerItemsElement.innerHTML = "";
var drawerItemElementBase = document.querySelector(".draweritem").cloneNode(true);
show(drawerItemElementBase);
var drawerItems = AutoTools.fieldsToObject("drawerItemLabel","drawerItemIcon","drawerItemCommand");
var drawerItemCount = 0;
if(!AutoTools.isSet("drawerItemCommandPrefix")){
var drawerItemCommandPrefix = "";
}
for(var drawerItem of drawerItems){
var drawerItemElement = drawerItemElementBase.cloneNode(true);
if(!drawerItem.drawerItemCommand){
drawerItem.drawerItemCommand = drawerItem.drawerItemLabel;
}
drawerItemElement.item = drawerItem;
drawerItemElement.querySelector(".label").innerHTML = drawerItem.drawerItemLabel;
var iconImage = drawerItem.drawerItemIcon;
var iconElement = drawerItemElement.querySelector(".icon img");
if(iconImage){
iconElement.src = iconImage;
}else{
hide(iconElement);
}
drawerItemElement.onclick = e => AutoTools.sendCommand(e.target.item.drawerItemCommand,drawerItemCommandPrefix);
if(drawerItemCount == 0 && !shouldShowUser){
drawerItemElement.style["margin-top"] = "var(--cr-toolbar-height)";
}
drawerItemsElement.appendChild(drawerItemElement);
drawerItemCount++;
}
document.querySelector("#content").onclick = e => closeDrawer();
var iconForDrawer = null;
if(!AutoTools.isSet("titleIcon")){
iconForDrawer = document.querySelector("#defaultTitleIcon");
show(iconForDrawer);
}else{
iconForDrawer = document.querySelector("#titleIcon");
}
titleIconWrapper.style["cursor"] = "pointer";
titleIconWrapper.onclick = e => {e.stopPropagation(); openDrawer();}
show(titleIconWrapper);
}else{
hide(swipeDetectElement);
}
inputFromTasker.cardButtons = AutoTools.fieldsToObject("cardButton","buttonCommand");
if(!AutoTools.isSet("titleSearch")){
titleSearch = false;
}
if(!AutoTools.isSet("titleSearchCommandPrefix")){
titleSearchCommandPrefix = null;
}
if(!AutoTools.isSet("searchShouldFilter")){
searchShouldFilter = false;
}
if(!AutoTools.isSet("titleSearchColor")){
titleSearchColor = "#ffffff";
}
if(titleSearch){
var searchButton = document.querySelector("#buttonsearch");
var searchInput = document.querySelector("#searchinput");
show(searchButton);
var rootRule = findRootRule();
rootRule.style.setProperty("--search-color",titleSearchColor);
rootRule.style.setProperty("--search-color-darker",AutoTools.shadeBlendConvert(-0.2, titleSearchColor));
var topBarContent = document.querySelector("#topBarContent");
var searchElement = document.querySelector("#search");
searchButton.onclick = e => {
var searchInputElement = document.querySelector("#searchinput");
show(searchElement);
searchInputElement.focus();
hide(topBarContent);
}
var searchBackButton = document.querySelector("#searchBackButton");
searchBackButton.onclick = e =>{
show(topBarContent);
hide(searchElement);
}
searchInput.onkeyup = e => {
var currentSearch = searchInput.value.toLowerCase();
if(e.keyCode == 13){
AutoTools.sendCommand(currentSearch,titleSearchCommandPrefix);
}
if(searchShouldFilter){
displayCards(currentSearch,true);
}
};
}
inputFromTasker.titleButtons = AutoTools.fieldsToObject("titleButtonIcon","titleButtonCommand");
console.log(inputFromTasker);
if(AutoTools.isSet("accentColor")){
var rootRule = findRootRule();
rootRule.style.setProperty("--md-background-color",accentColor);
var dark = AutoTools.shadeBlendConvert(-0.2, accentColor);
rootRule.style.setProperty("--md-background-color-dark", dark);
}
var titleElement = document.querySelector("#title");
if(AutoTools.isSet("titleFromTasker")){
titleElement.innerHTML = titleFromTasker;
show(document.querySelector("#topBar"));
document.title = titleFromTasker;
}
if(!AutoTools.isSet("backgroundColor")){
var backgroundColor = "#e2e1e0";
}
document.querySelector("body").style["background-color"] = backgroundColor;
var setByClass = (root,className,value,prop) => {
var element = root.querySelector(`.${className}`);
if(!value){
hide(element);
return false;
}
show(element);
if(!prop){
prop = "innerHTML";
}
element[prop] = value;
return true;
};
var setNumberStyleProp = (element, value , prop) =>{
if(!AutoTools.isSet(value)){
return false;
}
value = window[value];
var isNumber = !isNaN(value)
if(isNumber){
value = value + "px";
}
element.style[prop] = value;
return true;
};
var isCardBackgroundColorSet = AutoTools.isSet("cardBackgroundColor");
var count = 0;
var matchesFilter = function(matches, value, filter){
if(matches){
return true;