| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680 |
- (() => {
- (function() {
- var proxy;
- var chatProxy;
- var local = window.setting ? window.setting.langJson || {} : {};
- var isOnline = function() {
- try {
- return [ "online", "online-sg", "gray", "release" ].indexOf("online") > -1;
- } catch (e) {
- return false;
- }
- };
- var appKey = window.appKey || "";
- var remoteSetting = {};
- var IMAGE_PREVIEW_CATEGORY = "ysf-image-preview";
- var IMAGE_PREVIEW_PROTOCOL_VERSION = 1;
- var IMAGE_PREVIEW_ASSET_PATH = "/storage/5eacdf8a-b557-43cb-ba0a-6ede26213395.js";
- var IMAGE_PREVIEW_VERSION = "2.0.2";
- var IMAGE_PREVIEW_CDN_BASE = "https://ysf.nosdn.127.net";
- var IMAGE_PREVIEW_STORAGE_CDN_BASE = "https://res.qiyukf.net";
- var IMAGE_PREVIEW_CDN_HOSTS = {
- "ysf.nosdn.127.net": true,
- "qiyukf.nosdn.127.net": true,
- "res.qiyukf.net": true
- };
- var IMAGE_PREVIEW_PATH_PREFIX = "/image-preview/";
- var IMAGE_PREVIEW_STORAGE_PATH_PREFIX = "/storage/";
- var IMAGE_PREVIEW_TIMEOUT = 8e3;
- var previewLoadPromise = null;
- var previewLoadKey = "";
- var activePreviewRequest = null;
- var sdkCspNonce = function() {
- var e = typeof document !== "undefined" ? document.currentScript : null;
- if (!e) {
- var t = typeof document !== "undefined" ? document.getElementsByTagName("script") : [];
- e = t[t.length - 1];
- }
- return e ? e.nonce || e.getAttribute("nonce") || "" : "";
- }();
- var urlSetting = {};
- var inviteSetting = {};
- var sdkSetting = {};
- var sdkURL = "";
- var corpSetting = {};
- var settingUrl = "/webapi/sdk/setting/data";
- try {
- window.__YSFSDKADR__ = "https://qiyukf.com" || 0;
- window.__YSFDAROOT__ = "https://da.qiyukf.com/webda/da.gif" || 0;
- } catch (e) {
- window.__YSFSDKADR__ = "https://qytest.netease.com";
- window.__YSFDAROOT__ = "https://da.qiyukf.com/webda/da.gif";
- }
- function getAppKey(e) {
- e = e || document.currentScript.src;
- var t = e.match(/script\/(.*?)\.js/);
- return t && t[1];
- }
- function getCurrentScriptParams(e) {
- if (document.currentScript) {
- var t = document.currentScript.src;
- appKey = getAppKey(t);
- var i = new URL(t);
- return i.searchParams.get(e);
- } else {
- var n = document.getElementsByTagName("script");
- var o = n[n.length - 1].src;
- appKey = getAppKey(t);
- var r = {};
- var a = o.split("?")[1];
- if (a) {
- var s = /([^&=]+)=([^&]*)/g;
- var c;
- while (c = s.exec(a)) {
- r[decodeURIComponent(c[1])] = decodeURIComponent(c[2]);
- }
- }
- return r[e];
- }
- }
- function PromisePolyfill(e) {
- this.state = "pending";
- this.value = undefined;
- this.handlers = [];
- var t = function(e) {
- if (this.state === "pending") {
- this.state = "fulfilled";
- this.value = e;
- this.handlers.forEach((function(t) {
- t.onFulfilled(e);
- }));
- }
- }.bind(this);
- var i = function(e) {
- if (this.state === "pending") {
- this.state = "rejected";
- this.value = e;
- this.handlers.forEach((function(t) {
- t.onRejected(e);
- }));
- }
- }.bind(this);
- try {
- e(t, i);
- } catch (e) {
- i(e);
- }
- }
- var each = function(e, t) {
- if (!e || !t) {
- return;
- }
- for (var i in e) {
- if (e.hasOwnProperty(i)) {
- t.call(null, i, e[i]);
- }
- }
- };
- var serialize = function(e, t) {
- var i = [];
- each(e, (function(e, n) {
- if (t && n == undefined) {} else {
- i.push(encodeURIComponent(e) + "=" + encodeURIComponent(n));
- }
- }));
- return i.join("&");
- };
- PromisePolyfill.prototype.then = function(e, t) {
- var i = this;
- return new PromisePolyfill((function(n, o) {
- if (i.state === "fulfilled") {
- setTimeout((function() {
- try {
- if (typeof e === "function") {
- n(e(i.value));
- } else {
- n(i.value);
- }
- } catch (e) {
- o(e);
- }
- }), 0);
- } else if (i.state === "rejected") {
- setTimeout((function() {
- try {
- if (typeof t === "function") {
- n(t(i.value));
- } else {
- o(i.value);
- }
- } catch (e) {
- o(e);
- }
- }), 0);
- } else {
- i.handlers.push({
- onFulfilled: function(t) {
- try {
- if (typeof e === "function") {
- n(e(t));
- } else {
- n(t);
- }
- } catch (e) {
- o(e);
- }
- },
- onRejected: function(e) {
- try {
- if (typeof t === "function") {
- n(t(e));
- } else {
- o(e);
- }
- } catch (e) {
- o(e);
- }
- }
- });
- }
- }));
- };
- PromisePolyfill.prototype.catch = function(e) {
- return this.then(null, e);
- };
- var util = {
- isFrameModule: function() {
- if (util.isMobilePlatform() && window.__YSFMODILEWINTYPE__ === 2) {
- return "mobileFrame";
- } else if (!util.isMobilePlatform() && window.__YSFWINTYPE__ === 1) {
- return "webFrame";
- } else {
- false;
- }
- },
- isMobilePlatform: function() {
- const e = navigator.userAgent;
- if (/OpenHarmony/i.test(e) && /\bPC\b/i.test(e)) {
- return false;
- }
- return !!/(iPhone|iPad|iPod|iOS|Android|OpenHarmony)/i.test(e);
- },
- isIOSorSafari: function() {
- return !!(/(iPhone|iPad|iOS|mini)/i.test(navigator.userAgent) || (navigator.userAgent.indexOf("Safari") > -1 || ~navigator.userAgent.indexOf("AppleWebKit")) && navigator.userAgent.indexOf("Chrome") == -1);
- },
- isFirefox: function() {
- return navigator.userAgent.indexOf("Firefox") !== -1;
- },
- createAjax: function() {
- var e = null;
- var t = [ "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP.4.0", "Msxml2.XMLHTTP.5.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP" ];
- if (window.XMLHttpRequest) {
- e = new XMLHttpRequest;
- if ("withCredentials" in e) {
- return e;
- }
- }
- if (window.xDomainRequest) {
- e = new Window.xDomainRequest;
- }
- return e;
- },
- mergeParams: function(e) {
- var t = [];
- for (var i in e) {
- if (e.hasOwnProperty(i)) {
- t.push(encodeURIComponent(i) + "=" + encodeURIComponent(e[i]));
- }
- }
- return t.join("&");
- },
- ajax: function(conf) {
- var method = conf.method || "get", contentType = conf.contentType, url = conf.url, data = conf.data, result = {}, success = conf.success, error = conf.error, fullResult = conf.fullResult || false;
- var xhr = util.createAjax();
- if (!xhr) {
- error("NOT SUPPORT XHR");
- return;
- }
- try {
- if (method.toUpperCase() === "GET") {
- if (data) {
- url = url + "?" + util.mergeParams(data);
- }
- }
- if (conf.synchronous) {
- xhr.open(method, url, false);
- } else {
- xhr.open(method, url);
- }
- } catch (e) {
- console.error(e);
- error(e);
- return;
- }
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status === 200) {
- try {
- result = eval("(" + xhr.responseText + ")");
- } catch (e) {
- error(e);
- return;
- }
- if ((result && result.code) == 200) {
- success(fullResult ? result : result.result);
- } else {
- error(result);
- }
- } else {
- error();
- }
- }
- };
- if (method.toUpperCase() === "GET") {
- xhr.send(null);
- } else {
- if (contentType === "json") {
- xhr.setRequestHeader("content-type", "application/json");
- xhr.send(JSON.stringify(data));
- } else {
- xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
- xhr.send(util.mergeParams(data));
- }
- }
- },
- findLocalItems: function(e, t) {
- var i, n = [], o;
- for (i in localStorage) {
- if (i.match(e) || !e && typeof i === "string") {
- o = !t ? localStorage.getItem(i) : JSON.parse(localStorage.getItem(i));
- n.push({
- key: i,
- val: o
- });
- }
- }
- return n;
- },
- clearLocalItems: function(e) {
- for (var t = 0; t < e.length; t++) {
- window.localStorage.removeItem(e[t].key);
- }
- },
- addEvent: function(e, t, i) {
- if (e.addEventListener) {
- e.addEventListener(t, i, false);
- } else if (e.attachEvent) {
- e.attachEvent("on" + t, i);
- }
- },
- isIe: function() {
- return !!window.ActiveXObject || "ActiveXObject" in window;
- },
- isEdge: function() {
- return navigator.userAgent.indexOf("Edge") > -1;
- },
- addLoadEventForProxy: function() {
- function e() {
- for (var e = i.length - 1; e >= 0; e--) {
- i[e]();
- }
- }
- var t = false;
- var i = [];
- return function(n) {
- i.push(n);
- if (t) {
- return;
- }
- if (proxy.addEventListener) {
- proxy.addEventListener("load", e, false);
- } else if (proxy.attachEvent) {
- proxy.attachEvent("onload", e);
- }
- t = true;
- };
- }(),
- mergeUrl: function(e, t) {
- var i = e.split("?"), n = i.shift(), o = util.query2Object(i.shift() || "", "&");
- for (var r in t) {
- o[r] = t[r];
- }
- return n + "?" + serialize(o);
- },
- query2Object: function(e, t) {
- var i = e.split(t), n = {};
- for (var o = 0; o < i.length; o++) {
- var r = i[o], a = (r || "").split("="), s = a.shift();
- if (!s) {
- continue;
- }
- n[decodeURIComponent(s)] = decodeURIComponent(a.join("="));
- }
- return n;
- },
- isFunction: function(e) {
- return {}.toString.call(e).toLowerCase() === "[object function]" || {}.toString.call(e).toLowerCase() === "[object asyncfunction]";
- },
- isArray: function(e) {
- return {}.toString.call(e).toLowerCase() === "[object array]";
- },
- notification: function() {
- var e, t;
- return function(i) {
- if (e) {
- clearTimeout(t);
- e.close();
- }
- if (window.Notification && window.Notification.permission !== "granted") {
- Notification.requestPermission();
- }
- if (window.Notification && window.Notification.permission != "denied") {
- e = new Notification(i.notify, {
- tag: i.tag,
- body: i.body,
- icon: i.icon.indexOf("http") > -1 ? i.icon : window.__YSFSDKADR__ + i.icon
- });
- util.playAudio();
- e.onclick = function() {
- e && e.close();
- window.focus();
- ysf.openLayer();
- ysf.NotifyMsgAndBubble({
- category: "clearCircle"
- });
- };
- t = window.setTimeout((function() {
- e.close();
- }), 2e4);
- }
- };
- }(),
- playAudio: function() {
- if (window.__YSFSDKADR__) {
- var e = document.createElement("audio");
- e.src = "//ysf.nosdn.127.net/webapi/38a7410cdf36ef88290e0136e0f86998";
- return function() {
- e.play();
- };
- }
- }(),
- encode: function(e, t) {
- t = "" + t;
- if (!e || !t) {
- return t || "";
- }
- return t.replace(e.r, (function(t) {
- var i = e[!e.i ? t.toLowerCase() : t];
- return i != null ? i : t;
- }));
- },
- escape: function() {
- var e = /<br\/?>$/, t = {
- r: /\<|\>|\&|\r|\n|\s|\'|\"/g,
- "<": "<",
- ">": ">",
- "&": "&",
- " ": " ",
- '"': """,
- "'": "'",
- "\n": "<br/>",
- "\r": ""
- };
- return function(i) {
- i = util.encode(t, i);
- return i.replace(e, "<br/><br/>");
- };
- }(),
- unescape: function() {
- var e = {
- r: /\&(?:lt|gt|amp|nbsp|#39|quot)\;|\<br\/\>/gi,
- "<": "<",
- ">": ">",
- "&": "&",
- " ": " ",
- "'": "'",
- """: '"',
- "<br/>": "\n"
- };
- return function(t) {
- return util.encode(e, t);
- };
- }(),
- replaceRichAndUnescape: function(e) {
- var t = /<img[^>]+>/g;
- e = e.replace(t, "[" + (local.IMAGE || "图片") + "]");
- var i = /<\/?[^>]*>/g;
- e = e.replace(i, "");
- return util.unescape(e);
- },
- consoleError: function(e) {
- window.console && window.console.error(e);
- },
- consoleWarn: function(e) {
- window.console && window.console.warn(e);
- },
- getToday: function() {
- var e = new Date;
- return e.getFullYear() + "-" + e.getMonth() + "-" + e.getDate();
- },
- Base64: function() {
- var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- this.encode = function(t) {
- var i = "";
- var n, o, r, a, s, c, l;
- var u = 0;
- t = _utf8_encode(t);
- while (u < t.length) {
- n = t.charCodeAt(u++);
- o = t.charCodeAt(u++);
- r = t.charCodeAt(u++);
- a = n >> 2;
- s = (n & 3) << 4 | o >> 4;
- c = (o & 15) << 2 | r >> 6;
- l = r & 63;
- if (isNaN(o)) {
- c = l = 64;
- } else if (isNaN(r)) {
- l = 64;
- }
- i = i + e.charAt(a) + e.charAt(s) + e.charAt(c) + e.charAt(l);
- }
- return i;
- };
- this.decode = function(t) {
- var i = "";
- var n, o, r;
- var a, s, c, l;
- var u = 0;
- t = t.replace(/[^A-Za-z0-9\+\/\=]/g, "");
- while (u < t.length) {
- a = e.indexOf(t.charAt(u++));
- s = e.indexOf(t.charAt(u++));
- c = e.indexOf(t.charAt(u++));
- l = e.indexOf(t.charAt(u++));
- n = a << 2 | s >> 4;
- o = (s & 15) << 4 | c >> 2;
- r = (c & 3) << 6 | l;
- i = i + String.fromCharCode(n);
- if (c != 64) {
- i = i + String.fromCharCode(o);
- }
- if (l != 64) {
- i = i + String.fromCharCode(r);
- }
- }
- i = _utf8_decode(i);
- return i;
- };
- _utf8_encode = function(e) {
- e = e.replace(/\r\n/g, "\n");
- var t = "";
- for (var i = 0; i < e.length; i++) {
- var n = e.charCodeAt(i);
- if (n < 128) {
- t += String.fromCharCode(n);
- } else if (n > 127 && n < 2048) {
- t += String.fromCharCode(n >> 6 | 192);
- t += String.fromCharCode(n & 63 | 128);
- } else {
- t += String.fromCharCode(n >> 12 | 224);
- t += String.fromCharCode(n >> 6 & 63 | 128);
- t += String.fromCharCode(n & 63 | 128);
- }
- }
- return t;
- };
- _utf8_decode = function(e) {
- var t = "";
- var i = 0;
- var n = c1 = c2 = 0;
- while (i < e.length) {
- n = e.charCodeAt(i);
- if (n < 128) {
- t += String.fromCharCode(n);
- i++;
- } else if (n > 191 && n < 224) {
- c2 = e.charCodeAt(i + 1);
- t += String.fromCharCode((n & 31) << 6 | c2 & 63);
- i += 2;
- } else {
- c2 = e.charCodeAt(i + 1);
- c3 = e.charCodeAt(i + 2);
- t += String.fromCharCode((n & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
- i += 3;
- }
- }
- return t;
- };
- },
- throttleDebounce: function(e, t, i) {
- var n, o, r, a;
- var s = null;
- var c = null;
- var l = 0;
- var u = Date.now || function() {
- return (new Date).getTime();
- };
- if (!i) {
- i = {};
- }
- var f = function() {
- l = i.leading === false ? 0 : u();
- s = null;
- r = e.apply(n, o);
- if (!s) {
- n = o = null;
- }
- };
- var d = function() {
- var i = u() - a;
- if (i < t && i >= 0) {
- c = setTimeout(d, t - i);
- } else {
- c = null;
- r = e.apply(n, o);
- if (!c) {
- n = o = null;
- }
- }
- };
- return function() {
- var d = u();
- a = d;
- if (!l && i.leading === false) {
- l = d;
- }
- var m = t - (d - l);
- n = this;
- o = arguments;
- if (m <= 0 || m > t) {
- if (s) {
- clearTimeout(s);
- s = null;
- }
- l = d;
- r = e.apply(n, o);
- if (!s) {
- n = o = null;
- }
- } else {
- if (!s && i.trailing !== false) {
- s = setTimeout(f, m);
- }
- if (!c) {
- c = setTimeout(f, t);
- }
- }
- return r;
- };
- },
- loadJS: function(e, t) {
- var i = document.createElement("script"), n = t || function() {};
- i.type = "text/javascript";
- i.async = false;
- if (i.readyState) {
- i.onreadystatechange = function() {
- if (i.readyState == "loaded" || i.readyState == "complete") {
- i.onreadystatechange = null;
- n();
- }
- };
- } else {
- i.onload = function() {
- n();
- };
- }
- i.src = e;
- document.getElementsByTagName("head")[0].appendChild(i);
- },
- includes: function(e, t) {
- return String(e).indexOf(t) > -1;
- },
- getSearchParams: function(e, t) {
- var i = e.split("?")[1] || "";
- var n = util.query2Object(i, "&");
- return n[t] || null;
- }
- };
- function ininYsfSdk() {
- initSdkStyle();
- var e = {
- corpInfo: Number(corpSetting.corpInfo || "0"),
- winType: Number(corpSetting.dialogStyle || "1"),
- winMobileType: Number(corpSetting.dialogMobileStyle || "1"),
- sdkCustom: sdkSetting.theme || 0,
- hidden: String(remoteSetting.hidden) !== "1" || urlSetting.hidden && urlSetting.hidden !== "0" || urlSetting.hidden === "" ? 1 : 0,
- preloadIframe: remoteSetting.preloadIframe || 0,
- appKey: appKey,
- uid: urlSetting.uid || "",
- imgSrc: sdkURL,
- sessionInvite: remoteSetting.sessionInvite || 0
- };
- if (urlSetting.corpName && urlSetting.corpInfoUrl && urlSetting.corpCode) {
- e.profile = JSON.stringify([ {
- index: 0,
- key: "corpName",
- label: "企业名称",
- value: urlSetting.corpName,
- href: urlSetting.corpInfoUrl
- }, {
- index: 1,
- key: "corpCode",
- label: "企业域名",
- value: urlSetting.corpCode
- } ]);
- }
- ysf.config(e, 1);
- ysf.init(sdkURL, inviteSetting);
- if (inviteSetting.switchType !== 0) {
- ysf.invite(inviteSetting);
- }
- }
- function setConfig(e) {
- if (e) {
- sdkSetting = e.sdkSetting || {};
- inviteSetting = e.inviteSetting || {};
- corpSetting = e.corpSetting || {};
- sdkURL = e.sdkURL || "";
- }
- window.__YSFWINTYPE__ = Number(corpSetting.dialogStyle || "1");
- window.__YSFMODILEWINTYPE__ = Number(corpSetting.dialogMobileStyle || "2");
- window.__YSFTHEMELAYEROUT__ = sdkSetting.layout || 1;
- window.__YSFBGCOLOR__ = sdkSetting.bgColor || "0";
- window.__YSFBGTONE__ = sdkSetting.tone || "notone";
- window.__YSFBGIMG__ = sdkSetting.image || "";
- window.__YSFENABLENEWCLIENT__ = e && e.enableNewClient === 1 ? 1 : 0;
- var t = function(e) {
- window.__YSFSDKADR__ = "https://" + e;
- ysf.ROOT = window.__YSFSDKADR__ || "";
- ysf.initData();
- };
- if (e.cdomain) {
- t(e.cdomain);
- } else if (urlSetting.subdomain === "1") {
- t(e.accessDomain);
- }
- ysf.buildProxy();
- window.__YSFDASWITCH__ = e.analyticSwitch || 0;
- if (e.isGa === 1) {
- window.__YSFDAROOT__ = window.__YSFDAROOT__.replace("https://da", "https://dag");
- }
- if (e.globalSetting && e.globalSetting.privatisationUrl) {
- window.__YSFDAROOT__ = "https://da." + e.globalSetting.privatisationUrl + "/webda/da.gif";
- window.__YSFSDKADR__ = "https://" + e.globalSetting.privatisationUrl;
- }
- window.__YSFISGA__ = e.isGa || 0;
- window.__YSFVISITORRECORD__ = e.userVisitSwitch || 0;
- window.__YSFISUPINFOTOSERVER__ = e.isUpInfoToServer || 0;
- window.MIN_LBS = isOnline() ? "https://lbs.chatnos.com/lbs/webconf.jsp?devflag=qyonline" : "https://imtest-gy.netease.im/lbs/webconf.jsp?devflag=qytest";
- window.inviteSetting = inviteSetting;
- window.sdkTemplateId = e.sdkTemplateId || 0;
- window.shuntId = e.shuntId || 0;
- }
- function querySetting(e) {
- var t = {
- appKey: appKey
- };
- each(urlSetting, (function(e, i) {
- if (i !== null) {
- t[e] = i;
- }
- }));
- util.ajax({
- url: window.__YSFSDKADR__ + settingUrl,
- method: "GET",
- data: t,
- success: function(t) {
- if (t) {
- remoteSetting = t;
- setConfig(t);
- e();
- }
- },
- error: function(e) {
- console.error(e);
- }
- });
- }
- function initSdkStyle() {
- var e = "";
- var t = "";
- var i = [ "none", "#F96868", "#F2A654", "#926DDE", "#57C7D4", "#62A8EA", "#46BE8A", "#526069" ];
- if (sdkSetting.bgColor && sdkSetting.bgColor !== "0") {
- t = sdkSetting.bgColor;
- } else {
- t = i[sdkSetting.tone || 0];
- }
- if (sdkSetting.theme != 0) {
- e = "max-width:300px;max-height:300px;";
- sdkURL = sdkSetting.image || "";
- window.__YSFTHEMELAYEROUT__ = 0;
- if (sdkURL) {
- sdkURL = sdkURL + "?imageView&thumbnail=300x300";
- }
- }
- if (!sdkSetting.image) {
- sdkURL = "https://qiyukf.nosdn.127.net/sdk/res/kefu/custom/" + sdkSetting.layout + ".png";
- if (String(sdkSetting.layout) === "1") {
- e = "max-width:30px;max-height:120px;";
- } else {
- e = "max-width:70px;max-height:70px;";
- }
- }
- ysf.style([ "#YSF-BTN-HOLDER{position: fixed;" + e + "right: 30px; bottom: 24px; cursor: pointer; overflow: visible; filter: alpha(opacity=100);opacity:1;z-index: 9990}", "#YSF-BTN-HOLDER:hover{filter: alpha(opacity=95);opacity:.95}", "#YSF-BTN-HOLDER img{ display: block;overflow: hidden; }", "#YSF-BTN-CIRCLE{display: none;position: absolute;right: -5px;top: -6px;width: auto;min-width: 12px;height: 20px;padding: 0 4px;background-color: #f00;font-size: 12px;line-height: 20px;color: #fff;text-align: center;white-space: nowrap;font-family: sans-serif;border-radius: 10px;z-index:1;}", "#YSF-BTN-BUBBLE{display: none;position: absolute;left: -274px;bottom:-15px;width: 278px;height: 80px;box-sizing: border-box;padding: 14px 22px;filter: alpha(opacity=100);opacity:1;background: url(" + ysf.CDNROOT + "res/img/sdk/bg_floatMsg2x.png" + ") no-repeat;background:url(" + ysf.CDNROOT + "res/img/sdk/bg_floatMsg.png" + "); background-size: 278px 80px; z-index: 1;}", "#YSF-BTN-HOLDER.layer-6{bottom:0;}", "#YSF-BTN-HOLDER.layer-1 #YSF-BTN-BUBBLE{top:0}", "#YSF-BTN-HOLDER.layer-6 #YSF-BTN-BUBBLE{bottom:-6px;}", "#YSF-BTN-BUBBLE:hover{filter: alpha(opacity=95);opacity:.95}", "#YSF-BTN-CONTENT{height:45px;padding: 0;white-space: normal;word-break: break-all;text-align: left;font-size: 14px;line-height: 1.6;color: #222;overflow: hidden;z-index: 0;}", "#YSF-BTN-ARROW{ display: none; }", "#YSF-BTN-CLOSE{position: absolute; width:15px; height:15px;right: 4px;top: -3px; filter: alpha(opacity=90); opacity:.9; cursor: pointer; background: url(" + ysf.CDNROOT + "res/img/sdk/btn-close.png" + ") no-repeat;z-index: 1}", "#YSF-BTN-CLOSE:hover{filter: alpha(opacity=100); opacity: 1;}", "#YSF-PANEL-CORPINFO.ysf-chat-layeropen{ width: 511px; height: 500px; border-radius: 8px; box-shadow: 0 0 20px 0 rgba(0, 0, 0, .15);}", "#YSF-PANEL-CORPINFO{ position: fixed; bottom: 0px; right: 20px; width: 0; height: 0; z-index: 99999; }", "#YSF-PANEL-INFO.ysf-chat-layeropen{ width: 360px; height: 500px; border-radius: 8px; filter: alpha(opacity=100);opacity:1; box-shadow: 0 0 20px 0 rgba(0, 0, 0, .15);}", "#YSF-PANEL-INFO{ position: fixed; bottom: 0px; right: 20px; width: 0px; height: 0px; filter: alpha(opacity=0);opacity:0;z-index: 99999;}", "#YSF-PANEL-INFO .u-btn{background-color: " + t + ";}", "#YSF-CUSTOM-ENTRY{background-color: #F96868;}", "#YSF-CUSTOM-ENTRY-0{position: relative;width:auto;background-color: " + t + ";box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);}", "#YSF-CUSTOM-ENTRY-1{position: relative;width:auto;background-color: " + t + ";border-radius: 14px; box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);}", "#YSF-CUSTOM-ENTRY-2{position: relative;width:auto;background-color: " + t + ";border-radius: 8px;box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);}", "#YSF-CUSTOM-ENTRY-3{position: relative;width:auto;background-color: " + t + ";border-radius: 50%;box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);}", "#YSF-CUSTOM-ENTRY-4{position: relative;width:auto;background-color: " + t + ";border-radius: 50%;box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);}", "#YSF-CUSTOM-ENTRY-5{position: relative;width:auto;background-color: " + t + ";border-radius: 8px;box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);}", "#YSF-CUSTOM-ENTRY-6{position: relative;width:auto;background-color: " + t + ";border-radius: 8px;box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);}", "#YSF-CUSTOM-ENTRY-7{position: relative;width:auto;background-color: " + t + ";border-radius: 50%;box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);}", "#YSF-CUSTOM-ENTRY-8{position: relative;width:auto;background-color: " + t + ";border-radius: 8px;box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);}", "#YSF-CUSTOM-ENTRY-0 img{max-width: 300px;max-height: 300px;}", "#YSF-CUSTOM-ENTRY-1 img{width:28px;height:auto;}", "#YSF-CUSTOM-ENTRY-2 img{width:58px;height:auto;}", "#YSF-CUSTOM-ENTRY-3 img{width:60px;height:auto;}", "#YSF-CUSTOM-ENTRY-4 img{width:60px;height:auto;}", "#YSF-CUSTOM-ENTRY-5 img{width:60px;height:auto;}", "#YSF-CUSTOM-ENTRY-6 img{width:58px;height:auto;}", "#YSF-CUSTOM-ENTRY-7 img{width:60px;height:auto;}", "#YSF-CUSTOM-ENTRY-8 img{width:60px;height:auto;}", "#YSF-IFRAME-LAYER{ border:0; outline:none; }", ".ysf-online-invite-wrap{z-index:10001;position:fixed;_position:absolute;top:50%;left:50%;}", ".ysf-online-invite{position:relative;top:-50%;left:-50%;cursor:pointer;border-radius: 16px;box-shadow: 0 10px 30px 0 rgba(47,56,111,0.15);}", ".ysf-online-invite img{display:block;width:250px;}", ".ysf-online-invite .ysf-online-invite-img{width:100%;height:100%}", '.ysf-online-invite .text{position:absolute;top:-11px;left:0;right:0;overflow:hidden;margin: 36px 20px 0 67px;line-height:140%;color:#526069;font-size:14px;font-family:"Microsoft YaHei","微软雅黑",tahoma,arial,simsun,"宋体";text-align:left;white-space:normal;word-wrap:break-word;}', '.ysf-online-invite .close{position:absolute;top:12px;right:12px;width:16px;height:16px;background:url("https://ysf.nosdn.127.net/operation/4602027f7e6a0109ac433863d7d0acdf") no-repeat;cursor:pointer;background-size: cover;}', "#YSF-PANEL-MOBILE{ background: rgba(46,47,49,0.7); position: fixed; bottom: 0px; right: 0px; width: 100%; height: 0px; transition-property: height,bottom; transition-duration: 0.3s; transition-timing-function: ease; transition-delay: 0s; z-index: 99999; }", "#YSF-PANEL-MOBILE.ysf-chat-layeropen{ width: 100%; height: 100%; transition-property:height,bottom; transition-duration: 0.3s; transition-timing-function: ease; transition-delay: 0s; }", "#YSF-IFRAME-LAYER.ysf-chat-mobile-layeropen{ height: 90% !important; transition-property: height,bottom; transition-duration: 0.3s; transition-timing-function: ease; transition-delay: 0s; }", "#YSF-IFRAME-LAYER.ysf-chat-mobile-layeropen.ysf-chat-mobile-invite-layer{ height: 33% !important; }", "#YSF-IFRAME-LAYER{ position: absolute; bottom: 0px;left: 0; right: 0px; width: 0px; height: 0px; transition-property: height,bottom; transition-duration: 0.3s; transition-timing-function: ease; transition-delay: 0s; z-index: 9999; }", ".YSF-PANEL-BODY-FIXED{ position: fixed !important; left: 0; right: 0;}", ".YSF-INVITE-LAYER-WRAPPER {cursor: pointer; position: relative; border: 1px solid #eaf0f6; background: #fff;box-shadow: 0 5px 20px rgba(0,0,0,0.1); border-radius: 4px; width: 220px; padding: 16px; box-sizing: border-box; margin-bottom: 12px; background: #FFFFFF;box-shadow: 0 6px 20px 0 rgba(40,53,75,0.17);border-radius: 8px;}", ".YSF-INVITE-LAYER-HEADER {display: flex;align-items: center;justify-content: space-between;margin-bottom: 8px;}", ".YSF-INVITE-LAYER-HEADER-LEFT {display: flex;flex: 1;align-items: center;}", ".YSF-INVITE-LAYER-RICHTEXT { height: 44px; max-width: 168px; word-break: break-all; overflow: hidden; text-overflow: ellipsis; font-size: 14px; color: #333333; line-height: 22px; text-align: left; }", ".YSF-INVITE-LAYER-RICHTEXT p { margin: 0;}", "#YSF-BTN-HOLDER .YSF-INVITE-LAYER-AVATAR { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }", ".YSF-INVITE-LAYER-KEFU-NAME { font-size: 12px; color: #999999; margin-left: 4px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }", '#YSF-ONLINE-INVITE-LAYER-CLOSE{ width:12px; height:12px; background:url("https://ysf.nosdn.127.net/operation/0e5ee37a71d33e05b74d1a5aa3cdd99a") no-repeat; background-size: cover; cursor:pointer; }', "#YSF-INVITE-LAYER-WRAPPER-ENTRY { position: relative; float: right; }", '.YSF-LAYER-ENTRY-CIRCLE { width: auto; min-width: 12px; height: 20px; padding: 0 4px; border-radius: 10px; color: #FFFFFF; background-color: #f00; font-size: 12px; line-height: 20px; white-space: nowrap; z-index:1; background: url("https://ysf.nosdn.127.net/operation/997228b687d805f7a5d6244865615ec9") no-repeat; background-size: cover; position: absolute; top: 6px; right: -8px; }', ".YSF-INVITE-IMG {background-color: " + t + ";box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);float: right;}", ".YSF_INVITE-IMG-0{max-width: 300px; height:auto;}", ".YSF_INVITE-IMG-1{width:28px; height:auto; border-radius: 14px;}", ".YSF_INVITE-IMG-2{width:58px; height:auto; border-radius: 8px;}", ".YSF_INVITE-IMG-3{width:60px; height:auto; border-radius: 50%;}", ".YSF_INVITE-IMG-4{width:60px; height:auto; border-radius: 50%;}", ".YSF_INVITE-IMG-5{width:60px; height:auto; border-radius: 8px;}", ".YSF_INVITE-IMG-6{width:58px; height:auto; border-radius: 8px;}", ".YSF_INVITE-IMG-7{width:60px; height:auto; border-radius: 50%;}", ".YSF_INVITE-IMG-8{width:60px; height:auto; border-radius: 8px;}", "#YSF-BTN-HOLDER .portrait_icon{width: 24px;height: 24px;vertical-align: middle;display: inline-block;}" ].join(" "));
- }
- function initSdk() {
- var e = [ "hidden", "sdkTemplateId", "shuntId", "sessionInvite", "subdomain", "debugger", "uid", "corpName", "corpInfoUrl", "corpCode", "templateId" ];
- for (var t = 0; t < e.length; t++) {
- urlSetting[e[t]] = getCurrentScriptParams(e[t]);
- }
- if (document.currentScript.src) {
- var i = document.currentScript.src;
- if (util.includes(i, ".js&hidden")) {
- urlSetting.hidden = "1";
- }
- }
- querySetting((function() {
- ininYsfSdk();
- }));
- }
- window.appKey = appKey = getAppKey();
- ysfSdk();
- initSdk();
- function ysfSdk() {
- if (!window.localStorage || !window.postMessage) {
- return "not support service";
- }
- window.__YSF_EMOJI__ = {
- pmap: {
- emoticon_emoji_01: {
- tag: "[可爱]",
- file: "emoji_01.png"
- },
- emoticon_emoji_00: {
- tag: "[大笑]",
- file: "emoji_00.png"
- },
- emoticon_emoji_02: {
- tag: "[色]",
- file: "emoji_02.png"
- },
- emoticon_emoji_03: {
- tag: "[嘘]",
- file: "emoji_03.png"
- },
- emoticon_emoji_04: {
- tag: "[亲]",
- file: "emoji_04.png"
- },
- emoticon_emoji_05: {
- tag: "[呆]",
- file: "emoji_05.png"
- },
- emoticon_emoji_06: {
- tag: "[口水]",
- file: "emoji_06.png"
- },
- emoticon_emoji_145: {
- tag: "[汗]",
- file: "emoji_145.png"
- },
- emoticon_emoji_07: {
- tag: "[呲牙]",
- file: "emoji_07.png"
- },
- emoticon_emoji_08: {
- tag: "[鬼脸]",
- file: "emoji_08.png"
- },
- emoticon_emoji_09: {
- tag: "[害羞]",
- file: "emoji_09.png"
- },
- emoticon_emoji_10: {
- tag: "[偷笑]",
- file: "emoji_10.png"
- },
- emoticon_emoji_11: {
- tag: "[调皮]",
- file: "emoji_11.png"
- },
- emoticon_emoji_12: {
- tag: "[可怜]",
- file: "emoji_12.png"
- },
- emoticon_emoji_13: {
- tag: "[敲]",
- file: "emoji_13.png"
- },
- emoticon_emoji_14: {
- tag: "[惊讶]",
- file: "emoji_14.png"
- },
- emoticon_emoji_15: {
- tag: "[流感]",
- file: "emoji_15.png"
- },
- emoticon_emoji_16: {
- tag: "[委屈]",
- file: "emoji_16.png"
- },
- emoticon_emoji_17: {
- tag: "[流泪]",
- file: "emoji_17.png"
- },
- emoticon_emoji_18: {
- tag: "[嚎哭]",
- file: "emoji_18.png"
- },
- emoticon_emoji_19: {
- tag: "[惊恐]",
- file: "emoji_19.png"
- },
- emoticon_emoji_20: {
- tag: "[怒]",
- file: "emoji_20.png"
- },
- emoticon_emoji_21: {
- tag: "[酷]",
- file: "emoji_21.png"
- },
- emoticon_emoji_22: {
- tag: "[不说]",
- file: "emoji_22.png"
- },
- emoticon_emoji_23: {
- tag: "[鄙视]",
- file: "emoji_23.png"
- },
- emoticon_emoji_24: {
- tag: "[阿弥陀佛]",
- file: "emoji_24.png"
- },
- emoticon_emoji_25: {
- tag: "[奸笑]",
- file: "emoji_25.png"
- },
- emoticon_emoji_26: {
- tag: "[睡着]",
- file: "emoji_26.png"
- },
- emoticon_emoji_27: {
- tag: "[口罩]",
- file: "emoji_27.png"
- },
- emoticon_emoji_28: {
- tag: "[生气]",
- file: "emoji_28.png"
- },
- emoticon_emoji_29: {
- tag: "[抠鼻孔]",
- file: "emoji_29.png"
- },
- emoticon_emoji_30: {
- tag: "[疑问]",
- file: "emoji_30.png"
- },
- emoticon_emoji_31: {
- tag: "[怒骂]",
- file: "emoji_31.png"
- },
- emoticon_emoji_32: {
- tag: "[晕]",
- file: "emoji_32.png"
- },
- emoticon_emoji_33: {
- tag: "[呕吐]",
- file: "emoji_33.png"
- },
- emoticon_emoji_160: {
- tag: "[拜一拜]",
- file: "emoji_160.png"
- },
- emoticon_emoji_161: {
- tag: "[惊喜]",
- file: "emoji_161.png"
- },
- emoticon_emoji_162: {
- tag: "[流汗]",
- file: "emoji_162.png"
- },
- emoticon_emoji_163: {
- tag: "[卖萌]",
- file: "emoji_163.png"
- },
- emoticon_emoji_164: {
- tag: "[默契眨眼]",
- file: "emoji_164.png"
- },
- emoticon_emoji_165: {
- tag: "[烧香拜佛]",
- file: "emoji_165.png"
- },
- emoticon_emoji_166: {
- tag: "[晚安]",
- file: "emoji_166.png"
- },
- emoticon_emoji_34: {
- tag: "[强]",
- file: "emoji_34.png"
- },
- emoticon_emoji_35: {
- tag: "[弱]",
- file: "emoji_35.png"
- },
- emoticon_emoji_36: {
- tag: "[OK]",
- file: "emoji_36.png"
- },
- emoticon_emoji_37: {
- tag: "[拳头]",
- file: "emoji_37.png"
- },
- emoticon_emoji_38: {
- tag: "[胜利]",
- file: "emoji_38.png"
- },
- emoticon_emoji_39: {
- tag: "[鼓掌]",
- file: "emoji_39.png"
- },
- emoticon_emoji_200: {
- tag: "[握手]",
- file: "emoji_200.png"
- },
- emoticon_emoji_40: {
- tag: "[发怒]",
- file: "emoji_40.png"
- },
- emoticon_emoji_41: {
- tag: "[骷髅]",
- file: "emoji_41.png"
- },
- emoticon_emoji_42: {
- tag: "[便便]",
- file: "emoji_42.png"
- },
- emoticon_emoji_43: {
- tag: "[火]",
- file: "emoji_43.png"
- },
- emoticon_emoji_44: {
- tag: "[溜]",
- file: "emoji_44.png"
- },
- emoticon_emoji_45: {
- tag: "[爱心]",
- file: "emoji_45.png"
- },
- emoticon_emoji_46: {
- tag: "[心碎]",
- file: "emoji_46.png"
- },
- emoticon_emoji_47: {
- tag: "[钟情]",
- file: "emoji_47.png"
- },
- emoticon_emoji_48: {
- tag: "[唇]",
- file: "emoji_48.png"
- },
- emoticon_emoji_49: {
- tag: "[戒指]",
- file: "emoji_49.png"
- },
- emoticon_emoji_50: {
- tag: "[钻石]",
- file: "emoji_50.png"
- },
- emoticon_emoji_51: {
- tag: "[太阳]",
- file: "emoji_51.png"
- },
- emoticon_emoji_52: {
- tag: "[有时晴]",
- file: "emoji_52.png"
- },
- emoticon_emoji_53: {
- tag: "[多云]",
- file: "emoji_53.png"
- },
- emoticon_emoji_54: {
- tag: "[雷]",
- file: "emoji_54.png"
- },
- emoticon_emoji_55: {
- tag: "[雨]",
- file: "emoji_55.png"
- },
- emoticon_emoji_56: {
- tag: "[雪花]",
- file: "emoji_56.png"
- },
- emoticon_emoji_57: {
- tag: "[爱人]",
- file: "emoji_57.png"
- },
- emoticon_emoji_58: {
- tag: "[帽子]",
- file: "emoji_58.png"
- },
- emoticon_emoji_59: {
- tag: "[皇冠]",
- file: "emoji_59.png"
- },
- emoticon_emoji_60: {
- tag: "[篮球]",
- file: "emoji_60.png"
- },
- emoticon_emoji_61: {
- tag: "[足球]",
- file: "emoji_61.png"
- },
- emoticon_emoji_62: {
- tag: "[垒球]",
- file: "emoji_62.png"
- },
- emoticon_emoji_63: {
- tag: "[网球]",
- file: "emoji_63.png"
- },
- emoticon_emoji_64: {
- tag: "[台球]",
- file: "emoji_64.png"
- },
- emoticon_emoji_65: {
- tag: "[咖啡]",
- file: "emoji_65.png"
- },
- emoticon_emoji_66: {
- tag: "[啤酒]",
- file: "emoji_66.png"
- },
- emoticon_emoji_67: {
- tag: "[干杯]",
- file: "emoji_67.png"
- },
- emoticon_emoji_68: {
- tag: "[柠檬汁]",
- file: "emoji_68.png"
- },
- emoticon_emoji_69: {
- tag: "[餐具]",
- file: "emoji_69.png"
- },
- emoticon_emoji_70: {
- tag: "[汉堡]",
- file: "emoji_70.png"
- },
- emoticon_emoji_71: {
- tag: "[鸡腿]",
- file: "emoji_71.png"
- },
- emoticon_emoji_72: {
- tag: "[面条]",
- file: "emoji_72.png"
- },
- emoticon_emoji_73: {
- tag: "[冰淇淋]",
- file: "emoji_73.png"
- },
- emoticon_emoji_74: {
- tag: "[沙冰]",
- file: "emoji_74.png"
- },
- emoticon_emoji_75: {
- tag: "[生日蛋糕]",
- file: "emoji_75.png"
- },
- emoticon_emoji_76: {
- tag: "[蛋糕]",
- file: "emoji_76.png"
- },
- emoticon_emoji_77: {
- tag: "[糖果]",
- file: "emoji_77.png"
- },
- emoticon_emoji_78: {
- tag: "[葡萄]",
- file: "emoji_78.png"
- },
- emoticon_emoji_79: {
- tag: "[西瓜]",
- file: "emoji_79.png"
- },
- emoticon_emoji_80: {
- tag: "[光碟]",
- file: "emoji_80.png"
- },
- emoticon_emoji_81: {
- tag: "[手机]",
- file: "emoji_81.png"
- },
- emoticon_emoji_82: {
- tag: "[电话]",
- file: "emoji_82.png"
- },
- emoticon_emoji_83: {
- tag: "[电视]",
- file: "emoji_83.png"
- },
- emoticon_emoji_84: {
- tag: "[声音开启]",
- file: "emoji_84.png"
- },
- emoticon_emoji_85: {
- tag: "[声音关闭]",
- file: "emoji_85.png"
- },
- emoticon_emoji_86: {
- tag: "[铃铛]",
- file: "emoji_86.png"
- },
- emoticon_emoji_87: {
- tag: "[锁头]",
- file: "emoji_87.png"
- },
- emoticon_emoji_88: {
- tag: "[放大镜]",
- file: "emoji_88.png"
- },
- emoticon_emoji_89: {
- tag: "[灯泡]",
- file: "emoji_89.png"
- },
- emoticon_emoji_90: {
- tag: "[锤头]",
- file: "emoji_90.png"
- },
- emoticon_emoji_91: {
- tag: "[烟]",
- file: "emoji_91.png"
- },
- emoticon_emoji_92: {
- tag: "[炸弹]",
- file: "emoji_92.png"
- },
- emoticon_emoji_93: {
- tag: "[枪]",
- file: "emoji_93.png"
- },
- emoticon_emoji_94: {
- tag: "[刀]",
- file: "emoji_94.png"
- },
- emoticon_emoji_95: {
- tag: "[药]",
- file: "emoji_95.png"
- },
- emoticon_emoji_96: {
- tag: "[打针]",
- file: "emoji_96.png"
- },
- emoticon_emoji_97: {
- tag: "[钱袋]",
- file: "emoji_97.png"
- },
- emoticon_emoji_98: {
- tag: "[钞票]",
- file: "emoji_98.png"
- },
- emoticon_emoji_99: {
- tag: "[银行卡]",
- file: "emoji_99.png"
- },
- emoticon_emoji_100: {
- tag: "[手柄]",
- file: "emoji_100.png"
- },
- emoticon_emoji_101: {
- tag: "[麻将]",
- file: "emoji_101.png"
- },
- emoticon_emoji_102: {
- tag: "[调色板]",
- file: "emoji_102.png"
- },
- emoticon_emoji_103: {
- tag: "[电影]",
- file: "emoji_103.png"
- },
- emoticon_emoji_104: {
- tag: "[麦克风]",
- file: "emoji_104.png"
- },
- emoticon_emoji_105: {
- tag: "[耳机]",
- file: "emoji_105.png"
- },
- emoticon_emoji_106: {
- tag: "[音乐]",
- file: "emoji_106.png"
- },
- emoticon_emoji_107: {
- tag: "[吉他]",
- file: "emoji_107.png"
- },
- emoticon_emoji_108: {
- tag: "[火箭]",
- file: "emoji_108.png"
- },
- emoticon_emoji_109: {
- tag: "[飞机]",
- file: "emoji_109.png"
- },
- emoticon_emoji_110: {
- tag: "[火车]",
- file: "emoji_110.png"
- },
- emoticon_emoji_111: {
- tag: "[公交]",
- file: "emoji_111.png"
- },
- emoticon_emoji_112: {
- tag: "[轿车]",
- file: "emoji_112.png"
- },
- emoticon_emoji_113: {
- tag: "[出租车]",
- file: "emoji_113.png"
- },
- emoticon_emoji_114: {
- tag: "[警车]",
- file: "emoji_114.png"
- },
- emoticon_emoji_115: {
- tag: "[自行车]",
- file: "emoji_115.png"
- },
- emoticon_emoji_116: {
- tag: "[撇嘴]",
- file: "new_emoji_01.png"
- },
- emoticon_emoji_117: {
- tag: "[难过]",
- file: "1f641.png"
- },
- emoticon_emoji_118: {
- tag: "[冷汗]",
- file: "1f628.png"
- },
- emoticon_emoji_119: {
- tag: "[抓狂]",
- file: "1f629.png"
- },
- emoticon_emoji_120: {
- tag: "[傲慢]",
- file: "1f615.png"
- },
- emoticon_emoji_121: {
- tag: "[困]",
- file: "1f62a.png"
- },
- emoticon_emoji_122: {
- tag: "[疯了]",
- file: "1f616.png"
- },
- emoticon_emoji_123: {
- tag: "[奋斗]",
- file: "1f4aa-1f3fc.png"
- },
- emoticon_emoji_124: {
- tag: "[白眼]",
- file: "new_emoji_02.png"
- },
- emoticon_emoji_125: {
- tag: "[衰]",
- file: "new_emoji_05.png"
- },
- emoticon_emoji_126: {
- tag: "[再见]",
- file: "new_emoji_06.png"
- },
- emoticon_emoji_127: {
- tag: "[哼哼]",
- file: "1f63e.png"
- },
- emoticon_emoji_128: {
- tag: "[阴险]",
- file: "1f608.png"
- },
- emoticon_emoji_129: {
- tag: "[饥饿]",
- file: "new_emoji_03.png"
- },
- emoticon_emoji_130: {
- tag: "[乒乓]",
- file: "new_emoji_23.png"
- },
- emoticon_emoji_131: {
- tag: "[猪头]",
- file: "1f437.png"
- },
- emoticon_emoji_132: {
- tag: "[玫瑰]",
- file: "new_emoji_25.png"
- },
- emoticon_emoji_133: {
- tag: "[凋谢]",
- file: "new_emoji_24.png"
- },
- emoticon_emoji_134: {
- tag: "[瓢虫]",
- file: "1f41e.png"
- },
- emoticon_emoji_135: {
- tag: "[月亮]",
- file: "new_emoji_30.png"
- },
- emoticon_emoji_136: {
- tag: "[礼物]",
- file: "new_emoji_28.png"
- },
- emoticon_emoji_137: {
- tag: "[拥抱]",
- file: "new_emoji_08.png"
- },
- emoticon_emoji_138: {
- tag: "[抱拳]",
- file: "new_emoji_18.png"
- },
- emoticon_emoji_139: {
- tag: "[勾引]",
- file: "new_emoji_19.png"
- },
- emoticon_emoji_140: {
- tag: "[差劲]",
- file: "new_emoji_20.png"
- },
- emoticon_emoji_141: {
- tag: "[爱你]",
- file: "new_emoji_21.png"
- },
- emoticon_emoji_142: {
- tag: "[NO]",
- file: "new_emoji_22.png"
- },
- emoticon_emoji_143: {
- tag: "[飞吻]",
- file: "new_emoji_10.png"
- },
- emoticon_emoji_144: {
- tag: "[微笑]",
- file: "1f642.png"
- },
- emoticon_emoji_146: {
- tag: "[吐舌头]",
- file: "1f61d.png"
- },
- emoticon_emoji_147: {
- tag: "[忧郁]",
- file: "new_emoji_11.png"
- },
- emoticon_emoji_148: {
- tag: "[尴尬]",
- file: "1f630.png"
- },
- emoticon_emoji_149: {
- tag: "[舒适]",
- file: "1f60c.png"
- },
- emoticon_emoji_150: {
- tag: "[不悦]",
- file: "1f612.png"
- },
- emoticon_emoji_151: {
- tag: "[幽灵]",
- file: "1f47b.png"
- },
- emoticon_emoji_152: {
- tag: "[礼盒]",
- file: "1f49d.png"
- },
- emoticon_emoji_153: {
- tag: "[拜托]",
- file: "1f64f-1f3fc.png"
- },
- emoticon_emoji_154: {
- tag: "[气球]",
- file: "1f388.png"
- },
- emoticon_emoji_155: {
- tag: "[拍掌]",
- file: "new_emoji_09.png"
- },
- emoticon_emoji_156: {
- tag: "[泪中带笑]",
- file: "1f602.png"
- },
- emoticon_emoji_157: {
- tag: "[糗大了]",
- file: "new_emoji_07.png"
- }
- }
- };
- var e = {
- seq: 1,
- task: {},
- getSeq: function() {
- return e.seq++;
- },
- addTask: function(t, i, n) {
- n = n || 5e3;
- var o = e.getSeq();
- e.task[o] = {
- resolve: t,
- reject: i
- };
- setTimeout((function() {
- if (e.task[o]) {
- e.task[o].reject({
- code: -1,
- msg: "请求超时"
- });
- delete e.task[o];
- }
- }), n);
- return o;
- },
- fireSeqCallback: function(t) {
- var i = t.seq;
- if (e.task[i]) {
- if (t.code === 200) {
- e.task[i].resolve(t);
- } else {
- e.task[i].reject(t);
- }
- delete e.task[i];
- }
- }
- };
- var t = true;
- var i = {};
- var n = {
- appKey: appKey || window.appKey || ""
- };
- var o = [];
- var r;
- var a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
- var s = true;
- var c = false;
- var l;
- var u = 5e3;
- var f = 0;
- var d = [];
- var m;
- var p = 5e3;
- var g = false;
- var y = [];
- var _ = [];
- var v = false;
- var h = false;
- var S = false;
- var I = false;
- var w;
- var E = 0;
- if (window.ysf && window.ysf.a) {
- _ = window.ysf.a;
- }
- if (window.ysf) {
- var T = window.ysf.RESROOT;
- }
- window.ysf = function() {
- try {
- var e = arguments[0], t = Array.prototype.slice.call(arguments, 1);
- return Ye(e, t);
- } catch (e) {}
- };
- ysf.ROOT = window.__YSFSDKADR__ || "";
- ysf.RESROOT = T;
- var b = function(e) {
- if (!!e) {
- return "ysf-" + e;
- }
- var t = [];
- for (var i = 0, n; i < 20; ++i) {
- n = Math.floor(Math.random() * a.length);
- t.push(a.charAt(n));
- }
- return t.join("").toLowerCase();
- };
- var N = function(e) {
- e = e || 10;
- var t = [];
- for (var i = 0, n; i < e; ++i) {
- n = Math.floor(Math.random() * a.length);
- t.push(a.charAt(n));
- }
- return (new Date).getTime() + t.join("");
- };
- var x = function() {
- var e;
- if (/YSF_UID\s*=\s*(.*?)(?=;|$)/i.test(document.cookie)) {
- e = RegExp.$1;
- }
- if (!!e) {
- localStorage.setItem("YSF_UID", e);
- }
- var e;
- if (/YSF_LAST\s*=\s*(.*?)(?=;|$)/i.test(document.cookie)) {
- e = RegExp.$1;
- }
- if (!!e) {
- localStorage.setItem("YSF_LAST", e);
- }
- var t = new Date(1990, 11, 30).toGMTString();
- document.cookie = "YSF_UID=;path=/;expires=" + t;
- document.cookie = "YSF_LAST=;path=/;expires=" + t;
- };
- var R = {
- ack: function(e) {
- n.timestamp = parseInt(e, 10);
- if (!!n.onackdone) {
- n.onackdone();
- delete n.onackdone;
- }
- },
- rdy: function(e) {
- setTimeout((function() {
- le({
- local: 1
- });
- }), 100);
- }
- };
- var A = function() {
- var e = document.createElement("div"), t = e.style, i = {
- top: 0,
- left: 0,
- visibility: "hidden",
- position: "absolute",
- width: "1px",
- height: "1px"
- };
- each(i, (function(e, i) {
- t[e] = i;
- }));
- document.body.appendChild(e);
- return e;
- };
- var j = function(e) {
- each(e, (function(e, t) {
- if (e === "alipayImagePermissionText") {
- n[e] = String(t || "").replace(/<(script|style|iframe|svg|object|embed)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<[^>]*>/g, "").replace(/[^\u4e00-\u9fff\u3000-\u303fa-zA-Z0-9,。!?、:;()"'’‘\s]/g, "").replace(/\s+/g, " ").trim().slice(0, 200);
- } else {
- n[e] = t;
- }
- }));
- };
- var O = function(e) {
- e = e || "";
- var t = F(), i = C(), o = P();
- if (!t || e == "" && i != "") {
- t = e || t || b(e);
- ge("synckey:" + t);
- }
- n.device = t;
- n.uuid = o || b();
- localStorage.setItem("YSF-" + n["appKey"].toUpperCase() + "-UID", e || t);
- localStorage.setItem("YSF-" + n["appKey"].toUpperCase() + "-LAST", e || "");
- localStorage.setItem("YSF-" + n["appKey"].toUpperCase() + "-UUID", n.uuid);
- };
- var F = function() {
- return localStorage.getItem("YSF-" + n["appKey"].toUpperCase() + "-UID") || "";
- };
- var P = function() {
- return localStorage.getItem("YSF-" + n["appKey"].toUpperCase() + "-UUID");
- };
- var C = function() {
- return localStorage.getItem("YSF-" + n["appKey"].toUpperCase() + "-LAST") || "";
- };
- var L = function() {
- n.device = b();
- localStorage.setItem("YSF-" + n["appKey"].toUpperCase() + "-UID", n.device);
- ge("synckey:" + n.device);
- };
- var Y = function(e, t) {
- chatProxy.contentWindow.postMessage("" + e + ":" + JSON.stringify(t), "*");
- };
- var M = function(t) {
- return new PromisePolyfill((function(i, n) {
- var o = e.addTask(i, n);
- t.seq = o;
- if (chatProxy) {
- chatProxy.contentWindow.postMessage(t, "*");
- }
- if (window.windowurl) {
- window.windowurl.postMessage(t, "*");
- }
- }));
- };
- var k = function(e) {
- var t = new Error(e);
- t.code = e;
- return t;
- };
- var U = function(e) {
- if (!e || typeof e !== "object" || !e.pkg || typeof e.pkg !== "object") {
- return null;
- }
- var t = e.pkg;
- if (t.category !== IMAGE_PREVIEW_CATEGORY || t.protocolVersion !== IMAGE_PREVIEW_PROTOCOL_VERSION || typeof t.type !== "string" || typeof t.requestId !== "string" || !t.requestId) {
- return null;
- }
- return t;
- };
- var D = function(e) {
- var t = !!chatProxy && !!chatProxy.contentWindow && e.source === chatProxy.contentWindow && !!ysf.ROOT && e.origin === ysf.ROOT;
- if (!t) {
- util.consoleWarn("ignore untrusted ysf-image-preview message");
- }
- return t;
- };
- var B = function(e, t, i) {
- if (!e || !e.sourceWindow || !e.targetOrigin) {
- return false;
- }
- try {
- e.sourceWindow.postMessage({
- pkg: {
- category: IMAGE_PREVIEW_CATEGORY,
- type: t,
- protocolVersion: IMAGE_PREVIEW_PROTOCOL_VERSION,
- requestId: e.requestId,
- payload: i || {}
- }
- }, e.targetOrigin);
- return true;
- } catch (e) {
- util.consoleError("ysf-image-preview postMessage failed");
- return false;
- }
- };
- var V = function(e) {
- if (typeof e !== "string" || e.charAt(0) !== "/" || e.charAt(1) === "/" || e.indexOf("\\") > -1 || e.indexOf("..") > -1 || e.indexOf("?") > -1 || e.indexOf("#") > -1 || e.indexOf("://") > -1) {
- throw k("ASSET_URL_INVALID");
- }
- var t;
- var i = e.indexOf(IMAGE_PREVIEW_STORAGE_PATH_PREFIX) === 0;
- var n = i ? IMAGE_PREVIEW_STORAGE_CDN_BASE : IMAGE_PREVIEW_CDN_BASE;
- try {
- if (typeof window.URL === "function") {
- t = new window.URL(e, n);
- } else {
- t = document.createElement("a");
- t.href = n + e;
- }
- } catch (e) {
- throw k("ASSET_URL_INVALID");
- }
- var o = String(t.protocol || "").toLowerCase();
- var r = String(t.hostname || "").toLowerCase();
- var a = String(t.pathname || "");
- if (a.charAt(0) !== "/") {
- a = "/" + a;
- }
- var s = IMAGE_PREVIEW_CDN_HOSTS[r] && a.indexOf(IMAGE_PREVIEW_PATH_PREFIX) === 0;
- var c = r === "res.qiyukf.net" && /^\/storage\/[A-Za-z0-9][A-Za-z0-9._-]*\.js$/.test(a);
- if (o !== "https:" || !s && !c) {
- throw k("ASSET_URL_INVALID");
- }
- return t.href;
- };
- var H = function(e, t) {
- return new PromisePolyfill((function(i, n) {
- var o = document.getElementsByTagName("head")[0] || document.documentElement;
- if (!o) {
- n(k("SCRIPT_ERROR"));
- return;
- }
- var r = document.createElement("script");
- var a = false;
- var s;
- var c = function() {};
- var l = function() {
- if (s) {
- clearTimeout(s);
- s = null;
- }
- r.onload = null;
- r.onerror = null;
- r.onreadystatechange = null;
- c();
- };
- var u = function(e) {
- if (a) {
- return;
- }
- a = true;
- l();
- if (r.parentNode) {
- r.parentNode.removeChild(r);
- }
- n(k(e));
- };
- var f = function() {
- if (a) {
- return;
- }
- var e = window.YSFImagePreview;
- if (!e || String(e.version) !== String(t) || typeof e.open !== "function") {
- u("SCRIPT_ERROR");
- return;
- }
- a = true;
- l();
- i(e);
- };
- if (document.addEventListener) {
- var d = function(t) {
- if (t && t.blockedURI === e) {
- u("CSP_BLOCKED");
- }
- };
- document.addEventListener("securitypolicyviolation", d, false);
- c = function() {
- document.removeEventListener("securitypolicyviolation", d, false);
- };
- }
- r.type = "text/javascript";
- r.async = false;
- if (sdkCspNonce) {
- r.setAttribute("nonce", sdkCspNonce);
- r.nonce = sdkCspNonce;
- }
- r.onload = f;
- r.onerror = function() {
- u("SCRIPT_ERROR");
- };
- r.onreadystatechange = function() {
- if (r.readyState === "loaded" || r.readyState === "complete") {
- f();
- }
- };
- r.src = e;
- s = setTimeout((function() {
- u("SCRIPT_TIMEOUT");
- }), IMAGE_PREVIEW_TIMEOUT);
- o.appendChild(r);
- }));
- };
- var q = function(e, t) {
- var i = window.YSFImagePreview;
- if (i && String(i.version) === String(t) && typeof i.open === "function") {
- return new PromisePolyfill((function(e) {
- e(i);
- }));
- }
- var n = e + "@" + t;
- if (previewLoadPromise && previewLoadKey === n) {
- return previewLoadPromise;
- }
- var o = H(e, t);
- previewLoadPromise = o;
- previewLoadKey = n;
- o.then((function() {
- if (previewLoadPromise === o) {
- previewLoadPromise = null;
- previewLoadKey = "";
- }
- }), (function() {
- if (previewLoadPromise === o) {
- previewLoadPromise = null;
- previewLoadKey = "";
- }
- }));
- return o;
- };
- var G = function(e) {
- return activePreviewRequest === e && !e.cancelled && !e.superseded && e.state !== "closed";
- };
- var K = function(e) {
- if (e && e.timer) {
- clearTimeout(e.timer);
- e.timer = null;
- }
- };
- var W = function(e) {
- return "$" + String(e);
- };
- var z = function(e, t) {
- var i;
- var n;
- for (i in e.urlResolvers) {
- if (e.urlResolvers.hasOwnProperty(i)) {
- n = e.urlResolvers[i];
- if (n.timer) {
- clearTimeout(n.timer);
- }
- delete e.urlResolvers[i];
- n.reject(k(t || "SUPERSEDED"));
- }
- }
- };
- var J = function(e, t, i) {
- if (!e) {
- return;
- }
- var n = e.state === "open";
- e.cancelled = t === "cancel";
- e.superseded = t === "superseded";
- e.state = "closed";
- K(e);
- z(e, e.superseded ? "SUPERSEDED" : "OPEN_FAILED");
- if (e.instance && typeof e.instance.destroy === "function") {
- try {
- e.instance.destroy();
- } catch (e) {}
- }
- e.instance = null;
- if (activePreviewRequest === e) {
- activePreviewRequest = null;
- }
- if (i && n) {
- B(e, "previewClosed", {
- reason: t === "cancel" ? "cancel" : "error"
- });
- }
- };
- var X = function(e, t) {
- if (!G(e)) {
- return;
- }
- K(e);
- z(e, t);
- if (e.instance && typeof e.instance.destroy === "function") {
- try {
- e.instance.destroy();
- } catch (e) {}
- }
- e.instance = null;
- e.state = "closed";
- activePreviewRequest = null;
- B(e, "openResult", {
- success: false,
- errorCode: t || "OPEN_FAILED"
- });
- };
- var $ = function(e, t) {
- return new PromisePolyfill((function(i, n) {
- if (!G(e) || t === undefined || t === null) {
- n(k("SUPERSEDED"));
- return;
- }
- var o = W(t);
- var r = e.urlResolvers[o];
- if (r) {
- if (r.timer) {
- clearTimeout(r.timer);
- }
- r.reject(k("SUPERSEDED"));
- }
- var a = {
- resolve: i,
- reject: n,
- timer: null
- };
- e.urlResolvers[o] = a;
- a.timer = setTimeout((function() {
- if (e.urlResolvers[o] !== a) {
- return;
- }
- delete e.urlResolvers[o];
- a.reject(k("URL_REFRESH_FAILED"));
- }), IMAGE_PREVIEW_TIMEOUT);
- if (!B(e, "resolveImageUrl", {
- imageId: t
- })) {
- clearTimeout(a.timer);
- delete e.urlResolvers[o];
- a.reject(k("URL_REFRESH_FAILED"));
- }
- }));
- };
- var Z = function(e, t) {
- if (!G(e)) {
- return;
- }
- e.cancelled = true;
- e.state = "closed";
- activePreviewRequest = null;
- K(e);
- z(e, "SUPERSEDED");
- e.instance = null;
- B(e, "previewClosed", {
- reason: t === "cancel" || t === "timeout" || t === "error" ? t : "user"
- });
- };
- var Q = function(e, t) {
- if (activePreviewRequest) {
- J(activePreviewRequest, "superseded", false);
- }
- var i = {
- requestId: e.requestId,
- sourceWindow: t.source,
- targetOrigin: ysf.ROOT,
- state: "opening",
- cancelled: false,
- superseded: false,
- instance: null,
- timer: null,
- urlResolvers: {}
- };
- activePreviewRequest = i;
- if (remoteSetting.imagePreviewEnabled !== true && remoteSetting.imagePreviewEnabled !== 1 || util.isFrameModule() !== "webFrame") {
- X(i, "SWITCH_OFF");
- return;
- }
- var n;
- try {
- n = V(IMAGE_PREVIEW_ASSET_PATH);
- } catch (e) {
- X(i, "ASSET_URL_INVALID");
- return;
- }
- var o = IMAGE_PREVIEW_VERSION;
- i.timer = setTimeout((function() {
- if (G(i)) {
- X(i, "SCRIPT_TIMEOUT");
- }
- }), IMAGE_PREVIEW_TIMEOUT);
- q(n, o).then((function(t) {
- if (!G(i)) {
- return;
- }
- var n = e.payload || {};
- var o = {
- images: n.images,
- index: n.index,
- nonce: sdkCspNonce,
- onClose: function(e) {
- Z(i, e);
- },
- resolveImageUrl: function(e) {
- return $(i, e);
- }
- };
- var r;
- try {
- r = t.open(o);
- } catch (e) {
- X(i, "OPEN_FAILED");
- return;
- }
- if (!r || typeof r.then !== "function") {
- X(i, "OPEN_FAILED");
- return;
- }
- r.then((function(e) {
- if (!G(i)) {
- if (e && typeof e.destroy === "function") {
- try {
- e.destroy();
- } catch (e) {}
- }
- return;
- }
- K(i);
- i.instance = e;
- i.state = "open";
- B(i, "openResult", {
- success: true
- });
- }), (function(e) {
- if (!G(i)) {
- return;
- }
- var t = e && e.code;
- if (t !== "INVALID_PAYLOAD" && t !== "OPEN_FAILED") {
- t = "OPEN_FAILED";
- }
- X(i, t);
- }));
- }), (function(e) {
- if (!G(i)) {
- return;
- }
- X(i, e && e.code || "SCRIPT_ERROR");
- }));
- };
- var ee = function(e) {
- var t = activePreviewRequest;
- if (!t || t.requestId !== e.requestId) {
- return;
- }
- if (t.state === "opening") {
- t.cancelled = true;
- t.superseded = true;
- t.state = "closed";
- K(t);
- z(t, "SUPERSEDED");
- activePreviewRequest = null;
- return;
- }
- J(t, "cancel", true);
- };
- var te = function(e) {
- var t = activePreviewRequest;
- if (!t || t.requestId !== e.requestId) {
- return;
- }
- var i = e.payload || {};
- var n = W(i.imageId);
- var o = t.urlResolvers[n];
- if (!o) {
- return;
- }
- if (o.timer) {
- clearTimeout(o.timer);
- }
- delete t.urlResolvers[n];
- if (i.success && typeof i.url === "string" && i.url) {
- o.resolve(i.url);
- } else {
- o.reject(k(i.errorCode || "URL_REFRESH_FAILED"));
- }
- };
- var ie = function() {
- return {
- uid: n.uid || "",
- foreignId: n.uid || "",
- deviceId: F(),
- uuid: n.uuid || "",
- authToken: n.authToken || "",
- name: n.name || "",
- email: n.email || "",
- mobile: n.mobile || "",
- channelExtendInfo: n.channelExtendInfo || ""
- };
- };
- var ne = function() {
- return window.__YSFENABLENEWCLIENT__ == 1 && !(n.bid && t);
- };
- var oe = function() {
- if (!ne()) {
- return null;
- }
- return ie();
- };
- var re = function(e, t) {
- if (!ne() || !t) {
- return;
- }
- e.push({
- key: "secureInfo",
- value: JSON.stringify(t)
- });
- };
- var ae = "";
- var se = function(e, t, i) {
- if (!i || e && e.manualRequired) {
- return "";
- }
- return JSON.stringify({
- local: e && e.local || 0,
- user: t,
- secureInfo: {
- uid: i.uid || "",
- foreignId: i.foreignId || "",
- deviceId: i.deviceId || "",
- uuid: i.uuid || "",
- authToken: i.authToken || "",
- name: i.name || "",
- email: i.email || "",
- mobile: i.mobile || "",
- channelExtendInfo: i.channelExtendInfo || ""
- },
- alipayImagePermissionText: n.alipayImagePermissionText || ""
- });
- };
- var ce = function(e, t, i, n) {
- var o = se(t, i, n);
- if (o && o == ae) {
- if (util.isFunction(t.success)) {
- t.success();
- }
- return;
- }
- if (o) {
- ae = o;
- }
- be(e, t.success, (function(e) {
- if (o && o == ae) {
- ae = "";
- }
- if (util.isFunction(t.error)) {
- t.error(e);
- }
- }), t.local);
- };
- var le = function(e) {
- ge("KEY:" + n.appKey || 0);
- var t = {
- title: document.title || ""
- };
- var i = function(e, t) {
- var i = false;
- e.forEach((function(e) {
- if (e.key == t) {
- i = true;
- }
- }));
- return i;
- };
- each({
- uid: "",
- reallyUid: "",
- name: "",
- email: "",
- mobile: "",
- avatar: "",
- profile: "data",
- bid: "",
- level: "",
- authToken: ""
- }, (function(e, i) {
- var o = n[i] || n[e];
- if (o) {
- t[e] = o;
- }
- }));
- each({
- avatar: local.AVATAR || "头像"
- }, (function(e, n) {
- try {
- if (!t[e]) {
- return;
- }
- var o = JSON.parse(t["profile"] || "[]"), r = o.length;
- if (!i(o, e)) {
- o.push({
- key: e,
- value: t[e],
- index: r,
- label: n
- });
- t["profile"] = JSON.stringify(o);
- }
- } catch (t) {
- util.consoleError("parse profile error: [crm]" + e, t);
- }
- }));
- t.referrer = n.referrer || location.href;
- t.title = n.title || "";
- t.landPage = localStorage.getItem("DA-LANDPAGE") || "";
- t.landPageTitle = localStorage.getItem("DA-LANDPAGE-TITLE") || "";
- t.landPageReferrer = localStorage.getItem("DA-LANDPAGE-REFERRER") || "";
- t.sessionInfo = n.sessionInfo || "";
- t.deviceId = n.uid || n.device;
- t.channelExtendInfo = n.channelExtendInfo || "";
- var o = ysf.checkBaiduSelfBuild();
- if (o && n.baiduUcid) {
- t.baiduXstInfo = o;
- t.baiduUcid = n.baiduUcid;
- t.baiduSelfBuildSiteId = n.baiduSelfBuildSiteId;
- }
- var r = oe();
- ge("USR:" + serialize(t));
- if (r) {
- ge("SECUREINFO:" + JSON.stringify(r));
- }
- var a = navigator.userAgent;
- if (e && e.bid || n.bid) {
- Oe(e && e.bid || n.bid, ue.bind(this, e, t, r));
- } else {
- ue(e, t, r);
- }
- };
- var ue = function(e, t, i) {
- if (e.upToServer && (util.isIOSorSafari() || util.isFirefox() || !util.isFrameModule()) || window.__YSFISUPINFOTOSERVER__) {
- var o = [ {
- key: "userInfo",
- value: JSON.stringify(t)
- } ];
- re(o, i);
- o.push({
- key: "alipayImagePermissionText",
- value: n.alipayImagePermissionText || ""
- });
- if (e.local === 1) {
- setTimeout((function() {
- if (n.uid) {
- return;
- }
- ce(o, e, t, i);
- }), 200);
- } else {
- ce(o, e, t, i);
- }
- } else {
- var o = [ {
- key: "userInfo",
- value: JSON.stringify(t)
- } ];
- re(o, i);
- o.push({
- key: "alipayImagePermissionText",
- value: n.alipayImagePermissionText || ""
- });
- if (e && e.manualRequired) {
- ce(o, e, t, i);
- }
- if (util.isFunction(e.success)) {
- e.success();
- }
- }
- };
- var fe = function(e) {
- ge("PRODUCT:" + serialize(e.data, true));
- if (util.isIOSorSafari() || window.__YSFISUPINFOTOSERVER__ || util.isFirefox() || !util.isFrameModule()) {
- be([ {
- key: "orderInfo",
- value: JSON.stringify(e.data)
- } ], e.success, e.error);
- } else {
- if (util.isFunction(e.success)) {
- e.success();
- }
- }
- };
- var de = function(e) {
- ge(JSON.stringify({
- data: e.data,
- appkey: n.appKey,
- type: "cardMessage"
- }));
- if (util.isIOSorSafari() || window.__YSFISUPINFOTOSERVER__ || util.isFirefox() || !util.isFrameModule()) {
- be([ {
- key: "cardInfo",
- value: JSON.stringify(e.data)
- } ], e.success, e.error);
- } else {
- if (util.isFunction(e.success)) {
- e.success();
- }
- }
- };
- var me = function(e) {
- ge(JSON.stringify({
- data: e.data,
- appkey: n.appKey,
- type: "customMessage"
- }));
- if (util.isIOSorSafari() || window.__YSFISUPINFOTOSERVER__ || util.isFirefox() || !util.isFrameModule()) {
- be([ {
- key: "customMessage",
- value: JSON.stringify(e.data)
- } ], e.success, e.error);
- } else {
- if (util.isFunction(e.success)) {
- e.success();
- }
- }
- };
- var pe = function() {
- if (!window.__YSFDASWITCH__) {
- return;
- }
- var e = {
- ak: n.appKey,
- dv: F(),
- si: "",
- su: encodeURIComponent(document.referrer),
- cup: encodeURIComponent(location.href),
- cy: "",
- lp: localStorage.getItem("DA-LANDPAGE") || "",
- tm: (new Date).getTime()
- };
- ge("WEBANALYTICS:" + serialize(e));
- if (util.isIOSorSafari() || window.__YSFISUPINFOTOSERVER__ || util.isFirefox() || !util.isFrameModule()) {
- be([ {
- key: "analyticInfo",
- value: JSON.stringify(e)
- } ]);
- }
- };
- var ge = function(e) {
- try {
- proxy.contentWindow.postMessage(e, "*");
- } catch (e) {
- util.consoleError("proxy.contentWindow.postMessage---error");
- }
- };
- var ye = function() {
- var e = null;
- return function(e, t) {
- setTimeout((function() {
- var i = ("YSFMSG-" + n["appKey"] + "-" + e.id).toUpperCase();
- if (window.localStorage.getItem(i) == null) {
- window.localStorage.setItem(i, 1);
- t(true);
- }
- t(false);
- }), n["dvcTimer"] * 100);
- };
- }();
- var _e = function(t) {
- var i = t && t.data && t.data.pkg;
- if (i && i.category === IMAGE_PREVIEW_CATEGORY) {
- var n = U(t.data);
- if (!n || !D(t)) {
- return;
- }
- switch (n.type) {
- case "openPreview":
- Q(n, t);
- break;
- case "cancelPreview":
- ee(n);
- break;
- case "imageUrlResolved":
- te(n);
- break;
- default:
- break;
- }
- return;
- }
- if (t.origin != ysf.ROOT && ysf.ROOT != "") {
- return;
- }
- var o = [];
- if (typeof t.data === "string") {
- o = t.data.split(":");
- }
- var r = o.shift();
- if (r == "pkg") {
- ve(JSON.parse(o.join(":")));
- return;
- }
- var a = R[(r || "").toLowerCase()];
- if (!!a) {
- a(o.join(":"));
- }
- if (typeof t.data === "object") {
- if (t.data.seq) {
- e.fireSeqCallback(t.data);
- }
- }
- };
- var ve = function(e) {
- var t = {
- notify: function(e) {
- var t = "YSF-" + F() + "-MSGNUMBERS";
- ye(e, (function(i) {
- var o = Number(window.localStorage.getItem(t) || 0), r = i ? ++o : o;
- n["notifyContent"] = e;
- n["notifyNumber"] = r;
- if (i) {
- ysf._unread(ysf.getUnreadMsg());
- }
- ysf.NotifyMsgAndBubble({
- category: "notifyCircle",
- data: {
- circleNum: r,
- notifyCnt: e.content,
- type: e.type
- }
- });
- }));
- },
- winfocus: function(e) {
- util.notification(e);
- },
- closeIframe: function(e) {
- var t = document.getElementById("YSF-PANEL-CORPINFO") || document.getElementById("YSF-PANEL-INFO") || document.getElementById("YSF-PANEL-MOBILE"), i = document.getElementById("YSF-BTN-HOLDER"), o = document.getElementById("YSF-IFRAME-LAYER");
- t.className = "ysf-chat-layer";
- ysf.checkOpenLayerSize(t, true);
- if (util.isMobilePlatform() && o) {
- o.className = "";
- }
- if (util.isMobilePlatform() && t) {
- document.body.classList.remove("YSF-PANEL-BODY-FIXED");
- document.body.scrollTop = E;
- }
- t.setAttribute("data-switch", 0);
- if (!util.isMobilePlatform() && t && ysf.inviteLayer.isInviteLayerShow()) {
- ysf.inviteLayer.resetLayer();
- }
- if (e.closeType) {
- n["dvcswitch"] == 1;
- s = true;
- }
- try {
- Y("status", {
- layerOpen: 0
- });
- } catch (e) {}
- if (n["hidden"] == 0) {
- i.style.display = "block";
- }
- },
- toggleLabel: function() {
- n.winType = 3;
- Ee();
- le({
- manualRequired: true
- });
- ysf.open(w);
- ve({
- category: "closeIframe"
- });
- n.winType = 1;
- Ee();
- },
- leaveOk: function(e) {
- delete ysf.openInline.loadStatus;
- if (util.resetTimer) {
- clearTimeout(util.resetTimer);
- }
- util.resetTimer = setTimeout((function() {
- he();
- }), 1e3);
- var t = document.getElementById("YSF-PANEL-CORPINFO") || document.getElementById("YSF-PANEL-INFO") || document.getElementById("YSF-PANEL-MOBILE");
- if (util.isMobilePlatform() && t) {
- document.body.classList.remove("YSF-PANEL-BODY-FIXED");
- document.body.scrollTop = E;
- }
- },
- pushMsg: function(e) {
- if (e.data.sdkAppend) {
- f = f + 1;
- d.push(e.data.msgSessionId);
- ysf.NotifyMsgAndBubble({
- category: "notifyCircle",
- data: {
- circleNum: f,
- notifyCnt: e.data.content,
- type: "text"
- }
- });
- }
- },
- inputblur: function(e) {
- if (util.isMobilePlatform()) {
- document.body.scrollIntoView(false);
- var t = document.documentElement.scrollTop || document.body.scrollTop;
- window.scrollTo(0, Math.max(t - 1));
- }
- },
- inputonfocus: function(e) {
- var t = navigator.userAgent.toLowerCase();
- var i = t.match(/cpu iphone os (.*?) like mac os/);
- if (i) {
- if (parseInt(i[1].replace(/_/g, ".")) == 11) {
- return;
- }
- }
- document.body.scrollTop = document.body.scrollHeight + 100;
- },
- chatProxyBuild: function(e) {
- S = true;
- if (ysf.openInline.loadStatus == "loaded" && !I && (util.isEdge() || util.isIe())) {
- I = true;
- var t = r && r.getAttribute("data-switch");
- if (t == "1" || n["dvcswitch"] == 1) {
- Y("doconnect", {
- doconnect: 1
- });
- }
- }
- },
- inviteModalClick: function() {
- if (util.isMobilePlatform()) {
- var e = "ysf-chat-mobile-invite-layer";
- var t = document.querySelector("." + e);
- if (t) {
- t.classList.remove(e);
- ysf.inviteLayer.inviteLayerHide();
- }
- }
- }
- };
- var i = t[e.category];
- if (!!i) {
- i(e);
- }
- };
- var he = function() {
- if (activePreviewRequest) {
- J(activePreviewRequest, "cancel", false);
- }
- var e = document.getElementById("YSF-PANEL-CORPINFO") || document.getElementById("YSF-PANEL-INFO") || document.getElementById("YSF-PANEL-MOBILE"), t = document.getElementById("YSF-BTN-HOLDER");
- document.body.removeChild(e);
- document.body.removeChild(t);
- ysf.init(n["imgSrc"]);
- s = true;
- };
- var Se = function() {
- if (!!proxy) {
- return;
- }
- if (!!window.addEventListener) {
- window.addEventListener("message", _e, !1);
- } else {
- window.attachEvent("onmessage", _e);
- }
- proxy = A();
- proxy.innerHTML = '<iframe style="height:0px; width:0px;" src="' + ysf.ROOT + "/webapi/sdkres/delegate.html?k=" + n.appKey + "&" + +new Date + '"></iframe>';
- proxy = proxy.getElementsByTagName("IFRAME")[0];
- proxy.domain = document.domain;
- util.addLoadEventForProxy((function() {
- g = true;
- pe();
- if (!util.isMobilePlatform()) {}
- if (window.appKey) {
- ysf.analytics(window.__YSFDASWITCH__);
- }
- if (util.isFrameModule()) {
- if (v && !h) {
- h = true;
- for (var e = 0; e < y.length; e++) {
- var t = y[e], i = t.func, n = t.arg;
- i.apply(null, n);
- }
- }
- } else {
- for (var e = 0; e < y.length; e++) {
- var t = y[e], i = t.func, n = t.arg;
- i.apply(null, n);
- }
- }
- }));
- };
- var Ie = function(e) {
- var t = n.appKey, i = F(), o = encodeURIComponent(location.href), r = (new Date).getTime(), a = encodeURIComponent(document.title), s = 1;
- var c = function() {
- try {
- r = (new Date).getTime();
- var e = window.__YSFDAROOT__ + "?ak=" + t + "&dv=" + i + "&cup=" + o + "&tm=" + r + "&ct=" + a + "<=" + s + "&u=" + window.ysf.PAGEID;
- we(e);
- } catch (e) {}
- };
- if (e) {
- c();
- } else {
- if (util.isMobilePlatform) {
- util.addEvent(window, "pagehide", (function() {
- c();
- }));
- } else {
- util.addEvent(window, "beforeunload", (function() {
- c();
- }));
- }
- }
- };
- ysf.analytics = function(e) {
- var t = n.appKey, i = F(), o = "", r = encodeURIComponent(document.referrer), a = encodeURIComponent(location.href), s = "", c = localStorage.getItem("DA-LANDPAGE") || "", l = (new Date).getTime(), u = encodeURIComponent(document.title), f = 0;
- var d = location.hostname;
- if (document.referrer.indexOf(d) == -1) {
- c = encodeURIComponent(location.href);
- c = c.slice(0, 1e3);
- localStorage.setItem("DA-LANDPAGE", c);
- localStorage.setItem("DA-LANDPAGE-TITLE", document.title);
- localStorage.setItem("DA-LANDPAGE-REFERRER", r);
- }
- if (e) {
- var m = window.__YSFDAROOT__ + "?ak=" + t + "&dv=" + i + "&si=" + o + "&su=" + r + "&cup=" + a + "&tm=" + l + "&cy=" + s + "&lp=" + c + "&ct=" + u + "<=" + f + "&u=" + window.ysf.PAGEID;
- we(m);
- } else {
- if (window.__YSFVISITORRECORD__) {
- var m = window.__YSFDAROOT__ + "?ak=" + t + "&dv=" + i + "&cup=" + a + "&tm=" + l + "&ct=" + u + "<=" + f + "&u=" + window.ysf.PAGEID;
- we(m);
- }
- }
- if (window.__YSFVISITORRECORD__) {
- Ie();
- }
- };
- var we = function(e, t) {
- t = t || function() {};
- var i = new Image;
- i.onerror = function() {
- util.consoleWarn("faild to load qa.gif");
- };
- i.onload = function() {
- t();
- };
- i.src = e;
- i.width = 1;
- i.height = 1;
- return i;
- };
- var Ee = function() {
- var e = window.screen || {};
- var t = {
- base: ",location=0,menubar=0,scrollbars=0,status=0,toolbar=0,resizable=0",
- layerNoInfo: {
- param: ""
- },
- layerHasInfo: {
- param: ""
- }
- };
- if (n.bid) {
- t.winNoInfo = {
- width: 724,
- height: 575,
- left: Math.max(0, ((e.width || 0) - 724) / 2),
- top: Math.max(0, ((e.height || 0) - 575) / 2)
- };
- t.winHasInfo = {
- width: 944,
- height: 575,
- left: Math.max(0, ((e.width || 0) - 944) / 2),
- top: Math.max(0, ((e.height || 0) - 570) / 2)
- };
- } else {
- t.winNoInfo = {
- width: 600,
- height: 630,
- left: Math.max(0, ((e.width || 0) - 600) / 2),
- top: Math.max(0, ((e.height || 0) - 630) / 2)
- };
- t.winHasInfo = {
- width: 842,
- height: 632,
- left: Math.max(0, ((e.width || 0) - 840) / 2),
- top: Math.max(0, ((e.height || 0) - 630) / 2)
- };
- }
- t.winNoInfo.param = "top=" + t.winNoInfo.top + ",left=" + t.winNoInfo.left + ",width=" + t.winNoInfo.width + ",height=" + t.winNoInfo.height + t.base;
- t.winHasInfo.param = "top=" + t.winHasInfo.top + ",left=" + t.winHasInfo.left + ",width=" + t.winHasInfo.width + ",height=" + t.winHasInfo.height + t.base;
- if (!util.isMobilePlatform()) {
- switch (n["winType"]) {
- case 1:
- i = n["corpInfo"] ? t.layerHasInfo : t.layerNoInfo;
- i.type = "layer";
- break;
- case 3:
- i = {
- type: "url",
- param: ""
- };
- break;
- default:
- i = n["corpInfo"] ? t.winHasInfo : t.winNoInfo;
- i.type = "win";
- break;
- }
- } else {
- switch (n["winMobileType"]) {
- case 2:
- i.type = "layer";
- break;
- default:
- i = n["corpInfo"] ? t.winHasInfo : t.winNoInfo;
- i.type = "win";
- break;
- }
- }
- };
- var Te = function() {
- var e = localStorage.getItem("YSFDVC-" + n.device), t = 0;
- if (e != null) {
- t = Number(e) + 1;
- }
- localStorage.setItem("YSFDVC-" + n.device, t);
- n.dvctimer = t;
- };
- var be = function() {
- var e = 0, t = 3;
- return function(i, o, r, a) {
- var s = serialize({
- appKey: n.appKey,
- timestamp: (new Date).getTime(),
- token: n.uuid,
- local: a || 0
- });
- util.ajax({
- url: ysf.DOMAIN + "webapi/user/remoteStorage.action?" + s,
- method: "post",
- contentType: "json",
- data: i,
- success: function(e) {
- if (util.isFunction(o)) {
- o();
- }
- },
- error: function(n) {
- console.info(n, "reportInfo err");
- if (e < t) {
- e++;
- be(i, o, r, a);
- } else {
- if (util.isFunction(r)) {
- r(n);
- }
- }
- }
- });
- };
- }();
- var Ne = function() {
- m && clearTimeout(m);
- if (n.noUnreadPolling) {
- return;
- }
- if (document.hidden) {
- m = setTimeout(Ne, p);
- return;
- }
- util.ajax({
- url: ysf.DOMAIN + "webapi/user/getUnread.action",
- data: {
- appKey: n.appKey,
- foreignId: n.uid || "",
- deviceId: F(),
- bid: n.bid || "",
- ts: (new Date).getTime()
- },
- success: function(e) {
- ysf.HAS_MESSAGE_COUNT = e.count > 0;
- n["IN_SESSION"] = e.dvcSwitch === 1;
- xe(e.count, e.lastMessage);
- if (e.count > 0) {
- var t = r && r.getAttribute("data-switch");
- if (t == "1") {
- Y("doconnect", {
- reconnect: 1
- });
- }
- }
- if (e.needPolling) {
- m = setTimeout(Ne, e.delay || p);
- }
- },
- error: function(e) {
- var t = p;
- if (e && e.result && e.result.delay) {
- t = e.result.delay;
- }
- if (e && (e.code == 8112 || e.code == 19104 || e.code == 14001 || e.code == 16001 || e.code == 8013)) {
- return;
- }
- m = setTimeout(Ne, t);
- }
- });
- };
- var xe = function(e, t) {
- if (e > 0) {
- if (ysf.isInInviteLayerMode()) {
- ysf.displayInviteLayer(false);
- }
- Re(t);
- if (n["notifyContent"] && t.time < n["notifyContent"].time) {
- return;
- }
- n["notifyContent"] = t;
- n["notifyNumber"] = e;
- ysf.NotifyMsgAndBubble({
- category: "notifyCircle",
- data: {
- circleNum: n["notifyNumber"],
- notifyCnt: n["notifyContent"].content,
- type: n["notifyContent"].type
- }
- });
- } else {
- ysf.NotifyMsgAndBubble({
- category: "clearCircle"
- });
- }
- var i = r && r.getAttribute("data-switch");
- if (i != "1") {
- ysf._unread(ysf.getUnreadMsg());
- }
- };
- var Re = function() {
- var e = {
- image: function(e) {
- try {
- var t = JSON.parse(e.content);
- e.content = t;
- } catch (e) {}
- },
- richtext: function(e) {
- try {
- var t = JSON.parse(e.content);
- e.content = t.content;
- } catch (t) {
- e.content = "[" + (local.RICHTEXT || "富文本") + "]";
- }
- e.type = "rich";
- },
- custom: function(e) {
- try {
- var t = JSON.parse(e.content);
- e.content = t;
- } catch (t) {
- e.content = "[" + (local.RICHTEXT || "富文本") + "]";
- }
- if (e.content.cmd == 121) {
- e.type = "productinfo";
- }
- },
- staffInviteDetail: function(e) {
- try {
- var t = JSON.parse(e.content);
- e.content = t.message;
- } catch (t) {
- e.content = "[" + (local.EVALUATIONINVITATION || "评价邀请") + "]";
- }
- },
- userJoinEvaluate: function(e) {
- try {
- var t = JSON.parse(e.content);
- e.content = t.message;
- } catch (t) {
- e.content = "[" + (local.EVALUATIONTHANK || "评价感谢") + "]";
- }
- }
- };
- e["file"] = e["image"];
- return function(t) {
- if (!!e[t.type]) {
- e[t.type](t);
- }
- };
- }();
- var Ae = function(e) {
- var t = [];
- if (!util.isArray(e) || !e.length) {
- return t;
- }
- e.forEach((function(e) {
- if (!e.lastMessage) {
- e.lastMessage = {
- content: "",
- fromUser: 0,
- time: e.endTime == -1 ? new Date.getTime : e.endTime,
- type: "custom"
- };
- }
- if (e.lastMessage.type === "richtext") {
- try {
- var t = JSON.parse(e.lastMessage.content);
- t.content = util.replaceRichAndUnescape(t.content);
- e.lastMessage.content = JSON.stringify(t);
- } catch (e) {}
- }
- }));
- return e;
- };
- var je = function() {
- var e = 0, t = 1e5;
- var i = 0, o = 3;
- return function(r, a) {
- util.ajax({
- url: ysf.DOMAIN + "webapi/user/platform/session.action",
- data: {
- appKey: n.appKey,
- offset: e,
- limit: t,
- total: true,
- u: n.uid
- },
- method: "post",
- success: function(e) {
- var t = Ae(e);
- if (util.isFunction(r)) {
- r(t);
- }
- },
- error: function(e) {
- if (e && e.code === 200) {
- return;
- }
- if (i < o) {
- i++;
- je(r, a);
- } else {
- if (util.isFunction(a)) {
- a();
- }
- }
- }
- });
- };
- }();
- ysf.style = function(e) {
- if (!e) {
- return;
- }
- var t = document.getElementsByTagName("head")[0] || document.body, i = document.createElement("style");
- i.type = "text/css";
- if (sdkCspNonce) {
- i.setAttribute("nonce", sdkCspNonce);
- i.nonce = sdkCspNonce;
- }
- t.appendChild(i);
- if ("textContent" in i) {
- i.textContent = e;
- } else if (!!i.styleSheet) {
- i.styleSheet.cssText = e;
- }
- };
- ysf.openInline = function(e, t) {
- if (ysf.openInline.loadStatus == "loading") {
- return;
- }
- if (ysf.openInline.loadStatus == "loaded" && util.isFunction(t)) {
- return t();
- }
- var i = document.getElementById("YSF-PANEL-CORPINFO") || document.getElementById("YSF-PANEL-INFO") || document.getElementById("YSF-PANEL-MOBILE");
- if (!e || !i) {
- return;
- }
- ysf.openInline.loadStatus = "loading";
- e = util.mergeUrl(e, {
- w: n["winType"]
- });
- if (activePreviewRequest) {
- J(activePreviewRequest, "cancel", false);
- }
- var o = function(e) {
- var t = document.createElement("iframe");
- t.src = e;
- t.id = "YSF-IFRAME-LAYER";
- t.style.width = "100%";
- t.style.height = "100%";
- t.setAttribute("allowFullScreen", true);
- t.setAttribute("allow", "camera; microphone; autoplay");
- t.setAttribute("frameborder", "0");
- return t;
- };
- chatProxy = o(e);
- i.appendChild(chatProxy);
- util.addEvent(chatProxy, "load", (function() {
- if (!(util.isEdge() || util.isIe())) {
- if (n["dvcswitch"] == 1) {
- I = true;
- Y("doconnect", {
- doconnect: 1
- });
- }
- } else {
- if (n["dvcswitch"] == 1 && S) {
- I = true;
- Y("doconnect", {
- doconnect: 1
- });
- }
- }
- ysf.openInline.loadStatus = "loaded";
- ysf._onLayerload();
- if (util.isFunction(t)) {
- t();
- }
- }));
- };
- ysf._$text2portrait = function() {
- window.__YSFAPPPATH__ = "/sdk/";
- var e = function(e) {
- var t = '<img class="portrait_icon" data-id="' + e.id + '" src="' + e.src + '" title="' + e.tag + '" alt="' + e.tag + '">';
- return t;
- };
- var t = /(\[[^\]]+\])/gi;
- var i = window.__YSFSDKADR__ + window.__YSFAPPPATH__ + "res/portrait/emoji/";
- var n = window.__YSF_EMOJI__;
- return function(o) {
- o = o.replace(/alt="(\[[^\]]+\])"/gi, 'alt=""');
- var r = n.pmap;
- var a = {};
- each(r, (function(e, t) {
- a[t.tag] = e;
- }));
- o = o.replace(t, (function(t, n) {
- if (a[n]) {
- var o = e({
- id: a[n],
- tag: n,
- src: i + r[a[n]].file
- });
- return o;
- } else {
- return n;
- }
- }));
- return o;
- };
- }();
- ysf.showInviteLayerAuto = function(e) {
- if (!e) {
- return;
- }
- window.setTimeout((function() {
- var t = !ysf.HAS_QIYU_OPEND && ysf.hasTodayInviteTimes(e) && e.invitePatternVo && e.invitePatternVo.mode === 2 && e.switchType === 1 && e.waitTime && !!n["sessionInvite"] && n["hidden"] != 1;
- if (t) {
- ysf.setTodayShowInviteTimes();
- ysf.open({
- invitePatternVo: e.invitePatternVo,
- inviteTemplateId: e.id
- }, ysf.INVITE_TPYE);
- ysf.inviteLayer.showInvite();
- }
- }), e.waitTime * 1e3);
- };
- ysf.inviteLayer = function() {
- return {
- resetLayer: function() {
- ysf.reset();
- n["INIITE_LAYER"] = null;
- },
- showInvite: function() {
- n["INIITE_LAYER"] = 1;
- },
- isInviteLayerShow: function() {
- return n["INIITE_LAYER"] == 1;
- },
- inviteLayerHide: function() {
- n["INIITE_LAYER"] = null;
- }
- };
- }();
- ysf.getImRoot = function(e, t) {
- if (window.__YSFENABLENEWCLIENT__ == 1 && !t) {
- return ysf.ROOT + "/client/sdk";
- }
- var i = ysf.IMROOT;
- if (e === ysf.INVITE_TPYE && !util.isMobilePlatform()) {
- var n = "/client/iframe";
- i = ysf.ROOT + n;
- }
- return i;
- };
- ysf.entry = function(e) {
- var t = function() {
- var t = document.createElement("div");
- if (window.__YSFTHEMELAYEROUT__) {
- t.className = "layer-" + window.__YSFTHEMELAYEROUT__;
- }
- t.setAttribute("id", "YSF-BTN-HOLDER");
- if (n["hidden"] == 1) {
- t.style.display = "none";
- }
- var i = ysf.inviteText(e.inviteSetting);
- var o = "YSF-CUSTOM-ENTRY-" + window.__YSFTHEMELAYEROUT__;
- var r = "YSF-INVITE-IMG YSF_INVITE-IMG-" + window.__YSFTHEMELAYEROUT__;
- var a = i && i.replace(/(<img.*?>)/g, "[" + local.IMAGE + "]").replace(/<p><br><\/p>/g, "").replace(/<p>/g, "pStartElement").replace(/<\/p>/g, "pCloseElement").replace(/<.+?>/g, "").replace(/pStartElement/g, "<p>").replace(/pCloseElement/g, "</p>");
- var s = "";
- if (i) {
- s = "" + '<div class="YSF-INVITE-LAYER-WRAPPER" style="display: none">' + '<div class="YSF-INVITE-LAYER-HEADER">' + '<div class="YSF-INVITE-LAYER-HEADER-LEFT">' + '<img class="YSF-INVITE-LAYER-AVATAR" src="' + e.inviteSetting.invitePatternVo.inviteAvatar + '" alt="" />' + '<div class="YSF-INVITE-LAYER-KEFU-NAME">' + e.inviteSetting.invitePatternVo.realName + "</div>" + "</div>" + '<div id="YSF-ONLINE-INVITE-LAYER-CLOSE"></div>' + "</div>" + '<div class="YSF-INVITE-LAYER-RICHTEXT">' + ysf._$text2portrait(a) + "</div>" + "</div>" + '<div id="YSF-INVITE-LAYER-WRAPPER-ENTRY" style="display: none">' + '<div class="YSF-LAYER-ENTRY-CIRCLE"></div>' + '<img class="' + r + '" src="' + e.src + '"/>' + "</div>";
- }
- t.innerHTML = s + '<div id="' + o + '" class="YSF-CUSTOM-ENTRY"><img src="' + e.src + '"/></div>';
- t.onclick = function() {
- if (ysf.isInInviteLayerMode()) {
- ysf.open({
- invitePatternVo: e.inviteSetting.invitePatternVo,
- inviteTemplateId: e.inviteSetting.id
- });
- } else {
- ysf.open();
- }
- ysf.HAS_QIYU_OPEND = true;
- ysf.displayInviteLayer(false);
- };
- document.body.appendChild(t);
- if (i) {
- document.querySelector("#YSF-ONLINE-INVITE-LAYER-CLOSE").onclick = function(e) {
- e.stopPropagation();
- ysf.displayInviteLayer(false);
- ysf.INVITE_REJECT = true;
- setTimeout((function() {
- ysf.displayInviteLayer(true);
- }), inviteSetting.intervalTime * 1e3);
- };
- }
- if (e.inviteSetting && e.inviteSetting.switchType === 1 && e.inviteSetting.waitTime) {
- setTimeout((function() {
- ysf.displayInviteLayer(true);
- }), e.inviteSetting.waitTime * 1e3);
- }
- return t;
- };
- var i = function(e) {
- var t = document.createElement("span");
- t.setAttribute("id", "YSF-BTN-CIRCLE");
- e.appendChild(t);
- };
- var o = function(e) {
- var t = document.createElement("div"), i = document.createElement("div"), n = document.createElement("span"), o = document.createElement("span");
- t.setAttribute("id", "YSF-BTN-BUBBLE");
- i.setAttribute("id", "YSF-BTN-CONTENT");
- n.setAttribute("id", "YSF-BTN-ARROW");
- o.setAttribute("id", "YSF-BTN-CLOSE");
- o.onclick = function(e) {
- e.stopPropagation();
- e.preventDefault();
- ysf.NotifyMsgAndBubble({
- category: "clearCircle"
- });
- };
- e.appendChild(t);
- t.appendChild(i);
- t.appendChild(n);
- t.appendChild(o);
- };
- var r = t();
- i(r);
- o(r);
- };
- ysf.hasTodayInviteTimes = function(e) {
- var t = "YSF_INVITE_SHOW_TIMES";
- var i = JSON.parse(localStorage.getItem(t) || "{}")[util.getToday()] || 0;
- var n = e && e.switchType === 1 && (i === 0 || e.rejectType === 1 && (!e.timesLimitType || e.timesLimit > i) || e.rejectType === 0 && !ysf.INVITE_REJECT && (!e.timesLimitType || e.timesLimit > i));
- return n;
- };
- ysf.setTodayShowInviteTimes = function() {
- var e = "YSF_INVITE_SHOW_TIMES";
- var t = JSON.parse(localStorage.getItem(e) || "{}");
- var i = util.getToday();
- var o = {};
- o[i] = t[i] ? t[i] + 1 : 1;
- localStorage.setItem(e, JSON.stringify(o));
- util.ajax({
- url: ysf.DOMAIN + "webapi/invite/num",
- method: "get",
- data: {
- appKey: n.appKey
- },
- success: function(e) {
- console.log("[success]会话邀请次数统计接口");
- },
- error: function(e) {
- console.log("[err]会话邀请次数统计接口", e);
- }
- });
- };
- ysf.inviteText = function(e) {
- var t = e && e.invitePatternVo;
- var i = "";
- if (t) {
- i = t.robotSwitch === 0 ? t.humanWelcomePrompt : t.robotWelcomePrompt;
- }
- return i;
- };
- ysf.isInInviteLayerMode = function() {
- return document.querySelector(".YSF-INVITE-LAYER-WRAPPER") && document.querySelector(".YSF-INVITE-LAYER-WRAPPER").style.display !== "none";
- };
- ysf.isInvitedLayer = function() {
- var e = ysf.inviteText(window.inviteSetting);
- var t = window.inviteSetting && window.inviteSetting.invitePatternVo && window.inviteSetting.invitePatternVo.mode === 1 && e && ysf.hasTodayInviteTimes(window.inviteSetting) && !ysf.HAS_MESSAGE_COUNT && !n["IN_SESSION"] && !ysf.HAS_QIYU_OPEND && !!n["sessionInvite"];
- return t;
- };
- ysf.displayInviteLayer = function(e) {
- e = e && ysf.isInvitedLayer();
- if (e) {
- ysf.setTodayShowInviteTimes();
- }
- var t = document.querySelector("#YSF-BTN-HOLDER");
- var i = "#YSF-CUSTOM-ENTRY-" + window.__YSFTHEMELAYEROUT__;
- var n = document.querySelector(".YSF-INVITE-LAYER-WRAPPER");
- var o = document.querySelector("#YSF-INVITE-LAYER-WRAPPER-ENTRY");
- var r = document.querySelector(i);
- var a = document.querySelector("#YSF-BTN-CIRCLE");
- var s = document.querySelector("#YSF-BTN-BUBBLE");
- function c(e) {
- return e ? "block" : "none";
- }
- if (ysf.inviteText(window.inviteSetting)) {
- n.style.display = c(e);
- o.style.display = c(e);
- }
- r.style.display = c(!e);
- if (e) {
- t.style.maxHeight = "none";
- t.style.maxWidth = "none";
- a.style.display = c(false);
- s.style.display = c(false);
- }
- };
- ysf.entryPanel = function(e, t) {
- var i = document.createElement("div"), o = util.isFrameModule() ? 0 : 1;
- if (util.isMobilePlatform()) {
- i.setAttribute("id", "YSF-PANEL-MOBILE");
- i.onclick = function() {
- if (ysf.inviteLayer.isInviteLayerShow()) {
- return;
- }
- ve({
- category: "closeIframe"
- });
- };
- } else {
- parseInt(e) ? i.setAttribute("id", "YSF-PANEL-CORPINFO") : i.setAttribute("id", "YSF-PANEL-INFO");
- }
- i.className = "ysf-chat-layer";
- document.body.appendChild(i);
- i.setAttribute("data-switch", o);
- r = i;
- try {
- Y("status", {
- layerOpen: o
- });
- } catch (e) {}
- Te();
- if (n.preloadIframe) {
- ysf.openInline(ysf.url());
- }
- if (t && util.isFunction(t.success)) {
- t.success();
- }
- };
- ysf.invite = function() {
- var e, t, i, o = document.createDocumentFragment();
- var r = function() {
- if (!!e) {
- return;
- }
- e = document.createElement("div");
- e.className = "ysf-online-invite-wrap";
- if (i.style && i.style.type) {
- e.innerHTML = '<div class="ysf-online-invite" style="cursor:default;width:' + i.style.bdWidth + "px;height:" + i.style.bdHeight + "px;margin-top:" + -i.style.bdHeight / 2 + 'px"><div></div><div class="close custom" title="' + (local.CLOSE || "关闭") + '"></div><img class="ysf-online-invite-img"/></div>';
- var t = e.childNodes[0], n = t.childNodes, o = n[0];
- if (util.isArray(i.style.oprs)) {
- var r = null, l = null;
- for (var u = 0; u < i.style.oprs.length; u++) {
- r = i.style.oprs[u];
- l = document.createElement("a");
- if (!r) {
- continue;
- }
- l.style.position = "absolute";
- l.style.cursor = "pointer";
- l.style.height = r.height + "px";
- l.style.width = r.width + "px";
- l.style.top = r.top + "px";
- l.style.left = r.left + "px";
- if (r.type == 3) {
- l.onclick = s;
- } else if (r.type == 2) {
- l.onclick = function(e) {
- return function() {
- ysf.open({
- invited: 1,
- templateId: e
- });
- c();
- };
- }(r.tplid);
- } else if (r.type == 1) {
- l.href = r.url;
- l.target = "_blank";
- }
- o.appendChild(l);
- }
- }
- n[1].onclick = s;
- n[2].onload = function() {
- window.setTimeout(a, 100);
- };
- } else if (i.style) {
- e.innerHTML = '<div class="ysf-online-invite"><div class="text"></div><div class="close" title="' + (local.CLOSE || "关闭") + '"></div><img/></div>';
- var t = e.childNodes[0], n = t.childNodes, f = n[0];
- if ("innerText" in f) {
- f.innerText = i.style.welcomeText;
- } else {
- f.textContent = i.style.welcomeText;
- }
- t.onclick = function() {
- ysf.open({
- invited: 1
- });
- c();
- };
- n[1].onclick = s;
- n[2].onload = function() {
- window.setTimeout(a, 100);
- };
- }
- };
- var a = function() {
- e.style.visibility = "visible";
- };
- var s = function(e) {
- e = e || window.event || {};
- if (e.stopPropagation) {
- e.stopPropagation();
- } else {
- e.cancelBubble = !0;
- }
- c();
- ysf.INVITE_REJECT = true;
- if (i.rejectType != 0) {
- window.setTimeout(l, i.intervalTime * 1e3);
- }
- };
- var c = function() {
- o.appendChild(e);
- e.getElementsByTagName("IMG")[0].src = ysf.CDNROOT + "res/nej_blank.gif";
- };
- var l = function() {
- if (!n["sessionInvite"] || !ysf.hasTodayInviteTimes(window.inviteSetting)) {
- return;
- }
- ysf.setTodayShowInviteTimes();
- r();
- e.style.visibility = "hidden";
- document.body.appendChild(e);
- e.getElementsByTagName("IMG")[0].src = i.style && i.style.type ? i.style.bdImageUrl : ysf.CDNROOT + "res/invite/1/bg.png";
- };
- return function(e) {
- if (e && e.invitePatternVo && e.invitePatternVo.mode !== 0) {
- return;
- }
- if (!i) {
- i = e || {};
- if (util.isMobilePlatform()) {
- i.style = i.h5Style;
- }
- }
- var t = function() {
- window.setTimeout(l, (i.waitTime || 15) * 1e3);
- };
- if (n.timestamp) {
- t();
- } else {
- n.onackdone = t;
- }
- };
- }();
- ysf.checkOpenLayerSize = function(e, t) {
- var i = 360, o = 500;
- if (!n.layerSize || util.isMobilePlatform()) {
- return;
- }
- var r = n.layerSize;
- var a = parseInt(r.height) > o;
- var s = parseInt(r.width) > i;
- if (t) {
- s && (e.style.width = 0);
- a && (e.style.height = 0);
- return;
- }
- if (s) {
- e.style.width = util.includes(r.width, "px") ? r.width : r.width + "px";
- }
- if (a) {
- e.style.height = util.includes(r.height, "px") ? r.height : r.height + "px";
- }
- };
- ysf.openLayer = function() {
- return function(e) {
- var t = document.getElementById("YSF-PANEL-CORPINFO") || document.getElementById("YSF-PANEL-INFO") || document.getElementById("YSF-PANEL-MOBILE"), i = document.getElementById("YSF-BTN-HOLDER"), n = document.getElementById("YSF-IFRAME-LAYER");
- if (!t) {
- return;
- }
- i.style.display = "none";
- t.className = "ysf-chat-layer ysf-chat-layeropen";
- ysf.checkOpenLayerSize(t);
- if (util.isMobilePlatform() && n) {
- n.className = "ysf-chat-mobile-layeropen" + (e === ysf.INVITE_TPYE ? " ysf-chat-mobile-invite-layer" : "");
- }
- E = document.body.scrollTop || document.documentElement.scrollTop;
- if (document.getElementById("YSF-PANEL-MOBILE")) {
- document.body.classList.add("YSF-PANEL-BODY-FIXED");
- document.getElementById("YSF-PANEL-MOBILE").addEventListener("touchmove", (function(e) {
- e.stopPropagation();
- }));
- }
- t.setAttribute("data-switch", 1);
- try {
- Y("status", {
- layerOpen: 1
- });
- } catch (e) {}
- };
- }();
- window.windowurl = "";
- ysf.openWin = function() {
- return function(e, t, i) {
- if (util.isMobilePlatform()) {
- if (i && i.replace) {
- window.location.replace(e);
- } else {
- window.location.href = e;
- }
- } else {
- window.windowurl = window.open(e, "YSF_SERVICE_" + (n.appKey || "").toUpperCase(), t.param);
- if (!window.windowurl && !util.isIe()) {
- window.location.href = e;
- }
- }
- };
- }();
- ysf.openUrl = function() {
- return function(e, t, i) {
- var o = e.replace(/\/iframe/g, "");
- window.windowurl = window.open(o, "YSF_SERVICE_" + (n.appKey || "").toUpperCase(), t.param);
- if (!window.windowurl && !util.isIe()) {
- if (i && i.replace) {
- window.location.replace(o);
- } else {
- window.location.href = o;
- }
- }
- };
- }();
- ysf.close = function() {
- if (window.windowurl) {
- window.windowurl.close();
- } else if (i.type === "layer") {
- var e = document.getElementById("YSF-PANEL-CORPINFO") || document.getElementById("YSF-PANEL-INFO") || document.getElementById("YSF-PANEL-MOBILE"), t = document.getElementById("YSF-BTN-HOLDER");
- delete ysf.openInline.loadStatus;
- document.body.removeChild(e);
- document.body.removeChild(t);
- s = true;
- }
- };
- ysf.NotifyMsgAndBubble = function(e) {
- var t = {
- clearCircle: function(e) {
- var t = "YSF-" + F() + "-MSGNUMBERS", i = document.getElementById("YSF-BTN-CIRCLE"), o = document.getElementById("YSF-BTN-BUBBLE");
- o && (o.style.display = "none");
- i && (i.style.display = "none");
- localStorage.setItem(t, 0);
- n["notifyNumber"] = 0;
- n["notifyContent"] = "";
- f = 0;
- },
- notifyCircle: function(e) {
- var t = "YSF-" + F() + "-MSGNUMBERS";
- localStorage.setItem(t, e.data.circleNum);
- var i = document.getElementById("YSF-BTN-BUBBLE"), o = document.getElementById("YSF-BTN-CONTENT"), r = document.getElementById("YSF-BTN-CIRCLE");
- var a = document.getElementById("YSF-PANEL-CORPINFO") || document.getElementById("YSF-PANEL-INFO") || document.getElementById("YSF-PANEL-MOBILE");
- var s = {
- image: function(e) {
- return "[" + (local.IMAGE || "图片") + "]";
- },
- audio: function(e) {
- return "[" + (local.AUDIO || "音频") + "]";
- },
- video: function(e) {
- return "[" + (local.VIDEO || "视频") + "]";
- },
- file: function(e) {
- return "[" + (local.FILE || "文件") + "]" + e.name;
- },
- text: function(e) {
- return e;
- },
- rich: function(e) {
- return util.replaceRichAndUnescape(e);
- },
- productinfo: function(e) {
- return "[" + (local.PRD_LINK || "商品链接") + "]";
- },
- staffInviteDetail: function(e) {
- return util.replaceRichAndUnescape(e);
- },
- userJoinEvaluate: function(e) {
- return util.replaceRichAndUnescape(e);
- }
- };
- var c = util.isFrameModule() && a && a.getAttribute("data-switch") == 0 && s[e.data.type] && n["sdkCustom"] == 0;
- if (!util.isFrameModule() || c) {
- r && (r.style.display = "block");
- i && (i.style.display = "block");
- r && (r.innerHTML = e.data.circleNum > 99 ? "99+" : e.data.circleNum);
- o && (o.innerHTML = s[e.data.type](e.data.notifyCnt));
- }
- }
- };
- var i = t[e.category];
- if (!!i) {
- i(e);
- }
- };
- ysf.getUnreadMsg = function() {
- return {
- type: n["notifyContent"].type,
- message: n["notifyContent"].content,
- total: n["notifyNumber"]
- };
- };
- ysf.getConversationThrottle = util.throttleDebounce((function() {
- je(ysf._onConversation);
- }), 2e3);
- ysf.initNim = function() {
- var e = {
- NULL: 0,
- INIT: 1,
- CONNECTED: 2
- };
- var t = -1;
- var i = 3e3;
- var o = e.NULL;
- var r = 8e3;
- var a = function() {
- return {
- db: false,
- syncBroadcastMsgs: false,
- syncExtraTeamInfo: false,
- syncFilter: true,
- syncFriendUsers: false,
- syncFriends: false,
- syncRelations: false,
- syncRoamingMsgs: false,
- syncRobots: false,
- syncSessionUnread: false,
- syncStickTopSessions: false,
- syncSuperTeamRoamingMsgs: false,
- syncSuperTeams: false,
- syncTeamMembers: false,
- syncTeams: false,
- defaultLinkUrl: "https://weblink-qiyu.netease.im",
- privateConf: {
- lbs_web: window.MIN_LBS
- },
- onmsg: v,
- onerror: w,
- onconnect: I,
- ondisconnect: E,
- oncustomsysmsg: h,
- onofflinefiltermsgs: T
- };
- }();
- var s = function(e) {
- n["yinxin-state"] = e;
- };
- var c = function() {
- return n["yinxin-state"];
- };
- var l = function(e) {
- var t = n["yunxin-user"] || {};
- if (window.localStorage) {
- var i = "X-" + e.toUpperCase() + "-YSF-INFO", o = localStorage.getItem(i);
- if (!o) {
- return;
- }
- var r = util.query2Object(o);
- if (!!r.uid) {
- t.fid = r.uid;
- }
- r.source = o;
- return r;
- }
- };
- var u = function(e) {
- try {
- return JSON.parse(e);
- } catch (e) {
- return null;
- }
- };
- var f = function(e, t) {
- if (!t) {
- window.setTimeout(m._$bind(this, appkey), i);
- return;
- }
- g(t);
- t.appKey = e;
- y(t, a);
- window.nim = ysf.nim = new NIM(t);
- je(ysf._getConversation)();
- };
- var d = function(e, t) {
- util.ajax({
- url: ysf.DOMAIN + "webapi/user/create.action?appKey=" + t,
- data: e,
- method: "post",
- fullResult: true,
- contentType: "json",
- success: function(e) {
- var i = e.info;
- e.result = {
- token: i.token,
- account: i.accid,
- exchange: i.exchange,
- bid: i.bid
- };
- f(t, e.result);
- },
- error: function(e) {
- console.log(e, "userCreate error");
- }
- });
- };
- var m = function(e) {
- var t = {
- deviceid: n.uid || n.device,
- appKey: e,
- token: n.uuid || ""
- };
- if (n.uid) {
- t.foreignid = n.uid;
- }
- if (n.authToken) {
- t.authtoken = n.authToken;
- }
- d(t, e);
- };
- var p = function(e, t) {
- if (!util.isArray(e) || !util.isFunction(t)) {
- return;
- }
- var i = e.length;
- var n = 0;
- e.forEach((function(e) {
- util.loadJS(e, (function() {
- n++;
- if (n >= i) {
- t();
- }
- }));
- }));
- };
- function g(e) {
- var t = n["yunxin-user"];
- if (!t) {
- n["yunxin-user"] = e;
- } else {
- y(t, e);
- }
- }
- function y(e, t) {
- each(t, (function(t, i) {
- e[t] = i;
- }));
- return e;
- }
- function _(e) {
- var t = e.idClient.split("#")[0];
- if (!t) {
- console.error("msg idClient without #", e.idClient, e);
- return e;
- }
- return y(e, {
- id: e.idClient,
- bid: e.from,
- sessionid: t
- });
- }
- function v(e, t) {
- console.log(e, t, "_cbReceiveMessage");
- var i = {
- image: "file",
- audio: "file",
- video: "file"
- };
- var n = {
- 60: !0,
- 90: !0,
- 95: !0,
- 72: !0,
- 200: !0,
- 65: !0,
- 203: !0,
- 121: !0,
- 59: !0
- };
- e = _(e);
- if (e.type == "custom") {
- e.isOffline = t;
- h(e, n);
- return;
- }
- S(y(e, {
- content: e[i[e.type] || e.type],
- reallyType: e.type
- }));
- }
- function h(e, t, i) {
- var n = e.content || "";
- var o = [ 9, 17, 59, 42, 1002, "-1000", 11056, 108, 11060 ];
- try {
- n = JSON.parse(n);
- if (!!t && !t[n.cmd] && !i) {
- return;
- }
- if (~o.indexOf(n.cmd) || ~o.indexOf(i)) {
- return;
- }
- if (n.cmd == 65) {
- n.content = util.replaceRichAndUnescape(n.content);
- e.content = JSON.stringify(n);
- }
- } catch (e) {}
- var r = n.sessionid || n.currentSessionId || n.workSheetTemplateVo && n.workSheetTemplateVo.sessionId;
- S(y(e, {
- cmd: n.cmd,
- sessionid: r
- }));
- }
- function S(e) {
- ysf._onSessionMessage(e);
- if (n["onConversation"]) {
- ysf.getConversationThrottle();
- }
- }
- function I(t) {
- console.log(t, "_cbConnect2Yunxin");
- if (t.ip) {
- g({
- ip: t.ip
- });
- }
- s(e.CONNECTED);
- b();
- }
- function w(e) {
- var t = {
- 302: function() {
- console.error("连接失败");
- }
- };
- var i = t[e.code];
- if (util.isFunction(i)) {
- i.call(this);
- } else if (typeof i == "string") {
- t[i].call(this);
- }
- }
- function E() {
- s(e.NULL);
- }
- function T(e) {
- e.sort((function(e, t) {
- return e.time > t.time;
- }));
- e.forEach((function(e) {
- v(e, true);
- }));
- }
- function b() {
- var e = this;
- var t = function() {
- N({
- content: {
- cmd: -1e3,
- deviceid: F()
- }
- });
- if (e._timeout) {
- clearTimeout(e._timeout);
- }
- e._timeout = setTimeout((function() {
- t();
- }), r);
- };
- t();
- }
- function N(e) {
- ysf.nim.sendCustomSysMsg({
- to: e.bid || t,
- cc: !0,
- filter: !0,
- scene: "p2p",
- content: JSON.stringify(e.content),
- done: e.done
- });
- }
- function x() {
- ysf.nim && ysf.nim.disconnect();
- s(e.NULL);
- }
- function R() {
- return ~ysf.DOMAIN.indexOf("qytest.netease");
- }
- return {
- _$connect: function(t) {
- x();
- if (c() !== e.NULL) {
- return;
- }
- s(e.INIT);
- var i = [ "//res.qiyukf.net/storage/NIM_Web_NIM_v9.8.103.js" ];
- p(i, (function() {
- m(t);
- }));
- },
- _$disConnect: function() {
- x();
- }
- };
- }();
- ysf.checkBaiduSelfBuild = function() {
- try {
- var e = document.referrer;
- var t = util.getSearchParams(e, "xst");
- if (t && util.includes(e, "baidu.com")) {
- return t;
- }
- return null;
- } catch (e) {
- return null;
- }
- };
- ysf.config = function(e, t) {
- if (!e) {
- return;
- }
- e.reallyUid = e.uid;
- j(e);
- if (!t) {
- each(e, (function(e) {
- if (o.indexOf(e) < 0) {
- o.push(e);
- }
- }));
- }
- if (!!n.appKey) {
- if (!t) {
- try {
- var i = "YSF-" + n["appKey"].toUpperCase() + "-CARD-UID";
- var r = localStorage.getItem(i) || "";
- var a = e.uid || "";
- if (r && r !== a) {
- fe({
- data: null
- });
- de({
- data: null
- });
- }
- if (a) {
- localStorage.setItem(i, a);
- }
- } catch (e) {
- if (typeof console !== "undefined" && console.warn) {
- console.warn("[YSF] localStorage unavailable:", e);
- }
- }
- }
- O(e.uid);
- le({
- upToServer: true,
- success: e.success,
- error: e.error,
- local: t || 0
- });
- Ee();
- Ne();
- if (n["connectYunxin"]) {
- ysf.initNim._$connect(n["appKey"]);
- }
- }
- };
- var Oe = function(e, i) {
- util.ajax({
- url: ysf.DOMAIN + "webapi/user/company/get/getCorpStatus.action",
- method: "get",
- data: {
- appKey: n.appKey,
- shopCode: e
- },
- success: function(e) {
- t = e;
- if (util.isFunction(i)) {
- i();
- }
- },
- error: function(e) {
- console.log("[err]平台企业子企业是否开启", e);
- if (util.isFunction(i)) {
- i();
- }
- }
- });
- };
- var Fe = function(e) {
- each(e, (function(t, i) {
- if (i == undefined || i === "" || i === 0 || i === "0") {
- delete e[t];
- }
- }));
- };
- ysf.url = function(e, i) {
- if (!n.appKey) {
- return "";
- }
- var o = {
- k: n.appKey,
- u: n.uid || "",
- d: F(),
- uuid: n.uuid,
- gid: n.groupid || 0,
- sid: n.staffid || 0,
- qtype: n.qtype || 0,
- welcomeTemplateId: n.welcomeTemplateId || 0,
- dvctimer: n.dvctimer || 0,
- robotShuntSwitch: n.robotShuntSwitch || 0,
- hc: n.hc || 0,
- robotId: n.robotId || 0,
- pageId: ysf.PAGEID,
- shuntId: n.shuntId || 0,
- ctm: (new util.Base64).encode(n.uid + "--" + (new Date).getTime()),
- wxwId: n.wxworkAppId || "",
- language: n.language || "",
- isShowBack: n.isShowBack || 0,
- shortcutTemplateId: n.shortcutTemplateId || ""
- };
- if (n.spkf == 1) {
- o.spkf = 1;
- }
- if (n.APPbackPop) {
- o.APPbackPop = n.APPbackPop;
- }
- if (n.APPBridgePermission) {
- o.APPBridgePermission = n.APPBridgePermission;
- }
- if (n.usealipayjs) {
- o.usealipayjs = n.usealipayjs;
- }
- if (n.isCaptureSupported) {
- o.isCaptureSupported = n.isCaptureSupported;
- }
- if (n.isCustomPickSource) {
- o.isCustomPickSource = n.isCustomPickSource;
- }
- if (n.usewxjs) {
- o.usewxjs = n.usewxjs;
- }
- if (n.downloadPageUrl) {
- o.downloadPageUrl = n.downloadPageUrl;
- }
- if (n.customUrl) {
- o.customUrl = n.customUrl;
- }
- if (n.appName) {
- o.appName = n.appName;
- }
- if (n.checkPermission) {
- o.checkPermission = n.checkPermission;
- }
- if (n.disableMultiple) {
- o.disableMultiple = n.disableMultiple;
- }
- if (n.emojiPopoverWidth) {
- o.emojiPopoverWidth = n.emojiPopoverWidth;
- }
- if (i == ysf.INVITE_TPYE) {
- o.isInvite = 1;
- }
- if (window.sdkTemplateId) {
- o.templateId = window.sdkTemplateId;
- }
- if (window.shuntId) {
- o.shuntId = window.shuntId;
- }
- if (e && e.templateId) {
- o.templateId = e.templateId;
- }
- if (e && e.invited) {
- o.invited = 1;
- }
- if (e && e.invitePatternVo && i != ysf.INVITE_TPYE) {
- o.invited = 1;
- o.inviteTemplateId = e.inviteTemplateId;
- o.robotSwitch = e.invitePatternVo.robotSwitch;
- o.humanWelcomeTemplateId = e.invitePatternVo.welcomeTemplateId;
- o.robotId = e.invitePatternVo.robotId;
- o.welcomeTemplateId = e.invitePatternVo.robotWelcomeTemplateId;
- o.inviteGroupId = e.invitePatternVo.inviteGroupId;
- }
- if (!util.isMobilePlatform() && window.__YSFWINTYPE__ == 1 && n.layerSize && n.layerSize.inputHeight) {
- o.ipth = n.layerSize.inputHeight;
- }
- if (e && e.language) {
- o.language = e.language;
- }
- if (n.unconfirm) {
- o.unconfirm = n.unconfirm;
- }
- if (n.debugger) {
- o.debugger = n.debugger;
- }
- if (!util.isMobilePlatform() && window.__YSFWINTYPE__ == 1) {
- o.allowNewTab = n.allowNewTab || 0;
- }
- each({
- n: "name",
- e: "email",
- m: "mobile"
- }, (function(e, t) {
- var i = n[t];
- if (!!i) {
- o[e] = i;
- }
- }));
- if (n.customSkin) {
- each({
- topbarBgColor: "topbarBgColor",
- chatPanelBgColor: "chatPanelBgColor",
- lMsgColor: "lMsgColor",
- rMsgColor: "rMsgColor",
- lMsgBgColor: "lMsgBgColor",
- rMsgBgColor: "rMsgBgColor",
- buttonColor: "buttonColor",
- buttonBgColor: "buttonBgColor",
- editorColor: "editorColor",
- editorBgColor: "editorBgColor",
- corpInfoColor: "corpInfoColor",
- corpInfoTitleColor: "corpInfoTitleColor",
- corpInfoBgColor: "corpInfoBgColor",
- tipColor: "tipColor",
- linkColor: "linkColor",
- borderColor: "borderColor"
- }, (function(e, t) {
- var i = n.customSkin[t];
- if (!!i) {
- o[e] = i;
- }
- }));
- }
- o.t = encodeURIComponent(n.title || document.title);
- if (n.goodsCId) {
- o.goodsCId = n.goodsCId;
- }
- if (n.goodsCName) {
- o.goodsCName = n.goodsCName;
- }
- if (n.goodsId) {
- o.goodsId = n.goodsId;
- }
- if (n.orderId) {
- o.orderId = n.orderId;
- }
- if (n.orderStageType) {
- o.orderStageType = n.orderStageType;
- }
- var r = (e && e.bid || n.bid) && t;
- if (ne() && !r) {
- delete o.u;
- delete o.d;
- delete o.n;
- delete o.e;
- delete o.m;
- delete o.authToken;
- }
- Fe(o);
- if (r) {
- o.bid = e && e.bid || n.bid;
- return ysf.getImRoot(i, 1) + "/trade" + "?" + serialize(o);
- }
- return ysf.getImRoot(i) + "?" + serialize(o);
- };
- ysf.track = function(e, t) {
- var i = n.appKey, o = F(), r = encodeURIComponent(location.href), a = localStorage.getItem("DA-LANDPAGE") || "", s = (new Date).getTime(), c = e, l = "";
- desc = JSON.stringify(t), tp = 1;
- var u = function() {
- try {
- var e = window.__YSFDAROOT__ + "?ak=" + i + "&dv=" + o + "&cup=" + r + "&lp=" + a + "&tm=" + s + "&ct=" + c + "<=" + l + "&tp=" + tp + "&desc=" + desc + "&u=" + window.ysf.PAGEID;
- we(e);
- } catch (e) {}
- };
- u();
- };
- ysf.logoff = function() {
- if (activePreviewRequest) {
- J(activePreviewRequest, "cancel", false);
- }
- L();
- util.clearLocalItems(util.findLocalItems(/msgnumbers/gi));
- o.forEach((function(e) {
- delete n[e];
- }));
- };
- ysf.openByLink = function(e) {
- var t = ysf.url();
- if (!t) {
- return;
- }
- e = e || {};
- var i = e.target || e.srcElement;
- if (!i || i.tagName != "A") {
- return;
- }
- i.href = t;
- };
- var Pe = function(e) {
- if (e.clear) {
- return null;
- }
- e.title = e.title && e.title.length > 100 ? e.title.slice(0, 100) : e.title;
- e.desc = e.desc && e.desc.length > 300 ? e.desc.slice(0, 300) : e.desc;
- e.note = e.note && e.note.length > 100 ? e.note.slice(0, 100) : e.note;
- var t = {
- pageId: ysf.PAGEID,
- template: e.template,
- cardType: e.cardType,
- sendByUser: e.sendByUser,
- auto: e.sendByUser === 1 ? 0 : 1,
- show: e.sendByUser === 1 ? 1 : e.show,
- actionText: e.actionText,
- actionTextColor: e.actionTextColor,
- sendProToRobot: e.sendProToRobot,
- picture: e.picture,
- title: e.title,
- desc: e.desc,
- url: e.url,
- note: e.note,
- price: e.price,
- goodsId: e.goodsId,
- goodsCId: e.goodsCId,
- goodsCName: e.goodsCName,
- intent: e.intent,
- payMoney: e.payMoney,
- orderId: e.orderId,
- orderTime: e.orderTime,
- orderSku: e.orderSku,
- orderCount: e.orderCount,
- orderStatus: e.orderStatus,
- orderStageType: e.orderStageType,
- floatCardSend: e.floatCardSend || 0,
- info: e.info || {},
- agentId: e.agentId || ""
- };
- if (e.tags && util.isArray(e.tags)) {
- t.tags = JSON.stringify(e.tags);
- }
- if (e.sendKefuOffline) {
- t.sendKefuOffline = e.sendKefuOffline;
- }
- if (e.customLabel) {
- t.customLabel = JSON.stringify(e.customLabel);
- }
- if (e.params) {
- t.params = e.params;
- }
- if (!!n.bid) {
- t.bid = n.bid;
- }
- return t;
- };
- ysf.product = function(e) {
- var t = Pe(e);
- fe({
- data: t,
- success: e.success,
- error: e.error
- });
- };
- ysf.clearProduct = function(e) {
- e = e || {};
- ysf.product({
- clear: true,
- success: e.success,
- error: e.error
- });
- };
- var Ce = function(e) {
- if (e.clear) {
- return null;
- }
- var t = {
- uuid: e.uuid,
- type: e.type,
- cards: e.cards || [],
- floatCards: e.floatCards || [],
- auto: e.sendByUser === 1 ? 0 : 1,
- sendByUser: e.sendByUser,
- sendKefuOffline: e.sendKefuOffline || 0,
- sendProToRobot: e.sendProToRobot,
- intent: e.intent,
- params: e.params || {}
- };
- if (e.sendByUser === 1) {
- if (e.actionText) {
- t.actionText = e.actionText;
- }
- if (e.actionTextColor) {
- t.actionTextColor = e.actionTextColor;
- }
- if (e.hideAction) {
- t.hideAction = e.hideAction;
- }
- }
- if (!!n.bid) {
- t.bid = n.bid;
- }
- return t;
- };
- ysf.cardMessage = function(e) {
- if (e.clear) {
- de({
- data: null,
- success: e.success,
- error: e.error
- });
- return;
- }
- if (!e.cards || e.cards.length === 0) {
- console.error("cards is required");
- e.error && e.error("cards is required");
- return;
- }
- var t = Ce(e);
- de({
- data: t,
- success: e.success,
- error: e.error
- });
- };
- var Le = function(e) {
- if (e.data === undefined || e.data === null) {
- return null;
- }
- var t = {
- uuid: e.uuid,
- data: e.data,
- description: e.description || "",
- auto: e.sendByUser === 1 ? 0 : 1,
- sendByUser: e.sendByUser
- };
- if (e.sendByUser === 1) {
- if (e.actionText) {
- t.actionText = e.actionText;
- }
- if (e.actionTextColor) {
- t.actionTextColor = e.actionTextColor;
- }
- if (e.hideAction) {
- t.hideAction = e.hideAction;
- }
- }
- if (!!n.bid) {
- t.bid = n.bid;
- }
- return t;
- };
- ysf.customMessage = function(e) {
- var t = Le(e);
- me({
- data: t,
- success: e.success,
- error: e.error
- });
- };
- ysf.sendProduct = function(e) {
- var t = e.success;
- var i = e.error;
- delete e.success;
- delete e.error;
- var n = Pe(e);
- M({
- type: "sendProduct",
- data: n
- }).then(t).catch(i);
- };
- ysf.sendCardMessage = function(e) {
- if (!e.cards || e.cards.length === 0) {
- console.error("cards is required");
- e.error && e.error("cards is required");
- return;
- }
- var t = e.success;
- var i = e.error;
- delete e.success;
- delete e.error;
- var n = Ce(e);
- M({
- type: "sendCardMessage",
- data: n
- }).then(t).catch(i);
- };
- ysf.clearCustomCard = function(e) {
- e = e || {};
- ysf.cardMessage({
- clear: true,
- success: e.success,
- error: e.error
- });
- };
- ysf.sendCustomMessage = function(e) {
- var t = e.success;
- var i = e.error;
- delete e.success;
- delete e.error;
- var n = Le(e);
- M({
- type: "sendCustomMessage",
- data: n
- }).then(t).catch(i);
- };
- ysf.open = function(e, t, o) {
- w = e;
- var r = ysf.url(e, t, o);
- if (!r) {
- return;
- }
- var a = t || i.type;
- switch (a) {
- case "win":
- ysf.openWin(r, i, o);
- break;
- case "layer":
- ysf.openInline(r, (function() {
- var i = e && e.invitePatternVo && e.invitePatternVo.screenType == 2 && util.isMobilePlatform() ? "" : t;
- ysf.openLayer(i);
- try {
- if (s && n["dvcswitch"] == 0) {
- Y("doconnect", {
- doconnect: 1
- });
- s = false;
- }
- } catch (e) {}
- if (n["dvcswitch"] == 0 && n["pushswitch"] == 1 || f > 0) {
- Y("dopushmsgread", {
- ids: d
- });
- d = [];
- }
- if (!s && n["notifyNumber"] > 0) {
- Y("doconnect");
- }
- ysf.NotifyMsgAndBubble({
- category: "clearCircle"
- });
- }));
- break;
- case "url":
- ysf.openUrl(r, i, o);
- break;
- }
- };
- ysf.init = function(e, t, i) {
- window.inviteSetting = t || {};
- var o = function() {
- ysf.entry({
- src: e,
- inviteSetting: t || {}
- });
- var o = t && t.invitePatternVo && t.invitePatternVo.mode === 2 && t.switchType === 1;
- if (util.isFrameModule() || o) {
- ysf.entryPanel(n["corpInfo"], i);
- }
- ysf.showInviteLayerAuto(t);
- };
- if (util.isFrameModule()) {
- setTimeout((function() {
- util.ajax({
- url: ysf.DOMAIN + "webapi/user/dvcSession.action?appKey=" + n["appKey"] + "&d=" + n["device"] + "&f=" + n["uid"],
- method: "post",
- success: function(e) {
- v = true;
- n["dvcswitch"] = e.dvcSwitch;
- n["pushswitch"] = e.pushSwitch || 0;
- n["pushmsgid"] = e.batchIdList || 0;
- if (util.isFrameModule() == "mobileFrame") {
- n["dvcswitch"] = 0;
- }
- o();
- if (g && !h) {
- h = true;
- for (var t = 0; t < y.length; t++) {
- var i = y[t], r = i.func, a = i.arg;
- r.apply(null, a);
- }
- }
- },
- error: function() {
- v = true;
- n["dvcswitch"] = 0;
- n["pushswitch"] = 0;
- o();
- if (g && !h) {
- h = true;
- for (var e = 0; e < y.length; e++) {
- var t = y[e], i = t.func, r = t.arg;
- i.apply(null, r);
- }
- }
- }
- });
- }), 1e3);
- } else {
- n["dvcswitch"] = 0;
- n["pushswitch"] = 0;
- o();
- }
- };
- ysf.reset = function(e) {
- if (activePreviewRequest) {
- J(activePreviewRequest, "cancel", false);
- }
- var t = document.getElementById("YSF-PANEL-CORPINFO") || document.getElementById("YSF-PANEL-INFO") || document.getElementById("YSF-PANEL-MOBILE"), i = document.getElementById("YSF-BTN-HOLDER");
- delete ysf.openInline.loadStatus;
- document.body.removeChild(t);
- document.body.removeChild(i);
- ysf.init(n["imgSrc"], window.inviteSetting, {
- success: e && e.success,
- error: e && e.error
- });
- s = true;
- };
- util.addEvent(window, "beforeunload", (function() {
- var e = "YSFDVC-" + n["device"], t = "YSFMSG-" + n["appKey"], i = Number(localStorage.getItem(e));
- if (i > 0) {
- localStorage.setItem(e, --i);
- }
- util.clearLocalItems(util.findLocalItems(new RegExp(t, "ig")));
- }));
- ysf.on = function() {
- var e = {
- onload: "load",
- unread: 1
- };
- return function(e) {
- var t = Object.prototype.toString.call(e).slice(8, -1);
- if (/object/gi.test(t)) {
- for (var i in e) {
- if ("onload" == i && util.isFunction(e[i])) {
- if (!g) {
- util.addLoadEventForProxy(e[i]);
- } else {
- e[i]();
- }
- } else if ("onLayerload" == i && util.isFunction(e[i])) {
- if (ysf.openInline.loadStatus == "loaded") {
- e[i]();
- } else {
- ysf["_" + i] = e[i];
- }
- } else if (util.isFunction(ysf[i]) && util.isFunction(e[i])) {
- ysf["_" + i] = e[i];
- }
- }
- } else {
- util.consoleWarn("波比(。・∀・)ノ: 请保持正确的监听姿势...");
- }
- };
- }();
- ysf.getPushMessage = function(e) {
- Y("dogetpushmsg", {
- ids: e
- });
- };
- ysf._unread = function() {};
- ysf.unread = function() {
- return {
- type: n["notifyContent"].type,
- message: n["notifyContent"].content,
- total: n["notifyNumber"]
- };
- };
- ysf._onLayerload = function() {};
- ysf.clearDragresize = function(e) {
- try {
- var t = window.location.hostname.split(".")[0];
- var i = [ "callcenter", "session", "qualitysession", "qualitycallsession", "worksheet", "callflow", "leave", "monitor", "usercenter" ];
- if (i.indexOf(e) > -1) {
- util.clearLocalItems(util.findLocalItems(new RegExp(t + "-" + e, "ig")));
- } else {
- for (var n = 0; n < i.length; n++) {
- util.clearLocalItems(util.findLocalItems(new RegExp(t + "-" + i[n], "ig")));
- }
- }
- } catch (e) {}
- };
- ysf.setAuthToken = ysf.setToken = function(e) {
- n["authToken"] = e;
- le({});
- };
- ysf.pollAuthToken = function() {
- var e = 0;
- var t = -1;
- var i = 4;
- return function(n, o) {
- var r = function(i) {
- var r = i && i.authToken;
- if (!r) {
- util.consoleError("result has not token", i);
- return;
- }
- ysf.setAuthToken(i.authToken);
- e = 0;
- clearInterval(t);
- t = setTimeout((function() {
- ysf.pollAuthToken(n, o);
- }), o.interval);
- if (util.isFunction(o.onsuccess)) {
- o.onsuccess(i);
- }
- };
- var a = function(t) {
- if (e < i) {
- e++;
- ysf.pollAuthToken(n, o);
- }
- if (util.isFunction(o.onerror)) {
- o.onerror(t);
- }
- }, s = o.method || "GET";
- i = o.tryTime || 4;
- if (o.interval === null) {
- util.consoleError("pollauthtoken is not set interval", o);
- return;
- }
- util.ajax({
- url: n,
- method: s,
- data: o.data,
- success: r,
- error: a
- });
- };
- }();
- function Ye(e, t) {
- var i = ysf[e];
- if (!util.isFunction(i)) {
- return;
- }
- if (g) {
- return i.apply(null, t);
- } else {
- switch (e) {
- case "onready":
- case "onLayerload":
- case "onunread":
- case "config":
- case "product":
- case "logoff":
- case "setAuthToken":
- case "pollAuthToken":
- case "onConversation":
- case "onSessionMessage":
- case "getConversation":
- case "cardMessage":
- case "customMessage":
- y.push({
- func: i,
- arg: t
- });
- break;
- case "open":
- case "url":
- case "track":
- case "getUnreadMsg":
- util.consoleWarn("can not exec" + e + "before sdk ready");
- default:
- break;
- }
- }
- }
- ysf.onready = function(e) {
- util.isFunction(e) && e();
- };
- ysf.onunread = function(e) {
- ysf.on({
- unread: e
- });
- };
- ysf.onLayerload = function(e) {
- ysf.on({
- onLayerload: e
- });
- };
- ysf.getConversation = function(e) {
- ysf.on({
- getConversation: e
- });
- };
- ysf._getConversation = function() {};
- ysf.onConversation = function(e) {
- ysf.on({
- onConversation: e
- });
- n["onConversation"] = true;
- };
- ysf._onConversation = function() {};
- ysf.onSessionMessage = function(e) {
- ysf.on({
- onSessionMessage: e
- });
- };
- ysf._onSessionMessage = function() {};
- ysf.initData = function() {
- each({
- DOMAIN: ysf.ROOT + "/",
- IMROOT: function() {
- var e = "/client/iframe";
- if (util.isMobilePlatform() && window.__YSFMODILEWINTYPE__ === 2) {
- e = "/client";
- } else if (!util.isMobilePlatform() && window.__YSFWINTYPE__ == 1) {
- e = "/client/iframe";
- } else {
- e = "/client";
- }
- var t = ysf.ROOT + e;
- return t;
- }(),
- RESROOT: ysf.ROOT + "/sdk/",
- CDNROOT: "//res.qiyukf.net/sdk/",
- INVITE_TPYE: "layer"
- }, (function(e, t) {
- ysf[e] = t;
- }));
- };
- ysf.buildProxy = Se;
- (function() {
- ysf.initData();
- x();
- ysf.PAGEID = N();
- window.__YSFAPPPATH__ = "/sdk/";
- for (var e = 0; e < _.length; e++) {
- try {
- var t = _[e], i = t[0], n = Array.prototype.slice.call(t, 1);
- Ye(i, n);
- } catch (e) {
- util.consoleWarn(e);
- }
- }
- })();
- }
- })();
- })();
|