@internetarchive/bookreader 5.0.0-84 → 5.0.0-86
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/BookReader/BookReader.js +1 -1
- package/BookReader/plugins/plugin.chapters.js +1 -1
- package/BookReader/plugins/plugin.chapters.js.map +1 -1
- package/BookReader/plugins/plugin.search.js +1 -1
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReader/plugins/plugin.text_selection.js +1 -1
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.tts.js +1 -1
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/plugins/plugin.chapters.js +2 -2
- package/src/plugins/plugin.text_selection.js +6 -0
- package/src/plugins/search/plugin.search.js +3 -1
- package/src/plugins/tts/PageChunk.js +4 -1
- package/tests/jest/plugins/plugin.text_selection.test.js +1 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -163,11 +163,11 @@ BookReader.prototype.getOpenLibraryRecord = async function (olHost, ocaid) {
|
|
|
163
163
|
const baseURL = `${olHost}/query.json?type=/type/edition&*=`;
|
|
164
164
|
const fetchUrlByBookId = `${baseURL}&ocaid=${ocaid}`;
|
|
165
165
|
|
|
166
|
-
let data = await $.ajax({ url: fetchUrlByBookId
|
|
166
|
+
let data = await $.ajax({ url: fetchUrlByBookId });
|
|
167
167
|
|
|
168
168
|
if (!data || !data.length) {
|
|
169
169
|
// try sourceid
|
|
170
|
-
data = await $.ajax({ url: `${baseURL}&source_records=ia:${ocaid}
|
|
170
|
+
data = await $.ajax({ url: `${baseURL}&source_records=ia:${ocaid}` });
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
return data?.[0];
|
|
@@ -89,6 +89,9 @@ export class TextSelectionPlugin {
|
|
|
89
89
|
url: applyVariables(this.options.fullDjvuXmlUrl, this.optionVariables),
|
|
90
90
|
dataType: this.options.jsonp ? "jsonp" : "html",
|
|
91
91
|
cache: true,
|
|
92
|
+
xhrFields: {
|
|
93
|
+
withCredentials: window.br.protected,
|
|
94
|
+
},
|
|
92
95
|
error: (e) => undefined,
|
|
93
96
|
}).then((res) => {
|
|
94
97
|
try {
|
|
@@ -115,6 +118,9 @@ export class TextSelectionPlugin {
|
|
|
115
118
|
url: applyVariables(this.options.singlePageDjvuXmlUrl, this.optionVariables, { pageIndex: index }),
|
|
116
119
|
dataType: this.options.jsonp ? "jsonp" : "html",
|
|
117
120
|
cache: true,
|
|
121
|
+
xhrFields: {
|
|
122
|
+
withCredentials: window.br.protected,
|
|
123
|
+
},
|
|
118
124
|
error: (e) => undefined,
|
|
119
125
|
});
|
|
120
126
|
try {
|
|
@@ -222,8 +222,10 @@ BookReader.prototype.search = async function(term = '', overrides = {}) {
|
|
|
222
222
|
this.trigger('SearchStarted', { term: this.searchTerm, instance: this });
|
|
223
223
|
callSearchResultsCallback(await $.ajax({
|
|
224
224
|
url: url,
|
|
225
|
-
dataType: 'jsonp',
|
|
226
225
|
cache: true,
|
|
226
|
+
xhrFields: {
|
|
227
|
+
withCredentials: this.protected,
|
|
228
|
+
},
|
|
227
229
|
beforeSend: xhr => { this.searchXHR = xhr; },
|
|
228
230
|
}));
|
|
229
231
|
};
|
|
@@ -25,11 +25,14 @@ export default class PageChunk {
|
|
|
25
25
|
const chunks = await $.ajax({
|
|
26
26
|
type: 'GET',
|
|
27
27
|
url: `https://${server}/BookReader/BookReaderGetTextWrapper.php`,
|
|
28
|
-
dataType:'jsonp',
|
|
29
28
|
cache: true,
|
|
29
|
+
xhrFields: {
|
|
30
|
+
withCredentials: window.br.protected,
|
|
31
|
+
},
|
|
30
32
|
data: {
|
|
31
33
|
path: `${bookPath}_djvu.xml`,
|
|
32
34
|
page: leafIndex,
|
|
35
|
+
callback: 'false',
|
|
33
36
|
},
|
|
34
37
|
});
|
|
35
38
|
return PageChunk._fromTextWrapperResponse(leafIndex, chunks);
|
|
@@ -87,7 +87,7 @@ const FAKE_XML_EMPTY = '';
|
|
|
87
87
|
|
|
88
88
|
describe("Generic tests", () => {
|
|
89
89
|
document.body.innerHTML = '<div id="BookReader">';
|
|
90
|
-
const br = new BookreaderWithTextSelection({
|
|
90
|
+
const br = window.br = new BookreaderWithTextSelection({
|
|
91
91
|
data: [
|
|
92
92
|
[
|
|
93
93
|
{ width: 800, height: 1200,
|