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}};window.jGroupdocs.http={splitUrl:function(){var a=new RegExp("(\\w+)://([^/]+)([^?]*)([?].+)?");return function(e){var b=e.match(a),d=b.length>3?b[3]:null,c=b.length>4?b[4]:null;return{schema:b[1],authority:b.length>2?b[2]:null,path:d,query:c,queryDict:$.fn.q(c),pathAndQuery:c?d+c:d}}}()};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(f,e,h,b,c,d,a){var g={userId:f,privateKey:e,guid:h,useHtmlBasedEngine:true,preloadPagesCount:b};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/ViewDocument"+this._urlSuffix,g,c,d,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(p,n,l,m,b,k,d,i,c,f,h,j,e,g,a){var o={guid:p,width:n,quality:l,usePdf:m,preloadPagesCount:b,password:k,fileDisplayName:d,watermarkText:i,watermarkFontSize:c,watermarkColor:f,watermarkLeft:h,watermarkTop:j};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/ViewDocument"+this._urlSuffix,o,e,g,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(o,i,r,j,p,k,l,m,n,h,f,a,c,e,g,b,d){var q={userId:o,privateKey:i,guid:r,dimension:j,token:p,firstPage:k,pageCount:l,quality:m,usePdf:n,docVersion:h,watermarkText:f,watermarkFontSize:a,watermarkColor:c,watermarkLeft:e,watermarkTop:g};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetImageUrls"+this._urlSuffix,q,b,d,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(f,a,b,c,d){var e={path:f,useHtmlBasedEngine:a,displayName:b};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetPrintableHtml"+this._urlSuffix,e,c,d,false)},reorderPage:function(f,d,c,a,b){var e={path:f,oldPosition:d,newPosition:c};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/ReorderPage"+this._urlSuffix,e,a,b,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 b="'-ms-transform': 'scale(' + $data.heightRatio * $root.zoom() / 100.0 + ')' ";if(this.options.pageContentType=="html"&&a.browser.msie)if(a.browser.version==8)b="zoom: $data.heightRatio * $root.zoom() / 100.0, backgroundColor:'transparent' ";b+=",";var d='

Loading your content...

'+(this.options.pageContentType=="image"?'
":'
")+"
",c=this.element;a(d).appendTo(c);c.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,k,h,i,j,l,m,a){var c=function(b){if(b.data!=null&&typeof b.data.guid!=="undefined")m.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,k,h,i,j,l,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(c,d,b,a){this._portalService.viewDocumentAsHtml(this.userId,this.userKey,c,this.preloadPagesCount,function(c){if(c.data&&typeof c.data.guid!=="undefined")b.apply(this,[c.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(j,k,h,b,f,a,c,e,g,i,d){this._portalService.getImageUrlsAsync(this.userId,this.userKey,j,b,k,0,h,this.quality==null?"":this.quality,this.use_pdf,this.fileVersion,f,a,c,e,g,function(a){i.apply(this,[a.data])},function(a){d.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])})},reorderPage:function(e,c,b,d,a){this._portalService.reorderPage(e,c,b,function(a){d.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,watermarkText:null,watermarkFontSize:null,watermarkColor:null,watermarkLeft:null,watermarkTop:null,searchText:null,htmlSearchHighlightClassName:"search_highlight_html",htmlSearchHighlightElement:"span",options:{showHyperlinks:true},_create:function(a){this._model=new docViewerModel(a);this._init(a)},_init:function(a){var c=this;if(!ko.bindingHandlers.searchText)ko.bindingHandlers.searchText={update:function(g,j){var a=ko.utils.unwrapObservable(j());c.removeSearchHighlight(g);if(a){var e=a.text;if(e){var i=a.isCaseSensitive,h=a.searchForSeparateWords,b,f=/[-[\]{}()*+?.,\\^$|#\s]/g;if(h){var d=c.getWords(e);d=jQuery.map(d,function(a){return a.replace(f,"\\$&")});b="("+d.join("|")+")"}else b=e.replace(f,"\\$&");var k=new RegExp(b,i?null:"i");c.searchHtmlElement(g,k)}}}};if(this.viewerLeft!=0){this.viewerWidth-=this.viewerLeft;this.documentSpace.css("width",this.viewerWidth+"px")}var d=852,e=1100;this.pageImageWidth=d;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(0);this.pageWidth=ko.observable(d);this.pageHeight=ko.observable(e);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(""),searchText:ko.observable(null)};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);this.documentSpace.trigger("onDocumentloadingStarted");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,this.watermarkText,this.watermarkFontSize,this.watermarkColor,this.watermarkLeft,this.watermarkTop,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(c){var b=c;a.htmlContent(b);a.searchText({text:this.searchText,isCaseSensitive:false,searchForSeparateWords:false});a.visible(true);a.startedDownloadingPage=false}.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,this.watermarkText,this.watermarkFontSize,this.watermarkColor,this.watermarkLeft,this.watermarkTop,function(b){for(a=0;a"+u+"").appendTo("head");var t=c.pageHtml,j=this.pages()[0];f=this._pdf2XmlWrapper.getPageSize();e=this._pdf2XmlWrapper.documentDescription.pages;j.prop=e[0].h/e[0].w;j.heightRatio=e[0].h/f.height;j.htmlContent(t);j.visible(true);var o=this.documentSpace.find(".html_page_contents:first > div");c.page_size.width=f.width;c.page_size.height=f.height;var n=f.width;o.css("width",n+"pt");var q=o.width();this.pointToPixelRatio=q/n;this.heightWidthRatio=parseFloat(c.page_size.height/c.page_size.width);this.pageWidth(q);this.pageHeight(Math.round(this.pageWidth()*this.heightWidthRatio));this.initialWidth=this.pageWidth()}this.pagesContainerElement=this.documentSpace.find(".pages_container");var p=this.pageCount(),d,i=[],g;if(this.pageContentType=="image"){var l,m;if(this.variableHeightPageSupport){e=this._pdf2XmlWrapper.documentDescription.pages;m=e.length}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());if(this.pageContentType=="html"&&this.zoomToFitWidth){var w=this.getFitWidth()/this.pageWidth()*100;this.setZoom(w)}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]);this.documentSpace.trigger("documentLoadCompleted.groupdocs")},_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(),e,k=null,h=this.documentSpace.height();if(this.variableHeightPageSupport){var l=this.getSelectableInstance();if(l==null)return null;var j=l.pageLocations,d,i,n=this.pages();if(j.length!=n.length)return null;for(var c=0;c=a&&d<=a+h||i>=a&&i<=a+h||d<=a&&i>=a+h)if(f===null)f=c+1;else g=c+1}if(g===null)g=f}else if(this._firstPage!=null){e=this._firstPage.outerHeight(true);var o=this._firstPage.outerWidth(true),p=this.pagesContainerElement.width();k=Math.floor(a/e)+1;var m=Math.floor((a+h)/e)+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 h=f.pageLocations[b-1].y;c=h}}else{var d=Math.floor(this.pagesContainerElement.width()/this._firstPage.width());if(d==0)d=1;if(this.alwaysOnePageInRow)d=1;var i=Math.ceil(b/d)-1;c=i*this._firstPage.outerHeight(true)}var g=this.documentSpace.scrollTop();this.documentSpace.scrollTop(c);if(this.documentSpace.scrollTop()==g)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 j=this.pages()[b-1];!j.visible()&&this.getDocumentPageHtml(b-1)}var e=Number(b);this.setPageNumerInUrlHash(e);a(this).trigger("onDocumentPageSet",[e]);this.documentSpace.trigger("documentPageSet.groupdocs",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(a){this.zoom(a);this.loadPagesZoomed();if(this.pageContentType=="image"){if(this._pdf2XmlWrapper){var b=this._pdf2XmlWrapper.getPageSize();this.scale(this.pageImageWidth/b.width*a/100)}this._dvselectable.dvselectable("changeSelectedRowsStyle",this.scale());this.reInitSelectable();this.recalculatePageLeft();this.setPage(this.pageInd());this.shouldMinimumWidthBeUsed(this.pageWidth(),true)&&this.loadImagesForVisiblePages();this.options.showHyperlinks&&this._refreshHyperlinkFrames()}else if(this.pageContentType=="html"){this.reInitSelectable();this.setPage(this.pageInd());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(b,f,e){if(this.pageContentType=="image"){var g=this.getSelectableInstance();if(g!=null){var j=g.performSearch(b,this.zoom()/100,f,e);a(this).trigger("onSearchPerformed",[j])}}else{this.searchText=b;for(var h=this.pages(),c,d=0;d1){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&&aa.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;if(this.options.preventTouchEventsBubbling){function b(a){a.preventBubble()}this.element.bind({touchstart:b,touchmove:b,touchend:b})}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(),c=b.left,a=b.top;if(this.options.bookLayout)a=this.parentElement.offset().top;this._canvasOffset=new jSaaspose.Point(c,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())},clearSelection:function(){this.element.find(".selection-highlight:not(.static)").remove()},_mouseCapture:function(){return this._mode!=this.SelectionModes.DoNothing},_mouseStart:function(a){this.clearSelection();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(t){if(this._mode==this.SelectionModes.DoNothing)return false;this.helper.remove();var q=this._findPageAt(this.lasso.topLeft)||this.pages[0],j;if(typeof q==="undefined")return false;var e=parseInt(q.pageId)-1;if(e<0)return false;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 g=c.top(),f=c.bottom();c=b[0].originalRect;for(var m=c.left(),l=c.right(),i=c.top(),h=c.bottom(),o=b[0].position,r=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());i=Math.min(i,c.top());h=Math.max(h,c.bottom())}var u=this.options.proportion;if(this.options.storeAnnotationCoordinatesRelativeToPages){g=Math.min(i,g);f=Math.max(h,f)}else{j=e*this.options.pageHeight;j/=u;g=Math.max(j+i,g);f=Math.min(j+h,f)}var s=new jSaaspose.Rect(m,g,l,f),p=s.clone();this.options.txtarea.val(a.trim(n)).focus().select()}switch(this._mode){case this.SelectionModes.SelectText:this.element.trigger("onTextSelected",[e,p,o,r,this.selectionCounter]);break;case this.SelectionModes.SelectTextToStrikeout:this.element.trigger("onTextToStrikeoutSelected",[e,p,o,r,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",[e,k]);break;case this.SelectionModes.ClickPoint:this.mouseClickHandler(t);break;case this.SelectionModes.TrackMouseMovement:a(this.element).trigger("onMouseMoveStopped",[])}return false},mouseClickHandler:function(b){if(this._mode==this.SelectionModes.ClickPoint){this._canvasScroll=this.getCanvasScroll();var c=b.pageX-this._canvasOffset.x+this._canvasScroll.x,d=b.pageY-this._canvasOffset.y+this._canvasScroll.y,a=new jSaaspose.Rect(c,d,c,d),f=this._findPageAt(a.topLeft),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(i)){y=h;break}}var n=y+s;if(nI)f=i;o=n+B.length;k=g[o];c=b[q].rect.clone();c.subtract(b[q].pageLocation);var C=this.options.proportion,T=f*C,S=k*C;c.setLeft(T);c.setRight(S);j.push(c)}}}else{var t=v.indexOf(e);while(t!=-1){var c;b=x.words;if(this.options.searchPartialWords){var P=/\s/g,F=v.substring(0,t),R=F.match(P),O=e.match(P),p=0,N=0;if(R)p=R.length;if(O)N=O.length;var A=p+N,g=this.options.pdf2XmlWrapper.getRowCharacterCoordinates(r,w),i=b[p].originalRect.left(),bb=b[A].originalRect.left(),I=b[A].originalRect.right(),W=x.originalRect.right();s=F.length-F.lastIndexOf(" ")-1;for(var y=0,L=0,K=false,h=0;h=Math.round(i)){y=h;K=true}if(Math.round(E)>=Math.round(bb)){L=h;break}}var n=y+s;if(nI)f=i;var ab=e.lastIndexOf(" "),D=e.substring(ab+1,e.length),o;if(p==A)o=n+e.length;else o=L+D.length;if(o0){this.search.push({PageId:fb,pageWords:j.slice(0)});Q+=j.length;j.length=0}}this.highlightSearch(this.search);return Q},getWords:function(b){return a.map(b.split(" "),function(a){if(a!="")return a})},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()=m,f=n<=p&&p=0&&!e.intersects(c[b].rect);b+=l)c[b].shown=false;if(b==c.length||b<0)return null;for(var a=c[b],q=0,o=0,r=a.rect.left(),t=a.rect.top(),i=a.originalRect.left(),k=a.originalRect.top(),h=0,g=0,d={bounds:null,text:"",page:u+(this.options.bookLayout?this.options.startNumbers.start-1:0),row:v,position:a.position,length:a.text.length};b=0&&(f||z||e.intersects(c[b].rect));b+=l){a=c[b];a.shown=true;if(!this.dragged)d.text+=a.text+" ";r=Math.min(r,a.rect.left());t=Math.min(t,a.rect.top());q=Math.max(q,a.rect.right());o=Math.max(o,a.rect.bottom());i=Math.min(i,a.originalRect.left());k=Math.min(k,a.originalRect.top());h=Math.max(h,a.originalRect.right());g=Math.max(g,a.originalRect.bottom())}for(;b=0;b+=l)c[b].shown=false;var w=new jSaaspose.Rect(r,t+1,q,o-1);w.subtract(x.rect.topLeft);d.bounds=w;var y=new jSaaspose.Rect(i,k+1,h,g-1);d.originalRect=y;d.length=a.position-d.position+a.text.length;return d},_findPageAt:function(b){for(var d=0,e=0,c=null,h=false,f=false,a=0;a=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)},down:function(){var b=this._viewModel.pageInd(),d=this._viewModel.pageCount(),c;if(b<=0)c=1;else if(b>d)c=d;else c=b!=d?parseInt(b)+1:b;this._viewModel.pageInd(c);a(this.element).trigger("onDownNavigate",c)},"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})},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(){if(this.options.supportPageReordering){var b=this;ko.bindingHandlers.sortableArray={init:function(e,d){var c=d();a(e).sortable({axis:"y",update:function(h,e){var f=e.item[0],d=ko.dataFor(f),g=c.indexOf(d),a=ko.utils.arrayIndexOf(e.item.parent().children(),f);e.item.remove();if(a>=0){c.remove(d);c.splice(a,0,d)}b.rootElement.trigger("onPageReordered",[g,a])}})}}}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));this.options.useInnerThumbnails&&ko.applyBindings(this._viewModel,this.toggleThuumbnailsButton[0])},_createViewModel:function(){var a=ko.createViewModel({thumbnails:[],pageInd:1,pageCount:0,busy:true});a._thumbnailHeight=ko.observable(201);a.useInnerThumbnails=this.options.useInnerThumbnails;a.showThumbnails=ko.observable(true);a.element=this.element;a.rootElement=this.rootElement;a.thumbnailPanelElement=this.thumbnailPanelElement;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.hideThumbnails=function(){for(var b,a=0;a0)&&this.element.scrollTop(i-g)}if(c=="down"){g=h-d;(j>0||k<0)&&this.element.scrollTop(i+g)}},"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 c=this.element,b;if(this.options.supportPageReordering)b="foreach: thumbnails, sortableArray: thumbnails";else b="foreach: thumbnails";this.element=a('
  • '+(this.useHtmlBasedEngine?"
    ":" ")+'
');if(this.options.useInnerThumbnails){this.thumbnailPanelElement=a('
');this.element.appendTo(this.thumbnailPanelElement);this.toggleThuumbnailsButton=a('
');this.toggleThuumbnailsButton.appendTo(this.thumbnailPanelElement);this.thumbnailPanelElement.prependTo(c)}else this.element.appendTo(c);this.rootElement=c}})})(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("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),isNewVersion:false,processingOnServer: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){b.processingOnServer=true;this.viewJobPoller=new jobPoller({userId:c._userId,userKey:c._userKey,jobId:a,completed:function(){b.uploading(false);b.processingOnServer=false;b.viewJobPoller=null},failed:function(){b.uploading(false);b.processingOnServer=false;b.viewJobPoller=null},timedout:function(){b.uploading(false);b.processingOnServer=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);b.isNewVersion=true;return b}var e=this,a=this._createEntity(c,"file",d);a.uploading(true);a.isNewVersion=false;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,isForUserStorage: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,baseServerHost:this.options.url,isForUserStorage:this.options.isForUserStorage,folder:this.options.fld,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);if(this.isForUserStorage)b.attr("action",this._buildUriForIframeAction());else b.attr("action",this.action);b.attr("target","iframe"+c);return b},_buildUriForIframeAction:function(){var b="";a.ajax({url:this.baseServerHost+"getFileUploadUrl",data:"path="+this.folder+"&forIframe=true",async:false,success:function(a){b=a}});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