@internetarchive/ia-book-actions 0.1.3-alpha2 → 0.1.4-alpha1

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
@@ -135,7 +135,7 @@
135
135
  let loanTotalTime5Min = { loanTotalTime: 300, loanRenewAtLast: 180, pageChangedInLast: 15 };
136
136
  let loanTotalTime1Hour = { loanTotalTime: 3600, loanRenewAtLast: 600, pageChangedInLast: 900 };
137
137
 
138
- iaBookActions.loanRenewTimeConfig = loanTotalTime1Hour;
138
+ iaBookActions.loanRenewTimeConfig = loanTotalTime2Min;
139
139
 
140
140
  let lendingStatus1 = iaBookActions.lendingStatus;
141
141
  let secondsLeftOnLoan = iaBookActions.loanRenewTimeConfig.loanTotalTime;
@@ -150,6 +150,23 @@
150
150
  });
151
151
  });
152
152
 
153
+ window.addEventListener('BookReader:userAction', () => {
154
+ if (this.borrowType === 'browsed') {
155
+ this.suppressToast = false;
156
+ this.autoLoanRenewChecker(true);
157
+ }
158
+
159
+ return nothing;
160
+ });
161
+
162
+ document.querySelector('.brControlClick').addEventListener('click', () => {
163
+ window.dispatchEvent(new CustomEvent('BookReader:userAction', {
164
+ bubbles: true,
165
+ composed: true,
166
+ detail: { props },
167
+ }));
168
+ });
169
+
153
170
  document.querySelectorAll('.errorEnable input[type=checkbox]').forEach((item) => {
154
171
  if (window.location.href.indexOf('?error=true') !== -1) {
155
172
  item.checked = true;
@@ -311,6 +328,9 @@
311
328
  <td>
312
329
  <button class="pageChangedEvent">Page Change Event</button>
313
330
  </td>
331
+ <td>
332
+ <button class="brControlClick">Br Controls</button>
333
+ </td>
314
334
  </tr>
315
335
  </table>
316
336
  </fieldset>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.1.3-alpha2",
3
+ "version": "0.1.4-alpha1",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -36,7 +36,7 @@ export default css`
36
36
  align-items: center;
37
37
  transition: all 0.1s ease 0s;
38
38
  vertical-align: middle;
39
- padding: 0 1rem;
39
+ padding: 0 3rem;
40
40
  outline-color: ${whiteColor};
41
41
  outline-offset: -4px;
42
42
  user-select: none;
@@ -52,7 +52,7 @@ export default class TimerCountdown extends LitElement {
52
52
 
53
53
  timerCountdown() {
54
54
  // - let just execute setInterval in every 1 minute
55
- this.timerExecutionSeconds = 60;
55
+ this.timerExecutionSeconds = 1;
56
56
 
57
57
  /**
58
58
  * set interval in window object
@@ -63,6 +63,7 @@ export default class TimerCountdown extends LitElement {
63
63
  const secondsLeft = Math.round(this.secondsLeftOnLoan);
64
64
 
65
65
  console.log(
66
+ new Date().toLocaleTimeString(),
66
67
  'timeLeftInSec',
67
68
  secondsLeft,
68
69
  ' ||| timeLeftInMin',
@@ -166,7 +166,7 @@ export default class ActionsConfig {
166
166
 
167
167
  return {
168
168
  id: 'purchaseBook',
169
- text: 'Purchase at',
169
+ text: 'Purchase at ',
170
170
  subText: 'Better World Books',
171
171
  title: 'Purchase',
172
172
  url: this.bwbPurchaseUrl,
@@ -271,7 +271,7 @@ export default class IABookActions extends LitElement {
271
271
  /**
272
272
  * detect click-event on document to close toast-template
273
273
  */
274
- document.addEventListener('click', e => {
274
+ window.addEventListener('click', e => {
275
275
  if (this.loanRenewHelper && this.loanRenewResult.secondsLeft > 0) {
276
276
  this.suppressToast = true;
277
277
  }