Skip to content

Commit 675c7ea

Browse files
committed
Cleaned up HTML and added a little interactivity
1 parent 7942774 commit 675c7ea

File tree

4 files changed

+2422
-1182
lines changed

4 files changed

+2422
-1182
lines changed

AirPlay.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ table th {
170170

171171
table td, table th {
172172
padding: 5px 5px;
173+
text-align: left;
173174
}
174175

175176
table tr {
@@ -180,6 +181,10 @@ table tr:hover {
180181
background-color: #e4f2fc;
181182
}
182183

184+
table tr.selected {
185+
background-color: #75bdf0;
186+
}
187+
183188
table td {
184189
font-size: 9pt;
185190
}
@@ -198,3 +203,7 @@ table td {
198203
border-top: 3px solid #09598a;
199204
padding-top: 10px;
200205
}
206+
207+
.noscript {
208+
display: none;
209+
}

features.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
function toLong(s) {
2+
var ret = s.trim();
3+
try {
4+
if (ret.startsWith("0x")) {
5+
return Long.fromString(ret.substring(2), 16);
6+
}
7+
return Long.fromString(ret, 10);
8+
} catch (e) {
9+
return Long.ZERO;
10+
}
11+
}
12+
function setBitClassName(prefix, value, selected, notSelected) {
13+
for (var i=0; i<65; i++) {
14+
var b = Long.ONE.shiftLeft(i);
15+
var el = document.getElementById(prefix + "-bit" + i);
16+
if (el) {
17+
if (value.and(b).equals(b)) {
18+
el.className = selected;
19+
} else {
20+
el.className = notSelected;
21+
}
22+
}
23+
}
24+
}
25+
function featuresExample(el) {
26+
document.getElementById("airplay-features-input").value = el.value;
27+
updateFeatures(el.value);
28+
}
29+
function featuresChanged(el) {
30+
document.getElementById("airplay-features-examples").value = "";
31+
updateFeatures(el.value);
32+
}
33+
34+
function updateFeatures(featuresS) {
35+
var comma = featuresS.indexOf(",");
36+
var features = 0;
37+
if (comma >= 0) {
38+
var high = toLong(featuresS.substring(comma + 1));
39+
var low = toLong(featuresS.substring(0, comma));
40+
features = high.shiftLeft(32).or(low);
41+
} else {
42+
features = toLong(featuresS);
43+
}
44+
if (features.equals(Long.ZERO)) {
45+
document.getElementById("airplay-features-output").className = "noscript";
46+
setBitClassName("airplay-features", Long.ZERO, "", "")
47+
} else {
48+
document.getElementById("airplay-features-output").className = "";
49+
setBitClassName("airplay-features", features, "selected", "notSelected")
50+
}
51+
52+
document.getElementById("airplay-features-dec").innerHTML = features.toString(10);
53+
document.getElementById("airplay-features-hex").innerHTML = "0x" + features.toString(16);
54+
var txt = "0x" + features.and(Long.fromBits(0xffffffff, 0, true)).toString(16) +
55+
",0x" + features.shiftRight(32).toString(16);
56+
document.getElementById("airplay-features-txt").innerHTML = txt;
57+
}
58+
featuresChanged(document.getElementById("airplay-features-input"));
59+
document.getElementById("airplay-features-interactive").className = "";

0 commit comments

Comments
 (0)