├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── assets ├── icon-20.png ├── icon-40.png └── icon.svg ├── immersive-reader-sdk.podspec └── js ├── .npmignore ├── README.md ├── azure-pipelines.yml ├── build ├── copy-dev.js ├── edog.js └── version.js ├── package.json ├── samples ├── advanced-csharp-multiple-resources │ ├── Controllers │ │ └── HomeController.cs │ ├── ImmersiveReaderLaunchParameters.cs │ ├── ImmersiveReaderResourceConfig.cs │ ├── Models │ │ └── ErrorViewModel.cs │ ├── MultipleResourcesSampleWebApp.csproj │ ├── MultipleResourcesSampleWebApp.sln │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── ReadMe.md │ ├── Views │ │ ├── Home │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ ├── _Layout.cshtml.css │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ │ ├── css │ │ ├── site.css │ │ └── site.min.css │ │ ├── favicon.ico │ │ ├── images │ │ ├── banner1.svg │ │ ├── banner2.svg │ │ ├── banner3.svg │ │ └── banner4.svg │ │ └── js │ │ ├── site.js │ │ └── site.min.js ├── advanced-csharp │ ├── AdvancedSampleWebApp.csproj │ ├── AdvancedSampleWebApp.sln │ ├── Canary.cs │ ├── Controllers │ │ └── HomeController.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── ReadMe.md │ ├── SamplePageModel.cs │ ├── Views │ │ └── Home │ │ │ ├── Document.cshtml │ │ │ ├── Document.cshtml.cs │ │ │ ├── Index.cshtml │ │ │ ├── Index.cshtml.cs │ │ │ ├── Math.cshtml │ │ │ ├── Math.cshtml.cs │ │ │ ├── MultiLang.cshtml │ │ │ ├── MultiLang.cshtml.cs │ │ │ ├── Options.cshtml │ │ │ ├── Options.cshtml.cs │ │ │ ├── UILangs.cshtml │ │ │ ├── UILangs.cshtml.cs │ │ │ ├── WordDoc.cshtml │ │ │ └── WordDoc.cshtml.cs │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ │ ├── css │ │ ├── buttons.css │ │ ├── site.css │ │ └── styles.css │ │ ├── images │ │ └── icon.svg │ │ └── js │ │ └── helpers.js ├── advanced-nodejs │ ├── ReadMe.md │ ├── app.js │ ├── bin │ │ └── www │ ├── package.json │ ├── public │ │ ├── css │ │ │ ├── buttons.css │ │ │ └── styles.css │ │ ├── images │ │ │ └── icon.svg │ │ └── js │ │ │ └── helpers.js │ ├── routes │ │ ├── requests.js │ │ └── views.js │ └── views │ │ ├── document.html │ │ ├── hide-exit-button.html │ │ ├── inner-hide-exit-button.html │ │ ├── math.html │ │ ├── multilang.html │ │ ├── options.html │ │ ├── sections.html │ │ └── uilangs.html ├── azure-function-csharp │ ├── .gitignore │ ├── ManagedIdentityAzureADTokenProvider.cs │ ├── Program.cs │ ├── Readme.md │ ├── host.json │ ├── images │ │ ├── azfunc1.png │ │ ├── azfunc2.png │ │ ├── azfunc3.png │ │ ├── azfunc4.png │ │ ├── azfunc5.png │ │ ├── azfunc6.png │ │ ├── azfunc7.png │ │ ├── azfunc8.png │ │ ├── azid1.png │ │ ├── azid2.png │ │ ├── azid3.png │ │ ├── azid4.png │ │ ├── azid5.png │ │ ├── azid6.png │ │ ├── azid7.png │ │ ├── azid8.png │ │ ├── azid9.png │ │ ├── azpor1.png │ │ ├── azpor2.png │ │ ├── funchost.png │ │ └── funcresponse.png │ ├── local.settings.json │ └── quickstart-azure-function-csharp.csproj ├── ember-sample │ ├── .ember-cli │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierignore │ ├── .template-lintrc.js │ ├── README.md │ ├── app │ │ ├── app.js │ │ ├── components │ │ │ ├── .gitkeep │ │ │ ├── reader-view.hbs │ │ │ └── reader-view.js │ │ ├── helpers │ │ │ └── .gitkeep │ │ ├── index.html │ │ ├── router.js │ │ ├── routes │ │ │ ├── .gitkeep │ │ │ └── reader.js │ │ ├── styles │ │ │ └── app.css │ │ └── templates │ │ │ └── application.hbs │ ├── config │ │ ├── ember-cli-update.json │ │ ├── optional-features.json │ │ └── targets.js │ ├── ember-cli-build.js │ ├── package-lock.json │ ├── package.json │ ├── server │ │ ├── .env_sample │ │ ├── .gitignore │ │ ├── app.js │ │ ├── bin │ │ │ └── www │ │ ├── package.json │ │ ├── routes │ │ │ └── index.js │ │ └── yarn.lock │ └── vendor │ │ └── .gitkeep ├── ios │ ├── README.md │ ├── quickstart-swift.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── quickstart-swift │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ ├── Checkmark.imageset │ │ │ │ ├── Checkmark@2x.png │ │ │ │ └── Contents.json │ │ │ ├── Checkmarkempty.imageset │ │ │ │ ├── Checkmarkempty@2x.png │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── ImmersiveReader.swift │ │ ├── ImmersiveReaderViewController.swift │ │ ├── Info.plist │ │ ├── LaunchViewController.swift │ │ ├── PrefixHeader.pch │ │ ├── Preview Content │ │ │ └── Preview Assets.xcassets │ │ │ │ └── Contents.json │ │ ├── Resources │ │ │ ├── ImmersiveReader.html │ │ │ └── iFrameMessaging.js │ │ └── immersive_reader_sdk.h │ └── server │ │ ├── .env_sample │ │ ├── .gitignore │ │ ├── app.js │ │ ├── bin │ │ └── www │ │ ├── package.json │ │ ├── routes │ │ └── index.js │ │ └── yarn.lock ├── quickstart-csharp-azfunction │ ├── Controllers │ │ └── HomeController.cs │ ├── Models │ │ └── ErrorViewModel.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Readme.md │ ├── Startup.cs │ ├── Views │ │ ├── Home │ │ │ ├── Index.cshtml │ │ │ └── Privacy.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.json │ ├── quickstart-csharp-azfunction.csproj │ ├── quickstart-csharp-azfunction.sln │ └── wwwroot │ │ ├── css │ │ └── site.css │ │ ├── favicon.ico │ │ ├── images │ │ └── gettoken.png │ │ └── js │ │ └── site.js ├── quickstart-csharp │ ├── Controllers │ │ └── HomeController.cs │ ├── Models │ │ └── ErrorViewModel.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── QuickstartSampleWebApp.csproj │ ├── QuickstartSampleWebApp.sln │ ├── ReadMe.md │ ├── Views │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ ├── Index.cshtml │ │ │ ├── Options.cshtml │ │ │ └── Privacy.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _CookieConsentPartial.cshtml │ │ │ ├── _Layout.cshtml │ │ │ ├── _Layout.cshtml.css │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ │ ├── css │ │ ├── site.css │ │ └── site.min.css │ │ ├── favicon.ico │ │ ├── images │ │ ├── banner1.svg │ │ ├── banner2.svg │ │ └── banner3.svg │ │ └── js │ │ ├── site.js │ │ └── site.min.js ├── quickstart-java-android │ ├── .gitignore │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── ReadMe.md │ ├── app │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── immersiveReader.html │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── immersivereadersdk │ │ │ │ ├── AuthenticationTask.java │ │ │ │ ├── Chunk.java │ │ │ │ ├── Content.java │ │ │ │ ├── Error.java │ │ │ │ ├── IRActivity.java │ │ │ │ ├── IRAuthenticator.java │ │ │ │ ├── IRDataHolder.java │ │ │ │ ├── IRError.java │ │ │ │ ├── IRLauncher.java │ │ │ │ ├── IRStore.java │ │ │ │ ├── ImmersiveReader.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── Message.java │ │ │ │ ├── Options.java │ │ │ │ ├── ReadableContent.java │ │ │ │ ├── ReadableTextChunk.java │ │ │ │ └── WebAppInterface.java │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ ├── activity_immersive_reader.xml │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── quickstart-java │ ├── ReadMe.md │ ├── pom.xml │ ├── quickstart-java.iml │ └── src │ │ └── main │ │ ├── java │ │ └── Microsoft │ │ │ └── ImmersiveReader │ │ │ └── GetAuthTokenServlet.java │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ ├── index.jsp │ │ ├── options.jsp │ │ └── resources │ │ └── helpers.js ├── quickstart-kotlin-azfunction │ ├── .gitignore │ ├── README.md │ ├── app │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── immersiveReader.html │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── immersivereadersdk │ │ │ │ ├── MainActivity.kt │ │ │ │ └── WebAppInterface.kt │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── quickstart-kotlin │ ├── .gitignore │ ├── README.md │ ├── app │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── immersiveReader.html │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── immersivereadersdk │ │ │ │ ├── MainActivity.kt │ │ │ │ └── WebAppInterface.kt │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── server │ │ ├── .env_sample │ │ ├── .gitignore │ │ ├── app.js │ │ ├── bin │ │ │ └── www │ │ ├── package.json │ │ ├── routes │ │ │ └── index.js │ │ └── yarn.lock │ └── settings.gradle ├── quickstart-nodejs │ ├── ReadMe.md │ ├── app.js │ ├── bin │ │ └── www │ ├── package.json │ ├── public │ │ ├── js │ │ │ └── helpers.js │ │ └── stylesheets │ │ │ └── style.css │ ├── routes │ │ ├── index.js │ │ ├── options.js │ │ └── users.js │ ├── views │ │ ├── error.pug │ │ ├── index.pug │ │ ├── layout.pug │ │ └── options.pug │ └── yarn.lock ├── quickstart-python │ ├── ReadMe.md │ ├── app.py │ ├── static │ │ └── helpers.js │ └── templates │ │ ├── index.html │ │ └── options.html ├── react-sample-server │ ├── README.md │ ├── client │ │ ├── .env_sample │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ │ └── index.html │ │ ├── src │ │ │ ├── App.js │ │ │ ├── AppOptions.js │ │ │ └── index.js │ │ └── yarn.lock │ └── server │ │ ├── .env_sample │ │ ├── .gitignore │ │ ├── app.js │ │ ├── bin │ │ └── www │ │ ├── package.json │ │ ├── routes │ │ └── index.js │ │ └── yarn.lock ├── react-sample-simple │ ├── .env_sample │ ├── .gitignore │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ │ └── index.html │ ├── src │ │ ├── App.js │ │ ├── AppOptions.js │ │ └── index.js │ └── yarn.lock ├── simple │ ├── Readme.md │ └── renderButtonsPlusHtml.html └── uwp │ ├── ImmersiveReader.sln │ ├── ImmersiveReader │ ├── ImmersiveReader.csproj │ ├── ImmersiveReaderView.xaml │ ├── ImmersiveReaderView.xaml.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── script.html │ ├── README.md │ └── SampleApp │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── Package.appxmanifest │ ├── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml │ └── SampleApp.csproj ├── src ├── content.ts ├── error.ts ├── immersive-reader-sdk.ts ├── launchAsync.ts ├── launchResponse.ts ├── options.ts └── renderButtons.ts ├── tests ├── launchAsync.test.ts └── renderButtons.test.ts ├── tsconfig.json ├── tslint.json ├── webpack.config.js └── yarn.lock /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This project welcomes contributions and suggestions. Most contributions require you to 4 | agree to a Contributor License Agreement (CLA) declaring that you have the right to, 5 | and actually do, grant us the rights to use your contribution. For details, visit 6 | https://cla.microsoft.com. 7 | 8 | When you submit a pull request, a CLA-bot will automatically determine whether you need 9 | to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the 10 | instructions provided by the bot. You will only need to do this once across all repositories using our CLA. 11 | 12 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 13 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 14 | or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 15 | 16 | Please submit pull requests to the [dev](https://github.com/microsoft/immersive-reader-sdk/tree/dev) branch. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Microsoft Corporation. All rights reserved. 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Azure Applied AI Immersive Reader - Immersive Reader SDK 2 | 3 | The Immersive Reader SDK is a set of libraries that allow you to easily and quickly integrate the [Immersive Reader](https://azure.microsoft.com/services/immersive-reader) into your application. 4 | 5 | ## Usage 6 | 7 | * [JavaScript](./js) 8 | * [Usage](https://docs.microsoft.com/azure/cognitive-services/immersive-reader/reference) 9 | 10 | ## Contributing 11 | 12 | We welcome [contributions](CONTRIBUTING.md) to this project. 13 | 14 | * [Submit bugs](https://github.com/microsoft/immersive-reader-sdk/issues) and help us verify fixes as they are checked in. 15 | * Submit and review [source code changes](https://github.com/microsoft/immersive-reader-sdk/pulls). 16 | * Join the discussion on [StackOverflow](https://stackoverflow.com/questions/tagged/immersive-reader) and [Twitter](https://twitter.com/hashtag/ImmersiveReader). 17 | 18 | Please submit pull requests to the [dev](https://github.com/microsoft/immersive-reader-sdk/tree/dev) branch. 19 | 20 | ## Reporting Security Issues 21 | 22 | Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at 23 | [secure@microsoft.com](mailto:secure@microsoft.com). You should receive a response within 24 hours. If for some reason 24 | you do not, please follow up via email to ensure we received your original message. Further information, including the 25 | [MSRC PGP](https://technet.microsoft.com/security/dn606155) key, can be found in the 26 | [Security TechCenter](https://technet.microsoft.com/security/default). 27 | 28 | ## License 29 | 30 | Copyright (c) Microsoft Corporation. All rights reserved. 31 | 32 | Licensed under the [MIT](LICENSE.txt) License. 33 | -------------------------------------------------------------------------------- /assets/icon-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/assets/icon-20.png -------------------------------------------------------------------------------- /assets/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/assets/icon-40.png -------------------------------------------------------------------------------- /assets/icon.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /immersive-reader-sdk.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = "immersive-reader-sdk" 3 | spec.version = "1.0.0" 4 | spec.summary = "Microsoft Cognitive Services - Immersive Reader iOS SDK" 5 | 6 | spec.description = <<-DESC 7 | Integrate Microsoft Cognitive Services Immersive Reader iOS SDK into your iOS App. 8 | DESC 9 | spec.homepage = "https://github.com/microsoft/immersive-reader-sdk/iOS" 10 | spec.license = "MIT" 11 | spec.author = { "Immersive Reader SDK" => "irsdk@microsoft.com" } 12 | spec.platform = :ios, "9.0" 13 | 14 | spec.source = { :git => "https://github.com/microsoft/immersive-reader-sdk.git", :tag => "legacy-ios" } 15 | spec.source_files = ["iOS/immersive-reader-sdk/immersive-reader-sdk/ImmersiveReaderViewController.swift", "iOS/immersive-reader-sdk/immersive-reader-sdk/LaunchImmersiveReader.swift", "iOS/immersive-reader-sdk/immersive-reader-sdk/TestingHandler.swift", "iOS/immersive-reader-sdk/immersive-reader-sdk/immersive_reader_sdk.h"] 16 | 17 | spec.resource_bundles = { 18 | 'immersive-reader-sdk' => ['iOS/immersive-reader-sdk/immersive-reader-sdk/Resources/TestPage.html', 'iOS/immersive-reader-sdk/immersive-reader-sdk/Resources/iFrameMessaging.js'] 19 | } 20 | spec.preserve_paths = "iOS/immersive-reader-sdk/immersive-reader-sdk/Resources/*" 21 | 22 | end 23 | -------------------------------------------------------------------------------- /js/.npmignore: -------------------------------------------------------------------------------- 1 | assets 2 | build 3 | dist 4 | samples 5 | src 6 | tests 7 | .vscode/ 8 | azure-pipelines.yml 9 | CONTRIBUTING.md 10 | tsconfig.json 11 | tslint.json 12 | yarn.lock 13 | webpack.config.js -------------------------------------------------------------------------------- /js/azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | - master 3 | 4 | pool: 5 | vmImage: 'Ubuntu-16.04' 6 | 7 | steps: 8 | - script: yarn 9 | displayName: 'yarn install' 10 | 11 | - script: yarn build 12 | displayName: 'yarn build' 13 | 14 | - script: yarn test 15 | displayName: 'yarn test' 16 | 17 | -------------------------------------------------------------------------------- /js/build/copy-dev.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | // This script copies the locally built immersive-reader-sdk.js file to the supplied --outPath 5 | 6 | const fs = require('fs'); 7 | 8 | const outPathIndex = process.argv.indexOf('--outPath'); 9 | 10 | if (outPathIndex == -1) { 11 | return; 12 | } 13 | 14 | const outPath = process.argv[outPathIndex + 1]; 15 | 16 | fs.copyFileSync('lib/immersive-reader-sdk.js', outPath); -------------------------------------------------------------------------------- /js/build/edog.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | // This script is used internally at Microsoft for testing-related purposes. 5 | 6 | const fs = require('fs'); 7 | const replace = require('replace-in-file'); 8 | 9 | fs.copyFileSync('lib/immersive-reader-sdk.js', 'lib/immersive-reader-sdk.edog.js'); 10 | fs.copyFileSync('lib/immersive-reader-sdk.js', 'lib/immersive-reader-sdk.local.js'); 11 | 12 | replace.sync({ 13 | files: 'lib/immersive-reader-sdk.edog.js', 14 | from: /cognitiveservices\.azure\.com/g, 15 | to: 'ppe.cognitiveservices.azure.com' 16 | }); 17 | 18 | replace.sync({ 19 | files: 'lib/immersive-reader-sdk.local.js', 20 | from: /https:\/\/learningtools\.onenote\.com\/learningtoolsapp\/cognitive\/reader/g, 21 | to: 'reader.html' 22 | }); 23 | 24 | replace.sync({ 25 | files: 'lib/immersive-reader-sdk.local.js', 26 | from: /https:\/\/contentstorage\.onenote\.office\.net\/onenoteltir\/permanent-static-resources\//g, 27 | to: '' 28 | }); -------------------------------------------------------------------------------- /js/build/version.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | var package = require('../package.json'); 5 | console.log(package.version); -------------------------------------------------------------------------------- /js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@microsoft/immersive-reader-sdk", 3 | "version": "1.4.0", 4 | "homepage": "https://github.com/Microsoft/immersive-reader-sdk", 5 | "license": "MIT", 6 | "main": "lib/immersive-reader-sdk.js", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/microsoft/immersive-reader-sdk.git", 10 | "directory": "js" 11 | }, 12 | "types": "lib/immersive-reader-sdk.d.ts", 13 | "devDependencies": { 14 | "@types/jest": "^27.0.2", 15 | "@types/node": "^12.12.14", 16 | "jest": "^27.3.1", 17 | "replace-in-file": "^3.4.4", 18 | "ts-jest": "^27.0.7", 19 | "ts-loader": "^5.3.3", 20 | "tslint": "^5.14.0", 21 | "tslint-loader": "^3.5.4", 22 | "tslint-microsoft-contrib": "^6.1.0", 23 | "typescript": "^3.8", 24 | "webpack": "^5.76.0", 25 | "webpack-cli": "^4.9.1" 26 | }, 27 | "scripts": { 28 | "build": "webpack --config webpack.config.js", 29 | "build:details": "webpack --config webpack.config.js --display-error-details", 30 | "prepublish": "yarn build", 31 | "test": "jest" 32 | }, 33 | "jest": { 34 | "preset": "ts-jest", 35 | "testEnvironment": "jsdom" 36 | }, 37 | "dependencies": { 38 | "decode-uri-component": "0.2.1", 39 | "json-schema": "^0.4.0", 40 | "loader-utils": "^3.2.1", 41 | "minimatch": "3.0.5", 42 | "string_decoder": "^1.3.0", 43 | "terser": "^5.14.2" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/ImmersiveReaderLaunchParameters.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | namespace MultipleResourcesSampleWebApp 5 | { 6 | /// 7 | /// Parameters used to launch the Immersive Reader on the client side 8 | /// 9 | public struct ImmersiveReaderLaunchParameters 10 | { 11 | public string Token { get; set; } 12 | public string Subdomain { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/ImmersiveReaderResourceConfig.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | namespace MultipleResourcesSampleWebApp 5 | { 6 | /// 7 | /// Configuration values for a resource created with Azure Active Directory 8 | /// https://docs.microsoft.com/azure/applied-ai-services/immersive-reader/how-to-create-immersive-reader 9 | /// 10 | public struct ImmersiveReaderResourceConfig 11 | { 12 | public string TenantId { get; set; } // Azure subscription TenantId 13 | public string ClientId { get; set; } // Azure AD ApplicationId 14 | public string ClientSecret { get; set; } // Azure AD Application Service Principal password 15 | public string Subdomain { get; set; } // Immersive Reader resource subdomain (resource 'Name' if the resource was created in the Azure portal, or 'CustomSubDomain' option if the resource was created with Azure CLI Powershell. Check the Azure portal for the subdomain on the Endpoint in the resource Overview page, for example, 'https://[SUBDOMAIN].cognitiveservices.azure.com/') 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | namespace MultipleResourcesSampleWebApp.Models 5 | { 6 | public class ErrorViewModel 7 | { 8 | public string RequestId { get; set; } 9 | 10 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 11 | } 12 | } -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/MultipleResourcesSampleWebApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/MultipleResourcesSampleWebApp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.32112.339 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultipleResourcesSampleWebApp", "MultipleResourcesSampleWebApp.csproj", "{F7CA9BF5-33C1-4526-AE0C-B748215310BF}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {F7CA9BF5-33C1-4526-AE0C-B748215310BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {F7CA9BF5-33C1-4526-AE0C-B748215310BF}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {F7CA9BF5-33C1-4526-AE0C-B748215310BF}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {F7CA9BF5-33C1-4526-AE0C-B748215310BF}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {96652F6F-5DD9-4F1C-ACA6-2308AB019C8D} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | var builder = WebApplication.CreateBuilder(args); 5 | 6 | builder.Services.AddControllersWithViews(); 7 | 8 | var app = builder.Build(); 9 | 10 | if (!app.Environment.IsDevelopment()) 11 | { 12 | app.UseExceptionHandler("/Home/Error"); 13 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 14 | app.UseHsts(); 15 | } 16 | 17 | app.UseHttpsRedirection(); 18 | app.UseStaticFiles(); 19 | 20 | app.UseRouting(); 21 | 22 | app.MapControllerRoute( 23 | name: "default", 24 | pattern: "{controller=Home}/{action=Index}/{id?}"); 25 | 26 | app.Run(); 27 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "MultipleResourcesSampleWebApp": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": true, 6 | "launchBrowser": true, 7 | "applicationUrl": "https://localhost:7135", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |

Error.

7 |

An error occurred while processing your request.

8 | 9 | @if (Model?.ShowRequestId ?? false) 10 | { 11 |

12 | Request ID: @Model.RequestId 13 |

14 | } 15 | 16 |

Development Mode

17 |

18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

20 |

21 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. 22 |

23 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/Views/Shared/_Layout.cshtml.css: -------------------------------------------------------------------------------- 1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | for details on configuring this project to bundle and minify static web assets. */ 3 | 4 | a.navbar-brand { 5 | white-space: normal; 6 | text-align: center; 7 | word-break: break-all; 8 | } 9 | 10 | a { 11 | color: #0077cc; 12 | } 13 | 14 | .btn-primary { 15 | color: #fff; 16 | background-color: #1b6ec2; 17 | border-color: #1861ac; 18 | } 19 | 20 | .nav-pills .nav-link.active, .nav-pills .show > .nav-link { 21 | color: #fff; 22 | background-color: #1b6ec2; 23 | border-color: #1861ac; 24 | } 25 | 26 | .border-top { 27 | border-top: 1px solid #e5e5e5; 28 | } 29 | .border-bottom { 30 | border-bottom: 1px solid #e5e5e5; 31 | } 32 | 33 | .box-shadow { 34 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); 35 | } 36 | 37 | button.accept-policy { 38 | font-size: 1rem; 39 | line-height: inherit; 40 | } 41 | 42 | .footer { 43 | position: absolute; 44 | bottom: 0; 45 | width: 100%; 46 | white-space: nowrap; 47 | line-height: 60px; 48 | } 49 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using MultipleResourcesSampleWebApp 2 | @using MultipleResourcesSampleWebApp.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | html { 2 | font-size: 14px; 3 | } 4 | 5 | @media (min-width: 768px) { 6 | html { 7 | font-size: 16px; 8 | } 9 | } 10 | 11 | html { 12 | position: relative; 13 | min-height: 100%; 14 | } 15 | 16 | body { 17 | margin-bottom: 60px; 18 | padding-top: 50px; 19 | padding-bottom: 20px; 20 | } 21 | 22 | /* Wrapping element */ 23 | /* Set some basic padding to keep content from hitting the edges */ 24 | .body-content { 25 | padding-left: 15px; 26 | padding-right: 15px; 27 | } 28 | 29 | /* Carousel */ 30 | .carousel-caption p { 31 | font-size: 20px; 32 | line-height: 1.4; 33 | } 34 | 35 | /* Make .svg files in the carousel display properly in older browsers */ 36 | .carousel-inner .item img[src$=".svg"] { 37 | width: 100%; 38 | } 39 | 40 | /* QR code generator */ 41 | #qrCode { 42 | margin: 15px; 43 | } 44 | 45 | /* Hide/rearrange for smaller screens */ 46 | @media screen and (max-width: 767px) { 47 | /* Hide captions */ 48 | .carousel-caption { 49 | display: none; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/advanced-csharp-multiple-resources/wwwroot/favicon.ico -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Write your JavaScript code. 2 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp-multiple-resources/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/advanced-csharp-multiple-resources/wwwroot/js/site.min.js -------------------------------------------------------------------------------- /js/samples/advanced-csharp/AdvancedSampleWebApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp/AdvancedSampleWebApp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.32112.339 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvancedSampleWebApp", "AdvancedSampleWebApp.csproj", "{8100D733-7053-4068-9300-982D2A1F7875}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {8100D733-7053-4068-9300-982D2A1F7875}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {8100D733-7053-4068-9300-982D2A1F7875}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {8100D733-7053-4068-9300-982D2A1F7875}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {8100D733-7053-4068-9300-982D2A1F7875}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {83BADBF2-216D-4C17-BC34-63A02AFE0D90} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | var builder = WebApplication.CreateBuilder(args); 5 | 6 | builder.Services.AddControllersWithViews(); 7 | 8 | var app = builder.Build(); 9 | 10 | if (!app.Environment.IsDevelopment()) 11 | { 12 | app.UseExceptionHandler("/Error"); 13 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 14 | app.UseHsts(); 15 | } 16 | 17 | app.UseHttpsRedirection(); 18 | app.UseStaticFiles(); 19 | 20 | app.UseRouting(); 21 | 22 | app.MapControllerRoute( 23 | name: "default", 24 | pattern: "{controller=Home}/{action=Index}/{id?}"); 25 | 26 | app.Run(); 27 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "AdvancedSampleWebApp": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": true, 6 | "launchBrowser": true, 7 | "applicationUrl": "https://localhost:7152", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp/SamplePageModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using Microsoft.AspNetCore.Mvc.RazorPages; 5 | using Microsoft.Extensions.Configuration; 6 | 7 | namespace AdvancedSampleWebApp.Pages 8 | { 9 | public class SamplePageModel : PageModel 10 | { 11 | public SamplePageModel(IConfiguration configuration) 12 | { 13 | } 14 | 15 | public void OnGet() 16 | { 17 | ViewData["Canary"] = Canary.Generate(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp/Views/Home/Document.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using AdvancedSampleWebApp.Pages; 5 | 6 | namespace AdvancedSampleWebApp.Views.Home 7 | { 8 | public class DocumentModel : SamplePageModel 9 | { 10 | public DocumentModel(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /js/samples/advanced-csharp/Views/Home/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using AdvancedSampleWebApp.Pages; 5 | 6 | namespace AdvancedSampleWebApp.Views.Home 7 | { 8 | public class IndexModel : SamplePageModel 9 | { 10 | public IndexModel(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /js/samples/advanced-csharp/Views/Home/Math.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using AdvancedSampleWebApp.Pages; 5 | 6 | namespace AdvancedSampleWebApp.Views.Home 7 | { 8 | public class MathModel : SamplePageModel 9 | { 10 | public MathModel(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /js/samples/advanced-csharp/Views/Home/MultiLang.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using AdvancedSampleWebApp.Pages; 5 | 6 | namespace AdvancedSampleWebApp.Views.Home 7 | { 8 | public class MultiLangModel : SamplePageModel 9 | { 10 | public MultiLangModel(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /js/samples/advanced-csharp/Views/Home/Options.cshtml.cs: -------------------------------------------------------------------------------- 1 | using AdvancedSampleWebApp.Pages; 2 | 3 | namespace AdvancedSampleWebApp.Views.Home 4 | { 5 | public class OptionsModel : SamplePageModel 6 | { 7 | public OptionsModel(IConfiguration configuration) : base(configuration) 8 | { } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp/Views/Home/UILangs.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using AdvancedSampleWebApp.Pages; 5 | 6 | namespace AdvancedSampleWebApp.Views.Home 7 | { 8 | public class UILangsModel : SamplePageModel 9 | { 10 | public UILangsModel(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /js/samples/advanced-csharp/Views/Home/WordDoc.cshtml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | using AdvancedSampleWebApp.Pages; 5 | 6 | namespace AdvancedSampleWebApp.Views.Home 7 | { 8 | public class WordDocModel : SamplePageModel 9 | { 10 | public WordDocModel(IConfiguration configuration) : base(configuration) 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /js/samples/advanced-csharp/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp/wwwroot/css/buttons.css: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Microsoft Corporation. All rights reserved. 2 | Licensed under the MIT License. */ 3 | 4 | .ir-button-area { 5 | margin: 0 auto; 6 | position: relative; 7 | width: 100%; 8 | } 9 | 10 | .ir-button-small { 11 | position: absolute; 12 | right: 5px; 13 | top: 5px; 14 | } -------------------------------------------------------------------------------- /js/samples/advanced-csharp/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | html { 2 | font-size: 14px; 3 | } 4 | 5 | @media (min-width: 768px) { 6 | html { 7 | font-size: 16px; 8 | } 9 | } 10 | 11 | html { 12 | position: relative; 13 | min-height: 100%; 14 | } 15 | 16 | body { 17 | margin-bottom: 60px; 18 | } -------------------------------------------------------------------------------- /js/samples/advanced-csharp/wwwroot/css/styles.css: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Microsoft Corporation. All rights reserved. 2 | Licensed under the MIT License. */ 3 | 4 | body, 5 | html { 6 | height: 100%; 7 | margin: 0; 8 | padding: 0; 9 | width: 100%; 10 | } 11 | body { 12 | background-color: #ffffff; 13 | } 14 | 15 | p { 16 | line-height: 25px; 17 | } 18 | 19 | /* nav bar */ 20 | 21 | nav { 22 | margin-top: 10px; 23 | margin-left: auto; 24 | margin-right: auto; 25 | text-align: center; 26 | } 27 | 28 | nav a { 29 | padding: 3px; 30 | } 31 | 32 | .active { 33 | font-weight: bold !important; 34 | color: red; 35 | } 36 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp/wwwroot/images/icon.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /js/samples/advanced-csharp/wwwroot/js/helpers.js: -------------------------------------------------------------------------------- 1 | function getImmersiveReaderTokenAsync(canary) { 2 | return new Promise((resolve, reject) => { 3 | $.ajax({ 4 | url: "/api/token", 5 | type: "POST", 6 | contentType: "text/plain", 7 | data: canary, 8 | success: (token) => { 9 | resolve(token); 10 | }, 11 | error: (err) => { 12 | console.log("Error in getting token!", err); 13 | reject(err); 14 | }, 15 | }); 16 | }); 17 | } 18 | 19 | function getImmersiveReaderSubdomainAsync() { 20 | return new Promise((resolve, reject) => { 21 | $.ajax({ 22 | url: "/api/subdomain", 23 | type: "GET", 24 | success: (subdomain) => { 25 | resolve(subdomain); 26 | }, 27 | error: (err) => { 28 | console.log("Error in getting subdomain!", err); 29 | reject(err); 30 | }, 31 | }); 32 | }); 33 | } 34 | -------------------------------------------------------------------------------- /js/samples/advanced-nodejs/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Immersive Reader - Node.js Sample 2 | 3 | ## Prerequisites 4 | 5 | * An Immersive Reader resource configured for Azure Active Directory authentication. Follow [these instructions](https://docs.microsoft.com/azure/applied-ai-services/immersive-reader/how-to-create-immersive-reader) to get set up. You will need some of the values created here when configuring the sample project properties. Save the output of your session into a text file for future reference. 6 | * Install [Yarn](https://yarnpkg.com), [npm](https://npmjs.com) 7 | 8 | ## Usage 9 | 10 | 1. Open a command prompt (Windows) or terminal (OSX, Linux) 11 | 12 | 1. Navigate to the **immersive-reader-sdk/js/samples/advanced-nodejs** directory 13 | 14 | 1. Run `yarn install` 15 | 16 | 1. Create a file called **.env** and add the following, supplying values as appropriate. 17 | 18 | ```text 19 | TENANT_ID={YOUR_TENANT_ID} 20 | CLIENT_ID={YOUR_CLIENT_ID} 21 | CLIENT_SECRET={YOUR_CLIENT_SECRET} 22 | SUBDOMAIN={YOUR_SUBDOMAIN} 23 | ``` 24 | 25 | 1. Run `yarn build:dev` 26 | 27 | 1. Run `yarn run start` (or `nodemon start` if you want to view changes you make after doing a browser refresh) 28 | 29 | 1. Open a web browser and navigate to [http://localhost:3000](http://localhost:3000) to view the sample 30 | 31 | ## License 32 | 33 | Copyright (c) Microsoft Corporation. All rights reserved. 34 | 35 | Licensed under the MIT License. 36 | -------------------------------------------------------------------------------- /js/samples/advanced-nodejs/app.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | require('dotenv').config(); 5 | var express = require('express'); 6 | var path = require('path'); 7 | 8 | var viewsRouter = require('./routes/views'); 9 | var requestsRouter = require('./routes/requests'); 10 | 11 | var app = express(); 12 | 13 | app.set('views', path.join(__dirname, 'views')); 14 | app.use(express.static('public')) 15 | 16 | app.use('/', viewsRouter); 17 | app.use('/', requestsRouter); 18 | 19 | module.exports = app; -------------------------------------------------------------------------------- /js/samples/advanced-nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejssample", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "build:dev": "cd ../../ && yarn && yarn build && node build/copy-dev.js --outPath ./samples/advanced-nodejs/public/js/immersive-reader-sdk.local.js", 7 | "start": "node ./bin/www" 8 | }, 9 | "dependencies": { 10 | "axios": "^0.21.1", 11 | "debug": "~2.6.9", 12 | "dotenv": "^8.0.0", 13 | "express": "^4.17.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /js/samples/advanced-nodejs/public/css/styles.css: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Microsoft Corporation. All rights reserved. 2 | Licensed under the MIT License. */ 3 | 4 | body, 5 | html { 6 | height: 100%; 7 | margin: 0; 8 | padding: 0; 9 | width: 100%; 10 | } 11 | body { 12 | background-color: #ffffff; 13 | } 14 | 15 | #ActiveNavId { 16 | display: none; 17 | } 18 | 19 | p { 20 | line-height: 25px; 21 | } 22 | 23 | /* nav bar */ 24 | 25 | nav { 26 | margin-top: 10px; 27 | margin-left: auto; 28 | margin-right: auto; 29 | text-align: center; 30 | } 31 | 32 | nav a { 33 | padding: 3px; 34 | } 35 | 36 | .active { 37 | font-weight: bold !important; 38 | color: red; 39 | } 40 | -------------------------------------------------------------------------------- /js/samples/advanced-nodejs/public/images/icon.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /js/samples/advanced-nodejs/public/js/helpers.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | function getImmersiveReaderTokenAsync() { 5 | return new Promise(function (resolve, reject) { 6 | $.ajax({ 7 | url: '/getimmersivereadertoken', 8 | type: 'GET', 9 | success: function (token) { 10 | resolve(token); 11 | }, 12 | error: function (err) { 13 | console.log('Error in getting token!', err); 14 | reject(err); 15 | } 16 | }); 17 | }); 18 | } 19 | 20 | function getSubdomainAsync() { 21 | return new Promise(function (resolve, reject) { 22 | $.ajax({ 23 | url: '/subdomain', 24 | type: 'GET', 25 | success: function (subdomain) { resolve(subdomain); }, 26 | error: function (err) { reject(err); } 27 | }); 28 | }); 29 | } 30 | 31 | function launchImmersiveReader(data, options) { 32 | getImmersiveReaderTokenAsync().then(function (token) { 33 | getSubdomainAsync().then(function (subdomain) { 34 | ImmersiveReader.launchAsync(token, subdomain, data, options).catch(function (error) { 35 | console.log('there was an error', error); 36 | }); 37 | }); 38 | }); 39 | } -------------------------------------------------------------------------------- /js/samples/advanced-nodejs/routes/requests.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | var axios = require('axios'); 5 | var express = require('express'); 6 | var router = express.Router(); 7 | var qs = require('qs'); 8 | 9 | router.get('/getimmersivereadertoken', function(req, res) { 10 | try { 11 | var config ={ 12 | headers: { 13 | 'content-type': 'application/x-www-form-urlencoded' 14 | } 15 | } 16 | var data = { 17 | grant_type: 'client_credentials', 18 | client_id: process.env.CLIENT_ID, 19 | client_secret: process.env.CLIENT_SECRET, 20 | resource: 'https://cognitiveservices.azure.com/' 21 | }; 22 | var url = `https://login.windows.net/${process.env.TENANT_ID}/oauth2/token` 23 | console.log(qs.stringify(data)); 24 | axios.post(url, qs.stringify(data), config) 25 | .then(function (response) { 26 | var token = response.data.access_token; 27 | return res.send(token); 28 | }) 29 | .catch(function (response) { 30 | if (response.status !== 200) { 31 | return res.send({error : "Unable to acquire Azure AD token. Check the debugger for more information."}) 32 | } 33 | }); 34 | } catch (error) { 35 | console.log(error); 36 | return res.status(500).send('CogSvcs IssueToken error'); 37 | } 38 | }); 39 | 40 | router.get('/subdomain', function (req, res) { 41 | return res.send(process.env.SUBDOMAIN); 42 | }) 43 | 44 | module.exports = router; -------------------------------------------------------------------------------- /js/samples/advanced-nodejs/routes/views.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | var express = require('express'); 5 | var router = express.Router(); 6 | var path = require('path'); 7 | var viewRoot = path.join(__dirname, '../views'); 8 | 9 | router.get('/', function(req, res, next) { 10 | res.redirect('/sections'); 11 | }); 12 | 13 | router.get('/document', function(req, res, next) { 14 | res.sendFile('document.html', {root: viewRoot}); 15 | }); 16 | 17 | router.get('/math', function(req, res, next) { 18 | res.sendFile('math.html', {root: viewRoot}); 19 | }); 20 | 21 | router.get('/multilang', function(req, res, next) { 22 | res.sendFile('multilang.html', {root: viewRoot}); 23 | }); 24 | 25 | router.get('/sections', function(req, res, next) { 26 | res.sendFile('sections.html', {root: viewRoot}); 27 | }); 28 | 29 | router.get('/uilangs', function(req, res, next) { 30 | res.sendFile('uilangs.html', {root: viewRoot}); 31 | }); 32 | 33 | router.get('/hideexitbutton', function(req, res, next) { 34 | res.sendFile('hide-exit-button.html', {root: viewRoot}); 35 | }); 36 | 37 | router.get('/inner-hide-exit-button', function(req, res, next) { 38 | res.sendFile('inner-hide-exit-button.html', {root: viewRoot}); 39 | }); 40 | 41 | router.get('/options', function(req, res, next) { 42 | res.sendFile('options.html', {root: viewRoot}); 43 | }); 44 | 45 | module.exports = router; 46 | -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/ManagedIdentityAzureADTokenProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using System.Threading.Tasks; 3 | using Azure.Core; 4 | using Azure.Identity; 5 | using Microsoft.Azure.Functions.Worker; 6 | using Microsoft.Azure.Functions.Worker.Http; 7 | using Microsoft.Extensions.Logging; 8 | 9 | namespace quickstart_azure_function_csharp.GetAzureADToken 10 | { 11 | public static class ManagedIdentityAzureADTokenProvider 12 | { 13 | //This is the placeholder to be replaced with your own subdomain value 14 | const string subdomain = ""; 15 | 16 | [Function("GetAzureADToken")] 17 | public static async Task Run([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestData req, FunctionContext executionContext) 18 | { 19 | var logger = executionContext.GetLogger("GetAzureADToken"); 20 | logger.LogInformation("C# HTTP trigger function processed a request to get an Azure AD token."); 21 | 22 | var response = req.CreateResponse(HttpStatusCode.OK); 23 | 24 | var tokenCredential = new DefaultAzureCredential(); 25 | var accessToken = await tokenCredential.GetTokenAsync( 26 | new TokenRequestContext(scopes: new string[] { "https://cognitiveservices.azure.com/" }) { } 27 | ); 28 | 29 | await response.WriteAsJsonAsync(new { token = accessToken.Token, subdomain = subdomain }); 30 | 31 | return response; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Hosting; 2 | 3 | namespace quickstart_azure_function_csharp 4 | { 5 | public class Program 6 | { 7 | public static void Main() 8 | { 9 | var host = new HostBuilder() 10 | .ConfigureFunctionsWorkerDefaults() 11 | .Build(); 12 | 13 | host.Run(); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "logging": { 4 | "applicationInsights": { 5 | "samplingSettings": { 6 | "isEnabled": true, 7 | "excludedTypes": "Request" 8 | } 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azfunc1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azfunc1.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azfunc2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azfunc2.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azfunc3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azfunc3.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azfunc4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azfunc4.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azfunc5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azfunc5.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azfunc6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azfunc6.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azfunc7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azfunc7.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azfunc8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azfunc8.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azid1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azid1.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azid2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azid2.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azid3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azid3.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azid4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azid4.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azid5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azid5.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azid6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azid6.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azid7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azid7.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azid8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azid8.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azid9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azid9.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azpor1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azpor1.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/azpor2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/azpor2.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/funchost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/funchost.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/images/funcresponse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/azure-function-csharp/images/funcresponse.png -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/local.settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "IsEncrypted": false, 3 | "Host": { 4 | "LocalHttpPort": 7071, 5 | "CORS": "*", 6 | "CORSCredentials": false 7 | }, 8 | "Values": { 9 | "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /js/samples/azure-function-csharp/quickstart-azure-function-csharp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net5.0 4 | v3 5 | Exe 6 | quickstart_azure_function_csharp 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | PreserveNewest 18 | 19 | 20 | PreserveNewest 21 | Never 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /js/samples/ember-sample/.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /js/samples/ember-sample/.eslintrc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | ecmaVersion: 2018, 8 | sourceType: 'module', 9 | ecmaFeatures: { 10 | legacyDecorators: true, 11 | }, 12 | }, 13 | plugins: ['ember'], 14 | extends: [ 15 | 'eslint:recommended', 16 | 'plugin:ember/recommended', 17 | 'plugin:prettier/recommended', 18 | ], 19 | env: { 20 | browser: true, 21 | }, 22 | rules: {}, 23 | overrides: [ 24 | // node files 25 | { 26 | files: [ 27 | '.eslintrc.js', 28 | '.prettierrc.js', 29 | '.template-lintrc.js', 30 | 'ember-cli-build.js', 31 | 'blueprints/*/index.js', 32 | 'config/**/*.js', 33 | 'lib/*/index.js', 34 | 'server/**/*.js', 35 | ], 36 | parserOptions: { 37 | sourceType: 'script', 38 | }, 39 | env: { 40 | browser: false, 41 | node: true, 42 | }, 43 | plugins: ['node'], 44 | extends: ['plugin:node/recommended'], 45 | rules: { 46 | // this can be removed once the following is fixed 47 | // https://github.com/mysticatea/eslint-plugin-node/issues/77 48 | 'node/no-unpublished-require': 'off', 49 | }, 50 | }, 51 | ], 52 | }; -------------------------------------------------------------------------------- /js/samples/ember-sample/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist/ 5 | /tmp/ 6 | 7 | # dependencies 8 | /bower_components/ 9 | /node_modules/ 10 | 11 | # misc 12 | /.env* 13 | /.pnp* 14 | /.sass-cache 15 | /.eslintcache 16 | /connect.lock 17 | /coverage/ 18 | /libpeerconnection.log 19 | /npm-debug.log* 20 | /testem.log 21 | /yarn-error.log 22 | 23 | # ember-try 24 | /.node_modules.ember-try/ 25 | /bower.json.ember-try 26 | /package.json.ember-try 27 | -------------------------------------------------------------------------------- /js/samples/ember-sample/.prettierignore: -------------------------------------------------------------------------------- 1 | # unconventional js 2 | /blueprints/*/files/ 3 | /vendor/ 4 | 5 | # compiled output 6 | /dist/ 7 | /tmp/ 8 | 9 | # dependencies 10 | /bower_components/ 11 | /node_modules/ 12 | 13 | # misc 14 | /coverage/ 15 | !.* 16 | .eslintcache 17 | 18 | # ember-try 19 | /.node_modules.ember-try/ 20 | /bower.json.ember-try 21 | /package.json.ember-try -------------------------------------------------------------------------------- /js/samples/ember-sample/.template-lintrc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | extends: 'recommended', 5 | }; -------------------------------------------------------------------------------- /js/samples/ember-sample/app/app.js: -------------------------------------------------------------------------------- 1 | import Application from '@ember/application'; 2 | import Resolver from 'ember-resolver'; 3 | import loadInitializers from 'ember-load-initializers'; 4 | import config from 'ember-sample/config/environment'; 5 | 6 | export default class App extends Application { 7 | modulePrefix = config.modulePrefix; 8 | podModulePrefix = config.podModulePrefix; 9 | Resolver = Resolver; 10 | } 11 | 12 | loadInitializers(App, config.modulePrefix); 13 | -------------------------------------------------------------------------------- /js/samples/ember-sample/app/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/ember-sample/app/components/.gitkeep -------------------------------------------------------------------------------- /js/samples/ember-sample/app/helpers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/ember-sample/app/helpers/.gitkeep -------------------------------------------------------------------------------- /js/samples/ember-sample/app/router.js: -------------------------------------------------------------------------------- 1 | import EmberRouter from '@ember/routing/router'; 2 | import config from 'ember-sample/config/environment'; 3 | 4 | export default class Router extends EmberRouter { 5 | location = config.locationType; 6 | rootURL = config.rootURL; 7 | } 8 | 9 | Router.map(function () { 10 | this.route('reader'); 11 | }); 12 | -------------------------------------------------------------------------------- /js/samples/ember-sample/app/routes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/ember-sample/app/routes/.gitkeep -------------------------------------------------------------------------------- /js/samples/ember-sample/app/routes/reader.js: -------------------------------------------------------------------------------- 1 | import Route from '@ember/routing/route'; 2 | import { inject as service } from '@ember/service'; 3 | 4 | // This is an example of routing in Ember 5 | export default class ReaderRoute extends Route { 6 | @service store; 7 | } 8 | -------------------------------------------------------------------------------- /js/samples/ember-sample/app/styles/app.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Base Elements 3 | */ 4 | 5 | * { 6 | margin: 0; 7 | padding: 0; 8 | } -------------------------------------------------------------------------------- /js/samples/ember-sample/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /js/samples/ember-sample/config/ember-cli-update.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": "1.0.0", 3 | "packages": [ 4 | { 5 | "name": "ember-cli", 6 | "version": "3.26.1", 7 | "blueprints": [ 8 | { 9 | "name": "app", 10 | "outputRepo": "https://github.com/ember-cli/ember-new-output", 11 | "codemodsSource": "ember-app-codemods-manifest@1", 12 | "isBaseBlueprint": true, 13 | "options": [] 14 | } 15 | ] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /js/samples/ember-sample/config/optional-features.json: -------------------------------------------------------------------------------- 1 | { 2 | "application-template-wrapper": false, 3 | "default-async-observers": true, 4 | "jquery-integration": false, 5 | "template-only-glimmer-components": true 6 | } 7 | -------------------------------------------------------------------------------- /js/samples/ember-sample/config/targets.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const browsers = [ 4 | 'last 1 Chrome versions', 5 | 'last 1 Firefox versions', 6 | 'last 1 Safari versions', 7 | ]; 8 | 9 | const isCI = Boolean(process.env.CI); 10 | const isProduction = process.env.EMBER_ENV === 'production'; 11 | 12 | if (isCI || isProduction) { 13 | browsers.push('ie 11'); 14 | } 15 | 16 | module.exports = { 17 | browsers, 18 | }; 19 | -------------------------------------------------------------------------------- /js/samples/ember-sample/ember-cli-build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const EmberApp = require('ember-cli/lib/broccoli/ember-app'); 4 | 5 | module.exports = function (defaults) { 6 | let app = new EmberApp(defaults, { 7 | // Add options here 8 | }); 9 | 10 | // Use `app.import` to add additional libraries to the generated 11 | // output files. 12 | // 13 | // If you need to use different assets in different 14 | // environments, specify an object as the first parameter. That 15 | // object's keys should be the environment name and the values 16 | // should be the asset to use in that environment. 17 | // 18 | // If the library that you are including contains AMD or ES6 19 | // modules that you would like to import into your application 20 | // please specify an object with the list of modules as keys 21 | // along with the exports of each module as its value. 22 | 23 | return app.toTree(); 24 | }; 25 | -------------------------------------------------------------------------------- /js/samples/ember-sample/server/.env_sample: -------------------------------------------------------------------------------- 1 | TENANT_ID={TENANT_ID} 2 | CLIENT_ID={CLIENT_ID} 3 | CLIENT_SECRET={SECRET} 4 | SUBDOMAIN={SUBDOMAIN} 5 | -------------------------------------------------------------------------------- /js/samples/ember-sample/server/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | !bin/ -------------------------------------------------------------------------------- /js/samples/ember-sample/server/app.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | 3 | var createError = require('http-errors'); 4 | var express = require('express'); 5 | var path = require('path'); 6 | var cookieParser = require('cookie-parser'); 7 | var logger = require('morgan'); 8 | var cors = require('cors'); 9 | 10 | var indexRouter = require('./routes/index'); 11 | 12 | var app = express(); 13 | 14 | // view engine setup 15 | app.set('views', path.join(__dirname, 'views')); 16 | app.set('view engine', 'pug'); 17 | 18 | app.use(cors()); 19 | app.use(logger('dev')); 20 | app.use(express.json()); 21 | app.use(express.urlencoded({ extended: false })); 22 | app.use(cookieParser()); 23 | app.use(express.static(path.join(__dirname, 'public'))); 24 | 25 | app.use('/', indexRouter); 26 | 27 | // catch 404 and forward to error handler 28 | app.use(function(req, res, next) { 29 | next(createError(404)); 30 | }); 31 | 32 | // error handler 33 | app.use(function(err, req, res, next) { 34 | // set locals, only providing error in development 35 | res.locals.message = err.message; 36 | res.locals.error = req.app.get('env') === 'development' ? err : {}; 37 | 38 | // render the error page 39 | res.status(err.status || 500); 40 | res.render('error'); 41 | }); 42 | 43 | module.exports = app; 44 | -------------------------------------------------------------------------------- /js/samples/ember-sample/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "quickstart-nodejs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "axios": "^1.6.0", 10 | "cookie-parser": "~1.4.4", 11 | "cors": "^2.8.5", 12 | "debug": "~2.6.9", 13 | "dotenv": "^8.2.0", 14 | "express": "~4.19.2", 15 | "http-errors": "~1.6.3", 16 | "json-schema": "^0.4.0", 17 | "morgan": "~1.9.1", 18 | "pug": "3.0.3", 19 | "request": "^2.88.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /js/samples/ember-sample/server/routes/index.js: -------------------------------------------------------------------------------- 1 | var axios = require('axios'); 2 | var express = require('express'); 3 | var router = express.Router(); 4 | var qs = require('qs'); 5 | require('dotenv').config() 6 | 7 | /* GET home page. */ 8 | router.get('/', function (req, res, next) { 9 | res.json({ 10 | message: 'Ping /GetTokenAndSubdomain from your local app to fetch the creds.' 11 | }) 12 | }); 13 | 14 | router.get('/GetTokenAndSubdomain', async function (req, res) { 15 | var config = { 16 | headers: { 17 | 'content-type': 'application/x-www-form-urlencoded', 18 | } 19 | } 20 | var data = { 21 | grant_type: 'client_credentials', 22 | client_id: process.env.CLIENT_ID, 23 | client_secret: process.env.CLIENT_SECRET, 24 | resource: 'https://cognitiveservices.azure.com/' 25 | }; 26 | 27 | var url = `https://login.windows.net/${process.env.TENANT_ID}/oauth2/token`; 28 | try { 29 | const response = await axios.post(url, qs.stringify(data), config); 30 | var token = response.data.access_token; 31 | var subdomain = process.env.SUBDOMAIN; 32 | res.setHeader("Access-Control-Allow-Origin", "*"); 33 | return res.json({ token, subdomain }); 34 | } catch (response) { 35 | if (response.status !== 200) { 36 | return res.json({ error: "Unable to acquire Azure AD token. Check the debugger for more information." }) 37 | } 38 | } 39 | }); 40 | 41 | module.exports = router; 42 | -------------------------------------------------------------------------------- /js/samples/ember-sample/vendor/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/ember-sample/vendor/.gitkeep -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift/Assets.xcassets/Checkmark.imageset/Checkmark@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/ios/quickstart-swift/Assets.xcassets/Checkmark.imageset/Checkmark@2x.png -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift/Assets.xcassets/Checkmark.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "Checkmark@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift/Assets.xcassets/Checkmarkempty.imageset/Checkmarkempty@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/ios/quickstart-swift/Assets.xcassets/Checkmarkempty.imageset/Checkmarkempty@2x.png -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift/Assets.xcassets/Checkmarkempty.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "Checkmarkempty@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // immersive-reader-sdk 4 | // 5 | // Created by MONIKA Chauhan on 15/10/19. 6 | // Copyright © 2019 Microsoft. All rights reserved. 7 | // 8 | 9 | #ifndef PrefixHeader_pch 10 | #define PrefixHeader_pch 11 | 12 | // Include any system framework and library headers here that should be included in all compilation units. 13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. 14 | 15 | #import 16 | #import 17 | 18 | #endif /* PrefixHeader_pch */ 19 | -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift/Resources/iFrameMessaging.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | window.addEventListener("message", function(message) { 5 | if (message.data == "ImmersiveReader-ReadyForContent") { 6 | window.webkit.messageHandlers.readyForContent.postMessage(null); 7 | } 8 | if (message.data == "ImmersiveReader-LaunchSuccessful") { 9 | window.webkit.messageHandlers.launchSuccessful.postMessage(null); 10 | } 11 | if (message.data == "ImmersiveReader-TokenExpired") { 12 | window.webkit.messageHandlers.tokenExpired.postMessage(null); 13 | } 14 | if (message.data == "ImmersiveReader-Throttled") { 15 | window.webkit.messageHandlers.throttled.postMessage(null); 16 | } 17 | }); 18 | 19 | function sendContentToReader(message) { 20 | // It is more secure to specify an exact target origin, not *, when you use postMessage to send data to other windows. 21 | document.getElementById('immersiveReaderIframe').contentWindow.postMessage(JSON.stringify({messageType:'Content', messageValue: message}), '*'); 22 | } 23 | -------------------------------------------------------------------------------- /js/samples/ios/quickstart-swift/immersive_reader_sdk.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #import 5 | 6 | //! Project version number for immersive_reader_sdk. 7 | FOUNDATION_EXPORT double immersive_reader_sdkVersionNumber; 8 | 9 | //! Project version string for immersive_reader_sdk. 10 | FOUNDATION_EXPORT const unsigned char immersive_reader_sdkVersionString[]; 11 | 12 | // In this header, you should import all the public headers of your framework using statements like #import 13 | -------------------------------------------------------------------------------- /js/samples/ios/server/.env_sample: -------------------------------------------------------------------------------- 1 | TENANT_ID={TENANT_ID} 2 | CLIENT_ID={CLIENT_ID} 3 | CLIENT_SECRET={SECRET} 4 | SUBDOMAIN={SUBDOMAIN} 5 | -------------------------------------------------------------------------------- /js/samples/ios/server/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | !bin/ 27 | -------------------------------------------------------------------------------- /js/samples/ios/server/app.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | 3 | var createError = require('http-errors'); 4 | var express = require('express'); 5 | var path = require('path'); 6 | var cookieParser = require('cookie-parser'); 7 | var logger = require('morgan'); 8 | var cors = require('cors'); 9 | 10 | var indexRouter = require('./routes/index'); 11 | 12 | var app = express(); 13 | 14 | app.use(cors()); 15 | app.use(logger('dev')); 16 | app.use(express.json()); 17 | app.use(express.urlencoded({ extended: false })); 18 | app.use(cookieParser()); 19 | app.use(express.static(path.join(__dirname, 'public'))); 20 | 21 | app.use('/', indexRouter); 22 | 23 | // catch 404 and forward to error handler 24 | app.use(function(req, res, next) { 25 | next(createError(404)); 26 | }); 27 | 28 | // error handler 29 | app.use(function(err, req, res, next) { 30 | // set locals, only providing error in development 31 | res.locals.message = err.message; 32 | res.locals.error = req.app.get('env') === 'development' ? err : {}; 33 | 34 | // render the error page 35 | res.status(err.status || 500); 36 | res.render('error'); 37 | }); 38 | 39 | module.exports = app; 40 | -------------------------------------------------------------------------------- /js/samples/ios/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "quickstart-nodejs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "axios": "^1.8.2", 10 | "cookie-parser": "~1.4.4", 11 | "cors": "^2.8.5", 12 | "debug": "~2.6.9", 13 | "dotenv": "^8.2.0", 14 | "express": "~4.19.2", 15 | "http-errors": "~1.6.3", 16 | "morgan": "~1.9.1", 17 | "request": "^2.88.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /js/samples/ios/server/routes/index.js: -------------------------------------------------------------------------------- 1 | var axios = require('axios'); 2 | var express = require('express'); 3 | var router = express.Router(); 4 | var qs = require('qs'); 5 | require('dotenv').config() 6 | 7 | /* GET home page. */ 8 | router.get('/', function (req, res, next) { 9 | res.json({ 10 | message: 'Ping /GetTokenAndSubdomain from your local app to fetch the creds.' 11 | }) 12 | }); 13 | 14 | router.get('/GetTokenAndSubdomain', async function (req, res) { 15 | var config = { 16 | headers: { 17 | 'content-type': 'application/x-www-form-urlencoded', 18 | } 19 | } 20 | var data = { 21 | grant_type: 'client_credentials', 22 | client_id: process.env.CLIENT_ID, 23 | client_secret: process.env.CLIENT_SECRET, 24 | resource: 'https://cognitiveservices.azure.com/' 25 | }; 26 | 27 | var url = `https://login.windows.net/${process.env.TENANT_ID}/oauth2/token`; 28 | try { 29 | const response = await axios.post(url, qs.stringify(data), config); 30 | var token = response.data.access_token; 31 | var subdomain = process.env.SUBDOMAIN; 32 | res.setHeader("Access-Control-Allow-Origin", "*"); 33 | return res.json({ token, subdomain }); 34 | } catch (response) { 35 | if (response.status !== 200) { 36 | return res.json({ error: "Unable to acquire Azure AD token. Check the debugger for more information." }) 37 | } 38 | } 39 | }); 40 | 41 | module.exports = router; 42 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ImmersiveReader.Samples.QuickStart.AzureFunction.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Hosting; 3 | 4 | namespace quickstart_csharp_azfunction 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | CreateHostBuilder(args).Build().Run(); 11 | } 12 | 13 | public static IHostBuilder CreateHostBuilder(string[] args) => 14 | Host.CreateDefaultBuilder(args) 15 | .ConfigureWebHostDefaults(webBuilder => 16 | { 17 | webBuilder.UseStartup(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:32299", 7 | "sslPort": 44347 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Hosting; 6 | 7 | namespace quickstart_csharp_azfunction 8 | { 9 | public class Startup 10 | { 11 | public Startup(IConfiguration configuration) 12 | { 13 | Configuration = configuration; 14 | } 15 | 16 | public IConfiguration Configuration { get; } 17 | 18 | // This method gets called by the runtime. Use this method to add services to the container. 19 | public void ConfigureServices(IServiceCollection services) 20 | { 21 | services.AddControllersWithViews(); 22 | } 23 | 24 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 25 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 26 | { 27 | if (env.IsDevelopment()) 28 | { 29 | app.UseDeveloperExceptionPage(); 30 | } 31 | else 32 | { 33 | app.UseExceptionHandler("/Home/Error"); 34 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 35 | app.UseHsts(); 36 | } 37 | app.UseHttpsRedirection(); 38 | app.UseStaticFiles(); 39 | 40 | app.UseRouting(); 41 | 42 | app.UseEndpoints(endpoints => 43 | { 44 | endpoints.MapControllerRoute( 45 | name: "default", 46 | pattern: "{controller=Home}/{action=Index}/{id?}"); 47 | }); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/Views/Home/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Privacy Policy"; 3 | } 4 |

@ViewData["Title"]

5 | 6 |

Use this page to detail your site's privacy policy.

7 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |

Error.

7 |

An error occurred while processing your request.

8 | 9 | @if (Model.ShowRequestId) 10 | { 11 |

12 | Request ID: @Model.RequestId 13 |

14 | } 15 | 16 |

Development Mode

17 |

18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

20 |

21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |

26 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using ImmersiveReader.Samples.QuickStart.AzureFunction 2 | @using ImmersiveReader.Samples.QuickStart.AzureFunction.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/quickstart-csharp-azfunction.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net5.0 5 | ImmersiveReader.Samples.QuickStart.AzureFunction 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <_WebToolingArtifacts Remove="Properties\PublishProfiles\**" /> 18 | <_WebToolingArtifacts Remove="Properties\ServiceDependencies\**" /> 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/quickstart-csharp-azfunction.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31702.278 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "quickstart-csharp-azfunction", "quickstart-csharp-azfunction.csproj", "{7A6B35AD-1F95-4C92-966A-222C7BC62BCB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {7A6B35AD-1F95-4C92-966A-222C7BC62BCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {7A6B35AD-1F95-4C92-966A-222C7BC62BCB}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {7A6B35AD-1F95-4C92-966A-222C7BC62BCB}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {7A6B35AD-1F95-4C92-966A-222C7BC62BCB}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {E447FFA6-4064-4161-8931-0B9136B08721} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | for details on configuring this project to bundle and minify static web assets. */ 3 | 4 | a.navbar-brand { 5 | white-space: normal; 6 | text-align: center; 7 | word-break: break-all; 8 | } 9 | 10 | /* Provide sufficient contrast against white background */ 11 | a { 12 | color: #0366d6; 13 | } 14 | 15 | .btn-primary { 16 | color: #fff; 17 | background-color: #1b6ec2; 18 | border-color: #1861ac; 19 | } 20 | 21 | .nav-pills .nav-link.active, .nav-pills .show > .nav-link { 22 | color: #fff; 23 | background-color: #1b6ec2; 24 | border-color: #1861ac; 25 | } 26 | 27 | /* Sticky footer styles 28 | -------------------------------------------------- */ 29 | html { 30 | font-size: 14px; 31 | } 32 | @media (min-width: 768px) { 33 | html { 34 | font-size: 16px; 35 | } 36 | } 37 | 38 | .border-top { 39 | border-top: 1px solid #e5e5e5; 40 | } 41 | .border-bottom { 42 | border-bottom: 1px solid #e5e5e5; 43 | } 44 | 45 | .box-shadow { 46 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); 47 | } 48 | 49 | button.accept-policy { 50 | font-size: 1rem; 51 | line-height: inherit; 52 | } 53 | 54 | /* Sticky footer styles 55 | -------------------------------------------------- */ 56 | html { 57 | position: relative; 58 | min-height: 100%; 59 | } 60 | 61 | body { 62 | /* Margin bottom by footer height */ 63 | margin-bottom: 60px; 64 | } 65 | .footer { 66 | position: absolute; 67 | bottom: 0; 68 | width: 100%; 69 | white-space: nowrap; 70 | line-height: 60px; /* Vertically center the text there */ 71 | } 72 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-csharp-azfunction/wwwroot/favicon.ico -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/wwwroot/images/gettoken.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-csharp-azfunction/wwwroot/images/gettoken.png -------------------------------------------------------------------------------- /js/samples/quickstart-csharp-azfunction/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | function getTokenAndLaunch() { 2 | 3 | getTokenFromAzureFunction( 4 | function (response) { 5 | launchInternal(response.subdomain, response.token); 6 | }, 7 | function (errorMessage) { 8 | console.log(errorMessage); 9 | } 10 | ); 11 | } 12 | 13 | function getTokenFromAzureFunction(onsuccess, onerror) { 14 | // Calling Azure function to get Azure AD token 15 | // Function URL example: https://.azurewebsites.net/api/ 16 | var tokenUrl = (tokenFrom == 'local') ? functionLocalUrl : functionUrl; 17 | 18 | $.ajax(tokenUrl, { 19 | method: 'GET', 20 | data: { "code" : functionApiKey }, 21 | success: function (data) { 22 | onsuccess(data); 23 | }, 24 | error: function (xhr, status, error) { 25 | var failureMessage = "GetToken error: " + status + " - " + error; 26 | onerror(failureMessage); 27 | } 28 | }); 29 | } 30 | 31 | function launchInternal(subdomain, token) { 32 | 33 | const data = { 34 | title: $("#ir-title").text(), 35 | chunks: [{ 36 | content: $("#ir-content").html(), 37 | mimeType: "text/html" 38 | }] 39 | }; 40 | 41 | const options = { 42 | "onExit": exitCallback 43 | }; 44 | 45 | ImmersiveReader.launchAsync(token, subdomain, data, options) 46 | .catch(function (error) { 47 | alert("Error in launching the Immersive Reader. Check the console."); 48 | console.log(error); 49 | }); 50 | } 51 | 52 | function exitCallback() { 53 | console.log("This is the callback function. It is executed when the Immersive Reader closes."); 54 | } -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace QuickstartSampleWebApp.Models 2 | { 3 | public class ErrorViewModel 4 | { 5 | public string RequestId { get; set; } 6 | 7 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 8 | } 9 | } -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Program.cs: -------------------------------------------------------------------------------- 1 | var builder = WebApplication.CreateBuilder(args); 2 | 3 | // Add services to the container. 4 | builder.Services.AddControllersWithViews(); 5 | 6 | var app = builder.Build(); 7 | 8 | // Configure the HTTP request pipeline. 9 | if (!app.Environment.IsDevelopment()) 10 | { 11 | app.UseExceptionHandler("/Home/Error"); 12 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 13 | app.UseHsts(); 14 | } 15 | 16 | app.UseHttpsRedirection(); 17 | app.UseStaticFiles(); 18 | 19 | app.UseRouting(); 20 | 21 | app.MapControllerRoute( 22 | name: "default", 23 | pattern: "{controller=Home}/{action=Index}/{id?}"); 24 | 25 | app.Run(); 26 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "QuickstartSampleWebApp": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": true, 6 | "launchBrowser": true, 7 | "applicationUrl": "https://localhost:7143", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/QuickstartSampleWebApp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6.0 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/QuickstartSampleWebApp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.32112.339 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickstartSampleWebApp", "QuickstartSampleWebApp.csproj", "{A5CF8875-B26D-4B8D-B3B5-538D2297781A}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {A5CF8875-B26D-4B8D-B3B5-538D2297781A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {A5CF8875-B26D-4B8D-B3B5-538D2297781A}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {A5CF8875-B26D-4B8D-B3B5-538D2297781A}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {A5CF8875-B26D-4B8D-B3B5-538D2297781A}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {28C4F0F3-D0CD-414F-BF4B-F0283016396C} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Immersive Reader - C# Sample 2 | 3 | ## Prerequisites 4 | 5 | * An Immersive Reader resource configured for Azure Active Directory authentication. Follow [these instructions](https://docs.microsoft.com/azure/applied-ai-services/immersive-reader/how-to-create-immersive-reader) to get set up. You will need some of the values created here when configuring the sample project properties. Save the output of your session into a text file for future reference. 6 | * [Visual Studio 2022](https://visualstudio.microsoft.com/downloads) 7 | 8 | ## Usage 9 | 10 | 1. Open **QuickstartSampleWebApp.sln** in Visual Studio. 11 | 12 | 1. Right-click on the project in the Solution Explorer and choose **Manage User Secrets**. This will open a file called **secrets.json**. Replace the contents of that file with the following, supplying your values as appropriate: 13 | 14 | ```json 15 | { 16 | "TenantId": "", 17 | "ClientId": "", 18 | "ClientSecret": "", 19 | "Subdomain": "" 20 | } 21 | ``` 22 | 23 | 1. Run **Debug > Start Debugging**. 24 | 25 | ## License 26 | 27 | Copyright (c) Microsoft Corporation. All rights reserved. 28 | 29 | Licensed under the MIT License. 30 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "About"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Contact"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
18 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Views/Home/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Privacy Policy"; 3 | } 4 |

@ViewData["Title"]

5 | 6 |

Use this page to detail your site's privacy policy.

7 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |

Error.

7 |

An error occurred while processing your request.

8 | 9 | @if (Model?.ShowRequestId ?? false) 10 | { 11 |

12 | Request ID: @Model.RequestId 13 |

14 | } 15 | 16 |

Development Mode

17 |

18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

20 |

21 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. 22 |

23 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Views/Shared/_Layout.cshtml.css: -------------------------------------------------------------------------------- 1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | for details on configuring this project to bundle and minify static web assets. */ 3 | 4 | a.navbar-brand { 5 | white-space: normal; 6 | text-align: center; 7 | word-break: break-all; 8 | } 9 | 10 | a { 11 | color: #0077cc; 12 | } 13 | 14 | .btn-primary { 15 | color: #fff; 16 | background-color: #1b6ec2; 17 | border-color: #1861ac; 18 | } 19 | 20 | .nav-pills .nav-link.active, .nav-pills .show > .nav-link { 21 | color: #fff; 22 | background-color: #1b6ec2; 23 | border-color: #1861ac; 24 | } 25 | 26 | .border-top { 27 | border-top: 1px solid #e5e5e5; 28 | } 29 | .border-bottom { 30 | border-bottom: 1px solid #e5e5e5; 31 | } 32 | 33 | .box-shadow { 34 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); 35 | } 36 | 37 | button.accept-policy { 38 | font-size: 1rem; 39 | line-height: inherit; 40 | } 41 | 42 | .footer { 43 | position: absolute; 44 | bottom: 0; 45 | width: 100%; 46 | white-space: nowrap; 47 | line-height: 60px; 48 | } 49 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using QuickstartSampleWebApp 2 | @using QuickstartSampleWebApp.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification\ 2 | for details on configuring this project to bundle and minify static web assets. */ 3 | 4 | html { 5 | font-size: 14px; 6 | } 7 | 8 | @media (min-width: 768px) { 9 | html { 10 | font-size: 16px; 11 | } 12 | } 13 | 14 | html { 15 | position: relative; 16 | min-height: 100%; 17 | } 18 | 19 | body { 20 | margin-bottom: 60px; 21 | padding-top: 50px; 22 | padding-bottom: 20px; 23 | } 24 | 25 | /* Wrapping element */ 26 | /* Set some basic padding to keep content from hitting the edges */ 27 | .body-content { 28 | padding-left: 15px; 29 | padding-right: 15px; 30 | } 31 | 32 | /* Carousel */ 33 | .carousel-caption p { 34 | font-size: 20px; 35 | line-height: 1.4; 36 | } 37 | 38 | /* Make .svg files in the carousel display properly in older browsers */ 39 | .carousel-inner .item img[src$=".svg"] { 40 | width: 100%; 41 | } 42 | 43 | /* QR code generator */ 44 | #qrCode { 45 | margin: 15px; 46 | } 47 | 48 | /* Hide/rearrange for smaller screens */ 49 | @media screen and (max-width: 767px) { 50 | /* Hide captions */ 51 | .carousel-caption { 52 | display: none; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-csharp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | // for details on configuring this project to bundle and minify static web assets. 3 | 4 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /js/samples/quickstart-csharp/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-csharp/wwwroot/js/site.min.js -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | env* 16 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir= 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Immersive Reader - Android Java Sample 2 | 3 | ## Prerequisites 4 | 5 | * An Immersive Reader resource configured for Azure Active Directory authentication. Follow [these instructions](https://docs.microsoft.com/azure/applied-ai-services/immersive-reader/how-to-create-immersive-reader) to get set up. You will need some of the values created here when configuring the sample project properties. Save the output of your session into a text file for future reference. 6 | * [Android Studio](https://developer.android.com/studio) 7 | 8 | ## Usage 9 | 10 | 1. Launch Android Studio and open the project from the **immersive-reader-sdk/js/samples/quickstart-java-android** directory. 11 | 12 | 1. Create a file named **env** to the **/assets** folder and add the following, supplying values as appropriate. Be sure not to commit this file into source control, as it contains secrets that should not be made public. 13 | 14 | ```text 15 | TENANT_ID= 16 | CLIENT_ID= 17 | CLIENT_SECRET= 18 | SUBDOMAIN= 19 | ``` 20 | 21 | 1. Choose a device emulator from the AVD Manager and run the project. 22 | 23 | ## License 24 | 25 | Copyright (c) Microsoft Corporation. All rights reserved. 26 | 27 | Licensed under the MIT License. 28 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.example.immersivereadersdk" 7 | minSdkVersion 15 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'androidx.appcompat:appcompat:1.0.2' 24 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 25 | implementation 'com.google.code.gson:gson:2.8.6' 26 | implementation 'io.github.cdimascio:java-dotenv:5.1.3' 27 | testImplementation 'junit:junit:4.12' 28 | androidTestImplementation 'androidx.test.ext:junit:1.1.0' 29 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 30 | } 31 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/AuthenticationTask.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import android.os.AsyncTask; 4 | 5 | /** 6 | * Async task to request the client for the access token in background thread. 7 | */ 8 | 9 | public class AuthenticationTask extends AsyncTask { 10 | 11 | private TaskParams mParams; 12 | 13 | public interface ITaskListener { 14 | void onAccessTokenObtained(String accessToken); 15 | } 16 | 17 | public class TaskParams { 18 | ImmersiveReader.IAuthenticator mAccessTokenProvider; 19 | ITaskListener mTaskListener; 20 | 21 | public TaskParams(ImmersiveReader.IAuthenticator accessTokenProvider, ITaskListener taskListener) { 22 | this.mAccessTokenProvider = accessTokenProvider; 23 | this.mTaskListener = taskListener; 24 | } 25 | } 26 | 27 | public void setParams(TaskParams mParams) { 28 | this.mParams = mParams; 29 | } 30 | 31 | @Override 32 | protected String doInBackground(Void... voids) { 33 | return mParams.mAccessTokenProvider.getAccessToken(); 34 | } 35 | 36 | @Override 37 | protected void onPostExecute(String accessToken) { 38 | super.onPostExecute(accessToken); 39 | if (mParams.mTaskListener != null) { 40 | mParams.mTaskListener.onAccessTokenObtained(accessToken); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/Chunk.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import androidx.annotation.Keep; 4 | 5 | @Keep 6 | public class Chunk { 7 | 8 | public String content; 9 | public String lang; 10 | public String mimeType; 11 | 12 | public Chunk(String content, String lang, String mimeType) { 13 | this.content = content; 14 | this.lang = lang; 15 | this.mimeType = mimeType; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/Content.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import androidx.annotation.Keep; 4 | import java.util.List; 5 | 6 | @Keep 7 | public class Content { 8 | 9 | public String title; 10 | public List chunks; 11 | 12 | public Content(String title, List chunks) { 13 | this.title = title; 14 | this.chunks = chunks; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/Error.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import androidx.annotation.Keep; 4 | 5 | @Keep 6 | public class Error { 7 | 8 | public static final int NONE = 1000; 9 | public static final int INVALID_ACCESS_TOKEN = 8001; 10 | public static final int INVALID_STATE = 8002; 11 | public static final int INVALID_CONTENT = 8003; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/IRActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import android.os.Bundle; 4 | import android.webkit.WebView; 5 | 6 | import androidx.appcompat.app.AppCompatActivity; 7 | 8 | public class IRActivity extends AppCompatActivity { 9 | 10 | @Override 11 | public void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | this.getSupportActionBar().hide(); 14 | setContentView(R.layout.activity_immersive_reader); 15 | final WebView webView = findViewById(R.id.webView); 16 | 17 | // Create an Immersive Reader launcher instance and launch it. 18 | IRLauncher immersiveReaderLauncher = new IRLauncher(IRActivity.this, webView); 19 | immersiveReaderLauncher.launch(new IRLauncher.IRLaunchListener() { 20 | @Override 21 | public void onSuccess() { 22 | //Log telemetry 23 | } 24 | 25 | @Override 26 | public void onFailure(IRError error) { 27 | finishImmersiveReader(error); 28 | } 29 | 30 | @Override 31 | public void onExit() { 32 | finishImmersiveReader(new IRError(Error.NONE, "Immersive reader screen exited by user")); 33 | } 34 | }); 35 | } 36 | 37 | private void finishImmersiveReader(IRError error) { 38 | Bundle bundle = new Bundle(); 39 | bundle.putParcelable(IRStore.Output.ERROR, error); 40 | getIntent().putExtras(bundle); 41 | finish(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/IRDataHolder.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import androidx.annotation.Keep; 4 | 5 | /** 6 | * A thin singleton class that is used to hold the Client's IAuthenticator's implementation and the Content to be read. 7 | * This is required for two reasons: 8 | * 1) As per Android guidelines, data being passed via intent should be limited to a few KBs. Alternative is to use Singleton holder classes like this one. 9 | * 2) We need a way to make callbacks survive app configuration changes and killed in background scenarios 10 | */ 11 | 12 | @Keep 13 | public class IRDataHolder { 14 | 15 | private static IRDataHolder mInstance = null; 16 | private ReadableContent mActiveContent = null; 17 | private ImmersiveReader.IAuthenticator mAuthenticator = null; 18 | 19 | public static IRDataHolder getInstance() { 20 | 21 | if (mInstance == null) { 22 | synchronized (IRDataHolder.class) { 23 | if (mInstance == null) { 24 | mInstance = new IRDataHolder(); 25 | } 26 | } 27 | } 28 | return mInstance; 29 | } 30 | 31 | public void setContentToRead(ReadableContent content) { 32 | mActiveContent = content; 33 | } 34 | 35 | public ReadableContent getContentToRead() { 36 | return mActiveContent; 37 | } 38 | 39 | public ImmersiveReader.IAuthenticator getAuthenticator() { 40 | return mAuthenticator; 41 | } 42 | 43 | public void setAuthenticator(ImmersiveReader.IAuthenticator accessTokenProvider) { 44 | this.mAuthenticator = accessTokenProvider; 45 | } 46 | 47 | public void clearContent() { 48 | mActiveContent = null; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/IRError.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | import androidx.annotation.Keep; 6 | 7 | @Keep 8 | public class IRError implements Parcelable { 9 | 10 | private int errorId; 11 | private String errorMessage = ""; 12 | 13 | public String getErrorMessage() { 14 | return errorMessage; 15 | } 16 | 17 | public void setErrorMessage(String errorMessage) { 18 | this.errorMessage = errorMessage; 19 | } 20 | 21 | public int getErrorId() { 22 | return errorId; 23 | } 24 | 25 | public void setErrorId(int errorId) { 26 | this.errorId = errorId; 27 | } 28 | 29 | public IRError(int errorId, String errorMessage) { 30 | this.errorId = errorId; 31 | this.errorMessage = errorMessage; 32 | } 33 | 34 | // parcelable 35 | @Override 36 | public int describeContents() { 37 | return 0; 38 | } 39 | 40 | @Override 41 | public void writeToParcel(Parcel out, int flags) { 42 | out.writeInt(this.errorId); 43 | out.writeString(this.errorMessage); 44 | } 45 | 46 | public static final Creator CREATOR 47 | = new Creator() { 48 | public IRError createFromParcel(Parcel in) { 49 | return new IRError(in); 50 | } 51 | 52 | public IRError[] newArray(int size) { 53 | return new IRError[size]; 54 | } 55 | }; 56 | 57 | private IRError(Parcel in) { 58 | this.errorId = in.readInt(); 59 | this.errorMessage = in.readString(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/IRStore.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import androidx.annotation.Keep; 4 | 5 | @Keep 6 | public final class IRStore { 7 | @Keep 8 | public final static class Output { 9 | public final static String ERROR = "Error"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.Button; 7 | import android.widget.TextView; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public class MainActivity extends Activity { 13 | 14 | @Override 15 | public void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_main); 18 | final TextView irTitle = findViewById(R.id.Title); 19 | final TextView irText1 = findViewById(R.id.Content1); 20 | final TextView irText2 = findViewById(R.id.Content2); 21 | 22 | final Button immersiveReaderButton = findViewById(R.id.LaunchImmersiveReaderButton); 23 | immersiveReaderButton.setOnClickListener(new View.OnClickListener() { 24 | @Override 25 | public void onClick(View view) { 26 | List readableTextChunks = new ArrayList<>(); 27 | readableTextChunks.add(new ReadableTextChunk(irText1.getText().toString(), "en")); 28 | readableTextChunks.add(new ReadableTextChunk(irText2.getText().toString(), "fr")); 29 | ReadableContent readableContent = new ReadableContent(irTitle.getText().toString(), readableTextChunks); 30 | 31 | ImmersiveReader immersiveReader = new ImmersiveReader(MainActivity.this, new IRAuthenticator()); 32 | immersiveReader.read(readableContent); 33 | } 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/Message.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import androidx.annotation.Keep; 4 | 5 | @Keep 6 | public class Message { 7 | 8 | public String cogSvcsAccessToken; 9 | public String cogSvcsSubdomain; 10 | public Content request; 11 | public Integer launchToPostMessageSentDurationInMs; 12 | public Options options; 13 | 14 | public Message(String cogSvcsAccessToken, String cogSvcsSubdomain, Content request, Integer launchToPostMessageSentDurationInMs, Options options) { 15 | this.cogSvcsAccessToken = cogSvcsAccessToken; 16 | this.cogSvcsSubdomain = cogSvcsSubdomain; 17 | this.request = request; 18 | this.launchToPostMessageSentDurationInMs = launchToPostMessageSentDurationInMs; 19 | this.options = options; 20 | } 21 | } -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/Options.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import java.util.concurrent.Callable; 4 | import androidx.annotation.Keep; 5 | 6 | @Keep 7 | public class Options { 8 | 9 | public Callable onExit; 10 | public String uiLang; 11 | public Integer timeout; 12 | 13 | public Options(Callable exitCallback, String uiLang, Integer timeout) { 14 | this.onExit = exitCallback; 15 | this.uiLang = uiLang; 16 | this.timeout = timeout; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/ReadableContent.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import androidx.annotation.Keep; 4 | 5 | import java.util.List; 6 | 7 | @Keep 8 | public class ReadableContent { 9 | 10 | private String mTitle; 11 | private List mTextChunks; 12 | 13 | public ReadableContent(String title, List textChunks) { 14 | this.mTitle = title; 15 | this.mTextChunks = textChunks; 16 | } 17 | 18 | public String getTitle() { 19 | return mTitle; 20 | } 21 | 22 | public List getTextChunks() { 23 | return mTextChunks; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/ReadableTextChunk.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import androidx.annotation.Keep; 4 | 5 | @Keep 6 | public class ReadableTextChunk { 7 | public String mText; 8 | public String mLocale; 9 | 10 | public ReadableTextChunk(String text, String locale) { 11 | this.mText = text; 12 | this.mLocale = locale; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/java/com/example/immersivereadersdk/WebAppInterface.java: -------------------------------------------------------------------------------- 1 | package com.example.immersivereadersdk; 2 | 3 | import androidx.annotation.Keep; 4 | import android.webkit.JavascriptInterface; 5 | 6 | /** 7 | * JavaScript interface implementation passed to the WebView to enable talking between JS and Java 8 | */ 9 | 10 | @Keep 11 | public class WebAppInterface { 12 | 13 | public static WebAppListener mListener; 14 | 15 | interface WebAppListener { 16 | void onShowToast(String toast); 17 | 18 | void onImmersiveReaderExit(); 19 | } 20 | 21 | public WebAppInterface(WebAppListener listener) { 22 | this.mListener = listener; 23 | } 24 | 25 | @JavascriptInterface 26 | public void showToast(String toast) { 27 | mListener.onShowToast(toast); 28 | } 29 | 30 | @JavascriptInterface 31 | public void immersiveReaderExit() { 32 | mListener.onImmersiveReaderExit(); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/layout/activity_immersive_reader.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 17 | 18 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | #008577 8 | #00574B 9 | #D81B60 10 | 11 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.5.1' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-java-android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 25 09:58:12 PDT 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /js/samples/quickstart-java-android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name='ImmersiveReaderSDK' 3 | -------------------------------------------------------------------------------- /js/samples/quickstart-java/quickstart-java.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /js/samples/quickstart-java/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | Archetype Created Web Application 7 | 8 | 9 | GetAuthTokenServlet 10 | Microsoft.ImmersiveReader.GetAuthTokenServlet 11 | 12 | 13 | 14 | GetAuthTokenServlet 15 | /getAuthTokenServlet 16 | 17 | 18 | -------------------------------------------------------------------------------- /js/samples/quickstart-java/src/main/webapp/resources/helpers.js: -------------------------------------------------------------------------------- 1 | function getTokenAsync() { 2 | return new Promise(function (resolve, reject) { 3 | $.ajax({ 4 | url: "/getAuthTokenServlet", 5 | type: "GET", 6 | success: function (response) { 7 | let data = response; 8 | if (data.error) { 9 | reject(data.error); 10 | } else { 11 | // decode token 12 | const decodedData = data 13 | .replace(/\\"/g, '"') // Unescape escaped quotes 14 | .replace(/\\\\/g, '\\'); // Unescape escaped backslashes 15 | data = JSON.parse(decodedData); 16 | const token = data["access_token"]; 17 | resolve({ token }); 18 | } 19 | }, 20 | error: function (err) { 21 | reject(err); 22 | }, 23 | }); 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | 16 | /*/Constants.kt 17 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | android { 8 | compileSdkVersion 28 9 | defaultConfig { 10 | applicationId "com.example.immersivereadersdk" 11 | minSdkVersion 15 12 | targetSdkVersion 28 13 | versionCode 1 14 | versionName "1.0" 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 28 | implementation 'androidx.appcompat:appcompat:1.0.2' 29 | implementation 'androidx.core:core-ktx:1.0.2' 30 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 31 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1" 32 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1" 33 | implementation 'com.google.code.gson:gson:2.8.6' 34 | implementation 'io.github.cdimascio:java-dotenv:5.1.3' 35 | testImplementation 'junit:junit:4.12' 36 | androidTestImplementation 'androidx.test:runner:1.1.1' 37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 38 | } 39 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/assets/immersiveReader.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 38 | 39 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/java/com/example/immersivereadersdk/WebAppInterface.kt: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | package com.example.immersivereadersdk 5 | 6 | import android.content.Context 7 | import android.webkit.JavascriptInterface 8 | import android.webkit.WebView 9 | import android.widget.LinearLayout 10 | import android.widget.Toast 11 | 12 | class WebAppInterface(private val mContext: Context, var parentLayout: LinearLayout, var webView: WebView) { 13 | 14 | // Show a toast from html. 15 | @JavascriptInterface 16 | fun showToast(toast: String) { 17 | Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show() 18 | } 19 | 20 | // Exit the Immersive Reader. 21 | @JavascriptInterface 22 | fun immersiveReaderExit() { 23 | webView.post(Runnable { destroyWebView(parentLayout, webView) }) 24 | 25 | // Any additional functionality may be added here. 26 | Toast.makeText(mContext, "The Immersive Reader has been closed!", Toast.LENGTH_SHORT).show() 27 | } 28 | 29 | // Disposes of the WebView when the back arrow is tapped. 30 | private fun destroyWebView(parentLayout: LinearLayout, webView: WebView) { 31 | 32 | // Removes the WebView from its parent view before doing anything. 33 | parentLayout.removeView(webView) 34 | 35 | // Cleans things up before destroying the WebView. 36 | webView.clearHistory() 37 | webView.clearCache(true) 38 | webView.loadUrl("about:blank") 39 | webView.onPause() 40 | webView.removeAllViews() 41 | webView.pauseTimers() 42 | webView.destroy() 43 | } 44 | } -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | #008577 8 | #00574B 9 | #D81B60 10 | 11 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.3.41' 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.5.0' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } 27 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin-azfunction/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Oct 01 14:12:30 PDT 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin-azfunction/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name='ImmersiveReaderSDK' 3 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | 16 | /*/Constants.kt 17 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | android { 8 | compileSdkVersion 28 9 | defaultConfig { 10 | applicationId "com.example.immersivereadersdk" 11 | minSdkVersion 15 12 | targetSdkVersion 28 13 | versionCode 1 14 | versionName "1.0" 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 28 | implementation 'androidx.appcompat:appcompat:1.0.2' 29 | implementation 'androidx.core:core-ktx:1.0.2' 30 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 31 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1" 32 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1" 33 | implementation 'com.google.code.gson:gson:2.8.6' 34 | implementation 'io.github.cdimascio:java-dotenv:5.1.3' 35 | testImplementation 'junit:junit:4.12' 36 | androidTestImplementation 'androidx.test:runner:1.1.1' 37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 38 | } 39 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/assets/immersiveReader.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 38 | 39 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/java/com/example/immersivereadersdk/WebAppInterface.kt: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | package com.example.immersivereadersdk 5 | 6 | import android.content.Context 7 | import android.webkit.JavascriptInterface 8 | import android.webkit.WebView 9 | import android.widget.LinearLayout 10 | import android.widget.Toast 11 | 12 | class WebAppInterface(private val mContext: Context, var parentLayout: LinearLayout, var webView: WebView) { 13 | 14 | // Show a toast from html. 15 | @JavascriptInterface 16 | fun showToast(toast: String) { 17 | Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show() 18 | } 19 | 20 | // Exit the Immersive Reader. 21 | @JavascriptInterface 22 | fun immersiveReaderExit() { 23 | webView.post(Runnable { destroyWebView(parentLayout, webView) }) 24 | 25 | // Any additional functionality may be added here. 26 | Toast.makeText(mContext, "The Immersive Reader has been closed!", Toast.LENGTH_SHORT).show() 27 | } 28 | 29 | // Disposes of the WebView when the back arrow is tapped. 30 | private fun destroyWebView(parentLayout: LinearLayout, webView: WebView) { 31 | 32 | // Removes the WebView from its parent view before doing anything. 33 | parentLayout.removeView(webView) 34 | 35 | // Cleans things up before destroying the WebView. 36 | webView.clearHistory() 37 | webView.clearCache(true) 38 | webView.loadUrl("about:blank") 39 | webView.onPause() 40 | webView.removeAllViews() 41 | webView.pauseTimers() 42 | webView.destroy() 43 | } 44 | } -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | #008577 8 | #00574B 9 | #D81B60 10 | 11 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.3.41' 5 | repositories { 6 | google() 7 | jcenter() 8 | 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.5.0' 12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | 23 | } 24 | } 25 | 26 | task clean(type: Delete) { 27 | delete rootProject.buildDir 28 | } 29 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/quickstart-kotlin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Oct 01 14:12:30 PDT 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/server/.env_sample: -------------------------------------------------------------------------------- 1 | TENANT_ID= 2 | CLIENT_ID= 3 | CLIENT_SECRET= 4 | SUBDOMAIN= -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/server/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | !bin/ 27 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/server/app.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | 3 | var createError = require('http-errors'); 4 | var express = require('express'); 5 | var path = require('path'); 6 | var cookieParser = require('cookie-parser'); 7 | var logger = require('morgan'); 8 | var cors = require('cors'); 9 | 10 | var indexRouter = require('./routes/index'); 11 | 12 | var app = express(); 13 | 14 | app.use(cors()); 15 | app.use(logger('dev')); 16 | app.use(express.json()); 17 | app.use(express.urlencoded({ extended: false })); 18 | app.use(cookieParser()); 19 | app.use(express.static(path.join(__dirname, 'public'))); 20 | 21 | app.use('/', indexRouter); 22 | 23 | // catch 404 and forward to error handler 24 | app.use(function(req, res, next) { 25 | next(createError(404)); 26 | }); 27 | 28 | // error handler 29 | app.use(function(err, req, res, next) { 30 | // set locals, only providing error in development 31 | res.locals.message = err.message; 32 | res.locals.error = req.app.get('env') === 'development' ? err : {}; 33 | 34 | // render the error page 35 | res.status(err.status || 500); 36 | res.render('error'); 37 | }); 38 | 39 | module.exports = app; 40 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "quickstart-nodejs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "axios": "^1.8.2", 10 | "cookie-parser": "~1.4.4", 11 | "cors": "^2.8.5", 12 | "debug": "~2.6.9", 13 | "dotenv": "^8.2.0", 14 | "express": "~4.19.2", 15 | "http-errors": "~1.6.3", 16 | "morgan": "~1.9.1", 17 | "request": "^2.88.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/server/routes/index.js: -------------------------------------------------------------------------------- 1 | var axios = require('axios'); 2 | var express = require('express'); 3 | var router = express.Router(); 4 | var qs = require('qs'); 5 | require('dotenv').config() 6 | 7 | /* GET home page. */ 8 | router.get('/', function (req, res, next) { 9 | res.json({ 10 | message: 'Ping /GetTokenAndSubdomain from your local app to fetch the creds.' 11 | }) 12 | }); 13 | 14 | router.get('/GetTokenAndSubdomain', async function (req, res) { 15 | var config = { 16 | headers: { 17 | 'content-type': 'application/x-www-form-urlencoded', 18 | } 19 | } 20 | var data = { 21 | grant_type: 'client_credentials', 22 | client_id: process.env.CLIENT_ID, 23 | client_secret: process.env.CLIENT_SECRET, 24 | resource: 'https://cognitiveservices.azure.com/' 25 | }; 26 | 27 | var url = `https://login.windows.net/${process.env.TENANT_ID}/oauth2/token`; 28 | try { 29 | const response = await axios.post(url, qs.stringify(data), config); 30 | var token = response.data.access_token; 31 | var subdomain = process.env.SUBDOMAIN; 32 | res.setHeader("Access-Control-Allow-Origin", "*"); 33 | return res.json({ token, subdomain }); 34 | } catch (response) { 35 | if (response.status !== 200) { 36 | return res.json({ error: "Unable to acquire Azure AD token. Check the debugger for more information." }) 37 | } 38 | } 39 | }); 40 | 41 | module.exports = router; 42 | -------------------------------------------------------------------------------- /js/samples/quickstart-kotlin/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name='ImmersiveReaderSDK' 3 | -------------------------------------------------------------------------------- /js/samples/quickstart-nodejs/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Immersive Reader - Node.js Sample 2 | 3 | ## Prerequisites 4 | 5 | * An Immersive Reader resource configured for Azure Active Directory authentication. Follow [these instructions](https://docs.microsoft.com/azure/applied-ai-services/immersive-reader/how-to-create-immersive-reader) to get set up. You will need some of the values created here when configuring the sample project properties. Save the output of your session into a text file for future reference. 6 | * Install [Yarn](https://yarnpkg.com), [npm](https://npmjs.com) 7 | 8 | ## Usage 9 | 10 | 1. Open a command prompt (Windows) or terminal (OSX, Linux) 11 | 12 | 1. Navigate to the **immersive-reader-sdk/js/samples/quickstart-nodejs** directory 13 | 14 | 1. Run `yarn install` 15 | 16 | 1. Create a file called **.env** and add the following, supplying values as appropriate. 17 | 18 | ```text 19 | TENANT_ID={YOUR_TENANT_ID} 20 | CLIENT_ID={YOUR_CLIENT_ID} 21 | CLIENT_SECRET={YOUR_CLIENT_SECRET} 22 | SUBDOMAIN={YOUR_SUBDOMAIN} 23 | ``` 24 | 25 | 1. Run `npm start` (or `nodemon start` if you want to view changes you make after doing a browser refresh) 26 | 27 | 1. Open a web browser and navigate to [http://localhost:3000](http://localhost:3000) to view the sample 28 | 29 | ## License 30 | 31 | Copyright (c) Microsoft Corporation. All rights reserved. 32 | 33 | Licensed under the MIT License. 34 | -------------------------------------------------------------------------------- /js/samples/quickstart-nodejs/app.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | 3 | var createError = require('http-errors'); 4 | var express = require('express'); 5 | var path = require('path'); 6 | var cookieParser = require('cookie-parser'); 7 | var logger = require('morgan'); 8 | 9 | var indexRouter = require('./routes/index'); 10 | var usersRouter = require('./routes/users'); 11 | var optionsRouter = require('./routes/options'); 12 | 13 | var app = express(); 14 | 15 | // view engine setup 16 | app.set('views', path.join(__dirname, 'views')); 17 | app.set('view engine', 'pug'); 18 | 19 | app.use(logger('dev')); 20 | app.use(express.json()); 21 | app.use(express.urlencoded({ extended: false })); 22 | app.use(cookieParser()); 23 | app.use(express.static(path.join(__dirname, 'public'))); 24 | 25 | app.use('/', indexRouter); 26 | app.use('/users', usersRouter); 27 | app.use('/options', optionsRouter); 28 | 29 | // catch 404 and forward to error handler 30 | app.use(function(req, res, next) { 31 | next(createError(404)); 32 | }); 33 | 34 | // error handler 35 | app.use(function(err, req, res, next) { 36 | // set locals, only providing error in development 37 | res.locals.message = err.message; 38 | res.locals.error = req.app.get('env') === 'development' ? err : {}; 39 | 40 | // render the error page 41 | res.status(err.status || 500); 42 | res.render('error'); 43 | }); 44 | 45 | module.exports = app; 46 | -------------------------------------------------------------------------------- /js/samples/quickstart-nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "quickstart-nodejs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "axios": "^1.8.2", 10 | "cookie-parser": "~1.4.4", 11 | "debug": "~2.6.9", 12 | "dotenv": "^8.2.0", 13 | "express": "~4.19.2", 14 | "http-errors": "~1.6.3", 15 | "morgan": "~1.9.1", 16 | "pug": "3.0.3" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /js/samples/quickstart-nodejs/public/js/helpers.js: -------------------------------------------------------------------------------- 1 | function getTokenAndSubdomainAsync() { 2 | return new Promise(function (resolve, reject) { 3 | $.ajax({ 4 | url: "/GetTokenAndSubdomain", 5 | type: "GET", 6 | success: function (data) { 7 | if (data.error) { 8 | reject(data.error); 9 | } else { 10 | resolve(data); 11 | } 12 | }, 13 | error: function (err) { 14 | reject(err); 15 | } 16 | }); 17 | }); 18 | } -------------------------------------------------------------------------------- /js/samples/quickstart-nodejs/public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } 9 | -------------------------------------------------------------------------------- /js/samples/quickstart-nodejs/routes/index.js: -------------------------------------------------------------------------------- 1 | var axios = require('axios'); 2 | var express = require('express'); 3 | var router = express.Router(); 4 | var qs = require('qs'); 5 | 6 | /* GET home page. */ 7 | router.get('/', function(req, res, next) { 8 | res.render('index', { title: 'Express' }); 9 | }); 10 | 11 | router.get('/GetTokenAndSubdomain', function(req, res) { 12 | try { 13 | var config ={ 14 | headers: { 15 | 'content-type': 'application/x-www-form-urlencoded' 16 | } 17 | } 18 | var data = { 19 | grant_type: 'client_credentials', 20 | client_id: process.env.CLIENT_ID, 21 | client_secret: process.env.CLIENT_SECRET, 22 | resource: 'https://cognitiveservices.azure.com/' 23 | }; 24 | var url = `https://login.windows.net/${process.env.TENANT_ID}/oauth2/token` 25 | console.log(qs.stringify(data)); 26 | axios.post(url, qs.stringify(data), config) 27 | .then(function (response) { 28 | var token = response.data.access_token; 29 | var subdomain = process.env.SUBDOMAIN; 30 | return res.send({token, subdomain}); 31 | }) 32 | .catch(function (response) { 33 | if (response.status !== 200) { 34 | return res.send({error : "Unable to acquire Azure AD token. Check the debugger for more information."}) 35 | } 36 | }); 37 | } catch (error) { 38 | console.log(error); 39 | return res.status(500).send('CogSvcs IssueToken error'); 40 | } 41 | }); 42 | 43 | module.exports = router; 44 | -------------------------------------------------------------------------------- /js/samples/quickstart-nodejs/routes/options.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | router.get('/', (req, res) => { 5 | res.render('options', {title: "options"}); 6 | }); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /js/samples/quickstart-nodejs/routes/users.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET users listing. */ 5 | router.get('/', function(req, res, next) { 6 | res.send('respond with a resource'); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /js/samples/quickstart-nodejs/views/error.pug: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= message 5 | h2= error.status 6 | pre #{error.stack} 7 | -------------------------------------------------------------------------------- /js/samples/quickstart-nodejs/views/layout.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | title= title 5 | link(rel='stylesheet', href='/stylesheets/style.css') 6 | body 7 | block content 8 | -------------------------------------------------------------------------------- /js/samples/quickstart-python/app.py: -------------------------------------------------------------------------------- 1 | import traceback 2 | import os 3 | import requests 4 | import json 5 | from dotenv import load_dotenv 6 | from flask import Flask, redirect, render_template, request, jsonify 7 | app = Flask(__name__) 8 | 9 | load_dotenv() 10 | 11 | @app.route('/') 12 | def index(): 13 | 'Show the index page' 14 | return render_template('index.html') 15 | 16 | @app.route('/options') 17 | def options(): 18 | 'Show the options page' 19 | return render_template('options.html') 20 | 21 | @app.route('/GetTokenAndSubdomain', methods=['GET']) 22 | def getTokenAndSubdomain(): 23 | 'Get the access token' 24 | if request.method == 'GET': 25 | try: 26 | headers = { 'content-type': 'application/x-www-form-urlencoded' } 27 | data = { 28 | 'client_id': str(os.environ.get('CLIENT_ID')), 29 | 'client_secret': str(os.environ.get('CLIENT_SECRET')), 30 | 'resource': 'https://cognitiveservices.azure.com/', 31 | 'grant_type': 'client_credentials' 32 | } 33 | 34 | resp = requests.post('https://login.windows.net/' + str(os.environ.get('TENANT_ID')) + '/oauth2/token', data=data, headers=headers) 35 | jsonResp = resp.json() 36 | 37 | if ('access_token' not in jsonResp): 38 | print(jsonResp) 39 | raise Exception('AAD Authentication error') 40 | 41 | token = jsonResp['access_token'] 42 | subdomain = str(os.environ.get('SUBDOMAIN')) 43 | 44 | return jsonify(token = token, subdomain = subdomain) 45 | except Exception as e: 46 | message = 'Unable to acquire Azure AD token. Check the debugger for more information.' 47 | print(message, e) 48 | return jsonify(error = message) -------------------------------------------------------------------------------- /js/samples/quickstart-python/static/helpers.js: -------------------------------------------------------------------------------- 1 | function getTokenAndSubdomainAsync() { 2 | return new Promise(function (resolve, reject) { 3 | $.ajax({ 4 | url: "/GetTokenAndSubdomain", 5 | type: "GET", 6 | success: function (data) { 7 | if (data.error) { 8 | reject(data.error); 9 | } else { 10 | resolve(data); 11 | } 12 | }, 13 | error: function (err) { 14 | reject(err); 15 | } 16 | }); 17 | }); 18 | } -------------------------------------------------------------------------------- /js/samples/react-sample-server/README.md: -------------------------------------------------------------------------------- 1 | # Azure Applied AI Immersive Reader - React + Node Sample 2 | 3 | 4 | For setting up the node server: 5 | - please cd into the server folder and then [refer to public node server sample here](https://github.com/microsoft/immersive-reader-sdk/tree/dev/js/samples/quickstart-nodejs) 6 | - Also please note, **this server is running on port 3001** 7 | 8 | 9 | For setting up the react client app: 10 | - please cd into the client folder and then refer to the client readme file. 11 | 12 | -------------------------------------------------------------------------------- /js/samples/react-sample-server/client/.env_sample: -------------------------------------------------------------------------------- 1 | #this is for package dependencies further up the project tree that could cause issues 2 | SKIP_PREFLIGHT_CHECK=true -------------------------------------------------------------------------------- /js/samples/react-sample-server/client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | -------------------------------------------------------------------------------- /js/samples/react-sample-server/client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-sample", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@microsoft/immersive-reader-sdk": "^1.4.0", 7 | "loader-utils": "^3.2.1", 8 | "minimatch": "3.0.5", 9 | "node-forge": "^1.3.0", 10 | "postcss": "^8.4.5", 11 | "react": "^17.0.2", 12 | "react-dom": "^17.0.2", 13 | "shell-quote": "^1.7.4", 14 | "string_decoder": "^1.3.0", 15 | "terser": "^5.14.2" 16 | }, 17 | "devDependencies": { 18 | "@testing-library/jest-dom": "^5.11.4", 19 | "@testing-library/react": "^11.1.0", 20 | "@testing-library/user-event": "^12.1.10", 21 | "react-scripts": "^5.0.1" 22 | }, 23 | "scripts": { 24 | "start": "react-scripts start", 25 | "build": "react-scripts build", 26 | "test": "react-scripts test", 27 | "eject": "react-scripts eject" 28 | }, 29 | "eslintConfig": { 30 | "extends": [ 31 | "react-app", 32 | "react-app/jest" 33 | ] 34 | }, 35 | "browserslist": { 36 | "production": [ 37 | ">0.2%", 38 | "not dead", 39 | "not op_mini all" 40 | ], 41 | "development": [ 42 | "last 1 chrome version", 43 | "last 1 firefox version", 44 | "last 1 safari version" 45 | ] 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /js/samples/react-sample-server/client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | import AppOptions from './AppOptions'; 5 | 6 | ReactDOM.render( 7 | 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | -------------------------------------------------------------------------------- /js/samples/react-sample-server/server/.env_sample: -------------------------------------------------------------------------------- 1 | TENANT_ID={TENANT_ID} 2 | CLIENT_ID={CLIENT_ID} 3 | CLIENT_SECRET={SECRET} 4 | SUBDOMAIN={SUBDOMAIN} 5 | -------------------------------------------------------------------------------- /js/samples/react-sample-server/server/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | !bin/ 27 | -------------------------------------------------------------------------------- /js/samples/react-sample-server/server/app.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | 3 | var createError = require('http-errors'); 4 | var express = require('express'); 5 | var path = require('path'); 6 | var cookieParser = require('cookie-parser'); 7 | var logger = require('morgan'); 8 | var cors = require('cors'); 9 | 10 | var indexRouter = require('./routes/index'); 11 | 12 | var app = express(); 13 | 14 | app.use(cors()); 15 | app.use(logger('dev')); 16 | app.use(express.json()); 17 | app.use(express.urlencoded({ extended: false })); 18 | app.use(cookieParser()); 19 | app.use(express.static(path.join(__dirname, 'public'))); 20 | 21 | app.use('/', indexRouter); 22 | 23 | // catch 404 and forward to error handler 24 | app.use(function(req, res, next) { 25 | next(createError(404)); 26 | }); 27 | 28 | // error handler 29 | app.use(function(err, req, res, next) { 30 | // set locals, only providing error in development 31 | res.locals.message = err.message; 32 | res.locals.error = req.app.get('env') === 'development' ? err : {}; 33 | 34 | // render the error page 35 | res.status(err.status || 500); 36 | res.render('error'); 37 | }); 38 | 39 | module.exports = app; 40 | -------------------------------------------------------------------------------- /js/samples/react-sample-server/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "quickstart-nodejs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "axios": "^1.6.0", 10 | "cookie-parser": "~1.4.4", 11 | "cors": "^2.8.5", 12 | "debug": "~2.6.9", 13 | "dotenv": "^8.2.0", 14 | "express": "~4.19.2", 15 | "http-errors": "~1.6.3", 16 | "morgan": "~1.9.1", 17 | "request": "^2.88.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /js/samples/react-sample-server/server/routes/index.js: -------------------------------------------------------------------------------- 1 | var axios = require('axios'); 2 | var express = require('express'); 3 | var router = express.Router(); 4 | var qs = require('qs'); 5 | require('dotenv').config() 6 | 7 | /* GET home page. */ 8 | router.get('/', function (req, res, next) { 9 | res.json({ 10 | message: 'Ping /GetTokenAndSubdomain from your local app to fetch the creds.' 11 | }) 12 | }); 13 | 14 | router.get('/GetTokenAndSubdomain', async function (req, res) { 15 | var config = { 16 | headers: { 17 | 'content-type': 'application/x-www-form-urlencoded', 18 | } 19 | } 20 | var data = { 21 | grant_type: 'client_credentials', 22 | client_id: process.env.CLIENT_ID, 23 | client_secret: process.env.CLIENT_SECRET, 24 | resource: 'https://cognitiveservices.azure.com/' 25 | }; 26 | 27 | var url = `https://login.windows.net/${process.env.TENANT_ID}/oauth2/token`; 28 | try { 29 | const response = await axios.post(url, qs.stringify(data), config); 30 | var token = response.data.access_token; 31 | var subdomain = process.env.SUBDOMAIN; 32 | res.setHeader("Access-Control-Allow-Origin", "*"); 33 | return res.json({ token, subdomain }); 34 | } catch (response) { 35 | if (response.status !== 200) { 36 | return res.json({ error: "Unable to acquire Azure AD token. Check the debugger for more information." }) 37 | } 38 | } 39 | }); 40 | 41 | module.exports = router; 42 | -------------------------------------------------------------------------------- /js/samples/react-sample-simple/.env_sample: -------------------------------------------------------------------------------- 1 | SKIP_PREFLIGHT_CHECK=true #this is for package dependencies that could cause issues 2 | 3 | REACT_APP_TENANT_ID={TENANT_ID} 4 | REACT_APP_CLIENT_ID={CLIENT_ID} 5 | REACT_APP_CLIENT_SECRET={SECRET} 6 | REACT_APP_SUBDOMAIN={SUBDOMAIN} 7 | -------------------------------------------------------------------------------- /js/samples/react-sample-simple/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | -------------------------------------------------------------------------------- /js/samples/react-sample-simple/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-sample", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@microsoft/immersive-reader-sdk": "^1.4.0", 7 | "follow-redirects": "^1.15.6", 8 | "loader-utils": "^3.2.1", 9 | "minimatch": "3.0.5", 10 | "node-forge": "^1.3.0", 11 | "postcss": "^8.4.5", 12 | "react": "^17.0.2", 13 | "react-dom": "^17.0.2", 14 | "shell-quote": "^1.7.3", 15 | "string_decoder": "^1.3.0", 16 | "terser": "^5.14.2" 17 | }, 18 | "devDependencies": { 19 | "@testing-library/jest-dom": "^5.11.4", 20 | "@testing-library/react": "^11.1.0", 21 | "@testing-library/user-event": "^12.1.10", 22 | "react-scripts": "^5.0.1", 23 | "web-vitals": "^1.0.1" 24 | }, 25 | "scripts": { 26 | "start": "react-scripts start", 27 | "build": "react-scripts build", 28 | "test": "react-scripts test", 29 | "eject": "react-scripts eject" 30 | }, 31 | "proxy": "https://login.windows.net", 32 | "eslintConfig": { 33 | "extends": [ 34 | "react-app", 35 | "react-app/jest" 36 | ] 37 | }, 38 | "browserslist": { 39 | "production": [ 40 | ">0.2%", 41 | "not dead", 42 | "not op_mini all" 43 | ], 44 | "development": [ 45 | "last 1 chrome version", 46 | "last 1 firefox version", 47 | "last 1 safari version" 48 | ] 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /js/samples/react-sample-simple/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | import AppOptions from './AppOptions'; 5 | 6 | ReactDOM.render( 7 | 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | -------------------------------------------------------------------------------- /js/samples/simple/Readme.md: -------------------------------------------------------------------------------- 1 | # Immersive Reader - Simple HTML/Javascript Sample 2 | 3 | ## Prerequisites 4 | 5 | * An Immersive Reader resource configured for Azure Active Directory authentication. Follow [these instructions](https://docs.microsoft.com/azure/applied-ai-services/immersive-reader/how-to-create-immersive-reader) to get set up. You will need some of the values created here when configuring the sample project properties. Save the output of your session into a text file for future reference. 6 | 7 | ## Usage 8 | 9 | 1. Set constant values for `ClientSecret`, `Subdomain`, `ClientId` and `TenantId` into **renderButtonsPlusHtml.html** file. 10 | 1. Open **renderButtonsPlusHtml.html** in a web browser. 11 | 12 | > [!IMPORTANT] 13 | > **Be sure not to commit any references that contain TenantId, ClientId, ClientSecret, Subdomain or other secrets into source control, as secrets should not be made public**. 14 | 15 | 16 | ## License 17 | 18 | Copyright (c) Microsoft Corporation. All rights reserved. 19 | 20 | Licensed under the MIT License. 21 | -------------------------------------------------------------------------------- /js/samples/uwp/ImmersiveReader/ImmersiveReaderView.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /js/samples/uwp/ImmersiveReader/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ImmersiveReader")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ImmersiveReader")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /js/samples/uwp/ImmersiveReader/script.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 32 | 33 | -------------------------------------------------------------------------------- /js/samples/uwp/README.md: -------------------------------------------------------------------------------- 1 | # ImmersiveReaderView control for UWP 2 | 3 | 4 | The ImmersiveReaderView control is a Windows Runtime component that allows you to easily and quickly integrate the [Immersive Reader](https://azure.microsoft.com/services/immersive-reader) into your UWP application. 5 | 6 | ## Usage 7 | 8 | Usage of this SDK requires an Azure subscription to Immersive Reader. Follow [these instructions](https://docs.microsoft.com/azure/applied-ai-services/immersive-reader/how-to-create-immersive-reader) to create an Immersive Reader resource and configure Azure Active Directory authentication. Save the output of your session into a text file for future reference. 9 | 10 | For sample usage, launch the `ImmersiveReader.sln` file in Visual Studio 2019. Ensure that you have the UWP development tooling installed. Note that ImmersiveReaderView only supports the Fall Creator's Update (16299) or higher. 11 | 12 | Press `F5` to run the sample application. Enter your Azure information into the sample app and click the `Start immersive reader` button. -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/uwp/SampleApp/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/uwp/SampleApp/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/uwp/SampleApp/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/uwp/SampleApp/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/uwp/SampleApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/uwp/SampleApp/Assets/StoreLogo.png -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/immersive-reader-sdk/01c1a959de24c065843e2daf5676d2a4a5fc3dc8/js/samples/uwp/SampleApp/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | SampleApp 18 | kid_j 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SampleApp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SampleApp")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /js/samples/uwp/SampleApp/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /js/src/content.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export type Content = { 5 | title?: string; // Title text shown at the top of the Immersive Reader (optional) 6 | chunks: Chunk[]; // Array of chunks 7 | } 8 | 9 | export type Chunk = { 10 | content: string; // Plain text string 11 | lang?: string; // Language of the text, e.g. en, es-ES (optional). Language will be detected automatically if not specified. 12 | mimeType?: string; // MIME type of the content (optional). Currently 'text/plain', 'application/mathml+xml', and 'text/html' are supported. Defaults to 'text/plain' if not specified. 13 | } -------------------------------------------------------------------------------- /js/src/error.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export type Error = { 5 | code: ErrorCode; 6 | message: string; // Human-readable representation of the error 7 | sessionId?: string; // Session ID which can be used for debugging 8 | }; 9 | 10 | export enum ErrorCode { 11 | BadArgument = 'BadArgument', 12 | Timeout = 'Timeout', 13 | TokenExpired = 'TokenExpired', 14 | Throttled = 'Throttled', 15 | ServerError = 'ServerError', 16 | InvalidSubdomain = 'InvalidSubdomain' 17 | } -------------------------------------------------------------------------------- /js/src/immersive-reader-sdk.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | import { renderButtons } from './renderButtons'; 5 | import { close, launchAsync } from './launchAsync'; 6 | import { CookiePolicy } from './options'; 7 | 8 | if (typeof window !== 'undefined') { 9 | window.addEventListener('load', () => { 10 | if (!(window.hasOwnProperty('Promise'))) { 11 | dynamicallyLoadScript('https://ircdname.azureedge.net/permanent-static-resources/promise-polyfill.min.js'); 12 | } 13 | 14 | renderButtons(); 15 | }); 16 | } 17 | 18 | function dynamicallyLoadScript(scriptUrl: string) { 19 | const script = document.createElement('script'); 20 | script.src = scriptUrl; 21 | document.head.appendChild(script); 22 | } 23 | 24 | export { renderButtons, close, launchAsync, CookiePolicy }; -------------------------------------------------------------------------------- /js/src/launchResponse.ts: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | export type LaunchResponse = { 5 | container: HTMLDivElement; 6 | sessionId: string; 7 | charactersProcessed: number; 8 | }; -------------------------------------------------------------------------------- /js/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "experimentalDecorators": true, 5 | "emitDecoratorMetadata": true, 6 | "module": "commonjs", 7 | "noImplicitAny": true, 8 | "noImplicitReturns": true, 9 | "noUnusedLocals": true, 10 | "noUnusedParameters": true, 11 | "outDir": "lib", 12 | "removeComments": true, 13 | "sourceMap": true, 14 | "target": "es5", 15 | "lib": [ 16 | "es5", 17 | "es2015.promise", 18 | "dom" 19 | ] 20 | }, 21 | "include": [ "src/**/*" ] 22 | } -------------------------------------------------------------------------------- /js/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const webpack = require('webpack'); 3 | 4 | module.exports = { 5 | mode: 'production', 6 | entry: './src/immersive-reader-sdk.ts', 7 | module: { 8 | rules: [ { 9 | test: /\.tsx?$/, 10 | use: 'ts-loader', 11 | exclude: /node_modules/ 12 | }, 13 | { 14 | test: /\.ts$/, 15 | enforce: 'pre', 16 | use: [ { loader: 'tslint-loader' } ] 17 | } ] 18 | }, 19 | resolve: { 20 | extensions: ['.ts', '.js', '.json'] 21 | }, 22 | output: { 23 | path: path.join(__dirname, 'lib'), 24 | library: 'ImmersiveReader', 25 | filename: 'immersive-reader-sdk.js', 26 | libraryTarget: 'umd' 27 | }, 28 | plugins: [ 29 | new webpack.DefinePlugin({ 30 | VERSION: JSON.stringify(require("./package.json").version) 31 | }) 32 | ] 33 | }; --------------------------------------------------------------------------------