12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720 |
- if (!window.zammadChatTemplates) {
- window.zammadChatTemplates = {};
- }
- window.zammadChatTemplates["agent"] = function(__obj) {
- if (!__obj) __obj = {};
- var __out = [], __capture = function(callback) {
- var out = __out, result;
- __out = [];
- callback.call(this);
- result = __out.join('');
- __out = out;
- return __safe(result);
- }, __sanitize = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else if (typeof value !== 'undefined' && value != null) {
- return __escape(value);
- } else {
- return '';
- }
- }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
- __safe = __obj.safe = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else {
- if (!(typeof value !== 'undefined' && value != null)) value = '';
- var result = new String(value);
- result.ecoSafe = true;
- return result;
- }
- };
- if (!__escape) {
- __escape = __obj.escape = function(value) {
- return ('' + value)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- };
- }
- (function() {
- (function() {
- if (this.agent.avatar) {
- __out.push('\n<img class="zammad-chat-agent-avatar" src="');
- __out.push(__sanitize(this.agent.avatar));
- __out.push('">\n');
- }
-
- __out.push('\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">');
-
- __out.push(__sanitize(this.agent.name));
-
- __out.push('</span>\n</span>');
-
- }).call(this);
-
- }).call(__obj);
- __obj.safe = __objSafe, __obj.escape = __escape;
- return __out.join('');
- };
- if (!window.zammadChatTemplates) {
- window.zammadChatTemplates = {};
- }
- window.zammadChatTemplates["chat"] = function(__obj) {
- if (!__obj) __obj = {};
- var __out = [], __capture = function(callback) {
- var out = __out, result;
- __out = [];
- callback.call(this);
- result = __out.join('');
- __out = out;
- return __safe(result);
- }, __sanitize = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else if (typeof value !== 'undefined' && value != null) {
- return __escape(value);
- } else {
- return '';
- }
- }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
- __safe = __obj.safe = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else {
- if (!(typeof value !== 'undefined' && value != null)) value = '';
- var result = new String(value);
- result.ecoSafe = true;
- return result;
- }
- };
- if (!__escape) {
- __escape = __obj.escape = function(value) {
- return ('' + value)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- };
- }
- (function() {
- (function() {
- __out.push('<div class="zammad-chat');
-
- if (this.flat) {
- __out.push(__sanitize(' zammad-chat--flat'));
- }
-
- __out.push('"');
-
- if (this.fontSize) {
- __out.push(__sanitize(" style='font-size: " + this.fontSize + "'"));
- }
-
- __out.push('>\n <div class="zammad-chat-header js-chat-open"');
-
- if (this.background) {
- __out.push(__sanitize(" style='background: " + this.background + "'"));
- }
-
- __out.push('>\n <div class="zammad-chat-header-controls js-chat-toggle">\n <span class="zammad-chat-agent-status zammad-chat-is-hidden js-chat-status" data-status="online"></span>\n <span class="zammad-chat-header-icon">\n <svg class="zammad-chat-header-icon-open" width="13" height="7" viewBox="0 0 13 7"><path d="M10.807 7l1.4-1.428-5-4.9L6.5-.02l-.7.7-4.9 4.9 1.414 1.413L6.5 2.886 10.807 7z" fill-rule="evenodd"/></svg>\n <svg class="zammad-chat-header-icon-close" width="13" height="13" viewBox="0 0 13 13"><path d="m2.241.12l-2.121 2.121 4.243 4.243-4.243 4.243 2.121 2.121 4.243-4.243 4.243 4.243 2.121-2.121-4.243-4.243 4.243-4.243-2.121-2.121-4.243 4.243-4.243-4.243" fill-rule="evenodd"/></svg>\n </span>\n </div>\n <div class="zammad-chat-agent zammad-chat-is-hidden">\n </div>\n <div class="zammad-chat-welcome">\n <svg class="zammad-chat-icon" viewBox="0 0 24 24" width="24" height="24"><path d="M2 5C2 4 3 3 4 3h16c1 0 2 1 2 2v10C22 16 21 17 20 17H4C3 17 2 16 2 15V5zM12 17l6 4v-4h-6z"/></svg>\n <span class="zammad-chat-welcome-text">');
-
- __out.push(this.T(this.title));
-
- __out.push('</span>\n </div>\n </div>\n <div class="zammad-chat-modal"></div>\n <div class="zammad-scroll-hint is-hidden">\n <svg class="zammad-scroll-hint-icon" width="20" height="18" viewBox="0 0 20 18"><path d="M0,2.00585866 C0,0.898053512 0.898212381,0 1.99079514,0 L18.0092049,0 C19.1086907,0 20,0.897060126 20,2.00585866 L20,11.9941413 C20,13.1019465 19.1017876,14 18.0092049,14 L1.99079514,14 C0.891309342,14 0,13.1029399 0,11.9941413 L0,2.00585866 Z M10,14 L16,18 L16,14 L10,14 Z" fill-rule="evenodd"/></svg>\n ');
-
- __out.push(this.T(this.scrollHint));
-
- __out.push('\n </div>\n <div class="zammad-chat-body"></div>\n <form class="zammad-chat-controls">\n <div class="zammad-chat-input" rows="1" placeholder="');
-
- __out.push(this.T('Compose your message…'));
-
- __out.push('" contenteditable="true"></div>\n <button type="submit" class="zammad-chat-button zammad-chat-send"');
-
- if (this.background) {
- __out.push(__sanitize(" style='background: " + this.background + "'"));
- }
-
- __out.push('>');
-
- __out.push(this.T('Send'));
-
- __out.push('</button>\n </form>\n</div>');
-
- }).call(this);
-
- }).call(__obj);
- __obj.safe = __objSafe, __obj.escape = __escape;
- return __out.join('');
- };
- if (!window.zammadChatTemplates) {
- window.zammadChatTemplates = {};
- }
- window.zammadChatTemplates["customer_timeout"] = function(__obj) {
- if (!__obj) __obj = {};
- var __out = [], __capture = function(callback) {
- var out = __out, result;
- __out = [];
- callback.call(this);
- result = __out.join('');
- __out = out;
- return __safe(result);
- }, __sanitize = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else if (typeof value !== 'undefined' && value != null) {
- return __escape(value);
- } else {
- return '';
- }
- }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
- __safe = __obj.safe = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else {
- if (!(typeof value !== 'undefined' && value != null)) value = '';
- var result = new String(value);
- result.ecoSafe = true;
- return result;
- }
- };
- if (!__escape) {
- __escape = __obj.escape = function(value) {
- return ('' + value)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- };
- }
- (function() {
- (function() {
- __out.push('<div class="zammad-chat-modal-text">\n ');
-
- if (this.agent) {
- __out.push('\n ');
- __out.push(this.T('Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.', this.delay, this.agent));
- __out.push('\n ');
- } else {
- __out.push('\n ');
- __out.push(this.T('Since you didn\'t respond in the last %s minutes your conversation was closed.', this.delay));
- __out.push('\n ');
- }
-
- __out.push('\n <br>\n <div class="zammad-chat-button js-restart"');
-
- if (this.background) {
- __out.push(__sanitize(" style='background: " + this.background + "'"));
- }
-
- __out.push('>');
-
- __out.push(this.T('Start new conversation'));
-
- __out.push('</div>\n</div>');
-
- }).call(this);
-
- }).call(__obj);
- __obj.safe = __objSafe, __obj.escape = __escape;
- return __out.join('');
- };
- if (!window.zammadChatTemplates) {
- window.zammadChatTemplates = {};
- }
- window.zammadChatTemplates["loader"] = function(__obj) {
- if (!__obj) __obj = {};
- var __out = [], __capture = function(callback) {
- var out = __out, result;
- __out = [];
- callback.call(this);
- result = __out.join('');
- __out = out;
- return __safe(result);
- }, __sanitize = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else if (typeof value !== 'undefined' && value != null) {
- return __escape(value);
- } else {
- return '';
- }
- }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
- __safe = __obj.safe = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else {
- if (!(typeof value !== 'undefined' && value != null)) value = '';
- var result = new String(value);
- result.ecoSafe = true;
- return result;
- }
- };
- if (!__escape) {
- __escape = __obj.escape = function(value) {
- return ('' + value)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- };
- }
- (function() {
- (function() {
- __out.push('<span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n</span>\n<span class="zammad-chat-modal-text">');
-
- __out.push(this.T('Connecting'));
-
- __out.push('</span>');
-
- }).call(this);
-
- }).call(__obj);
- __obj.safe = __objSafe, __obj.escape = __escape;
- return __out.join('');
- };
- if (!window.zammadChatTemplates) {
- window.zammadChatTemplates = {};
- }
- window.zammadChatTemplates["message"] = function(__obj) {
- if (!__obj) __obj = {};
- var __out = [], __capture = function(callback) {
- var out = __out, result;
- __out = [];
- callback.call(this);
- result = __out.join('');
- __out = out;
- return __safe(result);
- }, __sanitize = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else if (typeof value !== 'undefined' && value != null) {
- return __escape(value);
- } else {
- return '';
- }
- }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
- __safe = __obj.safe = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else {
- if (!(typeof value !== 'undefined' && value != null)) value = '';
- var result = new String(value);
- result.ecoSafe = true;
- return result;
- }
- };
- if (!__escape) {
- __escape = __obj.escape = function(value) {
- return ('' + value)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- };
- }
- (function() {
- (function() {
- __out.push('<div class="zammad-chat-message zammad-chat-message--');
-
- __out.push(__sanitize(this.from));
-
- __out.push(__sanitize(this.unreadClass));
-
- __out.push('">\n <span class="zammad-chat-message-body"');
-
- if (this.background && this.from === 'customer') {
- __out.push(__sanitize(" style='background: " + this.background + "'"));
- }
-
- __out.push('>');
-
- __out.push(this.message);
-
- __out.push('</span>\n</div>');
-
- }).call(this);
-
- }).call(__obj);
- __obj.safe = __objSafe, __obj.escape = __escape;
- return __out.join('');
- };
- if (!window.zammadChatTemplates) {
- window.zammadChatTemplates = {};
- }
- window.zammadChatTemplates["status"] = function(__obj) {
- if (!__obj) __obj = {};
- var __out = [], __capture = function(callback) {
- var out = __out, result;
- __out = [];
- callback.call(this);
- result = __out.join('');
- __out = out;
- return __safe(result);
- }, __sanitize = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else if (typeof value !== 'undefined' && value != null) {
- return __escape(value);
- } else {
- return '';
- }
- }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
- __safe = __obj.safe = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else {
- if (!(typeof value !== 'undefined' && value != null)) value = '';
- var result = new String(value);
- result.ecoSafe = true;
- return result;
- }
- };
- if (!__escape) {
- __escape = __obj.escape = function(value) {
- return ('' + value)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- };
- }
- (function() {
- (function() {
- __out.push('<div class="zammad-chat-status">\n <div class="zammad-chat-status-inner">\n ');
-
- __out.push(this.status);
-
- __out.push('\n </div>\n</div>');
-
- }).call(this);
-
- }).call(__obj);
- __obj.safe = __objSafe, __obj.escape = __escape;
- return __out.join('');
- };
- if (!window.zammadChatTemplates) {
- window.zammadChatTemplates = {};
- }
- window.zammadChatTemplates["timestamp"] = function(__obj) {
- if (!__obj) __obj = {};
- var __out = [], __capture = function(callback) {
- var out = __out, result;
- __out = [];
- callback.call(this);
- result = __out.join('');
- __out = out;
- return __safe(result);
- }, __sanitize = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else if (typeof value !== 'undefined' && value != null) {
- return __escape(value);
- } else {
- return '';
- }
- }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
- __safe = __obj.safe = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else {
- if (!(typeof value !== 'undefined' && value != null)) value = '';
- var result = new String(value);
- result.ecoSafe = true;
- return result;
- }
- };
- if (!__escape) {
- __escape = __obj.escape = function(value) {
- return ('' + value)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- };
- }
- (function() {
- (function() {
- __out.push('<div class="zammad-chat-timestamp"><strong>');
-
- __out.push(__sanitize(this.label));
-
- __out.push('</strong> ');
-
- __out.push(__sanitize(this.time));
-
- __out.push('</div>');
-
- }).call(this);
-
- }).call(__obj);
- __obj.safe = __objSafe, __obj.escape = __escape;
- return __out.join('');
- };
- if (!window.zammadChatTemplates) {
- window.zammadChatTemplates = {};
- }
- window.zammadChatTemplates["typingIndicator"] = function(__obj) {
- if (!__obj) __obj = {};
- var __out = [], __capture = function(callback) {
- var out = __out, result;
- __out = [];
- callback.call(this);
- result = __out.join('');
- __out = out;
- return __safe(result);
- }, __sanitize = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else if (typeof value !== 'undefined' && value != null) {
- return __escape(value);
- } else {
- return '';
- }
- }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
- __safe = __obj.safe = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else {
- if (!(typeof value !== 'undefined' && value != null)) value = '';
- var result = new String(value);
- result.ecoSafe = true;
- return result;
- }
- };
- if (!__escape) {
- __escape = __obj.escape = function(value) {
- return ('' + value)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- };
- }
- (function() {
- (function() {
- __out.push('<div class="zammad-chat-message zammad-chat-message--typing zammad-chat-message--agent">\n <span class="zammad-chat-message-body">\n <span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n </span>\n </span>\n</div>');
-
- }).call(this);
-
- }).call(__obj);
- __obj.safe = __objSafe, __obj.escape = __escape;
- return __out.join('');
- };
- if (!window.zammadChatTemplates) {
- window.zammadChatTemplates = {};
- }
- window.zammadChatTemplates["waiting_list_timeout"] = function(__obj) {
- if (!__obj) __obj = {};
- var __out = [], __capture = function(callback) {
- var out = __out, result;
- __out = [];
- callback.call(this);
- result = __out.join('');
- __out = out;
- return __safe(result);
- }, __sanitize = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else if (typeof value !== 'undefined' && value != null) {
- return __escape(value);
- } else {
- return '';
- }
- }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
- __safe = __obj.safe = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else {
- if (!(typeof value !== 'undefined' && value != null)) value = '';
- var result = new String(value);
- result.ecoSafe = true;
- return result;
- }
- };
- if (!__escape) {
- __escape = __obj.escape = function(value) {
- return ('' + value)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- };
- }
- (function() {
- (function() {
- __out.push('<div class="zammad-chat-modal-text">\n ');
-
- __out.push(this.T('We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!'));
-
- __out.push('\n <br>\n <div class="zammad-chat-button js-restart"');
-
- if (this.background) {
- __out.push(__sanitize(" style='background: " + this.background + "'"));
- }
-
- __out.push('>');
-
- __out.push(this.T('Start new conversation'));
-
- __out.push('</div>\n</div>');
-
- }).call(this);
-
- }).call(__obj);
- __obj.safe = __objSafe, __obj.escape = __escape;
- return __out.join('');
- };
- if (!window.zammadChatTemplates) {
- window.zammadChatTemplates = {};
- }
- window.zammadChatTemplates["waiting"] = function(__obj) {
- if (!__obj) __obj = {};
- var __out = [], __capture = function(callback) {
- var out = __out, result;
- __out = [];
- callback.call(this);
- result = __out.join('');
- __out = out;
- return __safe(result);
- }, __sanitize = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else if (typeof value !== 'undefined' && value != null) {
- return __escape(value);
- } else {
- return '';
- }
- }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
- __safe = __obj.safe = function(value) {
- if (value && value.ecoSafe) {
- return value;
- } else {
- if (!(typeof value !== 'undefined' && value != null)) value = '';
- var result = new String(value);
- result.ecoSafe = true;
- return result;
- }
- };
- if (!__escape) {
- __escape = __obj.escape = function(value) {
- return ('' + value)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"');
- };
- }
- (function() {
- (function() {
- __out.push('<div class="zammad-chat-modal-text">\n <span class="zammad-chat-loading-animation">\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n <span class="zammad-chat-loading-circle"></span>\n </span>\n ');
-
- __out.push(this.T('All colleagues are busy.'));
-
- __out.push('<br>\n ');
-
- __out.push(this.T('You are on waiting list position <strong>%s</strong>.', this.position));
-
- __out.push('\n</div>');
-
- }).call(this);
-
- }).call(__obj);
- __obj.safe = __objSafe, __obj.escape = __escape;
- return __out.join('');
- };
- /*! @license DOMPurify 2.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.1/LICENSE */
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).DOMPurify=t()}(this,(function(){"use strict";var e=Object.hasOwnProperty,t=Object.setPrototypeOf,n=Object.isFrozen,r=Object.getPrototypeOf,o=Object.getOwnPropertyDescriptor,i=Object.freeze,a=Object.seal,l=Object.create,c="undefined"!=typeof Reflect&&Reflect,s=c.apply,u=c.construct;s||(s=function(e,t,n){return e.apply(t,n)}),i||(i=function(e){return e}),a||(a=function(e){return e}),u||(u=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var f,m=x(Array.prototype.forEach),d=x(Array.prototype.pop),p=x(Array.prototype.push),g=x(String.prototype.toLowerCase),h=x(String.prototype.match),y=x(String.prototype.replace),v=x(String.prototype.indexOf),b=x(String.prototype.trim),T=x(RegExp.prototype.test),A=(f=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return u(f,t)});function x(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return s(e,t,r)}}function S(e,r){t&&t(e,null);for(var o=r.length;o--;){var i=r[o];if("string"==typeof i){var a=g(i);a!==i&&(n(r)||(r[o]=a),i=a)}e[i]=!0}return e}function w(t){var n=l(null),r=void 0;for(r in t)s(e,t,[r])&&(n[r]=t[r]);return n}function N(e,t){for(;null!==e;){var n=o(e,t);if(n){if(n.get)return x(n.get);if("function"==typeof n.value)return x(n.value)}e=r(e)}return function(e){return console.warn("fallback value for",e),null}}var k=i(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),E=i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),D=i(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),O=i(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),R=i(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),_=i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),M=i(["#text"]),L=i(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),F=i(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),I=i(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),C=i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),z=a(/\{\{[\s\S]*|[\s\S]*\}\}/gm),H=a(/<%[\s\S]*|[\s\S]*%>/gm),U=a(/^data-[\-\w.\u00B7-\uFFFF]/),j=a(/^aria-[\-\w]+$/),B=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),P=a(/^(?:\w+script|data):/i),W=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function q(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var K=function(){return"undefined"==typeof window?null:window},V=function(e,t){if("object"!==(void 0===e?"undefined":G(e))||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};return function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:K(),n=function(t){return e(t)};if(n.version="2.3.1",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,o=t.document,a=t.DocumentFragment,l=t.HTMLTemplateElement,c=t.Node,s=t.Element,u=t.NodeFilter,f=t.NamedNodeMap,x=void 0===f?t.NamedNodeMap||t.MozNamedAttrMap:f,Y=t.Text,X=t.Comment,$=t.DOMParser,Z=t.trustedTypes,J=s.prototype,Q=N(J,"cloneNode"),ee=N(J,"nextSibling"),te=N(J,"childNodes"),ne=N(J,"parentNode");if("function"==typeof l){var re=o.createElement("template");re.content&&re.content.ownerDocument&&(o=re.content.ownerDocument)}var oe=V(Z,r),ie=oe&&ze?oe.createHTML(""):"",ae=o,le=ae.implementation,ce=ae.createNodeIterator,se=ae.createDocumentFragment,ue=ae.getElementsByTagName,fe=r.importNode,me={};try{me=w(o).documentMode?o.documentMode:{}}catch(e){}var de={};n.isSupported="function"==typeof ne&&le&&void 0!==le.createHTMLDocument&&9!==me;var pe=z,ge=H,he=U,ye=j,ve=P,be=W,Te=B,Ae=null,xe=S({},[].concat(q(k),q(E),q(D),q(R),q(M))),Se=null,we=S({},[].concat(q(L),q(F),q(I),q(C))),Ne=null,ke=null,Ee=!0,De=!0,Oe=!1,Re=!1,_e=!1,Me=!1,Le=!1,Fe=!1,Ie=!1,Ce=!0,ze=!1,He=!0,Ue=!0,je=!1,Be={},Pe=null,We=S({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ge=null,qe=S({},["audio","video","img","source","image","track"]),Ke=null,Ve=S({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ye="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",$e="http://www.w3.org/1999/xhtml",Ze=$e,Je=!1,Qe=null,et=o.createElement("form"),tt=function(e){Qe&&Qe===e||(e&&"object"===(void 0===e?"undefined":G(e))||(e={}),e=w(e),Ae="ALLOWED_TAGS"in e?S({},e.ALLOWED_TAGS):xe,Se="ALLOWED_ATTR"in e?S({},e.ALLOWED_ATTR):we,Ke="ADD_URI_SAFE_ATTR"in e?S(w(Ve),e.ADD_URI_SAFE_ATTR):Ve,Ge="ADD_DATA_URI_TAGS"in e?S(w(qe),e.ADD_DATA_URI_TAGS):qe,Pe="FORBID_CONTENTS"in e?S({},e.FORBID_CONTENTS):We,Ne="FORBID_TAGS"in e?S({},e.FORBID_TAGS):{},ke="FORBID_ATTR"in e?S({},e.FORBID_ATTR):{},Be="USE_PROFILES"in e&&e.USE_PROFILES,Ee=!1!==e.ALLOW_ARIA_ATTR,De=!1!==e.ALLOW_DATA_ATTR,Oe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Re=e.SAFE_FOR_TEMPLATES||!1,_e=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,Ie=e.RETURN_DOM_FRAGMENT||!1,Ce=!1!==e.RETURN_DOM_IMPORT,ze=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,He=!1!==e.SANITIZE_DOM,Ue=!1!==e.KEEP_CONTENT,je=e.IN_PLACE||!1,Te=e.ALLOWED_URI_REGEXP||Te,Ze=e.NAMESPACE||$e,Re&&(De=!1),Ie&&(Fe=!0),Be&&(Ae=S({},[].concat(q(M))),Se=[],!0===Be.html&&(S(Ae,k),S(Se,L)),!0===Be.svg&&(S(Ae,E),S(Se,F),S(Se,C)),!0===Be.svgFilters&&(S(Ae,D),S(Se,F),S(Se,C)),!0===Be.mathMl&&(S(Ae,R),S(Se,I),S(Se,C))),e.ADD_TAGS&&(Ae===xe&&(Ae=w(Ae)),S(Ae,e.ADD_TAGS)),e.ADD_ATTR&&(Se===we&&(Se=w(Se)),S(Se,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&S(Ke,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(Pe===We&&(Pe=w(Pe)),S(Pe,e.FORBID_CONTENTS)),Ue&&(Ae["#text"]=!0),_e&&S(Ae,["html","head","body"]),Ae.table&&(S(Ae,["tbody"]),delete Ne.tbody),i&&i(e),Qe=e)},nt=S({},["mi","mo","mn","ms","mtext"]),rt=S({},["foreignobject","desc","title","annotation-xml"]),ot=S({},E);S(ot,D),S(ot,O);var it=S({},R);S(it,_);var at=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:$e,tagName:"template"});var n=g(e.tagName),r=g(t.tagName);if(e.namespaceURI===Xe)return t.namespaceURI===$e?"svg"===n:t.namespaceURI===Ye?"svg"===n&&("annotation-xml"===r||nt[r]):Boolean(ot[n]);if(e.namespaceURI===Ye)return t.namespaceURI===$e?"math"===n:t.namespaceURI===Xe?"math"===n&&rt[r]:Boolean(it[n]);if(e.namespaceURI===$e){if(t.namespaceURI===Xe&&!rt[r])return!1;if(t.namespaceURI===Ye&&!nt[r])return!1;var o=S({},["title","style","font","a","script"]);return!it[n]&&(o[n]||!ot[n])}return!1},lt=function(e){p(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ie}catch(t){e.remove()}}},ct=function(e,t){try{p(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){p(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Se[e])if(Fe||Ie)try{lt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},st=function(e){var t=void 0,n=void 0;if(Le)e="<remove></remove>"+e;else{var r=h(e,/^[\r\n\t ]+/);n=r&&r[0]}var i=oe?oe.createHTML(e):e;if(Ze===$e)try{t=(new $).parseFromString(i,"text/html")}catch(e){}if(!t||!t.documentElement){t=le.createDocument(Ze,"template",null);try{t.documentElement.innerHTML=Je?"":i}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),Ze===$e?ue.call(t,_e?"html":"body")[0]:_e?t.documentElement:a},ut=function(e){return ce.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,null,!1)},ft=function(e){return!(e instanceof Y||e instanceof X)&&!("string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof x&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore)},mt=function(e){return"object"===(void 0===c?"undefined":G(c))?e instanceof c:e&&"object"===(void 0===e?"undefined":G(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},dt=function(e,t,r){de[e]&&m(de[e],(function(e){e.call(n,t,r,Qe)}))},pt=function(e){var t=void 0;if(dt("beforeSanitizeElements",e,null),ft(e))return lt(e),!0;if(h(e.nodeName,/[\u0080-\uFFFF]/))return lt(e),!0;var r=g(e.nodeName);if(dt("uponSanitizeElement",e,{tagName:r,allowedTags:Ae}),!mt(e.firstElementChild)&&(!mt(e.content)||!mt(e.content.firstElementChild))&&T(/<[/\w]/g,e.innerHTML)&&T(/<[/\w]/g,e.textContent))return lt(e),!0;if("select"===r&&T(/<template/i,e.innerHTML))return lt(e),!0;if(!Ae[r]||Ne[r]){if(Ue&&!Pe[r]){var o=ne(e)||e.parentNode,i=te(e)||e.childNodes;if(i&&o)for(var a=i.length-1;a>=0;--a)o.insertBefore(Q(i[a],!0),ee(e))}return lt(e),!0}return e instanceof s&&!at(e)?(lt(e),!0):"noscript"!==r&&"noembed"!==r||!T(/<\/no(script|embed)/i,e.innerHTML)?(Re&&3===e.nodeType&&(t=e.textContent,t=y(t,pe," "),t=y(t,ge," "),e.textContent!==t&&(p(n.removed,{element:e.cloneNode()}),e.textContent=t)),dt("afterSanitizeElements",e,null),!1):(lt(e),!0)},gt=function(e,t,n){if(He&&("id"===t||"name"===t)&&(n in o||n in et))return!1;if(De&&!ke[t]&&T(he,t));else if(Ee&&T(ye,t));else{if(!Se[t]||ke[t])return!1;if(Ke[t]);else if(T(Te,y(n,be,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==v(n,"data:")||!Ge[e]){if(Oe&&!T(ve,y(n,be,"")));else if(n)return!1}else;}return!0},ht=function(e){var t=void 0,r=void 0,o=void 0,i=void 0;dt("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a){var l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Se};for(i=a.length;i--;){var c=t=a[i],s=c.name,u=c.namespaceURI;if(r=b(t.value),o=g(s),l.attrName=o,l.attrValue=r,l.keepAttr=!0,l.forceKeepAttr=void 0,dt("uponSanitizeAttribute",e,l),r=l.attrValue,!l.forceKeepAttr&&(ct(s,e),l.keepAttr))if(T(/\/>/i,r))ct(s,e);else{Re&&(r=y(r,pe," "),r=y(r,ge," "));var f=e.nodeName.toLowerCase();if(gt(f,o,r))try{u?e.setAttributeNS(u,s,r):e.setAttribute(s,r),d(n.removed)}catch(e){}}}dt("afterSanitizeAttributes",e,null)}},yt=function e(t){var n=void 0,r=ut(t);for(dt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)dt("uponSanitizeShadowNode",n,null),pt(n)||(n.content instanceof a&&e(n.content),ht(n));dt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,o){var i=void 0,l=void 0,s=void 0,u=void 0,f=void 0;if((Je=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!mt(e)){if("function"!=typeof e.toString)throw A("toString is not a function");if("string"!=typeof(e=e.toString()))throw A("dirty is not a string, aborting")}if(!n.isSupported){if("object"===G(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(mt(e))return t.toStaticHTML(e.outerHTML)}return e}if(Me||tt(o),n.removed=[],"string"==typeof e&&(je=!1),je);else if(e instanceof c)1===(l=(i=st("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?i=l:i.appendChild(l);else{if(!Fe&&!Re&&!_e&&-1===e.indexOf("<"))return oe&&ze?oe.createHTML(e):e;if(!(i=st(e)))return Fe?null:ie}i&&Le&<(i.firstChild);for(var m=ut(je?e:i);s=m.nextNode();)3===s.nodeType&&s===u||pt(s)||(s.content instanceof a&&yt(s.content),ht(s),u=s);if(u=null,je)return e;if(Fe){if(Ie)for(f=se.call(i.ownerDocument);i.firstChild;)f.appendChild(i.firstChild);else f=i;return Ce&&(f=fe.call(r,f,!0)),f}var d=_e?i.outerHTML:i.innerHTML;return Re&&(d=y(d,pe," "),d=y(d,ge," ")),oe&&ze?oe.createHTML(d):d},n.setConfig=function(e){tt(e),Me=!0},n.clearConfig=function(){Qe=null,Me=!1},n.isValidAttribute=function(e,t,n){Qe||tt({});var r=g(e),o=g(t);return gt(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&(de[e]=de[e]||[],p(de[e],t))},n.removeHook=function(e){de[e]&&d(de[e])},n.removeHooks=function(e){de[e]&&(de[e]=[])},n.removeAllHooks=function(){de={}},n}()}));
- //# sourceMappingURL=purify.min.js.map
- var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
- hasProp = {}.hasOwnProperty,
- bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
- slice = [].slice;
- (function(window) {
- var Base, Core, Io, Log, Timeout, ZammadChat, myScript, scriptHost, scriptProtocol, scripts;
- scripts = document.getElementsByTagName('script');
- myScript = scripts[scripts.length - 1];
- scriptProtocol = window.location.protocol.replace(':', '');
- if (myScript && myScript.src) {
- scriptHost = myScript.src.match('.*://([^:/]*).*')[1];
- scriptProtocol = myScript.src.match('(.*)://[^:/]*.*')[1];
- }
- Core = (function() {
- Core.prototype.defaults = {
- debug: false
- };
- function Core(options) {
- var key, ref, value;
- this.options = {};
- ref = this.defaults;
- for (key in ref) {
- value = ref[key];
- this.options[key] = value;
- }
- for (key in options) {
- value = options[key];
- this.options[key] = value;
- }
- }
- return Core;
- })();
- Base = (function(superClass) {
- extend(Base, superClass);
- function Base(options) {
- Base.__super__.constructor.call(this, options);
- this.log = new Log({
- debug: this.options.debug,
- logPrefix: this.options.logPrefix || this.logPrefix
- });
- }
- return Base;
- })(Core);
- Log = (function(superClass) {
- extend(Log, superClass);
- function Log() {
- this.log = bind(this.log, this);
- this.error = bind(this.error, this);
- this.notice = bind(this.notice, this);
- this.debug = bind(this.debug, this);
- return Log.__super__.constructor.apply(this, arguments);
- }
- Log.prototype.debug = function() {
- var items;
- items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
- if (!this.options.debug) {
- return;
- }
- return this.log('debug', items);
- };
- Log.prototype.notice = function() {
- var items;
- items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
- return this.log('notice', items);
- };
- Log.prototype.error = function() {
- var items;
- items = 1 <= arguments.length ? slice.call(arguments, 0) : [];
- return this.log('error', items);
- };
- Log.prototype.log = function(level, items) {
- var element, item, j, len, logString;
- items.unshift('||');
- items.unshift(level);
- items.unshift(this.options.logPrefix);
- console.log.apply(console, items);
- if (!this.options.debug) {
- return;
- }
- logString = '';
- for (j = 0, len = items.length; j < len; j++) {
- item = items[j];
- logString += ' ';
- if (typeof item === 'object') {
- logString += JSON.stringify(item);
- } else if (item && item.toString) {
- logString += item.toString();
- } else {
- logString += item;
- }
- }
- element = document.querySelector('.js-chatLogDisplay');
- if (element) {
- return element.innerHTML = '<div>' + logString + '</div>' + element.innerHTML;
- }
- };
- return Log;
- })(Core);
- Timeout = (function(superClass) {
- extend(Timeout, superClass);
- function Timeout() {
- this.stop = bind(this.stop, this);
- this.start = bind(this.start, this);
- return Timeout.__super__.constructor.apply(this, arguments);
- }
- Timeout.prototype.timeoutStartedAt = null;
- Timeout.prototype.logPrefix = 'timeout';
- Timeout.prototype.defaults = {
- debug: false,
- timeout: 4,
- timeoutIntervallCheck: 0.5
- };
- Timeout.prototype.start = function() {
- var check, timeoutStartedAt;
- this.stop();
- timeoutStartedAt = new Date;
- check = (function(_this) {
- return function() {
- var timeLeft;
- timeLeft = new Date - new Date(timeoutStartedAt.getTime() + _this.options.timeout * 1000 * 60);
- _this.log.debug("Timeout check for " + _this.options.timeout + " minutes (left " + (timeLeft / 1000) + " sec.)");
- if (timeLeft < 0) {
- return;
- }
- _this.stop();
- return _this.options.callback();
- };
- })(this);
- this.log.debug("Start timeout in " + this.options.timeout + " minutes");
- return this.intervallId = setInterval(check, this.options.timeoutIntervallCheck * 1000 * 60);
- };
- Timeout.prototype.stop = function() {
- if (!this.intervallId) {
- return;
- }
- this.log.debug("Stop timeout of " + this.options.timeout + " minutes");
- return clearInterval(this.intervallId);
- };
- return Timeout;
- })(Base);
- Io = (function(superClass) {
- extend(Io, superClass);
- function Io() {
- this.ping = bind(this.ping, this);
- this.send = bind(this.send, this);
- this.reconnect = bind(this.reconnect, this);
- this.close = bind(this.close, this);
- this.connect = bind(this.connect, this);
- this.set = bind(this.set, this);
- return Io.__super__.constructor.apply(this, arguments);
- }
- Io.prototype.logPrefix = 'io';
- Io.prototype.set = function(params) {
- var key, results, value;
- results = [];
- for (key in params) {
- value = params[key];
- results.push(this.options[key] = value);
- }
- return results;
- };
- Io.prototype.connect = function() {
- this.log.debug("Connecting to " + this.options.host);
- this.ws = new window.WebSocket("" + this.options.host);
- this.ws.onopen = (function(_this) {
- return function(e) {
- _this.log.debug('onOpen', e);
- _this.options.onOpen(e);
- return _this.ping();
- };
- })(this);
- this.ws.onmessage = (function(_this) {
- return function(e) {
- var j, len, pipe, pipes;
- pipes = JSON.parse(e.data);
- _this.log.debug('onMessage', e.data);
- for (j = 0, len = pipes.length; j < len; j++) {
- pipe = pipes[j];
- if (pipe.event === 'pong') {
- _this.ping();
- }
- }
- if (_this.options.onMessage) {
- return _this.options.onMessage(pipes);
- }
- };
- })(this);
- this.ws.onclose = (function(_this) {
- return function(e) {
- _this.log.debug('close websocket connection', e);
- if (_this.pingDelayId) {
- clearTimeout(_this.pingDelayId);
- }
- if (_this.manualClose) {
- _this.log.debug('manual close, onClose callback');
- _this.manualClose = false;
- if (_this.options.onClose) {
- return _this.options.onClose(e);
- }
- } else {
- _this.log.debug('error close, onError callback');
- if (_this.options.onError) {
- return _this.options.onError('Connection lost...');
- }
- }
- };
- })(this);
- return this.ws.onerror = (function(_this) {
- return function(e) {
- _this.log.debug('onError', e);
- if (_this.options.onError) {
- return _this.options.onError(e);
- }
- };
- })(this);
- };
- Io.prototype.close = function() {
- this.log.debug('close websocket manually');
- this.manualClose = true;
- return this.ws.close();
- };
- Io.prototype.reconnect = function() {
- this.log.debug('reconnect');
- this.close();
- return this.connect();
- };
- Io.prototype.send = function(event, data) {
- var msg;
- if (data == null) {
- data = {};
- }
- this.log.debug('send', event, data);
- msg = JSON.stringify({
- event: event,
- data: data
- });
- return this.ws.send(msg);
- };
- Io.prototype.ping = function() {
- var localPing;
- localPing = (function(_this) {
- return function() {
- return _this.send('ping');
- };
- })(this);
- return this.pingDelayId = setTimeout(localPing, 29000);
- };
- return Io;
- })(Base);
- ZammadChat = (function(superClass) {
- extend(ZammadChat, superClass);
- ZammadChat.prototype.defaults = {
- chatId: void 0,
- show: true,
- target: document.querySelector('body'),
- host: '',
- debug: false,
- flat: false,
- lang: void 0,
- cssAutoload: true,
- cssUrl: void 0,
- fontSize: void 0,
- buttonClass: 'open-zammad-chat',
- inactiveClass: 'is-inactive',
- title: '<strong>Chat</strong> with us!',
- scrollHint: 'Scroll down to see new messages',
- idleTimeout: 6,
- idleTimeoutIntervallCheck: 0.5,
- inactiveTimeout: 8,
- inactiveTimeoutIntervallCheck: 0.5,
- waitingListTimeout: 4,
- waitingListTimeoutIntervallCheck: 0.5,
- onReady: void 0,
- onCloseAnimationEnd: void 0,
- onError: void 0,
- onOpenAnimationEnd: void 0,
- onConnectionReestablished: void 0,
- onSessionClosed: void 0,
- onConnectionEstablished: void 0,
- onCssLoaded: void 0
- };
- ZammadChat.prototype.logPrefix = 'chat';
- ZammadChat.prototype._messageCount = 0;
- ZammadChat.prototype.isOpen = false;
- ZammadChat.prototype.blinkOnlineInterval = null;
- ZammadChat.prototype.stopBlinOnlineStateTimeout = null;
- ZammadChat.prototype.showTimeEveryXMinutes = 2;
- ZammadChat.prototype.lastTimestamp = null;
- ZammadChat.prototype.lastAddedType = null;
- ZammadChat.prototype.inputDisabled = false;
- ZammadChat.prototype.inputTimeout = null;
- ZammadChat.prototype.isTyping = false;
- ZammadChat.prototype.state = 'offline';
- ZammadChat.prototype.initialQueueDelay = 10000;
- ZammadChat.prototype.translations = {
- 'cs': {
- '<strong>Chat</strong> with us!': '<strong>Chatujte</strong> s námi!',
- 'All colleagues are busy.': 'Všichni kolegové jsou vytíženi.',
- 'Chat closed by %s': '%s ukončil konverzaci',
- 'Compose your message…': 'Napište svou zprávu…',
- 'Connecting': 'Připojování',
- 'Connection lost': 'Připojení ztraceno',
- 'Connection re-established': 'Připojení obnoveno',
- 'Offline': 'Offline',
- 'Online': 'Online',
- 'Scroll down to see new messages': 'Srolujte dolů pro zobrazení nových zpráv',
- 'Send': 'Odeslat',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Jelikož jste nereagovali v posledních %s minutách, vaše konverzace byla uzavřena.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Jelikož jste nereagovali v posledních %s minutách, vaše konverzace s <strong>%s</strong> byla uzavřena.',
- 'Start new conversation': 'Zahájit novou konverzaci',
- 'Today': 'Dnes',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Omlouváme se, že musíte čekat déle, než je vhodné pro získání slotu. Prosím, zkuste to později, případně nám napište e-mail. Děkujeme!',
- 'You are on waiting list position <strong>%s</strong>.': 'Jste <strong>%s</strong>. v pořadí na čekací listině.'
- },
- 'da': {
- '<strong>Chat</strong> with us!': '<strong>Chat</strong> med os!',
- 'All colleagues are busy.': 'Alle medarbejdere er optaget.',
- 'Chat closed by %s': 'Chat lukket af %s',
- 'Compose your message…': 'Skriv din besked…',
- 'Connecting': 'Forbinder',
- 'Connection lost': 'Forbindelse mistet',
- 'Connection re-established': 'Forbindelse genoprettet',
- 'Offline': 'Offline',
- 'Online': 'Online',
- 'Scroll down to see new messages': 'Scroll ned for at se nye beskeder',
- 'Send': 'Afsend',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': '',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '',
- 'Start new conversation': 'Start en ny samtale',
- 'Today': 'I dag',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
- 'You are on waiting list position <strong>%s</strong>.': 'Du er i kø som nummer <strong>%s</strong>.'
- },
- 'de': {
- '<strong>Chat</strong> with us!': '<strong>Chatte</strong> mit uns!',
- 'All colleagues are busy.': 'Alle Kollegen sind beschäftigt.',
- 'Chat closed by %s': 'Chat von %s geschlossen',
- 'Compose your message…': 'Verfassen Sie Ihre Nachricht…',
- 'Connecting': 'Verbinde',
- 'Connection lost': 'Verbindung verloren',
- 'Connection re-established': 'Verbindung wieder aufgebaut',
- 'Offline': 'Offline',
- 'Online': 'Online',
- 'Scroll down to see new messages': 'Nach unten scrollen um neue Nachrichten zu sehen',
- 'Send': 'Senden',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Da Sie innerhalb der letzten %s Minuten nicht reagiert haben, wurde Ihre Unterhaltung geschlossen.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Da Sie innerhalb der letzten %s Minuten nicht reagiert haben, wurde Ihre Unterhaltung mit <strong>%s</strong> geschlossen.',
- 'Start new conversation': 'Neue Unterhaltung starten',
- 'Today': 'Heute',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Entschuldigung, es dauert länger als erwartet einen freien Platz zu bekommen. Versuchen Sie es später erneut oder senden Sie uns eine E-Mail. Vielen Dank!',
- 'You are on waiting list position <strong>%s</strong>.': 'Sie sind in der Warteliste auf Position <strong>%s</strong>.'
- },
- 'es': {
- '<strong>Chat</strong> with us!': '<strong>Chatee</strong> con nosotros!',
- 'All colleagues are busy.': 'Todos los colegas están ocupados.',
- 'Chat closed by %s': 'Chat cerrado por %s',
- 'Compose your message…': 'Escribe tu mensaje…',
- 'Connecting': 'Conectando',
- 'Connection lost': 'Conexión perdida',
- 'Connection re-established': 'Conexión reestablecida',
- 'Offline': 'Desconectado',
- 'Online': 'En línea',
- 'Scroll down to see new messages': 'Desplace hacia abajo para ver nuevos mensajes',
- 'Send': 'Enviar',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Debido a que usted no ha respondido en los últimos %s minutos, su conversación se ha cerrado.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Debido a que usted no ha respondido en los últimos %s minutos, su conversación con <strong>%s</strong> se ha cerrado.',
- 'Start new conversation': 'Iniciar nueva conversación',
- 'Today': 'Hoy',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Lo sentimos, estamos tardando más de lo esperado para asignar un agente. Inténtelo de nuevo más tarde o envíenos un correo electrónico. ¡Gracias!',
- 'You are on waiting list position <strong>%s</strong>.': 'Usted está en la posición <strong>%s</strong> de la lista de espera.'
- },
- 'fr': {
- '<strong>Chat</strong> with us!': '<strong>Chattez</strong> avec nous !',
- 'All colleagues are busy.': 'Tous les agents sont occupés.',
- 'Chat closed by %s': 'Chat fermé par %s',
- 'Compose your message…': 'Écrivez votre message…',
- 'Connecting': 'Connexion',
- 'Connection lost': 'Connexion perdue',
- 'Connection re-established': 'Connexion ré-établie',
- 'Offline': 'Hors-ligne',
- 'Online': 'En ligne',
- 'Scroll down to see new messages': 'Défiler vers le bas pour voir les nouveaux messages',
- 'Send': 'Envoyer',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Sans réponse de votre part depuis %s minutes, votre conservation a été fermée.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Sans réponse de votre part depuis %s minutes, votre conversation avec <strong>%s</strong> a été fermée.',
- 'Start new conversation': 'Démarrer une nouvelle conversation',
- 'Today': 'Aujourd\'hui',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Nous sommes désolés, trouver un agent disponible prend plus de temps que prévu. Réessayez plus tard ou envoyez-nous un mail. Merci !',
- 'You are on waiting list position <strong>%s</strong>.': 'Vous êtes actuellement en position <strong>%s</strong> dans la file d\'attente.'
- },
- 'hr': {
- '<strong>Chat</strong> with us!': '<strong>Čavrljajte</strong> sa nama!',
- 'All colleagues are busy.': 'Svi agenti su zauzeti.',
- 'Chat closed by %s': '%s zatvara chat',
- 'Compose your message…': 'Sastavite poruku…',
- 'Connecting': 'Povezivanje',
- 'Connection lost': 'Veza prekinuta',
- 'Connection re-established': 'Veza je ponovno uspostavljena',
- 'Offline': 'Odsutan',
- 'Online': 'Dostupan(a)',
- 'Scroll down to see new messages': 'Pomaknite se prema dolje da biste vidjeli nove poruke',
- 'Send': 'Pošalji',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Budući da niste odgovorili u posljednjih %s minuta, Vaš je razgovor zatvoren.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Budući da niste odgovorili u posljednjih %s minuta, Vaš je razgovor s <strong>%</strong>s zatvoren.',
- 'Start new conversation': 'Započni novi razgovor',
- 'Today': 'Danas',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Oprostite, traje duže nego inače za dobiti slobodan termin. Molimo, pokušajte ponovno kasnije ili nam pošaljite e-mail. Hvala!',
- 'You are on waiting list position <strong>%s</strong>.': 'Nalazite se u redu čekanja na poziciji <strong>%s</strong>.'
- },
- 'hu': {
- '<strong>Chat</strong> with us!': '<strong>Csevegjen</strong> velünk!',
- 'All colleagues are busy.': 'Minden munkatársunk foglalt.',
- 'Chat closed by %s': 'A csevegés %s által lezárva',
- 'Compose your message…': 'Fogalmazza meg üzenetét…',
- 'Connecting': 'Csatlakozás',
- 'Connection lost': 'A kapcsolat megszakadt',
- 'Connection re-established': 'A kapcsolat helyreállt',
- 'Offline': 'Offline',
- 'Online': 'Online',
- 'Scroll down to see new messages': 'Görgessen lefelé az új üzenetek megtekintéséhez',
- 'Send': 'Küldés',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Mivel az elmúlt %s percben nem válaszolt, a beszélgetése lezárásra került.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Mivel az elmúlt %s percben nem válaszolt, <strong>%s</strong> munkatársunkkal folytatott beszélgetését lezártuk.',
- 'Start new conversation': 'Új beszélgetés indítása',
- 'Today': 'Ma',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Sajnáljuk, hogy a vártnál hosszabb ideig tart a helyfoglalás. Kérjük, próbálja meg később újra, vagy küldjön nekünk egy e-mailt. Köszönjük!',
- 'You are on waiting list position <strong>%s</strong>.': 'Ön a várólistán a <strong>%s</strong> helyen szerepel.'
- },
- 'it': {
- '<strong>Chat</strong> with us!': '<strong>Chatta</strong> con noi!',
- 'All colleagues are busy.': 'Tutti i colleghi sono occupati.',
- 'Chat closed by %s': 'Chat chiusa da %s',
- 'Compose your message…': 'Scrivi il tuo messaggio…',
- 'Connecting': 'Connessione in corso',
- 'Connection lost': 'Connessione persa',
- 'Connection re-established': 'Connessione ristabilita',
- 'Offline': 'Offline',
- 'Online': 'Online',
- 'Scroll down to see new messages': 'Scorri verso il basso per vedere i nuovi messaggi',
- 'Send': 'Invia',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Dato che non hai risposto negli ultimi %s minuti, la conversazione è stata chiusa.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Dato che non hai risposto negli ultimi %s minuti, la conversazione con <strong>%s</strong> è stata chiusa.',
- 'Start new conversation': 'Avvia una nuova chat',
- 'Today': 'Oggi',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Siamo spiacenti, ci vuole più tempo del previsto per ottenere uno spazio libero. Riprova più tardi o inviaci un\'e-mail. Grazie!',
- 'You are on waiting list position <strong>%s</strong>.': 'Sei alla posizione <strong>%s</strong> della lista di attesa.'
- },
- 'lt': {
- '<strong>Chat</strong> with us!': '<strong>Kalbėkitės</strong> su mumis!',
- 'All colleagues are busy.': 'Visi kolegos užimti.',
- 'Chat closed by %s': '%s uždarė pokalbį',
- 'Compose your message…': 'Rašykite žinutę…',
- 'Connecting': 'Jungiamasi',
- 'Connection lost': 'Dingo ryšys',
- 'Connection re-established': 'Ryšys atnaujintas',
- 'Offline': 'Atsijungęs',
- 'Online': 'Prisijungęs',
- 'Scroll down to see new messages': 'Naujos žinutės žemiau',
- 'Send': 'Siųsti',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Jūsų pokalbis buvo uždarytas, nes nieko neatsakėte per %s minučių.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Jūsų pokalbis su <strong>%s</strong> buvo uždarytas, nes nieko neatsakėte per %s minučių.',
- 'Start new conversation': 'Pradėti naują pokalbį',
- 'Today': 'Šiandien',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Atsiprašome, kad tenka laukti atskymo. Bandykite vėliau arba rašykite el. paštu. Ačiū!',
- 'You are on waiting list position <strong>%s</strong>.': 'Esate <strong>%s</strong> eilėje.'
- },
- 'nl': {
- '<strong>Chat</strong> with us!': '<strong>Chat</strong> met ons!',
- 'All colleagues are busy.': 'Alle collega\'s zijn bezet.',
- 'Chat closed by %s': 'Chat gesloten door %s',
- 'Compose your message…': 'Stel je bericht op…',
- 'Connecting': 'Verbinden',
- 'Connection lost': 'Verbinding verbroken',
- 'Connection re-established': 'Verbinding hersteld',
- 'Offline': 'Offline',
- 'Online': 'Online',
- 'Scroll down to see new messages': 'Scroll naar beneden om nieuwe tickets te bekijken',
- 'Send': 'Verstuur',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'De chat is afgesloten omdat je de laatste %s minuten niet hebt gereageerd.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Je chat met <strong>%s</strong> is afgesloten omdat je niet hebt gereageerd in de laatste %s minuten.',
- 'Start new conversation': 'Nieuw gesprek starten',
- 'Today': 'Vandaag',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Het spijt ons, het duurt langer dan verwacht om een chat te starten. Probeer het later nog eens of stuur ons een e-mail. Bedankt!',
- 'You are on waiting list position <strong>%s</strong>.': 'Je bevindt zich op wachtlijstpositie <strong>%s</strong>.'
- },
- 'pl': {
- '<strong>Chat</strong> with us!': '<strong>Czatuj</strong> z nami!',
- 'All colleagues are busy.': 'Wszyscy agenci są zajęci.',
- 'Chat closed by %s': 'Chat zamknięty przez %s',
- 'Compose your message…': 'Skomponuj swoją wiadomość…',
- 'Connecting': 'Łączenie',
- 'Connection lost': 'Utracono połączenie',
- 'Connection re-established': 'Ponowne nawiązanie połączenia',
- 'Offline': 'Offline',
- 'Online': 'Online',
- 'Scroll down to see new messages': 'Skroluj w dół, aby zobaczyć wiadomości',
- 'Send': 'Wyślij',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Ponieważ nie odpowiedziałeś w ciągu ostatnich %s minut, Twoja rozmowa została zamknięta.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Ponieważ nie odpowiedziałeś w ciągu ostatnich %s minut, Twoja rozmowa z <strong>%s</strong> została zamknięta.',
- 'Start new conversation': 'Rozpocznij nową rozmowę',
- 'Today': 'Dzisiaj',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Przepraszamy, znalezienie wolnego konsultanta zajmuje więcej czasu niż oczekiwano. Spróbuj ponownie później lub wyślij nam e-mail. Dziękujemy!',
- 'You are on waiting list position <strong>%s</strong>.': 'Jesteś na pozycji listy oczekujących <strong>%s</strong>.'
- },
- 'pt-br': {
- '<strong>Chat</strong> with us!': '<strong>Converse</strong> conosco!',
- 'All colleagues are busy.': 'Nossos atendentes estão ocupados.',
- 'Chat closed by %s': 'Chat encerrado por %s',
- 'Compose your message…': 'Escreva sua mensagem…',
- 'Connecting': 'Conectando',
- 'Connection lost': 'Conexão perdida',
- 'Connection re-established': 'Conexão restabelecida',
- 'Offline': 'Desconectado',
- 'Online': 'Online',
- 'Scroll down to see new messages': 'Rolar para baixo para ver novas mensagems',
- 'Send': 'Enviar',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Como você não respondeu nos últimos %s minutos, sua conversa foi encerrada.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Como você não respondeu nos últimos %s minutos, sua conversa com <strong>%s</strong> foi encerrada.',
- 'Start new conversation': 'Iniciar uma nova conversa',
- 'Today': 'Hoje',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Lamentamos, está demorando mais do que o esperado para conseguir uma vaga. Tente novamente mais tarde ou envie-nos um e-mail. Obrigado!',
- 'You are on waiting list position <strong>%s</strong>.': 'Você está na posição <strong>%s</strong> da lista de espera.'
- },
- 'ro': {
- '<strong>Chat</strong> with us!': '<strong>Comunică</strong> cu noi!',
- 'All colleagues are busy.': 'Toți colegii sunt ocupați momentan.',
- 'Chat closed by %s': 'Chat închis de către %s',
- 'Compose your message…': 'Compune-ți mesajul…',
- 'Connecting': 'Se conectează',
- 'Connection lost': 'Conexiune pierdută',
- 'Connection re-established': 'Conexiune restabilită',
- 'Offline': 'Offline',
- 'Online': 'Online',
- 'Scroll down to see new messages': 'Derulați în jos pentru a vedea mesajele noi',
- 'Send': 'Trimite',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Deoarece nu ai răspuns în ultimele %s minute, conversația ta a fost închisă.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Deoarece nu ai răspuns în ultimele %s minute, conversația ta cu <strong>%s</strong> a fost închisă.',
- 'Start new conversation': 'Începe o conversație nouă',
- 'Today': 'Azi',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Ne pare rău, durează mai mult decât ne așteptam să obținem un loc. Te rugăm să încerci din nou mai târziu sau să ne trimiți un email. Mulțumim!',
- 'You are on waiting list position <strong>%s</strong>.': 'Aveți poziția <strong>%s</strong> în lista de așteptare.'
- },
- 'ru': {
- '<strong>Chat</strong> with us!': '<strong>Напишите</strong> нам!',
- 'All colleagues are busy.': 'Все коллеги заняты.',
- 'Chat closed by %s': 'Чат закрыт %s',
- 'Compose your message…': 'Составьте сообщение…',
- 'Connecting': 'Подключение',
- 'Connection lost': 'Подключение потеряно',
- 'Connection re-established': 'Подключение восстановлено',
- 'Offline': 'Оффлайн',
- 'Online': 'В сети',
- 'Scroll down to see new messages': 'Прокрутите вниз, чтобы увидеть новые сообщения',
- 'Send': 'Отправить',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Поскольку Вы не ответили в течение последних %s минут, Ваш разговор был закрыт.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Поскольку Вы не ответили в течение последних %s минут, Ваш разговор с <strong>%s</strong> был закрыт.',
- 'Start new conversation': 'Начать новый разговор',
- 'Today': 'Сегодня',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Извините, получение свободного слота занимает больше времени, чем ожидалось. Пожалуйста, повторите попытку позже или отправьте нам электронное письмо. Благодарим Вас!',
- 'You are on waiting list position <strong>%s</strong>.': 'Вы находитесь в списке ожидания <strong>%s</strong>.'
- },
- 'sr': {
- '<strong>Chat</strong> with us!': '<strong>Ћаскајте</strong> са нама!',
- 'All colleagues are busy.': 'Све колеге су заузете.',
- 'Chat closed by %s': 'Ћаскање затворено од стране %s',
- 'Compose your message…': 'Напишите поруку…',
- 'Connecting': 'Повезивање',
- 'Connection lost': 'Веза је изгубљена',
- 'Connection re-established': 'Веза је поново успостављена',
- 'Offline': 'Одсутан(а)',
- 'Online': 'Доступан(а)',
- 'Scroll down to see new messages': 'Скролујте на доле за нове поруке',
- 'Send': 'Пошаљи',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Пошто нисте одговорили у последњих %s минут(a), ваш разговор је завршен.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Пошто нисте одговорили у последњих %s минут(a), ваш разговор са <strong>%s</strong> је завршен.',
- 'Start new conversation': 'Започни нови разговор',
- 'Today': 'Данас',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Жао нам је, добијање празног термина траје дуже од очекиваног. Молимо покушајте поново касније или нам пошаљите имејл поруку. Хвала вам!',
- 'You are on waiting list position <strong>%s</strong>.': 'Ви сте тренутно <strong>%s.</strong> у реду за чекање.'
- },
- 'sr-latn-rs': {
- '<strong>Chat</strong> with us!': '<strong>Ćaskajte</strong> sa nama!',
- 'All colleagues are busy.': 'Sve kolege su zauzete.',
- 'Chat closed by %s': 'Ćaskanje zatvoreno od strane %s',
- 'Compose your message…': 'Napišite poruku…',
- 'Connecting': 'Povezivanje',
- 'Connection lost': 'Veza je izgubljena',
- 'Connection re-established': 'Veza je ponovo uspostavljena',
- 'Offline': 'Odsutan(a)',
- 'Online': 'Dostupan(a)',
- 'Scroll down to see new messages': 'Skrolujte na dole za nove poruke',
- 'Send': 'Pošalji',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Pošto niste odgovorili u poslednjih %s minut(a), vaš razgovor je završen.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Pošto niste odgovorili u poslednjih %s minut(a), vaš razgovor sa <strong>%s</strong> je završen.',
- 'Start new conversation': 'Započni novi razgovor',
- 'Today': 'Danas',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Žao nam je, dobijanje praznog termina traje duže od očekivanog. Molimo pokušajte ponovo kasnije ili nam pošaljite imejl poruku. Hvala vam!',
- 'You are on waiting list position <strong>%s</strong>.': 'Vi ste trenutno <strong>%s.</strong> u redu za čekanje.'
- },
- 'sv': {
- '<strong>Chat</strong> with us!': '<strong>Chatta</strong> med oss!',
- 'All colleagues are busy.': 'Alla kollegor är upptagna.',
- 'Chat closed by %s': 'Chatt stängd av %s',
- 'Compose your message…': 'Skriv ditt meddelande …',
- 'Connecting': 'Ansluter',
- 'Connection lost': 'Anslutningen försvann',
- 'Connection re-established': 'Anslutningen återupprättas',
- 'Offline': 'Offline',
- 'Online': 'Online',
- 'Scroll down to see new messages': 'Bläddra ner för att se nya meddelanden',
- 'Send': 'Skicka',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': 'Din chatt avslutades då du inte svarade inom %s minuter.',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': 'Chatten stängdes eftersom du inte svarat inom %s minuter i din konversation med <strong>%s</strong>.',
- 'Start new conversation': 'Starta ny konversation',
- 'Today': 'Idag',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': 'Det tar tyvärr längre tid än förväntat att få en ledig plats. Försök igen senare eller skicka ett mejl till oss. Tack!',
- 'You are on waiting list position <strong>%s</strong>.': 'Du är på väntelistan som position <strong>%s</strong>.'
- },
- 'zh-cn': {
- '<strong>Chat</strong> with us!': '发起<strong>即时对话</strong>!',
- 'All colleagues are busy.': '所有同事都很忙。',
- 'Chat closed by %s': '对话已被 %s 关闭',
- 'Compose your message…': '编辑您的信息…',
- 'Connecting': '连接中',
- 'Connection lost': '连接丢失',
- 'Connection re-established': '正在重新建立连接',
- 'Offline': '离线',
- 'Online': '在线',
- 'Scroll down to see new messages': '向下滚动以查看新消息',
- 'Send': '发送',
- 'Since you didn\'t respond in the last %s minutes your conversation was closed.': '"由于您超过 %s 分钟没有任何回复',
- 'Since you didn\'t respond in the last %s minutes your conversation with <strong>%s</strong> was closed.': '"由于您超过 %s 分钟没有回复',
- 'Start new conversation': '开始新的会话',
- 'Today': '今天',
- 'We are sorry, it is taking longer than expected to get a slot. Please try again later or send us an email. Thank you!': '',
- 'You are on waiting list position <strong>%s</strong>.': '您目前的等候位置是第 <strong>%s</strong> 位.'
- }
- };
- ZammadChat.prototype.sessionId = void 0;
- ZammadChat.prototype.scrolledToBottom = true;
- ZammadChat.prototype.scrollSnapTolerance = 10;
- ZammadChat.prototype.richTextFormatKey = {
- 66: true,
- 73: true,
- 85: true,
- 83: true
- };
- ZammadChat.prototype.T = function() {
- var item, items, j, len, string, translations;
- string = arguments[0], items = 2 <= arguments.length ? slice.call(arguments, 1) : [];
- if (this.options.lang && this.options.lang !== 'en') {
- if (!this.translations[this.options.lang]) {
- this.log.notice("Translation '" + this.options.lang + "' needed!");
- } else {
- translations = this.translations[this.options.lang];
- if (!translations[string]) {
- this.log.notice("Translation needed for '" + string + "'");
- }
- string = translations[string] || string;
- }
- }
- if (items) {
- for (j = 0, len = items.length; j < len; j++) {
- item = items[j];
- string = string.replace(/%s/, item);
- }
- }
- return string;
- };
- ZammadChat.prototype.view = function(name) {
- return (function(_this) {
- return function(options) {
- if (!options) {
- options = {};
- }
- options.T = _this.T;
- options.background = _this.options.background;
- options.flat = _this.options.flat;
- options.fontSize = _this.options.fontSize;
- return window.zammadChatTemplates[name](options);
- };
- })(this);
- };
- function ZammadChat(options) {
- this.removeAttributes = bind(this.removeAttributes, this);
- this.startTimeoutObservers = bind(this.startTimeoutObservers, this);
- this.onCssLoaded = bind(this.onCssLoaded, this);
- this.setAgentOnlineState = bind(this.setAgentOnlineState, this);
- this.onConnectionEstablished = bind(this.onConnectionEstablished, this);
- this.setSessionId = bind(this.setSessionId, this);
- this.onConnectionReestablished = bind(this.onConnectionReestablished, this);
- this.reconnect = bind(this.reconnect, this);
- this.destroy = bind(this.destroy, this);
- this.onScrollHintClick = bind(this.onScrollHintClick, this);
- this.detectScrolledtoBottom = bind(this.detectScrolledtoBottom, this);
- this.onLeaveTemporary = bind(this.onLeaveTemporary, this);
- this.onAgentTypingEnd = bind(this.onAgentTypingEnd, this);
- this.onAgentTypingStart = bind(this.onAgentTypingStart, this);
- this.onQueue = bind(this.onQueue, this);
- this.onQueueScreen = bind(this.onQueueScreen, this);
- this.onWebSocketClose = bind(this.onWebSocketClose, this);
- this.onCloseAnimationEnd = bind(this.onCloseAnimationEnd, this);
- this.close = bind(this.close, this);
- this.toggle = bind(this.toggle, this);
- this.sessionClose = bind(this.sessionClose, this);
- this.onOpenAnimationEnd = bind(this.onOpenAnimationEnd, this);
- this.open = bind(this.open, this);
- this.renderMessage = bind(this.renderMessage, this);
- this.receiveMessage = bind(this.receiveMessage, this);
- this.onSubmit = bind(this.onSubmit, this);
- this.onInput = bind(this.onInput, this);
- this.onReopenSession = bind(this.onReopenSession, this);
- this.onError = bind(this.onError, this);
- this.onWebSocketMessage = bind(this.onWebSocketMessage, this);
- this.send = bind(this.send, this);
- this.onKeydown = bind(this.onKeydown, this);
- this.onPaste = bind(this.onPaste, this);
- this.onDrop = bind(this.onDrop, this);
- this.render = bind(this.render, this);
- this.view = bind(this.view, this);
- this.T = bind(this.T, this);
- ZammadChat.__super__.constructor.call(this, options);
- if (typeof jQuery !== 'undefined' && this.options.target instanceof jQuery) {
- this.log.notice('Chat: target option is a jQuery object. jQuery is not a requirement for the chat any more.');
- this.options.target = this.options.target.get(0);
- }
- this.isFullscreen = window.matchMedia && window.matchMedia('(max-width: 768px)').matches;
- this.scrollRoot = this.getScrollRoot();
- if (!window.WebSocket || !sessionStorage) {
- this.state = 'unsupported';
- this.log.notice('Chat: Browser not supported!');
- return;
- }
- if (!this.options.chatId) {
- this.state = 'unsupported';
- this.log.error('Chat: need chatId as option!');
- return;
- }
- if (!this.options.lang) {
- this.options.lang = document.documentElement.getAttribute('lang');
- }
- if (this.options.lang) {
- if (!this.translations[this.options.lang]) {
- this.log.debug("lang: No " + this.options.lang + " found, try first two letters");
- this.options.lang = this.options.lang.replace(/-.+?$/, '');
- }
- this.log.debug("lang: " + this.options.lang);
- }
- if (!this.options.host) {
- this.detectHost();
- }
- this.loadCss();
- this.io = new Io(this.options);
- this.io.set({
- onOpen: this.render,
- onClose: this.onWebSocketClose,
- onMessage: this.onWebSocketMessage,
- onError: this.onError
- });
- this.io.connect();
- }
- ZammadChat.prototype.getScrollRoot = function() {
- var end, html, start;
- if ('scrollingElement' in document) {
- return document.scrollingElement;
- }
- html = document.documentElement;
- start = parseInt(html.pageYOffset, 10);
- html.pageYOffset = start + 1;
- end = parseInt(html.pageYOffset, 10);
- html.pageYOffset = start;
- if (end > start) {
- return html;
- } else {
- return document.body;
- }
- };
- ZammadChat.prototype.render = function() {
- var btn;
- if (!this.el || !document.querySelector('.zammad-chat')) {
- this.renderBase();
- }
- btn = document.querySelector("." + this.options.buttonClass);
- if (btn) {
- btn.classList.add(this.options.inactiveClass);
- }
- this.setAgentOnlineState('online');
- this.log.debug('widget rendered');
- this.startTimeoutObservers();
- this.idleTimeout.start();
- this.sessionId = sessionStorage.getItem('sessionId');
- return this.send('chat_status_customer', {
- session_id: this.sessionId,
- url: window.location.href
- });
- };
- ZammadChat.prototype.renderBase = function() {
- if (this.el) {
- this.el.remove();
- }
- this.options.target.insertAdjacentHTML('beforeend', this.view('chat')({
- title: this.options.title,
- scrollHint: this.options.scrollHint
- }));
- this.el = this.options.target.querySelector('.zammad-chat');
- this.input = this.el.querySelector('.zammad-chat-input');
- this.body = this.el.querySelector('.zammad-chat-body');
- this.el.querySelector('.js-chat-open').addEventListener('click', this.open);
- this.el.querySelector('.js-chat-toggle').addEventListener('click', this.toggle);
- this.el.querySelector('.js-chat-status').addEventListener('click', this.stopPropagation);
- this.el.querySelector('.zammad-chat-controls').addEventListener('submit', this.onSubmit);
- this.body.addEventListener('scroll', this.detectScrolledtoBottom);
- this.el.querySelector('.zammad-scroll-hint').addEventListener('click', this.onScrollHintClick);
- this.input.addEventListener('keydown', this.onKeydown);
- this.input.addEventListener('input', this.onInput);
- this.input.addEventListener('paste', this.onPaste);
- this.input.addEventListener('drop', this.onDrop);
- window.addEventListener('beforeunload', this.onLeaveTemporary);
- return window.addEventListener('hashchange', (function(_this) {
- return function() {
- if (_this.isOpen) {
- if (_this.sessionId) {
- _this.send('chat_session_notice', {
- session_id: _this.sessionId,
- message: window.location.href
- });
- }
- return;
- }
- return _this.idleTimeout.start();
- };
- })(this));
- };
- ZammadChat.prototype.stopPropagation = function(event) {
- return event.stopPropagation();
- };
- ZammadChat.prototype.onDrop = function(e) {
- var dataTransfer, file, reader, x, y;
- e.stopPropagation();
- e.preventDefault();
- if (window.dataTransfer) {
- dataTransfer = window.dataTransfer;
- } else if (e.dataTransfer) {
- dataTransfer = e.dataTransfer;
- } else {
- throw 'No clipboardData support';
- }
- x = e.clientX;
- y = e.clientY;
- file = dataTransfer.files[0];
- if (file.type.match('image.*')) {
- reader = new FileReader();
- reader.onload = (function(_this) {
- return function(e) {
- var insert;
- insert = function(dataUrl, width) {
- var img, pos, range, result;
- if (_this.isRetina()) {
- width = width / 2;
- }
- result = dataUrl;
- img = new Image();
- img.style.width = '100%';
- img.style.maxWidth = width + 'px';
- img.src = result;
- if (document.caretPositionFromPoint) {
- pos = document.caretPositionFromPoint(x, y);
- range = document.createRange();
- range.setStart(pos.offsetNode, pos.offset);
- range.collapse();
- return range.insertNode(img);
- } else if (document.caretRangeFromPoint) {
- range = document.caretRangeFromPoint(x, y);
- return range.insertNode(img);
- } else {
- return console.log('could not find carat');
- }
- };
- return _this.resizeImage(e.target.result, 460, 'auto', 2, 'image/jpeg', 'auto', insert);
- };
- })(this);
- return reader.readAsDataURL(file);
- }
- };
- ZammadChat.prototype.onPaste = function(e) {
- var clipboardData, docType, html, htmlTmp, imageFile, imageInserted, item, j, k, l, len, len1, len2, len3, m, match, newTag, node, outer, reader, ref, ref1, ref2, ref3, regex, replacementTag, sanitized, text;
- e.stopPropagation();
- e.preventDefault();
- if (e.clipboardData) {
- clipboardData = e.clipboardData;
- } else if (window.clipboardData) {
- clipboardData = window.clipboardData;
- } else if (e.clipboardData) {
- clipboardData = e.clipboardData;
- } else {
- throw 'No clipboardData support';
- }
- imageInserted = false;
- if (clipboardData && clipboardData.items && clipboardData.items[0]) {
- item = clipboardData.items[0];
- if (item.kind === 'file' && (item.type === 'image/png' || item.type === 'image/jpeg')) {
- imageFile = item.getAsFile();
- reader = new FileReader();
- reader.onload = (function(_this) {
- return function(e) {
- var insert;
- insert = function(dataUrl, width) {
- var img;
- if (_this.isRetina()) {
- width = width / 2;
- }
- img = new Image();
- img.style.width = '100%';
- img.style.maxWidth = width + 'px';
- img.src = dataUrl;
- return document.execCommand('insertHTML', false, img);
- };
- return _this.resizeImage(e.target.result, 460, 'auto', 2, 'image/jpeg', 'auto', insert);
- };
- })(this);
- reader.readAsDataURL(imageFile);
- imageInserted = true;
- }
- }
- if (imageInserted) {
- return;
- }
- text = void 0;
- docType = void 0;
- try {
- text = clipboardData.getData('text/html');
- docType = 'html';
- if (!text || text.length === 0) {
- docType = 'text';
- text = clipboardData.getData('text/plain');
- }
- if (!text || text.length === 0) {
- docType = 'text2';
- text = clipboardData.getData('text');
- }
- } catch (error) {
- e = error;
- console.log('Sorry, can\'t insert markup because browser is not supporting it.');
- docType = 'text3';
- text = clipboardData.getData('text');
- }
- if (docType === 'text' || docType === 'text2' || docType === 'text3') {
- text = '<div>' + text.replace(/\n/g, '</div><div>') + '</div>';
- text = text.replace(/<div><\/div>/g, '<div><br></div>');
- }
- console.log('p', docType, text);
- if (docType === 'html') {
- html = document.createElement('div');
- sanitized = DOMPurify.sanitize(text);
- this.log.debug('sanitized HTML clipboard', sanitized);
- html.innerHTML = sanitized;
- match = false;
- htmlTmp = text;
- regex = new RegExp('<(/w|w)\:[A-Za-z]');
- if (htmlTmp.match(regex)) {
- match = true;
- htmlTmp = htmlTmp.replace(regex, '');
- }
- regex = new RegExp('<(/o|o)\:[A-Za-z]');
- if (htmlTmp.match(regex)) {
- match = true;
- htmlTmp = htmlTmp.replace(regex, '');
- }
- if (match) {
- html = this.wordFilter(html);
- }
- ref = html.childNodes;
- for (j = 0, len = ref.length; j < len; j++) {
- node = ref[j];
- if (node.nodeType === 8) {
- node.remove();
- }
- }
- ref1 = html.querySelectorAll('a, font, small, time, form, label');
- for (k = 0, len1 = ref1.length; k < len1; k++) {
- node = ref1[k];
- node.outerHTML = node.innerHTML;
- }
- replacementTag = 'div';
- ref2 = html.querySelectorAll('textarea');
- for (l = 0, len2 = ref2.length; l < len2; l++) {
- node = ref2[l];
- outer = node.outerHTML;
- regex = new RegExp('<' + node.tagName, 'i');
- newTag = outer.replace(regex, '<' + replacementTag);
- regex = new RegExp('</' + node.tagName, 'i');
- newTag = newTag.replace(regex, '</' + replacementTag);
- node.outerHTML = newTag;
- }
- ref3 = html.querySelectorAll('font, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe, meta, link, title, head, fieldset');
- for (m = 0, len3 = ref3.length; m < len3; m++) {
- node = ref3[m];
- node.remove();
- }
- this.removeAttributes(html);
- text = html.innerHTML;
- }
- if (docType === 'text3') {
- this.pasteHtmlAtCaret(text);
- } else {
- document.execCommand('insertHTML', false, text);
- }
- return true;
- };
- ZammadChat.prototype.onKeydown = function(e) {
- var richtTextControl;
- if (!this.inputDisabled && !e.shiftKey && e.keyCode === 13) {
- e.preventDefault();
- this.sendMessage();
- }
- richtTextControl = false;
- if (!e.altKey && !e.ctrlKey && e.metaKey) {
- richtTextControl = true;
- } else if (!e.altKey && e.ctrlKey && !e.metaKey) {
- richtTextControl = true;
- }
- if (richtTextControl && this.richTextFormatKey[e.keyCode]) {
- e.preventDefault();
- if (e.keyCode === 66) {
- document.execCommand('bold');
- return true;
- }
- if (e.keyCode === 73) {
- document.execCommand('italic');
- return true;
- }
- if (e.keyCode === 85) {
- document.execCommand('underline');
- return true;
- }
- if (e.keyCode === 83) {
- document.execCommand('strikeThrough');
- return true;
- }
- }
- };
- ZammadChat.prototype.send = function(event, data) {
- if (data == null) {
- data = {};
- }
- data.chat_id = this.options.chatId;
- return this.io.send(event, data);
- };
- ZammadChat.prototype.onWebSocketMessage = function(pipes) {
- var j, len, pipe;
- for (j = 0, len = pipes.length; j < len; j++) {
- pipe = pipes[j];
- this.log.debug('ws:onmessage', pipe);
- switch (pipe.event) {
- case 'chat_error':
- this.log.notice(pipe.data);
- if (pipe.data && pipe.data.state === 'chat_disabled') {
- this.destroy({
- remove: true
- });
- }
- break;
- case 'chat_session_message':
- if (pipe.data.self_written) {
- return;
- }
- this.receiveMessage(pipe.data);
- break;
- case 'chat_session_typing':
- if (pipe.data.self_written) {
- return;
- }
- this.onAgentTypingStart();
- break;
- case 'chat_session_start':
- this.onConnectionEstablished(pipe.data);
- break;
- case 'chat_session_queue':
- this.onQueueScreen(pipe.data);
- break;
- case 'chat_session_closed':
- this.onSessionClosed(pipe.data);
- break;
- case 'chat_session_left':
- this.onSessionClosed(pipe.data);
- break;
- case 'chat_status_customer':
- switch (pipe.data.state) {
- case 'online':
- this.sessionId = void 0;
- if (!this.options.cssAutoload || this.cssLoaded) {
- this.onReady();
- } else {
- this.socketReady = true;
- }
- break;
- case 'offline':
- this.onError('Zammad Chat: No agent online');
- break;
- case 'chat_disabled':
- this.onError('Zammad Chat: Chat is disabled');
- break;
- case 'no_seats_available':
- this.onError("Zammad Chat: Too many clients in queue. Clients in queue: " + pipe.data.queue);
- break;
- case 'reconnect':
- this.onReopenSession(pipe.data);
- }
- }
- }
- };
- ZammadChat.prototype.onReady = function() {
- var base, btn;
- this.log.debug('widget ready for use');
- btn = document.querySelector("." + this.options.buttonClass);
- if (btn) {
- btn.addEventListener('click', this.open);
- btn.classList.remove(this.options.inactiveClass);
- }
- if (typeof (base = this.options).onReady === "function") {
- base.onReady();
- }
- if (this.options.show) {
- return this.show();
- }
- };
- ZammadChat.prototype.onError = function(message) {
- var base, btn;
- this.log.debug(message);
- this.addStatus(message);
- btn = document.querySelector("." + this.options.buttonClass);
- if (btn) {
- btn.classList.add('zammad-chat-is-hidden');
- }
- if (this.isOpen) {
- this.disableInput();
- this.destroy({
- remove: false
- });
- } else {
- this.destroy({
- remove: true
- });
- }
- return typeof (base = this.options).onError === "function" ? base.onError(message) : void 0;
- };
- ZammadChat.prototype.onReopenSession = function(data) {
- var j, len, message, ref, unfinishedMessage;
- this.log.debug('old messages', data.session);
- this.inactiveTimeout.start();
- unfinishedMessage = sessionStorage.getItem('unfinished_message');
- if (data.agent) {
- this.onConnectionEstablished(data);
- ref = data.session;
- for (j = 0, len = ref.length; j < len; j++) {
- message = ref[j];
- this.renderMessage({
- message: message.content,
- id: message.id,
- from: message.created_by_id ? 'agent' : 'customer'
- });
- }
- if (unfinishedMessage) {
- this.input.innerHTML = unfinishedMessage;
- }
- }
- if (data.position) {
- this.onQueue(data);
- }
- this.show();
- this.open();
- this.scrollToBottom();
- if (unfinishedMessage) {
- return this.input.focus();
- }
- };
- ZammadChat.prototype.onInput = function() {
- var j, len, message, ref;
- ref = this.el.querySelectorAll('.zammad-chat-message--unread');
- for (j = 0, len = ref.length; j < len; j++) {
- message = ref[j];
- message.classList.remove('zammad-chat-message--unread');
- }
- sessionStorage.setItem('unfinished_message', this.input.innerHTML);
- return this.onTyping();
- };
- ZammadChat.prototype.onTyping = function() {
- if (this.isTyping && this.isTyping > new Date(new Date().getTime() - 1500)) {
- return;
- }
- this.isTyping = new Date();
- this.send('chat_session_typing', {
- session_id: this.sessionId
- });
- return this.inactiveTimeout.start();
- };
- ZammadChat.prototype.onSubmit = function(event) {
- event.preventDefault();
- return this.sendMessage();
- };
- ZammadChat.prototype.sendMessage = function() {
- var message, messageElement;
- message = this.input.innerHTML;
- if (!message) {
- return;
- }
- this.inactiveTimeout.start();
- sessionStorage.removeItem('unfinished_message');
- messageElement = this.view('message')({
- message: message,
- from: 'customer',
- id: this._messageCount++,
- unreadClass: ''
- });
- this.maybeAddTimestamp();
- if (this.el.querySelector('.zammad-chat-message--typing')) {
- this.lastAddedType = 'typing-placeholder';
- this.el.querySelector('.zammad-chat-message--typing').insertAdjacentHTML('beforebegin', messageElement);
- } else {
- this.lastAddedType = 'message--customer';
- this.body.insertAdjacentHTML('beforeend', messageElement);
- }
- this.input.innerHTML = '';
- this.scrollToBottom();
- return this.send('chat_session_message', {
- content: message,
- id: this._messageCount,
- session_id: this.sessionId
- });
- };
- ZammadChat.prototype.receiveMessage = function(data) {
- this.inactiveTimeout.start();
- this.onAgentTypingEnd();
- this.maybeAddTimestamp();
- this.renderMessage({
- message: data.message.content,
- id: data.id,
- from: 'agent'
- });
- return this.scrollToBottom({
- showHint: true
- });
- };
- ZammadChat.prototype.renderMessage = function(data) {
- this.lastAddedType = "message--" + data.from;
- data.unreadClass = document.hidden ? ' zammad-chat-message--unread' : '';
- return this.body.insertAdjacentHTML('beforeend', this.view('message')(data));
- };
- ZammadChat.prototype.open = function() {
- var remainerHeight;
- if (this.isOpen) {
- this.log.debug('widget already open, block');
- return;
- }
- this.isOpen = true;
- this.log.debug('open widget');
- this.show();
- if (!this.sessionId) {
- this.showLoader();
- }
- this.el.classList.add('zammad-chat-is-open');
- remainerHeight = this.el.clientHeight - this.el.querySelector('.zammad-chat-header').offsetHeight;
- this.el.style.transform = "translateY(" + remainerHeight + "px)";
- this.el.clientHeight;
- if (!this.sessionId) {
- this.el.addEventListener('transitionend', this.onOpenAnimationEnd);
- this.el.classList.add('zammad-chat--animate');
- this.el.clientHeight;
- this.el.style.transform = '';
- return this.send('chat_session_init', {
- url: window.location.href
- });
- } else {
- this.el.style.transform = '';
- return this.onOpenAnimationEnd();
- }
- };
- ZammadChat.prototype.onOpenAnimationEnd = function() {
- var base;
- this.el.removeEventListener('transitionend', this.onOpenAnimationEnd);
- this.el.classList.remove('zammad-chat--animate');
- this.idleTimeout.stop();
- if (this.isFullscreen) {
- this.disableScrollOnRoot();
- }
- return typeof (base = this.options).onOpenAnimationEnd === "function" ? base.onOpenAnimationEnd() : void 0;
- };
- ZammadChat.prototype.sessionClose = function() {
- this.send('chat_session_close', {
- session_id: this.sessionId
- });
- this.inactiveTimeout.stop();
- this.waitingListTimeout.stop();
- sessionStorage.removeItem('unfinished_message');
- if (this.onInitialQueueDelayId) {
- clearTimeout(this.onInitialQueueDelayId);
- }
- return this.setSessionId(void 0);
- };
- ZammadChat.prototype.toggle = function(event) {
- if (this.isOpen) {
- return this.close(event);
- } else {
- return this.open(event);
- }
- };
- ZammadChat.prototype.close = function(event) {
- var remainerHeight;
- if (!this.isOpen) {
- this.log.debug('can\'t close widget, it\'s not open');
- return;
- }
- if (this.initDelayId) {
- clearTimeout(this.initDelayId);
- }
- if (this.sessionId) {
- this.log.debug('session close before widget close');
- this.sessionClose();
- }
- this.log.debug('close widget');
- if (event) {
- event.stopPropagation();
- }
- if (this.isFullscreen) {
- this.enableScrollOnRoot();
- }
- remainerHeight = this.el.clientHeight - this.el.querySelector('.zammad-chat-header').offsetHeight;
- this.el.addEventListener('transitionend', this.onCloseAnimationEnd);
- this.el.classList.add('zammad-chat--animate');
- document.offsetHeight;
- return this.el.style.transform = "translateY(" + remainerHeight + "px)";
- };
- ZammadChat.prototype.onCloseAnimationEnd = function() {
- var base;
- this.el.removeEventListener('transitionend', this.onCloseAnimationEnd);
- this.el.classList.remove('zammad-chat-is-open', 'zammad-chat--animate');
- this.el.style.transform = '';
- this.showLoader();
- this.el.querySelector('.zammad-chat-welcome').classList.remove('zammad-chat-is-hidden');
- this.el.querySelector('.zammad-chat-agent').classList.add('zammad-chat-is-hidden');
- this.el.querySelector('.zammad-chat-agent-status').classList.add('zammad-chat-is-hidden');
- this.isOpen = false;
- if (typeof (base = this.options).onCloseAnimationEnd === "function") {
- base.onCloseAnimationEnd();
- }
- return this.io.reconnect();
- };
- ZammadChat.prototype.onWebSocketClose = function() {
- if (this.isOpen) {
- return;
- }
- if (this.el) {
- this.el.classList.remove('zammad-chat-is-shown');
- return this.el.classList.remove('zammad-chat-is-loaded');
- }
- };
- ZammadChat.prototype.show = function() {
- if (this.state === 'offline') {
- return;
- }
- this.el.classList.add('zammad-chat-is-loaded');
- return this.el.classList.add('zammad-chat-is-shown');
- };
- ZammadChat.prototype.disableInput = function() {
- this.inputDisabled = true;
- this.input.setAttribute('contenteditable', false);
- this.el.querySelector('.zammad-chat-send').disabled = true;
- return this.io.close();
- };
- ZammadChat.prototype.enableInput = function() {
- this.inputDisabled = false;
- this.input.setAttribute('contenteditable', true);
- return this.el.querySelector('.zammad-chat-send').disabled = false;
- };
- ZammadChat.prototype.hideModal = function() {
- return this.el.querySelector('.zammad-chat-modal').innerHTML = '';
- };
- ZammadChat.prototype.onQueueScreen = function(data) {
- var show;
- this.setSessionId(data.session_id);
- show = (function(_this) {
- return function() {
- _this.onQueue(data);
- return _this.waitingListTimeout.start();
- };
- })(this);
- if (this.initialQueueDelay && !this.onInitialQueueDelayId) {
- this.onInitialQueueDelayId = setTimeout(show, this.initialQueueDelay);
- return;
- }
- if (this.onInitialQueueDelayId) {
- clearTimeout(this.onInitialQueueDelayId);
- }
- return show();
- };
- ZammadChat.prototype.onQueue = function(data) {
- this.log.notice('onQueue', data.position);
- this.inQueue = true;
- return this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('waiting')({
- position: data.position
- });
- };
- ZammadChat.prototype.onAgentTypingStart = function() {
- if (this.stopTypingId) {
- clearTimeout(this.stopTypingId);
- }
- this.stopTypingId = setTimeout(this.onAgentTypingEnd, 3000);
- if (this.el.querySelector('.zammad-chat-message--typing')) {
- return;
- }
- this.maybeAddTimestamp();
- this.body.insertAdjacentHTML('beforeend', this.view('typingIndicator')());
- if (!this.isVisible(this.el.querySelector('.zammad-chat-message--typing'), true)) {
- return;
- }
- return this.scrollToBottom();
- };
- ZammadChat.prototype.onAgentTypingEnd = function() {
- if (this.el.querySelector('.zammad-chat-message--typing')) {
- return this.el.querySelector('.zammad-chat-message--typing').remove();
- }
- };
- ZammadChat.prototype.onLeaveTemporary = function() {
- if (!this.sessionId) {
- return;
- }
- return this.send('chat_session_leave_temporary', {
- session_id: this.sessionId
- });
- };
- ZammadChat.prototype.maybeAddTimestamp = function() {
- var label, time, timestamp;
- timestamp = Date.now();
- if (!this.lastTimestamp || (timestamp - this.lastTimestamp) > this.showTimeEveryXMinutes * 60000) {
- label = this.T('Today');
- time = new Date().toTimeString().substr(0, 5);
- if (this.lastAddedType === 'timestamp') {
- this.updateLastTimestamp(label, time);
- return this.lastTimestamp = timestamp;
- } else {
- this.body.insertAdjacentHTML('beforeend', this.view('timestamp')({
- label: label,
- time: time
- }));
- this.lastTimestamp = timestamp;
- this.lastAddedType = 'timestamp';
- return this.scrollToBottom();
- }
- }
- };
- ZammadChat.prototype.updateLastTimestamp = function(label, time) {
- var timestamps;
- if (!this.el) {
- return;
- }
- timestamps = this.el.querySelectorAll('.zammad-chat-body .zammad-chat-timestamp');
- if (!timestamps) {
- return;
- }
- return timestamps[timestamps.length - 1].outerHTML = this.view('timestamp')({
- label: label,
- time: time
- });
- };
- ZammadChat.prototype.addStatus = function(status) {
- if (!this.el) {
- return;
- }
- this.maybeAddTimestamp();
- this.body.insertAdjacentHTML('beforeend', this.view('status')({
- status: status
- }));
- return this.scrollToBottom();
- };
- ZammadChat.prototype.detectScrolledtoBottom = function() {
- var scrollBottom;
- scrollBottom = this.body.scrollTop + this.body.offsetHeight;
- this.scrolledToBottom = Math.abs(scrollBottom - this.body.scrollHeight) <= this.scrollSnapTolerance;
- if (this.scrolledToBottom) {
- return this.el.querySelector('.zammad-scroll-hint').classList.add('is-hidden');
- }
- };
- ZammadChat.prototype.showScrollHint = function() {
- this.el.querySelector('.zammad-scroll-hint').classList.remove('is-hidden');
- return this.body.scrollTop = this.body.scrollTop + this.el.querySelector('.zammad-scroll-hint').offsetHeight;
- };
- ZammadChat.prototype.onScrollHintClick = function() {
- return this.body.scrollTo({
- top: this.body.scrollHeight,
- behavior: 'smooth'
- });
- };
- ZammadChat.prototype.scrollToBottom = function(arg) {
- var showHint;
- showHint = (arg != null ? arg : {
- showHint: false
- }).showHint;
- if (this.scrolledToBottom) {
- return this.body.scrollTop = this.body.scrollHeight;
- } else if (showHint) {
- return this.showScrollHint();
- }
- };
- ZammadChat.prototype.destroy = function(params) {
- var btn;
- if (params == null) {
- params = {};
- }
- this.log.debug('destroy widget', params);
- this.setAgentOnlineState('offline');
- if (params.remove && this.el) {
- this.el.remove();
- btn = document.querySelector("." + this.options.buttonClass);
- if (btn) {
- btn.classList.add(this.options.inactiveClass);
- btn.style.display = 'none';
- }
- }
- if (this.waitingListTimeout) {
- this.waitingListTimeout.stop();
- }
- if (this.inactiveTimeout) {
- this.inactiveTimeout.stop();
- }
- if (this.idleTimeout) {
- this.idleTimeout.stop();
- }
- return this.io.close();
- };
- ZammadChat.prototype.reconnect = function() {
- this.log.notice('reconnecting');
- this.disableInput();
- this.lastAddedType = 'status';
- this.setAgentOnlineState('connecting');
- return this.addStatus(this.T('Connection lost'));
- };
- ZammadChat.prototype.onConnectionReestablished = function() {
- var base;
- this.lastAddedType = 'status';
- this.setAgentOnlineState('online');
- this.addStatus(this.T('Connection re-established'));
- return typeof (base = this.options).onConnectionReestablished === "function" ? base.onConnectionReestablished() : void 0;
- };
- ZammadChat.prototype.onSessionClosed = function(data) {
- var base;
- this.addStatus(this.T('Chat closed by %s', data.realname));
- this.disableInput();
- this.setAgentOnlineState('offline');
- this.inactiveTimeout.stop();
- return typeof (base = this.options).onSessionClosed === "function" ? base.onSessionClosed(data) : void 0;
- };
- ZammadChat.prototype.setSessionId = function(id) {
- this.sessionId = id;
- if (id === void 0) {
- return sessionStorage.removeItem('sessionId');
- } else {
- return sessionStorage.setItem('sessionId', id);
- }
- };
- ZammadChat.prototype.onConnectionEstablished = function(data) {
- var base;
- if (this.onInitialQueueDelayId) {
- clearTimeout(this.onInitialQueueDelayId);
- }
- this.inQueue = false;
- if (data.agent) {
- this.agent = data.agent;
- }
- if (data.session_id) {
- this.setSessionId(data.session_id);
- }
- this.body.innerHTML = '';
- this.el.querySelector('.zammad-chat-agent').innerHTML = this.view('agent')({
- agent: this.agent
- });
- this.enableInput();
- this.hideModal();
- this.el.querySelector('.zammad-chat-welcome').classList.add('zammad-chat-is-hidden');
- this.el.querySelector('.zammad-chat-agent').classList.remove('zammad-chat-is-hidden');
- this.el.querySelector('.zammad-chat-agent-status').classList.remove('zammad-chat-is-hidden');
- if (!this.isFullscreen) {
- this.input.focus();
- }
- this.setAgentOnlineState('online');
- this.waitingListTimeout.stop();
- this.idleTimeout.stop();
- this.inactiveTimeout.start();
- return typeof (base = this.options).onConnectionEstablished === "function" ? base.onConnectionEstablished(data) : void 0;
- };
- ZammadChat.prototype.showCustomerTimeout = function() {
- this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('customer_timeout')({
- agent: this.agent.name,
- delay: this.options.inactiveTimeout
- });
- this.el.querySelector('.js-restart').addEventListener('click', function() {
- return location.reload();
- });
- return this.sessionClose();
- };
- ZammadChat.prototype.showWaitingListTimeout = function() {
- this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('waiting_list_timeout')({
- delay: this.options.watingListTimeout
- });
- this.el.querySelector('.js-restart').addEventListener('click', function() {
- return location.reload();
- });
- return this.sessionClose();
- };
- ZammadChat.prototype.showLoader = function() {
- return this.el.querySelector('.zammad-chat-modal').innerHTML = this.view('loader')();
- };
- ZammadChat.prototype.setAgentOnlineState = function(state) {
- var capitalizedState;
- this.state = state;
- if (!this.el) {
- return;
- }
- capitalizedState = state.charAt(0).toUpperCase() + state.slice(1);
- this.el.querySelector('.zammad-chat-agent-status').dataset.status = state;
- return this.el.querySelector('.zammad-chat-agent-status').textContent = this.T(capitalizedState);
- };
- ZammadChat.prototype.detectHost = function() {
- var protocol;
- protocol = 'ws://';
- if (scriptProtocol === 'https') {
- protocol = 'wss://';
- }
- return this.options.host = "" + protocol + scriptHost + "/ws";
- };
- ZammadChat.prototype.loadCss = function() {
- var newSS, styles, url;
- if (!this.options.cssAutoload) {
- return;
- }
- url = this.options.cssUrl;
- if (!url) {
- url = this.options.host.replace(/^wss/i, 'https').replace(/^ws/i, 'http').replace(/\/ws$/i, '');
- url += '/assets/chat/chat.css';
- }
- this.log.debug("load css from '" + url + "'");
- styles = "@import url('" + url + "');";
- newSS = document.createElement('link');
- newSS.onload = this.onCssLoaded;
- newSS.rel = 'stylesheet';
- newSS.href = 'data:text/css,' + escape(styles);
- return document.getElementsByTagName('head')[0].appendChild(newSS);
- };
- ZammadChat.prototype.onCssLoaded = function() {
- var base;
- this.cssLoaded = true;
- if (this.socketReady) {
- this.onReady();
- }
- return typeof (base = this.options).onCssLoaded === "function" ? base.onCssLoaded() : void 0;
- };
- ZammadChat.prototype.startTimeoutObservers = function() {
- this.idleTimeout = new Timeout({
- logPrefix: 'idleTimeout',
- debug: this.options.debug,
- timeout: this.options.idleTimeout,
- timeoutIntervallCheck: this.options.idleTimeoutIntervallCheck,
- callback: (function(_this) {
- return function() {
- _this.log.debug('Idle timeout reached, hide widget', new Date);
- return _this.destroy({
- remove: true
- });
- };
- })(this)
- });
- this.inactiveTimeout = new Timeout({
- logPrefix: 'inactiveTimeout',
- debug: this.options.debug,
- timeout: this.options.inactiveTimeout,
- timeoutIntervallCheck: this.options.inactiveTimeoutIntervallCheck,
- callback: (function(_this) {
- return function() {
- _this.log.debug('Inactive timeout reached, show timeout screen.', new Date);
- _this.showCustomerTimeout();
- return _this.destroy({
- remove: false
- });
- };
- })(this)
- });
- return this.waitingListTimeout = new Timeout({
- logPrefix: 'waitingListTimeout',
- debug: this.options.debug,
- timeout: this.options.waitingListTimeout,
- timeoutIntervallCheck: this.options.waitingListTimeoutIntervallCheck,
- callback: (function(_this) {
- return function() {
- _this.log.debug('Waiting list timeout reached, show timeout screen.', new Date);
- _this.showWaitingListTimeout();
- return _this.destroy({
- remove: false
- });
- };
- })(this)
- });
- };
- ZammadChat.prototype.disableScrollOnRoot = function() {
- this.rootScrollOffset = this.scrollRoot.scrollTop;
- this.scrollRoot.style.overflow = 'hidden';
- return this.scrollRoot.style.position = 'fixed';
- };
- ZammadChat.prototype.enableScrollOnRoot = function() {
- this.scrollRoot.scrollTop = this.rootScrollOffset;
- this.scrollRoot.style.overflow = '';
- return this.scrollRoot.style.position = '';
- };
- ZammadChat.prototype.isVisible = function(el, partial, hidden, direction) {
- var bViz, clientSize, hVisible, lViz, rViz, rec, tViz, vVisible, vpHeight, vpWidth;
- if (el.length < 1) {
- return;
- }
- vpWidth = window.innerWidth;
- vpHeight = window.innerHeight;
- direction = direction ? direction : 'both';
- clientSize = hidden === true ? t.offsetWidth * t.offsetHeight : true;
- rec = el.getBoundingClientRect();
- tViz = rec.top >= 0 && rec.top < vpHeight;
- bViz = rec.bottom > 0 && rec.bottom <= vpHeight;
- lViz = rec.left >= 0 && rec.left < vpWidth;
- rViz = rec.right > 0 && rec.right <= vpWidth;
- vVisible = partial ? tViz || bViz : tViz && bViz;
- hVisible = partial ? lViz || rViz : lViz && rViz;
- if (direction === 'both') {
- return clientSize && vVisible && hVisible;
- } else if (direction === 'vertical') {
- return clientSize && vVisible;
- } else if (direction === 'horizontal') {
- return clientSize && hVisible;
- }
- };
- ZammadChat.prototype.isRetina = function() {
- var mq;
- if (window.matchMedia) {
- mq = window.matchMedia('only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)');
- return mq && mq.matches || (window.devicePixelRatio > 1);
- }
- return false;
- };
- ZammadChat.prototype.resizeImage = function(dataURL, x, y, sizeFactor, type, quallity, callback, force) {
- var imageObject;
- if (x == null) {
- x = 'auto';
- }
- if (y == null) {
- y = 'auto';
- }
- if (sizeFactor == null) {
- sizeFactor = 1;
- }
- if (force == null) {
- force = true;
- }
- imageObject = new Image();
- imageObject.onload = function() {
- var canvas, context, factor, imageHeight, imageWidth, newDataUrl, resize;
- imageWidth = imageObject.width;
- imageHeight = imageObject.height;
- console.log('ImageService', 'current size', imageWidth, imageHeight);
- if (y === 'auto' && x === 'auto') {
- x = imageWidth;
- y = imageHeight;
- }
- if (y === 'auto') {
- factor = imageWidth / x;
- y = imageHeight / factor;
- }
- if (x === 'auto') {
- factor = imageWidth / y;
- x = imageHeight / factor;
- }
- resize = false;
- if (x < imageWidth || y < imageHeight) {
- resize = true;
- x = x * sizeFactor;
- y = y * sizeFactor;
- } else {
- x = imageWidth;
- y = imageHeight;
- }
- canvas = document.createElement('canvas');
- canvas.width = x;
- canvas.height = y;
- context = canvas.getContext('2d');
- context.drawImage(imageObject, 0, 0, x, y);
- if (quallity === 'auto') {
- if (x < 200 && y < 200) {
- quallity = 1;
- } else if (x < 400 && y < 400) {
- quallity = 0.9;
- } else if (x < 600 && y < 600) {
- quallity = 0.8;
- } else if (x < 900 && y < 900) {
- quallity = 0.7;
- } else {
- quallity = 0.6;
- }
- }
- newDataUrl = canvas.toDataURL(type, quallity);
- if (resize) {
- console.log('ImageService', 'resize', x / sizeFactor, y / sizeFactor, quallity, (newDataUrl.length * 0.75) / 1024 / 1024, 'in mb');
- callback(newDataUrl, x / sizeFactor, y / sizeFactor, true);
- return;
- }
- console.log('ImageService', 'no resize', x, y, quallity, (newDataUrl.length * 0.75) / 1024 / 1024, 'in mb');
- return callback(newDataUrl, x, y, false);
- };
- return imageObject.src = dataURL;
- };
- ZammadChat.prototype.pasteHtmlAtCaret = function(html) {
- var el, frag, lastNode, node, range, sel;
- sel = void 0;
- range = void 0;
- if (window.getSelection) {
- sel = window.getSelection();
- if (sel.getRangeAt && sel.rangeCount) {
- range = sel.getRangeAt(0);
- range.deleteContents();
- el = document.createElement('div');
- el.innerHTML = html;
- frag = document.createDocumentFragment(node, lastNode);
- while (node = el.firstChild) {
- lastNode = frag.appendChild(node);
- }
- range.insertNode(frag);
- if (lastNode) {
- range = range.cloneRange();
- range.setStartAfter(lastNode);
- range.collapse(true);
- sel.removeAllRanges();
- return sel.addRange(range);
- }
- }
- } else if (document.selection && document.selection.type !== 'Control') {
- return document.selection.createRange().pasteHTML(html);
- }
- };
- ZammadChat.prototype.wordFilter = function(editor) {
- var content, cur_level, el, i, j, k, l, last_level, len, len1, len2, len3, len4, len5, len6, len7, list_tag, m, matches, n, o, p, pnt, q, r, ref, ref1, ref10, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, s, start, str, txt;
- content = editor.html();
- content = content.replace(/<!--[\s\S]+?-->/gi, '');
- content = content.replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi, '');
- content = content.replace(/<(\/?)s>/gi, '<$1strike>');
- content = content.replace(/ /gi, ' ');
- editor.innerHTML = content;
- ref = editor.querySelectorAll('p');
- for (j = 0, len = ref.length; j < len; j++) {
- p = ref[j];
- str = p.getAttribute('style');
- matches = /mso-list:\w+ \w+([0-9]+)/.exec(str);
- if (matches) {
- p.dataset._listLevel = parseInt(matches[1], 10);
- }
- }
- last_level = 0;
- pnt = null;
- ref1 = editor.querySelectorAll('p');
- for (k = 0, len1 = ref1.length; k < len1; k++) {
- p = ref1[k];
- cur_level = p.dataset._listLevel;
- if (cur_level !== void 0) {
- txt = p.textContent;
- list_tag = '<ul></ul>';
- if (/^\s*\w+\./.test(txt)) {
- matches = /([0-9])\./.exec(txt);
- if (matches) {
- start = parseInt(matches[1], 10);
- list_tag = (ref2 = start > 1) != null ? ref2 : '<ol start="' + start + {
- '"></ol>': '<ol></ol>'
- };
- } else {
- list_tag = '<ol></ol>';
- }
- }
- if (cur_level > last_level) {
- if (last_level === 0) {
- p.insertAdjacentHTML('beforebegin', list_tag);
- pnt = p.previousElementSibling;
- } else {
- }
- pnt.insertAdjacentHTML('beforeend', list_tag);
- }
- if (cur_level < last_level) {
- for (i = l = ref3 = i, ref4 = last_level - cur_level; ref3 <= ref4 ? l <= ref4 : l >= ref4; i = ref3 <= ref4 ? ++l : --l) {
- pnt = pnt.parentNode;
- }
- }
- if (p.querySelector('span:first')) {
- p.querySelector('span:first').remove();
- }
- pnt.insertAdjacentHTML('beforeend', '<li>' + p.innerHTML + '</li>');
- p.remove();
- last_level = cur_level;
- } else {
- last_level = 0;
- }
- }
- ref5 = editor.querySelectorAll('[style]');
- for (m = 0, len2 = ref5.length; m < len2; m++) {
- el = ref5[m];
- el.removeAttribute('style');
- }
- ref6 = editor.querySelectorAll('[align]');
- for (n = 0, len3 = ref6.length; n < len3; n++) {
- el = ref6[n];
- el.removeAttribute('align');
- }
- ref7 = editor.querySelectorAll('span');
- for (o = 0, len4 = ref7.length; o < len4; o++) {
- el = ref7[o];
- el.outerHTML = el.innerHTML;
- }
- ref8 = editor.querySelectorAll('span:empty');
- for (q = 0, len5 = ref8.length; q < len5; q++) {
- el = ref8[q];
- el.remove();
- }
- ref9 = editor.querySelectorAll("[class^='Mso']");
- for (r = 0, len6 = ref9.length; r < len6; r++) {
- el = ref9[r];
- el.removeAttribute('class');
- }
- ref10 = editor.querySelectorAll('p:empty');
- for (s = 0, len7 = ref10.length; s < len7; s++) {
- el = ref10[s];
- el.remove();
- }
- return editor;
- };
- ZammadChat.prototype.removeAttribute = function(element) {
- var att, j, len, ref, results;
- if (!element) {
- return;
- }
- ref = element.attributes;
- results = [];
- for (j = 0, len = ref.length; j < len; j++) {
- att = ref[j];
- results.push(element.removeAttribute(att.name));
- }
- return results;
- };
- ZammadChat.prototype.removeAttributes = function(html) {
- var j, len, node, ref;
- ref = html.querySelectorAll('*');
- for (j = 0, len = ref.length; j < len; j++) {
- node = ref[j];
- this.removeAttribute(node);
- }
- return html;
- };
- return ZammadChat;
- })(Base);
- return window.ZammadChat = ZammadChat;
- })(window);
|