2 lines
4.1 KiB
JavaScript
2 lines
4.1 KiB
JavaScript
|
(function(){var o={ppt:{},pdf:{},doc:{}};window.addEventListener("message",function(a){if(a.data.pptId){var e=o.ppt[a.data.pptId];if(a.data.pageAnim){var i=a.data.pageAnim.split(",");e.info.current=i[0].split("/")[0],e.info.total=i[0].split("/")[1],e.info.currentAnim=i[1].split("/")[0],e.info.currentAnimTotal=i[1].split("/")[1]}if(a.data.fileInfo&&(e.info.fileInfo=a.data.fileInfo),e.callback){if(a.data.pageAnim){var i=a.data.pageAnim.split(","),t={current:i[0].split("/")[0],total:i[0].split("/")[1],currentAnim:i[1].split("/")[0],currentAnimTotal:i[1].split("/")[1],fileInfo:e.info.fileInfo};e.callback(t)}else e.callback(a.data);e.callback=""}}if(a.data.pdfId){var e=o.pdf[a.data.pdfId];if(a.data.pageInfo){var n=a.data.pageInfo;e.info.current=n.current,e.info.total=n.total}if(a.data.getSize){e.getSizeCallback&&(e.getSizeCallback(a.data.getSize),e.getSizeCallback="");var f=a.data.getSize.split("_");e.info.width=f[0],e.info.height=f[1]}if(a.data.fileInfo&&(e.info.fileInfo=a.data.fileInfo),e.callback){if(a.data.pageInfo){var n=a.data.pageInfo,t={current:n.current,total:n.total,fileInfo:e.info.fileInfo};e.callback(t)}else e.callback(a.data);e.callback=""}}if(a.data.docId){var e=o.doc[a.data.docId];if(a.data.pageInfo){var n=a.data.pageInfo;e.info.current=n.current,e.info.total=n.total}if(a.data.getSize){e.getSizeCallback&&(e.getSizeCallback(a.data.getSize),e.getSizeCallback="");var f=a.data.getSize.split("_");e.info.width=f[0],e.info.height=f[1]}if(a.data.fileInfo&&(e.info.fileInfo=a.data.fileInfo),e.callback){if(a.data.pageInfo){var n=a.data.pageInfo,t={current:n.current,total:n.total,fileInfo:e.info.fileInfo};e.callback(t)}else e.callback(a.data);e.callback=""}}});function l(a){o.ppt[a]=this;var e=this;e.info={current:0,total:0,currentAnim:0,currentAnimTotal:0},e.element=document.getElementById(a).contentWindow,e.goPage=function(t,n){e.element.postMessage("goPage,"+(parseInt(t)-1),"*"),e.getAnimtPage(n)},e.nextPage=function(t){e.element.postMessage("nextPage","*"),e.getAnimtPage(t)},e.prePage=function(t){e.element.postMessage("prePage","*"),e.getAnimtPage(t)},e.nextAnim=function(t){e.element.postMessage("nextAnim","*"),e.getAnimtPage(t)},e.preAnim=function(t){e.element.postMessage("preAnim","*"),e.getAnimtPage(t)},e.getAnimtPage=function(t){t&&(this.callback=t),e.element.postMessage({pageAnim:200,pptId:a},"*")};var i=setInterval(function(){e.getAnimtPage(),e.info.total>0&&clearInterval(i)},500);setTimeout(function(){clearInterval(i)},5e3),e.allScreen=function(t){e.element.postMessage("allScreen","*")}}window.PPTIframe=l;function s(a){o.pdf[a]=this;var e=this;e.info={current:0,total:0},e.element=document.getElementById(a).contentWindow,e.goPage=function(t,n){parseInt(t)>0&&(e.element.postMessage("goPage,"+parseInt(t),"*"),n&&(this.callback=n))},e.nextPage=function(t){e.element.postMessage("nextPage","*"),t&&(this.callback=t)},e.prePage=function(t){e.element.postMessage("prePage","*"),t&&(this.callback=t)},e.getPageInfo=function(t){e.element.postMessage("getPageInfo","*"),t&&(this.callback=t)},e.getSize=function(t){e.element.postMessage("getSize","*"),t&&(this.getSizeCallback=t)},e.initScroll=function(){e.element.postMessage("initScroll","*")};var i=setInterval(function(){e.element.postMessage({pdfId:a},"*"),e.info.fileInfo&&clearInterval(i)},500);setTimeout(function(){clearInterval(i)},5e3)}window.PDFIframe=s;function c(a){o.doc[a]=this;var e=this;e.info={current:0,total:0},e.element=document.getElementById(a).contentWindow,e.goPage=function(t,n){parseInt(t)>0&&(e.element.postMessage("goPage,"+parseInt(t),"*"),n&&(this.callback=n))},e.nextPage=function(t){e.element.postMessage("nextPage","*"),t&&(this.callback=t)},e.prePage=function(t){e.element.postMessage("prePage","*"),t&&(this.callback=t)},e.getPageInfo=function(t){e.element.postMessage("getPageInfo","*"),t&&(this.callback=t)},e.getSize=function(t){e.element.postMessage("getSize","*"),t&&(this.getSizeCallback=t)},e.initScroll=function(){e.element.postMessage("initScroll","*")};var i=setInterval(function(){e.element.postMessage({docId:a},"*"),e.info.fileInfo&&clearInterval(
|