Skip to content

Commit 04d5536

Browse files
committed
Minor edits
1 parent 3ff267f commit 04d5536

File tree

1 file changed

+106
-106
lines changed

1 file changed

+106
-106
lines changed

articles/ai-services/immersive-reader/how-to-multiple-resources.md

Lines changed: 106 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ In this tutorial, you learn how to:
2727

2828
* An Azure subscription. If you don't have one, create a [free account](https://azure.microsoft.com/free/ai-services).
2929
* A single Immersive Reader resource configured for Microsoft Entra authentication. Follow [these instructions](how-to-create-immersive-reader.md) to get set up.
30-
* Follow the [quickstart](quickstarts/client-libraries.md?pivots=programming-language-nodejs) to create a web app that launches the Immersive Reader with NodeJS.
30+
* A [NodeJS web app](quickstarts/client-libraries.md?pivots=programming-language-nodejs) that launches Immersive Reader.
3131

3232
## Create multiple resources
3333

@@ -147,118 +147,118 @@ The `getimmersivereaderlaunchparams` API endpoint should be secured behind some
147147

148148
## Add sample content
149149

150-
1. Open *views\index.pug*, and replace its content with the following code. This code populates the page with some sample content, and adds two buttons that launch the Immersive Reader. One that launches Immersive Reader for the EastUS resource, and another for the WestUS resource.
150+
Open *views\index.pug*, and replace its content with the following code. This code populates the page with some sample content, and adds two buttons that launch the Immersive Reader. One that launches Immersive Reader for the **EastUS** resource, and another for the **WestUS** resource.
151151

152-
```pug
153-
doctype html
154-
html
155-
head
156-
title Immersive Reader Quickstart Node.js
152+
```pug
153+
doctype html
154+
html
155+
head
156+
title Immersive Reader Quickstart Node.js
157157
158-
link(rel='stylesheet', href='https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css')
158+
link(rel='stylesheet', href='https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css')
159159
160-
// A polyfill for Promise is needed for IE11 support.
161-
script(src='https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js')
160+
// A polyfill for Promise is needed for IE11 support.
161+
script(src='https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js')
162162
163-
script(src='https://ircdname.azureedge.net/immersivereadersdk/immersive-reader-sdk.1.2.0.js')
164-
script(src='https://code.jquery.com/jquery-3.3.1.min.js')
163+
script(src='https://ircdname.azureedge.net/immersivereadersdk/immersive-reader-sdk.1.2.0.js')
164+
script(src='https://code.jquery.com/jquery-3.3.1.min.js')
165165
166-
style(type="text/css").
167-
.immersive-reader-button {
168-
background-color: white;
169-
margin-top: 5px;
170-
border: 1px solid black;
171-
float: right;
172-
}
173-
body
174-
div(class="container")
175-
button(class="immersive-reader-button" data-button-style="icon" data-locale="en" onclick='handleLaunchImmersiveReader("wus")') WestUS Immersive Reader
176-
button(class="immersive-reader-button" data-button-style="icon" data-locale="en" onclick='handleLaunchImmersiveReader("eus")') EastUS Immersive Reader
177-
178-
h1(id="ir-title") About Immersive Reader
179-
div(id="ir-content" lang="en-us")
180-
p Immersive Reader is a tool that implements proven techniques to improve reading comprehension for emerging readers, language learners, and people with learning differences. The Immersive Reader is designed to make reading more accessible for everyone. The Immersive Reader
181-
182-
ul
183-
li Shows content in a minimal reading view
184-
li Displays pictures of commonly used words
185-
li Highlights nouns, verbs, adjectives, and adverbs
186-
li Reads your content out loud to you
187-
li Translates your content into another language
188-
li Breaks down words into syllables
189-
190-
h3 The Immersive Reader is available in many languages.
191-
192-
p(lang="es-es") El Lector inmersivo está disponible en varios idiomas.
193-
p(lang="zh-cn") 沉浸式阅读器支持许多语言
194-
p(lang="de-de") Der plastische Reader ist in vielen Sprachen verfügbar.
195-
p(lang="ar-eg" dir="rtl" style="text-align:right") يتوفر \"القارئ الشامل\" في العديد من اللغات.
196-
197-
script(type="text/javascript").
198-
function getTokenAndSubdomainAsync(region) {
199-
return new Promise(function (resolve, reject) {
200-
$.ajax({
201-
url: "/GetTokenAndSubdomain",
202-
type: "GET",
203-
data: {
204-
region: region
205-
},
206-
success: function (data) {
207-
if (data.error) {
208-
reject(data.error);
209-
} else {
210-
resolve(data);
211-
}
212-
},
213-
error: function (err) {
214-
reject(err);
166+
style(type="text/css").
167+
.immersive-reader-button {
168+
background-color: white;
169+
margin-top: 5px;
170+
border: 1px solid black;
171+
float: right;
172+
}
173+
body
174+
div(class="container")
175+
button(class="immersive-reader-button" data-button-style="icon" data-locale="en" onclick='handleLaunchImmersiveReader("wus")') WestUS Immersive Reader
176+
button(class="immersive-reader-button" data-button-style="icon" data-locale="en" onclick='handleLaunchImmersiveReader("eus")') EastUS Immersive Reader
177+
178+
h1(id="ir-title") About Immersive Reader
179+
div(id="ir-content" lang="en-us")
180+
p Immersive Reader is a tool that implements proven techniques to improve reading comprehension for emerging readers, language learners, and people with learning differences. The Immersive Reader is designed to make reading more accessible for everyone. The Immersive Reader
181+
182+
ul
183+
li Shows content in a minimal reading view
184+
li Displays pictures of commonly used words
185+
li Highlights nouns, verbs, adjectives, and adverbs
186+
li Reads your content out loud to you
187+
li Translates your content into another language
188+
li Breaks down words into syllables
189+
190+
h3 The Immersive Reader is available in many languages.
191+
192+
p(lang="es-es") El Lector inmersivo está disponible en varios idiomas.
193+
p(lang="zh-cn") 沉浸式阅读器支持许多语言
194+
p(lang="de-de") Der plastische Reader ist in vielen Sprachen verfügbar.
195+
p(lang="ar-eg" dir="rtl" style="text-align:right") يتوفر \"القارئ الشامل\" في العديد من اللغات.
196+
197+
script(type="text/javascript").
198+
function getTokenAndSubdomainAsync(region) {
199+
return new Promise(function (resolve, reject) {
200+
$.ajax({
201+
url: "/GetTokenAndSubdomain",
202+
type: "GET",
203+
data: {
204+
region: region
205+
},
206+
success: function (data) {
207+
if (data.error) {
208+
reject(data.error);
209+
} else {
210+
resolve(data);
215211
}
216-
});
212+
},
213+
error: function (err) {
214+
reject(err);
215+
}
216+
});
217+
});
218+
}
219+
220+
function handleLaunchImmersiveReader(region) {
221+
getTokenAndSubdomainAsync(region)
222+
.then(function (response) {
223+
const token = response["token"];
224+
const subdomain = response["subdomain"];
225+
// Learn more about chunk usage and supported MIME types https://learn.microsoft.com/azure/ai-services/immersive-reader/reference#chunk
226+
const data = {
227+
title: $("#ir-title").text(),
228+
chunks: [{
229+
content: $("#ir-content").html(),
230+
mimeType: "text/html"
231+
}]
232+
};
233+
// Learn more about options https://learn.microsoft.com/azure/ai-services/immersive-reader/reference#options
234+
const options = {
235+
"onExit": exitCallback,
236+
"uiZIndex": 2000
237+
};
238+
ImmersiveReader.launchAsync(token, subdomain, data, options)
239+
.catch(function (error) {
240+
alert("Error in launching the Immersive Reader. Check the console.");
241+
console.log(error);
242+
});
243+
})
244+
.catch(function (error) {
245+
alert("Error in getting the Immersive Reader token and subdomain. Check the console.");
246+
console.log(error);
217247
});
218-
}
219-
220-
function handleLaunchImmersiveReader(region) {
221-
getTokenAndSubdomainAsync(region)
222-
.then(function (response) {
223-
const token = response["token"];
224-
const subdomain = response["subdomain"];
225-
// Learn more about chunk usage and supported MIME types https://learn.microsoft.com/azure/ai-services/immersive-reader/reference#chunk
226-
const data = {
227-
title: $("#ir-title").text(),
228-
chunks: [{
229-
content: $("#ir-content").html(),
230-
mimeType: "text/html"
231-
}]
232-
};
233-
// Learn more about options https://learn.microsoft.com/azure/ai-services/immersive-reader/reference#options
234-
const options = {
235-
"onExit": exitCallback,
236-
"uiZIndex": 2000
237-
};
238-
ImmersiveReader.launchAsync(token, subdomain, data, options)
239-
.catch(function (error) {
240-
alert("Error in launching the Immersive Reader. Check the console.");
241-
console.log(error);
242-
});
243-
})
244-
.catch(function (error) {
245-
alert("Error in getting the Immersive Reader token and subdomain. Check the console.");
246-
console.log(error);
247-
});
248-
}
249-
250-
function exitCallback() {
251-
console.log("This is the callback function. It is executed when the Immersive Reader closes.");
252-
}
253-
```
254-
255-
1. Your web app is now ready. Start the app by running:
256-
257-
```bash
258-
npm start
259-
```
260-
261-
1. Open your browser and navigate to `http://localhost:3000`. You should see the above content on the page. Select either the **EastUS Immersive Reader** button or the **WestUS Immersive Reader** button to launch the Immersive Reader using those respective resources.
248+
}
249+
250+
function exitCallback() {
251+
console.log("This is the callback function. It is executed when the Immersive Reader closes.");
252+
}
253+
```
254+
255+
Your web app is now ready. Start the app by running:
256+
257+
```bash
258+
npm start
259+
```
260+
261+
Open your browser and navigate to `http://localhost:3000`. You should see the above content on the page. Select either the **EastUS Immersive Reader** button or the **WestUS Immersive Reader** button to launch the Immersive Reader using those respective resources.
262262

263263
## Next step
264264

0 commit comments

Comments
 (0)