@internetarchive/ia-book-actions 0.0.29-alpha40 → 0.0.29-alpha41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/demo/index.html
CHANGED
|
@@ -120,7 +120,6 @@
|
|
|
120
120
|
// set defaultLendingStatus for unavailable (without borrowables) book
|
|
121
121
|
let iaBookActions = document.querySelector('ia-book-actions');
|
|
122
122
|
|
|
123
|
-
|
|
124
123
|
iaBookActions.userid = userid;
|
|
125
124
|
iaBookActions.identifier = identifier;
|
|
126
125
|
iaBookActions.bookTitle = 'Contemporary Black biography. Volume 39 : profiles from the interContemporary Black biography. Volume 39';
|
|
@@ -134,7 +133,7 @@
|
|
|
134
133
|
|
|
135
134
|
let isDevBox = true;
|
|
136
135
|
iaBookActions.loanRenewTimeConfig = {
|
|
137
|
-
loanTotalTime: isDevBox ?
|
|
136
|
+
loanTotalTime: isDevBox ? 15 : 3600, // 60 second = 1 min
|
|
138
137
|
loanRenewAtLast: isDevBox ? 10 : 3540, // at last 10th minute
|
|
139
138
|
pageChangedInLast: isDevBox ? 5 : 900, // within last 15 second/minute
|
|
140
139
|
isDevBox: isDevBox,
|
package/package.json
CHANGED
|
@@ -79,6 +79,26 @@ export default class TimerCountdown extends LitElement {
|
|
|
79
79
|
}, timerIntervalSeconds * 1000);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* get remaining time with timeunit
|
|
84
|
+
*
|
|
85
|
+
* @memberof TimerCountdown
|
|
86
|
+
* @return string
|
|
87
|
+
*/
|
|
88
|
+
get remainingTime() {
|
|
89
|
+
let unitOfTime = 'second';
|
|
90
|
+
let timeLeft = Math.round(this.secondsLeftOnLoan);
|
|
91
|
+
|
|
92
|
+
if (timeLeft > 60) {
|
|
93
|
+
unitOfTime = 'minute';
|
|
94
|
+
timeLeft = Math.floor(timeLeft / 60);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return timeLeft !== 1
|
|
98
|
+
? `${timeLeft} ${unitOfTime}s`
|
|
99
|
+
: `${timeLeft} ${unitOfTime}`;
|
|
100
|
+
}
|
|
101
|
+
|
|
82
102
|
render() {
|
|
83
103
|
return html`
|
|
84
104
|
<svg
|
|
@@ -89,8 +109,8 @@ export default class TimerCountdown extends LitElement {
|
|
|
89
109
|
>
|
|
90
110
|
<circle class="circle" cx="50" cy="50" r="50" />
|
|
91
111
|
</svg>
|
|
92
|
-
<span class="sr-only"
|
|
93
|
-
<span>${
|
|
112
|
+
<span class="sr-only">${this.remainingTime}</span>
|
|
113
|
+
<span>${this.remainingTime}</span>
|
|
94
114
|
`;
|
|
95
115
|
}
|
|
96
116
|
|
|
@@ -131,6 +151,17 @@ export default class TimerCountdown extends LitElement {
|
|
|
131
151
|
stroke-dasharray: 0;
|
|
132
152
|
animation: ${timerSecondsLeft} circletimer linear;
|
|
133
153
|
}
|
|
154
|
+
|
|
155
|
+
.sr-only {
|
|
156
|
+
position: absolute;
|
|
157
|
+
left: -9999px;
|
|
158
|
+
width: 1px;
|
|
159
|
+
height: 1px;
|
|
160
|
+
margin: 0;
|
|
161
|
+
padding: 0;
|
|
162
|
+
border: none;
|
|
163
|
+
overflow: hidden;
|
|
164
|
+
}
|
|
134
165
|
`;
|
|
135
166
|
}
|
|
136
167
|
}
|
package/src/ia-book-actions.js
CHANGED