All Downloads are FREE. Search and download functionalities are using the official Maven repository.

assets.js.installableViewer.min.js Maven / Gradle / Ivy

Go to download

GroupDocs.Viewer is an online document viewer that lets you read documents in your browser, regardless of whether you have the software that they were created in. You can view many types to word processing documents (DOC, DOCX, TXT, RTF, ODT), presentations (PPT, PPTX), spreadsheets (XLS, XLSX), portable files (PDF), and image files (JPG, BMP, GIF, TIFF). For each file, you get a high-fidelity rendering, showing the document just as it would if you opened it in the software it was created in. Layout and formatting is retained and you see an exact copy of the original. GroupDocs.Viewer lets you really read the document. You can search text documents, copy text and even embed the document РІР‚ GroupDocs.Viewer and all - in a web page. You can print or download the file from GroupDocs.Viewer if you need to work with it offline.

There is a newer version: 17.5.0
Show newest version
(function (a) { a.widget("ui.groupdocsViewer", { _viewModel: null, options: {enableViewerInit: true, supportTextSelection: true, resourcePrefix: ""}, _create: function () { a.extend(this.options, { element: this.element, applicationPath: a.ui.groupdocsViewer.prototype.applicationPath, widgetInstance: this }); this._viewModel = this.getViewModel() }, getViewModel: function () { if (this._viewModel == null)this._viewModel = this._createViewModel(); return this._viewModel }, _createViewModel: function () { return new window.groupdocs.groupdocsViewerViewModel(this.options) }, on: function (a, b) { this.element.on(a, b) }, off: function (a, b) { this.element.off(a, b) }, setWidth: function (a) { this._viewModel.setWidth(a) }, setHeight: function (a) { this._viewModel.setHeight(a) }, openNextPage: function () { this._viewModel.openNextPage() }, openPreviousPage: function () { this._viewModel.openPreviousPage() }, setPage: function (a) { this._viewModel.setPage(a) }, openFirstPage: function () { this._viewModel.openFirstPage() }, openLastPage: function () { this._viewModel.openLastPage() }, showFileBrowser: function () { this._viewModel.showFileBrowser() }, setViewerMode: function (a) { this._viewModel.setViewerMode(a) }, zoomIn: function () { this._viewModel.zoomIn() }, zoomOut: function () { this._viewModel.zoomOut() }, setZoom: function (a) { this._viewModel.setZoom(a) }, downloadDocument: function () { this._viewModel.downloadDocument() }, printDocument: function () { this._viewModel.printDocument() }, searchForward: function (d, c, b, a) { this._viewModel.searchForward(d, c, b, a) }, searchBackward: function (d, c, b, a) { this._viewModel.searchBackward(d, c, b, a) }, clearSearchValue: function () { this._viewModel.clearSearchValue() }, getDocumentPageCount: function () { return this._viewModel.getDocumentPageCount() }, loadDocument: function (a) { this._viewModel.loadDocument(a) }, rotateCurrentPage: function (a) { this._viewModel._rotatePage(a) }, setLoadingState: function (a) { this._viewModel.setLoadingState(a) }, getContentControlDescriptions: function () { return this._viewModel.getContentControlDescriptions() }, navigateToContentControl: function (a) { this._viewModel.navigateToContentControl(a) }, destroy: function () { this._viewModel.destroy() } }); if (!window.groupdocs)window.groupdocs = {}; window.groupdocs.groupdocsViewerViewModel = function (b) { a.extend(this, b); this._create(b) }; a.extend(window.groupdocs.groupdocsViewerViewModel.prototype, { groupdocsViewerWrapper: null, browserIsInternetExplorer: false, resizeTimeoutId: null, viewModes: {ScrollMode: 1, BookMode: 2}, viewMode: null, licElement: null, printImageElements: null, _create: function (a) { this._model = new b(a); this._init(a) }, _init: function (F) { var c, d = this.element; this.viewerId = window.groupdocs.viewerId; var b = a.extend({hostUrl: this.applicationPath, docViewerId: "docViewer" + this.viewerId}, F); this.printImageElements = []; window.groupdocs.viewerId++; var I = false; if (F.enableViewerInit) { var f, A = false; if (a.browser.msie) { this.browserIsInternetExplorer = true; if (a.browser.version == 8 || a.browser.version == 9) { I = true; if (a.browser.version == 8)A = true } f = ".grpdx input[type='text']::-ms-clear {display: none;}"; a("").appendTo("head") } var k = "grpdx" + b.docViewerId, e = this, t = ""; if (e.browserIsInternetExplorer && b.useHtmlBasedEngine) { t = " ie"; if (A)t += " ie8" } var R = ""; if (!b.showHeader)R = 'style="display: none"'; d.each(function () { a('
' + (b.supportPageRotation ? '
' : "") + '
' + (b.showThumbnails ? ' ' : "") + '
').appendTo(a(this)) }) } this.groupdocsViewerWrapper = c = d.find(".groupdocs_viewer_wrapper"); var B = this.viewerHeader = c.find(".viewer_header"), m = this.viewerMainWrapper = c.find(".viewer_mainwrapper"); if (!b.showHeader) { B.height(0); m.css("top", "0") } if (!F.enableViewerInit)return; if (b.filePath == "")b.openThumbnails = false; var K = "#" + b.docViewerId, i = a(K), P = c.find("[name='search_wrapper']"); if (b.useHtmlBasedEngine) { B.find("li[name='openDoublePageFlipViewMenuItem']").hide(); if (!b.supportTextSelection) { f = "." + k + " .html_pages_container{-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}"; a("").appendTo("head"); if (this.browserIsInternetExplorer)i.on("selectstart", function (a) { a.preventDefault(); return true }) } b.supportPageReordering = false } var s, C; if (b.width)s = b.width; else s = d.width(); c.width(s); if (b.height)C = b.height; else C = d.height(); c.height(C); var p = null; if (!b.useHtmlBasedEngine) { p = c.find("[name='selection-content']"); if (p.length == 0)p = a("'").appendTo(c) } var T = c.find("[name='jGDerror']"); T.find(".modal_dialog_overlay").click(function () { T.hide() }); var x = c.find(".navigation-bar"), z = c.find(".zoom_wrappper"), G = c.find(".doc_viewer_wrapper_page_flip"), v = this.fileOpenDialogWrapper = c.find(".fileOpenDialogWrapper"); if (!b.supportTextSelection) { var W = K + " .ui-selectable-helper {display: none;visibility: hidden}"; a("").appendTo("head") } var w; if (b.thumbnailsContainerWidth) { var Z = 203, V = 150, U = 187, M = this.getScrollbarWidth(), u = Math.round(b.thumbnailsContainerWidth), S = (Z - M) / (u - M); w = Math.round(V / S); var X = Math.round(U / S); f = "div.thumbnailsContainer{width:" + u + "px}"; f += "div.thumbnailsContainer ul li img{width:" + w + "px}"; f += "div.thumbnailsContainer ul li{min-width:" + X + "px}"; f += ".thumbs_btn_slide{left:" + (u + 2) + "px}"; a("").appendTo("head") } f = ""; if (b.searchHighlightColor)f += "." + k + " .search_highlight_html, ." + k + " .search-highlight {background-color:" + b.searchHighlightColor + "; fill:" + b.searchHighlightColor + "}"; if (b.currentSearchHighlightColor)f += ".grpdx." + k + " .current_search_highlight {background-color:" + b.currentSearchHighlightColor + "; fill:" + b.currentSearchHighlightColor + "}"; if (b.useEmScaling)f += ".grpdx." + k + " .html_page_contents {transform-origin:initial}"; f && a("").appendTo("head"); function j() { e._localizeElements() } i.bind("onHtmlCreated", j); x.bind("onHtmlCreated", j); z.bind("onHtmlCreated", j); G.bind("onHtmlCreated", j); v.bind("onHtmlCreated", j); var hb = { createHtml: true, viewerElement: i, useCaseSensitiveSearch: b.useCaseSensitiveSearch, searchForSeparateWords: b.searchForSeparateWords, treatPhrasesInDoubleQuotesAsExactPhrases: b.treatPhrasesInDoubleQuotesAsExactPhrases, useHtmlBasedEngine: b.useHtmlBasedEngine, searchIsVisible: b.showSearch, useRtl: b.useRtl, useAccentInsensitiveSearch: b.useAccentInsensitiveSearch, useVirtualScrolling: b.useVirtualScrolling }, db = { createHtml: true, thumbnailWidth: w, quality: 100, useHtmlBasedEngine: b.useHtmlBasedEngine, useHtmlThumbnails: b.useHtmlThumbnails, useInnerThumbnails: b.useInnerThumbnails, supportPageReordering: b.supportPageReordering, use_pdf: b.supportTextSelection ? "true" : "false", ignoreDocumentAbsence: b.ignoreDocumentAbsence, supportPageRotation: b.supportPageRotation, openThumbnails: b.openThumbnails, instanceIdToken: b.instanceIdToken, locale: b.locale }, E; if (b.showThumbnails)E = m; else E = null; var ib = { watermarkText: b.watermarkText, watermarkColor: b.watermarkColor, watermarkPosition: b.watermarkPosition, watermarkWidth: b.watermarkWidth, preventTouchEventsBubbling: b.preventTouchEventsBubbling, searchForSeparateWords: b.searchForSeparateWords, treatPhrasesInDoubleQuotesAsExact: b.treatPhrasesInDoubleQuotesAsExact, usePngImagesForHtmlBasedEngine: b.usePngImagesForHtmlBasedEngine, alwaysOnePageInRow: b.showOnePageInRow || b.viewerStyle == window.groupdocs.OnePageInRow, onlyShrinkLargePages: b.onlyShrinkLargePages, loadAllPagesOnSearch: b.loadAllPagesOnSearch, useEmScaling: b.useEmScaling, convertWordDocumentsCompletely: b.convertWordDocumentsCompletely, ignoreDocumentAbsence: b.ignoreDocumentAbsence, usePdf: b.supportTextSelection, preloadPagesOnBrowserSide: b.preloadPagesOnBrowserSide, supportPageRotation: b.supportPageRotation, useAccentInsensitiveSearch: b.useAccentInsensitiveSearch, useRtl: b.useRtl, viewerLayout: b.viewerStyle, useVirtualScrolling: b.useVirtualScrolling, supportListOfContentControls: b.supportListOfContentControls, supportListOfBookmarks: b.supportListOfBookmarks, embedImagesIntoHtmlForWordFiles: b.embedImagesIntoHtmlForWordFiles, instanceIdToken: b.instanceIdToken, browserIsIE9OrLess: I, locale: b.locale }, eb = "onMenuClicked", D = c.find(".viewTypeMenu"), n = { dropDownMenuIsVisible: ko.observable(false), dropDownMenuClicked: false, openScrollView: function () { e.setMultiplePagesInRowLayout() }, openDoublePageFlipView: function () { e.openDoublePageFlipView() }, openOnePageInRowView: function () { e.openOnePageInRowView() }, openTwoPagesInRowView: function () { e.openTwoPagesInRowView() }, openCoverThenTwoPagesInRowView: function () { e.openCoverThenTwoPagesInRowView() }, showDropDownMenu: function (a) { this.dropDownMenuIsVisible(a) }, toggleDropDownMenu: function (b, a) { this.dropDownMenuIsVisible(!this.dropDownMenuIsVisible()); this.dropDownMenuClicked = true; D.trigger(eb); a.stopPropagation() } }, Q = this.viewerAdapter = new DocViewerAdapter({ fileId: b.filePath, fileVersion: "0", quality: b.quality, use_pdf: b.supportTextSelection ? "true" : "false", docSpace: i, _mode: "webComponent", createHtml: true, initialZoom: b.initialZoom, viewerWidth: s, viewerHeight: m.height(), docViewerId: b.docViewerId, zoomToFitWidth: b.zoomToFitWidth, zoomToFitHeight: b.zoomToFitHeight, navigation: x, navigationOptions: {createHtml: true}, thumbnails: E, thumbnailsOptions: db, zooming: z, zoomingOptions: {createHtml: true}, search: P, searchOptions: hb, preloadPagesCount: b.preloadPagesCount, docSpacePageFlip: b.useHtmlBasedEngine || b.viewerStyle == this.viewModes.ScrollMode && !b.showViewerStyleControl ? null : G, usePageNumberInUrlHash: false, selectionContent: p, imageHorizontalMargin: 14, imageVerticalMargin: 14, useJavaScriptDocumentDescription: true, searchPartialWords: true, variableHeightPageSupport: true, textSelectionSynchronousCalculation: false, minimumImageWidth: b.minimumImageWidth, fileDisplayName: b.fileDisplayName, pageContentType: b.useHtmlBasedEngine ? "html" : "image", searchExactText: b.searchExactText, viewerOptions: ib, viewTypeMenu: D, viewTypeViewModel: n, instanceId: this.viewerId }); if (b.showFolderBrowser) { var Y = { hostUrl: b.hostUrl, userId: b.userId, userKey: b.userKey, fileExplorer: c.find(".file_browser_content"), fileUploader: c.find(".file_browser_toolbar"), resourcePrefix: b.resourcePrefix, urlHashEnabled: false, instanceIdToken: b.instanceIdToken }; v.fileOpenDialog(Y); v.find(".popclose").click(function () { e._hideFileOpenDialog() }) } j(); var r = d.find(".thumbs_btn"); b.useInnerThumbnails && r.hide(); function N() { b.showThumbnails && b.thumbsImageBase64Encoded != null && r.css("background-image", "url(data:image/png;base64," + b.thumbsImageBase64Encoded + ")").css("background-position", "0 0") } N(); r.click(function () { a(this).toggleClass("thumbs_btn_slide"); d.find(".thumbnailsContainer").toggle(); if (a.browser.msie) { r.css("background-image", ""); N() } return false }); c.find(".btnOpen").click(function () { e._showFileOpenDialog() }); c.find("[name=rotateClockwise]").click(function () { e._rotatePage(90) }); c.find("[name=rotateCounterClockwise]").click(function () { e._rotatePage(-90) }); c.find(".file_browser_content").bind("fileSelected", function (b, a) { e._hideFileOpenDialog(); e.fileDisplayName = Q.docViewerViewModel.fileDisplayName = ""; Q.docViewerViewModel.loadDocument(a.guid) }); if (b.showThumbnails && b.openThumbnails) { d.find(".thumbs_btn").addClass("thumbs_btn_slide"); d.find(".thumbnailsContainer").css("display", "block") } ko.applyBindings(n, D.get(0)); a("html").click(function () { e.viewerAdapter.zoomViewModel && e.viewerAdapter.zoomViewModel.showDropDownMenu(false); n.showDropDownMenu(false) }); if (b.backgroundColor) { d.find(".groupdocs_viewer_wrapper").css("background-color", b.backgroundColor); B.css("background-color", b.backgroundColor); d.find(".new_head_input").css("background-color", b.backgroundColor); d.find(".new_head_tools_wrapper").css("background-color", b.backgroundColor).css("box-shadow", "none"); d.find(".thumbs_btn").css("background-color", b.backgroundColor) } d.find(".btnOpen").css("display", b.showFolderBrowser ? "" : "none"); d.find(".navigation-bar").css("display", b.showPaging ? "" : "none"); z.css("display", b.showZoom ? "" : "none"); d.find(".btn_download").css("display", b.showDownload ? "" : "none"); d.find(".print_button").css("display", b.showPrint ? "" : "none"); d.find(".viewTypeMenu").css("display", b.showViewerStyleControl ? "" : "none"); b.showPrint === false && b.showDownload === false && d.find("[name='printAndDownloadToolbar']").css("display", "none"); b.showSearch === false && P.css("display", "none"); function O(e, d, f) { for (var c = ["-moz-", "-webkit-", ""], a = e + "{", b = 0; b < c.length; b++)a += c[b] + d + ":" + f + ";"; a += "}"; return a } var g = ""; if (b.toolbarButtonsBoxShadowStyle) { var J = "box-shadow", y = O(".grpdx .new_head_tools_btn", J, b.toolbarButtonsBoxShadowStyle); g += y; if (b.toolbarButtonsBoxShadowHoverStyle) { y = O(".grpdx .new_head_tools_btn:hover", J, b.toolbarButtonsBoxShadowHoverStyle); g += y } } if (b.thumbnailsContainerBackgroundColor)g += ".grpdx div.thumbnailsContainer{background-color:" + b.thumbnailBackgroundColor + "}\r\n"; if (b.toolbarBorderBottomColor)g += ".grpdx .viewer_header{border-bottom-color:" + b.toolbarBorderBottomColor + "}\r\n"; if (b.thumbnailsContainerBorderRightColor)g += ".grpdx div.thumbnailsContainer{border-right-color:" + b.thumbnailsContainerBorderRightColor + "}\r\n"; if (b.toolbarInputFieldBorderColor)g += ".grpdx .new_head_input{border-color:" + b.toolbarInputFieldBorderColor + "}\r\n"; if (b.toolbarButtonBorderColor)g += ".grpdx .new_head_tools_btn{border-color:" + b.toolbarButtonBorderColor + "}\r\n"; if (b.useInnerThumbnails)g += ".grpdx #" + b.docViewerId + "{display: inline-block}\r\n"; a("").appendTo("head"); i.bind("onDocumentLoadComplete", function (b, a) { e.documentLoadCompleteHandler(a, c, m) }); i.bind("onDocumentLoaded", function (b, a) { e.documentLoadedHandler(a, c, m) }); i.bind("isDocumentSinglePaged.groupdocs", function (b, a) { e.documentSinglePagedHandler(a, x) }); if (b.viewerStyle == this.viewModes.BookMode)n.openDoublePageFlipView(); else this.viewMode = this.viewModes.ScrollMode; var l = c.find("[name='jGDerror']"), H = l.find(".modal_dialog_content"), h = l.find(".modal_dialog_content_wrapper"), ab = l.find(".modal_dialog_header"); l.removeClass("jerrorwrapper"); var L = c.find(".viewer_mainwrapper"), jb = false; if (!window.jGDError)window.jGDError = []; window.jGDError[this.viewerId] = function (f) { a(d).trigger("error.groupdocs", f); if (b.enableStandardErrorHandling) { var m = c.find(".btn_download"); m.unbind(); m.bind({ click: function () { e._downloadDocument(); return false } }); f = f.replace(/^[\r\n\s]+|[\r\n\s]+$/g, ""); if (!f)f = "Sorry, we're unable to perform your request right now. Please try again later."; l.css("height", "auto"); ab.text("Error"); var g, i; if (f.substring(0, 1) == "<") { H.html(f); var k = L.width(), j = L.height(); if (k < 100)g = k; else g = k - 100; if (j < 100)i = j; else i = j - 100 } else H.text(f); if (g != undefined) { h.css("margin-left", -g / 2); h.width(g) } i != undefined && h.height(i); l.show(); h.css("margin-left", -h.width() / 2); h.css("margin-top", -h.height() / 2) } }; var q = this.groupdocsViewerWrapper.find("[name='messageDialog']"), gb = q.find("[name='minimizeButton']"), fb = q.find("[name='maximizeButton']"); gb.click(function () { q.addClass("min") }); fb.click(function () { q.removeClass("min") }); var o = this.groupdocsViewerWrapper.find("[name='messageDialogPdf']"), cb = o.find("[name='minimizeButtonPdf']"), bb = o.find("[name='maximizeButtonPdf']"); cb.click(function () { o.addClass("min") }); bb.click(function () { o.removeClass("min") }); this.resizeHandler() }, documentLoadedHandler: function (e, f, g) { this.printFrameLoaded = false; var h = a("body"), c = "printFrame" + this.viewerId, b = h.children("div.groupdocsPrintFrame[name='" + c + "'],div.groupdocsPrintFrameDeactivated[name='" + c + "']"); if (b.length == 0) { b = a("
"); b.attr("name", c); b.appendTo(h) } else b.empty(); this.printImageElements.length = 0; var d = e.page_count; if (!e.lic && d > 3)d = 3; for (var i, j = 0; j < d; j++) { i = a("").appendTo(b); this.printImageElements.push(i) } if (!e.lic && f.find(".licBanner").length == 0) { g.addClass("viewer_mainwrapper_trial"); this.licElement = a("
"); this.licElement.addClass("banner_trial"); !this.showHeader && this.licElement.css("top", "0"); var k = this._getLocalizedString("This viewer has been created using an unlicensed version of ", "UnlicensedViewer"); this.licElement.html(k + " GroupDocs.Viewer for Java v2.13.0 "); this.licElement.appendTo(f); !this.showHeader && g.css("top", this.licElement.height() + "px"); this.resizeHandler() } }, documentLoadCompleteHandler: function (a, b) { var e = this; this.showImageWidth && alert("Image width: " + a.page_size.Width); this.downloadUrl = a.url; this.pdfDownloadUrl = a.pdfDownloadUrl; this.pdfPrintUrl = a.pdfPrintUrl; this.documentPath = a.guid; var c = b.find(".btn_download"), d = b.find(".print_button"); c.unbind(); d.unbind(); c.bind({ click: function () { e._downloadDocument(); return false } }); d.bind({ click: function () { e._printDocument(); return false } }) }, documentSinglePagedHandler: function (b, a) { if (this.showPaging)if (b)a.hide(); else a.show() }, _localizeElements: function () { var b = this; this.localizedStrings != null && b.element.find("[data-localize],[data-localize-ph],[data-localize-tooltip]").each(function () { var e = a(this), c = e.attr("data-localize"), d; if (c) { d = b.localizedStrings[c]; e.text(d) } else { c = e.attr("data-localize-ph"); if (c) { d = b.localizedStrings[c]; e.attr("placeholder", d) } else { c = e.attr("data-localize-tooltip"); if (c) { d = b.localizedStrings[c]; e.attr("data-tooltip", d) } } } }) }, getScrollbarWidth: function () { var c = null, d = a("
").css("width", "100px").css("height", "100px").css("overflow", "scroll").css("position", "absolute").css("top", "-9999px"), b = d[0]; document.body.appendChild(b); c = b.offsetWidth - b.clientWidth; document.body.removeChild(b); return c }, resizeHandler: function () { if (this.showHeader) { var d = this.viewerHeader.outerHeight(true), b = 0; if (this.licElement)b = this.licElement.height(); if (d != this.viewerMainWrapper.position().top - b) { var c = d; if (this.licElement) { this.licElement.css("top", c.toString() + "px"); c += b } this.viewerMainWrapper.css("top", c.toString() + "px"); if (this.viewMode == this.viewModes.BookMode)this.viewerAdapter.docViewerPageFlipViewModel.reInitSelectable(); else this.viewerAdapter.docViewerViewModel.reInitSelectable() } } if (this.useInnerThumbnails) { var a = 0, e = this.viewerAdapter.thumbnailsViewModel; if (e)a = e.getThumbnailsPanelWidth(); if (this.viewMode == this.viewModes.BookMode)this.viewerAdapter.docViewerPageFlipViewModel.resizeViewerElement(a); else this.viewerAdapter.docViewerViewModel.resizeViewerElement(a) } else this.viewerAdapter.docViewerViewModel.loadImagesForVisiblePages(); this._setFitWidthAndHeightValues() }, resizeHandlerWithDelay: function () { this.resizeTimeoutId && clearTimeout(this.resizeTimeoutId); var a = this; this.resizeTimeoutId = window.setTimeout(function () { a.resizeHandler() }, 1e3) }, setWidth: function (a) { this.groupdocsViewerWrapper.width(a); this.resizeHandler(); this.resizeHandlerWithDelay() }, setHeight: function (a) { this.groupdocsViewerWrapper.height(a); this.resizeHandler(); this.resizeHandlerWithDelay() }, _showFileOpenDialog: function () { var b = this; this.fileOpenDialogWrapper.addClass("in"); this.fileOpenDialogWrapper.show(); this.backdrop = a('




© 2015 - 2025 Weber Informatics LLC | Privacy Policy