tangled
alpha
login
or
join now
modamo.xyz
/
readius
0
fork
atom
Browser extension that sorts Pratt books by distance to patron
0
fork
atom
overview
issues
pulls
pipelines
Display available copies
modamo-gh
4 months ago
dfdfd871
3adc1555
+50
-3
3 changed files
expand all
collapse all
unified
split
src
popup.css
popup.html
popup.ts
+11
-2
src/popup.css
reviewed
···
68
68
}
69
69
70
70
input[type="range"] {
71
71
+
accent-color: white;
71
72
box-sizing: border-box;
72
73
margin: 0;
73
74
padding: 0;
···
75
76
}
76
77
77
78
#copies {
78
78
-
background-color: green;
79
79
flex: 1;
80
80
flex-direction: column;
81
81
gap: 8px;
82
82
height: 256px;
83
83
+
overflow-y: auto;
83
84
width: 100%;
84
85
}
85
86
···
90
91
.copy {
91
92
background-color: white;
92
93
border-radius: 8px;
93
93
-
height: 48px;
94
94
+
display: flex;
95
95
+
flex-direction: column;
96
96
+
gap: 4px;
97
97
+
padding: 8px;
94
98
width: 100%;
95
99
}
100
100
+
101
101
+
.copyText {
102
102
+
color: black;
103
103
+
margin: 0;
104
104
+
}
+1
src/popup.html
reviewed
···
46
46
>Radius</label
47
47
>
48
48
</div>
49
49
+
<h2 id="available"></h2>
49
50
<div
50
51
class="hidden"
51
52
id="copies"
+38
-1
src/popup.ts
reviewed
···
4
4
const MAPBOX = "publicKey";
5
5
6
6
const addressInput = document.querySelector("input");
7
7
+
const availableCopies = document.querySelector("#available");
7
8
const browserLocationButton = document.querySelector("#browserLocation");
8
9
const copiesDiv = document.querySelector("#copies");
9
10
const manualLocationButton = document.querySelector("#manualLocation");
···
39
40
const displayCopies = () => {
40
41
copiesDiv!.innerHTML = "";
41
42
43
43
+
availableCopies!.textContent = `Available Copies Nearby: ${
44
44
+
(window as any).__enochPrattCopies.filter(
45
45
+
(copy) => copy.distance <= Number(sliderInput?.value)
46
46
+
).length
47
47
+
}`;
48
48
+
42
49
(window as any).__enochPrattCopies
43
50
.sort(
44
51
(a: { distance: number }, b: { distance: number }) =>
···
50
57
51
58
copyDiv.classList.add("copy");
52
59
60
60
+
const branch = document.createElement("h3");
61
61
+
branch.classList.add("copyText");
62
62
+
branch.textContent = copy.library;
63
63
+
64
64
+
const distance = document.createElement("p");
65
65
+
distance.classList.add("copyText");
66
66
+
distance.textContent = `Distance: ${copy.distance.toFixed(
67
67
+
2
68
68
+
)} mi`;
69
69
+
70
70
+
const status = document.createElement("p");
71
71
+
status.classList.add("copyText");
72
72
+
status.textContent = `Status: ${copy.status}`;
73
73
+
74
74
+
copyDiv.appendChild(branch);
75
75
+
copyDiv.appendChild(distance);
76
76
+
copyDiv.appendChild(status);
77
77
+
53
78
copiesDiv?.appendChild(copyDiv);
54
79
}
55
80
});
···
97
122
status: div?.innerHTML || ""
98
123
};
99
124
100
100
-
copies.push(copy);
125
125
+
if (
126
126
+
!copy.status.toLowerCase().includes("due") &&
127
127
+
!copy.status.toLowerCase().includes("hold") &&
128
128
+
!copy.status.toLowerCase().includes("in transit")
129
129
+
) {
130
130
+
copies.push(copy);
131
131
+
}
101
132
});
102
133
103
134
return copies;
···
317
348
displayCopies();
318
349
319
350
label.textContent = `${miles} mi`;
351
351
+
352
352
+
availableCopies!.textContent = `Available Copies Nearby: ${
353
353
+
(window as any).__enochPrattCopies.filter(
354
354
+
(copy) => copy.distance <= Number(sliderInput?.value)
355
355
+
).length
356
356
+
}`;
320
357
321
358
if (
322
359
circleInstance &&