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

assets.js.GroupdocsViewer.all.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: 2.1.0
Show newest version
if(!window.jGroupdocs)window.jGroupdocs={};window.jGroupdocs.stringExtensions={format:function(c){var b=c,a=arguments.length;while(--a)b=b.replace(new RegExp("\\{"+(a-1)+"\\}","gm"),arguments[a]);return b}};JsInject={Container:function(){this.serviceEntries=[];this.disposables=[]}};JsInject.Container.prototype.Resolve=function(a,c,b,d,e,f,g,h,i,j){return this.ResolveInternal(a,!0,c,b,d,e,f,g,h,i,j)};JsInject.Container.prototype.TryResolve=function(a,c,b,d,e,f,g,h,i,j){return this.ResolveInternal(a,!1,c,b,d,e,f,g,h,i,j)};JsInject.Container.prototype.RegisterInternal=function(a,c,b,d){if(this.RegisteredInternal(a))throw"Factory with name '"+a+"' alredy registered";this.serviceEntries[a]={factory:c,scope:b,owner:d,instance:null}};JsInject.Container.prototype.Dispose=function(){for(var a in this.disposables)this.disposables[a].Dispose()};JsInject.Container.prototype.ResolveInternal=function(a,k,b,c,d,e,f,g,h,i,j){if(!this.RegisteredInternal(a))if(k)throw"Factory with name '"+a+"' is not registered";else return null;a=this.serviceEntries[a];if(a.scope==="container"){if(a.instance===null)a.instance=this.CreateInstanceInternal(a.factory,a.owner,b,c,d,e,f,g,h,i,j);return a.instance}return this.CreateInstanceInternal(a.factory,a.owner,b,c,d,e,f,g,h,i,j)};JsInject.Container.prototype.CreateInstanceInternal=function(a,c,b,d,e,f,g,h,i,j,k){a=a(this,b,d,e,f,g,h,i,j,k);c==="container"&&typeof a.Dispose==="function"&&this.disposables.push(a);return a};JsInject.Container.prototype.RegisteredInternal=function(a){return this.serviceEntries[a]!==void 0};JsInject.Registration=function(a,b){this.name=a;this.factory=b;this.scope="none";this.owner="consumer"};JsInject.Registration.prototype.Reused=function(){this.scope="container";this.Owned();return this};JsInject.Registration.prototype.Owned=function(){this.owner="container";return this};JsInject.ContainerBuilder=function(){this.registrations=[]};JsInject.ContainerBuilder.prototype.Register=function(b,c){var a=new JsInject.Registration(b,c);this.registrations.push(a);return a};JsInject.ContainerBuilder.prototype.Create=function(){var b=new JsInject.Container,c;for(c in this.registrations){var a=this.registrations[c];b.RegisterInternal(a.name,a.factory,a.scope,a.owner)}return b};JsInject.Container.prototype.Register=function(a,c,b){a=new JsInject.Registration(a,c);b&&a.Reused();this.RegisterInternal(a.name,a.factory,a.scope,a.owner)};if(!window.jSaaspose)window.jSaaspose={};if(!window.Container){window.Container=new JsInject.Container;Container.Register("Cacher",function(){return $.jCacher},true);Container.Register("Rx.Observable",function(){return Rx.Observable},true);Container.Register("RequestObservable",function(){return $.ajaxAsObservable},true);Container.Register("AsyncSubject",function(){return new Rx.AsyncSubject},false);var host=window.location.hostname+(window.location.port?":"+window.location.port:""),applicationPath=$.ui.groupdocsViewer.prototype.applicationPath,slashPosition=applicationPath.indexOf("//"),hostNamePosition=slashPosition+2;if(applicationPath.indexOf(host,hostNamePosition)!=hostNamePosition)$.ui.groupdocsViewer.prototype.isWorkingCrossDomain=true;Container.Register("PortalService",function(){return new jSaaspose.PortalService($.ui.groupdocsViewer.prototype.applicationPath,$.ui.groupdocsViewer.prototype.useHttpHandlers,$.ui.groupdocsViewer.prototype.isWorkingCrossDomain)},true);Container.Register("HttpProvider",function(){return{buildUrl:function(){return""},signUrl:function(){return""}}},true)}/*
* Bootstrap.js by @fat & @mdo
* Copyright 2012 Twitter, Inc. - 2.3.2
* http://www.apache.org/licenses/LICENSE-2.0.txt
*/
!function(a){"use strict";a(function(){a.support.transition=function(){var a=function(){var c=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},a;for(a in b)if(c.style[a]!==undefined)return b[a]}();return a&&{end:a}}()})}(window.jQuery),!function(a){"use strict";var c='[data-dismiss="alert"]',b=function(b){a(b).on("click",c,this.close)};b.prototype.close=function(e){function f(){b.trigger("closed").remove()}var d=a(this),c=d.attr("data-target"),b;c||(c=d.attr("href"),c=c&&c.replace(/.*(?=#[^\s]*$)/,"")),b=a(c),e&&e.preventDefault(),b.length||(b=d.hasClass("alert")?d:d.parent()),b.trigger(e=a.Event("close"));if(e.isDefaultPrevented())return;b.removeClass("in"),a.support.transition&&b.hasClass("fade")?b.on(a.support.transition.end,f):f()};var d=a.fn.alert;a.fn.alert=function(c){return this.each(function(){var e=a(this),d=e.data("alert");d||e.data("alert",d=new b(this)),typeof c=="string"&&d[c].call(e)})},a.fn.alert.Constructor=b,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.alert.data-api",c,b.prototype.close)}(window.jQuery),!function(a){"use strict";var b=function(c,b){this.$element=a(c),this.options=a.extend({},a.fn.button.defaults,b)};b.prototype.setState=function(c){var b="disabled",a=this.$element,e=a.data(),d=a.is("input")?"val":"html";c+="Text",e.resetText||a.data("resetText",a[d]()),a[d](e[c]||this.options[c]),setTimeout(function(){c=="loadingText"?a.addClass(b).attr(b,b):a.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var e=a(this),d=e.data("button"),f=typeof c=="object"&&c;d||e.data("button",d=new b(this,f)),c=="toggle"?d.toggle():c&&d.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.button.data-api","[data-toggle^=button]",function(c){var b=a(c.target);b.hasClass("btn")||(b=b.closest(".btn")),b.button("toggle")})}(window.jQuery),!function(a){"use strict";var b=function(c,b){this.$element=a(c),this.$indicators=this.$element.find(".carousel-indicators"),this.options=b,this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.prototype={cycle:function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(b){var c=this.getActiveIndex(),d=this;return b>this.$items.length-1||b<0?void 0:this.sliding?this.$element.one("slid",function(){d.to(b)}):c==b?this.pause().cycle():this.slide(b>c?"next":"prev",a(this.$items[b]))},pause:function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){return this.sliding?void 0:this.slide("next")},prev:function(){return this.sliding?void 0:this.slide("prev")},slide:function(e,i){var g=this.$element.find(".item.active"),b=i||g[e](),h=this.interval,d=e=="next"?"left":"right",j=e=="next"?"first":"last",f=this,c;this.sliding=!0,h&&this.pause(),b=b.length?b:this.$element.find(".item")[j](),c=a.Event("slide",{relatedTarget:b[0],direction:d});if(b.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(f.$indicators.children()[f.getActiveIndex()]);b&&b.addClass("active")}));if(a.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(c);if(c.isDefaultPrevented())return;b.addClass(e),b[0].offsetWidth,g.addClass(d),b.addClass(d),this.$element.one(a.support.transition.end,function(){b.removeClass([e,d].join(" ")).addClass("active"),g.removeClass(["active",d].join(" ")),f.sliding=!1,setTimeout(function(){f.$element.trigger("slid")},0)})}else{this.$element.trigger(c);if(c.isDefaultPrevented())return;g.removeClass("active"),b.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return h&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var g=a(this),d=g.data("carousel"),e=a.extend({},a.fn.carousel.defaults,typeof c=="object"&&c),f=typeof c=="string"?c:e.slide;d||g.data("carousel",d=new b(this,e)),typeof c=="number"?d.to(c):f?d[f]():e.interval&&d.pause().cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(g){var b=a(this),e,c=a(b.attr("data-target")||(e=b.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},c.data(),b.data()),d;c.carousel(f),(d=b.attr("data-slide-to"))&&c.data("carousel").pause().to(d).cycle(),g.preventDefault()})}(window.jQuery),!function(a){"use strict";var b=function(c,b){this.$element=a(c),this.options=a.extend({},a.fn.collapse.defaults,b),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var d,e,b,c;if(this.transitioning||this.$element.hasClass("in"))return;d=this.dimension(),e=a.camelCase(["scroll",d].join("-")),b=this.$parent&&this.$parent.find("> .accordion-group > .in");if(b&&b.length){c=b.data("collapse");if(c&&c.transitioning)return;b.collapse("hide"),c||b.data("collapse",null)}this.$element[d](0),this.transition("addClass",a.Event("show"),"shown"),a.support.transition&&this.$element[d](this.$element[0][e])},hide:function(){var b;if(this.transitioning||!this.$element.hasClass("in"))return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(f,c,e){var b=this,d=function(){c.type=="show"&&b.reset(),b.transitioning=0,b.$element.trigger(e)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[f]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,d):d()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var e=a(this),d=e.data("collapse"),f=a.extend({},a.fn.collapse.defaults,e.data(),typeof c=="object"&&c);d||e.data("collapse",d=new b(this,f)),typeof c=="string"&&d[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.collapse.data-api","[data-toggle=collapse]",function(f){var b=a(this),d,c=b.attr("data-target")||f.preventDefault()||(d=b.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),e=a(c).data("collapse")?"toggle":b.data();b[a(c).hasClass("in")?"addClass":"removeClass"]("collapsed"),a(c).collapse(e)})}(window.jQuery),!function(a){"use strict";function e(){a(".dropdown-backdrop").remove(),a(c).each(function(){d(a(this)).removeClass("open")})}function d(d){var b=d.attr("data-target"),c;b||(b=d.attr("href"),b=b&&/#/.test(b)&&b.replace(/.*(?=#[^\s]*$)/,"")),c=b&&a(b);if(!c||!c.length)c=d.parent();return c}var c="[data-toggle=dropdown]",b=function(c){var b=a(c).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){b.parent().removeClass("open")})};b.prototype={constructor:b,toggle:function(){var b=a(this),c,f;return b.is(".disabled, :disabled")?void 0:(c=d(b),f=c.hasClass("open"),e(),f||("ontouchstart"in document.documentElement&&a('').attr("id","dragdrop-container");a.children("ul").append(b.clone());return a}});$(a).droppable({tolerance:"pointer",accept:function(a){return this!==a&&$(this).find(".listbox").hasClass("selected")===false},drop:function(e,b){var c=$(b.draggable).find(".listbox").hasClass("ui-selected")?$.map($(b.draggable).parent().parent().find(".ui-selected"),function(a){return $(a).parent().parent().data("item")}):[$(b.draggable).data("item")];if(d)d.apply(this,[c]);else $(a).trigger("onDropped",[c])}})},update:function(c,a){var d=a(),b=ko.utils.unwrapObservable(d.disabled)||false;$(c).draggable("option","disabled",b)}};ko.bindingHandlers.ellipsis={init:function(a){$(a).ellipsis()}};ko.bindingHandlers.hover={init:function(c,b){var a=b(),e=a.onIn?a.onIn:function(){},d=a.onOut?a.onOut:function(){};$(c).hover(e,d)}};ko.bindingHandlers.makeColorPicker={init:function(b,a){a()&&$(b).ColorPicker({onSubmit:function(g,f,b,c){var d=b.r*65536+b.g*256+b.b,e=a();e(d);$(c).ColorPickerHide()}})}};ko.utils.arrayPushAllOptimized=function(c,b){for(var d=c(),a=0,e=b.length;aa.length?false:a.substring(0,b.length)===b};jSaaspose.PortalService=function(b,c,a){this._init(b,c,a)};$.extend(jSaaspose.PortalService.prototype,{_urlSuffix:"",_lastError:null,_service:null,_cacheTimeout:300,applicationPath:null,useJSONP:false,_useHttpHandlers:false,urlPrefix:"document-viewer",_init:function(c,a,b){this.applicationPath=c;this._useHttpHandlers=a;if(a)this._urlSuffix="Handler";if($.browser.msie&&$.browser.version==8&&b)this.useJSONP=true},viewDocumentAsHtml:function(e,d,i,g,f,b,c,a){var h={userId:e,privateKey:d,guid:i,convertToHtml:true,index:g,count:f};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/ViewDocument"+this._urlSuffix,h,b,c,a!=null?a:true)},getDocumentPageHtml:function(e,c,a,b){var d={path:e,pageIndex:c};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetDocumentPageHtml"+this._urlSuffix,d,a,b,false)},viewDocument:function(k,i,g,h,b,f,c,d,e,a){var j={guid:k,width:i,quality:g,usePdf:h,preloadPagesCount:b,password:f,fileDisplayName:c};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/ViewDocument"+this._urlSuffix,j,d,e,a!=null?a:true)},getPdf2JavaScript:function(g,f,e,a,b,c){var d={guid:e,descForHtmlBasedEngine:a};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetPdf2JavaScript"+this._urlSuffix,d,b,c,false)},getImageUrlsAsync:function(j,d,m,e,k,f,g,h,i,c,a,b){var l={userId:j,privateKey:d,guid:m,dimension:e,token:k,firstPage:f,pageCount:g,quality:h,usePdf:i,docVersion:c};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetImageUrls"+this._urlSuffix,l,a,b,false)},loadFileBrowserTreeData:function(l,d,n,f,i,j,h,k,e,g,b,c,a){var m={userId:l,privateKey:d,path:n,pageIndex:f,pageSize:i,orderBy:j,orderAsc:h,filter:k,fileTypes:e,extended:g};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/LoadFileBrowserTreeData"+this._urlSuffix,m,b,c,a!=null?a:true)},getPrintableHtml:function(e,a,b,c){var d={path:e,displayName:a};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetPrintableHtml"+this._urlSuffix,d,b,c,false)},_runServiceSync:function(f,e,d){var a=null,b=false,c=function(c){b=true;a=c.data};this._runService(f,e,false,c,null,d);return a},_runServiceAsync:function(f,e,a,b,d,c){return this._runService(f,e,true,a,b,d,c)},_highLevelErrorHandler:function(a){window.jGDError&&window.jGDError(a.Reason)},_runService:function(h,k,m,i,c,j,l){var e=JSON.stringify(k),g=null;if(j){g=Container.Resolve("Cacher");var f=g.get(h+e);if(f){f.value.Subscribe(function(a){this._successHandler(a,i)}.bind(this),function(a){this._errorHandler(a,c,false)}.bind(this));return f.value}}var d;if(this.useJSONP)if(this._useHttpHandlers)d="data="+e.toString();else d=k;else d=e;var b=Container.Resolve("RequestObservable")({url:h,type:this.useJSONP?"GET":"POST",contentType:"application/json; charset=utf-8",dataType:this.useJSONP?"jsonp"+(l?" xml":""):null,data:d,async:m}),a=Container.Resolve("AsyncSubject");b.Finally=function(b){a.Subscribe(b)};b.Subscribe(function(b){if(b)if(b.data.success===false){var d={code:b.data.code,Reason:b.data?b.data.Reason:null};this._highLevelErrorHandler(d);c&&c(d)}else this._successHandler(b,i);a.OnNext();a.OnCompleted()}.bind(this),function(b){this._errorHandler(b,c,false);a.OnNext();a.OnCompleted()}.bind(this));j&&g.add(h+e,b,this._cacheTimeout);return b},_errorHandler:function(b,d,e){if(b.xmlHttpRequest.readyState==0)return;if(b.xmlHttpRequest.status==401){window.location=Container.Resolve("HttpProvider").buildUrl("/","sign-in",{returnUrl:window.location.href});return}var a,c=0;if(b.xmlHttpRequest.responseText!=""){var f="";try{a=eval("("+b.xmlHttpRequest.responseText+")")}catch(g){a={Reason:b.xmlHttpRequest.responseText}}c=500}else{c=404;a={Reason:"Service link is not found"}}if(this._lastError!=404&&e){this._lastError=c;if(c==404)jerror(a.Reason);else jerror()}try{d&&d(a)}catch(g){}},_successHandler:function(a,b){if(b){if(a.xmlHttpRequest.responseText=="")a.data=null;b(a)}}});(function(){var a=jQuery.event.special,b="D"+ +new Date,c="D"+(+new Date+1);a.scrollstart={setup:function(){var c,d=function(d){var b=this,e=arguments;if(c)clearTimeout(c);else{d.type="scrollstart";$(b).trigger("scrollstart")}c=setTimeout(function(){c=null},a.scrollstop.latency)};jQuery(this).bind("scroll",d).data(b,d)},teardown:function(){jQuery(this).unbind("scroll",jQuery(this).data(b))}};a.scrollstop={latency:300,setup:function(){var b,d=function(d){var c=this,e=arguments;b&&clearTimeout(b);b=setTimeout(function(){b=null;d.type="scrollstop";$(c).trigger("scrollstop")},a.scrollstop.latency)};jQuery(this).bind("scroll",d).data(c,d)},teardown:function(){jQuery(this).unbind("scroll",jQuery(this).data(c))}}})();(function(a,b){a.widget("ui.docViewer",{_viewModel:null,options:{fileId:0,fileVersion:1,userId:0,userKey:null,baseUrl:null,_mode:"full",_docGuid:"",quality:null,use_pdf:"true",showHyperlinks:true},_create:function(){a.extend(this.options,{documentSpace:this.element});this.options.createHtml&&this._createHtml();this._viewModel=this.getViewModel();ko.applyBindings(this._viewModel,this.element.get(0))},_init:function(){a(this._viewModel).bind("getPagesCount",function(c,b){a(this.element).trigger("getPagesCount",[b])}.bind(this));a(this._viewModel).bind("onDocumentLoaded",function(b,a){this.element.trigger("onDocumentLoaded",a)}.bind(this));a(this._viewModel).bind("onDocumentPasswordRequired",function(){a(this.element).trigger("onDocumentPasswordRequired")}.bind(this));a(this._viewModel).bind("_onProcessPages",function(c,b){a(this.element).trigger("_onProcessPages",[b])}.bind(this));a(this._viewModel).bind("onProcessPages",function(c,b){a(this.element).trigger("onProcessPages",[b])}.bind(this));a(this._viewModel).bind("onScrollDocView",function(c,b){a(this.element).trigger("onScrollDocView",[b])}.bind(this));a(this._viewModel).bind("onBeforeScrollDocView",function(c,b){a(this.element).trigger("onBeforeScrollDocView",[b])}.bind(this));a(this._viewModel).bind("onDocumentLoadComplete",function(d,c,b){a(this.element).trigger("onDocumentLoadComplete",[c,b])}.bind(this));a(this._viewModel).bind("onSearchPerformed",function(c,b){a(this.element).trigger("onSearchPerformed",[b])}.bind(this));a(this._viewModel).bind("onPageImageLoaded",function(){a(this.element).trigger("onPageImageLoaded")}.bind(this));a(this._viewModel).bind("onDocViewScrollPositionSet",function(c,b){a(this.element).trigger("onDocViewScrollPositionSet",[b])}.bind(this));a(this._viewModel).bind("onDocumentPageSet",function(c,b){a(this.element).trigger("onDocumentPageSet",[b])}.bind(this))},getViewModel:function(){if(this._viewModel==null)this._viewModel=this._createViewModel();return this._viewModel},_createViewModel:function(){return new docViewerViewModel(this.options)},applyBindings:function(){ko.applyBindings(this._viewModel,this.element.get(0))},_createHtml:function(){var c='

Loading your content...

'+(this.options.pageContentType=="image"?'
":'
")+"
",b=this.element;a(c).appendTo(b);b.trigger("onHtmlCreated");this.element=a("#"+this.options.docViewerId)}});docViewerModel=function(b){a.extend(this,b);this._init()};a.extend(docViewerModel.prototype,{_init:function(){this._portalService=Container.Resolve("PortalService")},loadDocument:function(d,e,b,g,f,h,a){var c=function(b){if(b.data!=null&&typeof b.data.guid!=="undefined")h.apply(this,[b.data]);else a.apply(this,[{code:b.data.code,Reason:b.data?b.data.Reason:null}])};switch(this._mode){case"embed":this._portalService.viewEmbedDocumentAllAsync(this.userId,this.userKey,d,b,this.quality,this.use_pdf,this.preloadPagesCount,g,f,c,a);break;case"webComponent":this._portalService.viewDocument(d,b,this.quality,this.use_pdf,this.preloadPagesCount,g,f,c,a);break;case"annotatedDocument":this._portalService.viewAnnotatedDocumentAsync(this.userId,this.userKey,d,null,e,b,null,this.quality,this.use_pdf,c,a,false);break;default:this._portalService.viewDocumentAllAsync(this.userId,this.userKey,d,null,e,b,null,this.quality,this.use_pdf,c,a,false)}},loadDocumentAsHtml:function(d,b,c,a){this._portalService.viewDocumentAsHtml(this.userId,this.userKey,d,1,b,function(b){if(b.data&&typeof b.data.guid!=="undefined")c.apply(this,[b.data]);else a.apply(this)},function(b){a.apply(this,[b])},false)},loadProperties:function(b,a){this._portalService.getDocInfoAsync(this.userId,this.userKey,b,function(b){a.apply(this,[b.data])})},loadHyperlinks:function(c,b,a){this._portalService.getDocumentHyperlinks(c,function(a){b.apply(this,[a.data])},function(b){a.apply(this,[b])})},retrieveImageUrls:function(e,f,c,a,d,b){this._portalService.getImageUrlsAsync(this.userId,this.userKey,e,a,f,0,c,this.quality==null?"":this.quality,this.use_pdf,this.fileVersion,function(a){d.apply(this,[a.data])},function(a){b.apply(this,[a])})},getDocumentPageHtml:function(d,b,c,a){this._portalService.getDocumentPageHtml(d,b,function(a){c.apply(this,[a.data])},function(b){a.apply(this,[b])})}});docViewerViewModel=function(b){a.extend(this,b);this._create(b)};a.extend(docViewerViewModel.prototype,{_model:null,pagesDimension:null,pageImageWidth:0,imageHorizontalMargin:34,imageVerticalMargin:0,initialZoom:100,zoom:null,scale:null,docWasLoadedInViewer:false,scrollPosition:[0,0],inprogress:null,pages:null,pageInd:null,pageWidth:null,pageHeight:null,pageCount:null,docType:null,fileId:null,_dvselectable:null,_thumbnailHeight:140,_firstPage:null,_sessionToken:"",imageUrls:[],pagePrefix:"page-",documentName:null,fit90PercentWidth:false,_pageBounds:null,unscaledPageHeight:null,pageLeft:null,alwaysOnePageInRow:false,preloadPagesCount:0,viewerStyle:1,changedUrlHash:false,hashPagePrefix:"page",pageContentType:"image",scrollbarWidth:null,password:null,useJavaScriptDocumentDescription:false,minimumImageWidth:null,fileDisplayName:null,hyperlinks:null,options:{showHyperlinks:true},_create:function(a){this._model=new docViewerModel(a);this._init(a)},_init:function(a){var c=852,d=1100;this.pageImageWidth=c;this.pages=ko.observableArray([]);this.scale=ko.observable(this.initialZoom/100);this.inprogress=ko.observable(false),this.pageLeft=ko.observable(0);this.pageInd=ko.observable(1);this.pageWidth=ko.observable(c);this.pageHeight=ko.observable(d);this.pageCount=ko.observable(0);this.docType=ko.observable(-1);this.documentName=ko.observable("");this.password=ko.observable("");this.preloadPagesCount=a.preloadPagesCount;this.viewerStyle=a.viewerStyle;this.browserIsChrome=ko.observable(false);this.hyperlinks=ko.observableArray();if(this.pageContentType=="html")this.imageHorizontalMargin=0;if(!this.docViewerId)this.docViewerId=this.documentSpace.attr("id");this.pagePrefix=this.docViewerId+"-page-";if(a.fit90PercentWidth)this.pageImageWidth=this.documentSpace.width()*.9-2*this.imageHorizontalMargin;if(this.pageContentType=="image")this.initialWidth=this.pageImageWidth;if(this.zoomToFitWidth)this.initialWidth=this.pageImageWidth=this.getFitWidth();this.zoom=ko.observable(this.initialZoom);this.options.showHyperlinks=a.showHyperlinks!=false&&this.use_pdf!="false";var b;if(this.pages().length==0){b={number:1,visible:ko.observable(false),url:ko.observable(""),htmlContent:ko.observable("")};if(this.variableHeightPageSupport)b.prop=1;this.pages.push(b)}if(a.fileId)this.loadDocument();else b.visible(true)},loadDocument:function(a){this.inprogress(true);var c=1;if(this.pageContentType=="image"){var b;if(this.shouldMinimumWidthBeUsed(this.pageImageWidth*this.initialZoom/100,false))b=this.minimumImageWidth;else b=Math.round(this.pageImageWidth*this.initialZoom/100);this._model.loadDocument(a||this.fileId,c,b,this.password(),this.fileDisplayName,function(b){if(typeof a!=="undefined")this.fileId=a;this.pageWidth(this.pageImageWidth*(this.initialZoom/100));this.zoom(this.initialZoom);this.docWasLoadedInViewer&&this.setPageNumerInUrlHash(1);this._onDocumentLoadedBeforePdf2Xml(b)}.bind(this),function(a){this._onDocumentLoadFailed(a)}.bind(this))}else this.pageContentType=="html"&&this._model.loadDocumentAsHtml(a||this.fileId,c,function(b){if(typeof a!=="undefined")this.fileId=a;this.pageWidth(this.pageImageWidth*(this.initialZoom/100));this._onDocumentLoadedBeforePdf2Xml(b)}.bind(this),function(a){this._onDocumentLoadFailed(a)}.bind(this));typeof viewModelPathOnlineDoc!=="undefined"&&viewModelPathOnlineDoc.pathOnlineDoc("")},getDocumentPageHtml:function(b){var a=this.pages()[b];if(!a.visible()&&!a.startedDownloadingPage){a.startedDownloadingPage=true;this._model.getDocumentPageHtml(this.fileId,b,function(f){var e=f,d=this.getPageBodyContents(e);a.htmlContent(d);a.visible(true);a.startedDownloadingPage=false;var c=this.documentSpace.find(".doc-page:nth-child("+(b+1)+") .html_page_contents > div");a.prop=c.height()/c.width();this.fixImageReferencesInHtml(c)}.bind(this),function(b){a.startedDownloadingPage=false;this._onError(b)}.bind(this))}},retrieveImageUrls:function(d){var a,c,b;if(this.shouldMinimumWidthBeUsed(this.pageWidth(),true))b=this.minimumImageWidth;else b=this.pageWidth();c=Math.floor(b)+"x";this._model.retrieveImageUrls(this.fileId,this._sessionToken,d,c,function(b){for(a=0;a"+t+"").appendTo("head");var s=c.pageHtml,p=this.getPageBodyContents(s),m=this.pages()[0];m.htmlContent(p);m.visible(true);this.urlForImagesInHtml=c.urlForImagesInHtml;var j=this.documentSpace.find(".html_page_contents:first > div");e=this._pdf2XmlWrapper.documentDescription.pages;m.prop=e[0].h/e[0].w;this.fixImageReferencesInHtml(j);var w=Math.round(j.width()),v=Math.round(j.height());f=this._pdf2XmlWrapper.getPageSize();c.page_size.Width=f.width;c.page_size.Height=f.height;var o=e[0].w;this.pointToPixelRatio=j.width()/o;this.heightWidthRatio=parseFloat(c.page_size.Height/c.page_size.Width);this.pageWidth(f.width*this.pointToPixelRatio);this.pageHeight(Math.round(this.pageWidth()*this.heightWidthRatio))}this.pagesContainerElement=this.documentSpace.find(".pages_container");var n=this.pageCount(),d,i=[],g;if(this.pageContentType=="image"){var l;if(this.variableHeightPageSupport)e=this._pdf2XmlWrapper.documentDescription.pages;for(d=0;dh.pageCount())a=h.pageCount();if(a<1)a=1;h.setPage(a)}}}).run()}else this.setPage(1);this.zoomToFitHeight&&this.setZoom(this.getFitHeightZoom());this.docWasLoadedInViewer=true;this.pageContentType=="image"&&this._mode!="webComponent"&&this._mode!="annotatedDocument"&&this._loadHyperlinks();a(this).trigger("onScrollDocView",{pi:1,direction:"up",position:0});a(this).trigger("onDocumentLoadComplete",[c,this._pdf2XmlWrapper])},_onDocumentHyperlinksLoaded:function(b){if(!b||!b.links){this.hyperlinks.removeAll();return}var d=[],e=this,c=this.getSelectableInstance();a.each(b.links,function(){var a={url:this.Url,pageNumber:this.PageNumber,targetPage:this.TargetPage,rect:new jSaaspose.Rect(this.Bounds.X,this.Bounds.Y,this.Bounds.X+this.Bounds.Width,this.Bounds.Y+this.Bounds.Height)};a.frame=ko.observable(c!=null?c.convertPageAndRectToScreenCoordinates(a.pageNumber,a.rect):a.rect);d.push(a)});this.hyperlinks(d)},_loadHyperlinks:function(){this.options.showHyperlinks==true&&this._model.loadHyperlinks(this.fileId,this._onDocumentHyperlinksLoaded.bind(this),function(){})},_refreshHyperlinkFrames:function(){var b=this.getSelectableInstance();a.each(this.hyperlinks(),function(){this.frame(b!=null?b.convertPageAndRectToScreenCoordinates(this.pageNumber,this.rect):this.rect)})},setPageWidth:function(a){this.pageImageWidth=a},getFitWidth:function(){var a;if(this.viewerWidth)a=this.viewerWidth;else a=this.documentSpace.width();var b=this.getScrollbarWidth();return a-b-2*(this.imageHorizontalMargin+1)},getFitWidthZoom:function(){return this.getFitWidth()/this.initialWidth*100},getFitHeightZoom:function(){var a;if(this.viewerHeight)a=this.viewerHeight;else a=this.documentSpace.parent().height();return(a-(this.imageVerticalMargin+2))/Math.round(this.initialWidth*this.heightWidthRatio)*100},getScrollbarWidth:function(){if(this.scrollbarWidth==null){var c=a("
").css("width","100px").css("height","100px").css("overflow","scroll").css("position","absolute").css("top","-9999px"),b=c[0];document.body.appendChild(b);this.scrollbarWidth=b.offsetWidth-b.clientWidth;document.body.removeChild(b)}return this.scrollbarWidth},getPageHeight:function(){return this.unscaledPageHeight*this.scale()},getSelectable:function(){return this._dvselectable},_onPropertiesLoaded:function(b){a(this).trigger("onDocumentLoaded",{fileId:this.fileId,response:b})},getFileId:function(){return this.fileId},ScrollDocView:function(x,v){var t=this.isSetCalled;this.isSetCalled=false;if(t)return;var w,b=null,u=this.documentSpace.height(),c=a(v.target).scrollTop();a(this).trigger("onBeforeScrollDocView",{position:c});if(this.variableHeightPageSupport){var q=this.getSelectableInstance();if(q==null)return null;var p=q.pageLocations,i,o,r=this.pages();if(p.length!=r.length)return null;for(var l=this.getVisiblePagesNumbers(),s=this.documentSpace.height(),m=null,f=null,n,j,k,g,d=l.start-1;d<=l.end-1;d++){i=p[d].y;pageHeight=r[d].prop*this.pageWidth();o=Math.floor(i+pageHeight);n=Math.max(i,c);j=Math.min(o,c+s);k=j-n;g=k/pageHeight;if(f==null||g>f){f=g;m=d}}b=m+1}else if(this._firstPage!=null){b=(c+u/2)/this._firstPage.outerHeight(true);var e=Math.floor(this.pagesContainerElement.width()/this._firstPage.width());if(e==0)e=1;if(this.alwaysOnePageInRow)e=1;b=b>>0;var h=this.pageCount();if(b!=h)b=b+1;b=(b-1)*e+1;if(b>h)b=h}if(b!==null){this.pageInd(b);this.setPageNumerInUrlHash(b);a(this).trigger("onScrollDocView",{pi:b,position:c});this.documentSpace.trigger("documentScrolledToPage.groupdocs",[b])}},ScrollDocViewEnd:function(d,b){this.isSetCalled=false;this.scrollPosition=[a(b.target).scrollLeft(),a(b.target).scrollTop()];var c=this.loadImagesForVisiblePages();this._dvselectable&&a(this._dvselectable).dvselectable("setVisiblePagesNumbers",c);a(this).trigger("onDocumentPageSet",[this.pageInd()]);this.documentSpace.trigger("documentScrolledToPage.groupdocs",[this.pageInd()])},getVisiblePagesNumbers:function(){var f=null,g=null,a=this.documentSpace.scrollTop(),c,k=null,h=this.documentSpace.height();if(this.variableHeightPageSupport){var l=this.getSelectableInstance();if(l==null)return null;var j=l.pageLocations,e,i,n=this.pages();if(j.length!=n.length)return null;for(var d=0;d=a&&e<=a+h||i>=a&&i<=a+h||e<=a&&i>=a+h)if(f===null)f=d+1;else g=d+1}if(g===null)g=f}else if(this._firstPage!=null){c=this._firstPage.outerHeight(true);var o=this._firstPage.outerWidth(true),p=this.pagesContainerElement.width();k=Math.floor(a/c)+1;var m=Math.floor((a+h)/c)+1,b=Math.floor(p/o);if(b==0)b=1;if(this.alwaysOnePageInRow)b=1;f=k!=1?(k-1)*b+1:1;g=m*b<=this.pageCount()?m*b:this.pageCount()}return{start:f,end:g}},loadImagesForVisiblePages:function(){var b=this.getVisiblePagesNumbers();if(b!=null){var c=b.start,e=b.end;if(c!==null&&e!==null)for(var a=c;a<=e;a++){var d=this.pages()[a-1];if(this.pageContentType=="image")this.triggerImageLoadedEvent(a);else if(this.pageContentType=="html")!d.visible()&&this.getDocumentPageHtml(a-1);d.visible(true)}}return b},setPage:function(b){this.isSetCalled=true;this.pageInd(b);var c;if(this.variableHeightPageSupport){var f=this.getSelectableInstance();if(f!=null){var i=f.pageLocations[b-1].y;c=i}}else{var d=Math.floor(this.pagesContainerElement.width()/this._firstPage.width());if(d==0)d=1;if(this.alwaysOnePageInRow)d=1;var j=Math.ceil(b/d)-1;c=j*this._firstPage.outerHeight(true)}var h=this.documentSpace.scrollTop();this.documentSpace.scrollTop(c);if(this.documentSpace.scrollTop()==h)this.isSetCalled=false;a(this).trigger("onDocViewScrollPositionSet",{position:c});if(this.pageContentType=="image"){this.triggerImageLoadedEvent(b);this.pages()[b-1].visible(true)}else if(this.pageContentType=="html"){var g=this.pages()[b-1];if(!g.visible()){g.visible(true);this.getDocumentPageHtml(b-1)}}var e=Number(b);this.setPageNumerInUrlHash(e);a(this).trigger("onDocumentPageSet",[e])},triggerImageLoadedEvent:function(b){if(a.browser.msie)!this.pages()[b-1].visible()&&a("img#img-"+b).load(function(){a(this).trigger("onPageImageLoaded")})},setZoom:function(b){this.zoom(b);this.loadPagesZoomed();if(this.pageContentType=="image"){if(this._pdf2XmlWrapper){var d=this._pdf2XmlWrapper.getPageSize();this.scale(this.pageImageWidth/d.width*b/100)}this._dvselectable.dvselectable("changeSelectedRowsStyle",this.scale());var c=this.getVisiblePagesNumbers(),a=Math.floor(this.pagesContainerElement.width()/this._firstPage.width());if(a==0)a=1;if(this.alwaysOnePageInRow)a=1;this._dvselectable.dvselectable("reInitPages",this.scale(),c,this.scrollPosition,this.getPageHeight(),a);this.recalculatePageLeft();this.setPage(this.pageInd());this.shouldMinimumWidthBeUsed(this.pageWidth(),true)&&this.loadImagesForVisiblePages();this.options.showHyperlinks&&this._refreshHyperlinkFrames()}else this.pageContentType=="html"&&this.loadImagesForVisiblePages()},loadPagesZoomed:function(){var a=Math.round(this.initialWidth*this.zoom()/100),b=Math.round(a*this.heightWidthRatio);if(a!=this.pageWidth()||b!=this.pageHeight()){this.pagesDimension=Math.floor(a)+"x";this.pageWidth(a);this.pageHeight(b);if(this.pageContentType=="image"){var c=this.pageCount();!this.shouldMinimumWidthBeUsed(a,true)&&this.retrieveImageUrls(c)}}},performSearch:function(d){var b=this.getSelectableInstance();if(b!=null){var c=b.performSearch(d,this.zoom()/100);a(this).trigger("onSearchPerformed",[c])}},selectTextInRect:function(e,c,d,b){return this._dvselectable?a(this._dvselectable).dvselectable("highlightPredefinedArea",e,c,d,b):null},deselectTextInRect:function(e,c,d,b){this._dvselectable&&a(this._dvselectable).dvselectable("unhighlightPredefinedArea",e,c,d,b)},recalculatePageLeft:function(){if(this._firstPage!=null&&this.pagesContainerElement!=null){var a=this._firstPage.offset().left-this.pagesContainerElement.offset().left;this.pageLeft(a)}},reInitSelectable:function(){var a=this.getVisiblePagesNumbers();this._dvselectable!=null&&this._dvselectable.dvselectable("reInitPages",this.scale(),a,this.scrollPosition,this.getPageHeight())},reInitCanvasOffset:function(){var a=this.getSelectableInstance();a.initCanvasOffset()},openCurrentPage:function(){this.setPage(this.pageInd())},setPageNumerInUrlHash:function(a){if(this.usePageNumberInUrlHash===b||this.usePageNumberInUrlHash==true)if(location.hash!=""||a>1){this.changedUrlHash=true;location.hash=this.hashPagePrefix+a.toString();this.changedUrlHash=false}},isScrollViewerVisible:function(){return this.documentSpace.is(":visible")},getSelectableInstance:function(){if(this._dvselectable==null)return null;var a=this._dvselectable.data("ui-dvselectable");if(!a)a=this._dvselectable.data("dvselectable");return a},shouldMinimumWidthBeUsed:function(d,b){var a=null;if(this.use_pdf!="false"&&b){var c=this._pdf2XmlWrapper.getPageSize();a=c.width}return this.minimumImageWidth!=null&&(d<=this.minimumImageWidth||a!==null&&a]*>((?:.|\r?\n)*?)<\/body>/)[1]},fixImageReferencesInHtml:function(e){var d=e.find("object[type='image/svg+xml']"),b,c=this.urlForImagesInHtml;d.each(function(){var d=a(this);b=d.attr("data");b=c.replace("(0)",b);d.attr("data",b);var e=d.children();e.attr("data",b)})}})})(jQuery);DocViewerAdapter=function(a){$.extend(this,a);this.init()};$.extend(DocViewerAdapter.prototype,{docViewerWidget:null,docViewerViewModel:null,navigationWidget:null,navigationViewModel:null,thumbnailsWidget:null,thumbnailsViewModel:null,zoomViewModel:null,init:function(){var g=null,e=null,d=null,l=null,i=null,n=null,b=null,h=null,c=null,f=null,k=null,j=null;if(this.docSpace){g=this.docSpace.docViewer({userId:this.userId,userKey:this.userKey,baseUrl:this.baseUrl,fileId:this.fileId,fileVersion:this.fileVersion,quality:this.quality,use_pdf:this.use_pdf,pageImageWidth:this.pageImageWidth,_mode:this._mode,docViewerId:this.docViewerId,createHtml:this.createHtml,initialZoom:this.initialZoom,alwaysOnePageInRow:this.alwaysOnePageInRow,zoomToFitWidth:this.zoomToFitWidth,zoomToFitHeight:this.zoomToFitHeight,viewerWidth:this.viewerWidth,viewerHeight:this.viewerHeight,preloadPagesCount:this.preloadPagesCount,selectionContent:this.selectionContent,viewerStyle:this.viewerStyle,usePageNumberInUrlHash:this.usePageNumberInUrlHash,pageContentType:this.pageContentType,imageHorizontalMargin:this.imageHorizontalMargin,imageVerticalMargin:this.imageVerticalMargin,useJavaScriptDocumentDescription:this.useJavaScriptDocumentDescription,searchPartialWords:this.searchPartialWords,variableHeightPageSupport:this.variableHeightPageSupport,textSelectionSynchronousCalculation:this.textSelectionSynchronousCalculation,minimumImageWidth:this.minimumImageWidth,fileDisplayName:this.fileDisplayName});b=this.docSpace.docViewer("getViewModel")}else{g=this.docSpaceCreator();b=this.docSpaceViewModel()}var m=null,a=null;if(this.docSpacePageFlip){m=this.docSpacePageFlip.docViewerPageFlip({userId:this.userId,userKey:this.userKey,baseUrl:this.baseUrl,fileId:this.fileId,fileVersion:this.fileVersion,quality:this.quality,use_pdf:this.use_pdf,pageImageWidth:this.pageImageWidth,_mode:this._mode,docViewerId:this.docViewerId,createHtml:this.createHtml,initialZoom:this.initialZoom,alwaysOnePageInRow:this.alwaysOnePageInRow,zoomToFitWidth:this.zoomToFitWidth,zoomToFitHeight:this.zoomToFitHeight,viewerWidth:this.viewerWidth,viewerHeight:this.viewerHeight,selectionContent:this.selectionContent,minimumImageWidth:this.minimumImageWidth});a=this.docSpacePageFlip.docViewerPageFlip("getViewModel")}if(this.navigation){e=this.navigation.navigation(this.navigationOptions);h=this.navigation.navigation("getViewModel")}if(this.search){i=this.search.search(this.searchOptions);k=this.search.search("getViewModel")}if(this.zooming){l=this.zooming.zooming(this.zoomingOptions||{});f=this.zooming.zooming("getViewModel")}if(this.thumbnails){d=this.thumbnails.thumbnails(this.thumbnailsOptions||{baseUrl:this.baseUrl,quality:this.quality,use_pdf:this.use_pdf});c=this.thumbnails.thumbnails("getViewModel")}else{d=this.thumbnailsCreator();c=this.thumbnailsViewModelCreator()}if(this.embedSource){n=this.embedSource.embedSource();j=this.embedSource.embedSource("getViewModel")}this.docViewerViewModel=b;this.docViewerPageFlipViewModel=a;this.navigationViewModel=h;this.thumbnailsViewModel=c;this.zoomViewModel=f;this.searchViewModel=k;this.embedSourceViewModel=j;g.bind("getPagesCount",function(b,a){e&&h.setPagesCount(a)}.bind(this));g.bind("_onProcessPages",function(h,g,f,a,e,b){if(d)c.onProcessPages(g,f,a,e,b)}.bind(this));g.bind("onScrollDocView",function(b,a){d&&c.setThumbnailsScroll(a);e&&h.setPageIndex(a.pi);i&&k.scrollPositionChanged(a.position)}.bind(this));g.bind("onSearchPerformed",function(){i}.bind(this));g.bind("onDocumentPageSet",function(c,b){if(a)a.onDocumentPageSet(b)});g.bind("onDocumentLoadComplete",function(g,c,d){a&&a._onDocumentLoaded(c,d);var e=c.url;$("#btnDownload,#btnDownload2").bind({click:function(){window.location.href=e;return false}});if(n){j.setGuid(c.guid);j.setFileId(b.getFileId());j.password(b.password())}if(l)if(b.isScrollViewerVisible()){f.setFitWidthZoom(b.getFitWidthZoom());f.setFitHeightZoom(b.getFitHeightZoom());f.setZoomWithoutEvent(b.zoom())}else{f.setFitWidthZoom(a.getFitWidthZoom());f.setFitHeightZoom(a.getFitHeightZoom());f.setZoomWithoutEvent(a.zoom())}i&&k.documentLoaded()}.bind(this));m&&m.bind("onPageTurned",function(f,a){e&&h.setPageIndex(a);d&&c.pageInd(a);b.pageInd(a);b.setPageNumerInUrlHash(a)});i&&i.bind("onPerformSearch",function(c,a){b.performSearch(a)});if(e){e.bind("onUpNavigate",function(f,e){a&&a.setPage(e);b.setPage(e);if(d){c.setPageWithoutEvent(e);c.setThumbnailsScroll({pi:e,direction:"up"})}}.bind(this));e.bind("onDownNavigate",function(f,e){a&&a.setPage(e);b.setPage(e);if(d){c.setPageWithoutEvent(e);c.setThumbnailsScroll({pi:e,direction:"down"})}}.bind(this));e.bind("onSetNavigate",function(f,e){a&&a.setPage(e.pageIndex);b.setPage(e.pageIndex);if(d){c.setPageWithoutEvent(e.pageIndex);c.setThumbnailsScroll({pi:e.pageIndex,direction:e.direction})}}.bind(this))}l&&l.bind("onSetZoom",function(d,c){a&&a.setZoom(c);b.setZoom(c);i&&k.resetButtons()}.bind(this));if(d){d.bind("onSetThumbnails",function(d,c){b.setPage(c);a&&a.setPage(c);e&&h.setPageIndex(c)}.bind(this));d.bind("onSetThumbnailsScroll",function(b,a){e&&h.setPageIndex(a)}.bind(this))}},thumbnailsCreator:function(){},thumbnailsViewModelCreator:function(){return{"set":function(){},setThumbnailsScroll:function(){},onProcessPages:function(){}}}});jSaaspose.Point=function(a,b){this.x=a||0;this.y=b||0};$.extend(jSaaspose.Point.prototype,{x:0,y:0,clone:function(){return new jSaaspose.Point(this.x,this.y)}});jSaaspose.Rect=function(a,c,b,d){this.set(a,c,b,d)};$.extend(jSaaspose.Rect.prototype,{topLeft:null,bottomRight:null,clone:function(){return new jSaaspose.Rect(this.topLeft.x,this.topLeft.y,this.bottomRight.x,this.bottomRight.y)},"set":function(a,c,b,d){if(!this.topLeft)this.topLeft=new jSaaspose.Point;if(!this.bottomRight)this.bottomRight=new jSaaspose.Point;this.topLeft.x=Math.min(a,b);this.topLeft.y=Math.min(c,d);this.bottomRight.x=Math.max(a,b);this.bottomRight.y=Math.max(c,d);return this},add:function(a){this.topLeft.x+=a.x;this.topLeft.y+=a.y;this.bottomRight.x+=a.x;this.bottomRight.y+=a.y;return this},subtract:function(a){this.topLeft.x-=a.x;this.topLeft.y-=a.y;this.bottomRight.x-=a.x;this.bottomRight.y-=a.y;return this},scale:function(a){this.topLeft.x*=a;this.topLeft.y*=a;this.bottomRight.x*=a;this.bottomRight.y*=a;return this},left:function(){return this.topLeft.x},top:function(){return this.topLeft.y},right:function(){return this.bottomRight.x},bottom:function(){return this.bottomRight.y},width:function(){return this.bottomRight.x-this.topLeft.x},height:function(){return this.bottomRight.y-this.topLeft.y},setLeft:function(a){this.topLeft.x=a},setTop:function(a){this.topLeft.y=a},setRight:function(a){this.bottomRight.x=a},setBottom:function(a){this.bottomRight.y=a},contains:function(a){return this.topLeft.x<=a.x&&a.x<=this.bottomRight.x&&this.topLeft.y<=a.y&&a.y<=this.bottomRight.y},includes:function(a){return this.contains(a.topLeft)&&this.contains(a.bottomRight)},intersects:function(a){return!(this.topLeft.x>a.bottomRight.x||this.bottomRight.xa.bottomRight.y||this.bottomRight.y
",searchTemplate:"
",addTemplate:"
",cAreaPageIndex:0,cAreaFieldIndex:0,annotationContainer:"
{1}
",annotationTemplate:"
",timeouts:[],flag:0,options:{appendTo:"body",txtarea:"",pdf2XmlWrapper:null,startNumbers:null,pagesCount:0,proportion:1,cancel:":input,option,.comment",bookLayout:false,docSpace:""},_canvasOffset:null,_canvasScroll:null,_mouseStartPos:null,_selectionInfo:{position:-1,length:0},SelectionModes:{SelectText:0,SelectRectangle:1,SelectTextToStrikeout:2,ClickPoint:3,TrackMouseMovement:4,DoNothing:5},_mode:null,rightMargin:35,parentElement:null,_viewModel:null,selectionCounter:0,_create:function(){this.initCanvasOffset();if(!this.options.initializeStorageOnly){this.dragged=false;this._mouseInit();this.helper=a("
");this.createEventHandlers();this._mode=this.SelectionModes.SelectText;this.pagePrefix=this.options.pagePrefix}},createEventHandlers:function(){var b=this;a.ctrl("C",function(){var c=a(document.activeElement),d=c.attr("id");if(d!=b.options.txtarea.attr("id")&&(c.is("input")||c.is("textarea")))return;b.options.txtarea.focus().select()});a(b.element).bind({click:function(a){b.mouseClickHandler(a)}})},_init:function(){if(this.options.pdf2XmlWrapper==null)return;this.initStorage()},destroy:function(){this._mouseDestroy();return this},initStorage:function(){var a=this.pageLocations=this._getPageLocations();if(this.options.pdf2XmlWrapper!=null)if(this.options.bookLayout)this.pages=this.options.pdf2XmlWrapper.getPages(this.options.proportion,a,this.options.startNumbers.start-1,this.options.startNumbers.end-1);else this.pages=this.options.pdf2XmlWrapper.getPages(this.options.proportion,a,0,this.options.pagesCount-1)},initCanvasOffset:function(){this.parentElement=this.options.docSpace.parent();var b=this.element.parent().offset().left,a=this.element.parent().offset().top;if(this.options.bookLayout)a=this.parentElement.offset().top;this._canvasOffset=new jSaaspose.Point(b,a)},_getPageLocations:function(){var b=this,d=this.options.docSpace.attr("id"),e=".page-image",c=this.element.find(e);if(this.options.bookLayout)c=c.filter("[id='"+d+"-img-"+this.options.startNumbers.start.toString()+"'],[id='"+d+"-img-"+this.options.startNumbers.end.toString()+"']");this._canvasScroll=this.getCanvasScroll();return a.map(c,function(c){var d=a(c).offset().left-b._canvasOffset.x+b._canvasScroll.x,e=b.options.bookLayout?0:a(c).offset().top-b.element.offset().top;return new jSaaspose.Point(d,e)})},getCanvasScroll:function(){return this.options.bookLayout?new jSaaspose.Point(this.parentElement.scrollLeft(),this.parentElement.scrollTop()):new jSaaspose.Point(this.element.parent().scrollLeft(),this.element.parent().scrollTop())},_mouseStart:function(a){this.element.find(".selection-highlight:not(.static)").remove();if(this._mode==this.SelectionModes.DoNothing)return;this.selectionCounter++;this._canvasScroll=this.getCanvasScroll();if(this.options.bookLayout)this._canvasScroll.y+=this.parentElement.parent().scrollTop();this._mouseStartPos=new jSaaspose.Point(a.pageX-this._canvasOffset.x+this._canvasScroll.x,a.pageY-this._canvasOffset.y+this._canvasScroll.y);if(this.checkMouseIsInEdgeInBookMode(this._mouseStartPos.x,this._mouseStartPos.y))return;if(this._mode==this.SelectionModes.TrackMouseMovement){var b=this._mouseStartPos.y,d=this.findPageAtVerticalPosition(b),c=parseInt(d.pageId)-1;this.element.trigger("onMouseMoveStarted",[c,{left:this._mouseStartPos.x,top:b}])}else{this.element.append(this.helper);this.helper.css({left:this._mouseStartPos.x,top:this._mouseStartPos.y,width:0,height:0})}this.options.txtarea.val("");this.lasso=new jSaaspose.Rect},_mouseDrag:function(e){if(this._mode==this.SelectionModes.DoNothing)return;var j=this.element.width(),i=this.element.height(),l=100,k=100;if(this.checkMouseIsInEdgeInBookMode(this._mouseStartPos.x,this._mouseStartPos.y))return;this.dragged=true;var a=this._mouseStartPos.x,c=this._mouseStartPos.y,b=e.pageX-this._canvasOffset.x+this._canvasScroll.x,d=e.pageY-this._canvasOffset.y+this._canvasScroll.y,g=b,h=d;if(a>b){var f=b;b=a;a=f}if(c>d){var f=d;d=c;c=f}this.lasso.set(a,c,b,d);this._mode!=this.SelectionModes.ClickPoint&&this._mode!=this.SelectionModes.TrackMouseMovement&&this.helper.css({left:a,top:c,width:this.lasso.width(),height:this.lasso.height()});this.findSelectedPages();this.element.trigger("onMouseDrag",[{left:g,top:h}]);return false},_mouseStop:function(s){if(this._mode==this.SelectionModes.DoNothing)return;this.helper.remove();var u=this._findPageAt(this.lasso.topLeft)||this.pages[0],j,i=parseInt(u.pageId)-1;if(this._mode==this.SelectionModes.SelectText||this._mode==this.SelectionModes.SelectTextToStrikeout){if(!this.dragged)return false;var v=this;this.dragged=false;var b=v._getDocumentHighlightRects();if(!b||b.length==0)return false;var n="",c;if(this.options.storeAnnotationCoordinatesRelativeToPages)c=this.convertRectToRelativeToPageUnscaledCoordinates(this.lasso);else c=this.convertRectToAbsoluteCoordinates(this.lasso);var f=c.top(),e=c.bottom();c=b[0].originalRect;for(var m=c.left(),l=c.right(),h=c.top(),g=c.bottom(),o=b[0].position,q=b[b.length-1].position+b[b.length-1].length-o,d=0;d0&&(b[d-1].page!=b[d].page||b[d-1].row!=b[d].row)?"\r\n":" ";c=b[d].originalRect;m=Math.min(m,c.left());l=Math.max(l,c.right());h=Math.min(h,c.top());g=Math.max(g,c.bottom())}var t=this.options.proportion;if(this.options.storeAnnotationCoordinatesRelativeToPages){f=Math.max(h,f);e=Math.min(g,e)}else{j=i*this.options.pageHeight;j/=t;f=Math.max(j+h,f);e=Math.min(j+g,e)}var r=new jSaaspose.Rect(m,f,l,e),p=r.clone();this.options.txtarea.val(a.trim(n)).focus().select()}switch(this._mode){case this.SelectionModes.SelectText:this.element.trigger("onTextSelected",[i,p,o,q,this.selectionCounter]);break;case this.SelectionModes.SelectTextToStrikeout:this.element.trigger("onTextToStrikeoutSelected",[i,p,o,q,this.selectionCounter]);break;case this.SelectionModes.SelectRectangle:var k;if(this.options.storeAnnotationCoordinatesRelativeToPages)k=this.convertRectToRelativeToPageUnscaledCoordinates(this.lasso,this._mouseStartPos);else k=this.convertRectToAbsoluteCoordinates(this.lasso,this._mouseStartPos);this.element.trigger("onRectangleSelected",[i,k]);break;case this.SelectionModes.ClickPoint:this.mouseClickHandler(s);break;case this.SelectionModes.TrackMouseMovement:a(this.element).trigger("onMouseMoveStopped",[])}return false},mouseClickHandler:function(c){if(this._mode==this.SelectionModes.ClickPoint){this._canvasScroll=this.getCanvasScroll();var d=c.pageX-this._canvasOffset.x+this._canvasScroll.x,b=c.pageY-this._canvasOffset.y+this._canvasScroll.y,a=new jSaaspose.Rect(d,b,d,b),f=this.findPageAtVerticalPosition(b),e=parseInt(f.pageId)-1;if(this.options.storeAnnotationCoordinatesRelativeToPages)a=this.convertRectToRelativeToPageUnscaledCoordinates(a);else a=this.convertRectToAbsoluteCoordinates(a);this.element.trigger("onPointClicked",[e,a])}return false},checkMouseIsInEdgeInBookMode:function(c,d){var f=this.element.width(),e=this.element.height(),b=100,a=100;return this.options.bookLayout&&(c>f-b&&df-b&&d>e-a||ce-a)?true:false},convertRectToAbsoluteCoordinates:function(g,d){var a=g.clone(),e=this.options.proportion,b=null;if(d)b=this._findPageAt(d);else b=this._findPageAt(a.topLeft);a.subtract(b.rect.topLeft);var f=parseInt(b.pageId)-1,c=f*this.options.pageHeight;c/=e;a.scale(1/e);a.add(new jSaaspose.Point(0,c));return a},convertRectToScreenCoordinates:function(d){var a=d.clone().scale(this.options.proportion);a.top()<0&&a.setTop(0);var b=this.options.pageHeight,c=Math.floor(a.top()/b);a.subtract(new jSaaspose.Point(0,c*b));a.add(this.pages[c].rect.topLeft);return a},convertRectToRelativeToPageUnscaledCoordinates:function(e,c){var a=e.clone(),d=this.options.proportion,b=null;if(c)b=this._findPageAt(c);else b=this._findPageAt(a.topLeft);a.subtract(b.rect.topLeft);a.scale(1/d);return a},convertPageAndRectToScreenCoordinates:function(b,c){var a=c.clone().scale(this.options.proportion);a.top()<0&&a.setTop(0);a.add(this.pages[b].rect.topLeft);return a},highlightPredefinedArea:function(c,d,f,a){this.dragged=true;if(this.options.storeAnnotationCoordinatesRelativeToPages)this.lasso=this.convertPageAndRectToScreenCoordinates(f,c);else this.lasso=this.convertRectToScreenCoordinates(c);this.selectionCounter++;var b=this._findPageAt(this.lasso.topLeft)||this.pages[0],e=this.options.startNumbers;this.options.startNumbers={start:parseInt(b.pageId),end:parseInt(b.pageId)};this.findSelectedPages(true,d,a);this.options.startNumbers=e;this.dragged=false;return typeof a=="undefined"?this.selectionCounter:a},unhighlightPredefinedArea:function(f,g,h,d){if(this.options.storeAnnotationCoordinatesRelativeToPages)this.lasso=this.convertPageAndRectToScreenCoordinates(h,f);else this.lasso=this.convertRectToScreenCoordinates(f);var b=this._getDocumentHighlightRects();if(!b||b.length==0)return;if(typeof d=="undefined")d="";for(var c=0;c=Math.round(o)){y=k;x=true}if(Math.round(A)>=Math.round(R)){z=k;break}}var t=y+O;if(tH)g=o;var Q=e.lastIndexOf(" "),r=e.substring(Q+1,e.length),m;if(i==n)m=t+e.length;else m=z+r.length;if(m0){this.search.push({PageId:Z,pageWords:f.slice(0)});E+=f.length;f.length=0}}this.highlightSearch(this.search);return E},highlightSearch:function(e){this.initHighlightSearchPaneContainer();for(var d=0;d0){for(var c=b;c--;)clearTimeout(a[c]);a=[]}},_getElementsByClassName:function(e,b){if(!b)b=document.getElementsByTagName("body")[0];for(var d=[],f=new RegExp("\\b"+e+"\\b"),c=b.getElementsByTagName("*"),a=0,g=c.length;a
";var p=window.jGroupdocs.stringExtensions.format(f.addTemplate,this.pagePrefix+b+"-custom-check-"+j,n-5,m+o-8,k[j].iconType==1?"selection-check":"selection-del",b+"/"+j);c+=p}++b;var r=b
",f=0;fc.bottom()||e.right()>c.right()&&e.top()c.bottom()&&e.top()=this.pages[a].rect.top()&&b.y<=this.pages[a].rect.bottom()){var g=Math.abs(b.x-this.pages[a].rect.left());if(!h||g=this.pages[a].rect.left()&&b.x<=this.pages[a].rect.right()){var i=Math.abs(b.y-this.pages[a].rect.top());if(!f||i=this.pages[a].rect.top()&&b<=this.pages[a].rect.bottom())return this.pages[a];return null},setMode:function(a){this._mode=a},getMode:function(){return this._mode},getRowsFromRect:function(f){var c=null;this.lasso=f.clone();this.lasso=new jSaaspose.Rect(Math.round(this.lasso.left()),Math.round(this.lasso.top())+.001,Math.round(this.lasso.right()),Math.round(this.lasso.bottom())-.001);for(var a=this._getDocumentHighlightRects(),b=0;bo){n=true;break}d=g[a-m]}else d=g[a];var p=h.number;e=k/h.w;var s=this.getRows(h,p,e,l,d),u=d.x+h.w*e,t=d.y+h.h*e;q.push({pageId:p,rows:s,rect:new jSaaspose.Rect(d.x,d.y,u,t)})}if(r)return n;j++;jd)b=d;else b=c!=1?c-1:1;this._viewModel.pageInd(b);a(this.element).trigger("onUpNavigate",b);this.element.trigger("documentPageSet.groupdocs",b)},down:function(){var c=this._viewModel.pageInd(),d=this._viewModel.pageCount(),b;if(c<=0)b=1;else if(c>d)b=d;else b=c!=d?parseInt(c)+1:c;this._viewModel.pageInd(b);a(this.element).trigger("onDownNavigate",b);this.element.trigger("documentPageSet.groupdocs",b)},"set":function(c){var e=this._viewModel.pageCount(),b;if(c<=0)b=1;else if(c>e)b=e;else b=c;var d="up";if(this._viewModel.pageInd()>b)d="down";this._viewModel.pageInd(b);a(this.element).trigger("onSetNavigate",{pageIndex:b,direction:d});this.element.trigger("documentPageSet.groupdocs",b)},setPageIndex:function(a){this._viewModel.pageInd(a)},openFirstPage:function(){this.selectPage(1)},openLastPage:function(){this.selectPage(this.pageCount())},onKeyPress:function(a){a.keyCode==13&&this.set(this._viewModel.pageInd())},setPagesCount:function(a){this._pageCount=a;this._viewModel.pageCount(a)},_createHtml:function(){var b=this.element;b.addClass("left");a('

of

').appendTo(b);b.trigger("onHtmlCreated")},_createEmbeddedHtml:function(){var b=this.element;b.addClass("left");a('

Page

of

').appendTo(b);b.trigger("onHtmlCreated")}})})(jQuery);(function(a,b){a.widget("ui.thumbnails",{_viewModel:null,_pageCount:0,_sessionToken:"",_docGuid:"",_docVersion:1,_pagesWidth:"150",_heightWidthRatio:0,_thumbsSelected:0,_thumbnailWidth:150,_portalService:Container.Resolve("PortalService"),options:{quality:null,use_pdf:"false",baseUrl:null,userId:0,userKey:null},_create:function(){this.options.createHtml&&this._createHtml();if(this.options.thumbnailWidth)this._thumbnailWidth=this.options.thumbnailWidth;this._viewModel=this.getViewModel();ko.applyBindings(this._viewModel,this.element.get(0))},_createViewModel:function(){var a=ko.createViewModel({thumbnails:[],pageInd:1,pageCount:0,busy:true});a._thumbnailHeight=ko.observable(201);if(this.useHtmlBasedEngine)a.scale=ko.observable(0);a.scrollThumbnailsPanel=function(a){this._onScrollLeftPanel(a)}.bind(this);a.selectPage=function(a){this.set(a)}.bind(this);a.onProcessPages=function(e,d,a,c,b){this.onProcessPages(e,d,a,c,b)}.bind(this);a.setThumbnailsScroll=function(a){this.setThumbnailsScroll(a)}.bind(this);a.set=function(a){this.set(a)}.bind(this);a.setPageWithoutEvent=function(a){this.setPageWithoutEvent(a)}.bind(this);return a},getViewModel:function(){if(!this._viewModel)this._viewModel=this._createViewModel();return this._viewModel},onProcessPages:function(a,t,o,q,p){this._sessionToken=a.token;this._docGuid=a.guid;this._docVersion=a.version;this._viewModel.pageCount(a.page_count);this._heightWidthRatio=parseFloat(a.page_size.Height/a.page_size.Width);var k=this._thumbnailWidth,e=false,g=null,j,m,f=null;if(a.documentDescription){e=true;g=a.documentDescription.pages;j=a.documentDescription.maxPageHeight;m=a.documentDescription.widthForMaxHeight;f=j/m*k;if(this.useHtmlBasedEngine){this.getDocumentPageHtmlCallback=o;this.viewerViewModel=q;this._viewModel.scale(f/j/p)}}for(var l=[],b,i,d,h,n=47,c=0;c0)&&this.element.scrollTop(h-l)}if(c=="down"){var l=g-d;(i>0||j<0)&&this.element.scrollTop(h+l)}},"set":function(b){this._viewModel.pageInd(b);a(this.element).trigger("onSetThumbnails",b)},setPageWithoutEvent:function(a){this._viewModel.pageInd(a)},setPagesCount:function(a){this._pageCount=a;this._viewModel.pageCount(a)},_createHtml:function(){var b=this.element;this.element=a('
  • '+(this.useHtmlBasedEngine?"
    ":" ")+'
').appendTo(b)}})})(jQuery);(function(a){fileOpenDialogViewModel=function(a,c,b){this.fileOpenDialog=a;this.fileUploader=c;this.fileExplorer=b;this._init()};a.extend(fileOpenDialogViewModel.prototype,{_explorerViewModel:null,_uploaderElements:[],_init:function(){this.fileExplorer.bind("onPathChanged",this._onExplorerPathChanged.bind(this));this.fileExplorer.bind("onNodeSelected",this._onExplorerNodeSelected.bind(this));this._explorerViewModel=a(this.fileExplorer).explorer("getViewModel");this.fileUploader.bind("onStart",this._onFileUploaderStart.bind(this));this.fileUploader.bind("onProgress",this._onFileUploaderProgress.bind(this));this.fileUploader.bind("onComplete",this._onFileUploaderComplete.bind(this))},_onExplorerPathChanged:function(){},_onExplorerNodeSelected:function(c,b){if(b.id>0&&b.type==="file"){a(this.fileOpenDialog.fileExplorer).trigger("fileSelected",b);a(this.fileOpenDialog.element).modal("hide")}},_onFileUploaderStart:function(d,c,a,b){this._explorerViewModel.busy(true);this._uploaderElements[c]=this._explorerViewModel.createFile(a,b)},_onFileUploaderProgress:function(f,e,d,c,b){b>0&&a(this.fileOpenDialog.explorerProgressPercentage).text(Math.round(c/b*100)+" %")},_onFileUploaderComplete:function(f,b,d){var c=this._uploaderElements,e=this._explorerViewModel;a(this.fileOpenDialog.explorerProgressPercentage).text("100 %");e.busy(false);if(b&&d){c[b].id=d.id;c[b].guid=d.guid;c[b].url=d.url;c[b].Name=d.name;c[b].docType(d.docType);c[b].sizeInKb(Math.round(d.size/1024));c[b].version=d.version;c[b].path=e.path()+"/"+d.name;c[b].name(d.name);c[b].uploading(false);c[b].open()}else e._removeEntity(c[b])}})})(jQuery);(function(a){a.widget("ui.fileOpenDialog",{_viewModel:null,options:{autoOpen:true,url:"",uploadWebFiles:false,fileTypes:"doc,docx,docm,dot,dotx,dotm,rtf,odt,ott,pdf",resourcePrefix:""},_create:function(){var b=this,k=b.options,g=this.element;g.addClass("modal fade modal2 modal800px");var e=(b.wrapper=a("
")).addClass("modal_inner_wrapper").prependTo(g);this._buildDialogHeader(e);var i=(b.content=a("
")).addClass("modal_content").appendTo(e),h=(b.inputWrapLeft=a("
")).addClass("modal_input_wrap_left").appendTo(i),f=(b.fileExplorer=a("
")).addClass("file_browser_content").appendTo(h);this._buildFileUploader(f,b);var c=(b.filesArea=a("
")).attr("data-bind","fileDnD: {}").css({position:"relative"}).appendTo(f),j=a("
").css({position:"relative"}).appendTo(c),d=a("
").addClass("file_browser_sort").appendTo(c);this._buildExplorerHeaders(d,"file_browser_sort_filename","Name","File Name","FileName");this._buildExplorerHeaders(d,"file_browser_sort_size","Size","Size","Size");this._buildExplorerHeaders(d,"file_browser_sort_modified","ModifiedOn","Modified","Modified");this._buildFoldersList(c);this._buildFilesList(c);this._buildFooter(e);this.element.trigger("onHtmlCreated");this._viewModel=this.getViewModel()},_init:function(){},_buildDialogHeader:function(b){var e=a("
").addClass("popclose").attr("data-dismiss","modal").appendTo(b),c=a("
").addClass("modal_header").appendTo(b),d=a("

").text("Open File").attr("data-localize","OpenFile").appendTo(c)},_buildFileUploader:function(d,c){var b=(c.fileUploader=a("
")).addClass("file_browser_toolbar").css({position:"relative",display:"inline-block",overflow:"hidden"}).appendTo(d),g=a("").appendTo(b),e=a("").addClass("small_button file_browser_upload_btn").attr("href","#").attr("data-localize","ParentFolder").attr("data-bind","click: function () { $parent.openParentFolder();}").text("Parent folder").appendTo(b),h=a("").appendTo(b);if(c.options.uploadWebFiles)var f=(c.openFromUrlButton=a("")).addClass("small_button").text("Open From URL").appendTo(b)},_buildExplorerProgress:function(d){var c=a("
").attr("data-bind","visible: busy()").addClass("explorer-progress").appendTo(d),b=a("
").css({position:"relative",top:"50px",left:"50%",width:"96px",height:"56px"}).appendTo(c),f=a("").attr("src",this.options.resourcePrefix+"/Images/uploading.gif").attr("alt","").css({width:"16px",height:"16px"}).appendTo(b),g=a("
").appendTo(b),e=(self.explorerProgressPercentage=a("")).attr("id","explorer-progress-percentage").appendTo(b)},_buildExplorerHeaders:function(g,e,b,f,d){var c=a("").attr("href","#").attr("data-bind","click: function() { setOrder("+b+");}").addClass(e).appendTo(g),i=a("

").text(f).attr("data-localize",d).appendTo(c),h=a("").addClass("smallarrow").attr("data-bind","visible: orderBy() === '"+b+"', css: {up: orderAsc(), down: !orderAsc()}").appendTo(c)},_buildFoldersList:function(e){var d=a("
    ").addClass("file_browser_folder_list").attr("data-bind","foreach: folders").appendTo(e),c=a("
  • ").attr("data-bind","attr: { id: 'explorer-entity-' + id }, click: open").appendTo(d),b=a("
    ").addClass("file_browser_listbox folderlist").appendTo(c),f=a("").addClass("listicons licon_folder").appendTo(b),g=a("

    ").addClass("listname_file_browser foldername").attr("data-bind","text: name()").appendTo(b)},_buildFilesList:function(e){var d=a("
      ").addClass("file_browser_file_list").attr("data-bind","foreach: files").appendTo(e),c=a("
    • ").attr("data-bind","attr: { id: 'explorer-entity-' + id }, click: open").appendTo(d),b=a("
      ").addClass("file_browser_listbox filelist").appendTo(c),f=a("").addClass("listicons").attr("data-bind","css: { 'licon_unkwn': (docType() != 'words' && docType() != 'pdf' && docType() != 'slides' &&docType() != 'cells' && docType() != 'image' && docType() != 'email' && docType() != 'diagram' && docType() != 'project' && docType() != 'taggedimage'), 'licon_word': docType() == 'words', 'licon_pdf': docType() == 'pdf', 'licon_ppt': docType() == 'slides', 'licon_xls': docType() == 'cells', 'licon_bmp': (docType() == 'image' || docType() == 'taggedimage'), 'licon_outlook': docType() == 'email', 'licon_visio': docType() == 'diagram', 'licon_mpp': docType() == 'project' }").appendTo(b),g=a("

      ").addClass("listname_file_browser filenameellipses").attr("data-bind","text: name(), ellipsis: true").appendTo(b),h=a("

      ").addClass("listfilesize listsmalltext").attr("data-bind","text: (sizeInKb() + 'Kb')").appendTo(b),g=a("

      ").addClass("listfilesize listsmalltext").attr("data-bind","text: modifiedOn()").appendTo(b)},_buildFooter:function(c){var b=(self.footer=a("
      ")).addClass("modal_footer").appendTo(c),d=a("
      ").addClass("modal_btn_wrapper").appendTo(b)},_createViewModel:function(){var f=this.options.hostUrl,c=this.options.userId,b=this.options.userKey,d=a(this.fileExplorer).explorer({userId:c,privateKey:b,pageSize:30,fileTypes:this.options.fileTypes,urlHashEnabled:this.options.urlHashEnabled}),e=a(this.fileUploader).uploader({url:f,userId:c,key:b,proxy:"Uploader.aspx",fld:"",multiple:true,addFileBtn:a(this.uploadButton)});return new fileOpenDialogViewModel(this,e,d)},getViewModel:function(){if(!this._viewModel)this._viewModel=this._createViewModel();return this._viewModel},destroy:function(){a.Widget.prototype.destroy.call(this)}})})(jQuery);(function(a,b){a.widget("ui.explorer",{_viewModel:null,_init:function(){var b=this;this._viewModel=this.getViewModel();this._viewModel.path.subscribe(function(b){a(this.element).trigger("onPathChanged",[b])}.bind(this));a(this._viewModel).bind("onNodeSelected",function(d,c,b){a(this.element).trigger("onNodeSelected",[c,b])}.bind(this));ko.applyBindings(this._viewModel,this.element.get(0))},_createViewModel:function(){return new explorerViewModel(this._getViewModelOptions())},_getViewModelOptions:function(){return{userId:this.options.userId,userKey:this.options.privateKey,pageSize:this.options.pageSize,fileTypes:this.options.fileTypes,startupPath:this.options.startupPath,view:this.options.view,urlHashEnabled:this.options.urlHashEnabled}},getViewModel:function(){if(!this._viewModel)this._viewModel=this._createViewModel();return this._viewModel},setFilter:function(a){this._viewModel.setFilter(a)},setOrder:function(a){this._viewModel.setFilter(a)}});explorerModel=function(b){a.extend(this.options,b);this._init()};a.extend(explorerModel.prototype,{_portalService:Container.Resolve("PortalService"),_path:"",_entitiesLoaded:0,_entitiesTotal:0,_filter:{name:"",types:null},_order:{by:ko.observable("Name"),asc:ko.observable(true)},options:{userId:"",userKey:"",pageSize:30,extended:false},_init:function(){},_loadPage:function(b,c,d,a){this._portalService.loadFileBrowserTreeData(this.options.userId,this.options.userKey,c,b?b:0,this.options.pageSize,this._order.by(),this._order.asc(),this._filter.name,this._filter.types,this.options.extended,function(b){if(b.textStatus==="success"){this._entitiesLoaded+=b.data.nodes.length;this._entitiesTotal=b.data.count;d.apply(this,[c,b.data.nodes])}else a.apply(this,[])}.bind(this),function(b){a.apply(this,[b])}.bind(this),false)},openFolder:function(c,b,a){this._path=c||"";this._entitiesLoaded=0;this._entitiesTotal=0;this._loadPage(0,this._path,b,a)},loadMore:function(b,a){if(this._entitiesLoaded>=this._entitiesTotal)return false;var c=Math.ceil(this._entitiesLoaded/this.options.pageSize);this._loadPage(c,this._path,b,a);return true},createFolder:function(a,c,b){this._portalService.createFolderAsync(this.options.userId,this.options.userKey,a,function(d){if(d.data>0)c.apply(this,[a,d.data]);else b.apply(this,[a,null,d.data])}.bind(this),function(c){b.apply(this,[c,a])}.bind(this)).Subscribe()},setFilter:function(a){this._filter.name=a.name;this._filter.types=a.types},setOrder:function(a){if(this._order.by()==a){var b=!this._order.asc();this._order.asc(b)}else{this._order.asc(true);this._order.by(a)}}});explorerViewModel=function(a){this._init(a)};a.extend(explorerViewModel.prototype,{_model:null,_filtering:false,_ordering:false,_userId:null,_userKey:null,urlHashEnabled:true,busy:ko.observable(false),path:ko.observable(""),entities:ko.observableArray(),files:ko.observableArray(),folders:ko.observableArray(),changedUrlHash:false,view:ko.observable("listing"),_init:function(a){this._model=this._createModel(a);this._userId=a.userId;this._userKey=a.userKey;if(typeof a.urlHashEnabled!="undefined")this.urlHashEnabled=a.urlHashEnabled;this.busy=ko.observable(false);this.path=ko.observable("");this.entities=ko.observableArray();this.files=ko.observableArray();this.folders=ko.observableArray();this.isNotRootFolder=ko.computed({read:function(){return!(this.path()==="")},owner:this});!a.skipStartupPathLoad&&this.openFolder(a.startupPath)},_createModel:function(a){return new explorerModel(a)},_addRoot:function(){var a=this._createEntity("Home","folder");a.path="";this.entities.push(a);return a},_onEntitiesLoaded:function(c,d){var b=this;if(b._filtering||b._ordering||c!=b.path()){b.entities.removeAll();b.files.removeAll();b.folders.removeAll()}a.each(d,function(){if(!this.extended){var a=this;b._extendEntity(a);b.entities.push(a)}if(this.type=="file")b.files.push(this);else b.folders.push(this)});b._filtering=false;b._ordering=false;b.path(c);if(this.urlHashEnabled){this.changedUrlHash=true;location.hash=b.view()+"#"+c;this.changedUrlHash=false}b.busy(false)},_onNetworkError:function(a){this.busy(false);jerror(a.Reason||a)},_extendEntity:function(b){var c=this,d=b.supportedTypes?a.map(b.supportedTypes,function(a){return a.toUpperCase()}):[];a.extend(b,{extended:true,name:ko.observable(b.name),uploading:ko.observable(false),sizeInKb:ko.observable(Math.round(b.size/1024)),docType:ko.observable(b.docType),modifiedOn:function(){return isNaN(b.modifyTime)||b.modifyTime<0?"---":(new Date(b.modifyTime)).format("mmm dd, yyyy")},percentCompleted:ko.observable(0),uploadSpeed:ko.observable(0),remainingTime:ko.observable(0),supportedTypes:ko.observableArray(d),thumbnail:ko.observable(b.thumbnail),selected:ko.observable(false),isVisible:ko.observable(true),viewJobId:ko.observable(null),viewJobPoller:null});b.statusText=ko.computed(function(){return this.viewJobId()&&this.viewJobId()>0?"Server-side processing ...":"Time remaining: "+this.remainingTime()+" secs @ "+this.uploadSpeed()+" kb/Sec."},b);b.open=function(d){if(b.type==="file")a(c).trigger("onNodeSelected",[b,d]);else c.openFolder(b.path)};b.viewJobId.subscribe(function(a){if(a&&a>0){this.viewJobPoller=new jobPoller({userId:c._userId,userKey:c._userKey,jobId:a,completed:function(){b.uploading(false);b.viewJobPoller=null},failed:function(){b.uploading(false);b.viewJobPoller=null},timedout:function(){b.uploading(false);b.viewJobPoller=null}});this.viewJobPoller.start()}})},_findEntity:function(c,d){for(var b=0;b0?a.length-a.replace(/\/+/g,"").length+1:0},getSelectedEntities:function(){return a.map(this.entities(),function(a){if(a.id&&a.selected())return a})},openFolder:function(a){if(this.busy())return;this.busy(true);this._model.openFolder(a,this._onEntitiesLoaded.bind(this),this._onNetworkError.bind(this))},openParentFolder:function(){var b=this.path().lastIndexOf("/"),a=this.path().substr(0,b>0?b:0);a!=this.path()&&this.openFolder(a)},loadMore:function(){!this.busy()&&this.busy(this._model.loadMore(this._onEntitiesLoaded.bind(this),this._onNetworkError.bind(this)));return this.busy()},createFile:function(c,d){var b=this._findEntity(c,"file");if(b){b.uploading(true);return b}var e=this,a=this._createEntity(c,"file",d);a.uploading(true);this.entities.push(a);this.files.unshift(a);return a},entityExists:function(a,b){return this._findEntity(a,b)!=null},setFilter:function(a){this._filtering=true;this._model.setFilter(a);this.openFolder(this.path())},setOrder:function(a){this._ordering=true;this._model.setOrder(a);this.openFolder(this.path())},orderBy:function(){return this._model._order.by()},orderAsc:function(){return this._model._order.asc()},findEntity:function(a,b){return this._findEntity(a,b)},isNullOrWhiteSpace:function(a){return a===null||a=="undefined"||a.match(/^ *$/)!==null}})})(jQuery);(function(a,b){a.widget("ui.uploader",{_appender:null,_handler:null,options:{multiple:true,userId:b,key:"",url:"",proxy:"",fld:"documents",formats:"",onComplete:null,onStart:null,addFileBtn:null,skipErrors:false,delayedStart:false},_initHandler:function(){if(this._handler==null){var b=Container.Resolve("HttpProvider").buildUrl(this.options.url,this.options.proxy,{user_id:this.options.userId,fld:this.options.fld});this._handler=a.handlerFactory.get({multiple:this.options.multiple,action:Container.Resolve("HttpProvider").signUrl(b,this.options.key),skipErrors:this.options.skipErrors});a(this._handler).hitch("onComplete",this._onComplete,this);a(this._handler).hitch("onProgress",this._onProgress,this);a(this._handler).hitch("onStart",this._onStart,this)}},_initAppender:function(){if(this._appender==null){var b=this;this._appender=new FileAppender({container:this.element,multiple:!this._handler.sync,_addFileBtn:this.options.addFileBtn,onAddItemAction:function(c){if(b.options.delayedStart)a(b.element).trigger("onFileSelected",[a.fileInputUtils.getName(c),c]);else b._uploadFile(c)}})}},_create:function(){this._initHandler();this._initAppender()},_onCancel:function(b){var a=b.data;this._handler.cancel(a)},_onComplete:function(d,c,b){if(this.options.onComplete)this.options.onComplete.apply(this,[c,b]);else a(this.element).trigger("onComplete",[c,b])},_beforeStart:function(a){return this.options.beforeStart?this.options.beforeStart(a):true},_onStart:function(e,d,b,c){if(this.options.onStart)this.options.onStart.apply(this,[d,b,c]);else a(this.element).trigger("onStart",[d,b,c])},_onProgress:function(h,g,d,e,f,b,c){if(this.options.onProgress)this.options.onProgress.apply(this,[g,d,e,f,b,c]);else a(this.element).trigger("onProgress",[g,d,e,f,b,c])},_uploadFile:function(e){var b=this._handler.add(e,jSaaspose.utils.getSequenceNumber()),d=this._handler.getPath(b);if(!this._beforeStart(d)){this._handler.cancel(b);return}var c=this._addFileItem(b,d);if(this.options.formats==""||this.options.formats.indexOf(c.ext.toLowerCase())!=-1){a(this.element).trigger("onAdded",[c,null]);this._handler.upload(b)}else a(this.element).trigger("onAdded",[null,"Not allowed format"]);return b},upload:function(){throw new("not implemented");},uploadFile:function(a){return this._uploadFile(a)},cancelUploadFile:function(a){this._handler.cancel(a)},_addFileItem:function(c,a){return{id:c,name:a,ext:this._getExt(a)}},_getExt:function(a){return Container.Resolve("PathProvider").getExt(a).toUpperCase()},_setOption:function(b,c){a.Widget.prototype._setOption.call(this,b,c);if(b==="fld"){this._handler=null;this._initHandler()}}});UploadHandlerBasic=function(b){a.extend(this,b)};a.extend(UploadHandlerBasic.prototype,{action:"",_inputs:{},sync:true,skipErrors:false,getPath:function(b){return a.fileInputUtils.getPath(this._inputs[b])},getSize:function(c){var b=this._inputs[c];return a.fileInputUtils.getSize(b)},add:function(b,c){this._inputs[c]=b;a(b).detach();return c},upload:function(a){this._upload(a)},cancel:function(a){this._cancel(a)},_parseResponse:function(a){try{var b=eval("("+a+")")}catch(c){throw"Error in file processing at server side:"+a;}return b},_upload:function(){},_cancel:function(){}});IFrameHandler=function(){UploadHandlerBasic.apply(this,arguments)};a.extend(IFrameHandler.prototype,UploadHandlerBasic.prototype,{_upload:function(c){var e=this._inputs[c],f=Container.Resolve("PathProvider").getName(this.getPath(c));a(e).attr("name",f);var d=this._createForm(c),b=this._createIFrame(c);d.append(e);var g=b.get(0).document?b.get(0).document:b.get(0).contentDocument?b.get(0).contentDocument:b.get(0).contentWindow.document;g.body.appendChild(d.get(0));b.hitch("load",function(){var d=this._getIframeContentJSON(b[0]);a(this).trigger("onComplete",[c,d.success?d.parsed:null]);delete this._inputs[c];setTimeout(function(){b.remove()},1)},this);a(this).trigger("onStart",[c,f]);d.submit();d.remove()},_createForm:function(c){var b=a('
      ');b.attr("id","form"+c);b.attr("action",this.action);b.attr("target","iframe"+c);return b},_createIFrame:function(c){var b=a('").appendTo("body");o=v(h)}o.write("
      "+r+"
      "+e.popupWindowTitle+"");i=a(o).find("form")}i.submit()}setTimeout(u,e.checkInterval);function u(){if(document.cookie.indexOf(e.cookieName+"="+e.cookieValue)!=-1){k.onSuccess(f);document.cookie=e.cookieName+"=; expires="+(new Date(1e3)).toUTCString()+"; path="+e.cookiePath;s(false);return}if(g||h)try{var b=g?g.document:v(h);if(b&&b.body!=null&&b.body.innerHTML.length){var d=true;if(i&&i.length){var c=a(b.body).contents().first();if(c.length&&c[0]===i[0])d=false}if(d){k.onFail(b.body.innerHTML,f);s(true);return}}}catch(j){k.onFail(j.message,f);s(true);return}setTimeout(u,e.checkInterval)}function v(b){var a=b[0].contentWindow||b[0].contentDocument;if(a&&a.document)a=a.document;return a}function s(a){setTimeout(function(){if(g){l&&g.close();if(p){g.focus();a&&g.close()}}},0)}function t(a){return a.replace(d,function(a){return"&"+c[a]})}return n.promise()}})})(jQuery,this);




      © 2015 - 2024 Weber Informatics LLC | Privacy Policy