उदाहरण और डेमो
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
एम्बेड किए गए व्यूअर एपीआई दस्तावेज़ सेट में शामिल सभी उदाहरण तुरंत देखने के लिए नीचे दिए गए हैं. इसके अलावा, बेहतर कॉन्सेप्ट दिखाने के लिए कई और डेमो शामिल किए गए हैं.
डेवलपर की गाइड में दिए गए उदाहरण
ये बुनियादी उदाहरण डेवलपर की गाइड में दिए गए हैं. इनमें एम्बेड किए गए व्यूअर एपीआई के सबसे आम इस्तेमाल के बारे में भी बताया गया है.
- आसान तरीके से सेट की गई किताब
एम्बेड किए गए व्यूअर एपीआई के "नमस्ते, दुनिया" उदाहरण में, एपीआई को लोड करने और किसी खास किताब से दर्शक का ध्यान खींचने का तरीका बताया गया है.
- किताब की भाषा
इस उदाहरण में, दर्शक के इंटरफ़ेस की भाषा को बदलने का तरीका बताया गया है. जैसे, ब्राज़ीलियन पॉर्चुगीज़ में भाषा बदलें.
- book-notfound
इस वीडियो में, कॉलबैक फ़ंक्शन को जोड़ने का तरीका बताया गया है. इसे तब कॉल किया जाता है, जब दर्शक तय की गई किताब को लोड नहीं कर पाता है. ऐसी शर्तों को अच्छी तरह से मैनेज करने के लिए, इस उदाहरण को आधार बनाया जा सकता है.
- book-सफल
इस वीडियो में कॉलबैक फ़ंक्शन जोड़ने का तरीका बताया गया है. इसे तब कॉल किया जाता है, जब दर्शक किसी किताब को शुरू कर देता है और प्रोग्राम के हिसाब से उसमें बदलाव किए जाने के लिए तैयार होता है.
- बुक-ऐनिमेशन
यह समझने के लिए कि JavaScript का इस्तेमाल करके दर्शक को प्रोग्राम के हिसाब से कैसे कंट्रोल किया जा सकता है, एक झलक दिखाई जाती है. यह झलक, हर तीन सेकंड में अपने-आप अगले पेज पर फ़्लिप हो जाती है.
व्यूअर का प्रोग्रामेटिक कंट्रोल
दर्शक की मदद से, दर्शक से इंटरैक्ट करके, उपयोगकर्ता के पास ऐसे किसी भी काम के लिए कोड का इस्तेमाल करने का विकल्प मौजूद है. नीचे दिए गए उदाहरणों में बताया गया है कि यह कैसे काम का हो सकता है.
- book-इंटरैक्शन-controls
इस उदाहरण में व्यूअर के साथ इस्तेमाल किए जा सकने वाले इंटरैक्शन के सभी तरीके शामिल हैं. इनमें, Zoom, NextPage, goToPage, और हाइलाइट करने वाले फ़ंक्शन शामिल हैं.
- book-इंटरैक्शनs-openatpage
यह दिखाता है कि कॉलबैक और goToPage फ़ंक्शन का इस्तेमाल करके, किसी खास पेज पर किताब व्यूअर को अपने-आप कैसे खोला जा सकता है.
Books API और डाइनैमिक लिंक के साथ जोड़ना
ऐडवांस ऐप्लिकेशन बनाते समय, एम्बेड किए गए व्यूअर एपीआई को Books API या डाइनैमिक लिंक सुविधा के साथ जोड़ना मददगार हो सकता है. उदाहरण के लिए, पहले से यह जानना मददगार हो सकता है कि एम्बेड करने के लिए कोई खास झलक उपलब्ध होगी या नहीं (उदाहरण के लिए, यह तय करना कि उपयोगकर्ता को आपकी साइट पर झलक विंडो खोलने का विकल्प दिया जाए या नहीं). इसके अलावा, ऐसा हो सकता है कि आपको किसी किताब का आइडेंटिफ़ायर न पता हो और आप सबसे पहले Books API का इस्तेमाल करके "उसे खोजना" चाहें. नीचे दिए गए उदाहरणों में बताया गया है कि इन कार्रवाइयों को कैसे किया जाए.
- book- Dynamiclinks-zippy
यहां हम देखते हैं कि कोई किताब पहले एम्बेड करने के लिए उपलब्ध है या नहीं. अगर और अगर यह उपलब्ध है, तो भी हम "झलक की सूची" रेंडर करते हैं. इस पर क्लिक करने पर, किताब की झलक वाली इनलाइन इमेज दिखती है.
- booksapi-titlesearch
इस उदाहरण में, किसी किताब के लिए खोज क्वेरी डालकर, एम्बेड किए गए व्यूअर को खोला जा सकता है. यह आपकी डाली गई क्वेरी के लिए, एम्बेड किया जा सकने वाला पहला नतीजा अपने-आप दिखाएगा. यह खोज के नतीजों को ऐक्सेस करने के लिए, Data API के JSON आउटपुट फ़ॉर्मैट का इस्तेमाल करता है.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2024-06-28 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2024-06-28 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eThis documentation provides a comprehensive list of examples for Google Books Embedded Viewer API.\u003c/p\u003e\n"],["\u003cp\u003eExamples cover basic viewer setup, language settings, error handling, and programmatic control functionalities.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can learn to integrate the viewer with the Books API and Dynamic Links for advanced functionalities.\u003c/p\u003e\n"],["\u003cp\u003eSample code demonstrates interactions like zooming, navigation, and highlighting within the embedded viewer.\u003c/p\u003e\n"],["\u003cp\u003eUse cases include creating book previews, searching for books, and handling embedding availability.\u003c/p\u003e\n"]]],[],null,["# Examples and Demos\n\nAll of the examples contained within the Embedded Viewer API documentation set are listed below for quick reference. In addition, a number of additional demos are included to illustrate advanced concepts.\n\nExamples from the Developer's Guide\n-----------------------------------\n\nThese basic examples appear in the [Developer's Guide](/books/docs/viewer/developers_guide) and cover the most common uses of the Embedded Viewer API.\n\n- [book-simple](/books/docs/viewer/examples/book-simple) \n The \"Hello, World\" example of the Embedded Viewer API, this example indicates how to load the API and draw a viewer with a particular book.\n- [book-language](/books/docs/viewer/examples/book-language) \n This example shows how to change the viewer's interface language, in this case to Brazilian Portuguese.\n- [book-notfound](/books/docs/viewer/examples/book-notfound) \n This shows how to add a callback function which is called when the viewer could not load the specified book. You can build on this example to gracefully handle such conditions.\n- [book-success](/books/docs/viewer/examples/book-success) \n This shows how to add a callback function which is called when the viewer has successfully initialized with a book and is ready to be manipulated programatically.\n- [book-animate](/books/docs/viewer/examples/book-animate) \n To illustrate how the viewer can be controlled programmatically using JavaScript, a preview is shown which automatically flips to the next page every 3 seconds.\n\nProgrammatic control of the viewer\n----------------------------------\n\nThe viewer allows you to do with code almost anything the user can do by interacting with the the viewer. The examples below show how this might be useful.\n\n- [book-interactions-controls](/books/docs/viewer/examples/book-interactions-controls) \n This working example enumerates all the interaction methods supported by the viewer, including zoom, nextPage, goToPage, and highlighting functions.\n- [book-interactions-openatpage](/books/docs/viewer/examples/book-interactions-openatpage) \n Shows how to automatically open a book viewer on a particular page, using callbacks and the goToPage function.\n\nCombining with the Books API and Dynamic Links\n----------------------------------------------\n\nWhen building advanced applications, you may find it useful to combine\nthe Embedded Viewer API with either the [Books API](/books/docs/v1/getting_started) or the\n[Dynamic Links](/books/docs/dynamic-links)\nfeature. For example, it may be useful to know in advance whether a particular\npreview will be available for embedding (e.g., to determine whether to give the\nuser the option to open a preview window on your site). Or, you may not know the\nidentifier for a particular book, and want to first \"look it up\" using the Books\nAPI. The examples below indicate how to perform these operations.\n\n- [book-dynamiclinks-zippy](/books/docs/viewer/examples/book-dynamiclinks-zippy) \n Here we check whether a book is available for embedding first. If and only if it is available, we render a \"preview zippy,\" which, when clicked, shows the book preview inline.\n- [booksapi-titlesearch](/books/docs/viewer/examples/booksapi-titlesearch) \n This example allows you open an embedded viewer by simply entering a search query for a book. It will automatically show the first embeddable result for the query you enter. This uses the JSON output format of the Data API to access the search results."]]