Iniit
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
var Unibase;
|
||||
(function (Unibase) {
|
||||
let Apps;
|
||||
(function (Apps) {
|
||||
let Collaboration;
|
||||
(function (Collaboration) {
|
||||
let Components;
|
||||
(function (Components) {
|
||||
let PdfViewer;
|
||||
(function (PdfViewer) {
|
||||
class Base {
|
||||
constructor() {
|
||||
this.isFullscreen = false;
|
||||
}
|
||||
init(response) {
|
||||
this.result = response.result;
|
||||
this.documentGroup = this.result.DocumentGroup;
|
||||
this.documentFileName = this.result.DocumentFileName;
|
||||
this.documentFileId = this.result.DocumentFileId;
|
||||
this.filePath = this.result.DocumentFilePath;
|
||||
this.render();
|
||||
}
|
||||
unwireBootStrapKeyEvent() {
|
||||
let popup = document.body.getElementsByClassName('_bizgaze_popup_container');
|
||||
let events = $._data($(popup)[0], "events");
|
||||
if (events && events.keydown) {
|
||||
$(popup).off('keydown.dismiss.bs.modal', events.keydown[0].handler);
|
||||
}
|
||||
}
|
||||
render() {
|
||||
this.renderPopup();
|
||||
this.renderMenuBar();
|
||||
this.renderPdf();
|
||||
this.updateProps();
|
||||
this.refreshHeight();
|
||||
this.addEventListeners();
|
||||
this.unwireBootStrapKeyEvent();
|
||||
}
|
||||
addEventListeners() {
|
||||
this.fullscreenBtn.addEventListener('click', () => {
|
||||
this.openFullscreen();
|
||||
});
|
||||
this.popupElement.addEventListener('fullscreenchange', () => {
|
||||
setTimeout(() => {
|
||||
this.setHeigthOnFullscreenChange();
|
||||
}, 0);
|
||||
if (this.isFullscreen) {
|
||||
this.fullscreenBtn.classList.remove('biz-enterfullscreen');
|
||||
this.fullscreenBtn.classList.add('biz-exitfullscreen');
|
||||
this.isFullscreen = true;
|
||||
}
|
||||
else {
|
||||
this.fullscreenBtn.classList.remove('biz-exitfullscreen');
|
||||
this.fullscreenBtn.classList.add('biz-enterfullscreen');
|
||||
this.isFullscreen = false;
|
||||
}
|
||||
;
|
||||
});
|
||||
document.addEventListener('fullscreenchange', () => {
|
||||
this.setHeigthOnFullscreenChange();
|
||||
});
|
||||
window.addEventListener('keyup', (e) => {
|
||||
if (e.keyCode == 122) {
|
||||
e.preventDefault();
|
||||
this.openFullscreen();
|
||||
this.setHeigthOnFullscreenChange();
|
||||
}
|
||||
});
|
||||
this.exitPdf.addEventListener('click', () => {
|
||||
this.closePopup();
|
||||
});
|
||||
}
|
||||
openFullscreen() {
|
||||
let elem = this.popupElement;
|
||||
if (!this.isFullscreen) {
|
||||
if (elem.requestFullscreen) {
|
||||
elem.requestFullscreen();
|
||||
}
|
||||
else if (elem.webkitRequestFullscreen) {
|
||||
elem.webkitRequestFullscreen();
|
||||
}
|
||||
else if (elem.msRequestFullscreen) {
|
||||
elem.msRequestFullscreen();
|
||||
}
|
||||
this.isFullscreen = true;
|
||||
}
|
||||
else {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
else if (document.webkitExitFullscreen) {
|
||||
document.webkitExitFullscreen();
|
||||
}
|
||||
else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
}
|
||||
this.isFullscreen = false;
|
||||
}
|
||||
}
|
||||
setHeigthOnFullscreenChange() {
|
||||
var footerHeight = this.element.parentElement.nextElementSibling.offsetHeight;
|
||||
this.element.parentElement.style.height = window.innerHeight - footerHeight + 'px';
|
||||
this.pdfViewer.height = '100%';
|
||||
}
|
||||
renderPdf() {
|
||||
this.pdfViewer = new ej.pdfviewer.PdfViewer({
|
||||
created: this.pdfCreated.bind(this),
|
||||
documentPath: this.filePath,
|
||||
serviceUrl: 'http://localhost:3088/pdfviewer'
|
||||
});
|
||||
ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch, ej.pdfviewer.Print, ej.pdfviewer.Navigation);
|
||||
this.pdfViewer.appendTo('#DocumentViewer');
|
||||
}
|
||||
updateProps() {
|
||||
this.popupElement = document.getElementsByClassName('_bizgaze_popup_container')[0];
|
||||
this.element = document.getElementById('DocumentViewer');
|
||||
this.fullscreenBtn = document.getElementsByClassName('biz-pdf-fullscreen-btn')[0];
|
||||
this.exitPdf = document.getElementsByClassName('biz-pdf-exitpdf-btn')[0];
|
||||
}
|
||||
pdfCreated() {
|
||||
var util = Unibase.Apps.Collaboration.Components.Common.Util.Instance();
|
||||
document.getElementById("DocumentViewer_zoomDropDownContainer").after(util.createElement('div', 'class', 'biz-pdf-fullscreen'));
|
||||
util.appendChildren('biz-pdf-fullscreen', 0, util.createElement('button', 'class', 'e-icons biz-pdf-fullscreen-btn biz-enterfullscreen'));
|
||||
document.getElementById("DocumentViewer_downloadContainer").after(util.createElement('div', 'class', 'biz-pdf-exitpdf'));
|
||||
util.appendChildren('biz-pdf-exitpdf', 0, util.createElement('button', 'class', 'e-icons biz-pdf-exitpdf-btn'));
|
||||
}
|
||||
actionComplete() {
|
||||
}
|
||||
closePopup() {
|
||||
Unibase.Apps.Collaboration.Components.DocConnector.Instance().closeDoc();
|
||||
var contId = $("._bizgaze_popup_container:visible").attr("id");
|
||||
$('#' + contId).modal('hide');
|
||||
$('#' + contId).remove();
|
||||
}
|
||||
refreshHeight() {
|
||||
var footerHeight = this.element.parentElement.nextElementSibling.offsetHeight;
|
||||
var rootHeight = this.element.parentElement.parentElement.offsetHeight;
|
||||
this.element.parentElement.style.height = (rootHeight - footerHeight) + 'px';
|
||||
}
|
||||
renderPopup() {
|
||||
Unibase.Apps.Collaboration.Components.Documents.Instance().loadForm(0, this.documentFileId, 0, null, this.documentGroup);
|
||||
}
|
||||
renderMenuBar() {
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new Base();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
PdfViewer.Base = Base;
|
||||
})(PdfViewer = Components.PdfViewer || (Components.PdfViewer = {}));
|
||||
})(Components = Collaboration.Components || (Collaboration.Components = {}));
|
||||
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
|
||||
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
|
||||
})(Unibase || (Unibase = {}));
|
||||
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
var Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){let i;(function(t){class i{constructor(){this.isFullscreen=!1}init(n){this.result=n.result;this.documentGroup=this.result.DocumentGroup;this.documentFileName=this.result.DocumentFileName;this.documentFileId=this.result.DocumentFileId;this.filePath=this.result.DocumentFilePath;this.render()}unwireBootStrapKeyEvent(){let t=document.body.getElementsByClassName("_bizgaze_popup_container"),n=$._data($(t)[0],"events");n&&n.keydown&&$(t).off("keydown.dismiss.bs.modal",n.keydown[0].handler)}render(){this.renderPopup();this.renderMenuBar();this.renderPdf();this.updateProps();this.refreshHeight();this.addEventListeners();this.unwireBootStrapKeyEvent()}addEventListeners(){this.fullscreenBtn.addEventListener("click",()=>{this.openFullscreen()});this.popupElement.addEventListener("fullscreenchange",()=>{setTimeout(()=>{this.setHeigthOnFullscreenChange()},0),this.isFullscreen?(this.fullscreenBtn.classList.remove("biz-enterfullscreen"),this.fullscreenBtn.classList.add("biz-exitfullscreen"),this.isFullscreen=!0):(this.fullscreenBtn.classList.remove("biz-exitfullscreen"),this.fullscreenBtn.classList.add("biz-enterfullscreen"),this.isFullscreen=!1)});document.addEventListener("fullscreenchange",()=>{this.setHeigthOnFullscreenChange()});window.addEventListener("keyup",n=>{n.keyCode==122&&(n.preventDefault(),this.openFullscreen(),this.setHeigthOnFullscreenChange())});this.exitPdf.addEventListener("click",()=>{this.closePopup()})}openFullscreen(){let n=this.popupElement;this.isFullscreen?(document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen(),this.isFullscreen=!1):(n.requestFullscreen?n.requestFullscreen():n.webkitRequestFullscreen?n.webkitRequestFullscreen():n.msRequestFullscreen&&n.msRequestFullscreen(),this.isFullscreen=!0)}setHeigthOnFullscreenChange(){var n=this.element.parentElement.nextElementSibling.offsetHeight;this.element.parentElement.style.height=window.innerHeight-n+"px";this.pdfViewer.height="100%"}renderPdf(){this.pdfViewer=new ej.pdfviewer.PdfViewer({created:this.pdfCreated.bind(this),documentPath:this.filePath,serviceUrl:"http://localhost:3088/pdfviewer"});ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.TextSelection,ej.pdfviewer.TextSearch,ej.pdfviewer.Print,ej.pdfviewer.Navigation);this.pdfViewer.appendTo("#DocumentViewer")}updateProps(){this.popupElement=document.getElementsByClassName("_bizgaze_popup_container")[0];this.element=document.getElementById("DocumentViewer");this.fullscreenBtn=document.getElementsByClassName("biz-pdf-fullscreen-btn")[0];this.exitPdf=document.getElementsByClassName("biz-pdf-exitpdf-btn")[0]}pdfCreated(){var t=n.Apps.Collaboration.Components.Common.Util.Instance();document.getElementById("DocumentViewer_zoomDropDownContainer").after(t.createElement("div","class","biz-pdf-fullscreen"));t.appendChildren("biz-pdf-fullscreen",0,t.createElement("button","class","e-icons biz-pdf-fullscreen-btn biz-enterfullscreen"));document.getElementById("DocumentViewer_downloadContainer").after(t.createElement("div","class","biz-pdf-exitpdf"));t.appendChildren("biz-pdf-exitpdf",0,t.createElement("button","class","e-icons biz-pdf-exitpdf-btn"))}actionComplete(){}closePopup(){n.Apps.Collaboration.Components.DocConnector.Instance().closeDoc();var t=$("._bizgaze_popup_container:visible").attr("id");$("#"+t).modal("hide");$("#"+t).remove()}refreshHeight(){var n=this.element.parentElement.nextElementSibling.offsetHeight,t=this.element.parentElement.parentElement.offsetHeight;this.element.parentElement.style.height=t-n+"px"}renderPopup(){n.Apps.Collaboration.Components.Documents.Instance().loadForm(0,this.documentFileId,0,null,this.documentGroup)}renderMenuBar(){}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.Base=i})(i=t.PdfViewer||(t.PdfViewer={}))})(i=t.Components||(t.Components={}))})(i=t.Collaboration||(t.Collaboration={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));
|
||||
Reference in New Issue
Block a user