-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.htm
151 lines (148 loc) · 6.76 KB
/
index.htm
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
<html manifest="ac.appcache"><head>
<!-- title must be first, IE 6 (test) and under, put title tag first in -->
<!-- childNodes/children, regardless of HTML src code tree order, if title -->
<!-- not first absolute pos into .children will fail -->
<title>tinymta - Lightweight NYC MTA Subway Train arrival times</title>
<!-- put no-referrer so preload reqs match later fetch reqs instead of double req -->
<meta name=mobileoptimized content=0><meta name="referrer" content="no-referrer">
<!-- preconnect Chrome 46/FF41-70 115-, preconnect Chrome 50/FF 85, inc both -->
<link href="https://api.weather.com/v3/wx/forecast/hourly/1day?geocode=40.74,-73.91&format=json&units=e&language=en-us&apiKey=8de2d8b3a93542c9a2d8b3a935a2c909" as="fetch" rel="preload" crossorigin>
<!-- dont do preconnect fallback for weather, not worth wire bytes -->
<!-- 1062 vs 1059 bytes gz local af rm weather PC tag -->
<!-- 1059 vs 1047 bytes gz local af rm 2 dns-fetch tags -->
<!-- as.js is a CFW, so higher latency vs static files on CF, put these 2 .js -->
<!-- on wire asap, for parallel download and parse/latency by modern UAs with -->
<!-- async, f.js has work arounds for as.js no-async early failed paint/no DOM -->
<!-- body yet problems, IMO as.js is less important than getting "new socket" -->
<!-- cross origin weather JSON preload on wire, since tinymta socket 25%-99% chance -->
<!-- already started -->
<link href="//tinymta.us.to/as.js" rel=preload as=script>
<script async defer src="//tinymta.us.to/as.js"></script>
<script async defer src="//tinymta.us.to/jsp?url=https%3A%2F%2Fapi.weather.com%2Fv3%2Fwx%2Fforecast%2Fhourly%2F1day%3Fgeocode%3D40.74%2C-73.91%26format%3Djson%26units%3De%26language%3Den-us%26apiKey%3D8de2d8b3a93542c9a2d8b3a935a2c909&callback=j1716324619352"></script>
<script async defer src=dumb.js></script>
<script async defer src=fav.js></script>
<!-- preconnect to status.htm's API -->
<link href="//collector-otp-prod.camsys-apps.com" rel="preconnect" crossorigin>
<!-- not time sensitive, all below are navigates or unimplimented by SF -->
<link href=stations.htm rel=prefetch>
<link href=mn/stations.htm rel=prefetch>
<link href=li/stations.htm rel=prefetch>
<link href=status.htm rel=prefetch>
<!-- draw_fav.js is dev only -->
<!-- <script src=draw_fav.js></script> -->
<style>:root{color-scheme:light dark}span{display:inline-block}img{height:2em}</style>
</head><body>
Do you have a<br>
[1]<a accesskey=1 href=stations.htm>Smart Phone (Subway)</a><br>
[2]<a accesskey=2 href=mn/stations.htm>Smart Phone (Metro North)</a><br>
[3]<a accesskey=3 href=li/stations.htm>Smart Phone (Long Island)</a><br>
[4]<a accesskey=4 href=jsrdt.htm>Dumb Phone (Subway)</a><br>
[5]<a accesskey=5 href=mn/jsrdt.htm>Dumb Phone (Metro North)</a><br>
[6]<a accesskey=6 href=li/jsrdt.htm>Dumb Phone (Long Island)</a><br>
[7]<a accesskey=7 href=status.htm>Service Changes</a><br>
<!-- [8]<a accesskey=8 href=plan.htm>Smart Phone UI (Subway) Trip Planner</a><br> -->
<!-- [9]<a accesskey=9 href=more.htm>More</a><br> -->
[0]<a accesskey=0 href=abt.htm>About</a>
<!-- div used by as.js-->
<div></div>
<script>
//1029->1061 LS "f", 1062 for LS "fav"
//localStorage.setItem("fav", "document.body.appendChild(document.createElement('div')).appendChild(document.createTextNode('FFF'))");
//localStorage.removeItem("fav");
//debugger;
//var CT = performance.now();
try{eval(localStorage.getItem("fav"))} catch (err) {}
//console.log('fav ld '+(performance.now()-CT));
var L;//async race CB fav.js vs inline wea script
var R;
//gz 1021 "document.", gz 1019 "doc." everywhere
var doc = document;
//IE 5.5 and 6.0 don't have document.head
var headElem = doc.documentElement.firstChild;
function y (nosvg, mkWeatherCellContainerPF) {
fetch(headElem.children[3].href)
.then(function (r) {
r.status != 200 ? //put != first for r.status gzip reasons
alert(r.status)
:
r.json().then(function (r) {
/*
was a polyfill func or real doc.CDF, but it was switched to "polyfill always"
DIV tag, to keep this minified/gziped htm file
inside exactly 1 http 1.1 resp packet (1500 bytes)
*/
var frag = doc.createElement('div'),
e, //elem
v, //val
img_ext = nosvg ? nosvg : '.svg',
br = doc.createElement('br'),
drop = this.E || doc.createTextNode("\ud83d\udca7"),
i = 0;
/*hardcode 24 hr in a day to save wire*/
for (; i < 24; i++) {
/*no inline-block for IE 5.0, inline-block 5.5 up.
A 1 cell table, is a old PF hack inline-block emulate for IE 5.0
http://mrclay.org/web_design/shrink_to_fit/
http://mrclay.org/web_design/shrink_to_fit/ieshrink.js
I fixed a bug in code above "<table><tr><td>" only works for
.innerHTML/real HTML parser in IE, <tbody> required if appendChild/W3C DOM
for IE 5 5.5 and 6, in my testing
see https://blog.tomayac.com/2006/06/23/dynamically-created-tables-in-internet-explorer-214331/
*/
if (mkWeatherCellContainerPF) {
e = mkWeatherCellContainerPF(frag);
} else {
/*
originally a DIV tag, switched to SPAN for IE 5.5/6 compat.
So IE 11 and all FF/WBK/Chrome know style=display=inline-block on a DIV tag
but IE 5.5/6 refuse to honor inline-block on a DIV tag, switch to SPAN
*/
e = frag.appendChild(doc.createElement('span'));
}
v = +r.validTimeLocal[i].slice(11, 13);
//perf, skip locale/Date objects
e.appendChild(doc.createTextNode((v % 12 || 12) + (v >= 12 ? 'PM\xa0' : 'AM\xa0')));
/*
Only opera 10 fatal excpt err if missing arg. All IEs don't err and no modern
Safari/WBK/Chrome/FF needs arg. But MDN archives say W3C fuzzyness and spec
flipping between FF 1-3?? and W3C on meaning of no arg, prob caused Opera devs
to mandate the arg 100% of time, false is "clone shallow" true is "clone deep"
meaningless for self closing BR tag
*/
e.appendChild(br.cloneNode(0));
e.appendChild(doc.createTextNode(r.temperature[i] + "F"));
e.appendChild(br.cloneNode(0));
e.appendChild(doc.createTextNode(r.precipChance[i] + "%"));
//avg of ~50 pg loads, 1.X ms is cumulative (24 calls summed per pg load)
//CE() is plus .src + setAttribute()
//FF115 CE() 1.4670533846736797
// CN() 1.655915783189822
//C109 CE() 2.156961555116267
// CN() 1.6185931681633636
//optimize for Chrome since Chrome more popular
e.appendChild(drop.cloneNode(0));
e.appendChild(br.cloneNode(0));
e.appendChild(doc.createElement('img'))
.src =
/*STARTINSERTPATH*/
'w/'
/*ENDINSERTPATH*/
+r.iconCode[i] + img_ext;
}
doc.body.appendChild(frag);
}); //json cb
}); //end fetch CB
};
if (!this.f) {
if (this.fetch) {
y();
} else {
//dont double load in dumb.js, async flag or no async flag
f=1;
headElem.appendChild(doc.createElement("script")).src = 'f.js';
}
}
//run DOM load CB from fav.js if needed (chains to as.js CB if needed)
L=L&&L();
</script>
</body></html>