{"version":3,"file":"viewer.min.js","sources":["viewer.js"],"sourcesContent":["var lsViewer = (function () {\n 'use strict';\n\n // CONFIGURATIONS APPLICATION\n\n var _config = {\n\n prefix: lsConfiguration.prefix, \n locale: lsConfiguration.locale, \n dateFormat: lsConfiguration.dateFormat, \n currencyCentSeparator: lsConfiguration.currencyCentSeparator, \n\n };\n\n // URLS\n\n var _url = {\n\n viewerUrls: {\n\n urlGetPageThumb: _config.prefix + '/Viewer/GetPageThumb',\n urlGetPageFile: _config.prefix + '/Viewer/GetPageFile',\n urlGetViewSummary: _config.prefix + '/Viewer/GetViewSummary',\n\n },\n\n language: {\n\n urlLanguage: _config.prefix + '/js/lang.',\n\n },\n\n };\n\n // NOTIFY\n\n var _notify = {\n\n success: function (title, message, fixed) {\n $.notify(\n {\n title: (title === undefined || title === null || title.length <= 0) ? '' : title,\n message: (message === undefined || message === null || message.length <= 0) ? '' : message\n }, {\n type: 'liquid-success',\n delay: (fixed === undefined || fixed === null || fixed === false) ? 5000 : 0\n });\n },\n\n alert: function (title, message, fixed) {\n $.notify(\n {\n title: (title === undefined || title === null || title.length <= 0) ? '' : title,\n message: (message === undefined || message === null || message.length <= 0) ? '' : message\n }, {\n type: 'liquid-alert',\n delay: (fixed === undefined || fixed === null || fixed === false) ? 5000 : 0\n });\n },\n\n danger: function (title, message, fixed) {\n $.notify(\n {\n title: (title === undefined || title === null || title.length <= 0) ? '' : title,\n message: (message === undefined || message === null || message.length <= 0) ? '' : message\n }, {\n type: 'liquid-danger',\n delay: (fixed === undefined || fixed === null || fixed === false) ? 5000 : 0\n });\n },\n\n closeAll: function () {\n $.notifyClose();\n }\n };\n\n // MODAL\n\n var _modal = {\n\n bootbox: {\n\n dialog: function (data) {\n bootbox.dialog({\n title: '' + data.title + '',\n message: data.htmlContent,\n buttons: data.buttons,\n className: data.className,\n classdialog: data.classdialog,\n height: data.height,\n overflow: data.overflow,\n onEscape: data.onEscape\n });\n },\n\n confirm: function (data) {\n\n bootbox.confirm({\n title: '' + data.title + '',\n message: data.message,\n buttons: data.buttons,\n callback: data.callback,\n className: data.className\n });\n\n },\n\n alert: function (title, message, className) {\n bootbox.alert({\n title: '' + title + '',\n message: message,\n className: className\n });\n },\n\n close: function (classbox) {\n if (classbox !== undefined) {\n $(classbox).modal('hide');\n }\n else {\n $('.bootbox.modal').modal('hide');\n }\n },\n\n showErrorOnModal: function (message) {\n $('.modal-error').html('Error: ' + message);\n $('.modal-error').show();\n },\n\n error: function (message) {\n var data = {\n title: \"Erro\",\n htmlContent: '
' + message + '
',\n buttons: {\n fechar: {\n label: \"FECHAR\",\n className: \"btn btn-default\",\n callback: function () { }\n }\n },\n className: \"small error\",\n onEscape: function () { }\n };\n bootbox.dialog(data);\n },\n }\n };\n\n // SERVICES API\n\n var _servicesAPI = {\n\n viewer: {\n\n getGetViewSummary: function (token) {\n\n var data = {\n token: token\n };\n return $.getJSON(_url.viewerUrls.urlGetViewSummary, data).then(function (data) {\n return data;\n });\n },\n\n },\n\n lang: {\n\n getLanguage: function (locale, callback, errorCallback) {\n\n return $.ajax({\n url: _url.language.urlLanguage + locale + '.min.js',\n dataType: 'script',\n success: callback,\n error: errorCallback\n });\n }\n\n },\n \n };\n\n // LANG\n\n var _lang = {\n\n load: function () {\n\n return _servicesAPI.lang.getLanguage(_config.locale, function () {\n\n _lang.langObject = lang;\n\n }, function (dataFail) {\n\n _common.ajaxCommonHandler.fail(dataFail);\n\n });\n\n },\n\n langObject: {},\n\n }\n\n // COMMON\n\n var _common = {\n\n headerAndContextBarHeight: 110,\n\n headerAndContextBarHeightAndTableHeaderToolbar: 243,\n\n headerAndContextBarHeightAndTableHeaderInfo: 234,\n\n headerAndContextBarHeightAndTableHeaderInfoAndButtons: 263,\n\n headerAndContextBarHeightAndViewerPageTools: 160, // 165,\n\n headerAndContextBarHeightAndViewerPageToolsEmbed: 186, // 165,\n\n headerAndContextBarHeightAndDetailTabHeaderForm: 292,\n\n headerAndContextBarHeightAndIndexerPageTools: 167, // 165,\n\n loading: {\n\n idDOM: 'loader',\n\n element: function () {\n\n return jQuery('
');\n }\n\n },\n\n openLoadingModal: function () {\n var $loadDiv = $('
');\n $('.modal-content').append($loadDiv);\n },\n\n closeLoadingModal: function () {\n $('.fullpageload.modal').remove();\n },\n\n openLoadingFullPage: function () {\n var $loadDiv = jQuery('
');\n jQuery('body').append($loadDiv);\n },\n\n closeLoadingFullPage: function () {\n jQuery('body').find('.fullpageload').remove();\n },\n\n permission: {\n\n object: {\n\n wardrobe: {\n\n WardrobeCreate: 1,\n WardrobeRename: 2,\n WardrobeDelete: 4,\n WardrobeManageRoles: 8,\n WardrobeReadProperties: 16,\n FolderCreate: 32\n\n },\n\n folder: {\n\n FolderCreate: 1,\n FolderRename: 2,\n FolderDelete: 4,\n FolderManageRoles: 8,\n FolderSearch: 16,\n FolderExport: 32,\n FolderSign: 64,\n FolderSubsForm: 128,\n FolderProcessOCR: 256,\n FolderReadProperties: 512,\n DocumentCreate: 1024,\n FolderCopyTo: 2048,\n FolderMoveTo: 4096\n\n },\n\n document: {\n\n DocumentRename: 1,\n DocumentDelete: 2,\n DocumentExport: 4,\n DocumentManageRoles: 8,\n DocumentReadProperties: 16,\n DocumentCopyTo: 32,\n DocumentImportTo: 64,\n DocumentPrint: 128,\n DocumentSign: 256,\n DocumentMarcaDagua: 512,\n DocumentProcessOCR: 1024,\n DocumentViewForm: 2048,\n DocumentEditForm: 4096,\n DocumentSubsForm: 8192,\n DocumentMoveTo: 16384,\n PageCreate: 32768,\n PageEdit: 65536,\n PageDelete: 131072,\n PageExport: 262144,\n PageViewAnnotation: 524288,\n PageCreateAnnotation: 1048576,\n PageDeleteAnnotation: 2097152,\n PageInsertMark: 4194304,\n PageViewWithouttMark: 8388608,\n PageProcessOCR: 16777216,\n PageViewOCR: 33554432,\n PageEditOCR: 67108864,\n DocumentReplace: 134217728,\n DocumentEditTemporality: 268435456,\n PageClassify: 536870912,\n DocumentShare: 1073741824\n\n }\n\n },\n\n system: {\n\n Access: 1,\n Search: 2,\n CreateWardrobe: 4,\n ReportInfoSystem: 8,\n ReportActivity: 16,\n ReportError: 32,\n ConfigForm: 64,\n ConfigImportPerfil: 128,\n ConfigVolume: 256,\n ConfigGroup: 512,\n ConfigUser: 1024,\n ConfigRoleSystem: 2048,\n ConfigRoleObjects: 4096,\n ConfigWaterMark: 8192,\n ConfigTemporalidade: 16384,\n ConfigSessions: 32768,\n Index: 65536,\n ConfigAuthApplication: 131072,\n ConfigLiquidSuite: 262144,\n ConfigIntegrations: 524288,\n EditUserProfile: 1048576,\n ExportSearch: 2097152\n\n },\n\n },\n\n ajaxCommonHandler: {\n\n fail: function (failData) {\n\n var errorDetailsTemplate = {\n ErrorCode: 0,\n Message: \"\"\n }\n\n var result = true;\n if (failData.responseJSON === null || failData.responseJSON === undefined) {\n result = false;\n }\n else {\n for (var prop in errorDetailsTemplate) {\n if (!failData.responseJSON.hasOwnProperty(prop)) {\n result = false;\n }\n }\n }\n\n if (result === true) {\n\n if (failData.responseJSON.ErrorCode === 401) {\n window.location.reload(true);\n }\n else if (failData.responseJSON.ErrorCode === 614) {\n _notify.danger(_lang.langObject.ocurrProblem, _lang.langObject.documentCreateImportPerfilFieldNullException, false);\n }\n else {\n _notify.danger(_lang.langObject.attention, failData.responseJSON.Message, false);\n }\n }\n else {\n if (failData.status === 401) {\n window.location.reload(true);\n }\n else if (failData.status === 563) {\n _notify.alert(_lang.langObject.attention, failData.responseText, false);\n }\n else if (failData.status === 564) {\n _notify.alert(_lang.langObject.attention, failData.responseText, false);\n }\n else if (failData.status === 566) {\n _notify.alert(_lang.langObject.attention, failData.responseText, false);\n }\n else if (failData.status === 548) {\n _notify.alert(_lang.langObject.attention, failData.responseText, false);\n }\n else if (failData.status === 614) {\n _notify.danger(_lang.langObject.ocurrProblem, _lang.langObject.documentCreateImportPerfilFieldNullException, false);\n }\n else {\n if (failData.responseType === 'arraybuffer') {\n _notify.danger(_lang.langObject.ocurrProblem, failData.statusText, false);\n }\n else if (failData.responseText !== undefined) {\n _notify.danger(_lang.langObject.ocurrProblem, failData.responseText, false);\n }\n else if (failData.statusText !== undefined) {\n _notify.danger(_lang.langObject.ocurrProblem, failData.statusText, false);\n }\n else {\n _notify.danger(_lang.langObject.ocurrProblem, failData, false);\n }\n }\n }\n\n },\n\n failErrorDetails: function (errorDetails) {\n\n if (errorDetails.ErrorCode === 401) {\n window.location.reload(true);\n }\n else if (errorDetails.ErrorCode === 500) {\n _notify.danger(_lang.langObject.attention, errorDetails.Message, false);\n }\n else if (errorDetails.ErrorCode === 563) {\n _notify.alert(_lang.langObject.attention, errorDetails.Message, false);\n }\n else if (errorDetails.ErrorCode === 564) {\n _notify.alert(_lang.langObject.attention, errorDetails.Message, false);\n }\n else if (errorDetails.ErrorCode === 566) {\n _notify.alert(_lang.langObject.attention, errorDetails.Message, false);\n }\n else if (errorDetails.ErrorCode === 548) {\n _notify.alert(_lang.langObject.attention, errorDetails.Message, false);\n }\n else if (errorDetails.ErrorCode === 614) {\n _notify.danger(_lang.langObject.ocurrProblem, _lang.langObject.documentCreateImportPerfilFieldNullException, false);\n }\n else {\n _notify.danger(_lang.langObject.ocurrProblem, errorDetails, false);\n }\n }\n\n },\n\n gridElements: {\n\n button: function (classname, label, fn) {\n var $button = $('');\n $button.addClass(classname);\n $button.html(label.toUpperCase());\n if (fn !== undefined) {\n $button.on('click', fn);\n }\n return $button;\n },\n\n tableHeadItem: function (classname, label, fn) {\n var $div = $('
', { \"class\": classname });\n $div.html(label);\n if (fn !== undefined) {\n $div.on('click', fn);\n }\n return $div;\n },\n\n tableFooterLabel: function (page, total) {\n\n var $divpagelabel = $('
');\n $divpagelabel.html(_lang.langObject.page + \" \" + page + \" \" + _lang.langObject.of + \" \" + total);\n return $divpagelabel;\n\n },\n\n gridStatusHeader: function (gridData) {\n\n if (gridData.page === 1 && gridData.total === 0) {\n\n return $('
' + _lang.langObject.noRecordsFind + '
');\n\n }\n else {\n\n var $gridNavResults = $('
');\n $gridNavResults.append(gridData.records + ' ' + _lang.langObject.recordsFind);\n return $gridNavResults;\n\n }\n\n },\n\n },\n\n caller: {\n\n files: 1,\n viewer: 2,\n search: 3,\n report: 4,\n setting: 5\n\n },\n\n formatCPF: function (value) {\n return value.replace(/(\\d{3})(\\d{3})(\\d{3})(\\d{2})/g, \"\\$1.\\$2.\\$3\\-\\$4\");\n },\n\n formatCNPJ: function (value) {\n return value.replace(/(\\d{2})(\\d{3})(\\d{3})(\\d{4})(\\d{2})/g, \"\\$1.\\$2.\\$3\\/\\$4\\-\\$5\");\n },\n\n formatDateTime: function (value) {\n\n var dateObj = new Date(value);\n\n var day = (\"0\" + dateObj.getDate()).slice(-2);\n var mouth = (\"0\" + (dateObj.getMonth() + 1)).slice(-2);\n var year = dateObj.getFullYear();\n\n var hour = (\"0\" + dateObj.getHours()).slice(-2);\n var minute = (\"0\" + dateObj.getMinutes()).slice(-2);\n var seconds = (\"0\" + dateObj.getSeconds()).slice(-2);\n\n return day + \"/\" + mouth + \"/\" + year + \" \" + hour + \":\" + minute + \":\" + seconds;\n }\n };\n\n // APPLICATION CONTAINERS\n\n var _headerBar = {\n\n idDOM: '#top-menu-user',\n\n element: function () {\n\n return jQuery(_headerBar.idDOM);\n\n },\n\n clear: function () {\n\n _headerBar.element().empty();\n\n },\n\n elements: {\n\n logo: function () {\n\n var $logo = $('
');\n var $imgLogo = $('')\n $logo.append($imgLogo);\n return $logo;\n\n },\n\n searchInput: function () {\n\n if (_controllers.user.systemPermission.canSearch()) {\n\n var $divContainerInner = $('
');\n $divContainerInner.append($('
'));\n var $divSearch = $('
');\n var $inputSearch = $('');\n\n $inputSearch.on('keyup', function (e) {\n\n if (e.keyCode === 13) {\n\n var term = $(this).val();\n $(this).val('');\n _search.open(0, null, term);\n\n }\n });\n\n $divSearch.append($inputSearch);\n $divContainerInner.append($divSearch);\n\n var $divContainerOutter = $('
');\n $divContainerOutter.append($divContainerInner);\n return $divContainerOutter;\n\n }\n\n },\n\n userMenu: function () {\n\n var $divUser = $('
');\n\n //// Notification Icon\n //var $divNotification = $('
');\n //var $aNotification = $('');\n //$aNotification.on('click', function () {\n // console.log('Notificação');\n //});\n //$divNotification.append($aNotification);\n //$divUser.append($divNotification);\n\n var $divUserInner = $('
');\n\n var $divDropContainer = $('
');\n\n // User Name\n var $divUserName = $('
');\n _servicesAPI.user.getUserName().done(function (name) {\n $divUserName.html(name);\n }).fail(function (failData) {\n $divUserName.html('------');\n _common.ajaxCommonHandler.fail(failData);\n });\n $divDropContainer.append($divUserName);\n\n var $divUserInnerInner = $('
');\n\n // User Gravatar\n var $divUserFoto = $('
');\n _controllers.user.imagemPerfil.set($divUserFoto);\n $divUserInnerInner.append($divUserFoto);\n\n $divDropContainer.append($divUserInnerInner);\n\n $divDropContainer.append('');\n\n $divUserInner.append($divDropContainer);\n\n var $dropMenuContainer = $('');\n\n $divUserInner.append($dropMenuContainer);\n\n $divUser.append($divUserInner);\n\n return $divUser;\n\n },\n\n },\n\n create: function () {\n\n _headerBar.clear();\n\n _headerBar.element().append(_headerBar.elements.logo());\n\n _headerBar.element().append(_headerBar.elements.searchInput());\n\n _headerBar.element().append(_headerBar.elements.userMenu());\n\n },\n };\n\n var _contextBar = {\n\n idDOM: '#top-menu-section',\n\n element: function () {\n\n return jQuery(_contextBar.idDOM);\n\n },\n\n viewer: {\n\n idDOM: '#top-menu-section-view',\n\n element: function () {\n\n return jQuery(_contextBar.viewer.idDOM);\n\n },\n\n clear: function () {\n\n _contextBar.viewer.element().empty();\n\n },\n\n hide: function () {\n\n _contextBar.viewer.element().hide();\n\n },\n\n show: function () {\n\n _contextBar.viewer.element().show();\n\n },\n\n elements: {\n\n labelTool: function (name, caller) {\n\n var $labelDiv = $('
');\n\n var $nameLabel = $('
');\n $nameLabel.html(name);\n $labelDiv.append($nameLabel);\n\n return $labelDiv;\n },\n\n },\n\n create: function (name) {\n\n _contextBar.viewer.clear();\n\n _contextBar.viewer.element().append(_contextBar.viewer.elements.labelTool(name));\n\n },\n\n },\n\n };\n\n var _content = {\n\n viewer: {\n\n idDOM: '#work-area-view',\n\n element: function () {\n\n return jQuery(_content.viewer.idDOM);\n\n },\n\n clear: function () {\n\n _content.viewer.thumbArea.clear();\n _content.viewer.workArea.clear();\n\n },\n\n hide: function () {\n\n _content.viewer.element().hide();\n\n },\n\n show: function () {\n\n _content.viewer.element().show();\n\n },\n\n loading: function () {\n\n _content.viewer.thumbArea.loading();\n _content.viewer.workArea.loading();\n\n },\n\n // AREAS\n\n thumbArea: {\n\n blobThumb: [],\n\n idDOM: '#work-area-view-left',\n\n element: function () {\n\n return jQuery(_content.viewer.thumbArea.idDOM);\n },\n\n clear: function () {\n\n _content.viewer.thumbArea.element().empty();\n\n },\n\n loading: function () {\n\n _content.viewer.thumbArea.clear();\n _content.viewer.thumbArea.element().append(_common.loading.element());\n\n },\n\n hide: function () {\n\n _content.viewer.thumbArea.element().hide();\n\n },\n\n show: function () {\n\n _content.viewer.thumbArea.element().show();\n\n },\n\n resize: function () {\n\n var thumbHeight = ((jQuery(window).height()) - (_common.headerAndContextBarHeight));\n jQuery('#miniatura-preview').css({ height: thumbHeight });\n\n },\n\n disposeBlobs: function () {\n\n _content.viewer.thumbArea.blobThumb.forEach(function (el) {\n var URL = window.URL || window.webkitURL;\n URL.revokeObjectURL(el.blob);\n el.blobObject = null;\n });\n _content.viewer.thumbArea.blobThumb = [];\n\n },\n\n removeBlobByPageIdAndOrder: function (id, order) {\n\n var itemFilter = _content.viewer.thumbArea.blobThumb.filter(function (el) {\n return el.id === parseInt(id) && el.ordem === parseInt(order);\n });\n if (itemFilter.length > 0) {\n\n var URL = window.URL || window.webkitURL;\n\n URL.revokeObjectURL(itemFilter[0].blob);\n itemFilter[0].blobObject = null;\n\n _content.viewer.thumbArea.blobThumb = _content.viewer.thumbArea.blobThumb.filter(function (el) {\n return !(el.id === parseInt(id) && el.ordem === parseInt(order));\n });\n\n }\n\n },\n\n getTotalMiniaturas: function () {\n\n return jQuery(\".miniatura-preview-item\").length;\n },\n\n getElementSelected: function () {\n\n return jQuery(\".miniatura-preview-item.selected\");\n },\n\n getElementThumbSelected: function () {\n\n return jQuery(\".miniatura-preview-item.selected .miniatura-preview-item-image\");\n },\n\n getElementByOrder: function (order) {\n\n return jQuery('.miniatura-preview-item[data-ordem=' + parseInt(order) + ']');\n },\n\n getElementByPageIdAndOrder: function (id, order) {\n\n return jQuery('.miniatura-preview-item[data-pageid=' + parseInt(id) + '][data-ordem=' + parseInt(order) + ']');\n },\n\n getElementThumbByPageIdAndOrder: function (id, order) {\n\n return jQuery('.miniatura-preview-item[data-pageid=' + parseInt(id) + '][data-ordem=' + parseInt(order) + '] .miniatura-preview-item-image');\n },\n\n getElementSelectedImage: function () {\n\n return _content.viewer.thumbArea.getElementSelected().find('img').clone();\n },\n\n getAtrribPageIdElementSelected: function () {\n\n return parseInt(_content.viewer.thumbArea.getElementSelected().attr('data-pageid'));\n\n },\n\n getAtrribPageIdElementByOrder: function (order) {\n\n return parseInt(_content.viewer.thumbArea.getElementByOrder(order).attr('data-pageid'));\n\n },\n\n getAtrribDocumentIdElementSelected: function () {\n\n return parseInt(_content.viewer.thumbArea.getElementSelected().attr('data-docid'));\n\n },\n\n getAtrribDocumentIdElementByOrder: function (order) {\n\n return parseInt(_content.viewer.thumbArea.getElementByOrder(order).attr('data-docid'));\n\n },\n\n getAtrribTypeElementSelected: function () {\n\n return parseInt(_content.viewer.thumbArea.getElementSelected().attr('data-tipo'));\n\n },\n\n getAtrribTypeElementByOrder: function (order) {\n\n return parseInt(_content.viewer.thumbArea.getElementByOrder(order).attr('data-tipo'));\n\n },\n\n getAtrribOrderElementSelected: function () {\n\n return parseInt(_content.viewer.thumbArea.getElementSelected().attr('data-ordem'));\n\n },\n\n getAtrribOrderElementByOrder: function (order) {\n\n return parseInt(_content.viewer.thumbArea.getElementByOrder(order).attr('data-ordem'));\n\n },\n\n getAtrribExtensionElementSelected: function () {\n\n return parseInt(_content.viewer.thumbArea.getElementSelected().attr('data-extensao'));\n\n },\n\n getAtrribExtensionElementByOrder: function (order) {\n\n return parseInt(_content.viewer.thumbArea.getElementByOrder(order).attr('data-extensao'));\n\n },\n\n getAtrribIsMultipageElementSelected: function () {\n\n var result = _content.viewer.thumbArea.getElementSelected().attr('data-ismultipage');\n if (typeof (result) !== \"boolean\") {\n result = (result === 'true');\n }\n return result;\n\n },\n\n getAtrribIsMultipageElementByOrder: function (order) {\n\n var result = _content.viewer.thumbArea.getElementByOrder(order).attr('data-ismultipage');\n if (typeof (result) !== \"boolean\") {\n result = (result === 'true');\n }\n return result;\n\n },\n\n getAtrribIsDocCertDigitalElementSelected: function () {\n\n var result = _content.viewer.thumbArea.getElementSelected().attr('data-doccertdigital');\n if (typeof (result) !== \"boolean\") {\n result = (result === 'true');\n }\n return result;\n\n },\n\n getAtrribIsDocCertDigitalElementByOrder: function (order) {\n\n var result = _content.viewer.thumbArea.getElementByOrder(order).attr('data-doccertdigital');\n if (typeof (result) !== \"boolean\") {\n result = (result === 'true');\n }\n return result;\n\n },\n\n getAtrribNumberPagesElementSelected: function () {\n\n return parseInt(_content.viewer.thumbArea.getElementSelected().attr('data-quantidade-paginas'));\n\n },\n\n getAtrribNumberPagesElementByOrder: function (order) {\n\n return parseInt(_content.viewer.thumbArea.getElementByOrder(order).attr('data-quantidade-paginas'));\n\n },\n\n setElementSelectedByOrder: function (order) {\n\n _content.viewer.thumbArea.getElementSelected().removeClass('selected');\n _content.viewer.thumbArea.getElementByOrder(order).addClass('selected');\n\n },\n\n loadingThumbByPageIdAndOrder: function (id, order) {\n\n var $element = _content.viewer.thumbArea.getElementThumbByPageIdAndOrder(id, order);\n $element.empty();\n $element.append(_common.loading.element());\n\n },\n\n clearThumbByPageIdAndOrder: function (id, order) {\n\n var $element = _content.viewer.thumbArea.getElementByPageIdAndOrder(id, order);\n $element.empty();\n\n },\n\n loadThumb: function (id, ordem, isMultiPage, $imageContainer, quantidadePaginas) {\n\n var xhr = new XMLHttpRequest();\n xhr.responseType = 'arraybuffer';\n\n xhr.open('GET', _url.viewerUrls.urlGetPageThumb + \"?id=\" + id + \"&ordem=\" + ordem + \"&marcacoes=\" + _content.viewer.workArea.viewMarcacao + \"&token=\" + encodeURIComponent(_viewer.token), true);\n\n xhr.onload = function () {\n\n if (this.status === 200) {\n\n $imageContainer.empty();\n var type = xhr.getResponseHeader('Content-Type');\n var blob = new Blob([this.response], { type: type });\n var URL = window.URL || window.webkitURL;\n var srcUrl = URL.createObjectURL(blob);\n\n var element = document.createElement(\"img\");\n element.src = srcUrl;\n element.setAttribute('type', 'image/jpeg');\n\n $imageContainer.append(element);\n\n if (quantidadePaginas > 1) {\n var $elementNumberPages = $('
' + quantidadePaginas + '
');\n $imageContainer.append($elementNumberPages);\n }\n\n _content.viewer.thumbArea.blobThumb.push({ id: parseInt(id), blob: srcUrl, ordem: parseInt(ordem), blobObject: blob });\n }\n else {\n\n $imageContainer.empty();\n\n }\n };\n\n xhr.send();\n\n },\n\n createThumbs: function (documentSummary, pageId) {\n\n _content.viewer.thumbArea.disposeBlobs();\n\n var $miniaturas = $('
');\n var i = 0;\n\n var $miniaturaScroll = null;\n\n documentSummary.paginas.forEach(function (element) {\n\n var $miniaturaItem = $('
');\n\n $miniaturaItem.attr('data-docid', documentSummary.id);\n $miniaturaItem.attr('data-doccertdigital', documentSummary.fichaCertificacaoDigital);\n $miniaturaItem.attr('data-pageid', element.id);\n $miniaturaItem.attr('data-tipo', element.tipo);\n $miniaturaItem.attr('data-ordem', element.ordem);\n $miniaturaItem.attr('data-extensao', element.extensao);\n $miniaturaItem.attr('data-ismultipage', element.isMultiPage);\n $miniaturaItem.attr('data-quantidade-paginas', element.quantidadePaginas);\n\n var $miniaturaItemNumber = $('
');\n $miniaturaItemNumber.html(element.ordem);\n $miniaturaItem.append($miniaturaItemNumber);\n\n var $miniaturaItemImage = $('
');\n $miniaturaItemImage.html(_common.loading.element());\n $miniaturaItemImage.on('click', function () {\n\n $(\".miniatura-preview-item.selected\").removeClass('selected');\n $miniaturaItem.addClass('selected');\n\n _content.viewer.workArea.loadPage(element.id, element.tipo, element.extensao, element.ordem, element.isMultiPage);\n _content.viewer.workArea.toolbarPage.navLabelTool.updateLabel(element.ordem, documentSummary.total);\n\n });\n\n _content.viewer.thumbArea.loadThumb(element.id, element.ordem, element.isMultiPage, $miniaturaItemImage, element.quantidadePaginas);\n\n _content.viewer.workArea.viewerPage.loadPageBlob(element.id, element.ordem);\n\n if (pageId !== null && pageId !== undefined) {\n\n if (element.id == pageId) {\n $miniaturaItemImage.click();\n $miniaturaScroll = $miniaturaItem;\n }\n }\n else {\n if (i === 0) {\n\n $miniaturaItemImage.click();\n\n }\n }\n\n $miniaturaItem.append($miniaturaItemImage);\n $miniaturas.append($miniaturaItem);\n\n i++;\n });\n\n _content.viewer.thumbArea.clear();\n _content.viewer.thumbArea.element().append($miniaturas);\n _content.viewer.thumbArea.resize();\n\n if (pageId !== null && pageId !== undefined) {\n\n $miniaturas.scrollTop($miniaturaScroll.offset().top - 100);\n }\n\n },\n\n reloadAllThumbs: function (pageId, order) {\n\n _content.viewer.thumbArea.disposeBlobs();\n\n jQuery('.miniatura-preview-item').each(function (index, element) {\n var $miniatura = $(element);\n\n if (pageId !== undefined && order !== undefined) {\n if ($miniatura.attr('data-pageid') == pageId && $miniatura.attr('data-ordem') == order) {\n return true;\n }\n }\n\n $miniatura.find('.miniatura-preview-item-image').html(_common.loading.element());\n _content.viewer.thumbArea.loadThumb(\n $miniatura.attr('data-pageid'),\n $miniatura.attr('data-ordem'),\n $miniatura.attr('data-ismultipage'),\n $miniatura.find('.miniatura-preview-item-image'),\n $miniatura.attr('data-quantidade-paginas'),\n );\n });\n\n },\n },\n\n workArea: {\n\n idDOM: '#work-area-view-center',\n\n viewMarcacao: true,\n\n element: function () {\n\n return jQuery(_content.viewer.workArea.idDOM);\n },\n\n clear: function () {\n\n _content.viewer.workArea.element().empty();\n\n },\n\n loading: function () {\n\n _content.viewer.workArea.clear();\n _content.viewer.workArea.element().append(_common.loading.element());\n\n },\n\n hide: function () {\n\n _content.viewer.workArea.element().hide();\n\n },\n\n show: function () {\n\n _content.viewer.workArea.element().show();\n\n },\n\n resize: function () {\n\n _content.viewer.workArea.viewerPage.resize();\n\n },\n\n toolbarPage: {\n\n classDOM: '.liquid-page-tools',\n\n element: function () {\n\n return jQuery(_content.viewer.workArea.toolbarPage.classDOM);\n\n },\n\n hide: function () {\n\n _content.viewer.workArea.toolbarPage.element().hide();\n\n },\n\n show: function () {\n\n _content.viewer.workArea.toolbarPage.element().show();\n\n },\n\n sizeTool: {\n\n classDOM: '.page-tools-left-1',\n\n element: function () {\n\n return jQuery(_content.viewer.workArea.toolbarPage.sizeTool.classDOM);\n\n },\n\n hide: function () {\n\n _content.viewer.workArea.toolbarPage.sizeTool.element().hide();\n\n },\n\n show: function () {\n\n _content.viewer.workArea.toolbarPage.sizeTool.element().show();\n\n },\n\n create: function () {\n\n var $element = $('
');\n\n var $tool_fullscreen = $('');\n $tool_fullscreen.on('click', function () {\n\n _content.viewer.workArea.viewerPage.element().find('img').css('width', '');\n _content.viewer.workArea.viewerPage.element().find('img').css('height', '');\n _content.viewer.workArea.toolbarPage.sizeTool.element().find('select').val(100);\n\n });\n\n var $tool_zoom_in = $('');\n $tool_zoom_in.on('click', function () {\n\n var $imgElement = _content.viewer.workArea.viewerPage.element().find('img');\n var actualHeight = $imgElement.height();\n var imageTemp = new Image();\n imageTemp.src = $imgElement.attr(\"src\");\n var imageHeight = imageTemp.height;\n var factor = imageHeight / 10;\n factor = actualHeight + factor;\n $imgElement.css('width', '');\n $imgElement.css('height', factor + 'px');\n _content.viewer.workArea.toolbarPage.sizeTool.element().find('select').val(4);\n });\n\n var $tool_zoom_out = $('');\n $tool_zoom_out.on('click', function () {\n\n var $imgElement = _content.viewer.workArea.viewerPage.element().find('img');\n var actualHeight = $imgElement.height();\n var imageTemp = new Image();\n imageTemp.src = $imgElement.attr(\"src\");\n var imageHeight = imageTemp.height;\n var factor = imageHeight / 10;\n factor = actualHeight - factor;\n if (factor <= 0) {\n factor = 0;\n }\n $imgElement.css('width', '');\n $imgElement.css('height', factor + 'px');\n _content.viewer.workArea.toolbarPage.sizeTool.element().find('select').val(4);\n });\n\n $element.append($tool_fullscreen);\n $element.append($tool_zoom_in);\n $element.append($tool_zoom_out);\n\n return $element;\n\n },\n\n },\n\n definedSizeTool: {\n\n classDOM: '.page-tools-left-2',\n\n element: function () {\n\n return jQuery(_content.viewer.workArea.toolbarPage.definedSizeTool.classDOM);\n\n },\n\n hide: function () {\n\n _content.viewer.workArea.toolbarPage.definedSizeTool.element().hide();\n\n },\n\n show: function () {\n\n _content.viewer.workArea.toolbarPage.definedSizeTool.element().show();\n\n },\n\n create: function () {\n\n var $element = $('
');\n var $div_input_text = $('
');\n var $select_zoom = $('');\n\n var optionItens = [\n { val: 200, text: '200%' },\n { val: 100, text: '100%' },\n { val: 80, text: '80%' },\n { val: 50, text: '50%' },\n { val: 20, text: '20%' },\n { val: 10, text: '10%' },\n { val: 3, text: 'Fit' },\n { val: 2, text: 'Horizontal' },\n { val: 1, text: 'Vertical' },\n { val: 4, text: 'Custom' }\n ];\n $(optionItens).each(function () {\n var $option = $(\"