12345678 |
- /** Notice * This file contains works from many authors under various (but compatible) licenses. Please see core.txt for more information. **/
- (function(){(window.wpCoreControlsBundle=window.wpCoreControlsBundle||[]).push([[23],{446:function(ia,da,e){e.r(da);var ca=e(1),y=e(11),ha=e(2);ia=e(50);var ea=e(31),fa=e(10);e=function(){function e(){this.init()}e.prototype.init=function(){this.r5=!1;this.qf=this.al=this.connection=null;this.Lr={};this.fa=this.OE=null};e.prototype.ela=function(e){for(var w=this,r=0;r<e.length;++r){var h=e[r];switch(h.at){case "create":this.Lr[h.author]||(this.Lr[h.author]=h.aName);this.ica(h);break;case "modify":this.fa.El(h.xfdf).then(function(e){w.fa.rb(e[0])});
- break;case "delete":this.fa.El("<delete><id>"+h.aId+"</id></delete>")}}};e.prototype.ica=function(e){var w=this;this.fa.El(e.xfdf).then(function(r){r=r[0];r.authorId=e.author;w.fa.rb(r);w.fa.trigger(y.a.UPDATE_ANNOTATION_PERMISSION,[r])})};e.prototype.Iba=function(e,y,r){this.al&&this.al(e,y,r)};e.prototype.preloadAnnotations=function(e){this.addEventListener("webViewerServerAnnotationsEnabled",this.Iba.bind(this,e,"add",{imported:!1}),{once:!0})};e.prototype.initiateCollaboration=function(w,aa,r){var h=
- this;if(w){h.qf=aa;h.fa=r.ua();r.addEventListener(y.c.DOCUMENT_UNLOADED,function(){h.disableCollaboration()});h.Gla(w);var n=new XMLHttpRequest;n.addEventListener("load",function(){if(200===n.status&&0<n.responseText.length)try{var f=JSON.parse(n.responseText);h.connection=exports.Xa.kma(Object(ea.j)(h.qf,"blackbox/"),"annot");h.OE=f.id;h.Lr[f.id]=f.user_name;h.fa.JL(f.id);h.connection.qM(function(e){e.t&&e.t.startsWith("a_")&&e.data&&h.ela(e.data)},function(){h.connection.send({t:"a_retrieve",dId:w});
- h.trigger(e.Events.WEBVIEWER_SERVER_ANNOTATIONS_ENABLED,[h.Lr[f.id],h.OE])},function(){h.disableCollaboration()})}catch(z){Object(ha.g)(z.message)}});n.open("GET",Object(ea.j)(this.qf,"demo/SessionInfo.jsp"));n.withCredentials=!0;n.send();h.r5=!0;h.fa.KX(function(e){return h.Lr[e.Author]||e.Author})}else Object(ha.g)("Document ID required for collaboration")};e.prototype.disableCollaboration=function(){this.al&&(this.fa.removeEventListener(fa.a.Events.ANNOTATION_CHANGED,this.al),this.al=null);this.connection&&
- this.connection.OH();this.fa&&this.fa.JL("Guest");this.init();this.trigger(e.Events.WEBVIEWER_SERVER_ANNOTATIONS_DISABLED)};e.prototype.Gla=function(e){var w=this;this.al&&this.fa.removeEventListener(fa.a.Events.ANNOTATION_CHANGED,this.al);this.al=function(r,h,n){return Object(ca.b)(this,void 0,void 0,function(){var f,y,x,aa,ba,da,ea,fa,ha;return Object(ca.d)(this,function(z){switch(z.label){case 0:if(n.imported)return[2];f={t:"a_"+h,dId:e,annots:[]};return[4,w.fa.TH()];case 1:y=z.ea();"delete"!==
- h&&(x=(new DOMParser).parseFromString(y,"text/xml"),aa=new XMLSerializer);for(ba=0;ba<r.length;ba++)da=r[ba],fa=ea=void 0,"add"===h?(ea=x.querySelector('[name="'+da.Id+'"]'),fa=aa.serializeToString(ea),ha=null,da.InReplyTo&&(ha=w.fa.$f(da.InReplyTo).authorId||"default"),f.annots.push({at:"create",aId:da.Id,author:w.OE,aName:w.Lr[w.OE],parent:ha,xfdf:"<add>"+fa+"</add>"})):"modify"===h?(ea=x.querySelector('[name="'+da.Id+'"]'),fa=aa.serializeToString(ea),f.annots.push({at:"modify",aId:da.Id,xfdf:"<modify>"+
- fa+"</modify>"})):"delete"===h&&f.annots.push({at:"delete",aId:da.Id});0<f.annots.length&&w.connection.send(f);return[2]}})})}.bind(w);this.fa.addEventListener(fa.a.Events.ANNOTATION_CHANGED,this.al)};e.Events={WEBVIEWER_SERVER_ANNOTATIONS_ENABLED:"webViewerServerAnnotationsEnabled",WEBVIEWER_SERVER_ANNOTATIONS_DISABLED:"webViewerServerAnnotationsDisabled"};return e}();Object(ia.a)(e);da["default"]=e}}]);}).call(this || window)
|