ارجاع
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
Embedded Viewer API شامل یک کلاس است: DefaultViewer. برای آشنایی با استفاده از API، به راهنمای توسعهدهنده مراجعه کنید.
خلاصه سازنده
-
google.books.DefaultViewer (div, opt_options)
- یک نمایشگر تعبیه شده برای یک جلد در جستجوی کتاب Google.
خلاصه روش
-
string getPageNumber ()
- شماره صفحه صفحه ای را که در حال حاضر در viewport قابل مشاهده است برمی گرداند.
-
string getPageId ()
- یک شناسه منحصربهفرد برای صفحهای که در حال حاضر در viewport قابل مشاهده است، برمیگرداند.
-
boolean goToPage (pageNumber)
- اگر صفحه وجود داشته باشد و به آن تبدیل شده باشد، true را برمی گرداند.
-
boolean goToPageId (pageId)
- اگر صفحه وجود داشته باشد و به آن تبدیل شده باشد، true را برمی گرداند.
-
boolean isLoaded ()
- نشان می دهد که آیا بیننده با کتاب داده شده با موفقیت مقداردهی اولیه شده است یا خیر.
-
highlight (opt_string)
- یک عبارت را در پنجره نمای برجسته می کند.
-
load (identifiers, opt_notFoundCallback, opt_successCallback)
- کتابی را در پنجره نمایش بارگیری می کند.
-
nextPage ()
- به صفحه بعدی کتاب می رود.
-
previousPage ()
- به صفحه قبلی کتاب می رود.
-
resize ()
- اندازه بیننده را تغییر می دهد تا با اندازه کانتینر آن مطابقت داشته باشد.
-
zoomIn ()
- به بیننده زوم می کند.
-
zoomOut ()
- از بیننده بزرگنمایی می کند.
جزئیات سازنده
google.books.DefaultViewer
google.books.DefaultViewer(div, opt_options)
یک نمایشگر تعبیه شده برای یک جلد در جستجوی کتاب Google.
پارامترها: Element div
- Div برای رسم نمای در آن.
Object opt_options
- نقشه کلید-مقدار گزینهها برای ارسال به بیننده.
جزئیات روش
getPageNumber
string getPageNumber()
شماره صفحه صفحه ای را که در حال حاضر در viewport قابل مشاهده است برمی گرداند.
getPageId
string getPageId()
یک شناسه منحصربهفرد برای صفحهای که در حال حاضر در viewport قابل مشاهده است، برمیگرداند.
goToPage
boolean goToPage(pageNumber)
اگر صفحه وجود داشته باشد و به آن تبدیل شده باشد، true را برمی گرداند.
پارامترها: string, number pageNumber
- شماره صفحه صفحه که باید به آن مراجعه کنید.
goToPageId
boolean goToPageId(pageId)
اگر صفحه وجود داشته باشد و به آن تبدیل شده باشد، true را برمی گرداند.
پارامترها: string pageId
- شناسه منحصر به فرد صفحه که باید به آن مراجعه کنید.
بارگذاری شده است
boolean isLoaded()
اگر بیننده با کتاب داده شده با استفاده از load
با موفقیت مقداردهی اولیه شده باشد، true برمی گردد.
برجسته کردن
highlight(opt_string)
یک عبارت را در پنجره نمای برجسته می کند.
پارامترها: string opt_string
- رشته ای برای برجسته کردن. برجسته سازی را در صورت null
یا undefined
خاموش می کند.
بار
load(identifiers, opt_notFoundCallback, opt_successCallback)
کتابی را در پنجره نمایش بارگیری می کند.
پارامترها: string , Array of strings identifiers
- نشانی اینترنتی پیش نمایش یا شناسه کتاب مانند ISBN، OCLC، و غیره. به قالب درخواست پیوندهای پویا مراجعه کنید. برای تعیین چندین شناسه جایگزین برای کتاب (به عنوان مثال، ISBN های جلد سخت و جلد نرم)، Array
ای از این رشته های شناسه را ارسال کنید. بیننده اولین کتاب قابل جاسازی را در آرایه بارگذاری می کند.
Function opt_notFoundCallback
- اگر identifier
یک شناسه کتاب باشد، اگر کتاب پیدا نشد، این بازخوانی فراخوانی می شود. اگر null
تصویب شود یا این پارامتر حذف شود، هیچ تابعی در صورت خرابی فراخوانی نخواهد شد.
Function opt_successCallback
- اگر و زمانی که بیننده با یک کتاب خاص با موفقیت نمونهسازی شود و آماده دریافت فراخوانهای تابعی مانند nextPage
باشد، این تماس مجدد اجرا میشود.
صفحه بعدی
nextPage()
به صفحه بعدی کتاب می رود.
صفحه قبلی
previousPage()
به صفحه قبلی کتاب می رود.
تغییر اندازه
resize()
اندازه بیننده را تغییر می دهد تا با اندازه کانتینر آن مطابقت داشته باشد.
zoomIn
zoomIn()
بزرگنمایی
zoomOut()
از بیننده بزرگنمایی می کند.
بازگشت به بالا
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-01-09 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-01-09 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe Embedded Viewer API allows you to embed a Google Book into your webpage using the \u003ccode\u003egoogle.books.DefaultViewer\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods for navigation such as \u003ccode\u003enextPage\u003c/code\u003e, \u003ccode\u003epreviousPage\u003c/code\u003e, \u003ccode\u003egoToPage\u003c/code\u003e, and \u003ccode\u003egoToPageId\u003c/code\u003e, as well as zooming and highlighting functionalities.\u003c/p\u003e\n"],["\u003cp\u003eYou can load a book using identifiers like ISBN or OCLC with the \u003ccode\u003eload\u003c/code\u003e method and handle loading success or failure with callbacks.\u003c/p\u003e\n"],["\u003cp\u003eThe viewer can be resized dynamically with \u003ccode\u003eresize\u003c/code\u003e and provides methods to retrieve current page information like \u003ccode\u003egetPageNumber\u003c/code\u003e and \u003ccode\u003egetPageId\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Reference\n\nThe Embedded Viewer API contains one class: DefaultViewer. For an introduction to using the API, see the [Developer's Guide](/books/docs/viewer/developers_guide).\n\nConstructor summary\n-------------------\n\n`\n`**[google.books.DefaultViewer](#google.books.DefaultViewer)**`(div, opt_options)\n`\n: An embedded viewer for a volume in Google Book Search.\n\nMethod summary\n--------------\n\n`string\n`**[getPageNumber](#google.books.DefaultViewer.getPageNumber)**`() `\n: Returns the page number of the page that's currently visible in\n the viewport.\n\n`string\n`**[getPageId](#google.books.DefaultViewer.getPageId)**`() `\n: Returns a unique identifier for the page that's currently visible in the\n viewport.\n\n`boolean\n`**[goToPage](#google.books.DefaultViewer.goToPage)**`(pageNumber) `\n: Returns true if the page exists and was turned to.\n\n`boolean\n`**[goToPageId](#google.books.DefaultViewer.goToPageId)**`(pageId) `\n: Returns true if the page exists and was turned to.\n\n`boolean\n`**[isLoaded](#google.books.DefaultViewer.isLoaded)()**\n: Indicates whether the viewer has been successfully initialized with the given book.\n\n`\n`**[highlight](#google.books.DefaultViewer.highlight)**`(opt_string) `\n: Highlights a term in the viewport.\n\n`\n`**[load](#google.books.DefaultViewer.load)**`(identifiers, opt_notFoundCallback, opt_successCallback) `\n: Loads a book in the viewport.\n\n`\n`**[nextPage](#google.books.DefaultViewer.nextPage)**`() `\n: Goes to the next page in the book.\n\n`\n`**[previousPage](#google.books.DefaultViewer.previousPage)**`() `\n: Goes to the previous page in the book.\n\n`\n`**[resize](#google.books.DefaultViewer.resize)**`() `\n: Resizes the viewer to conform to size of its container div.\n\n`\n`**[zoomIn](#google.books.DefaultViewer.zoomIn)**`() `\n: Zooms into the viewer.\n\n`\n`**[zoomOut](#google.books.DefaultViewer.zoomOut)**`() `\n: Zooms out of the viewer.\n\nConstructor detail\n------------------\n\n### google.books.DefaultViewer\n\n```\ngoogle.books.DefaultViewer(div, opt_options)\n```\n\nAn embedded viewer for a volume in Google Book Search.\n\n\u003c!-- --\u003e\n\n**Parameters:** *Element*` div` - Div to draw the viewport in.\n\u003c!-- --\u003e\n\n*Object*` opt_options` - Key-value map of options to pass along to the viewer.\n\nMethod detail\n-------------\n\n### getPageNumber\n\n```\nstring getPageNumber()\n```\n\nReturns the page number of the page that's currently visible in the viewport.\n\n\u003c!-- --\u003e\n\n**Returns:** *string*` `\n\n### getPageId\n\n```\nstring getPageId()\n```\n\nReturns a unique identifier for the page that's currently visible in the viewport.\n\n\u003c!-- --\u003e\n\n**Returns:** *string*` `\n\n### goToPage\n\n```\nboolean goToPage(pageNumber)\n```\n\nReturns true if the page exists and was turned to.\n\n\u003c!-- --\u003e\n\n**Parameters:** *string, number*` pageNumber ` - The page number of the page to turn to.\n\n\u003c!-- --\u003e\n\n**Returns:** *boolean*` `\n\n### goToPageId\n\n```\nboolean goToPageId(pageId)\n```\n\nReturns true if the page exists and was turned to.\n\n\u003c!-- --\u003e\n\n**Parameters:** *string*` pageId ` - The unique identifier of the page to turn to.\n\n\u003c!-- --\u003e\n\n**Returns:** *boolean*` `\n\n### isLoaded\n\n```\nboolean isLoaded()\n```\n\nReturns true if the viewer has been successfully initialized with the given book using `load`.\n\n\u003c!-- --\u003e\n\n**Returns:** *boolean*` `\n\n### highlight\n\n```\nhighlight(opt_string)\n```\n\nHighlights a term in the viewport.\n\n\u003c!-- --\u003e\n\n**Parameters:** *string*` opt_string ` - A string to highlight. Turns off highlighting if `null` or `undefined`.\n\n### load\n\n```\nload(identifiers, opt_notFoundCallback, opt_successCallback)\n```\n\nLoads a book in the viewport.\n\n\u003c!-- --\u003e\n\n**Parameters:** *string* `, `*Array of strings*` identifiers ` - A preview URL or book identifier such as an ISBN, OCLC, etc. See [Dynamic Links request format](/books/docs/dynamic-links#requestFormat). To specify several alternative identifiers for the book (e.g., the hardcover and softcover ISBNs), pass an `Array` of these identifier strings; the viewer will the viewer will load the first embeddable book in the array.\n\u003c!-- --\u003e\n\n*Function*` opt_notFoundCallback ` - If `identifier` is a book identifier, this callback will be called if the book was not found. If `null` passed or this parameter is omitted, no function will be called on failure.\n\u003c!-- --\u003e\n\n*Function*` opt_successCallback ` - This callback will be executed if and when the viewer is successfully instantiated with a particular book, and ready to receive function calls such as `nextPage`.\n\n### nextPage\n\n```\nnextPage()\n```\n\nGoes to the next page in the book.\n\n### previousPage\n\n```\npreviousPage()\n```\n\nGoes to the previous page in the book.\n\n### resize\n\n```\nresize()\n```\n\nResizes the viewer to conform to size of its container div.\n\n### zoomIn\n\n```\nzoomIn()\n```\n\nZooms into the viewer.\n\n### zoomOut\n\n```\nzoomOut()\n```\n\nZooms out of the viewer.\n\n[Back to top](#top)"]]