mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 09:21:54 +00:00
[odf view] improvement: fixed bugs, improved ui, rm unused files
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
function Viewer(c){function p(){return document.isFullScreen||document.mozFullScreen||document.webkitIsFullScreen}function u(a){var b=E.options,c,f=!1,d;for(d=0;d<b.length;d+=1)c=b[d],c.value!==a?c.selected=!1:f=c.selected=!0;return f}function v(a,c,d){a!==b.getZoomLevel()&&(b.setZoomLevel(a),d=document.createEvent("UIEvents"),d.initUIEvent("scalechange",!1,!1,window,0),d.scale=a,d.resetAutoSettings=c,window.dispatchEvent(d))}function w(){var a;if(c.onScroll)c.onScroll();c.getPageInView&&(a=c.getPageInView())&&
|
||||
(e=a,document.getElementById("pageNumber").value=a)}function x(a){window.clearTimeout(y);y=window.setTimeout(function(){w()},a)}function g(a,b,g){var f,e;if(f="custom"===a?parseFloat(document.getElementById("customScaleOption").textContent)/100:parseFloat(a))v(f,!0,g);else{f=d.clientWidth-k;e=d.clientHeight-k;switch(a){case "page-actual":v(1,b,g);break;case "page-width":c.fitToWidth(f);break;case "page-height":c.fitToHeight(e);break;case "page-fit":c.fitToPage(f,e);break;case "auto":c.isSlideshow()?
|
||||
c.fitToPage(f+k,e+k):c.fitSmart(f)}u(a)}x(300)}function q(){l&&!p()&&b.togglePresentationMode()}function r(){m&&(s.className="touched",window.clearTimeout(z),z=window.setTimeout(function(){s.className=""},2E3))}var b=this,k=40,l=!1,A=!1,m=!1,t,B,d=document.getElementById("canvasContainer"),s=document.getElementById("overlayNavigator"),C=document.getElementById("toolbarLeft"),F=document.getElementById("toolbarMiddleContainer"),E=document.getElementById("scaleSelect"),D,n=[],e,y,z;this.initialize=function(){var a=
|
||||
String(document.location),h=a.indexOf("#"),a=a.substr(h+1);-1===h||0===a.length?console.log("Could not parse file path argument."):(B=document.getElementById("viewer"),t=a,D=t.replace(/^.*[\\\/]/,""),document.title=D,document.getElementById("documentName").innerHTML=document.title,c.onLoad=function(){(m=c.isSlideshow())?(d.style.padding=0,C.style.visibility="visible"):(F.style.visibility="visible",c.getPageInView&&(C.style.visibility="visible"));A=!0;n=c.getPages();document.getElementById("numPages").innerHTML=
|
||||
String(document.location),h=a.indexOf("#"),a=a.substr(h+1);-1===h||0===a.length?console.log("Could not parse file path argument."):(B=document.getElementById("viewer"),t=a,D=decodeURIComponent(t.replace(/^.*[\\\/]/,"")),document.title=D,document.getElementById("documentName").innerHTML=document.title,c.onLoad=function(){(m=c.isSlideshow())?(d.style.padding=0,C.style.visibility="visible"):(F.style.visibility="visible",c.getPageInView&&(C.style.visibility="visible"));A=!0;n=c.getPages();document.getElementById("numPages").innerHTML=
|
||||
"of "+n.length;b.showPage(1);g("auto");d.onscroll=w;x()},c.initialize(d,a))};this.showPage=function(a){0>=a?a=1:a>n.length&&(a=n.length);c.showPage(a);e=a;document.getElementById("pageNumber").value=e};this.showNextPage=function(){b.showPage(e+1)};this.showPreviousPage=function(){b.showPage(e-1)};this.download=function(){var a=t.split("#")[0];window.open(a+"#viewer.action=download","_parent")};this.toggleFullScreen=function(){var a=B;p()?document.cancelFullScreen?document.cancelFullScreen():document.mozCancelFullScreen?
|
||||
document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():a.requestFullScreen?a.requestFullScreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullScreen&&a.webkitRequestFullScreen()};this.togglePresentationMode=function(){var a=document.getElementById("titlebar"),h=document.getElementById("toolbarContainer"),e=document.getElementById("overlayCloseButton");l?(a.style.display=h.style.display="block",e.style.display="none",d.className="",d.onmouseup=
|
||||
function(){},d.oncontextmenu=function(){},d.onmousedown=function(){},g("auto"),m=c.isSlideshow()):(a.style.display=h.style.display="none",e.style.display="block",d.className="presentationMode",m=!0,d.onmousedown=function(a){a.preventDefault()},d.oncontextmenu=function(a){a.preventDefault()},d.onmouseup=function(a){a.preventDefault();1===a.which?b.showNextPage():b.showPreviousPage()},g("page-fit"));l=!l};this.getZoomLevel=function(){return c.getZoomLevel()};this.setZoomLevel=function(a){c.setZoomLevel(a)};
|
||||
|
Reference in New Issue
Block a user