-
Notifications
You must be signed in to change notification settings - Fork 1
/
eventcalendar.js
executable file
·2928 lines (2922 loc) · 79.8 KB
/
eventcalendar.js
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
$(document).ready(function () {
Boolean.prototype.CompareTo = function(that) {
return this - that;
};
Number.prototype.CompareTo = function(that) {
return this - that;
};
String.prototype.CompareTo = function(that) {
return this > that
? 1
: this < that
? -1
: 0;
};
Array.prototype.CompareTo = function(that) {
var i = 0;
while(i < this.length && i < that.length) {
var diff = this[i].CompareTo(that[i]);
if(diff != 0) {
return diff;
}
i = i + 1;
};
return this.length - that.length;
};
var list_1_Nil, list_1_Cons, i_vevent__ctor, i_notification__ctor, i_mkIEnumerator_1__ctor, i_UnfoldEnumerator_2__ctor, i_Set_1__ctor, i_SetIterator_1__ctor, i_GenericComparer_1__ctor, i_EventMarker__ctor, i_CreateEnumerable_1__ctor, calEvent_Vevent, calEvent_Note, String_Length, Set_Empty, Set_Contains, Set_Add, Set_1_get_Empty, SetTree_1_SetOne, SetTree_1_SetNode, SetTree_1_SetEmpty, SetTreeModule_toList, SetTreeModule_toArray, SetTreeModule_subset, SetTreeModule_spliceOutSuccessor, SetTreeModule_remove, SetTreeModule_rebalance, SetTreeModule_psubset, SetTreeModule_partitionAux, SetTreeModule_partition1, SetTreeModule_partition, SetTreeModule_notStarted, SetTreeModule_moveNext, SetTreeModule_mkIterator, SetTreeModule_mkIEnumerator, SetTreeModule_mk, SetTreeModule_minimumElementOpt, SetTreeModule_minimumElementAux, SetTreeModule_minimumElement, SetTreeModule_mem, SetTreeModule_maximumElementOpt, SetTreeModule_maximumElementAux, SetTreeModule_maximumElement, SetTreeModule_loop, SetTreeModule_iter, SetTreeModule_isEmpty, SetTreeModule_height, SetTreeModule_get_tolerance, SetTreeModule_forall, SetTreeModule_fold, SetTreeModule_filterAux, SetTreeModule_filter, SetTreeModule_exists, SetTreeModule_current, SetTreeModule_countAux, SetTreeModule_count, SetTreeModule_copyToArray, SetTreeModule_compareStacks, SetTreeModule_compare, SetTreeModule_collapseLHS, SetTreeModule_choose, SetTreeModule_alreadyFinished, SetTreeModule_add, SetTreeModule_SetOne, SetTreeModule_SetNode, Seq_Unfold, Seq_TryPickIndexedAux, Seq_TryPickIndexed, Seq_TryFind, Seq_ToList, Seq_ToArray, Seq_Skip, Seq_Scan, Seq_Reduce, Seq_OfList, Seq_OfArray, Seq_MinBy, Seq_Map2, Seq_Map, Seq_Length, Seq_IterateIndexed, Seq_Iterate, Seq_IsEmpty, Seq_Head, Seq_FromFactory, Seq_FoldIndexedAux, Seq_FoldIndexed, Seq_Fold, Seq_Filter, Seq_Enumerator, Seq_DistinctBy, Seq_Distinct, Seq_Delay, Seq_CompareWith, Seq_Choose, Range_oneStep, Range_customStep, Page_parseEventList, Page_op_Dynamic, Page_main, Page_jQuery, Page_fetchNewPosition, Page_asJQuery, Page_VeventsToMarkers, List_Tail, List_Reverse, List_IsEmpty, List_Head, List_FoldIndexedAux, List_FoldIndexed, List_Fold, List_Empty, List_CreateCons, LanguagePrimitives_UnboxGeneric, GoogleMap_showMyPosition, GoogleMap_op_Dynamic, GoogleMap_makeMap, GoogleLatLong_parseGoogleLocation, GoogleLatLong_jQuery, GoogleLatLong_fetchCoordinates, GoogleLatLong_FetchLatLong, GenericConstants_One, EventItem_mydate, EventItem_jsDateFormatToUser, EventItem_jsDateFormatToJson, EventItem_jsDateFormatCalendar, EventItem_items, EventItem_get_items, EventItem_formatDateData, EventItem_fetchQRCodeUrl, DateOrMonth_MonthAndYear, DateOrMonth_FullDate, Array_ZeroCreate, Array_BoxedLength;
Array_BoxedLength = (function (xs)
{
return xs.length;
});
Array_ZeroCreate = (function (size)
{
return new Array(size);
});
DateOrMonth_FullDate = (function (Item)
{
this.Tag = "FullDate";
this.Item = Item;
});
DateOrMonth_MonthAndYear = (function (Item)
{
this.Tag = "MonthAndYear";
this.Item = Item;
});
EventItem_fetchQRCodeUrl = (function (itm)
{
var _temp3;
var copyOfStruct = 150.000000;
_temp3 = copyOfStruct.toString();
var size = _temp3;
var baseurl = (((("http://chart.apis.google.com/chart?chs=" + size) + "x") + size) + "\u0026cht=qr\u0026choe=UTF-8\u0026chl=");
if ((itm.Tag == "Note"))
{
var item = itm.Item;
return (baseurl + encodeURIComponent(item.Info()));
}
else
{
var _item = itm.Item;
return (baseurl + encodeURIComponent(_item.iCal()));
};
});
EventItem_formatDateData = (function (md, duration)
{
var lz = (function (i)
{
if ((i.CompareTo(10.000000) < 0.000000))
{
return ("0" + i.toString());
}
else
{
return i.toString();
};
});
var _temp1;
var copyOfStruct = md.getFullYear();
_temp1 = copyOfStruct.toString();
return {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: _temp1, Item2: lz((md.getMonth() + 1.000000)), Item3: lz(md.getDate()), Item4: lz((md.getHours() + duration)), Item5: lz(md.getMinutes()), Item6: lz(md.getSeconds())};
});
EventItem_get_items = (function ()
{
var dsource = document.getElementById("#datasource");
jQuery(".datacontainer").css("visibility", "hidden");
jQuery(".datacontainer").css("position", "absolute");
var trs = dsource.getElementsByTagName("tr");
var _temp37;
var mapping = (function (i)
{
var tds = trs.item(i).childNodes;
var s = (function (x)
{
return tds.item(x).textContent;
});
var v = (function (x)
{
return s(x);
});
var matchValue = tds.length;
if ((matchValue.CompareTo(13.000000) == 0.000000))
{
return (function (arg0)
{
return (new calEvent_Vevent(arg0));
})((new i_vevent__ctor(s(0.000000), s(1.000000), EventItem_mydate(v(2.000000), v(3.000000), v(4.000000), v(5.000000), v(6.000000)), s(7.000000), s(8.000000), s(9.000000), s(10.000000), {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: s(11.000000), Item2: s(12.000000)})));
}
else
{
if ((matchValue.CompareTo(3.000000) == 0.000000))
{
return (function (arg0)
{
return (new calEvent_Note(arg0));
})((new i_notification__ctor(s(0.000000), s(1.000000), s(2.000000))));
}
else
{
if ((matchValue.CompareTo(25.000000) == 0.000000))
{
if ((((String_Length(s(1.000000)).CompareTo(2.000000) < 0.000000) && (String_Length(s(3.000000)).CompareTo(2.000000) < 0.000000)) && (String_Length(s(23.000000)).CompareTo(2.000000) < 0.000000)))
{
return (function (arg0)
{
return (new calEvent_Vevent(arg0));
})((new i_vevent__ctor(s(0.000000), s(2.000000), EventItem_mydate(v(4.000000), v(6.000000), v(8.000000), v(10.000000), v(12.000000)), s(14.000000), s(16.000000), s(18.000000), s(20.000000), {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: s(22.000000), Item2: s(24.000000)})));
}
else
{
if ((matchValue.CompareTo(5.000000) == 0.000000))
{
if (((String_Length(s(1.000000)).CompareTo(2.000000) < 0.000000) && (String_Length(s(3.000000)).CompareTo(2.000000) < 0.000000)))
{
return (function (arg0)
{
return (new calEvent_Note(arg0));
})((new i_notification__ctor(s(0.000000), s(2.000000), s(4.000000))));
}
else
{
var _temp39;
var _temp40;
var copyOfStruct = tds.length;
_temp40 = copyOfStruct.toString();
_temp39 = ("#datasource tablestructure has changed! " + _temp40);
throw (_temp39);
return null;
};
}
else
{
var _temp42;
var _temp43;
var _copyOfStruct = tds.length;
_temp43 = _copyOfStruct.toString();
_temp42 = ("#datasource tablestructure has changed! " + _temp43);
throw (_temp42);
return null;
};
};
}
else
{
if ((matchValue.CompareTo(5.000000) == 0.000000))
{
if (((String_Length(s(1.000000)).CompareTo(2.000000) < 0.000000) && (String_Length(s(3.000000)).CompareTo(2.000000) < 0.000000)))
{
return (function (arg0)
{
return (new calEvent_Note(arg0));
})((new i_notification__ctor(s(0.000000), s(2.000000), s(4.000000))));
}
else
{
var _temp45;
var _temp46;
var __copyOfStruct = tds.length;
_temp46 = __copyOfStruct.toString();
_temp45 = ("#datasource tablestructure has changed! " + _temp46);
throw (_temp45);
return null;
};
}
else
{
var _temp48;
var _temp49;
var ___copyOfStruct = tds.length;
_temp49 = ___copyOfStruct.toString();
_temp48 = ("#datasource tablestructure has changed! " + _temp49);
throw (_temp48);
return null;
};
};
};
};
});
_temp37 = (function (source)
{
return Seq_Map(mapping, Seq_OfList(source));
});
return _temp37(Seq_ToList(Range_oneStep(0.000000, (trs.length - 1.000000))));
});
EventItem_jsDateFormatCalendar = (function (mdx)
{
if ((mdx.Tag == "FullDate"))
{
var md = mdx.Item;
var patternInput = EventItem_formatDateData(md, 0.000000);
var y = patternInput.Item1;
var s = patternInput.Item6;
var n = patternInput.Item5;
var m = patternInput.Item2;
var h = patternInput.Item4;
var d = patternInput.Item3;
return ((((y + "-") + m) + "-") + d);
}
else
{
var _s = mdx.Item;
return _s;
};
});
EventItem_jsDateFormatToJson = (function (mdx, duration)
{
if ((mdx.Tag == "FullDate"))
{
var md = mdx.Item;
var patternInput = EventItem_formatDateData(md, duration);
var y = patternInput.Item1;
var s = patternInput.Item6;
var n = patternInput.Item5;
var m = patternInput.Item2;
var h = patternInput.Item4;
var d = patternInput.Item3;
return ((((((y + m) + d) + "T") + h) + n) + s);
}
else
{
var _s = mdx.Item;
return _s;
};
});
EventItem_jsDateFormatToUser = (function (mdx)
{
if ((mdx.Tag == "FullDate"))
{
var md = mdx.Item;
var _temp2;
var z = md;
_temp2 = (z.getFullYear().CompareTo(1990.000000) < 0.000000);
if (_temp2)
{
var _z = md;
return "";
}
else
{
var patternInput = EventItem_formatDateData(md, 0.000000);
var y = patternInput.Item1;
var s = patternInput.Item6;
var n = patternInput.Item5;
var m = patternInput.Item2;
var h = patternInput.Item4;
var d = patternInput.Item3;
return ((((((((d + ".") + m) + ".") + y) + " ") + h) + ".") + n);
};
}
else
{
var _s = mdx.Item;
if ((_s.CompareTo("0.0") == 0.000000))
{
return "";
}
else
{
return _s;
};
};
});
EventItem_mydate = (function (y, m, d, h, n)
{
if ((d.CompareTo(0.000000) == 0.000000))
{
return (new DateOrMonth_MonthAndYear(((m.toString() + ".") + y.toString())));
}
else
{
return (new DateOrMonth_FullDate((new Date(y, (m - 1.000000), d, h, n, 0.000000))));
};
});
GenericConstants_One = (function ()
{
return 1;
});
GoogleLatLong_FetchLatLong = (function (id, address)
{
var result = GoogleLatLong_fetchCoordinates(address, (function (data)
{
return GoogleLatLong_parseGoogleLocation(id, data);
}));
return result;
});
GoogleLatLong_fetchCoordinates = (function (address, callback)
{
var settings = {};
settings.success = (function (data, _arg2, _arg1)
{
return callback(data);
});
null;
var url = ("https://maps.googleapis.com/maps/api/geocode/json?sensor=false\u0026address=" + encodeURIComponent(address));
return jQuery.ajax(url, settings);
});
GoogleLatLong_jQuery = (function (command)
{
return jQuery(command);
});
GoogleLatLong_parseGoogleLocation = (function (id, data)
{
var matchValue = Seq_IsEmpty(Seq_OfArray(data.results));
if (matchValue)
{
return (function (value)
{
;
})("No results");
}
else
{
var replies = Seq_Head(Seq_OfArray(data.results));
var latlon = {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: replies.geometry.location.lat, Item2: replies.geometry.location.lng};
var _temp127;
var _temp128;
var copyOfStruct = latlon.Item1;
_temp128 = copyOfStruct.toString();
_temp127 = GoogleLatLong_jQuery(("#uLatitude" + id)).val(_temp128);
(function (value)
{
;
})(_temp127);
var _temp130;
var _temp131;
var _copyOfStruct = latlon.Item2;
_temp131 = _copyOfStruct.toString();
_temp130 = GoogleLatLong_jQuery(("#uLongitude" + id)).val(_temp131);
(function (value)
{
;
})(_temp130);
return window.alert(("Asetettu paikka osoitteelle: " + replies.formatted_address));
};
});
GoogleMap_makeMap = (function (markers)
{
var _temp103;
var _temp104;
var returnVal = {};
returnVal.zoom = 4.000000;
null;
returnVal.center = (new google.maps.LatLng(65.450000, 25.960000));
null;
returnVal.mapTypeControl = true;
null;
returnVal.mapTypeId = google.maps.MapTypeId.ROADMAP;
null;
_temp104 = returnVal;
_temp103 = (new google.maps.Map(document.getElementById("mapContainer"), _temp104));
var map = _temp103;
var _temp108;
var action = (function (i)
{
var _temp110;
var _temp111;
var _returnVal = {};
_returnVal.clickable = true;
null;
_returnVal.draggable = false;
null;
_returnVal.flat = true;
null;
_returnVal.position = (function (tupledArg)
{
var arg00 = tupledArg.Item1;
var arg01 = tupledArg.Item2;
return (new google.maps.LatLng(arg00, arg01));
})(i.Coordinates);
null;
_returnVal.map = map;
null;
_returnVal.title = i.Title;
null;
_temp111 = _returnVal;
_temp110 = (new google.maps.Marker(_temp111));
return (function (value)
{
;
})(_temp110);
});
_temp108 = (function (source)
{
return Seq_Iterate(action, source);
});
_temp108(markers);
var myTimer = {contents: 0.000000};
var mapresize = (function (unitVar0)
{
var refresh = (function (_unitVar0)
{
return google.maps.event.trigger(map, "resize", null);
});
clearTimeout(myTimer.contents);
myTimer.contents = setTimeout(refresh, 1000.000000);
});
(function (value)
{
;
})(GoogleMap_op_Dynamic(jQuery, "mapContainer").bind("resize", mapresize));
return map;
});
GoogleMap_op_Dynamic = (function (jqx, name)
{
return jqx(("#" + name));
});
GoogleMap_showMyPosition = (function (markers)
{
var mymap = GoogleMap_makeMap(markers);
if ((Modernizr.geolocation && (!Seq_IsEmpty(markers))))
{
return navigator.geolocation.getCurrentPosition((function (position)
{
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var coords = (new google.maps.LatLng(latitude, longitude));
var distance = (function (tupledArg)
{
var marklat = tupledArg.Item1;
var marklon = tupledArg.Item2;
var R = 6371.000000;
var dLat = (((marklat - latitude) * Math.PI) / 180.000000);
var dLon = (((marklon - longitude) * Math.PI) / 180.000000);
var lat1 = ((latitude * Math.PI) / 180.000000);
var lat2 = ((marklat * Math.PI) / 180.000000);
var a = ((Math.sin((dLat / 2.000000)) * Math.sin((dLat / 2.000000))) + (((Math.sin((dLon / 2.000000)) * Math.sin((dLon / 2.000000))) * Math.cos(lat1)) * Math.cos(lat2)));
var c = (2.000000 * Math.atan2(Math.sqrt(a), Math.sqrt((1.000000 - a))));
return (R * c);
});
var _temp117;
var _temp118;
var projection = (function (f)
{
return f;
});
_temp118 = (function (source)
{
return Seq_MinBy(projection, source);
});
var _temp120;
var _temp121;
var mapping = (function (f)
{
return distance(f.Coordinates);
});
_temp121 = (function (source)
{
return Seq_Map(mapping, source);
});
_temp120 = _temp121(markers);
_temp117 = _temp118(_temp120);
var nearest = _temp117;
var _temp123;
var _temp124;
var predicate = (function (f)
{
var d = (distance(f.Coordinates) - nearest);
return (d.CompareTo(20.000000) < 0.000000);
});
_temp124 = (function (source)
{
return Seq_Filter(predicate, source);
});
_temp123 = _temp124(markers);
var quiteNear = _temp123;
var _temp125;
var action = (function (f)
{
return (function (value)
{
;
})(GoogleMap_op_Dynamic(jQuery, f.Id).attr("class", "myNearEvent"));
});
_temp125 = (function (source)
{
return Seq_Iterate(action, source);
});
return _temp125(quiteNear);
}));
}
else
{
;
};
});
LanguagePrimitives_UnboxGeneric = (function (x)
{
return x;
});
List_CreateCons = (function (x, xs)
{
return (new list_1_Cons(x, xs));
});
List_Empty = (function ()
{
return (new list_1_Nil());
});
List_Fold = (function (f, seed, xs)
{
return List_FoldIndexed((function (_arg1)
{
return (function (acc)
{
return (function (x)
{
return f(acc)(x);
});
});
}), seed, xs);
});
List_FoldIndexed = (function (f, seed, xs)
{
return List_FoldIndexedAux(f, 0.000000, seed, xs);
});
List_FoldIndexedAux = (function (f, i, acc, _arg1)
{
if ((_arg1.Tag == "Cons"))
{
var xs = _arg1.Item2;
var x = _arg1.Item1;
return List_FoldIndexedAux(f, (i + 1.000000), f(i)(acc)(x), xs);
}
else
{
return acc;
};
});
List_Head = (function (_arg1)
{
if ((_arg1.Tag == "Cons"))
{
var xs = _arg1.Item2;
var x = _arg1.Item1;
return x;
}
else
{
throw ("List was empty");
return null;
};
});
List_IsEmpty = (function (_arg1)
{
return ((_arg1.Tag == "Nil") && true);
});
List_Reverse = (function (xs)
{
return List_Fold((function (acc)
{
return (function (x)
{
return (new list_1_Cons(x, acc));
});
}), (new list_1_Nil()), xs);
});
List_Tail = (function (_arg1)
{
if ((_arg1.Tag == "Cons"))
{
var xs = _arg1.Item2;
var x = _arg1.Item1;
return xs;
}
else
{
throw ("List was empty");
return null;
};
});
Page_VeventsToMarkers = (function (is)
{
var _temp81;
var _temp91;
var _temp96;
var _temp97;
var predicate = (function (i)
{
return (i.Id.CompareTo("") != 0.000000);
});
_temp97 = (function (source)
{
return Seq_Filter(predicate, source);
});
var _temp99;
var _temp100;
var mapping = (function (i)
{
if ((i.Tag == "Vevent"))
{
var z = i.Item;
return (new i_EventMarker__ctor(z.get_Id(), z.Summary(), z.get_LatLon()));
}
else
{
return (new i_EventMarker__ctor("", "", {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: 0.000000, Item2: 0.000000}));
};
});
_temp100 = (function (source)
{
return Seq_Map(mapping, source);
});
_temp99 = _temp100(is);
_temp96 = _temp97(_temp99);
_temp91 = (function (source)
{
return Seq_Distinct(source);
})(_temp96);
_temp81 = (function (source)
{
return Seq_ToArray(source);
})(_temp91);
var retr = _temp81;
return retr;
});
Page_asJQuery = (function (x)
{
return x;
});
Page_fetchNewPosition = (function (unitVar0)
{
(function (value)
{
;
})(window.alert("Suoritetaan Google-paikannus, jos ei toimi, niin koita uusiksi..."));
var getval = (function (item)
{
return Page_jQuery(("#" + item)).val().toString();
});
return GoogleLatLong_FetchLatLong("", ((getval("StreetAddress") + ", ") + getval("City")));
});
Page_jQuery = (function (command)
{
return jQuery(command);
});
Page_main = (function (unitVar0)
{
(function (value)
{
;
})(Page_parseEventList());
var marks = Page_VeventsToMarkers(EventItem_items);
GoogleMap_showMyPosition(Seq_OfArray(marks));
return Page_op_Dynamic(jQuery, "fetchPosBtn").click((function (arg00_)
{
return Page_fetchNewPosition();
}));
});
Page_op_Dynamic = (function (jqx, name)
{
return jqx(("#" + name));
});
Page_parseEventList = (function (unitVar0)
{
var lst = Page_op_Dynamic(jQuery, "maineventlist");
var makedivi = (function (e)
{
return (function (c)
{
return (function (value)
{
;
})(Page_asJQuery(c).appendTo(lst));
})((function (b)
{
return Page_asJQuery(b).html((((("\u003cul\u003e\u003cli class=\"timeAndCity\"\u003e" + e.get_Title()) + "\u003c/li\u003e\r\n \u003cli class=\"details\"\u003e") + e.get_Details()) + "\u003c/li\u003e\u003c/ul\u003e\r\n \u003cp class=\"testitPistelinja\"\u003e\u003c/p\u003e"));
})((function (a)
{
return Page_asJQuery(a).attr("id", e.get_Id());
})(Page_jQuery("\u003cdiv /\u003e").attr("class", "myevent"))));
});
var makediv = (function (e)
{
return (function (c)
{
return (function (value)
{
;
})(Page_asJQuery(c).appendTo(lst));
})((function (b)
{
return Page_asJQuery(b).html((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((("\r\n \u003ca id=\"L" + encodeURIComponent(e.get_Id())) + "\"\u003e\r\n \u003cdiv id=\u0027pop") + encodeURIComponent(e.get_Id())) + "\u0027 title=\u0027Testi\u0027 class=\u0027event testipopup\u0027\u003e\r\n \u003cul\u003e\r\n \u003cli class=\"technicaldate\"\u003e") + EventItem_jsDateFormatCalendar(e.get_StarTime())) + "\u003c/li\u003e\r\n \u003cli class=\"timeAndCity\"\u003e") + EventItem_jsDateFormatToUser(e.get_StarTime())) + " ") + e.get_City()) + "\u003c/li\u003e\r\n \u003cli class=\"location\"\u003e") + e.get_StreetAddress()) + " \u003cbr /\u003e") + e.get_LocationDetails()) + "\u003c/li\u003e\r\n \u003cli class=\"info\"\u003e") + e.get_Title()) + ", ") + e.get_Details()) + "\u003c/li\u003e\r\n \u003c/ul\u003e\u003cdiv class=\"dialogiAlaosa\"\u003e\r\n \u003cbutton id=\"opener") + e.get_Id()) + "\" class=\"qrButton\"\u003e\u003cimg id=\"openeri") + e.get_Id()) + "\" class=\"qrButton\" src=\"") + Page_jQuery("#LocalizationQrcodeUrl").text().toString()) + "\" alt=\"QR\"/\u003e\u003c/button\u003e\r\n \u003cbutton id=\"ical") + e.get_Id()) + "\" class=\"icalButton\"\u003e\u003cimg id=\"icali") + e.get_Id()) + "\" class=\"icalButton\" src=\"") + Page_jQuery("#LocalizationIcalUrl").text().toString()) + "\" alt=\"iCal\"/\u003e\u003c/button\u003e\r\n \u003c/div\u003e\u003c/div\u003e\r\n \u003ca id=\"op") + encodeURIComponent(e.get_Id())) + "\" href=\"#\"\u003e\u003cul\u003e\r\n \u003cli class=\"technicaldate\"\u003e") + EventItem_jsDateFormatCalendar(e.get_StarTime())) + "\u003c/li\u003e\r\n \u003cli class=\"timeAndCity\"\u003e") + EventItem_jsDateFormatToUser(e.get_StarTime())) + " ") + e.get_City()) + "\u003c/li\u003e\r\n \u003c/ul\u003e\u003c/a\u003e\u003cscript type=\"text/javascript\"\u003e\r\n$(function() {\r\n\r\n $(\"#pop") + encodeURIComponent(e.get_Id())) + "\").dialog({ autoOpen: false });\r\n $(\"#op") + encodeURIComponent(e.get_Id())) + "\").click(function(){$(\"#pop") + encodeURIComponent(e.get_Id())) + "\").dialog(\"open\");return false;});\r\n $(\"#opi") + encodeURIComponent(e.get_Id())) + "\").hover(function(){$(\"#opi") + encodeURIComponent(e.get_Id())) + "\").attr(\u0027src\u0027,\u0027") + Page_jQuery("#LocalizationInfoHoverUrl").text().toString()) + "\u0027); }, function() { $(\"#opi") + encodeURIComponent(e.get_Id())) + "\").attr(\u0027src\u0027,\u0027") + Page_jQuery("#LocalizationInfoUrl").text().toString()) + "\u0027);});\r\n $(\"#openeri") + e.get_Id()) + "\").hover(function(){$(\"#openeri") + e.get_Id()) + "\").attr(\u0027src\u0027,\u0027") + Page_jQuery("#LocalizationQrcodeHoverUrl").text().toString()) + "\u0027); }, function() { $(\"#openeri") + e.get_Id()) + "\").attr(\u0027src\u0027,\u0027") + Page_jQuery("#LocalizationQrcodeUrl").text().toString()) + "\u0027);});\r\n $(\"#icali") + e.get_Id()) + "\").hover(function(){$(\"#icali") + e.get_Id()) + "\").attr(\u0027src\u0027,\u0027") + Page_jQuery("#LocalizationIcalHoverUrl").text().toString()) + "\u0027); }, function() { $(\"#icali") + e.get_Id()) + "\").attr(\u0027src\u0027,\u0027") + Page_jQuery("#LocalizationIcalUrl").text().toString()) + "\u0027);});\r\n\r\n $(\"#opener") + e.get_Id()) + "\").click(function() {\r\n $(\"#iQRCode\").attr(\"src\",\"") + EventItem_fetchQRCodeUrl((new calEvent_Vevent(e)))) + "\");\r\n $(\"#dialog\").dialog(\"open\");\r\n });\r\n $(\"#ical") + e.get_Id()) + "\").click(function() {\r\n window.open(\"") + Page_jQuery("#IcalPath").text().toString()) + "?itemId=") + (e.get_Id() + "00")) + "\");\r\n });\r\n});\r\n \u003c/script\u003e\u003cp class=\"testitPistelinja\"\u003e\u003c/p\u003e\r\n "));
})((function (a)
{
return Page_asJQuery(a).attr("id", e.get_Id());
})(Page_jQuery("\u003cdiv /\u003e").attr("class", ("myevent " + EventItem_jsDateFormatCalendar(e.get_StarTime()))))));
});
var _temp5;
var action = (function (i)
{
if ((i.Tag == "Note"))
{
var y = i.Item;
return makedivi(y);
}
else
{
var x = i.Item;
return makediv(x);
};
});
_temp5 = (function (source)
{
return Seq_Iterate(action, source);
});
return _temp5(EventItem_items);
});
Range_customStep = (function (first, stepping, last)
{
var _temp50;
var f = (function (x)
{
if ((x.CompareTo(last) <= 0.000000))
{
return {Tag: "Some", Value: {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: x, Item2: (x + stepping)}};
}
else
{
return {Tag: "None"};
};
});
_temp50 = (function (seed)
{
return Seq_Unfold(f, seed);
});
return _temp50(first);
});
Range_oneStep = (function (first, last)
{
return Range_customStep(first, GenericConstants_One(), last);
});
Seq_Choose = (function (f, xs)
{
var trySkipToNext;
trySkipToNext = (function (_enum)
{
if (_enum.MoveNext())
{
var matchValue = f(_enum.get_Current());
if ((matchValue.Tag == "Some"))
{
var value = matchValue.Value;
return {Tag: "Some", Value: {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: value, Item2: _enum}};
}
else
{
return trySkipToNext(_enum);
};
}
else
{
return {Tag: "None"};
};
});
return (function (_f)
{
return Seq_Delay(_f);
})((function (unitVar0)
{
var _temp53;
var _f = trySkipToNext;
_temp53 = (function (seed)
{
return Seq_Unfold(_f, seed);
});
return _temp53(Seq_Enumerator(xs));
}));
});
Seq_CompareWith = (function (f, xs, ys)
{
var _temp32;
var _temp33;
var _f = (function (i)
{
return (i.CompareTo(0.000000) != 0.000000);
});
_temp33 = (function (_xs)
{
return Seq_TryFind(_f, _xs);
});
_temp32 = _temp33(Seq_Map2((function (x)
{
return (function (y)
{
return f(x)(y);
});
}), xs, ys));
var nonZero = _temp32;
if ((nonZero.Tag == "None"))
{
return (Seq_Length(xs) - Seq_Length(ys));
}
else
{
var diff = nonZero.Value;
return diff;
};
});
Seq_Delay = (function (f)
{
return Seq_FromFactory((function (unitVar0)
{
var _temp22;
var _temp23;
_temp22 = f(_temp23);
return Seq_Enumerator(_temp22);
}));
});
Seq_Distinct = (function (xs)
{
return Seq_DistinctBy((function (x)
{
return x;
}), xs);
});
Seq_DistinctBy = (function (f, xs)
{
var _temp54;
var _f = (function (tuple)
{
return tuple.Item1;
});
_temp54 = (function (_xs)
{
return Seq_Choose(_f, _xs);
});
return _temp54(Seq_Scan((function (tupledArg)
{
var _arg1 = tupledArg.Item1;
var acc = tupledArg.Item2;
return (function (x)
{
var y = f(x);
if ((function (set)
{
return Set_Contains(y, set);
})(acc))
{
return {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: {Tag: "None"}, Item2: acc};
}
else
{
return {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: {Tag: "Some", Value: x}, Item2: (function (set)
{
return Set_Add(y, set);
})(acc)};
};
});
}), {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: {Tag: "None"}, Item2: Set_Empty()}, xs));
});
Seq_Enumerator = (function (xs)
{
return xs.GetEnumerator();
});
Seq_Filter = (function (f, xs)
{
var trySkipToNext;
trySkipToNext = (function (_enum)
{
if (_enum.MoveNext())
{
if (f(_enum.get_Current()))
{
return {Tag: "Some", Value: {CompareTo: (function (that)
{
var diff;
return 0.000000;
}), Item1: _enum.get_Current(), Item2: _enum}};
}
else
{
return trySkipToNext(_enum);
};
}
else
{
return {Tag: "None"};
};
});
return (function (_f)
{
return Seq_Delay(_f);
})((function (unitVar0)
{
var _temp61;
var _f = trySkipToNext;
_temp61 = (function (seed)
{
return Seq_Unfold(_f, seed);
});
return _temp61(Seq_Enumerator(xs));
}));
});
Seq_Fold = (function (f, seed, xs)
{
return Seq_FoldIndexed((function (_arg1)
{
return (function (acc)
{
return (function (x)
{
return f(acc)(x);
});
});
}), seed, xs);
});
Seq_FoldIndexed = (function (f, seed, xs)
{
return Seq_FoldIndexedAux(f, 0.000000, seed, Seq_Enumerator(xs));
});
Seq_FoldIndexedAux = (function (f, i, acc, xs)
{
if (xs.MoveNext())
{
return Seq_FoldIndexedAux(f, (i + 1.000000), f(i)(acc)(xs.get_Current()), xs);
}
else
{
return acc;
};
});
Seq_FromFactory = (function (f)
{
return (new i_CreateEnumerable_1__ctor(f));
});
Seq_Head = (function (xs)
{
var enumerator = Seq_Enumerator(xs);
if (enumerator.MoveNext())
{
return enumerator.get_Current();
}
else
{
throw ("Seq was empty");
return null;
};