Önizleme Sihirbazı
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Önizleme Sihirbazı, önizlemeleri hızlı, kolay ve güvenilir bir şekilde sitenize entegre etmenizi sağlamak amacıyla tasarlanmıştır. Bir kitap görüntüleyici yerleştirebilir, Kitap Arama'nın bağlantısını verebilir, hatta sitenize bir önizleme "pop-up" penceresi ekleyebilirsiniz. Tek yapmanız gereken kodu oluşturmak ve sayfanıza yapıştırmaktır. Bazı basit JavaScript işlevlerini kullanarak da bu kodu özelleştirebilirsiniz.
Önizleme Sihirbazı, Dinamik Bağlantılar ve Yerleşik Görüntüleyici API'lerimizin üzerine geliştirdiğimiz basit bir kullanım kitaplığıdır. Özelleştirilmiş entegrasyon arayan ileri düzey bir geliştiriciyseniz doğrudan temel API'leri kullanabilirsiniz.
Önizleme kodunuzu oluşturun
Oluşturulan önizleme örnekleri
Aşağıdaki örnekler Önizleme Sihirbazı kullanılarak oluşturulmuştur.
Kodunuzu özelleştirin
Yukarıdaki sihirbazı kullanmaya ek olarak, bazı basit JavaScript "yardımcı" işlevlerini de doğrudan çağırabilirsiniz. Bunu yapmak için önce Önizleme Sihirbazı kitaplığını yüklemeniz gerekir. Bunu yapmanın bir yolu, aşağıdaki etiketi sayfanızın <head>
bölümüne eklemektir:
<script type="text/javascript" src="https://books.google.com/books/previewlib.js"></script>
Önizleme kitaplığını yükledikten sonra, dokümanınızın <body>
içindeki <script>
etiketlerinden aşağıdaki işlevlerden herhangi birini çağırabilirsiniz. Örneğin, "Google Önizleme" düğmesini eklemek istiyorsanız kodu, sayfada düğmenin istediğiniz konumundaki bir <script>
öğesine yerleştirirsiniz.
GBS_setLanguage
GBS_setLanguage(languageCode)
Bu işlev çağrıldıktan sonra eklenen düğmelerin veya metnin dilini değiştirir. Buna "Google Önizleme" düğmesinin dili, yerleştirilmiş önizlemenin arayüz dili vb. dahildir.
Parametreler:
string languageCode
- İstenen RFC 3066 dil kodu (İngilizce için varsayılan değer "en"dir). Şu anda desteklenen dil kodları arasında şunlar yer alır: hy, bg, ca, zh-CN, zh-TW, hr, cs, da, nl, en, fil, fi, fr, de, el, hi, hu, is, id, in, it, ja, ko, lv, lt, no, pl, pt-BR, pt-PT, ro., pt-PT, ro
GBS_setViewerOptions
GBS_setViewerOptions(optionObj)
Parametreler:
Object optionsObj
- Embedded Viewer API'sinin DefaultViewer oluşturucusuna aktarılan bir anahtar/değer çifti kümesi. Genellikle bu gelişmiş özelleştirmeler için kullanılır.
GBS_setCobrandName
GBS_setCobrandName(cobrandName)
İş Ortağı Programı'ndaki yayıncılar tarafından kullanılmak üzere tasarlanmış bu işlev, Kitap Arama'ya önizleme bağlantıları eklerken kullanılacak Ortak Markalı Arama sitesini ayarlar. Bir düğme eklemeden önce bu işlevi çağırmak, kullanıcıların Kitap Arama önizlemelerinin üzerinde ortak logosunu görmelerini sağlar.
GBS_insertEmbeddedViewer
GBS_insertEmbeddedViewer(identifier, opt_width, opt_height)
Bu işlevin çağrıldığı yere yerleştirilmiş bir kitap önizlemesi ekler. Önizleme kullanılamıyorsa hiçbir izleyici gösterilmez.
Parametreler:
string identifier
: ISBN, OCLC veya LCCN numarası gibi bir önizleme URL'si veya kitap tanımlayıcısı. Dinamik Bağlantı istek biçimi konusuna bakın.
Number opt_width
- İzleyicinin piksel cinsinden istenen genişliği.
Number opt_height
- İzleyicinin piksel cinsinden istenen yüksekliği.
GBS_insertPreviewButtonPopup(identifiers)
Kitap önizlemesi kullanılabiliyorsa bu işlev bir "Google Önizleme" düğmesi yazar. Bu düğmeyi tıkladığınızda sayfanızın sağ üst kısmında bir "kayan önizleme penceresi" açılır. Önizleme yoksa düğme çizilmez.
Daha ileri düzey geliştiriciler, bu işlevin dahili olarak kullandığı Yerleşik Görüntüleyici API'si ile ilgilenebilir.
Parametreler:
string, Array identifier
: ISBN, OCLC veya LCCN numarası gibi bir önizleme URL'si veya kitap tanımlayıcısı. Dinamik Bağlantı istek biçimi konusuna bakın. Kitap için birkaç alternatif tanımlayıcı biliyorsanız bu tanımlayıcılardan bir dizi aktarabilirsiniz. Bu tanımlayıcılardan herhangi biri için önizleme varsa düğme görünür.
GBS_insertPreviewButtonLink(identifiers, opt_options)
Kitap önizlemesi kullanılabiliyorsa bu işlev bir "Google Önizleme" düğmesi yazar. Bu düğme, kitabın önizleme sayfasına bağlantı verir. Varsayılan olarak, bu seçenek Google Kitaplar'daki önizlemeye bağlantı verir, ancak şunları da yapabilirsiniz:
- sitenizdeki bir URL'ye bağlantı vermelidir (bununla birlikte, yerleşik bir görüntüleyici bulunmalıdır). Bunu, isteğe bağlı bir
alternativeUrl
seçeneği ileterek yapabilirsiniz.
- GBS_setCobrandName bu işlevden önce çağrılırsa, kitap önizleme sayfasının Ortak Markalı sürümüne bağlantı verir.
Kullanıcı için önizleme yoksa sayfaya herhangi bir düğme çizilmez.
Parametreler:
string, Array identifier
: ISBN, OCLC veya LCCN numarası gibi bir önizleme URL'si veya kitap tanımlayıcısı. Dinamik Bağlantı istek biçimi konusuna bakın. Kitap için birkaç alternatif tanımlayıcı biliyorsanız bu tanımlayıcılardan bir dizi aktarabilirsiniz. Bu tanımlayıcılardan herhangi biri için önizleme varsa düğme görünür.
Object opt_options
- isteğe bağlı - Düğmenin davranışını yapılandırmak için kullanılan bir ad-değer eşlemesi. Şu anda bir seçenek desteklenmektedir: alternativeUrl
. Örneğin, Google Önizleme düğmesi ile sitenizdeki özel bir önizleme sayfası arasında bağlantı oluşturmak için aşağıdaki kodu ikinci bağımsız değişken olarak GBS_insertPreviewButtonLink
öğesine iletmeniz yeterlidir:
{ 'alternativeUrl' : 'http://yoursite.com/your-preview-page' }
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2024-06-28 UTC.
[null,null,["Son güncelleme tarihi: 2024-06-28 UTC."],[],[],null,["# Preview Wizard\n\nThe Preview Wizard is designed to let you quickly, easily, and reliably integrate previews with your site. You can embed a book viewer, link to Book Search, or even add a preview \"popup\" window to your site---all you need to do is [generate the code](#generateCode) and paste it onto your page. You can also [customize this code](#customizeYourCode) using some simple JavaScript functions.\n\nThe Preview Wizard is a simple convenience library we built on top of our [Dynamic Links](/books/docs/dynamic-links) and [Embedded Viewer](/books/docs/viewer/developers_guide) APIs. If you're an advanced developer looking for customized integration, consider\nusing the underlying APIs directly.\n\nGenerate your preview code\n--------------------------\n\n#### Enter book identifiers\n\nTell us all the ISBNs or other identifiers you know of for this book. If we can find a preview associated with any of these numbers, we can make it available to your site's users:\n\n|--------------------------------------|---|\n| ISBN OCLC number LCCN Book Search ID | |\n| ISBN OCLC number LCCN Book Search ID | |\n| ISBN OCLC number LCCN Book Search ID | |\n\n[Enter more identifiers...](about:invalid#zGoSafez)\n\n#### Choose how to show the book preview\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| If a preview is available for this book, what should the user see on your page? |---|------------------------------------------------------------------------| | | An embedded book viewer. Viewer size: pixels wide, pixels high | | | A button that opens a floating book viewer. | | | A button that links to the book's preview page on Book Search. | | | A button that goes to a custom preview page on your site. Preview URL: | If no preview can be found for the specified book(s), the preview or button will be automatically disabled and nothing will appear. | |\n\n#### Select your language\n\nChinese (Simplified) Chinese (Traditional) Dutch English French German Italian Japanese Portuguese (Brazilian) Russian Spanish\n\n#### Generate code for your web page\n\nExamples of generated previews\n------------------------------\n\nThe following examples were generated using the Preview Wizard.\n\n- [previewwizard-embed](/books/examples/previewwizard-embed): Embeds a book viewer on the page.\n- [previewwizard-popup](/books/examples/previewwizard-popup): Adds a button that can be clicked to open a floating preview over the page.\n- [previewwizard-linktogbs](/books/examples/previewwizard-linktogbs): Inserts a button that links to the preview on the Book Search site.\n- [previewwizard-customurl](/books/examples/previewwizard-customurl): Shows a button that goes to a specific URL.\n\nCustomize your code\n-------------------\n\nIn addition to using the wizard above, you can call some simple JavaScript \"helper\" functions directly. To do this, you should first load the Preview Wizard library. One way to do this is by adding the following tag to the `\u003chead\u003e` section of your page: \n\n```\n\u003cscript type=\"text/javascript\" src=\"https://books.google.com/books/previewlib.js\"\u003e\u003c/script\u003e\n```\n\nHaving loaded the preview library, you can then call any of the following functions from within `\u003cscript\u003e` tags inside your document's `\u003cbody\u003e`. For example, if you'd like to insert the \"Google Preview\" button, you'd put the code to do so in a `<script\u003e` element at the button's desired position within the page.\n\n### GBS_setLanguage\n\n```\nGBS_setLanguage(languageCode)\n```\n\nChanges the language of any buttons or text added after this function is called. This includes the language of the \"Google Preview\" button, the interface language of the embedded preview, and so on.\n\n\u003c!-- --\u003e\n\n**Parameters:** *string*` languageCode ` - The desired RFC 3066 language code (default is 'en' for English). Currently supported language codes include hy, bg, ca, zh-CN, zh-TW, hr, cs, da, nl, en, fil, fi, fr, de, el, hi, hu, is, id, in, it, ja, ko, lv, lt, no, pl, pt-BR, pt-PT, ro, ru, sr, sk, sl, es, sv, th, tr, uk, and vi.\n\n### GBS_setViewerOptions\n\n```\nGBS_setViewerOptions(optionObj)\n```\n\n**Parameters:** *Object*` optionsObj ` - A set of key-value pairs passed to the Embedded Viewer API's [DefaultViewer constructor](/books/docs/viewer/reference#google.books.DefaultViewer). Typically, this is used for advanced customizations.\n\n### GBS_setCobrandName\n\n```\nGBS_setCobrandName(cobrandName)\n```\n\nIntended for use by publishers in the [Partner Program](https://books.google.com/partner), this function sets the [Co-Branded Search](https://books.google.com/support/partner/bin/answer.py?hl=en&answer=65113) site to be used when inserting any preview links to Book Search. Calling this function before inserting a button ensures that users see the partner's logo above the Book Search previews.\n\n\u003c!-- --\u003e\n\n**Parameters:** *string*` cobrandName ` - The cobrand name to be added to any Book Search URLs. This is typically what comes after `/p/` in existing Co-Branded Search preview URLs.\n- For example, setting the value to `sup` will send the user to links like \n `https://books.google.com/books/p/sup?id=Q8ysL64pM54C&printsec=frontcover` \n rather than the default \n `https://books.google.com/books?id=Q8ysL64pM54C&printsec=frontcover`\n\n### GBS_insertEmbeddedViewer\n\n```\nGBS_insertEmbeddedViewer(identifier, opt_width, opt_height)\n```\n\nInserts an embedded book preview wherever this function is called. If the preview is unavailable, no viewer is shown.\n\n\u003c!-- --\u003e\n\n**Parameters:** *string*` identifier ` - A preview URL or book identifier such as an ISBN, OCLC, or LCCN number. See [Dynamic Links request format](/books/docs/dynamic-links#requestFormat).\n\u003c!-- --\u003e\n\n*Number*` opt_width ` - The desired width of the viewer, in pixels.\n\u003c!-- --\u003e\n\n*Number*` opt_height ` - The desired height of the viewer, in pixels.\n\n### GBS_insertPreviewButtonPopup\n\n```\nGBS_insertPreviewButtonPopup(identifiers)\n```\n\nIf the book preview is available, this function writes out a \"Google Preview\" button. Clicking this button opens a \"floating preview window\" right on top of your page. If no preview is available, the button is not drawn.\n- More sophisticated developers may be interested in the [Embedded Viewer API](/books/docs/viewer/developers_guide), which this function uses internally.\n\n\u003c!-- --\u003e\n\n**Parameters:** *string, Array*` identifier ` - A preview URL or book identifier such as an ISBN, OCLC, or LCCN number. See [Dynamic Links request format](/books/docs/dynamic-links#requestFormat). If you know of several alternative identifiers for the book, you can pass an array of these identifiers, and the button will appear if a preview is available for any one of them.\n\n### GBS_insertPreviewButtonLink\n\n```\nGBS_insertPreviewButtonLink(identifiers, opt_options)\n```\n\nIf the book preview is available, this function writes out a \"Google Preview\" button that simply links off to a preview page for the book. By default, this links to the preview on Google Books, but you can also:\n- link to a URL on your site (which should, in turn contain an embedded viewer). You can do this by passing an optional `alternativeUrl` option.\n- link to a Co-Branded version of the book preview page, if [GBS_setCobrandName](#GBS_setCobrandName) is called before this function.\nIf no preview is available to the user, no button is drawn onto the page.\n\n\u003c!-- --\u003e\n\n**Parameters:** *string, Array*` identifier ` - A preview URL or book identifier such as an ISBN, OCLC, or LCCN number. See [Dynamic Links request format](/books/docs/dynamic-links#requestFormat). If you know of several alternative identifiers for the book, you can pass an array of these identifiers, and the button will appear if a preview is available for any one of them.\n\u003c!-- --\u003e\n\n*Object*` opt_options ` - *optional* - A name-value map used to configure the behavior of the button. Currently one option is supported: `alternativeUrl`. For example, to have the Google Preview button link to a custom preview page on your site, simply pass the following as a second argument to `GBS_insertPreviewButtonLink`: \n` { 'alternativeUrl' : 'http://yoursite.com/your-preview-page' } `"]]