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 for Java is a powerful document viewer component that allows you to display over 50 document formats in your Java applications. The viewer can both rasterize documents and convert them to SVG+HTML+CSS, delivering true-text high-fidelity rendering. Supported file formats include: Microsoft Office, Microsoft Visio, Microsoft Project, Outlook documents, PDF, AutoCAD, Image files (JPG, BMP, GIF, TIFF, etc.) and many more formats.

There is a newer version: 17.5.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},trim:function(b,a){var c=new RegExp("^["+a+"]+|["+a+"]+$","g");return b.replace(c,"")},trimStart:function(a,b){var c=new RegExp("^["+b+"]+","g");return a.replace(c,"")},trimEnd:function(a,b){var c=new RegExp("["+b+"]+$","g");return a.replace(c,"")}};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;if(applicationPath!="/"){var 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(d,b,c){var a=jGroupdocs.stringExtensions.trimEnd(d,"/");if(b&&b.length>0)a+="/"+jGroupdocs.stringExtensions.trimStart(b,"/");if(c)a+=(a.indexOf("&")!=-1||a.indexOf("?")!=-1?"&":"?")+jQuery.param(c);return a},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};ko.bindingHandlers.pressKey={init:function(d,b,e,c,a){ko.utils.registerEventHandler(d,"keydown",function(e){var d=b();console.log(d);if(e.keyCode===d.keyCode){e.preventDefault();e.target.blur();d.action.call(c,a.$data)}})}};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(j,i,l,e,f,c,b,d,g,h,a){var k={userId:j,privateKey:i,guid:l,useHtmlBasedEngine:true,preloadPagesCount:e,fileDisplayName:f,usePngImagesForHtmlBasedEngine:c,convertWordDocumentsCompletely:b,ignoreDocumentAbsence:d};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/ViewDocument"+this._urlSuffix,k,g,h,a!=null?a:false)},getDocumentPageHtml:function(f,d,c,a,b){var e={path:f,pageIndex:d,usePngImages:c};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetDocumentPageHtml"+this._urlSuffix,e,a,b,false)},viewDocument:function(n,l,j,k,c,i,d,h,f,b,e,g,a){var m={guid:n,width:l,quality:j,usePdf:k,preloadPagesCount:c,password:i,fileDisplayName:d,watermarkText:h,watermarkColor:f,ignoreDocumentAbsence:b};this._runServiceAsync(this.applicationPath+this.urlPrefix+"/ViewDocument"+this._urlSuffix,m,e,g,a!=null?a:false)},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(m,g,p,h,n,i,j,k,l,f,e,c,a,b,d){var o={userId:m,privateKey:g,guid:p,dimension:h,token:n,firstPage:i,pageCount:j,quality:k,usePdf:l,docVersion:f,watermarkText:e,watermarkColor:c,useHtmlBasedEngine:a};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetImageUrls"+this._urlSuffix,o,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(h,a,b,f,d,c,e){var g={path:h,useHtmlBasedEngine:a,displayName:b,watermarkText:f,watermarkColor:d};return this._runServiceAsync(this.applicationPath+this.urlPrefix+"/GetPrintableHtml"+this._urlSuffix,g,c,e,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 e="'-ms-transform': 'scale(' + $data.heightRatio * $root.zoom() / 100.0 + ')' ";if(this.options.pageContentType=="html"&&a.browser.msie)if(a.browser.version==8)e="zoom: $data.heightRatio * $root.zoom() / 100.0, backgroundColor:'transparent' ";e+=",";var g='           
",h='
",c;if(this.options.useEmScaling)c=h;else c=g;var b,d;if(this.options.pageContentType=="html")if(this.options.useEmScaling)b='class="pages_container html_pages_container" data-bind="style:{fontSize: (16.* $root.zoom() / 100.0) + \'px\'}"';else b='class="pages_container html_pages_container"';else b='class="pages_container"';if(this.options.useEmScaling)d="
";else d="
";var i='
"+(this.options.pageContentType=="image"?"
":d)+'

Loading your content...

'+(this.options.pageContentType=="image"?'
":c)+'
',f=this.element;a(i).appendTo(f);f.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,j,i,h,k,a){var c=function(b){if(b.data!=null&&typeof b.data.guid!=="undefined")k.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,j,i,h,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(g,h,d,e,b,c,f,a){this._portalService.viewDocumentAsHtml(this.userId,this.userKey,g,this.preloadPagesCount,d,e,b,c,function(b){if(b.data&&typeof b.data.guid!=="undefined")f.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(h,i,f,b,e,c,a,g,d){this._portalService.getImageUrlsAsync(this.userId,this.userKey,h,b,i,0,f,this.quality==null?"":this.quality,this.use_pdf,this.fileVersion,e,c,a,function(a){g.apply(this,[a.data])},function(a){d.apply(this,[a])})},getDocumentPageHtml:function(e,c,b,d,a){this._portalService.getDocumentPageHtml(e,c,b,function(a){d.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",currentWordCounter:0,matchedNods:null,searchMatches:null,matchedNodsCount:0,matchesCount:null,searchSeparatorsList:'\\-[\\]{}()*+?\\\\^|\\s.,:;+"/',usePngImagesForHtmlBasedEngine:false,loadAllPagesOnSearch:false,serverPages:null,convertWordDocumentsCompletely:false,ignoreDocumentAbsence:false,tabs:null,useTabsForPages:null,tabPanelHeight:30,options:{showHyperlinks:true},_create:function(a){this._model=new docViewerModel(a);this._init(a)},_init:function(a){var e=this;if(!ko.bindingHandlers.searchText)ko.bindingHandlers.searchText={update:function(f,k,m,l,j){var a=j.$root,c=ko.utils.unwrapObservable(k());a.removeSearchHighlight(f);if(c){var b=c.text;if(b){var n,d,g=c.isCaseSensitive,h=c.searchForSeparateWords;if(c.treatPhrasesInDoubleQuotesAsExact){var e=b.replace(/^[\r\n\s]+|[\r\n\s]+$/g,"");if(e.length>=2&&e[0]=='"'&&e[e.length-1]=='"'){b=b.substr(1,e.length-2);b=b.replace(/^[\r\n\s]+|[\r\n\s]+$/g,"");a.currentWordCounter=0;a.matchedNods=[];a.searchMatches=[];a.matchedNodsCount=0;d=a.getWords(b);a.searchHtmlElement(f,null,null,null,d,g,true,c.pageNumber);return}}var i=/[-[\]{}()*+?.,\\^$|#\s]/g;if(h){d=a.getWords(b);d=jQuery.map(d,function(a){return a.replace(i,"\\$&")})}else d=a.getWords(b);a.searchHtmlElement(f,null,null,null,d,g,false,c.pageNumber);return}}}};if(this.viewerLeft!=0){this.viewerWidth-=this.viewerLeft;this.documentSpace.css("width",this.viewerWidth+"px")}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(0);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();this.useTabsForPages=ko.observable(false);this.tabs=ko.observableArray([]);if(this.pageContentType=="html"){this.imageHorizontalMargin=0;this.calculatePointToPixelRatio()}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";this.options.highlightColor=a.highlightColor;this.matchedNods=[];this.searchMatches=[];this.serverPages=[{w:this.initialWidth,h:100}];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.watermarkColor,this.ignoreDocumentAbsence,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,this.fileDisplayName,this.usePngImagesForHtmlBasedEngine,this.convertWordDocumentsCompletely,this.ignoreDocumentAbsence,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,c){var a;if(this.useTabsForPages())a=this.tabs()[b];else a=this.pages()[b];if(!a.visible()&&!a.startedDownloadingPage){a.startedDownloadingPage=true;this._model.getDocumentPageHtml(this.fileId,b,this.usePngImagesForHtmlBasedEngine,function(e){var d=e;a.htmlContent(d);a.searchText({text:this.searchText,isCaseSensitive:false,searchForSeparateWords:this.searchForSeparateWords,treatPhrasesInDoubleQuotesAsExact:this.treatPhrasesInDoubleQuotesAsExact,pageNumber:b});a.visible(true);a.startedDownloadingPage=false;c&&c.call()}.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.watermarkColor,this.useHtmlBasedEngine,function(b){for(a=0;a0&&this._firstPage.length==0)return;a(this).trigger("onProcessPages",[this.docGuid]);this.inprogress(false);this.pageContentType=="image"&&this.recalculatePageLeft();var l=Math.floor(this.pagesContainerElement.width()/this.pageWidth());if(l==0)l=1;if(this.alwaysOnePageInRow)l=1;var E=this.scale();this._dvselectable=this.pagesContainerElement.dvselectable({txtarea:this.selectionContent,pdf2XmlWrapper:this._pdf2XmlWrapper,startNumbers:this.getVisiblePagesNumbers(),pagesCount:this.pageCount(),proportion:E,pageHeight:this.getPageHeight(),horizontalPageCount:l,docSpace:this.documentSpace,pagePrefix:this.pagePrefix,searchPartialWords:this.searchPartialWords,storeAnnotationCoordinatesRelativeToPages:this.storeAnnotationCoordinatesRelativeToPages,initializeStorageOnly:this.pageContentType=="html",preventTouchEventsBubbling:this.preventTouchEventsBubbling,highlightColor:this.options.highlightColor});this._dvselectable.dvselectable("setVisiblePagesNumbers",this.getVisiblePagesNumbers());!this.zoomToFitHeight&&this.loadImagesForVisiblePages();if(!this.docWasLoadedInViewer&&(this.usePageNumberInUrlHash===b||this.usePageNumberInUrlHash==true)){var z=location.pathname;location.hash.substring(1,this.hashPagePrefix.length+1)!=this.hashPagePrefix&&this.setPage(1);Sammy(function(){this.get(/\#page(.*)/i,b);this.get(z,a);function a(){i.pageInd()!=1&&i.setPage(1)}function b(){if(!i.changedUrlHash)if(!(this.params.splat.length==0||this.params.splat[0].length==0)){var b=this.params.splat[0],a=Number(b);if(isNaN(a))a=1;if(a>i.pageCount())a=i.pageCount();if(a<1)a=1;i.setPage(a)}}}).run()}else this.setPage(1);this.zoomToFitHeight&&this.setZoom(this.getFitHeightZoom());if(this.pageContentType=="html"&&this.zoomToFitWidth){var u=this.getFitWidth(),r=this.pageWidth();if(!this.onlyShrinkLargePages||r>u){var F=u/r*100;this.setZoom(F)}}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},getViewerHeight:function(){var a;if(this.viewerHeight)a=this.viewerHeight;else a=this.documentSpace.parent().height();return a},getFitHeightZoom:function(){var a=this.getViewerHeight();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(e,g,d,c){if(this.pageContentType=="image"){var h=this.getSelectableInstance();if(h!=null){var k=h.performSearch(e,this.zoom()/100,g,d,c);a(this).trigger("onSearchPerformed",[k])}}else{this.searchText=e;this.searchForSeparateWords=d;this.treatPhrasesInDoubleQuotesAsExact=c;for(var i=this.pages(),f,b=0;b0&&e==-1||e!=-1)m="^"+m;n=new RegExp(m,u?null:"i");d=b.data;if(e==-1){if(s){d=d.substr(j,d.length-j);c=j;s=false}}else{c=e+B;d=d.substr(c,d.length-c)}a=d.match(n);if(a){if(e==-1)this.matchedNodsCount++;z++;this.matchedNods.push(b);var y=c+a.index,x=a[0].length;if(this.currentWordCounter==0){y=c+d.indexOf(a[1],a.index);x=a[1].length}if(this.currentWordCounter==g-1){var o=i[this.currentWordCounter],t=d;if(!u){o=o.toLowerCase();t=t.toLowerCase()}var E=c+t.indexOf(o,a.index);x=o.length+E-y}this.searchMatches.push({index:y,length:x});this.currentWordCounter++;if(this.currentWordCounter>=g){for(var D="search_highlight"+this.matchesCount.toString(),h=g-1;h>=0;h--)this.highlightOneNode(this.matchedNods[h],this.searchMatches[h].index,this.searchMatches[h].length,D,f,l,w);this.currentWordCounter=0;this.matchedNods=[];this.searchMatches=[];this.matchedNodsCount=0;this.matchesCount++;return z}}else{this.currentWordCounter=0;this.matchedNods=[];this.searchMatches=[]}}while(a&&c+a.index+a[0].length1){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").css("width",c+"pt"),d=b.width();this.pointToPixelRatio=d/c;b.remove()},activateTab:function(c){var d=this.tabs()[c],a=this;function b(){var b=a.pages();b[0].htmlContent(d.htmlContent());var f=a.documentSpace.find(".html_page_contents:first"),c=f.children("div,table"),e=c.width();b[0].prop=c.height()/e;a.pages([]);a.pageWidth(e);a.pages(b)}if(d.visible())b();else this.getDocumentPageHtml(c,function(){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,f=null,d=null,l=null,i=null,r=null,m=null,b=null,h=null,c=null,e=null,k=null,j=null,p=null,q="onMenuClicked";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()}var o=0;if(this.thumbnails)o=c.getThumbnailsPanelWidth();if(this.docSpace){var s=$.extend({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,viewerLeft:o,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,preventTouchEventsBubbling:this.preventTouchEventsBubbling,watermarkText:this.watermarkText},this.viewerOptions);g=this.docSpace.docViewer(s);b=this.docSpace.docViewer("getViewModel")}else{g=this.docSpaceCreator();b=this.docSpaceViewModel()}var n=null,a=null;if(this.docSpacePageFlip){n=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){f=this.navigation.navigation(this.navigationOptions);h=this.navigation.navigation("getViewModel")}if(this.search){i=this.search.search($.extend(this.searchOptions,{viewerViewModel:b}));k=this.search.search("getViewModel")}if(this.zooming){l=this.zooming.zooming(this.zoomingOptions||{});e=this.zooming.zooming("getViewModel")}if(this.embedSource){r=this.embedSource.embedSource();j=this.embedSource.embedSource("getViewModel")}if(this.viewTypeMenu){m=this.viewTypeMenu;p=this.viewTypeViewModel}this.docViewerViewModel=b;this.docViewerPageFlipViewModel=a;this.navigationViewModel=h;this.thumbnailsViewModel=c;this.zoomViewModel=e;this.searchViewModel=k;this.embedSourceViewModel=j;g.bind("getPagesCount",function(b,a){f&&h.setPagesCount(a)}.bind(this));g.bind("onDocumentloadingStarted",function(){d&&c.hideThumbnails()}.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);f&&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 f=c.url;$("#btnDownload,#btnDownload2").bind({click:function(){window.location.href=f;return false}});if(r){j.setGuid(c.guid);j.setFileId(b.getFileId());j.password(b.password())}if(l)if(b.isScrollViewerVisible()){e.setFitWidthZoom(b.getFitWidthZoom());e.setFitHeightZoom(b.getFitHeightZoom());e.setZoomWithoutEvent(b.zoom())}else if(a){e.setFitWidthZoom(a.getFitWidthZoom());e.setFitHeightZoom(a.getFitHeightZoom());e.setZoomWithoutEvent(a.zoom())}i&&k.documentLoaded()}.bind(this));n&&n.bind("onPageTurned",function(e,a){f&&h.setPageIndex(a);d&&c.pageInd(a);b.pageInd(a);b.setPageNumerInUrlHash(a)});i&&i.bind("onPerformSearch",function(f,e,d,c,a){b.performSearch(e,d,c,a)});if(f){f.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));f.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));f.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))}if(l){l.bind("onSetZoom",function(d,c){a&&a.setZoom(c);b.setZoom(c);i&&k.resetButtons()}.bind(this));l.bind(q,function(){m&&p.showDropDownMenu(false)})}if(d){d.bind("onSetThumbnails",function(d,c){b.setPage(c);a&&a.setPage(c);f&&h.setPageIndex(c)}.bind(this));d.bind("onSetThumbnailsScroll",function(b,a){f&&h.setPageIndex(a)}.bind(this));d.bind("onResizeThumbnails",function(c,a){b.resizeViewerElement(a)});d.bind("onPageReordered",function(d,c,a){b.onPageReordered(c,a)})}m&&m.bind(q,function(){e&&e.showDropDownMenu(false)})},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)},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this}});jSaaspose.Rect=function(b,d,c,e,a){this.set(b,d,c,e,a)};$.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,false)},"set":function(b,d,c,e,a){if(!this.topLeft)this.topLeft=new jSaaspose.Point;if(!this.bottomRight)this.bottomRight=new jSaaspose.Point;this.topLeft.x=b;this.topLeft.y=d;this.bottomRight.x=c;this.bottomRight.y=e;return a?this.normalize():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},round:function(){this.topLeft=this.topLeft.round();this.bottomRight=this.bottomRight.round();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.ythis.bottomRight.x)this.bottomRight.x=([this.topLeft.x,this.topLeft.x=this.bottomRight.x])[0];if(this.topLeft.y>this.bottomRight.y)this.bottomRight.y=([this.topLeft.y,this.topLeft.y=this.bottomRight.y])[0];return this}});$.ctrl=function(c,b,a){$(document).keydown(function(d){if(!a)a=[];if(d.keyCode==c.charCodeAt(0)&&d.ctrlKey){b.apply(this,a);return true}})};(function(a){a.widget("ui.dvselectable",a.ui.mouse,{customArea:[],search:[],lasso:null,pages:[],prevProportions:1,prevCustomTemplateProportions:1,searchProportions:1,selectedRowsCoordinates:[],highlightPaneContainer:null,highlightSearchPaneContainer:null,buttonPaneContainer:null,template:"
",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:"",highlightColor:null},_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(d){var c=a(d),e=c.offset().left-b._canvasOffset.x+b._canvasScroll.x,f=b.options.bookLayout?0:c.offset().top-b.element.offset().top;return new jSaaspose.Point(e,f)})},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(u){if(this._mode==this.SelectionModes.DoNothing)return false;this.helper.remove();var r=this._findPageAt(this.lasso.topLeft)||this.pages[0],k;if(typeof r==="undefined")return false;var e=parseInt(r.pageId)-1,h=null;if(e<0)return false;if(this._mode==this.SelectionModes.SelectText||this._mode==this.SelectionModes.SelectTextToStrikeout){if(!this.dragged)return false;var w=this;this.dragged=false;var c=w._getDocumentHighlightRects();if(!c||c.length==0)return false;var o="",b;if(this.options.storeAnnotationCoordinatesRelativeToPages)b=this.convertRectToRelativeToPageUnscaledCoordinates(this.lasso);else b=this.convertRectToAbsoluteCoordinates(this.lasso);var g=b.top(),f=b.bottom();b=c[0].originalRect;var n=b.left(),m=b.right(),j=b.top(),i=b.bottom(),p=c[0].position,s=c[c.length-1].position+c[c.length-1].length-p;h=[];for(var d=0;d0&&(c[d-1].page!=c[d].page||c[d-1].row!=c[d].row)?"\r\n":" ";b=c[d].originalRect;h.push(b);n=Math.min(n,b.left());m=Math.max(m,b.right());j=Math.min(j,b.top());i=Math.max(i,b.bottom())}var v=this.options.proportion;if(this.options.storeAnnotationCoordinatesRelativeToPages){g=Math.min(j,g);f=Math.max(i,f)}else{k=e*this.options.pageHeight;k/=v;g=Math.max(k+j,g);f=Math.min(k+i,f)}var t=new jSaaspose.Rect(n,g,m,f),q=t.clone();this.options.txtarea.val(a.trim(o)).focus().select()}switch(this._mode){case this.SelectionModes.SelectText:this.element.trigger("onTextSelected",[e,q,p,s,this.selectionCounter,h]);break;case this.SelectionModes.SelectTextToStrikeout:this.element.trigger("onTextToStrikeoutSelected",[e,q,p,s,this.selectionCounter,h]);break;case this.SelectionModes.SelectRectangle:var l;if(this.options.storeAnnotationCoordinatesRelativeToPages)l=this.convertRectToRelativeToPageUnscaledCoordinates(this.lasso,this._mouseStartPos);else l=this.convertRectToAbsoluteCoordinates(this.lasso,this._mouseStartPos);this.element.trigger("onRectangleSelected",[e,l]);break;case this.SelectionModes.ClickPoint:this.mouseClickHandler(u);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=2&&r[0]=='"'&&r[r.length-1]=='"'){F=false;c=r.substr(1,r.length-2);c=c.replace(/^[\r\n\s]+|[\r\n\s]+$/g,"");O=true}}this.search.length=0;this.initHighlightSearchPaneContainer();if(c=="")return-1;this.searchProportions=gb;for(var cb=this.pages,hb=cb.length,j=[],m=[],l,kb,Z,ab,e,V=0,t,s=0;s=Math.round(i)){z=h;break}}var n=z+t;if(nK)f=i;o=n+C.length;k=g[o];d=b[q].rect.clone();d.subtract(b[q].pageLocation);var D=this.options.proportion,Y=f*D,X=k*D;d.setLeft(Y);d.setRight(X);j.push(d)}}}else{var u=w.indexOf(c);while(u!=-1){var d;b=y.words;if(this.options.searchPartialWords){var U=/\s/g,H=w.substring(0,u),W=H.match(U),T=c.match(U),p=0,R=0;if(W)p=W.length;if(T)R=T.length;var B=p+R,g=this.options.pdf2XmlWrapper.getRowCharacterCoordinates(s,x),i=b[p].originalRect.left(),fb=b[B].originalRect.left(),K=b[B].originalRect.right(),bb=y.originalRect.right();t=H.length-H.lastIndexOf(" ")-1;for(var z=0,P=0,N=false,h=0;h=Math.round(i)){z=h;N=true}if(Math.round(G)>=Math.round(fb)){P=h;break}}var n=z+t;if(nK)f=i;var eb=c.lastIndexOf(" "),E=c.substring(eb+1,c.length),o;if(p==B)o=n+c.length;else o=P+E.length;var S=true;if(o0){this.search.push({PageId:jb,pageWords:j.slice(0)});V+=j.length;j.length=0}}this.highlightSearch(this.search);return V},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
",e=0;ec.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;b0&&b.length==0)return null;var d=100,h=Math.ceil(e/d),k=a*this.documentDescription.widthForMaxHeight,m=0,c=function(q,j,g,m,o,r){for(var n=false,a=j*d;ao){n=true;break}f=b[a-m]}else f=b[a];var p=i.number;g=k/i.w;var s=this.getRows(i,p,g,l,f),u=f.x+i.w*g,t=f.y+i.h*g;q.push({pageId:p,rows:s,rect:new jSaaspose.Rect(f.x,f.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){b.id>0&&b.type==="file"&&a(this.fileOpenDialog.fileExplorer).trigger("fileSelected",b)},_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);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,isKeepBothMode: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:this.options.key?Container.Resolve("HttpProvider").signUrl(b,this.options.key):b,skipErrors:this.options.skipErrors,isKeepBothMode:this.options.isKeepBothMode});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(f,c){var b=this._handler.add(f,jSaaspose.utils.getSequenceNumber()),e=this._handler.getPath(b);if(typeof c!=="undefined")this._handler.isKeepBothMode=c;if(!this._beforeStart(e)){this._handler.cancel(b);return}var d=this._addFileItem(b,e);if(this.options.formats==""||this.options.formats.indexOf(d.ext.toLowerCase())!=-1){a(this.element).trigger("onAdded",[d,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(b,a){return this._uploadFile(b,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("target","iframe"+c);b.attr("action",this.isForUserStorage?this._buildUriForIframeAction():this.action);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