ueditor.all.min-1.js 695 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328
  1. /*!
  2. * UEditor
  3. * version: ueditor
  4. * build: Wed Dec 26 2018 17:24:52 GMT+0800 (CST)
  5. */
  6. !(function () {
  7. function getListener(a, b, c) {
  8. var d
  9. return (
  10. (b = b.toLowerCase()),
  11. (d = a.__allListeners || (c && (a.__allListeners = {}))) &&
  12. (d[b] || (c && (d[b] = [])))
  13. )
  14. }
  15. function getDomNode(a, b, c, d, e, f) {
  16. var g,
  17. h = d && a[b]
  18. for (!h && (h = a[c]); !h && (g = (g || a).parentNode); ) {
  19. if ('BODY' == g.tagName || (f && !f(g))) return null
  20. h = g[c]
  21. }
  22. return h && e && !e(h) ? getDomNode(h, b, c, !1, e) : h
  23. }
  24. UEDITOR_CONFIG = window.UEDITOR_CONFIG || {}
  25. var baidu = window.baidu || {}
  26. ;(window.baidu = baidu),
  27. (window.UE = baidu.editor = window.UE || {}),
  28. (UE.plugins = {}),
  29. (UE.commands = {}),
  30. (UE.instants = {}),
  31. (UE.I18N = {}),
  32. (UE._customizeUI = {}),
  33. (UE.version = '1.4.3')
  34. var dom = (UE.dom = {}),
  35. browser = (UE.browser = (function () {
  36. var a = navigator.userAgent.toLowerCase(),
  37. b = window.opera,
  38. c = {
  39. ie: /(msie\s|trident.*rv:)([\w.]+)/.test(a),
  40. opera: !!b && b.version,
  41. webkit: a.indexOf(' applewebkit/') > -1,
  42. mac: a.indexOf('macintosh') > -1,
  43. quirks: 'BackCompat' == document.compatMode
  44. }
  45. c.gecko = 'Gecko' == navigator.product && !c.webkit && !c.opera && !c.ie
  46. var d = 0
  47. if (c.ie) {
  48. var e = a.match(/(?:msie\s([\w.]+))/),
  49. f = a.match(/(?:trident.*rv:([\w.]+))/)
  50. ;(d =
  51. e && f && e[1] && f[1]
  52. ? Math.max(1 * e[1], 1 * f[1])
  53. : e && e[1]
  54. ? 1 * e[1]
  55. : f && f[1]
  56. ? 1 * f[1]
  57. : 0),
  58. (c.ie11Compat = 11 == document.documentMode),
  59. (c.ie9Compat = 9 == document.documentMode),
  60. (c.ie8 = !!document.documentMode),
  61. (c.ie8Compat = 8 == document.documentMode),
  62. (c.ie7Compat =
  63. (7 == d && !document.documentMode) || 7 == document.documentMode),
  64. (c.ie6Compat = d < 7 || c.quirks),
  65. (c.ie9above = d > 8),
  66. (c.ie9below = d < 9),
  67. (c.ie11above = d > 10),
  68. (c.ie11below = d < 11)
  69. }
  70. if (c.gecko) {
  71. var g = a.match(/rv:([\d\.]+)/)
  72. g &&
  73. ((g = g[1].split('.')),
  74. (d = 1e4 * g[0] + 100 * (g[1] || 0) + 1 * (g[2] || 0)))
  75. }
  76. return (
  77. /chrome\/(\d+\.\d)/i.test(a) && (c.chrome = +RegExp.$1),
  78. /(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(a) &&
  79. !/chrome/i.test(a) &&
  80. (c.safari = +(RegExp.$1 || RegExp.$2)),
  81. c.opera && (d = parseFloat(b.version())),
  82. c.webkit && (d = parseFloat(a.match(/ applewebkit\/(\d+)/)[1])),
  83. (c.version = d),
  84. (c.isCompatible =
  85. !c.mobile &&
  86. ((c.ie && d >= 6) ||
  87. (c.gecko && d >= 10801) ||
  88. (c.opera && d >= 9.5) ||
  89. (c.air && d >= 1) ||
  90. (c.webkit && d >= 522) ||
  91. !1)),
  92. c
  93. )
  94. })()),
  95. ie = browser.ie,
  96. webkit = browser.webkit,
  97. gecko = browser.gecko,
  98. opera = browser.opera,
  99. utils = (UE.utils = {
  100. each: function (a, b, c) {
  101. if (null != a)
  102. if (a.length === +a.length) {
  103. for (var d = 0, e = a.length; d < e; d++)
  104. if (b.call(c, a[d], d, a) === !1) return !1
  105. } else
  106. for (var f in a)
  107. if (a.hasOwnProperty(f) && b.call(c, a[f], f, a) === !1) return !1
  108. },
  109. makeInstance: function (a) {
  110. var b = new Function()
  111. return (b.prototype = a), (a = new b()), (b.prototype = null), a
  112. },
  113. extend: function (a, b, c) {
  114. if (b) for (var d in b) (c && a.hasOwnProperty(d)) || (a[d] = b[d])
  115. return a
  116. },
  117. extend2: function (a) {
  118. for (var b = arguments, c = 1; c < b.length; c++) {
  119. var d = b[c]
  120. for (var e in d) a.hasOwnProperty(e) || (a[e] = d[e])
  121. }
  122. return a
  123. },
  124. inherits: function (a, b) {
  125. var c = a.prototype,
  126. d = utils.makeInstance(b.prototype)
  127. return utils.extend(d, c, !0), (a.prototype = d), (d.constructor = a)
  128. },
  129. bind: function (a, b) {
  130. return function () {
  131. return a.apply(b, arguments)
  132. }
  133. },
  134. defer: function (a, b, c) {
  135. var d
  136. return function () {
  137. c && clearTimeout(d), (d = setTimeout(a, b))
  138. }
  139. },
  140. indexOf: function (a, b, c) {
  141. var d = -1
  142. return (
  143. (c = this.isNumber(c) ? c : 0),
  144. this.each(a, function (a, e) {
  145. if (e >= c && a === b) return (d = e), !1
  146. }),
  147. d
  148. )
  149. },
  150. removeItem: function (a, b) {
  151. for (var c = 0, d = a.length; c < d; c++)
  152. a[c] === b && (a.splice(c, 1), c--)
  153. },
  154. trim: function (a) {
  155. return a.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g, '')
  156. },
  157. listToMap: function (a) {
  158. if (!a) return {}
  159. a = utils.isArray(a) ? a : a.split(',')
  160. for (var b, c = 0, d = {}; (b = a[c++]); ) d[b.toUpperCase()] = d[b] = 1
  161. return d
  162. },
  163. unhtml: function (a, b) {
  164. return a
  165. ? a.replace(
  166. b || /[&<">'](?:(amp|lt|quot|gt|#39|nbsp|#\d+);)?/g,
  167. function (a, b) {
  168. return b
  169. ? a
  170. : {
  171. '<': '&lt;',
  172. '&': '&amp;',
  173. '"': '&quot;',
  174. '>': '&gt;',
  175. "'": '&#39;'
  176. }[a]
  177. }
  178. )
  179. : ''
  180. },
  181. unhtmlForUrl: function (a, b) {
  182. return a
  183. ? a.replace(b || /[<">']/g, function (a) {
  184. return {
  185. '<': '&lt;',
  186. '&': '&amp;',
  187. '"': '&quot;',
  188. '>': '&gt;',
  189. "'": '&#39;'
  190. }[a]
  191. })
  192. : ''
  193. },
  194. html: function (a) {
  195. return a
  196. ? a.replace(/&((g|l|quo)t|amp|#39|nbsp);/g, function (a) {
  197. return {
  198. '&lt;': '<',
  199. '&amp;': '&',
  200. '&quot;': '"',
  201. '&gt;': '>',
  202. '&#39;': "'",
  203. '&nbsp;': ' '
  204. }[a]
  205. })
  206. : ''
  207. },
  208. cssStyleToDomStyle: (function () {
  209. var a = document.createElement('div').style,
  210. b = {
  211. float:
  212. void 0 != a.cssFloat
  213. ? 'cssFloat'
  214. : void 0 != a.styleFloat
  215. ? 'styleFloat'
  216. : 'float'
  217. }
  218. return function (a) {
  219. return (
  220. b[a] ||
  221. (b[a] = a.toLowerCase().replace(/-./g, function (a) {
  222. return a.charAt(1).toUpperCase()
  223. }))
  224. )
  225. }
  226. })(),
  227. loadFile: (function () {
  228. function a(a, c) {
  229. try {
  230. for (var d, e = 0; (d = b[e++]); )
  231. if (d.doc === a && d.url == (c.src || c.href)) return d
  232. } catch (f) {
  233. return null
  234. }
  235. }
  236. var b = []
  237. return function (c, d, e) {
  238. var f = a(c, d)
  239. if (f) return void (f.ready ? e && e() : f.funs.push(e))
  240. if ((b.push({ doc: c, url: d.src || d.href, funs: [e] }), !c.body)) {
  241. var g = []
  242. for (var h in d) 'tag' != h && g.push(h + '="' + d[h] + '"')
  243. return void c.write(
  244. '<' + d.tag + ' ' + g.join(' ') + ' ></' + d.tag + '>'
  245. )
  246. }
  247. if (!d.id || !c.getElementById(d.id)) {
  248. var i = c.createElement(d.tag)
  249. delete d.tag
  250. for (var h in d) i.setAttribute(h, d[h])
  251. ;(i.onload = i.onreadystatechange =
  252. function () {
  253. if (
  254. !this.readyState ||
  255. /loaded|complete/.test(this.readyState)
  256. ) {
  257. if (((f = a(c, d)), f.funs.length > 0)) {
  258. f.ready = 1
  259. for (var b; (b = f.funs.pop()); ) b()
  260. }
  261. i.onload = i.onreadystatechange = null
  262. }
  263. }),
  264. (i.onerror = function () {
  265. throw Error(
  266. 'The load ' +
  267. (d.href || d.src) +
  268. ' fails,check the url settings of file ueditor.config.js '
  269. )
  270. }),
  271. c.getElementsByTagName('head')[0].appendChild(i)
  272. }
  273. }
  274. })(),
  275. isEmptyObject: function (a) {
  276. if (null == a) return !0
  277. if (this.isArray(a) || this.isString(a)) return 0 === a.length
  278. for (var b in a) if (a.hasOwnProperty(b)) return !1
  279. return !0
  280. },
  281. fixColor: function (a, b) {
  282. if (/color/i.test(a) && /rgba?/.test(b)) {
  283. var c = b.split(',')
  284. if (c.length > 3) return ''
  285. b = '#'
  286. for (var d, e = 0; (d = c[e++]); )
  287. (d = parseInt(d.replace(/[^\d]/gi, ''), 10).toString(16)),
  288. (b += 1 == d.length ? '0' + d : d)
  289. b = b.toUpperCase()
  290. }
  291. return b
  292. },
  293. optCss: function (a) {
  294. function b(a, b) {
  295. if (!a) return ''
  296. var c = a.top,
  297. d = a.bottom,
  298. e = a.left,
  299. f = a.right,
  300. g = ''
  301. if (c && e && d && f)
  302. g +=
  303. ';' +
  304. b +
  305. ':' +
  306. (c == d && d == e && e == f
  307. ? c
  308. : c == d && e == f
  309. ? c + ' ' + e
  310. : e == f
  311. ? c + ' ' + e + ' ' + d
  312. : c + ' ' + f + ' ' + d + ' ' + e) +
  313. ';'
  314. else for (var h in a) g += ';' + b + '-' + h + ':' + a[h] + ';'
  315. return g
  316. }
  317. var c, d
  318. return (
  319. (a = a.replace(
  320. /(padding|margin|border)\-([^:]+):([^;]+);?/gi,
  321. function (a, b, e, f) {
  322. if (1 == f.split(' ').length)
  323. switch (b) {
  324. case 'padding':
  325. return !c && (c = {}), (c[e] = f), ''
  326. case 'margin':
  327. return !d && (d = {}), (d[e] = f), ''
  328. case 'border':
  329. return 'initial' == f ? '' : a
  330. }
  331. return a
  332. }
  333. )),
  334. (a += b(c, 'padding') + b(d, 'margin')),
  335. a
  336. .replace(/^[ \n\r\t;]*|[ \n\r\t]*$/, '')
  337. .replace(/;([ \n\r\t]+)|\1;/g, ';')
  338. .replace(/(&((l|g)t|quot|#39))?;{2,}/g, function (a, b) {
  339. return b ? b + ';;' : ';'
  340. })
  341. )
  342. },
  343. clone: function (a, b) {
  344. var c
  345. b = b || {}
  346. for (var d in a)
  347. a.hasOwnProperty(d) &&
  348. ((c = a[d]),
  349. 'object' == typeof c
  350. ? ((b[d] = utils.isArray(c) ? [] : {}), utils.clone(a[d], b[d]))
  351. : (b[d] = c))
  352. return b
  353. },
  354. transUnitToPx: function (a) {
  355. if (!/(pt|cm)/.test(a)) return a
  356. var b
  357. switch (
  358. (a.replace(/([\d.]+)(\w+)/, function (c, d, e) {
  359. ;(a = d), (b = e)
  360. }),
  361. b)
  362. ) {
  363. case 'cm':
  364. a = 25 * parseFloat(a)
  365. break
  366. case 'pt':
  367. a = Math.round((96 * parseFloat(a)) / 72)
  368. }
  369. return a + (a ? 'px' : '')
  370. },
  371. domReady: (function () {
  372. function a(a) {
  373. a.isReady = !0
  374. for (var c; (c = b.pop()); c());
  375. }
  376. var b = []
  377. return function (c, d) {
  378. d = d || window
  379. var e = d.document
  380. c && b.push(c),
  381. 'complete' === e.readyState
  382. ? a(e)
  383. : (e.isReady && a(e),
  384. browser.ie && 11 != browser.version
  385. ? (!(function () {
  386. if (!e.isReady) {
  387. try {
  388. e.documentElement.doScroll('left')
  389. } catch (b) {
  390. return void setTimeout(arguments.callee, 0)
  391. }
  392. a(e)
  393. }
  394. })(),
  395. d.attachEvent('onload', function () {
  396. a(e)
  397. }))
  398. : (e.addEventListener(
  399. 'DOMContentLoaded',
  400. function () {
  401. e.removeEventListener(
  402. 'DOMContentLoaded',
  403. arguments.callee,
  404. !1
  405. ),
  406. a(e)
  407. },
  408. !1
  409. ),
  410. d.addEventListener(
  411. 'load',
  412. function () {
  413. a(e)
  414. },
  415. !1
  416. )))
  417. }
  418. })(),
  419. cssRule:
  420. browser.ie && 11 != browser.version
  421. ? function (a, b, c) {
  422. var d, e
  423. if (void 0 === b || (b && b.nodeType && 9 == b.nodeType)) {
  424. if (
  425. ((c = b && b.nodeType && 9 == b.nodeType ? b : c || document),
  426. (d = c.indexList || (c.indexList = {})),
  427. (e = d[a]),
  428. void 0 !== e)
  429. )
  430. return c.styleSheets[e].cssText
  431. } else {
  432. if (
  433. ((c = c || document),
  434. (d = c.indexList || (c.indexList = {})),
  435. (e = d[a]),
  436. '' === b)
  437. )
  438. return (
  439. void 0 !== e &&
  440. ((c.styleSheets[e].cssText = ''), delete d[a], !0)
  441. )
  442. void 0 !== e
  443. ? (sheetStyle = c.styleSheets[e])
  444. : ((sheetStyle = c.createStyleSheet(
  445. '',
  446. (e = c.styleSheets.length)
  447. )),
  448. (d[a] = e)),
  449. (sheetStyle.cssText = b)
  450. }
  451. }
  452. : function (a, b, c) {
  453. var d
  454. return void 0 === b || (b && b.nodeType && 9 == b.nodeType)
  455. ? ((c = b && b.nodeType && 9 == b.nodeType ? b : c || document),
  456. (d = c.getElementById(a)),
  457. d ? d.innerHTML : void 0)
  458. : ((c = c || document),
  459. (d = c.getElementById(a)),
  460. '' === b
  461. ? !!d && (d.parentNode.removeChild(d), !0)
  462. : void (d
  463. ? (d.innerHTML = b)
  464. : ((d = c.createElement('style')),
  465. (d.id = a),
  466. (d.innerHTML = b),
  467. c.getElementsByTagName('head')[0].appendChild(d))))
  468. },
  469. sort: function (a, b) {
  470. b =
  471. b ||
  472. function (a, b) {
  473. return a.localeCompare(b)
  474. }
  475. for (var c = 0, d = a.length; c < d; c++)
  476. for (var e = c, f = a.length; e < f; e++)
  477. if (b(a[c], a[e]) > 0) {
  478. var g = a[c]
  479. ;(a[c] = a[e]), (a[e] = g)
  480. }
  481. return a
  482. },
  483. serializeParam: function (a) {
  484. var b = []
  485. for (var c in a)
  486. if ('method' != c && 'timeout' != c && 'async' != c)
  487. if (
  488. 'function' != (typeof a[c]).toLowerCase() &&
  489. 'object' != (typeof a[c]).toLowerCase()
  490. )
  491. b.push(encodeURIComponent(c) + '=' + encodeURIComponent(a[c]))
  492. else if (utils.isArray(a[c]))
  493. for (var d = 0; d < a[c].length; d++)
  494. b.push(
  495. encodeURIComponent(c) + '[]=' + encodeURIComponent(a[c][d])
  496. )
  497. return b.join('&')
  498. },
  499. formatUrl: function (a) {
  500. var b = a.replace(/&&/g, '&')
  501. return (
  502. (b = b.replace(/\?&/g, '?')),
  503. (b = b.replace(/&$/g, '')),
  504. (b = b.replace(/&#/g, '#')),
  505. (b = b.replace(/&+/g, '&'))
  506. )
  507. },
  508. isCrossDomainUrl: function (a) {
  509. var b = document.createElement('a')
  510. return (
  511. (b.href = a),
  512. browser.ie && (b.href = b.href),
  513. !(
  514. b.protocol == location.protocol &&
  515. b.hostname == location.hostname &&
  516. (b.port == location.port ||
  517. ('80' == b.port && '' == location.port) ||
  518. ('' == b.port && '80' == location.port))
  519. )
  520. )
  521. },
  522. clearEmptyAttrs: function (a) {
  523. for (var b in a) '' === a[b] && delete a[b]
  524. return a
  525. },
  526. str2json: function (a) {
  527. return utils.isString(a)
  528. ? window.JSON
  529. ? JSON.parse(a)
  530. : new Function('return ' + utils.trim(a || ''))()
  531. : null
  532. },
  533. json2str: (function () {
  534. function a(a) {
  535. return (
  536. /["\\\x00-\x1f]/.test(a) &&
  537. (a = a.replace(/["\\\x00-\x1f]/g, function (a) {
  538. var b = e[a]
  539. return b
  540. ? b
  541. : ((b = a.charCodeAt()),
  542. '\\u00' +
  543. Math.floor(b / 16).toString(16) +
  544. (b % 16).toString(16))
  545. })),
  546. '"' + a + '"'
  547. )
  548. }
  549. function b(a) {
  550. var b,
  551. c,
  552. d,
  553. e = ['['],
  554. f = a.length
  555. for (c = 0; c < f; c++)
  556. switch (((d = a[c]), typeof d)) {
  557. case 'undefined':
  558. case 'function':
  559. case 'unknown':
  560. break
  561. default:
  562. b && e.push(','), e.push(utils.json2str(d)), (b = 1)
  563. }
  564. return e.push(']'), e.join('')
  565. }
  566. function c(a) {
  567. return a < 10 ? '0' + a : a
  568. }
  569. function d(a) {
  570. return (
  571. '"' +
  572. a.getFullYear() +
  573. '-' +
  574. c(a.getMonth() + 1) +
  575. '-' +
  576. c(a.getDate()) +
  577. 'T' +
  578. c(a.getHours()) +
  579. ':' +
  580. c(a.getMinutes()) +
  581. ':' +
  582. c(a.getSeconds()) +
  583. '"'
  584. )
  585. }
  586. if (window.JSON) return JSON.stringify
  587. var e = {
  588. '\b': '\\b',
  589. '\t': '\\t',
  590. '\n': '\\n',
  591. '\f': '\\f',
  592. '\r': '\\r',
  593. '"': '\\"',
  594. '\\': '\\\\'
  595. }
  596. return function (c) {
  597. switch (typeof c) {
  598. case 'undefined':
  599. return 'undefined'
  600. case 'number':
  601. return isFinite(c) ? String(c) : 'null'
  602. case 'string':
  603. return a(c)
  604. case 'boolean':
  605. return String(c)
  606. default:
  607. if (null === c) return 'null'
  608. if (utils.isArray(c)) return b(c)
  609. if (utils.isDate(c)) return d(c)
  610. var e,
  611. f,
  612. g = ['{'],
  613. h = utils.json2str
  614. for (var i in c)
  615. if (Object.prototype.hasOwnProperty.call(c, i))
  616. switch (((f = c[i]), typeof f)) {
  617. case 'undefined':
  618. case 'unknown':
  619. case 'function':
  620. break
  621. default:
  622. e && g.push(','), (e = 1), g.push(h(i) + ':' + h(f))
  623. }
  624. return g.push('}'), g.join('')
  625. }
  626. }
  627. })()
  628. })
  629. utils.each(
  630. ['String', 'Function', 'Array', 'Number', 'RegExp', 'Object', 'Date'],
  631. function (a) {
  632. UE.utils['is' + a] = function (b) {
  633. return Object.prototype.toString.apply(b) == '[object ' + a + ']'
  634. }
  635. }
  636. )
  637. var EventBase = (UE.EventBase = function () {})
  638. EventBase.prototype = {
  639. addListener: function (a, b) {
  640. a = utils.trim(a).split(/\s+/)
  641. for (var c, d = 0; (c = a[d++]); ) getListener(this, c, !0).push(b)
  642. },
  643. on: function (a, b) {
  644. return this.addListener(a, b)
  645. },
  646. off: function (a, b) {
  647. return this.removeListener(a, b)
  648. },
  649. trigger: function () {
  650. return this.fireEvent.apply(this, arguments)
  651. },
  652. removeListener: function (a, b) {
  653. a = utils.trim(a).split(/\s+/)
  654. for (var c, d = 0; (c = a[d++]); )
  655. utils.removeItem(getListener(this, c) || [], b)
  656. },
  657. fireEvent: function () {
  658. var a = arguments[0]
  659. a = utils.trim(a).split(' ')
  660. for (var b, c = 0; (b = a[c++]); ) {
  661. var d,
  662. e,
  663. f,
  664. g = getListener(this, b)
  665. if (g)
  666. for (f = g.length; f--; )
  667. if (g[f]) {
  668. if (((e = g[f].apply(this, arguments)), e === !0)) return e
  669. void 0 !== e && (d = e)
  670. }
  671. ;(e = this['on' + b.toLowerCase()]) && (d = e.apply(this, arguments))
  672. }
  673. return d
  674. }
  675. }
  676. var dtd = (dom.dtd = (function () {
  677. function a(a) {
  678. for (var b in a) a[b.toUpperCase()] = a[b]
  679. return a
  680. }
  681. var b = utils.extend2,
  682. c = a({ isindex: 1, fieldset: 1 }),
  683. d = a({ input: 1, button: 1, select: 1, textarea: 1, label: 1 }),
  684. e = b(a({ a: 1 }), d),
  685. f = b({ iframe: 1 }, e),
  686. g = a({
  687. hr: 1,
  688. ul: 1,
  689. menu: 1,
  690. div: 1,
  691. blockquote: 1,
  692. noscript: 1,
  693. table: 1,
  694. center: 1,
  695. address: 1,
  696. dir: 1,
  697. pre: 1,
  698. h5: 1,
  699. dl: 1,
  700. h4: 1,
  701. noframes: 1,
  702. h6: 1,
  703. ol: 1,
  704. h1: 1,
  705. h3: 1,
  706. h2: 1
  707. }),
  708. h = a({ ins: 1, del: 1, script: 1, style: 1 }),
  709. i = b(
  710. a({
  711. b: 1,
  712. acronym: 1,
  713. bdo: 1,
  714. var: 1,
  715. '#': 1,
  716. abbr: 1,
  717. code: 1,
  718. br: 1,
  719. i: 1,
  720. cite: 1,
  721. kbd: 1,
  722. u: 1,
  723. strike: 1,
  724. s: 1,
  725. tt: 1,
  726. strong: 1,
  727. q: 1,
  728. samp: 1,
  729. em: 1,
  730. dfn: 1,
  731. span: 1
  732. }),
  733. h
  734. ),
  735. j = b(
  736. a({
  737. sub: 1,
  738. img: 1,
  739. embed: 1,
  740. object: 1,
  741. sup: 1,
  742. basefont: 1,
  743. map: 1,
  744. applet: 1,
  745. font: 1,
  746. big: 1,
  747. small: 1
  748. }),
  749. i
  750. ),
  751. k = b(a({ p: 1 }), j),
  752. l = b(a({ iframe: 1 }), j, d),
  753. m = a({
  754. img: 1,
  755. embed: 1,
  756. noscript: 1,
  757. br: 1,
  758. kbd: 1,
  759. center: 1,
  760. button: 1,
  761. basefont: 1,
  762. h5: 1,
  763. h4: 1,
  764. samp: 1,
  765. h6: 1,
  766. ol: 1,
  767. h1: 1,
  768. h3: 1,
  769. h2: 1,
  770. form: 1,
  771. font: 1,
  772. '#': 1,
  773. select: 1,
  774. menu: 1,
  775. ins: 1,
  776. abbr: 1,
  777. label: 1,
  778. code: 1,
  779. table: 1,
  780. script: 1,
  781. cite: 1,
  782. input: 1,
  783. iframe: 1,
  784. strong: 1,
  785. textarea: 1,
  786. noframes: 1,
  787. big: 1,
  788. small: 1,
  789. span: 1,
  790. hr: 1,
  791. sub: 1,
  792. bdo: 1,
  793. var: 1,
  794. div: 1,
  795. object: 1,
  796. sup: 1,
  797. strike: 1,
  798. dir: 1,
  799. map: 1,
  800. dl: 1,
  801. applet: 1,
  802. del: 1,
  803. isindex: 1,
  804. fieldset: 1,
  805. ul: 1,
  806. b: 1,
  807. acronym: 1,
  808. a: 1,
  809. blockquote: 1,
  810. i: 1,
  811. u: 1,
  812. s: 1,
  813. tt: 1,
  814. address: 1,
  815. q: 1,
  816. pre: 1,
  817. p: 1,
  818. em: 1,
  819. dfn: 1
  820. }),
  821. n = b(a({ a: 0 }), l),
  822. o = a({ tr: 1 }),
  823. p = a({ '#': 1 }),
  824. q = b(a({ param: 1 }), m),
  825. r = b(a({ form: 1 }), c, f, g, k),
  826. s = a({ li: 1, ol: 1, ul: 1 }),
  827. t = a({ style: 1, script: 1 }),
  828. u = a({ base: 1, link: 1, meta: 1, title: 1 }),
  829. v = b(u, t),
  830. w = a({ head: 1, body: 1 }),
  831. x = a({ html: 1 }),
  832. y = a({
  833. address: 1,
  834. blockquote: 1,
  835. center: 1,
  836. dir: 1,
  837. div: 1,
  838. dl: 1,
  839. fieldset: 1,
  840. form: 1,
  841. h1: 1,
  842. h2: 1,
  843. h3: 1,
  844. h4: 1,
  845. h5: 1,
  846. h6: 1,
  847. hr: 1,
  848. isindex: 1,
  849. menu: 1,
  850. noframes: 1,
  851. ol: 1,
  852. p: 1,
  853. pre: 1,
  854. table: 1,
  855. ul: 1
  856. }),
  857. z = a({
  858. area: 1,
  859. base: 1,
  860. basefont: 1,
  861. br: 1,
  862. col: 1,
  863. command: 1,
  864. dialog: 1,
  865. embed: 1,
  866. hr: 1,
  867. img: 1,
  868. input: 1,
  869. isindex: 1,
  870. keygen: 1,
  871. link: 1,
  872. meta: 1,
  873. param: 1,
  874. source: 1,
  875. track: 1,
  876. wbr: 1
  877. })
  878. return a({
  879. $nonBodyContent: b(x, w, u),
  880. $block: y,
  881. $inline: n,
  882. $inlineWithA: b(a({ a: 1 }), n),
  883. $body: b(a({ script: 1, style: 1 }), y),
  884. $cdata: a({ script: 1, style: 1 }),
  885. $empty: z,
  886. $nonChild: a({ iframe: 1, textarea: 1 }),
  887. $listItem: a({ dd: 1, dt: 1, li: 1 }),
  888. $list: a({ ul: 1, ol: 1, dl: 1 }),
  889. $isNotEmpty: a({
  890. table: 1,
  891. ul: 1,
  892. ol: 1,
  893. dl: 1,
  894. iframe: 1,
  895. area: 1,
  896. base: 1,
  897. col: 1,
  898. hr: 1,
  899. img: 1,
  900. embed: 1,
  901. input: 1,
  902. link: 1,
  903. meta: 1,
  904. param: 1,
  905. h1: 1,
  906. h2: 1,
  907. h3: 1,
  908. h4: 1,
  909. h5: 1,
  910. h6: 1
  911. }),
  912. $removeEmpty: a({
  913. a: 1,
  914. abbr: 1,
  915. acronym: 1,
  916. address: 1,
  917. b: 1,
  918. bdo: 1,
  919. big: 1,
  920. cite: 1,
  921. code: 1,
  922. del: 1,
  923. dfn: 1,
  924. em: 1,
  925. font: 1,
  926. i: 1,
  927. ins: 1,
  928. label: 1,
  929. kbd: 1,
  930. q: 1,
  931. s: 1,
  932. samp: 1,
  933. small: 1,
  934. span: 1,
  935. strike: 1,
  936. strong: 1,
  937. sub: 1,
  938. sup: 1,
  939. tt: 1,
  940. u: 1,
  941. var: 1
  942. }),
  943. $removeEmptyBlock: a({ p: 1, div: 1 }),
  944. $tableContent: a({
  945. caption: 1,
  946. col: 1,
  947. colgroup: 1,
  948. tbody: 1,
  949. td: 1,
  950. tfoot: 1,
  951. th: 1,
  952. thead: 1,
  953. tr: 1,
  954. table: 1
  955. }),
  956. $notTransContent: a({ pre: 1, script: 1, style: 1, textarea: 1 }),
  957. html: w,
  958. head: v,
  959. style: p,
  960. script: p,
  961. body: r,
  962. base: {},
  963. link: {},
  964. meta: {},
  965. title: p,
  966. col: {},
  967. tr: a({ td: 1, th: 1 }),
  968. img: {},
  969. embed: {},
  970. colgroup: a({ thead: 1, col: 1, tbody: 1, tr: 1, tfoot: 1 }),
  971. noscript: r,
  972. td: r,
  973. br: {},
  974. th: r,
  975. center: r,
  976. kbd: n,
  977. button: b(k, g),
  978. basefont: {},
  979. h5: n,
  980. h4: n,
  981. samp: n,
  982. h6: n,
  983. ol: s,
  984. h1: n,
  985. h3: n,
  986. option: p,
  987. h2: n,
  988. form: b(c, f, g, k),
  989. select: a({ optgroup: 1, option: 1 }),
  990. font: n,
  991. ins: n,
  992. menu: s,
  993. abbr: n,
  994. label: n,
  995. table: a({
  996. thead: 1,
  997. col: 1,
  998. tbody: 1,
  999. tr: 1,
  1000. colgroup: 1,
  1001. caption: 1,
  1002. tfoot: 1
  1003. }),
  1004. code: n,
  1005. tfoot: o,
  1006. cite: n,
  1007. li: r,
  1008. input: {},
  1009. iframe: r,
  1010. strong: n,
  1011. textarea: p,
  1012. noframes: r,
  1013. big: n,
  1014. small: n,
  1015. span: a({
  1016. '#': 1,
  1017. br: 1,
  1018. b: 1,
  1019. strong: 1,
  1020. u: 1,
  1021. i: 1,
  1022. em: 1,
  1023. sub: 1,
  1024. sup: 1,
  1025. strike: 1,
  1026. span: 1
  1027. }),
  1028. hr: n,
  1029. dt: n,
  1030. sub: n,
  1031. optgroup: a({ option: 1 }),
  1032. param: {},
  1033. bdo: n,
  1034. var: n,
  1035. div: r,
  1036. object: q,
  1037. sup: n,
  1038. dd: r,
  1039. strike: n,
  1040. area: {},
  1041. dir: s,
  1042. map: b(a({ area: 1, form: 1, p: 1 }), c, h, g),
  1043. applet: q,
  1044. dl: a({ dt: 1, dd: 1 }),
  1045. del: n,
  1046. isindex: {},
  1047. fieldset: b(a({ legend: 1 }), m),
  1048. thead: o,
  1049. ul: s,
  1050. acronym: n,
  1051. b: n,
  1052. a: b(a({ a: 1 }), l),
  1053. blockquote: b(a({ td: 1, tr: 1, tbody: 1, li: 1 }), r),
  1054. caption: n,
  1055. i: n,
  1056. u: n,
  1057. tbody: o,
  1058. s: n,
  1059. address: b(f, k),
  1060. tt: n,
  1061. legend: n,
  1062. q: n,
  1063. pre: b(i, e),
  1064. p: b(a({ a: 1 }), n),
  1065. em: n,
  1066. dfn: n
  1067. })
  1068. })()),
  1069. attrFix =
  1070. ie && browser.version < 9
  1071. ? {
  1072. tabindex: 'tabIndex',
  1073. readonly: 'readOnly',
  1074. for: 'htmlFor',
  1075. class: 'className',
  1076. maxlength: 'maxLength',
  1077. cellspacing: 'cellSpacing',
  1078. cellpadding: 'cellPadding',
  1079. rowspan: 'rowSpan',
  1080. colspan: 'colSpan',
  1081. usemap: 'useMap',
  1082. frameborder: 'frameBorder'
  1083. }
  1084. : { tabindex: 'tabIndex', readonly: 'readOnly' },
  1085. styleBlock = utils.listToMap([
  1086. '-webkit-box',
  1087. '-moz-box',
  1088. 'block',
  1089. 'list-item',
  1090. 'table',
  1091. 'table-row-group',
  1092. 'table-header-group',
  1093. 'table-footer-group',
  1094. 'table-row',
  1095. 'table-column-group',
  1096. 'table-column',
  1097. 'table-cell',
  1098. 'table-caption'
  1099. ]),
  1100. domUtils = (dom.domUtils = {
  1101. NODE_ELEMENT: 1,
  1102. NODE_DOCUMENT: 9,
  1103. NODE_TEXT: 3,
  1104. NODE_COMMENT: 8,
  1105. NODE_DOCUMENT_FRAGMENT: 11,
  1106. POSITION_IDENTICAL: 0,
  1107. POSITION_DISCONNECTED: 1,
  1108. POSITION_FOLLOWING: 2,
  1109. POSITION_PRECEDING: 4,
  1110. POSITION_IS_CONTAINED: 8,
  1111. POSITION_CONTAINS: 16,
  1112. fillChar: ie && '6' == browser.version ? '\ufeff' : '​',
  1113. keys: {
  1114. 8: 1,
  1115. 46: 1,
  1116. 16: 1,
  1117. 17: 1,
  1118. 18: 1,
  1119. 37: 1,
  1120. 38: 1,
  1121. 39: 1,
  1122. 40: 1,
  1123. 13: 1
  1124. },
  1125. getPosition: function (a, b) {
  1126. if (a === b) return 0
  1127. var c,
  1128. d = [a],
  1129. e = [b]
  1130. for (c = a; (c = c.parentNode); ) {
  1131. if (c === b) return 10
  1132. d.push(c)
  1133. }
  1134. for (c = b; (c = c.parentNode); ) {
  1135. if (c === a) return 20
  1136. e.push(c)
  1137. }
  1138. if ((d.reverse(), e.reverse(), d[0] !== e[0])) return 1
  1139. for (var f = -1; f++, d[f] === e[f]; );
  1140. for (a = d[f], b = e[f]; (a = a.nextSibling); ) if (a === b) return 4
  1141. return 2
  1142. },
  1143. getNodeIndex: function (a, b) {
  1144. for (var c = a, d = 0; (c = c.previousSibling); )
  1145. b && 3 == c.nodeType
  1146. ? c.nodeType != c.nextSibling.nodeType && d++
  1147. : d++
  1148. return d
  1149. },
  1150. inDoc: function (a, b) {
  1151. return 10 == domUtils.getPosition(a, b)
  1152. },
  1153. findParent: function (a, b, c) {
  1154. if (a && !domUtils.isBody(a))
  1155. for (a = c ? a : a.parentNode; a; ) {
  1156. if (!b || b(a) || domUtils.isBody(a))
  1157. return b && !b(a) && domUtils.isBody(a) ? null : a
  1158. a = a.parentNode
  1159. }
  1160. return null
  1161. },
  1162. findParentByTagName: function (a, b, c, d) {
  1163. return (
  1164. (b = utils.listToMap(utils.isArray(b) ? b : [b])),
  1165. domUtils.findParent(
  1166. a,
  1167. function (a) {
  1168. return b[a.tagName] && !(d && d(a))
  1169. },
  1170. c
  1171. )
  1172. )
  1173. },
  1174. findParents: function (a, b, c, d) {
  1175. for (
  1176. var e = b && ((c && c(a)) || !c) ? [a] : [];
  1177. (a = domUtils.findParent(a, c));
  1178. )
  1179. e.push(a)
  1180. return d ? e : e.reverse()
  1181. },
  1182. insertAfter: function (a, b) {
  1183. return a.nextSibling
  1184. ? a.parentNode.insertBefore(b, a.nextSibling)
  1185. : a.parentNode.appendChild(b)
  1186. },
  1187. remove: function (a, b) {
  1188. var c,
  1189. d = a.parentNode
  1190. if (d) {
  1191. if (b && a.hasChildNodes())
  1192. for (; (c = a.firstChild); ) d.insertBefore(c, a)
  1193. d.removeChild(a)
  1194. }
  1195. return a
  1196. },
  1197. getNextDomNode: function (a, b, c, d) {
  1198. return getDomNode(a, 'firstChild', 'nextSibling', b, c, d)
  1199. },
  1200. getPreDomNode: function (a, b, c, d) {
  1201. return getDomNode(a, 'lastChild', 'previousSibling', b, c, d)
  1202. },
  1203. isBookmarkNode: function (a) {
  1204. return 1 == a.nodeType && a.id && /^_baidu_bookmark_/i.test(a.id)
  1205. },
  1206. getWindow: function (a) {
  1207. var b = a.ownerDocument || a
  1208. return b.defaultView || b.parentWindow
  1209. },
  1210. getCommonAncestor: function (a, b) {
  1211. if (a === b) return a
  1212. for (var c = [a], d = [b], e = a, f = -1; (e = e.parentNode); ) {
  1213. if (e === b) return e
  1214. c.push(e)
  1215. }
  1216. for (e = b; (e = e.parentNode); ) {
  1217. if (e === a) return e
  1218. d.push(e)
  1219. }
  1220. for (c.reverse(), d.reverse(); f++, c[f] === d[f]; );
  1221. return 0 == f ? null : c[f - 1]
  1222. },
  1223. clearEmptySibling: function (a, b, c) {
  1224. function d(a, b) {
  1225. for (
  1226. var c;
  1227. a &&
  1228. !domUtils.isBookmarkNode(a) &&
  1229. (domUtils.isEmptyInlineElement(a) ||
  1230. !new RegExp('[^\t\n\r' + domUtils.fillChar + ']').test(
  1231. a.nodeValue
  1232. ));
  1233. )
  1234. (c = a[b]), domUtils.remove(a), (a = c)
  1235. }
  1236. !b && d(a.nextSibling, 'nextSibling'),
  1237. !c && d(a.previousSibling, 'previousSibling')
  1238. },
  1239. split: function (a, b) {
  1240. var c = a.ownerDocument
  1241. if (browser.ie && b == a.nodeValue.length) {
  1242. var d = c.createTextNode('')
  1243. return domUtils.insertAfter(a, d)
  1244. }
  1245. var e = a.splitText(b)
  1246. if (browser.ie8) {
  1247. var f = c.createTextNode('')
  1248. domUtils.insertAfter(e, f), domUtils.remove(f)
  1249. }
  1250. return e
  1251. },
  1252. isWhitespace: function (a) {
  1253. return !new RegExp('[^ \t\n\r' + domUtils.fillChar + ']').test(
  1254. a.nodeValue
  1255. )
  1256. },
  1257. getXY: function (a) {
  1258. for (var b = 0, c = 0; a.offsetParent; )
  1259. (c += a.offsetTop), (b += a.offsetLeft), (a = a.offsetParent)
  1260. return { x: b, y: c }
  1261. },
  1262. on: function (a, b, c) {
  1263. var d = utils.isArray(b) ? b : utils.trim(b).split(/\s+/),
  1264. e = d.length
  1265. if (e)
  1266. for (; e--; )
  1267. if (((b = d[e]), a.addEventListener)) a.addEventListener(b, c, !1)
  1268. else {
  1269. c._d || (c._d = { els: [] })
  1270. var f = b + c.toString(),
  1271. g = utils.indexOf(c._d.els, a)
  1272. ;(c._d[f] && g != -1) ||
  1273. (g == -1 && c._d.els.push(a),
  1274. c._d[f] ||
  1275. (c._d[f] = function (a) {
  1276. return c.call(a.srcElement, a || window.event)
  1277. }),
  1278. a.attachEvent('on' + b, c._d[f]))
  1279. }
  1280. a = null
  1281. },
  1282. un: function (a, b, c) {
  1283. var d = utils.isArray(b) ? b : utils.trim(b).split(/\s+/),
  1284. e = d.length
  1285. if (e)
  1286. for (; e--; )
  1287. if (((b = d[e]), a.removeEventListener))
  1288. a.removeEventListener(b, c, !1)
  1289. else {
  1290. var f = b + c.toString()
  1291. try {
  1292. a.detachEvent('on' + b, c._d ? c._d[f] : c)
  1293. } catch (g) {}
  1294. if (c._d && c._d[f]) {
  1295. var h = utils.indexOf(c._d.els, a)
  1296. h != -1 && c._d.els.splice(h, 1),
  1297. 0 == c._d.els.length && delete c._d[f]
  1298. }
  1299. }
  1300. },
  1301. isSameElement: function (a, b) {
  1302. if (a.tagName != b.tagName) return !1
  1303. var c = a.attributes,
  1304. d = b.attributes
  1305. if (!ie && c.length != d.length) return !1
  1306. for (var e, f, g = 0, h = 0, i = 0; (e = c[i++]); ) {
  1307. if ('style' == e.nodeName) {
  1308. if ((e.specified && g++, domUtils.isSameStyle(a, b))) continue
  1309. return !1
  1310. }
  1311. if (ie) {
  1312. if (!e.specified) continue
  1313. g++, (f = d.getNamedItem(e.nodeName))
  1314. } else f = b.attributes[e.nodeName]
  1315. if (!f.specified || e.nodeValue != f.nodeValue) return !1
  1316. }
  1317. if (ie) {
  1318. for (i = 0; (f = d[i++]); ) f.specified && h++
  1319. if (g != h) return !1
  1320. }
  1321. return !0
  1322. },
  1323. isSameStyle: function (a, b) {
  1324. var c = a.style.cssText
  1325. .replace(/( ?; ?)/g, ';')
  1326. .replace(/( ?: ?)/g, ':'),
  1327. d = b.style.cssText.replace(/( ?; ?)/g, ';').replace(/( ?: ?)/g, ':')
  1328. if (browser.opera) {
  1329. if (((c = a.style), (d = b.style), c.length != d.length)) return !1
  1330. for (var e in c)
  1331. if (!/^(\d+|csstext)$/i.test(e) && c[e] != d[e]) return !1
  1332. return !0
  1333. }
  1334. if (!c || !d) return c == d
  1335. if (((c = c.split(';')), (d = d.split(';')), c.length != d.length))
  1336. return !1
  1337. for (var f, g = 0; (f = c[g++]); )
  1338. if (utils.indexOf(d, f) == -1) return !1
  1339. return !0
  1340. },
  1341. isBlockElm: function (a) {
  1342. return (
  1343. 1 == a.nodeType &&
  1344. (dtd.$block[a.tagName] ||
  1345. styleBlock[domUtils.getComputedStyle(a, 'display')]) &&
  1346. !dtd.$nonChild[a.tagName]
  1347. )
  1348. },
  1349. isBody: function (a) {
  1350. return a && 1 == a.nodeType && 'body' == a.tagName.toLowerCase()
  1351. },
  1352. breakParent: function (a, b) {
  1353. var c,
  1354. d,
  1355. e,
  1356. f = a,
  1357. g = a
  1358. do {
  1359. for (
  1360. f = f.parentNode,
  1361. d
  1362. ? ((c = f.cloneNode(!1)),
  1363. c.appendChild(d),
  1364. (d = c),
  1365. (c = f.cloneNode(!1)),
  1366. c.appendChild(e),
  1367. (e = c))
  1368. : ((d = f.cloneNode(!1)), (e = d.cloneNode(!1)));
  1369. (c = g.previousSibling);
  1370. )
  1371. d.insertBefore(c, d.firstChild)
  1372. for (; (c = g.nextSibling); ) e.appendChild(c)
  1373. g = f
  1374. } while (b !== f)
  1375. return (
  1376. (c = b.parentNode),
  1377. c.insertBefore(d, b),
  1378. c.insertBefore(e, b),
  1379. c.insertBefore(a, e),
  1380. domUtils.remove(b),
  1381. a
  1382. )
  1383. },
  1384. isEmptyInlineElement: function (a) {
  1385. if (1 != a.nodeType || !dtd.$removeEmpty[a.tagName]) return 0
  1386. for (a = a.firstChild; a; ) {
  1387. if (domUtils.isBookmarkNode(a)) return 0
  1388. if (
  1389. (1 == a.nodeType && !domUtils.isEmptyInlineElement(a)) ||
  1390. (3 == a.nodeType && !domUtils.isWhitespace(a))
  1391. )
  1392. return 0
  1393. a = a.nextSibling
  1394. }
  1395. return 1
  1396. },
  1397. trimWhiteTextNode: function (a) {
  1398. function b(b) {
  1399. for (
  1400. var c;
  1401. (c = a[b]) && 3 == c.nodeType && domUtils.isWhitespace(c);
  1402. )
  1403. a.removeChild(c)
  1404. }
  1405. b('firstChild'), b('lastChild')
  1406. },
  1407. mergeChild: function (a, b, c) {
  1408. for (
  1409. var d,
  1410. e = domUtils.getElementsByTagName(a, a.tagName.toLowerCase()),
  1411. f = 0;
  1412. (d = e[f++]);
  1413. )
  1414. if (d.parentNode && !domUtils.isBookmarkNode(d))
  1415. if ('span' != d.tagName.toLowerCase())
  1416. domUtils.isSameElement(a, d) && domUtils.remove(d, !0)
  1417. else {
  1418. if (
  1419. a === d.parentNode &&
  1420. (domUtils.trimWhiteTextNode(a), 1 == a.childNodes.length)
  1421. ) {
  1422. ;(a.style.cssText = d.style.cssText + ';' + a.style.cssText),
  1423. domUtils.remove(d, !0)
  1424. continue
  1425. }
  1426. if (
  1427. ((d.style.cssText = a.style.cssText + ';' + d.style.cssText), c)
  1428. ) {
  1429. var g = c.style
  1430. if (g) {
  1431. g = g.split(';')
  1432. for (var h, i = 0; (h = g[i++]); )
  1433. d.style[utils.cssStyleToDomStyle(h.split(':')[0])] =
  1434. h.split(':')[1]
  1435. }
  1436. }
  1437. domUtils.isSameStyle(d, a) && domUtils.remove(d, !0)
  1438. }
  1439. },
  1440. getElementsByTagName: function (a, b, c) {
  1441. if (c && utils.isString(c)) {
  1442. var d = c
  1443. c = function (a) {
  1444. return domUtils.hasClass(a, d)
  1445. }
  1446. }
  1447. b = utils
  1448. .trim(b)
  1449. .replace(/[ ]{2,}/g, ' ')
  1450. .split(' ')
  1451. for (var e, f = [], g = 0; (e = b[g++]); )
  1452. for (var h, i = a.getElementsByTagName(e), j = 0; (h = i[j++]); )
  1453. (c && !c(h)) || f.push(h)
  1454. return f
  1455. },
  1456. mergeToParent: function (a) {
  1457. for (var b = a.parentNode; b && dtd.$removeEmpty[b.tagName]; ) {
  1458. if (b.tagName == a.tagName || 'A' == b.tagName) {
  1459. if (
  1460. (domUtils.trimWhiteTextNode(b),
  1461. ('SPAN' == b.tagName && !domUtils.isSameStyle(b, a)) ||
  1462. ('A' == b.tagName && 'SPAN' == a.tagName))
  1463. ) {
  1464. if (b.childNodes.length > 1 || b !== a.parentNode) {
  1465. ;(a.style.cssText = b.style.cssText + ';' + a.style.cssText),
  1466. (b = b.parentNode)
  1467. continue
  1468. }
  1469. ;(b.style.cssText += ';' + a.style.cssText),
  1470. 'A' == b.tagName && (b.style.textDecoration = 'underline')
  1471. }
  1472. if ('A' != b.tagName) {
  1473. b === a.parentNode && domUtils.remove(a, !0)
  1474. break
  1475. }
  1476. }
  1477. b = b.parentNode
  1478. }
  1479. },
  1480. mergeSibling: function (a, b, c) {
  1481. function d(a, b, c) {
  1482. var d
  1483. if (
  1484. (d = c[a]) &&
  1485. !domUtils.isBookmarkNode(d) &&
  1486. 1 == d.nodeType &&
  1487. domUtils.isSameElement(c, d)
  1488. ) {
  1489. for (; d.firstChild; )
  1490. 'firstChild' == b
  1491. ? c.insertBefore(d.lastChild, c.firstChild)
  1492. : c.appendChild(d.firstChild)
  1493. domUtils.remove(d)
  1494. }
  1495. }
  1496. !b && d('previousSibling', 'firstChild', a),
  1497. !c && d('nextSibling', 'lastChild', a)
  1498. },
  1499. unSelectable:
  1500. (ie && browser.ie9below) || browser.opera
  1501. ? function (a) {
  1502. ;(a.onselectstart = function () {
  1503. return !1
  1504. }),
  1505. (a.onclick =
  1506. a.onkeyup =
  1507. a.onkeydown =
  1508. function () {
  1509. return !1
  1510. }),
  1511. (a.unselectable = 'on'),
  1512. a.setAttribute('unselectable', 'on')
  1513. for (var b, c = 0; (b = a.all[c++]); )
  1514. switch (b.tagName.toLowerCase()) {
  1515. case 'iframe':
  1516. case 'textarea':
  1517. case 'input':
  1518. case 'select':
  1519. break
  1520. default:
  1521. ;(b.unselectable = 'on'),
  1522. a.setAttribute('unselectable', 'on')
  1523. }
  1524. }
  1525. : function (a) {
  1526. a.style.MozUserSelect =
  1527. a.style.webkitUserSelect =
  1528. a.style.msUserSelect =
  1529. a.style.KhtmlUserSelect =
  1530. 'none'
  1531. },
  1532. removeAttributes: function (a, b) {
  1533. b = utils.isArray(b)
  1534. ? b
  1535. : utils
  1536. .trim(b)
  1537. .replace(/[ ]{2,}/g, ' ')
  1538. .split(' ')
  1539. for (var c, d = 0; (c = b[d++]); ) {
  1540. switch ((c = attrFix[c] || c)) {
  1541. case 'className':
  1542. a[c] = ''
  1543. break
  1544. case 'style':
  1545. a.style.cssText = ''
  1546. var e = a.getAttributeNode('style')
  1547. !browser.ie && e && a.removeAttributeNode(e)
  1548. }
  1549. a.removeAttribute(c)
  1550. }
  1551. },
  1552. createElement: function (a, b, c) {
  1553. return domUtils.setAttributes(a.createElement(b), c)
  1554. },
  1555. setAttributes: function (a, b) {
  1556. for (var c in b)
  1557. if (b.hasOwnProperty(c)) {
  1558. var d = b[c]
  1559. switch (c) {
  1560. case 'class':
  1561. a.className = d
  1562. break
  1563. case 'style':
  1564. a.style.cssText = a.style.cssText + ';' + d
  1565. break
  1566. case 'innerHTML':
  1567. a[c] = d
  1568. break
  1569. case 'value':
  1570. a.value = d
  1571. break
  1572. default:
  1573. a.setAttribute(attrFix[c] || c, d)
  1574. }
  1575. }
  1576. return a
  1577. },
  1578. getComputedStyle: function (a, b) {
  1579. var c = 'width height top left'
  1580. if (c.indexOf(b) > -1)
  1581. return (
  1582. a[
  1583. 'offset' +
  1584. b.replace(/^\w/, function (a) {
  1585. return a.toUpperCase()
  1586. })
  1587. ] + 'px'
  1588. )
  1589. if (
  1590. (3 == a.nodeType && (a = a.parentNode),
  1591. browser.ie &&
  1592. browser.version < 9 &&
  1593. 'font-size' == b &&
  1594. !a.style.fontSize &&
  1595. !dtd.$empty[a.tagName] &&
  1596. !dtd.$nonChild[a.tagName])
  1597. ) {
  1598. var d = a.ownerDocument.createElement('span')
  1599. ;(d.style.cssText = 'padding:0;border:0;font-family:simsun;'),
  1600. (d.innerHTML = '.'),
  1601. a.appendChild(d)
  1602. var e = d.offsetHeight
  1603. return a.removeChild(d), (d = null), e + 'px'
  1604. }
  1605. try {
  1606. var f =
  1607. domUtils.getStyle(a, b) ||
  1608. (window.getComputedStyle
  1609. ? domUtils
  1610. .getWindow(a)
  1611. .getComputedStyle(a, '')
  1612. .getPropertyValue(b)
  1613. : (a.currentStyle || a.style)[utils.cssStyleToDomStyle(b)])
  1614. } catch (g) {
  1615. return ''
  1616. }
  1617. return utils.transUnitToPx(utils.fixColor(b, f))
  1618. },
  1619. removeClasses: function (a, b) {
  1620. b = utils.isArray(b)
  1621. ? b
  1622. : utils
  1623. .trim(b)
  1624. .replace(/[ ]{2,}/g, ' ')
  1625. .split(' ')
  1626. for (var c, d = 0, e = a.className; (c = b[d++]); )
  1627. e = e.replace(new RegExp('\\b' + c + '\\b'), '')
  1628. ;(e = utils.trim(e).replace(/[ ]{2,}/g, ' ')),
  1629. e ? (a.className = e) : domUtils.removeAttributes(a, ['class'])
  1630. },
  1631. addClass: function (a, b) {
  1632. if (a) {
  1633. b = utils
  1634. .trim(b)
  1635. .replace(/[ ]{2,}/g, ' ')
  1636. .split(' ')
  1637. for (var c, d = 0, e = a.className; (c = b[d++]); )
  1638. new RegExp('\\b' + c + '\\b').test(e) || (e += ' ' + c)
  1639. a.className = utils.trim(e)
  1640. }
  1641. },
  1642. hasClass: function (a, b) {
  1643. if (utils.isRegExp(b)) return b.test(a.className)
  1644. b = utils
  1645. .trim(b)
  1646. .replace(/[ ]{2,}/g, ' ')
  1647. .split(' ')
  1648. for (var c, d = 0, e = a.className; (c = b[d++]); )
  1649. if (!new RegExp('\\b' + c + '\\b', 'i').test(e)) return !1
  1650. return d - 1 == b.length
  1651. },
  1652. preventDefault: function (a) {
  1653. a.preventDefault ? a.preventDefault() : (a.returnValue = !1)
  1654. },
  1655. removeStyle: function (a, b) {
  1656. browser.ie
  1657. ? ('color' == b && (b = '(^|;)' + b),
  1658. (a.style.cssText = a.style.cssText.replace(
  1659. new RegExp(b + '[^:]*:[^;]+;?', 'ig'),
  1660. ''
  1661. )))
  1662. : a.style.removeProperty
  1663. ? a.style.removeProperty(b)
  1664. : a.style.removeAttribute(utils.cssStyleToDomStyle(b)),
  1665. a.style.cssText || domUtils.removeAttributes(a, ['style'])
  1666. },
  1667. getStyle: function (a, b) {
  1668. var c = a.style[utils.cssStyleToDomStyle(b)]
  1669. return utils.fixColor(b, c)
  1670. },
  1671. setStyle: function (a, b, c) {
  1672. ;(a.style[utils.cssStyleToDomStyle(b)] = c),
  1673. utils.trim(a.style.cssText) || this.removeAttributes(a, 'style')
  1674. },
  1675. setStyles: function (a, b) {
  1676. for (var c in b) b.hasOwnProperty(c) && domUtils.setStyle(a, c, b[c])
  1677. },
  1678. removeDirtyAttr: function (a) {
  1679. for (var b, c = 0, d = a.getElementsByTagName('*'); (b = d[c++]); )
  1680. b.removeAttribute('_moz_dirty')
  1681. a.removeAttribute('_moz_dirty')
  1682. },
  1683. getChildCount: function (a, b) {
  1684. var c = 0,
  1685. d = a.firstChild
  1686. for (
  1687. b =
  1688. b ||
  1689. function () {
  1690. return 1
  1691. };
  1692. d;
  1693. )
  1694. b(d) && c++, (d = d.nextSibling)
  1695. return c
  1696. },
  1697. isEmptyNode: function (a) {
  1698. return (
  1699. !a.firstChild ||
  1700. 0 ==
  1701. domUtils.getChildCount(a, function (a) {
  1702. return (
  1703. !domUtils.isBr(a) &&
  1704. !domUtils.isBookmarkNode(a) &&
  1705. !domUtils.isWhitespace(a)
  1706. )
  1707. })
  1708. )
  1709. },
  1710. clearSelectedArr: function (a) {
  1711. for (var b; (b = a.pop()); ) domUtils.removeAttributes(b, ['class'])
  1712. },
  1713. scrollToView: function (a, b, c) {
  1714. var d = function () {
  1715. var a = b.document,
  1716. c = 'CSS1Compat' == a.compatMode
  1717. return {
  1718. width:
  1719. (c ? a.documentElement.clientWidth : a.body.clientWidth) || 0,
  1720. height:
  1721. (c ? a.documentElement.clientHeight : a.body.clientHeight) || 0
  1722. }
  1723. },
  1724. e = function (a) {
  1725. if ('pageXOffset' in a)
  1726. return { x: a.pageXOffset || 0, y: a.pageYOffset || 0 }
  1727. var b = a.document
  1728. return {
  1729. x: b.documentElement.scrollLeft || b.body.scrollLeft || 0,
  1730. y: b.documentElement.scrollTop || b.body.scrollTop || 0
  1731. }
  1732. },
  1733. f = d().height,
  1734. g = f * -1 + c
  1735. g += a.offsetHeight || 0
  1736. var h = domUtils.getXY(a)
  1737. g += h.y
  1738. var i = e(b).y
  1739. ;(g > i || g < i - f) && b.scrollTo(0, g + (g < 0 ? -20 : 20))
  1740. },
  1741. isBr: function (a) {
  1742. return 1 == a.nodeType && 'BR' == a.tagName
  1743. },
  1744. isFillChar: function (a, b) {
  1745. if (3 != a.nodeType) return !1
  1746. var c = a.nodeValue
  1747. return b
  1748. ? new RegExp('^' + domUtils.fillChar).test(c)
  1749. : !c.replace(new RegExp(domUtils.fillChar, 'g'), '').length
  1750. },
  1751. isStartInblock: function (a) {
  1752. var b,
  1753. c = a.cloneRange(),
  1754. d = 0,
  1755. e = c.startContainer
  1756. if (1 == e.nodeType && e.childNodes[c.startOffset]) {
  1757. e = e.childNodes[c.startOffset]
  1758. for (var f = e.previousSibling; f && domUtils.isFillChar(f); )
  1759. (e = f), (f = f.previousSibling)
  1760. }
  1761. for (
  1762. this.isFillChar(e, !0) &&
  1763. 1 == c.startOffset &&
  1764. (c.setStartBefore(e), (e = c.startContainer));
  1765. e && domUtils.isFillChar(e);
  1766. )
  1767. (b = e), (e = e.previousSibling)
  1768. for (
  1769. b && (c.setStartBefore(b), (e = c.startContainer)),
  1770. 1 == e.nodeType &&
  1771. domUtils.isEmptyNode(e) &&
  1772. 1 == c.startOffset &&
  1773. c.setStart(e, 0).collapse(!0);
  1774. !c.startOffset;
  1775. ) {
  1776. if (
  1777. ((e = c.startContainer),
  1778. domUtils.isBlockElm(e) || domUtils.isBody(e))
  1779. ) {
  1780. d = 1
  1781. break
  1782. }
  1783. var g,
  1784. f = c.startContainer.previousSibling
  1785. if (f) {
  1786. for (; f && domUtils.isFillChar(f); )
  1787. (g = f), (f = f.previousSibling)
  1788. g ? c.setStartBefore(g) : c.setStartBefore(c.startContainer)
  1789. } else c.setStartBefore(c.startContainer)
  1790. }
  1791. return d && !domUtils.isBody(c.startContainer) ? 1 : 0
  1792. },
  1793. isEmptyBlock: function (a, b) {
  1794. if (a) {
  1795. if (1 != a.nodeType) return 0
  1796. if (
  1797. ((b = b || new RegExp('[  \t\r\n' + domUtils.fillChar + ']', 'g')),
  1798. a[browser.ie ? 'innerText' : 'textContent'].replace(b, '').length >
  1799. 0)
  1800. )
  1801. return 0
  1802. for (var c in dtd.$isNotEmpty)
  1803. if (a.getElementsByTagName(c).length) return 0
  1804. return 1
  1805. }
  1806. },
  1807. setViewportOffset: function (a, b) {
  1808. var c = 0 | parseInt(a.style.left),
  1809. d = 0 | parseInt(a.style.top),
  1810. e = a.getBoundingClientRect(),
  1811. f = b.left - e.left,
  1812. g = b.top - e.top
  1813. f && (a.style.left = c + f + 'px'), g && (a.style.top = d + g + 'px')
  1814. },
  1815. fillNode: function (a, b) {
  1816. var c = browser.ie
  1817. ? a.createTextNode(domUtils.fillChar)
  1818. : a.createElement('br')
  1819. ;(b.innerHTML = ''), b.appendChild(c)
  1820. },
  1821. moveChild: function (a, b, c) {
  1822. for (; a.firstChild; )
  1823. c && b.firstChild
  1824. ? b.insertBefore(a.lastChild, b.firstChild)
  1825. : b.appendChild(a.firstChild)
  1826. },
  1827. hasNoAttributes: function (a) {
  1828. return browser.ie
  1829. ? /^<\w+\s*?>/.test(a.outerHTML)
  1830. : 0 == a.attributes.length
  1831. },
  1832. isCustomeNode: function (a) {
  1833. return 1 == a.nodeType && a.getAttribute('_ue_custom_node_')
  1834. },
  1835. isTagNode: function (a, b) {
  1836. return (
  1837. 1 == a.nodeType && new RegExp('\\b' + a.tagName + '\\b', 'i').test(b)
  1838. )
  1839. },
  1840. filterNodeList: function (a, b, c) {
  1841. var d = []
  1842. if (!utils.isFunction(b)) {
  1843. var e = b
  1844. b = function (a) {
  1845. return (
  1846. utils.indexOf(
  1847. utils.isArray(e) ? e : e.split(' '),
  1848. a.tagName.toLowerCase()
  1849. ) != -1
  1850. )
  1851. }
  1852. }
  1853. return (
  1854. utils.each(a, function (a) {
  1855. b(a) && d.push(a)
  1856. }),
  1857. 0 == d.length ? null : 1 != d.length && c ? d : d[0]
  1858. )
  1859. },
  1860. isInNodeEndBoundary: function (a, b) {
  1861. var c = a.startContainer
  1862. if (3 == c.nodeType && a.startOffset != c.nodeValue.length) return 0
  1863. if (1 == c.nodeType && a.startOffset != c.childNodes.length) return 0
  1864. for (; c !== b; ) {
  1865. if (c.nextSibling) return 0
  1866. c = c.parentNode
  1867. }
  1868. return 1
  1869. },
  1870. isBoundaryNode: function (a, b) {
  1871. for (var c; !domUtils.isBody(a); )
  1872. if (((c = a), (a = a.parentNode), c !== a[b])) return !1
  1873. return !0
  1874. },
  1875. fillHtml: browser.ie11below ? '&nbsp;' : '<br/>'
  1876. }),
  1877. fillCharReg = new RegExp(domUtils.fillChar, 'g')
  1878. !(function () {
  1879. function a(a) {
  1880. a.collapsed =
  1881. a.startContainer &&
  1882. a.endContainer &&
  1883. a.startContainer === a.endContainer &&
  1884. a.startOffset == a.endOffset
  1885. }
  1886. function b(a) {
  1887. return (
  1888. !a.collapsed &&
  1889. 1 == a.startContainer.nodeType &&
  1890. a.startContainer === a.endContainer &&
  1891. a.endOffset - a.startOffset == 1
  1892. )
  1893. }
  1894. function c(b, c, d, e) {
  1895. return (
  1896. 1 == c.nodeType &&
  1897. (dtd.$empty[c.tagName] || dtd.$nonChild[c.tagName]) &&
  1898. ((d = domUtils.getNodeIndex(c) + (b ? 0 : 1)), (c = c.parentNode)),
  1899. b
  1900. ? ((e.startContainer = c),
  1901. (e.startOffset = d),
  1902. e.endContainer || e.collapse(!0))
  1903. : ((e.endContainer = c),
  1904. (e.endOffset = d),
  1905. e.startContainer || e.collapse(!1)),
  1906. a(e),
  1907. e
  1908. )
  1909. }
  1910. function d(a, b) {
  1911. var c,
  1912. d,
  1913. e = a.startContainer,
  1914. f = a.endContainer,
  1915. g = a.startOffset,
  1916. h = a.endOffset,
  1917. i = a.document,
  1918. j = i.createDocumentFragment()
  1919. if (
  1920. (1 == e.nodeType &&
  1921. (e = e.childNodes[g] || (c = e.appendChild(i.createTextNode('')))),
  1922. 1 == f.nodeType &&
  1923. (f = f.childNodes[h] || (d = f.appendChild(i.createTextNode('')))),
  1924. e === f && 3 == e.nodeType)
  1925. )
  1926. return (
  1927. j.appendChild(i.createTextNode(e.substringData(g, h - g))),
  1928. b && (e.deleteData(g, h - g), a.collapse(!0)),
  1929. j
  1930. )
  1931. for (
  1932. var k,
  1933. l,
  1934. m = j,
  1935. n = domUtils.findParents(e, !0),
  1936. o = domUtils.findParents(f, !0),
  1937. p = 0;
  1938. n[p] == o[p];
  1939. )
  1940. p++
  1941. for (var q, r = p; (q = n[r]); r++) {
  1942. for (
  1943. k = q.nextSibling,
  1944. q == e
  1945. ? c ||
  1946. (3 == a.startContainer.nodeType
  1947. ? (m.appendChild(i.createTextNode(e.nodeValue.slice(g))),
  1948. b && e.deleteData(g, e.nodeValue.length - g))
  1949. : m.appendChild(b ? e : e.cloneNode(!0)))
  1950. : ((l = q.cloneNode(!1)), m.appendChild(l));
  1951. k && k !== f && k !== o[r];
  1952. )
  1953. (q = k.nextSibling), m.appendChild(b ? k : k.cloneNode(!0)), (k = q)
  1954. m = l
  1955. }
  1956. ;(m = j),
  1957. n[p] || (m.appendChild(n[p - 1].cloneNode(!1)), (m = m.firstChild))
  1958. for (var s, r = p; (s = o[r]); r++) {
  1959. if (
  1960. ((k = s.previousSibling),
  1961. s == f
  1962. ? d ||
  1963. 3 != a.endContainer.nodeType ||
  1964. (m.appendChild(i.createTextNode(f.substringData(0, h))),
  1965. b && f.deleteData(0, h))
  1966. : ((l = s.cloneNode(!1)), m.appendChild(l)),
  1967. r != p || !n[p])
  1968. )
  1969. for (; k && k !== e; )
  1970. (s = k.previousSibling),
  1971. m.insertBefore(b ? k : k.cloneNode(!0), m.firstChild),
  1972. (k = s)
  1973. m = l
  1974. }
  1975. return (
  1976. b &&
  1977. a
  1978. .setStartBefore(o[p] ? (n[p] ? o[p] : n[p - 1]) : o[p - 1])
  1979. .collapse(!0),
  1980. c && domUtils.remove(c),
  1981. d && domUtils.remove(d),
  1982. j
  1983. )
  1984. }
  1985. function e(a, b) {
  1986. try {
  1987. if (g && domUtils.inDoc(g, a))
  1988. if (g.nodeValue.replace(fillCharReg, '').length)
  1989. g.nodeValue = g.nodeValue.replace(fillCharReg, '')
  1990. else {
  1991. var c = g.parentNode
  1992. for (
  1993. domUtils.remove(g);
  1994. c &&
  1995. domUtils.isEmptyInlineElement(c) &&
  1996. (browser.safari
  1997. ? !(domUtils.getPosition(c, b) & domUtils.POSITION_CONTAINS)
  1998. : !c.contains(b));
  1999. )
  2000. (g = c.parentNode), domUtils.remove(c), (c = g)
  2001. }
  2002. } catch (d) {}
  2003. }
  2004. function f(a, b) {
  2005. var c
  2006. for (a = a[b]; a && domUtils.isFillChar(a); )
  2007. (c = a[b]), domUtils.remove(a), (a = c)
  2008. }
  2009. var g,
  2010. h = 0,
  2011. i = domUtils.fillChar,
  2012. j = (dom.Range = function (a) {
  2013. var b = this
  2014. ;(b.startContainer =
  2015. b.startOffset =
  2016. b.endContainer =
  2017. b.endOffset =
  2018. null),
  2019. (b.document = a),
  2020. (b.collapsed = !0)
  2021. })
  2022. j.prototype = {
  2023. cloneContents: function () {
  2024. return this.collapsed ? null : d(this, 0)
  2025. },
  2026. deleteContents: function () {
  2027. var a
  2028. return (
  2029. this.collapsed || d(this, 1),
  2030. browser.webkit &&
  2031. ((a = this.startContainer),
  2032. 3 != a.nodeType ||
  2033. a.nodeValue.length ||
  2034. (this.setStartBefore(a).collapse(!0), domUtils.remove(a))),
  2035. this
  2036. )
  2037. },
  2038. extractContents: function () {
  2039. return this.collapsed ? null : d(this, 2)
  2040. },
  2041. setStart: function (a, b) {
  2042. return c(!0, a, b, this)
  2043. },
  2044. setEnd: function (a, b) {
  2045. return c(!1, a, b, this)
  2046. },
  2047. setStartAfter: function (a) {
  2048. return this.setStart(a.parentNode, domUtils.getNodeIndex(a) + 1)
  2049. },
  2050. setStartBefore: function (a) {
  2051. return this.setStart(a.parentNode, domUtils.getNodeIndex(a))
  2052. },
  2053. setEndAfter: function (a) {
  2054. return this.setEnd(a.parentNode, domUtils.getNodeIndex(a) + 1)
  2055. },
  2056. setEndBefore: function (a) {
  2057. return this.setEnd(a.parentNode, domUtils.getNodeIndex(a))
  2058. },
  2059. setStartAtFirst: function (a) {
  2060. return this.setStart(a, 0)
  2061. },
  2062. setStartAtLast: function (a) {
  2063. return this.setStart(
  2064. a,
  2065. 3 == a.nodeType ? a.nodeValue.length : a.childNodes.length
  2066. )
  2067. },
  2068. setEndAtFirst: function (a) {
  2069. return this.setEnd(a, 0)
  2070. },
  2071. setEndAtLast: function (a) {
  2072. return this.setEnd(
  2073. a,
  2074. 3 == a.nodeType ? a.nodeValue.length : a.childNodes.length
  2075. )
  2076. },
  2077. selectNode: function (a) {
  2078. return this.setStartBefore(a).setEndAfter(a)
  2079. },
  2080. selectNodeContents: function (a) {
  2081. return this.setStart(a, 0).setEndAtLast(a)
  2082. },
  2083. cloneRange: function () {
  2084. var a = this
  2085. return new j(a.document)
  2086. .setStart(a.startContainer, a.startOffset)
  2087. .setEnd(a.endContainer, a.endOffset)
  2088. },
  2089. collapse: function (a) {
  2090. var b = this
  2091. return (
  2092. a
  2093. ? ((b.endContainer = b.startContainer),
  2094. (b.endOffset = b.startOffset))
  2095. : ((b.startContainer = b.endContainer),
  2096. (b.startOffset = b.endOffset)),
  2097. (b.collapsed = !0),
  2098. b
  2099. )
  2100. },
  2101. shrinkBoundary: function (a) {
  2102. function b(a) {
  2103. return (
  2104. 1 == a.nodeType &&
  2105. !domUtils.isBookmarkNode(a) &&
  2106. !dtd.$empty[a.tagName] &&
  2107. !dtd.$nonChild[a.tagName]
  2108. )
  2109. }
  2110. for (
  2111. var c, d = this, e = d.collapsed;
  2112. 1 == d.startContainer.nodeType &&
  2113. (c = d.startContainer.childNodes[d.startOffset]) &&
  2114. b(c);
  2115. )
  2116. d.setStart(c, 0)
  2117. if (e) return d.collapse(!0)
  2118. if (!a)
  2119. for (
  2120. ;
  2121. 1 == d.endContainer.nodeType &&
  2122. d.endOffset > 0 &&
  2123. (c = d.endContainer.childNodes[d.endOffset - 1]) &&
  2124. b(c);
  2125. )
  2126. d.setEnd(c, c.childNodes.length)
  2127. return d
  2128. },
  2129. getCommonAncestor: function (a, c) {
  2130. var d = this,
  2131. e = d.startContainer,
  2132. f = d.endContainer
  2133. return e === f
  2134. ? a && b(this) && ((e = e.childNodes[d.startOffset]), 1 == e.nodeType)
  2135. ? e
  2136. : c && 3 == e.nodeType
  2137. ? e.parentNode
  2138. : e
  2139. : domUtils.getCommonAncestor(e, f)
  2140. },
  2141. trimBoundary: function (a) {
  2142. this.txtToElmBoundary()
  2143. var b = this.startContainer,
  2144. c = this.startOffset,
  2145. d = this.collapsed,
  2146. e = this.endContainer
  2147. if (3 == b.nodeType) {
  2148. if (0 == c) this.setStartBefore(b)
  2149. else if (c >= b.nodeValue.length) this.setStartAfter(b)
  2150. else {
  2151. var f = domUtils.split(b, c)
  2152. b === e
  2153. ? this.setEnd(f, this.endOffset - c)
  2154. : b.parentNode === e && (this.endOffset += 1),
  2155. this.setStartBefore(f)
  2156. }
  2157. if (d) return this.collapse(!0)
  2158. }
  2159. return (
  2160. a ||
  2161. ((c = this.endOffset),
  2162. (e = this.endContainer),
  2163. 3 == e.nodeType &&
  2164. (0 == c
  2165. ? this.setEndBefore(e)
  2166. : (c < e.nodeValue.length && domUtils.split(e, c),
  2167. this.setEndAfter(e)))),
  2168. this
  2169. )
  2170. },
  2171. txtToElmBoundary: function (a) {
  2172. function b(a, b) {
  2173. var c = a[b + 'Container'],
  2174. d = a[b + 'Offset']
  2175. 3 == c.nodeType &&
  2176. (d
  2177. ? d >= c.nodeValue.length &&
  2178. a[
  2179. 'set' +
  2180. b.replace(/(\w)/, function (a) {
  2181. return a.toUpperCase()
  2182. }) +
  2183. 'After'
  2184. ](c)
  2185. : a[
  2186. 'set' +
  2187. b.replace(/(\w)/, function (a) {
  2188. return a.toUpperCase()
  2189. }) +
  2190. 'Before'
  2191. ](c))
  2192. }
  2193. return (
  2194. (!a && this.collapsed) || (b(this, 'start'), b(this, 'end')), this
  2195. )
  2196. },
  2197. insertNode: function (a) {
  2198. var b = a,
  2199. c = 1
  2200. 11 == a.nodeType && ((b = a.firstChild), (c = a.childNodes.length)),
  2201. this.trimBoundary(!0)
  2202. var d = this.startContainer,
  2203. e = this.startOffset,
  2204. f = d.childNodes[e]
  2205. return (
  2206. f ? d.insertBefore(a, f) : d.appendChild(a),
  2207. b.parentNode === this.endContainer &&
  2208. (this.endOffset = this.endOffset + c),
  2209. this.setStartBefore(b)
  2210. )
  2211. },
  2212. setCursor: function (a, b) {
  2213. return this.collapse(!a).select(b)
  2214. },
  2215. createBookmark: function (a, b) {
  2216. var c,
  2217. d = this.document.createElement('span')
  2218. return (
  2219. (d.style.cssText = 'display:none;line-height:0px;'),
  2220. d.appendChild(this.document.createTextNode('‍')),
  2221. (d.id = '_baidu_bookmark_start_' + (b ? '' : h++)),
  2222. this.collapsed ||
  2223. ((c = d.cloneNode(!0)),
  2224. (c.id = '_baidu_bookmark_end_' + (b ? '' : h++))),
  2225. this.insertNode(d),
  2226. c && this.collapse().insertNode(c).setEndBefore(c),
  2227. this.setStartAfter(d),
  2228. { start: a ? d.id : d, end: c ? (a ? c.id : c) : null, id: a }
  2229. )
  2230. },
  2231. moveToBookmark: function (a) {
  2232. var b = a.id ? this.document.getElementById(a.start) : a.start,
  2233. c = a.end && a.id ? this.document.getElementById(a.end) : a.end
  2234. return (
  2235. this.setStartBefore(b),
  2236. domUtils.remove(b),
  2237. c ? (this.setEndBefore(c), domUtils.remove(c)) : this.collapse(!0),
  2238. this
  2239. )
  2240. },
  2241. enlarge: function (a, b) {
  2242. var c,
  2243. d,
  2244. e = domUtils.isBody,
  2245. f = this.document.createTextNode('')
  2246. if (a) {
  2247. for (
  2248. d = this.startContainer,
  2249. 1 == d.nodeType
  2250. ? d.childNodes[this.startOffset]
  2251. ? (c = d = d.childNodes[this.startOffset])
  2252. : (d.appendChild(f), (c = d = f))
  2253. : (c = d);
  2254. ;
  2255. ) {
  2256. if (domUtils.isBlockElm(d)) {
  2257. for (d = c; (c = d.previousSibling) && !domUtils.isBlockElm(c); )
  2258. d = c
  2259. this.setStartBefore(d)
  2260. break
  2261. }
  2262. ;(c = d), (d = d.parentNode)
  2263. }
  2264. for (
  2265. d = this.endContainer,
  2266. 1 == d.nodeType
  2267. ? ((c = d.childNodes[this.endOffset])
  2268. ? d.insertBefore(f, c)
  2269. : d.appendChild(f),
  2270. (c = d = f))
  2271. : (c = d);
  2272. ;
  2273. ) {
  2274. if (domUtils.isBlockElm(d)) {
  2275. for (d = c; (c = d.nextSibling) && !domUtils.isBlockElm(c); )
  2276. d = c
  2277. this.setEndAfter(d)
  2278. break
  2279. }
  2280. ;(c = d), (d = d.parentNode)
  2281. }
  2282. f.parentNode === this.endContainer && this.endOffset--,
  2283. domUtils.remove(f)
  2284. }
  2285. if (!this.collapsed) {
  2286. for (
  2287. ;
  2288. !(
  2289. 0 != this.startOffset ||
  2290. (b && b(this.startContainer)) ||
  2291. e(this.startContainer)
  2292. );
  2293. )
  2294. this.setStartBefore(this.startContainer)
  2295. for (
  2296. ;
  2297. !(
  2298. this.endOffset !=
  2299. (1 == this.endContainer.nodeType
  2300. ? this.endContainer.childNodes.length
  2301. : this.endContainer.nodeValue.length) ||
  2302. (b && b(this.endContainer)) ||
  2303. e(this.endContainer)
  2304. );
  2305. )
  2306. this.setEndAfter(this.endContainer)
  2307. }
  2308. return this
  2309. },
  2310. enlargeToBlockElm: function (a) {
  2311. for (; !domUtils.isBlockElm(this.startContainer); )
  2312. this.setStartBefore(this.startContainer)
  2313. if (!a)
  2314. for (; !domUtils.isBlockElm(this.endContainer); )
  2315. this.setEndAfter(this.endContainer)
  2316. return this
  2317. },
  2318. adjustmentBoundary: function () {
  2319. if (!this.collapsed) {
  2320. for (
  2321. ;
  2322. !domUtils.isBody(this.startContainer) &&
  2323. this.startOffset ==
  2324. this.startContainer[
  2325. 3 == this.startContainer.nodeType ? 'nodeValue' : 'childNodes'
  2326. ].length &&
  2327. this.startContainer[
  2328. 3 == this.startContainer.nodeType ? 'nodeValue' : 'childNodes'
  2329. ].length;
  2330. )
  2331. this.setStartAfter(this.startContainer)
  2332. for (
  2333. ;
  2334. !domUtils.isBody(this.endContainer) &&
  2335. !this.endOffset &&
  2336. this.endContainer[
  2337. 3 == this.endContainer.nodeType ? 'nodeValue' : 'childNodes'
  2338. ].length;
  2339. )
  2340. this.setEndBefore(this.endContainer)
  2341. }
  2342. return this
  2343. },
  2344. applyInlineStyle: function (a, b, c) {
  2345. if (this.collapsed) return this
  2346. this.trimBoundary()
  2347. .enlarge(!1, function (a) {
  2348. return 1 == a.nodeType && domUtils.isBlockElm(a)
  2349. })
  2350. .adjustmentBoundary()
  2351. for (
  2352. var d,
  2353. e,
  2354. f = this.createBookmark(),
  2355. g = f.end,
  2356. h = function (a) {
  2357. return 1 == a.nodeType
  2358. ? 'br' != a.tagName.toLowerCase()
  2359. : !domUtils.isWhitespace(a)
  2360. },
  2361. i = domUtils.getNextDomNode(f.start, !1, h),
  2362. j = this.cloneRange();
  2363. i && domUtils.getPosition(i, g) & domUtils.POSITION_PRECEDING;
  2364. )
  2365. if (3 == i.nodeType || dtd[a][i.tagName]) {
  2366. for (
  2367. j.setStartBefore(i), d = i;
  2368. d && (3 == d.nodeType || dtd[a][d.tagName]) && d !== g;
  2369. )
  2370. (e = d),
  2371. (d = domUtils.getNextDomNode(
  2372. d,
  2373. 1 == d.nodeType,
  2374. null,
  2375. function (b) {
  2376. return dtd[a][b.tagName]
  2377. }
  2378. ))
  2379. var k,
  2380. l = j.setEndAfter(e).extractContents()
  2381. if (c && c.length > 0) {
  2382. var m, n
  2383. n = m = c[0].cloneNode(!1)
  2384. for (var o, p = 1; (o = c[p++]); )
  2385. m.appendChild(o.cloneNode(!1)), (m = m.firstChild)
  2386. k = m
  2387. } else k = j.document.createElement(a)
  2388. b && domUtils.setAttributes(k, b),
  2389. k.appendChild(l),
  2390. j.insertNode(c ? n : k)
  2391. var q
  2392. if (
  2393. ('span' == a &&
  2394. b.style &&
  2395. /text\-decoration/.test(b.style) &&
  2396. (q = domUtils.findParentByTagName(k, 'a', !0))
  2397. ? (domUtils.setAttributes(q, b),
  2398. domUtils.remove(k, !0),
  2399. (k = q))
  2400. : (domUtils.mergeSibling(k), domUtils.clearEmptySibling(k)),
  2401. domUtils.mergeChild(k, b),
  2402. (i = domUtils.getNextDomNode(k, !1, h)),
  2403. domUtils.mergeToParent(k),
  2404. d === g)
  2405. )
  2406. break
  2407. } else i = domUtils.getNextDomNode(i, !0, h)
  2408. return this.moveToBookmark(f)
  2409. },
  2410. removeInlineStyle: function (a) {
  2411. if (this.collapsed) return this
  2412. ;(a = utils.isArray(a) ? a : [a]),
  2413. this.shrinkBoundary().adjustmentBoundary()
  2414. for (var b = this.startContainer, c = this.endContainer; ; ) {
  2415. if (1 == b.nodeType) {
  2416. if (utils.indexOf(a, b.tagName.toLowerCase()) > -1) break
  2417. if ('body' == b.tagName.toLowerCase()) {
  2418. b = null
  2419. break
  2420. }
  2421. }
  2422. b = b.parentNode
  2423. }
  2424. for (;;) {
  2425. if (1 == c.nodeType) {
  2426. if (utils.indexOf(a, c.tagName.toLowerCase()) > -1) break
  2427. if ('body' == c.tagName.toLowerCase()) {
  2428. c = null
  2429. break
  2430. }
  2431. }
  2432. c = c.parentNode
  2433. }
  2434. var d,
  2435. e,
  2436. f = this.createBookmark()
  2437. b &&
  2438. ((e = this.cloneRange().setEndBefore(f.start).setStartBefore(b)),
  2439. (d = e.extractContents()),
  2440. e.insertNode(d),
  2441. domUtils.clearEmptySibling(b, !0),
  2442. b.parentNode.insertBefore(f.start, b)),
  2443. c &&
  2444. ((e = this.cloneRange().setStartAfter(f.end).setEndAfter(c)),
  2445. (d = e.extractContents()),
  2446. e.insertNode(d),
  2447. domUtils.clearEmptySibling(c, !1, !0),
  2448. c.parentNode.insertBefore(f.end, c.nextSibling))
  2449. for (
  2450. var g,
  2451. h = domUtils.getNextDomNode(f.start, !1, function (a) {
  2452. return 1 == a.nodeType
  2453. });
  2454. h && h !== f.end;
  2455. )
  2456. (g = domUtils.getNextDomNode(h, !0, function (a) {
  2457. return 1 == a.nodeType
  2458. })),
  2459. utils.indexOf(a, h.tagName.toLowerCase()) > -1 &&
  2460. domUtils.remove(h, !0),
  2461. (h = g)
  2462. return this.moveToBookmark(f)
  2463. },
  2464. getClosedNode: function () {
  2465. var a
  2466. if (!this.collapsed) {
  2467. var c = this.cloneRange().adjustmentBoundary().shrinkBoundary()
  2468. if (b(c)) {
  2469. var d = c.startContainer.childNodes[c.startOffset]
  2470. d &&
  2471. 1 == d.nodeType &&
  2472. (dtd.$empty[d.tagName] || dtd.$nonChild[d.tagName]) &&
  2473. (a = d)
  2474. }
  2475. }
  2476. return a
  2477. },
  2478. select: browser.ie
  2479. ? function (a, b) {
  2480. var c
  2481. this.collapsed || this.shrinkBoundary()
  2482. var d = this.getClosedNode()
  2483. if (d && !b) {
  2484. try {
  2485. ;(c = this.document.body.createControlRange()),
  2486. c.addElement(d),
  2487. c.select()
  2488. } catch (h) {}
  2489. return this
  2490. }
  2491. var j,
  2492. k = this.createBookmark(),
  2493. l = k.start
  2494. if (
  2495. ((c = this.document.body.createTextRange()),
  2496. c.moveToElementText(l),
  2497. c.moveStart('character', 1),
  2498. this.collapsed)
  2499. ) {
  2500. if (!a && 3 != this.startContainer.nodeType) {
  2501. var m = this.document.createTextNode(i),
  2502. n = this.document.createElement('span')
  2503. n.appendChild(this.document.createTextNode(i)),
  2504. l.parentNode.insertBefore(n, l),
  2505. l.parentNode.insertBefore(m, l),
  2506. e(this.document, m),
  2507. (g = m),
  2508. f(n, 'previousSibling'),
  2509. f(l, 'nextSibling'),
  2510. c.moveStart('character', -1),
  2511. c.collapse(!0)
  2512. }
  2513. } else {
  2514. var o = this.document.body.createTextRange()
  2515. ;(j = k.end), o.moveToElementText(j), c.setEndPoint('EndToEnd', o)
  2516. }
  2517. this.moveToBookmark(k), n && domUtils.remove(n)
  2518. try {
  2519. c.select()
  2520. } catch (h) {}
  2521. return this
  2522. }
  2523. : function (a) {
  2524. function b(a) {
  2525. function b(b, c, d) {
  2526. 3 == b.nodeType &&
  2527. b.nodeValue.length < c &&
  2528. (a[d + 'Offset'] = b.nodeValue.length)
  2529. }
  2530. b(a.startContainer, a.startOffset, 'start'),
  2531. b(a.endContainer, a.endOffset, 'end')
  2532. }
  2533. var c,
  2534. d = domUtils.getWindow(this.document),
  2535. h = d.getSelection()
  2536. if ((browser.gecko ? this.document.body.focus() : d.focus(), h)) {
  2537. if ((h.removeAllRanges(), this.collapsed && !a)) {
  2538. var j = this.startContainer,
  2539. k = j
  2540. 1 == j.nodeType && (k = j.childNodes[this.startOffset]),
  2541. (3 == j.nodeType && this.startOffset) ||
  2542. (k
  2543. ? k.previousSibling && 3 == k.previousSibling.nodeType
  2544. : j.lastChild && 3 == j.lastChild.nodeType) ||
  2545. ((c = this.document.createTextNode(i)),
  2546. this.insertNode(c),
  2547. e(this.document, c),
  2548. f(c, 'previousSibling'),
  2549. f(c, 'nextSibling'),
  2550. (g = c),
  2551. this.setStart(c, browser.webkit ? 1 : 0).collapse(!0))
  2552. }
  2553. var l = this.document.createRange()
  2554. if (
  2555. this.collapsed &&
  2556. browser.opera &&
  2557. 1 == this.startContainer.nodeType
  2558. ) {
  2559. var k = this.startContainer.childNodes[this.startOffset]
  2560. if (k) {
  2561. for (
  2562. ;
  2563. k &&
  2564. domUtils.isBlockElm(k) &&
  2565. 1 == k.nodeType &&
  2566. k.childNodes[0];
  2567. )
  2568. k = k.childNodes[0]
  2569. k && this.setStartBefore(k).collapse(!0)
  2570. } else
  2571. (k = this.startContainer.lastChild),
  2572. k && domUtils.isBr(k) && this.setStartBefore(k).collapse(!0)
  2573. }
  2574. b(this),
  2575. l.setStart(this.startContainer, this.startOffset),
  2576. l.setEnd(this.endContainer, this.endOffset),
  2577. h.addRange(l)
  2578. }
  2579. return this
  2580. },
  2581. scrollToView: function (a, b) {
  2582. a = a ? window : domUtils.getWindow(this.document)
  2583. var c = this,
  2584. d = c.document.createElement('span')
  2585. return (
  2586. (d.innerHTML = '&nbsp;'),
  2587. c.cloneRange().insertNode(d),
  2588. domUtils.scrollToView(d, a, b),
  2589. domUtils.remove(d),
  2590. c
  2591. )
  2592. },
  2593. inFillChar: function () {
  2594. var a = this.startContainer
  2595. return !(
  2596. !this.collapsed ||
  2597. 3 != a.nodeType ||
  2598. a.nodeValue.replace(new RegExp('^' + domUtils.fillChar), '').length +
  2599. 1 !=
  2600. a.nodeValue.length
  2601. )
  2602. },
  2603. createAddress: function (a, b) {
  2604. function c(a) {
  2605. for (
  2606. var c,
  2607. d = a ? e.startContainer : e.endContainer,
  2608. f = domUtils.findParents(d, !0, function (a) {
  2609. return !domUtils.isBody(a)
  2610. }),
  2611. g = [],
  2612. h = 0;
  2613. (c = f[h++]);
  2614. )
  2615. g.push(domUtils.getNodeIndex(c, b))
  2616. var i = 0
  2617. if (b)
  2618. if (3 == d.nodeType) {
  2619. for (var j = d.previousSibling; j && 3 == j.nodeType; )
  2620. (i += j.nodeValue.replace(fillCharReg, '').length),
  2621. (j = j.previousSibling)
  2622. i += a ? e.startOffset : e.endOffset
  2623. } else if ((d = d.childNodes[a ? e.startOffset : e.endOffset]))
  2624. i = domUtils.getNodeIndex(d, b)
  2625. else {
  2626. d = a ? e.startContainer : e.endContainer
  2627. for (var k = d.firstChild; k; )
  2628. if (domUtils.isFillChar(k)) k = k.nextSibling
  2629. else if ((i++, 3 == k.nodeType))
  2630. for (; k && 3 == k.nodeType; ) k = k.nextSibling
  2631. else k = k.nextSibling
  2632. }
  2633. else
  2634. i = a ? (domUtils.isFillChar(d) ? 0 : e.startOffset) : e.endOffset
  2635. return i < 0 && (i = 0), g.push(i), g
  2636. }
  2637. var d = {},
  2638. e = this
  2639. return (
  2640. (d.startAddress = c(!0)),
  2641. a || (d.endAddress = e.collapsed ? [].concat(d.startAddress) : c()),
  2642. d
  2643. )
  2644. },
  2645. moveToAddress: function (a, b) {
  2646. function c(a, b) {
  2647. for (
  2648. var c, e, f, g = d.document.body, h = 0, i = a.length;
  2649. h < i;
  2650. h++
  2651. )
  2652. if (((f = a[h]), (c = g), (g = g.childNodes[f]), !g)) {
  2653. e = f
  2654. break
  2655. }
  2656. b
  2657. ? g
  2658. ? d.setStartBefore(g)
  2659. : d.setStart(c, e)
  2660. : g
  2661. ? d.setEndBefore(g)
  2662. : d.setEnd(c, e)
  2663. }
  2664. var d = this
  2665. return c(a.startAddress, !0), !b && a.endAddress && c(a.endAddress), d
  2666. },
  2667. equals: function (a) {
  2668. for (var b in this)
  2669. if (this.hasOwnProperty(b) && this[b] !== a[b]) return !1
  2670. return !0
  2671. },
  2672. traversal: function (a, b) {
  2673. if (this.collapsed) return this
  2674. for (
  2675. var c = this.createBookmark(),
  2676. d = c.end,
  2677. e = domUtils.getNextDomNode(c.start, !1, b);
  2678. e &&
  2679. e !== d &&
  2680. domUtils.getPosition(e, d) & domUtils.POSITION_PRECEDING;
  2681. ) {
  2682. var f = domUtils.getNextDomNode(e, !1, b)
  2683. a(e), (e = f)
  2684. }
  2685. return this.moveToBookmark(c)
  2686. }
  2687. }
  2688. })(),
  2689. (function () {
  2690. function a(a, b) {
  2691. var c = domUtils.getNodeIndex
  2692. ;(a = a.duplicate()), a.collapse(b)
  2693. var d = a.parentElement()
  2694. if (!d.hasChildNodes()) return { container: d, offset: 0 }
  2695. for (
  2696. var e,
  2697. f,
  2698. g = d.children,
  2699. h = a.duplicate(),
  2700. i = 0,
  2701. j = g.length - 1,
  2702. k = -1;
  2703. i <= j;
  2704. ) {
  2705. ;(k = Math.floor((i + j) / 2)), (e = g[k]), h.moveToElementText(e)
  2706. var l = h.compareEndPoints('StartToStart', a)
  2707. if (l > 0) j = k - 1
  2708. else {
  2709. if (!(l < 0)) return { container: d, offset: c(e) }
  2710. i = k + 1
  2711. }
  2712. }
  2713. if (k == -1) {
  2714. if (
  2715. (h.moveToElementText(d),
  2716. h.setEndPoint('StartToStart', a),
  2717. (f = h.text.replace(/(\r\n|\r)/g, '\n').length),
  2718. (g = d.childNodes),
  2719. !f)
  2720. )
  2721. return (
  2722. (e = g[g.length - 1]),
  2723. { container: e, offset: e.nodeValue.length }
  2724. )
  2725. for (var m = g.length; f > 0; ) f -= g[--m].nodeValue.length
  2726. return { container: g[m], offset: -f }
  2727. }
  2728. if (
  2729. (h.collapse(l > 0),
  2730. h.setEndPoint(l > 0 ? 'StartToStart' : 'EndToStart', a),
  2731. (f = h.text.replace(/(\r\n|\r)/g, '\n').length),
  2732. !f)
  2733. )
  2734. return dtd.$empty[e.tagName] || dtd.$nonChild[e.tagName]
  2735. ? { container: d, offset: c(e) + (l > 0 ? 0 : 1) }
  2736. : { container: e, offset: l > 0 ? 0 : e.childNodes.length }
  2737. for (; f > 0; )
  2738. try {
  2739. var n = e
  2740. ;(e = e[l > 0 ? 'previousSibling' : 'nextSibling']),
  2741. (f -= e.nodeValue.length)
  2742. } catch (o) {
  2743. return { container: d, offset: c(n) }
  2744. }
  2745. return { container: e, offset: l > 0 ? -f : e.nodeValue.length + f }
  2746. }
  2747. function b(b, c) {
  2748. if (b.item) c.selectNode(b.item(0))
  2749. else {
  2750. var d = a(b, !0)
  2751. c.setStart(d.container, d.offset),
  2752. 0 != b.compareEndPoints('StartToEnd', b) &&
  2753. ((d = a(b, !1)), c.setEnd(d.container, d.offset))
  2754. }
  2755. return c
  2756. }
  2757. function c(a) {
  2758. var b
  2759. try {
  2760. b = a.getNative().createRange()
  2761. } catch (c) {
  2762. return null
  2763. }
  2764. var d = b.item ? b.item(0) : b.parentElement()
  2765. return (d.ownerDocument || d) === a.document ? b : null
  2766. }
  2767. var d = (dom.Selection = function (a) {
  2768. var b,
  2769. d = this
  2770. ;(d.document = a),
  2771. browser.ie9below &&
  2772. ((b = domUtils.getWindow(a).frameElement),
  2773. domUtils.on(b, 'beforedeactivate', function () {
  2774. d._bakIERange = d.getIERange()
  2775. }),
  2776. domUtils.on(b, 'activate', function () {
  2777. try {
  2778. !c(d) && d._bakIERange && d._bakIERange.select()
  2779. } catch (a) {}
  2780. d._bakIERange = null
  2781. })),
  2782. (b = a = null)
  2783. })
  2784. d.prototype = {
  2785. rangeInBody: function (a, b) {
  2786. var c =
  2787. browser.ie9below || b
  2788. ? a.item
  2789. ? a.item()
  2790. : a.parentElement()
  2791. : a.startContainer
  2792. return c === this.document.body || domUtils.inDoc(c, this.document)
  2793. },
  2794. getNative: function () {
  2795. var a = this.document
  2796. try {
  2797. return a
  2798. ? browser.ie9below
  2799. ? a.selection
  2800. : domUtils.getWindow(a).getSelection()
  2801. : null
  2802. } catch (b) {
  2803. return null
  2804. }
  2805. },
  2806. getIERange: function () {
  2807. var a = c(this)
  2808. return !a && this._bakIERange ? this._bakIERange : a
  2809. },
  2810. cache: function () {
  2811. this.clear(),
  2812. (this._cachedRange = this.getRange()),
  2813. (this._cachedStartElement = this.getStart()),
  2814. (this._cachedStartElementPath = this.getStartElementPath())
  2815. },
  2816. getStartElementPath: function () {
  2817. if (this._cachedStartElementPath) return this._cachedStartElementPath
  2818. var a = this.getStart()
  2819. return a ? domUtils.findParents(a, !0, null, !0) : []
  2820. },
  2821. clear: function () {
  2822. this._cachedStartElementPath =
  2823. this._cachedRange =
  2824. this._cachedStartElement =
  2825. null
  2826. },
  2827. isFocus: function () {
  2828. try {
  2829. if (browser.ie9below) {
  2830. var a = c(this)
  2831. return !(!a || !this.rangeInBody(a))
  2832. }
  2833. return !!this.getNative().rangeCount
  2834. } catch (b) {
  2835. return !1
  2836. }
  2837. },
  2838. getRange: function () {
  2839. function a(a) {
  2840. for (
  2841. var b = c.document.body.firstChild, d = a.collapsed;
  2842. b && b.firstChild;
  2843. )
  2844. a.setStart(b, 0), (b = b.firstChild)
  2845. a.startContainer || a.setStart(c.document.body, 0),
  2846. d && a.collapse(!0)
  2847. }
  2848. var c = this
  2849. if (null != c._cachedRange) return this._cachedRange
  2850. var d = new baidu.editor.dom.Range(c.document)
  2851. if (browser.ie9below) {
  2852. var e = c.getIERange()
  2853. if (e)
  2854. try {
  2855. b(e, d)
  2856. } catch (f) {
  2857. a(d)
  2858. }
  2859. else a(d)
  2860. } else {
  2861. var g = c.getNative()
  2862. if (g && g.rangeCount) {
  2863. var h = g.getRangeAt(0),
  2864. i = g.getRangeAt(g.rangeCount - 1)
  2865. d
  2866. .setStart(h.startContainer, h.startOffset)
  2867. .setEnd(i.endContainer, i.endOffset),
  2868. d.collapsed &&
  2869. domUtils.isBody(d.startContainer) &&
  2870. !d.startOffset &&
  2871. a(d)
  2872. } else {
  2873. if (
  2874. this._bakRange &&
  2875. domUtils.inDoc(this._bakRange.startContainer, this.document)
  2876. )
  2877. return this._bakRange
  2878. a(d)
  2879. }
  2880. }
  2881. return (this._bakRange = d)
  2882. },
  2883. getStart: function () {
  2884. if (this._cachedStartElement) return this._cachedStartElement
  2885. var a,
  2886. b,
  2887. c,
  2888. d,
  2889. e = browser.ie9below ? this.getIERange() : this.getRange()
  2890. if (browser.ie9below) {
  2891. if (!e) return this.document.body.firstChild
  2892. if (e.item) return e.item(0)
  2893. for (
  2894. a = e.duplicate(),
  2895. a.text.length > 0 && a.moveStart('character', 1),
  2896. a.collapse(1),
  2897. b = a.parentElement(),
  2898. d = c = e.parentElement();
  2899. (c = c.parentNode);
  2900. )
  2901. if (c == b) {
  2902. b = d
  2903. break
  2904. }
  2905. } else if (
  2906. (e.shrinkBoundary(),
  2907. (b = e.startContainer),
  2908. 1 == b.nodeType &&
  2909. b.hasChildNodes() &&
  2910. (b =
  2911. b.childNodes[Math.min(b.childNodes.length - 1, e.startOffset)]),
  2912. 3 == b.nodeType)
  2913. )
  2914. return b.parentNode
  2915. return b
  2916. },
  2917. getText: function () {
  2918. var a, b
  2919. return this.isFocus() && (a = this.getNative())
  2920. ? ((b = browser.ie9below ? a.createRange() : a.getRangeAt(0)),
  2921. browser.ie9below ? b.text : b.toString())
  2922. : ''
  2923. },
  2924. clearRange: function () {
  2925. this.getNative()[browser.ie9below ? 'empty' : 'removeAllRanges']()
  2926. }
  2927. }
  2928. })(),
  2929. (function () {
  2930. function a(a, b) {
  2931. var c
  2932. if (b.textarea)
  2933. if (utils.isString(b.textarea)) {
  2934. for (
  2935. var d, e = 0, f = domUtils.getElementsByTagName(a, 'textarea');
  2936. (d = f[e++]);
  2937. )
  2938. if (d.id == 'ueditor_textarea_' + b.options.textarea) {
  2939. c = d
  2940. break
  2941. }
  2942. } else c = b.textarea
  2943. c ||
  2944. (a.appendChild(
  2945. (c = domUtils.createElement(document, 'textarea', {
  2946. name: b.options.textarea,
  2947. id: 'ueditor_textarea_' + b.options.textarea,
  2948. style: 'display:none'
  2949. }))
  2950. ),
  2951. (b.textarea = c)),
  2952. !c.getAttribute('name') && c.setAttribute('name', b.options.textarea),
  2953. (c.value = b.hasContents()
  2954. ? b.options.allHtmlEnabled
  2955. ? b.getAllHtml()
  2956. : b.getContent(null, null, !0)
  2957. : '')
  2958. }
  2959. function b(a) {
  2960. for (var b in a) return b
  2961. }
  2962. function c(a) {
  2963. ;(a.langIsReady = !0), a.fireEvent('langReady')
  2964. }
  2965. var d,
  2966. e = 0,
  2967. f = (UE.Editor = function (a) {
  2968. var d = this
  2969. ;(d.uid = e++),
  2970. EventBase.call(d),
  2971. (d.commands = {}),
  2972. (d.options = utils.extend(
  2973. utils.clone(a || {}),
  2974. UEDITOR_CONFIG,
  2975. !0
  2976. )),
  2977. (d.shortcutkeys = {}),
  2978. (d.inputRules = []),
  2979. (d.outputRules = []),
  2980. d.setOpt(f.defaultOptions(d)),
  2981. d.loadServerConfig(),
  2982. utils.isEmptyObject(UE.I18N)
  2983. ? utils.loadFile(
  2984. document,
  2985. {
  2986. src:
  2987. d.options.langPath +
  2988. d.options.lang +
  2989. '/' +
  2990. d.options.lang +
  2991. '.js',
  2992. tag: 'script',
  2993. type: 'text/javascript',
  2994. defer: 'defer'
  2995. },
  2996. function () {
  2997. UE.plugin.load(d), c(d)
  2998. }
  2999. )
  3000. : ((d.options.lang = b(UE.I18N)), UE.plugin.load(d), c(d)),
  3001. (UE.instants['ueditorInstant' + d.uid] = d)
  3002. })
  3003. ;(f.prototype = {
  3004. registerCommand: function (a, b) {
  3005. this.commands[a] = b
  3006. },
  3007. ready: function (a) {
  3008. var b = this
  3009. a && (b.isReady ? a.apply(b) : b.addListener('ready', a))
  3010. },
  3011. setOpt: function (a, b) {
  3012. var c = {}
  3013. utils.isString(a) ? (c[a] = b) : (c = a),
  3014. utils.extend(this.options, c, !0)
  3015. },
  3016. getOpt: function (a) {
  3017. return this.options[a]
  3018. },
  3019. destroy: function () {
  3020. var a = this
  3021. a.fireEvent('destroy')
  3022. var b = a.container.parentNode,
  3023. c = a.textarea
  3024. c
  3025. ? (c.style.display = '')
  3026. : ((c = document.createElement('textarea')),
  3027. b.parentNode.insertBefore(c, b)),
  3028. (c.style.width = a.iframe.offsetWidth + 'px'),
  3029. (c.style.height = a.iframe.offsetHeight + 'px'),
  3030. (c.value = a.getContent()),
  3031. (c.id = a.key),
  3032. (b.innerHTML = ''),
  3033. domUtils.remove(b)
  3034. var d = a.key
  3035. for (var e in a) a.hasOwnProperty(e) && delete this[e]
  3036. UE.delEditor(d)
  3037. },
  3038. render: function (a) {
  3039. var b = this,
  3040. c = b.options,
  3041. d = function (b) {
  3042. return parseInt(domUtils.getComputedStyle(a, b))
  3043. }
  3044. if ((utils.isString(a) && (a = document.getElementById(a)), a)) {
  3045. c.initialFrameWidth
  3046. ? (c.minFrameWidth = c.initialFrameWidth)
  3047. : (c.minFrameWidth = c.initialFrameWidth = a.offsetWidth),
  3048. c.initialFrameHeight
  3049. ? (c.minFrameHeight = c.initialFrameHeight)
  3050. : (c.initialFrameHeight = c.minFrameHeight = a.offsetHeight),
  3051. (a.style.width = /%$/.test(c.initialFrameWidth)
  3052. ? '100%'
  3053. : c.initialFrameWidth -
  3054. d('padding-left') -
  3055. d('padding-right') +
  3056. 'px'),
  3057. (a.style.height = /%$/.test(c.initialFrameHeight)
  3058. ? '100%'
  3059. : c.initialFrameHeight -
  3060. d('padding-top') -
  3061. d('padding-bottom') +
  3062. 'px'),
  3063. (a.style.zIndex = c.zIndex)
  3064. var e =
  3065. (ie && browser.version < 9 ? '' : '<!DOCTYPE html>') +
  3066. "<html xmlns='http://www.w3.org/1999/xhtml' class='view' ><head><style type='text/css'>.view{padding:0;word-wrap:break-word;cursor:text;height:90%;}\nbody{margin:8px;font-family:sans-serif;font-size:16px;}p{margin:5px 0;}</style>" +
  3067. (c.iframeCssUrl
  3068. ? "<link rel='stylesheet' type='text/css' href='" +
  3069. utils.unhtml(c.iframeCssUrl) +
  3070. "'/>"
  3071. : '') +
  3072. (c.initialStyle ? '<style>' + c.initialStyle + '</style>' : '') +
  3073. "</head><body class='view' ></body><script type='text/javascript' " +
  3074. (ie ? "defer='defer'" : '') +
  3075. " id='_initialScript'>setTimeout(function(){editor = window.parent.UE.instants['ueditorInstant" +
  3076. b.uid +
  3077. "'];editor._setup(document);},0);var _tmpScript = document.getElementById('_initialScript');_tmpScript.parentNode.removeChild(_tmpScript);</script></html>"
  3078. a.appendChild(
  3079. domUtils.createElement(document, 'iframe', {
  3080. id: 'ueditor_' + b.uid,
  3081. width: '100%',
  3082. height: '100%',
  3083. frameborder: '0',
  3084. src:
  3085. 'javascript:void(function(){document.open();' +
  3086. (c.customDomain && document.domain != location.hostname
  3087. ? 'document.domain="' + document.domain + '";'
  3088. : '') +
  3089. 'document.write("' +
  3090. e +
  3091. '");document.close();}())'
  3092. })
  3093. ),
  3094. (a.style.overflow = 'hidden'),
  3095. setTimeout(function () {
  3096. ;/%$/.test(c.initialFrameWidth) &&
  3097. (c.minFrameWidth = c.initialFrameWidth = a.offsetWidth),
  3098. /%$/.test(c.initialFrameHeight) &&
  3099. ((c.minFrameHeight = c.initialFrameHeight = a.offsetHeight),
  3100. (a.style.height = c.initialFrameHeight + 'px'))
  3101. })
  3102. }
  3103. },
  3104. _setup: function (b) {
  3105. var c = this,
  3106. d = c.options
  3107. ie
  3108. ? ((b.body.disabled = !0),
  3109. (b.body.contentEditable = !0),
  3110. (b.body.disabled = !1))
  3111. : (b.body.contentEditable = !0),
  3112. (b.body.spellcheck = !1),
  3113. (c.document = b),
  3114. (c.window = b.defaultView || b.parentWindow),
  3115. (c.iframe = c.window.frameElement),
  3116. (c.body = b.body),
  3117. (c.selection = new dom.Selection(b))
  3118. var e
  3119. browser.gecko &&
  3120. (e = this.selection.getNative()) &&
  3121. e.removeAllRanges(),
  3122. this._initEvents()
  3123. for (
  3124. var f = this.iframe.parentNode;
  3125. !domUtils.isBody(f);
  3126. f = f.parentNode
  3127. )
  3128. if ('FORM' == f.tagName) {
  3129. ;(c.form = f),
  3130. c.options.autoSyncData
  3131. ? domUtils.on(c.window, 'blur', function () {
  3132. a(f, c)
  3133. })
  3134. : domUtils.on(f, 'submit', function () {
  3135. a(this, c)
  3136. })
  3137. break
  3138. }
  3139. if (d.initialContent)
  3140. if (d.autoClearinitialContent) {
  3141. var g = c.execCommand
  3142. ;(c.execCommand = function () {
  3143. return (
  3144. c.fireEvent('firstBeforeExecCommand'), g.apply(c, arguments)
  3145. )
  3146. }),
  3147. this._setDefaultContent(d.initialContent)
  3148. } else this.setContent(d.initialContent, !1, !0)
  3149. domUtils.isEmptyNode(c.body) &&
  3150. (c.body.innerHTML = '<p>' + (browser.ie ? '' : '<br/>') + '</p>'),
  3151. d.focus &&
  3152. setTimeout(function () {
  3153. c.focus(c.options.focusInEnd),
  3154. !c.options.autoClearinitialContent && c._selectionChange()
  3155. }, 0),
  3156. c.container || (c.container = this.iframe.parentNode),
  3157. d.fullscreen && c.ui && c.ui.setFullScreen(!0)
  3158. try {
  3159. c.document.execCommand('2D-position', !1, !1)
  3160. } catch (h) {}
  3161. try {
  3162. c.document.execCommand('enableInlineTableEditing', !1, !1)
  3163. } catch (h) {}
  3164. try {
  3165. c.document.execCommand('enableObjectResizing', !1, !1)
  3166. } catch (h) {}
  3167. c._bindshortcutKeys(),
  3168. (c.isReady = 1),
  3169. c.fireEvent('ready'),
  3170. d.onready && d.onready.call(c),
  3171. browser.ie9below ||
  3172. domUtils.on(c.window, ['blur', 'focus'], function (a) {
  3173. if ('blur' == a.type) {
  3174. c._bakRange = c.selection.getRange()
  3175. try {
  3176. ;(c._bakNativeRange = c.selection
  3177. .getNative()
  3178. .getRangeAt(0)),
  3179. c.selection.getNative().removeAllRanges()
  3180. } catch (a) {
  3181. c._bakNativeRange = null
  3182. }
  3183. } else
  3184. try {
  3185. c._bakRange && c._bakRange.select()
  3186. } catch (a) {}
  3187. }),
  3188. browser.gecko &&
  3189. browser.version <= 10902 &&
  3190. ((c.body.contentEditable = !1),
  3191. setTimeout(function () {
  3192. c.body.contentEditable = !0
  3193. }, 100),
  3194. setInterval(function () {
  3195. c.body.style.height = c.iframe.offsetHeight - 20 + 'px'
  3196. }, 100)),
  3197. !d.isShow && c.setHide(),
  3198. d.readonly && c.setDisabled()
  3199. },
  3200. sync: function (b) {
  3201. var c = this,
  3202. d = b
  3203. ? document.getElementById(b)
  3204. : domUtils.findParent(
  3205. c.iframe.parentNode,
  3206. function (a) {
  3207. return 'FORM' == a.tagName
  3208. },
  3209. !0
  3210. )
  3211. d && a(d, c)
  3212. },
  3213. setHeight: function (a, b) {
  3214. a !== parseInt(this.iframe.parentNode.style.height) &&
  3215. (this.iframe.parentNode.style.height = a + 'px'),
  3216. !b &&
  3217. (this.options.minFrameHeight = this.options.initialFrameHeight =
  3218. a),
  3219. (this.body.style.height = a + 'px'),
  3220. !b && this.trigger('setHeight')
  3221. },
  3222. addshortcutkey: function (a, b) {
  3223. var c = {}
  3224. b ? (c[a] = b) : (c = a), utils.extend(this.shortcutkeys, c)
  3225. },
  3226. _bindshortcutKeys: function () {
  3227. var a = this,
  3228. b = this.shortcutkeys
  3229. a.addListener('keydown', function (c, d) {
  3230. var e = d.keyCode || d.which
  3231. for (var f in b)
  3232. for (var g, h = b[f].split(','), i = 0; (g = h[i++]); ) {
  3233. g = g.split(':')
  3234. var j = g[0],
  3235. k = g[1]
  3236. ;(/^(ctrl)(\+shift)?\+(\d+)$/.test(j.toLowerCase()) ||
  3237. /^(\d+)$/.test(j)) &&
  3238. ((('ctrl' == RegExp.$1 ? d.ctrlKey || d.metaKey : 0) &&
  3239. ('' != RegExp.$2 ? d[RegExp.$2.slice(1) + 'Key'] : 1) &&
  3240. e == RegExp.$3) ||
  3241. e == RegExp.$1) &&
  3242. (a.queryCommandState(f, k) != -1 && a.execCommand(f, k),
  3243. domUtils.preventDefault(d))
  3244. }
  3245. })
  3246. },
  3247. getContent: function (a, b, c, d, e) {
  3248. var f = this
  3249. if (
  3250. (a && utils.isFunction(a) && ((b = a), (a = '')),
  3251. b ? !b() : !this.hasContents())
  3252. )
  3253. return ''
  3254. f.fireEvent('beforegetcontent')
  3255. var g = UE.htmlparser(f.body.innerHTML, d)
  3256. return (
  3257. f.filterOutputRule(g),
  3258. f.fireEvent('aftergetcontent', a, g),
  3259. g.toHtml(e)
  3260. )
  3261. },
  3262. getAllHtml: function () {
  3263. var a = this,
  3264. b = []
  3265. if (
  3266. (a.fireEvent('getAllHtml', b), browser.ie && browser.version > 8)
  3267. ) {
  3268. var c = ''
  3269. utils.each(a.document.styleSheets, function (a) {
  3270. c += a.href
  3271. ? '<link rel="stylesheet" type="text/css" href="' +
  3272. a.href +
  3273. '" />'
  3274. : '<style>' + a.cssText + '</style>'
  3275. }),
  3276. utils.each(
  3277. a.document.getElementsByTagName('script'),
  3278. function (a) {
  3279. c += a.outerHTML
  3280. }
  3281. )
  3282. }
  3283. return (
  3284. '<html><head>' +
  3285. (a.options.charset
  3286. ? '<meta http-equiv="Content-Type" content="text/html; charset=' +
  3287. a.options.charset +
  3288. '"/>'
  3289. : '') +
  3290. (c || a.document.getElementsByTagName('head')[0].innerHTML) +
  3291. b.join('\n') +
  3292. '</head><body ' +
  3293. (ie && browser.version < 9 ? 'class="view"' : '') +
  3294. '>' +
  3295. a.getContent(null, null, !0) +
  3296. '</body></html>'
  3297. )
  3298. },
  3299. getPlainTxt: function () {
  3300. var a = new RegExp(domUtils.fillChar, 'g'),
  3301. b = this.body.innerHTML.replace(/[\n\r]/g, '')
  3302. return (
  3303. (b = b
  3304. .replace(/<(p|div)[^>]*>(<br\/?>|&nbsp;)<\/\1>/gi, '\n')
  3305. .replace(/<br\/?>/gi, '\n')
  3306. .replace(/<[^>\/]+>/g, '')
  3307. .replace(/(\n)?<\/([^>]+)>/g, function (a, b, c) {
  3308. return dtd.$block[c] ? '\n' : b ? b : ''
  3309. })),
  3310. b
  3311. .replace(a, '')
  3312. .replace(/\u00a0/g, ' ')
  3313. .replace(/&nbsp;/g, ' ')
  3314. )
  3315. },
  3316. getContentTxt: function () {
  3317. var a = new RegExp(domUtils.fillChar, 'g')
  3318. return this.body[browser.ie ? 'innerText' : 'textContent']
  3319. .replace(a, '')
  3320. .replace(/\u00a0/g, ' ')
  3321. },
  3322. setContent: function (b, c, d) {
  3323. function e(a) {
  3324. return 'DIV' == a.tagName && a.getAttribute('cdata_tag')
  3325. }
  3326. var f = this
  3327. f.fireEvent('beforesetcontent', b)
  3328. var g = UE.htmlparser(b)
  3329. if (
  3330. (f.filterInputRule(g),
  3331. (b = g.toHtml()),
  3332. (f.body.innerHTML = (c ? f.body.innerHTML : '') + b),
  3333. 'p' == f.options.enterTag)
  3334. ) {
  3335. var h,
  3336. i = this.body.firstChild
  3337. if (
  3338. !i ||
  3339. (1 == i.nodeType &&
  3340. (dtd.$cdata[i.tagName] || e(i) || domUtils.isCustomeNode(i)) &&
  3341. i === this.body.lastChild)
  3342. )
  3343. this.body.innerHTML =
  3344. '<p>' +
  3345. (browser.ie ? '&nbsp;' : '<br/>') +
  3346. '</p>' +
  3347. this.body.innerHTML
  3348. else
  3349. for (var j = f.document.createElement('p'); i; ) {
  3350. for (
  3351. ;
  3352. i &&
  3353. (3 == i.nodeType ||
  3354. (1 == i.nodeType &&
  3355. dtd.p[i.tagName] &&
  3356. !dtd.$cdata[i.tagName]));
  3357. )
  3358. (h = i.nextSibling), j.appendChild(i), (i = h)
  3359. if (j.firstChild) {
  3360. if (!i) {
  3361. f.body.appendChild(j)
  3362. break
  3363. }
  3364. i.parentNode.insertBefore(j, i),
  3365. (j = f.document.createElement('p'))
  3366. }
  3367. i = i.nextSibling
  3368. }
  3369. }
  3370. f.fireEvent('aftersetcontent'),
  3371. f.fireEvent('contentchange'),
  3372. !d && f._selectionChange(),
  3373. (f._bakRange = f._bakIERange = f._bakNativeRange = null)
  3374. var k
  3375. browser.gecko &&
  3376. (k = this.selection.getNative()) &&
  3377. k.removeAllRanges(),
  3378. f.options.autoSyncData && f.form && a(f.form, f)
  3379. },
  3380. focus: function (a) {
  3381. try {
  3382. var b = this,
  3383. c = b.selection.getRange()
  3384. if (a) {
  3385. var d = b.body.lastChild
  3386. d &&
  3387. 1 == d.nodeType &&
  3388. !dtd.$empty[d.tagName] &&
  3389. (domUtils.isEmptyBlock(d)
  3390. ? c.setStartAtFirst(d)
  3391. : c.setStartAtLast(d),
  3392. c.collapse(!0)),
  3393. c.setCursor(!0)
  3394. } else {
  3395. if (
  3396. !c.collapsed &&
  3397. domUtils.isBody(c.startContainer) &&
  3398. 0 == c.startOffset
  3399. ) {
  3400. var d = b.body.firstChild
  3401. d &&
  3402. 1 == d.nodeType &&
  3403. !dtd.$empty[d.tagName] &&
  3404. c.setStartAtFirst(d).collapse(!0)
  3405. }
  3406. c.select(!0)
  3407. }
  3408. this.fireEvent('focus selectionchange')
  3409. } catch (e) {}
  3410. },
  3411. isFocus: function () {
  3412. return this.selection.isFocus()
  3413. },
  3414. blur: function () {
  3415. var a = this.selection.getNative()
  3416. if (a.empty && browser.ie) {
  3417. var b = document.body.createTextRange()
  3418. b.moveToElementText(document.body),
  3419. b.collapse(!0),
  3420. b.select(),
  3421. a.empty()
  3422. } else a.removeAllRanges()
  3423. },
  3424. _initEvents: function () {
  3425. var a = this,
  3426. b = a.document,
  3427. c = a.window
  3428. ;(a._proxyDomEvent = utils.bind(a._proxyDomEvent, a)),
  3429. domUtils.on(
  3430. b,
  3431. [
  3432. 'click',
  3433. 'contextmenu',
  3434. 'mousedown',
  3435. 'keydown',
  3436. 'keyup',
  3437. 'keypress',
  3438. 'mouseup',
  3439. 'mouseover',
  3440. 'mouseout',
  3441. 'selectstart'
  3442. ],
  3443. a._proxyDomEvent
  3444. ),
  3445. domUtils.on(c, ['focus', 'blur'], a._proxyDomEvent),
  3446. domUtils.on(a.body, 'drop', function (b) {
  3447. browser.gecko && b.stopPropagation && b.stopPropagation(),
  3448. a.fireEvent('contentchange')
  3449. }),
  3450. domUtils.on(b, ['mouseup', 'keydown'], function (b) {
  3451. ;('keydown' == b.type &&
  3452. (b.ctrlKey || b.metaKey || b.shiftKey || b.altKey)) ||
  3453. (2 != b.button && a._selectionChange(250, b))
  3454. })
  3455. },
  3456. _proxyDomEvent: function (a) {
  3457. return (
  3458. this.fireEvent(
  3459. 'before' + a.type.replace(/^on/, '').toLowerCase()
  3460. ) !== !1 &&
  3461. this.fireEvent(a.type.replace(/^on/, ''), a) !== !1 &&
  3462. this.fireEvent('after' + a.type.replace(/^on/, '').toLowerCase())
  3463. )
  3464. },
  3465. _selectionChange: function (a, b) {
  3466. var c,
  3467. e,
  3468. f = this,
  3469. g = !1
  3470. if (browser.ie && browser.version < 9 && b && 'mouseup' == b.type) {
  3471. var h = this.selection.getRange()
  3472. h.collapsed || ((g = !0), (c = b.clientX), (e = b.clientY))
  3473. }
  3474. clearTimeout(d),
  3475. (d = setTimeout(function () {
  3476. if (f.selection && f.selection.getNative()) {
  3477. var a
  3478. if (g && 'None' == f.selection.getNative().type) {
  3479. a = f.document.body.createTextRange()
  3480. try {
  3481. a.moveToPoint(c, e)
  3482. } catch (d) {
  3483. a = null
  3484. }
  3485. }
  3486. var h
  3487. a &&
  3488. ((h = f.selection.getIERange),
  3489. (f.selection.getIERange = function () {
  3490. return a
  3491. })),
  3492. f.selection.cache(),
  3493. h && (f.selection.getIERange = h),
  3494. f.selection._cachedRange &&
  3495. f.selection._cachedStartElement &&
  3496. (f.fireEvent('beforeselectionchange'),
  3497. f.fireEvent('selectionchange', !!b),
  3498. f.fireEvent('afterselectionchange'),
  3499. f.selection.clear())
  3500. }
  3501. }, a || 50))
  3502. },
  3503. _callCmdFn: function (a, b) {
  3504. var c,
  3505. d,
  3506. e = b[0].toLowerCase()
  3507. return (
  3508. (c = this.commands[e] || UE.commands[e]),
  3509. (d = c && c[a]),
  3510. (c && d) || 'queryCommandState' != a
  3511. ? d
  3512. ? d.apply(this, b)
  3513. : void 0
  3514. : 0
  3515. )
  3516. },
  3517. execCommand: function (a) {
  3518. a = a.toLowerCase()
  3519. var b,
  3520. c = this,
  3521. d = c.commands[a] || UE.commands[a]
  3522. return d && d.execCommand
  3523. ? (d.notNeedUndo || c.__hasEnterExecCommand
  3524. ? ((b = this._callCmdFn('execCommand', arguments)),
  3525. !c.__hasEnterExecCommand &&
  3526. !d.ignoreContentChange &&
  3527. !c._ignoreContentChange &&
  3528. c.fireEvent('contentchange'))
  3529. : ((c.__hasEnterExecCommand = !0),
  3530. c.queryCommandState.apply(c, arguments) != -1 &&
  3531. (c.fireEvent('saveScene'),
  3532. c.fireEvent.apply(
  3533. c,
  3534. ['beforeexeccommand', a].concat(arguments)
  3535. ),
  3536. (b = this._callCmdFn('execCommand', arguments)),
  3537. c.fireEvent.apply(
  3538. c,
  3539. ['afterexeccommand', a].concat(arguments)
  3540. ),
  3541. c.fireEvent('saveScene')),
  3542. (c.__hasEnterExecCommand = !1)),
  3543. !c.__hasEnterExecCommand &&
  3544. !d.ignoreContentChange &&
  3545. !c._ignoreContentChange &&
  3546. c._selectionChange(),
  3547. b)
  3548. : null
  3549. },
  3550. queryCommandState: function (a) {
  3551. return this._callCmdFn('queryCommandState', arguments)
  3552. },
  3553. queryCommandValue: function (a) {
  3554. return this._callCmdFn('queryCommandValue', arguments)
  3555. },
  3556. hasContents: function (a) {
  3557. if (a)
  3558. for (var b, c = 0; (b = a[c++]); )
  3559. if (this.document.getElementsByTagName(b).length > 0) return !0
  3560. if (!domUtils.isEmptyBlock(this.body)) return !0
  3561. for (a = ['div'], c = 0; (b = a[c++]); )
  3562. for (
  3563. var d, e = domUtils.getElementsByTagName(this.document, b), f = 0;
  3564. (d = e[f++]);
  3565. )
  3566. if (domUtils.isCustomeNode(d)) return !0
  3567. return !1
  3568. },
  3569. reset: function () {
  3570. this.fireEvent('reset')
  3571. },
  3572. setEnabled: function () {
  3573. var a,
  3574. b = this
  3575. if ('false' == b.body.contentEditable) {
  3576. ;(b.body.contentEditable = !0), (a = b.selection.getRange())
  3577. try {
  3578. a.moveToBookmark(b.lastBk), delete b.lastBk
  3579. } catch (c) {
  3580. a.setStartAtFirst(b.body).collapse(!0)
  3581. }
  3582. a.select(!0),
  3583. b.bkqueryCommandState &&
  3584. ((b.queryCommandState = b.bkqueryCommandState),
  3585. delete b.bkqueryCommandState),
  3586. b.bkqueryCommandValue &&
  3587. ((b.queryCommandValue = b.bkqueryCommandValue),
  3588. delete b.bkqueryCommandValue),
  3589. b.fireEvent('selectionchange')
  3590. }
  3591. },
  3592. enable: function () {
  3593. return this.setEnabled()
  3594. },
  3595. setDisabled: function (a) {
  3596. var b = this
  3597. ;(a = a ? (utils.isArray(a) ? a : [a]) : []),
  3598. 'true' == b.body.contentEditable &&
  3599. (b.lastBk ||
  3600. (b.lastBk = b.selection.getRange().createBookmark(!0)),
  3601. (b.body.contentEditable = !1),
  3602. (b.bkqueryCommandState = b.queryCommandState),
  3603. (b.bkqueryCommandValue = b.queryCommandValue),
  3604. (b.queryCommandState = function (c) {
  3605. return utils.indexOf(a, c) != -1
  3606. ? b.bkqueryCommandState.apply(b, arguments)
  3607. : -1
  3608. }),
  3609. (b.queryCommandValue = function (c) {
  3610. return utils.indexOf(a, c) != -1
  3611. ? b.bkqueryCommandValue.apply(b, arguments)
  3612. : null
  3613. }),
  3614. b.fireEvent('selectionchange'))
  3615. },
  3616. disable: function (a) {
  3617. return this.setDisabled(a)
  3618. },
  3619. _setDefaultContent: (function () {
  3620. function a() {
  3621. var b = this
  3622. b.document.getElementById('initContent') &&
  3623. ((b.body.innerHTML = '<p>' + (ie ? '' : '<br/>') + '</p>'),
  3624. b.removeListener('firstBeforeExecCommand focus', a),
  3625. setTimeout(function () {
  3626. b.focus(), b._selectionChange()
  3627. }, 0))
  3628. }
  3629. return function (b) {
  3630. var c = this
  3631. ;(c.body.innerHTML = '<p id="initContent">' + b + '</p>'),
  3632. c.addListener('firstBeforeExecCommand focus', a)
  3633. }
  3634. })(),
  3635. setShow: function () {
  3636. var a = this,
  3637. b = a.selection.getRange()
  3638. if ('none' == a.container.style.display) {
  3639. try {
  3640. b.moveToBookmark(a.lastBk), delete a.lastBk
  3641. } catch (c) {
  3642. b.setStartAtFirst(a.body).collapse(!0)
  3643. }
  3644. setTimeout(function () {
  3645. b.select(!0)
  3646. }, 100),
  3647. (a.container.style.display = '')
  3648. }
  3649. },
  3650. show: function () {
  3651. return this.setShow()
  3652. },
  3653. setHide: function () {
  3654. var a = this
  3655. a.lastBk || (a.lastBk = a.selection.getRange().createBookmark(!0)),
  3656. (a.container.style.display = 'none')
  3657. },
  3658. hide: function () {
  3659. return this.setHide()
  3660. },
  3661. getLang: function (a) {
  3662. if (!this.options) return ''
  3663. var b = UE.I18N[this.options.lang]
  3664. if (!b) throw Error('not import language file')
  3665. a = (a || '').split('.')
  3666. for (var c, d = 0; (c = a[d++]) && ((b = b[c]), b); );
  3667. return b
  3668. },
  3669. getContentLength: function (a, b) {
  3670. var c = this.getContent(!1, !1, !0).length
  3671. if (a) {
  3672. ;(b = (b || []).concat(['hr', 'img', 'iframe'])),
  3673. (c = this.getContentTxt().replace(/[\t\r\n]+/g, '').length)
  3674. for (var d, e = 0; (d = b[e++]); )
  3675. c += this.document.getElementsByTagName(d).length
  3676. }
  3677. return c
  3678. },
  3679. addInputRule: function (a) {
  3680. this.inputRules.push(a)
  3681. },
  3682. filterInputRule: function (a) {
  3683. for (var b, c = 0; (b = this.inputRules[c++]); ) b.call(this, a)
  3684. },
  3685. addOutputRule: function (a) {
  3686. this.outputRules.push(a)
  3687. },
  3688. filterOutputRule: function (a) {
  3689. for (var b, c = 0; (b = this.outputRules[c++]); ) b.call(this, a)
  3690. },
  3691. getActionUrl: function (a) {
  3692. var b = this.getOpt(a) || a,
  3693. c = this.getOpt('imageUrl'),
  3694. d = this.getOpt('serverUrl')
  3695. return (
  3696. !d &&
  3697. c &&
  3698. (d = c.replace(/^(.*[\/]).+([\.].+)$/, '$1controller$2')),
  3699. d
  3700. ? ((d =
  3701. d +
  3702. (d.indexOf('?') == -1 ? '?' : '&') +
  3703. 'action=' +
  3704. (b || '')),
  3705. utils.formatUrl(d))
  3706. : ''
  3707. )
  3708. }
  3709. }),
  3710. utils.inherits(f, EventBase)
  3711. })(),
  3712. (UE.Editor.defaultOptions = function (a) {
  3713. var b = a.options.UEDITOR_HOME_URL
  3714. return {
  3715. isShow: !0,
  3716. initialContent: '',
  3717. initialStyle: '',
  3718. autoClearinitialContent: !1,
  3719. iframeCssUrl: b + 'themes/iframe.css',
  3720. textarea: 'editorValue',
  3721. focus: !1,
  3722. focusInEnd: !0,
  3723. autoClearEmptyNode: !0,
  3724. fullscreen: !1,
  3725. readonly: !1,
  3726. zIndex: 999,
  3727. imagePopup: !0,
  3728. enterTag: 'p',
  3729. customDomain: !1,
  3730. lang: 'zh-cn',
  3731. langPath: b + 'lang/',
  3732. theme: 'default',
  3733. themePath: b + 'themes/',
  3734. allHtmlEnabled: !1,
  3735. scaleEnabled: !1,
  3736. tableNativeEditInFF: !1,
  3737. autoSyncData: !0,
  3738. fileNameFormat: '{time}{rand:6}'
  3739. }
  3740. }),
  3741. (function () {
  3742. ;(UE.Editor.prototype.loadServerConfig = function () {
  3743. function showErrorMsg(a) {
  3744. console && console.error(a)
  3745. }
  3746. var me = this
  3747. setTimeout(function () {
  3748. try {
  3749. me.options.imageUrl &&
  3750. me.setOpt(
  3751. 'serverUrl',
  3752. me.options.imageUrl.replace(
  3753. /^(.*[\/]).+([\.].+)$/,
  3754. '$1controller$2'
  3755. )
  3756. )
  3757. var configUrl = me.getActionUrl('config'),
  3758. isJsonp = utils.isCrossDomainUrl(configUrl)
  3759. ;(me._serverConfigLoaded = !1),
  3760. configUrl &&
  3761. UE.ajax.request(configUrl, {
  3762. method: 'GET',
  3763. dataType: isJsonp ? 'jsonp' : '',
  3764. onsuccess: function (r) {
  3765. try {
  3766. var config = isJsonp
  3767. ? r
  3768. : eval('(' + r.responseText + ')')
  3769. utils.extend(me.options, config),
  3770. me.fireEvent('serverConfigLoaded'),
  3771. (me._serverConfigLoaded = !0)
  3772. } catch (e) {
  3773. showErrorMsg(me.getLang('loadconfigFormatError'))
  3774. }
  3775. },
  3776. onerror: function () {
  3777. showErrorMsg(me.getLang('loadconfigHttpError'))
  3778. }
  3779. })
  3780. } catch (e) {
  3781. showErrorMsg(me.getLang('loadconfigError'))
  3782. }
  3783. })
  3784. }),
  3785. (UE.Editor.prototype.isServerConfigLoaded = function () {
  3786. var a = this
  3787. return a._serverConfigLoaded || !1
  3788. }),
  3789. (UE.Editor.prototype.afterConfigReady = function (a) {
  3790. if (a && utils.isFunction(a)) {
  3791. var b = this,
  3792. c = function () {
  3793. a.apply(b, arguments), b.removeListener('serverConfigLoaded', c)
  3794. }
  3795. b.isServerConfigLoaded()
  3796. ? a.call(b, 'serverConfigLoaded')
  3797. : b.addListener('serverConfigLoaded', c)
  3798. }
  3799. })
  3800. })(),
  3801. (UE.ajax = (function () {
  3802. function a(a) {
  3803. var b = []
  3804. for (var c in a)
  3805. if (
  3806. 'method' != c &&
  3807. 'timeout' != c &&
  3808. 'async' != c &&
  3809. 'dataType' != c &&
  3810. 'callback' != c &&
  3811. void 0 != a[c] &&
  3812. null != a[c]
  3813. )
  3814. if (
  3815. 'function' != (typeof a[c]).toLowerCase() &&
  3816. 'object' != (typeof a[c]).toLowerCase()
  3817. )
  3818. b.push(encodeURIComponent(c) + '=' + encodeURIComponent(a[c]))
  3819. else if (utils.isArray(a[c]))
  3820. for (var d = 0; d < a[c].length; d++)
  3821. b.push(
  3822. encodeURIComponent(c) + '[]=' + encodeURIComponent(a[c][d])
  3823. )
  3824. return b.join('&')
  3825. }
  3826. function b(b, c) {
  3827. var d = f(),
  3828. e = !1,
  3829. g = {
  3830. method: 'POST',
  3831. timeout: 5e3,
  3832. async: !0,
  3833. data: {},
  3834. onsuccess: function () {},
  3835. onerror: function () {}
  3836. }
  3837. if (('object' == typeof b && ((c = b), (b = c.url)), d && b)) {
  3838. var h = c ? utils.extend(g, c) : g,
  3839. i = a(h)
  3840. utils.isEmptyObject(h.data) || (i += (i ? '&' : '') + a(h.data))
  3841. var j = setTimeout(function () {
  3842. 4 != d.readyState && ((e = !0), d.abort(), clearTimeout(j))
  3843. }, h.timeout),
  3844. k = h.method.toUpperCase(),
  3845. l =
  3846. b +
  3847. (b.indexOf('?') == -1 ? '?' : '&') +
  3848. ('POST' == k ? '' : i + '&noCache=' + +new Date())
  3849. d.open(k, l, h.async),
  3850. (d.onreadystatechange = function () {
  3851. 4 == d.readyState &&
  3852. (e || 200 != d.status ? h.onerror(d) : h.onsuccess(d))
  3853. }),
  3854. 'POST' == k
  3855. ? (d.setRequestHeader(
  3856. 'Content-Type',
  3857. 'application/x-www-form-urlencoded'
  3858. ),
  3859. d.send(i))
  3860. : d.send(null)
  3861. }
  3862. }
  3863. function c(b, c) {
  3864. function d(a, b, c) {
  3865. a.setAttribute('type', 'text/javascript'),
  3866. a.setAttribute('defer', 'defer'),
  3867. c && a.setAttribute('charset', c),
  3868. a.setAttribute('src', b),
  3869. document.getElementsByTagName('head')[0].appendChild(a)
  3870. }
  3871. function e(a) {
  3872. return function () {
  3873. try {
  3874. if (a) k.onerror && k.onerror()
  3875. else
  3876. try {
  3877. clearTimeout(g), i.apply(window, arguments)
  3878. } catch (b) {}
  3879. } catch (c) {
  3880. k.onerror && k.onerror.call(window, c)
  3881. } finally {
  3882. k.oncomplete && k.oncomplete.apply(window, arguments),
  3883. j.parentNode && j.parentNode.removeChild(j),
  3884. (window[f] = null)
  3885. try {
  3886. delete window[f]
  3887. } catch (b) {}
  3888. }
  3889. }
  3890. }
  3891. var f,
  3892. g,
  3893. h,
  3894. i = c.onsuccess || function () {},
  3895. j = document.createElement('SCRIPT'),
  3896. k = c || {},
  3897. l = k.charset,
  3898. m = k.jsonp || 'callback',
  3899. n = k.timeOut || 0,
  3900. o = new RegExp('(\\?|&)' + m + '=([^&]*)')
  3901. utils.isFunction(i)
  3902. ? ((f =
  3903. 'bd__editor__' +
  3904. Math.floor(2147483648 * Math.random()).toString(36)),
  3905. (window[f] = e(0)))
  3906. : utils.isString(i)
  3907. ? (f = i)
  3908. : (h = o.exec(b)) && (f = h[2]),
  3909. (b = b.replace(o, '$1' + m + '=' + f)),
  3910. b.search(o) < 0 &&
  3911. (b += (b.indexOf('?') < 0 ? '?' : '&') + m + '=' + f)
  3912. var p = a(c)
  3913. utils.isEmptyObject(c.data) || (p += (p ? '&' : '') + a(c.data)),
  3914. p && (b = b.replace(/\?/, '?' + p + '&')),
  3915. (j.onerror = e(1)),
  3916. n && (g = setTimeout(e(1), n)),
  3917. d(j, b, l)
  3918. }
  3919. var d = 'XMLHttpRequest()'
  3920. try {
  3921. new ActiveXObject('Msxml2.XMLHTTP'),
  3922. (d = "ActiveXObject('Msxml2.XMLHTTP')")
  3923. } catch (e) {
  3924. try {
  3925. new ActiveXObject('Microsoft.XMLHTTP'),
  3926. (d = "ActiveXObject('Microsoft.XMLHTTP')")
  3927. } catch (e) {}
  3928. }
  3929. var f = new Function('return new ' + d)
  3930. return {
  3931. request: function (a, d) {
  3932. d && 'jsonp' == d.dataType ? c(a, d) : b(a, d)
  3933. },
  3934. getJSONP: function (a, b, d) {
  3935. var e = { data: b, oncomplete: d }
  3936. c(a, e)
  3937. }
  3938. }
  3939. })())
  3940. var filterWord = (UE.filterWord = (function () {
  3941. function a(a) {
  3942. return /(class="?Mso|style="[^"]*\bmso\-|w:WordDocument|<(v|o):|lang=)/gi.test(
  3943. a
  3944. )
  3945. }
  3946. function b(a) {
  3947. return (a = a.replace(/[\d.]+\w+/g, function (a) {
  3948. return utils.transUnitToPx(a)
  3949. }))
  3950. }
  3951. function c(a) {
  3952. return a
  3953. .replace(/[\t\r\n]+/g, ' ')
  3954. .replace(/<!--[\s\S]*?-->/gi, '')
  3955. .replace(/<v:shape [^>]*>[\s\S]*?.<\/v:shape>/gi, function (a) {
  3956. if (browser.opera) return ''
  3957. try {
  3958. if (/Bitmap/i.test(a)) return ''
  3959. var c = a.match(/width:([ \d.]*p[tx])/i)[1],
  3960. d = a.match(/height:([ \d.]*p[tx])/i)[1],
  3961. e = a.match(/src=\s*"([^"]*)"/i)[1]
  3962. return (
  3963. '<img width="' +
  3964. b(c) +
  3965. '" height="' +
  3966. b(d) +
  3967. '" src="' +
  3968. e +
  3969. '" />'
  3970. )
  3971. } catch (f) {
  3972. return ''
  3973. }
  3974. })
  3975. .replace(/<\/?div[^>]*>/g, '')
  3976. .replace(/v:\w+=(["']?)[^'"]+\1/g, '')
  3977. .replace(
  3978. /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|xml|meta|link|style|\w+:\w+)(?=[\s\/>]))[^>]*>/gi,
  3979. ''
  3980. )
  3981. .replace(
  3982. /<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,
  3983. '<p><strong>$1</strong></p>'
  3984. )
  3985. .replace(
  3986. /\s+(class|lang|align)\s*=\s*(['"]?)([\w-]+)\2/gi,
  3987. function (a, b, c, d) {
  3988. return 'class' == b && 'MsoListParagraph' == d ? a : ''
  3989. }
  3990. )
  3991. .replace(/<(font|span)[^>]*>(\s*)<\/\1>/gi, function (a, b, c) {
  3992. return c.replace(/[\t\r\n ]+/g, ' ')
  3993. })
  3994. .replace(
  3995. /(<[a-z][^>]*)\sstyle=(["'])([^\2]*?)\2/gi,
  3996. function (a, c, d, e) {
  3997. for (
  3998. var f,
  3999. g = [],
  4000. h = e
  4001. .replace(/^\s+|\s+$/, '')
  4002. .replace(/&#39;/g, "'")
  4003. .replace(/&quot;/gi, "'")
  4004. .replace(/[\d.]+(cm|pt)/g, function (a) {
  4005. return utils.transUnitToPx(a)
  4006. })
  4007. .split(/;\s*/g),
  4008. i = 0;
  4009. (f = h[i]);
  4010. i++
  4011. ) {
  4012. var j,
  4013. k,
  4014. l = f.split(':')
  4015. if (2 == l.length) {
  4016. if (
  4017. ((j = l[0].toLowerCase()),
  4018. (k = l[1].toLowerCase()),
  4019. (/^(background)\w*/.test(j) &&
  4020. 0 == k.replace(/(initial|\s)/g, '').length) ||
  4021. (/^(margin)\w*/.test(j) && /^0\w+$/.test(k)))
  4022. )
  4023. continue
  4024. switch (j) {
  4025. case 'mso-padding-alt':
  4026. case 'mso-padding-top-alt':
  4027. case 'mso-padding-right-alt':
  4028. case 'mso-padding-bottom-alt':
  4029. case 'mso-padding-left-alt':
  4030. case 'mso-margin-alt':
  4031. case 'mso-margin-top-alt':
  4032. case 'mso-margin-right-alt':
  4033. case 'mso-margin-bottom-alt':
  4034. case 'mso-margin-left-alt':
  4035. case 'mso-height':
  4036. case 'mso-width':
  4037. case 'mso-vertical-align-alt':
  4038. ;/<table/.test(c) ||
  4039. (g[i] = j.replace(/^mso-|-alt$/g, '') + ':' + b(k))
  4040. continue
  4041. case 'horiz-align':
  4042. g[i] = 'text-align:' + k
  4043. continue
  4044. case 'vert-align':
  4045. g[i] = 'vertical-align:' + k
  4046. continue
  4047. case 'font-color':
  4048. case 'mso-foreground':
  4049. g[i] = 'color:' + k
  4050. continue
  4051. case 'mso-background':
  4052. case 'mso-highlight':
  4053. g[i] = 'background:' + k
  4054. continue
  4055. case 'mso-default-height':
  4056. g[i] = 'min-height:' + b(k)
  4057. continue
  4058. case 'mso-default-width':
  4059. g[i] = 'min-width:' + b(k)
  4060. continue
  4061. case 'mso-padding-between-alt':
  4062. g[i] = 'border-collapse:separate;border-spacing:' + b(k)
  4063. continue
  4064. case 'text-line-through':
  4065. ;('single' != k && 'double' != k) ||
  4066. (g[i] = 'text-decoration:line-through')
  4067. continue
  4068. case 'mso-zero-height':
  4069. 'yes' == k && (g[i] = 'display:none')
  4070. continue
  4071. case 'margin':
  4072. if (!/[1-9]/.test(k)) continue
  4073. }
  4074. if (
  4075. /^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?:decor|trans)|top-bar|version|vnd|word-break)/.test(
  4076. j
  4077. ) ||
  4078. (/text\-indent|padding|margin/.test(j) && /\-[\d.]+/.test(k))
  4079. )
  4080. continue
  4081. g[i] = j + ':' + l[1]
  4082. }
  4083. }
  4084. return (
  4085. c +
  4086. (g.length
  4087. ? ' style="' + g.join(';').replace(/;{2,}/g, ';') + '"'
  4088. : '')
  4089. )
  4090. }
  4091. )
  4092. }
  4093. return function (b) {
  4094. return a(b) ? c(b) : b
  4095. }
  4096. })())
  4097. !(function () {
  4098. function a(a, b, c) {
  4099. return a.push(n), b + (c ? 1 : -1)
  4100. }
  4101. function b(a, b) {
  4102. for (var c = 0; c < b; c++) a.push(m)
  4103. }
  4104. function c(g, h, i, j) {
  4105. switch (g.type) {
  4106. case 'root':
  4107. for (var k, l = 0; (k = g.children[l++]); )
  4108. i &&
  4109. 'element' == k.type &&
  4110. !dtd.$inlineWithA[k.tagName] &&
  4111. l > 1 &&
  4112. (a(h, j, !0), b(h, j)),
  4113. c(k, h, i, j)
  4114. break
  4115. case 'text':
  4116. d(g, h)
  4117. break
  4118. case 'element':
  4119. e(g, h, i, j)
  4120. break
  4121. case 'comment':
  4122. f(g, h, i)
  4123. }
  4124. return h
  4125. }
  4126. function d(a, b) {
  4127. 'pre' == a.parentNode.tagName
  4128. ? b.push(a.data)
  4129. : b.push(
  4130. l[a.parentNode.tagName]
  4131. ? utils.html(a.data)
  4132. : a.data.replace(/[ ]{2}/g, ' &nbsp;')
  4133. )
  4134. }
  4135. function e(d, e, f, g) {
  4136. var h = ''
  4137. if (d.attrs) {
  4138. h = []
  4139. var i = d.attrs
  4140. for (var j in i)
  4141. h.push(
  4142. j +
  4143. (void 0 !== i[j]
  4144. ? '="' +
  4145. (k[j]
  4146. ? utils.html(i[j]).replace(/["]/g, function (a) {
  4147. return '&quot;'
  4148. })
  4149. : utils.unhtml(i[j])) +
  4150. '"'
  4151. : '')
  4152. )
  4153. h = h.join(' ')
  4154. }
  4155. if (
  4156. (e.push(
  4157. '<' +
  4158. d.tagName +
  4159. (h ? ' ' + h : '') +
  4160. (dtd.$empty[d.tagName] ? '/' : '') +
  4161. '>'
  4162. ),
  4163. f &&
  4164. !dtd.$inlineWithA[d.tagName] &&
  4165. 'pre' != d.tagName &&
  4166. d.children &&
  4167. d.children.length &&
  4168. ((g = a(e, g, !0)), b(e, g)),
  4169. d.children && d.children.length)
  4170. )
  4171. for (var l, m = 0; (l = d.children[m++]); )
  4172. f &&
  4173. 'element' == l.type &&
  4174. !dtd.$inlineWithA[l.tagName] &&
  4175. m > 1 &&
  4176. (a(e, g), b(e, g)),
  4177. c(l, e, f, g)
  4178. dtd.$empty[d.tagName] ||
  4179. (f &&
  4180. !dtd.$inlineWithA[d.tagName] &&
  4181. 'pre' != d.tagName &&
  4182. d.children &&
  4183. d.children.length &&
  4184. ((g = a(e, g)), b(e, g)),
  4185. e.push('</' + d.tagName + '>'))
  4186. }
  4187. function f(a, b) {
  4188. b.push('<!--' + a.data + '-->')
  4189. }
  4190. function g(a, b) {
  4191. var c
  4192. if ('element' == a.type && a.getAttr('id') == b) return a
  4193. if (a.children && a.children.length)
  4194. for (var d, e = 0; (d = a.children[e++]); ) if ((c = g(d, b))) return c
  4195. }
  4196. function h(a, b, c) {
  4197. if (
  4198. ('element' == a.type && a.tagName == b && c.push(a),
  4199. a.children && a.children.length)
  4200. )
  4201. for (var d, e = 0; (d = a.children[e++]); ) h(d, b, c)
  4202. }
  4203. function i(a, b) {
  4204. if (a.children && a.children.length)
  4205. for (var c, d = 0; (c = a.children[d]); )
  4206. i(c, b),
  4207. c.parentNode &&
  4208. (c.children && c.children.length && b(c), c.parentNode && d++)
  4209. else b(a)
  4210. }
  4211. var j = (UE.uNode = function (a) {
  4212. ;(this.type = a.type),
  4213. (this.data = a.data),
  4214. (this.tagName = a.tagName),
  4215. (this.parentNode = a.parentNode),
  4216. (this.attrs = a.attrs || {}),
  4217. (this.children = a.children)
  4218. }),
  4219. k = { href: 1, src: 1, _src: 1, _href: 1, cdata_data: 1 },
  4220. l = { style: 1, script: 1 },
  4221. m = ' ',
  4222. n = '\n'
  4223. ;(j.createElement = function (a) {
  4224. return /[<>]/.test(a)
  4225. ? UE.htmlparser(a).children[0]
  4226. : new j({ type: 'element', children: [], tagName: a })
  4227. }),
  4228. (j.createText = function (a, b) {
  4229. return new UE.uNode({
  4230. type: 'text',
  4231. data: b ? a : utils.unhtml(a || '')
  4232. })
  4233. }),
  4234. (j.prototype = {
  4235. toHtml: function (a) {
  4236. var b = []
  4237. return c(this, b, a, 0), b.join('')
  4238. },
  4239. innerHTML: function (a) {
  4240. if ('element' != this.type || dtd.$empty[this.tagName]) return this
  4241. if (utils.isString(a)) {
  4242. if (this.children)
  4243. for (var b, c = 0; (b = this.children[c++]); ) b.parentNode = null
  4244. this.children = []
  4245. for (var b, d = UE.htmlparser(a), c = 0; (b = d.children[c++]); )
  4246. this.children.push(b), (b.parentNode = this)
  4247. return this
  4248. }
  4249. var d = new UE.uNode({ type: 'root', children: this.children })
  4250. return d.toHtml()
  4251. },
  4252. innerText: function (a, b) {
  4253. if ('element' != this.type || dtd.$empty[this.tagName]) return this
  4254. if (a) {
  4255. if (this.children)
  4256. for (var c, d = 0; (c = this.children[d++]); ) c.parentNode = null
  4257. return (
  4258. (this.children = []), this.appendChild(j.createText(a, b)), this
  4259. )
  4260. }
  4261. return this.toHtml().replace(/<[^>]+>/g, '')
  4262. },
  4263. getData: function () {
  4264. return 'element' == this.type ? '' : this.data
  4265. },
  4266. firstChild: function () {
  4267. return this.children ? this.children[0] : null
  4268. },
  4269. lastChild: function () {
  4270. return this.children ? this.children[this.children.length - 1] : null
  4271. },
  4272. previousSibling: function () {
  4273. for (var a, b = this.parentNode, c = 0; (a = b.children[c]); c++)
  4274. if (a === this) return 0 == c ? null : b.children[c - 1]
  4275. },
  4276. nextSibling: function () {
  4277. for (var a, b = this.parentNode, c = 0; (a = b.children[c++]); )
  4278. if (a === this) return b.children[c]
  4279. },
  4280. replaceChild: function (a, b) {
  4281. if (this.children) {
  4282. a.parentNode && a.parentNode.removeChild(a)
  4283. for (var c, d = 0; (c = this.children[d]); d++)
  4284. if (c === b)
  4285. return (
  4286. this.children.splice(d, 1, a),
  4287. (b.parentNode = null),
  4288. (a.parentNode = this),
  4289. a
  4290. )
  4291. }
  4292. },
  4293. appendChild: function (a) {
  4294. if (
  4295. 'root' == this.type ||
  4296. ('element' == this.type && !dtd.$empty[this.tagName])
  4297. ) {
  4298. this.children || (this.children = []),
  4299. a.parentNode && a.parentNode.removeChild(a)
  4300. for (var b, c = 0; (b = this.children[c]); c++)
  4301. if (b === a) {
  4302. this.children.splice(c, 1)
  4303. break
  4304. }
  4305. return this.children.push(a), (a.parentNode = this), a
  4306. }
  4307. },
  4308. insertBefore: function (a, b) {
  4309. if (this.children) {
  4310. a.parentNode && a.parentNode.removeChild(a)
  4311. for (var c, d = 0; (c = this.children[d]); d++)
  4312. if (c === b)
  4313. return this.children.splice(d, 0, a), (a.parentNode = this), a
  4314. }
  4315. },
  4316. insertAfter: function (a, b) {
  4317. if (this.children) {
  4318. a.parentNode && a.parentNode.removeChild(a)
  4319. for (var c, d = 0; (c = this.children[d]); d++)
  4320. if (c === b)
  4321. return (
  4322. this.children.splice(d + 1, 0, a), (a.parentNode = this), a
  4323. )
  4324. }
  4325. },
  4326. removeChild: function (a, b) {
  4327. if (this.children)
  4328. for (var c, d = 0; (c = this.children[d]); d++)
  4329. if (c === a) {
  4330. if (
  4331. (this.children.splice(d, 1),
  4332. (c.parentNode = null),
  4333. b && c.children && c.children.length)
  4334. )
  4335. for (var e, f = 0; (e = c.children[f]); f++)
  4336. this.children.splice(d + f, 0, e), (e.parentNode = this)
  4337. return c
  4338. }
  4339. },
  4340. getAttr: function (a) {
  4341. return this.attrs && this.attrs[a.toLowerCase()]
  4342. },
  4343. setAttr: function (a, b) {
  4344. if (!a) return void delete this.attrs
  4345. if ((this.attrs || (this.attrs = {}), utils.isObject(a)))
  4346. for (var c in a)
  4347. a[c] ? (this.attrs[c.toLowerCase()] = a[c]) : delete this.attrs[c]
  4348. else b ? (this.attrs[a.toLowerCase()] = b) : delete this.attrs[a]
  4349. },
  4350. getIndex: function () {
  4351. for (var a, b = this.parentNode, c = 0; (a = b.children[c]); c++)
  4352. if (a === this) return c
  4353. return -1
  4354. },
  4355. getNodeById: function (a) {
  4356. var b
  4357. if (this.children && this.children.length)
  4358. for (var c, d = 0; (c = this.children[d++]); )
  4359. if ((b = g(c, a))) return b
  4360. },
  4361. getNodesByTagName: function (a) {
  4362. a = utils
  4363. .trim(a)
  4364. .replace(/[ ]{2,}/g, ' ')
  4365. .split(' ')
  4366. var b = [],
  4367. c = this
  4368. return (
  4369. utils.each(a, function (a) {
  4370. if (c.children && c.children.length)
  4371. for (var d, e = 0; (d = c.children[e++]); ) h(d, a, b)
  4372. }),
  4373. b
  4374. )
  4375. },
  4376. getStyle: function (a) {
  4377. var b = this.getAttr('style')
  4378. if (!b) return ''
  4379. var c = new RegExp('(^|;)\\s*' + a + ':([^;]+)', 'i'),
  4380. d = b.match(c)
  4381. return d && d[0] ? d[2] : ''
  4382. },
  4383. setStyle: function (a, b) {
  4384. function c(a, b) {
  4385. var c = new RegExp('(^|;)\\s*' + a + ':([^;]+;?)', 'gi')
  4386. ;(d = d.replace(c, '$1')),
  4387. b && (d = a + ':' + utils.unhtml(b) + ';' + d)
  4388. }
  4389. var d = this.getAttr('style')
  4390. if ((d || (d = ''), utils.isObject(a))) for (var e in a) c(e, a[e])
  4391. else c(a, b)
  4392. this.setAttr('style', utils.trim(d))
  4393. },
  4394. traversal: function (a) {
  4395. return this.children && this.children.length && i(this, a), this
  4396. }
  4397. })
  4398. })()
  4399. var htmlparser = (UE.htmlparser = function (a, b) {
  4400. function c(a, b) {
  4401. if (m[a.tagName]) {
  4402. var c = k.createElement(m[a.tagName])
  4403. a.appendChild(c), c.appendChild(k.createText(b)), (a = c)
  4404. } else a.appendChild(k.createText(b))
  4405. }
  4406. function d(a, b, c) {
  4407. var e
  4408. if ((e = l[b])) {
  4409. for (var f, h = a; 'root' != h.type; ) {
  4410. if (
  4411. utils.isArray(e)
  4412. ? utils.indexOf(e, h.tagName) != -1
  4413. : e == h.tagName
  4414. ) {
  4415. ;(a = h), (f = !0)
  4416. break
  4417. }
  4418. h = h.parentNode
  4419. }
  4420. f || (a = d(a, utils.isArray(e) ? e[0] : e))
  4421. }
  4422. var i = new k({
  4423. parentNode: a,
  4424. type: 'element',
  4425. tagName: b.toLowerCase(),
  4426. children: dtd.$empty[b] ? null : []
  4427. })
  4428. if (c) {
  4429. for (var m, n = {}; (m = g.exec(c)); )
  4430. n[m[1].toLowerCase()] = j[m[1].toLowerCase()]
  4431. ? m[2] || m[3] || m[4]
  4432. : utils.unhtml(m[2] || m[3] || m[4])
  4433. i.attrs = n
  4434. }
  4435. return a.children.push(i), dtd.$empty[b] ? a : i
  4436. }
  4437. function e(a, b) {
  4438. a.children.push(new k({ type: 'comment', data: b, parentNode: a }))
  4439. }
  4440. var f =
  4441. /<(?:(?:\/([^>]+)>)|(?:!--([\S|\s]*?)-->)|(?:([^\s\/<>]+)\s*((?:(?:"[^"]*")|(?:'[^']*')|[^"'<>])*)\/?>))/g,
  4442. g =
  4443. /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
  4444. h = {
  4445. b: 1,
  4446. code: 1,
  4447. i: 1,
  4448. u: 1,
  4449. strike: 1,
  4450. s: 1,
  4451. tt: 1,
  4452. strong: 1,
  4453. q: 1,
  4454. samp: 1,
  4455. em: 1,
  4456. span: 1,
  4457. sub: 1,
  4458. img: 1,
  4459. sup: 1,
  4460. font: 1,
  4461. big: 1,
  4462. small: 1,
  4463. iframe: 1,
  4464. a: 1,
  4465. br: 1,
  4466. pre: 1
  4467. }
  4468. ;(a = a.replace(new RegExp(domUtils.fillChar, 'g'), '')),
  4469. b ||
  4470. (a = a.replace(
  4471. new RegExp(
  4472. '[\\r\\t\\n' +
  4473. (b ? '' : ' ') +
  4474. ']*</?(\\w+)\\s*(?:[^>]*)>[\\r\\t\\n' +
  4475. (b ? '' : ' ') +
  4476. ']*',
  4477. 'g'
  4478. ),
  4479. function (a, c) {
  4480. return c && h[c.toLowerCase()]
  4481. ? a.replace(/(^[\n\r]+)|([\n\r]+$)/g, '')
  4482. : a
  4483. .replace(new RegExp('^[\\r\\n' + (b ? '' : ' ') + ']+'), '')
  4484. .replace(new RegExp('[\\r\\n' + (b ? '' : ' ') + ']+$'), '')
  4485. }
  4486. ))
  4487. for (
  4488. var i,
  4489. j = { href: 1, src: 1 },
  4490. k = UE.uNode,
  4491. l = {
  4492. td: 'tr',
  4493. tr: ['tbody', 'thead', 'tfoot'],
  4494. tbody: 'table',
  4495. th: 'tr',
  4496. thead: 'table',
  4497. tfoot: 'table',
  4498. caption: 'table',
  4499. li: ['ul', 'ol'],
  4500. dt: 'dl',
  4501. dd: 'dl',
  4502. option: 'select'
  4503. },
  4504. m = { ol: 'li', ul: 'li' },
  4505. n = 0,
  4506. o = 0,
  4507. p = new k({ type: 'root', children: [] }),
  4508. q = p;
  4509. (i = f.exec(a));
  4510. ) {
  4511. n = i.index
  4512. try {
  4513. if ((n > o && c(q, a.slice(o, n)), i[3]))
  4514. dtd.$cdata[q.tagName]
  4515. ? c(q, i[0])
  4516. : (q = d(q, i[3].toLowerCase(), i[4]))
  4517. else if (i[1]) {
  4518. if ('root' != q.type)
  4519. if (dtd.$cdata[q.tagName] && !dtd.$cdata[i[1]]) c(q, i[0])
  4520. else {
  4521. for (
  4522. var r = q;
  4523. 'element' == q.type && q.tagName != i[1].toLowerCase();
  4524. )
  4525. if (((q = q.parentNode), 'root' == q.type))
  4526. throw ((q = r), 'break')
  4527. q = q.parentNode
  4528. }
  4529. } else i[2] && e(q, i[2])
  4530. } catch (s) {}
  4531. o = f.lastIndex
  4532. }
  4533. return o < a.length && c(q, a.slice(o)), p
  4534. }),
  4535. filterNode = (UE.filterNode = (function () {
  4536. function a(b, c) {
  4537. switch (b.type) {
  4538. case 'text':
  4539. break
  4540. case 'element':
  4541. var d
  4542. if ((d = c[b.tagName]))
  4543. if ('-' === d) b.parentNode.removeChild(b)
  4544. else if (utils.isFunction(d)) {
  4545. var e = b.parentNode,
  4546. f = b.getIndex()
  4547. if ((d(b), b.parentNode)) {
  4548. if (b.children)
  4549. for (var g, h = 0; (g = b.children[h]); )
  4550. a(g, c), g.parentNode && h++
  4551. } else
  4552. for (var g, h = f; (g = e.children[h]); )
  4553. a(g, c), g.parentNode && h++
  4554. } else {
  4555. var i = d.$
  4556. if (i && b.attrs) {
  4557. var j,
  4558. k = {}
  4559. for (var l in i) {
  4560. if (
  4561. ((j = b.getAttr(l)), 'style' == l && utils.isArray(i[l]))
  4562. ) {
  4563. var m = []
  4564. utils.each(i[l], function (a) {
  4565. var c
  4566. ;(c = b.getStyle(a)) && m.push(a + ':' + c)
  4567. }),
  4568. (j = m.join(';'))
  4569. }
  4570. j && (k[l] = j)
  4571. }
  4572. b.attrs = k
  4573. }
  4574. if (b.children)
  4575. for (var g, h = 0; (g = b.children[h]); )
  4576. a(g, c), g.parentNode && h++
  4577. }
  4578. else if (dtd.$cdata[b.tagName]) b.parentNode.removeChild(b)
  4579. else {
  4580. var e = b.parentNode,
  4581. f = b.getIndex()
  4582. b.parentNode.removeChild(b, !0)
  4583. for (var g, h = f; (g = e.children[h]); )
  4584. a(g, c), g.parentNode && h++
  4585. }
  4586. break
  4587. case 'comment':
  4588. b.parentNode.removeChild(b)
  4589. }
  4590. }
  4591. return function (b, c) {
  4592. if (utils.isEmptyObject(c)) return b
  4593. var d
  4594. ;(d = c['-']) &&
  4595. utils.each(d.split(' '), function (a) {
  4596. c[a] = '-'
  4597. })
  4598. for (var e, f = 0; (e = b.children[f]); ) a(e, c), e.parentNode && f++
  4599. return b
  4600. }
  4601. })())
  4602. UE.plugin = (function () {
  4603. var a = {}
  4604. return {
  4605. register: function (b, c, d, e) {
  4606. d && utils.isFunction(d) && ((e = d), (d = null)),
  4607. (a[b] = { optionName: d || b, execFn: c, afterDisabled: e })
  4608. },
  4609. load: function (b) {
  4610. utils.each(a, function (a) {
  4611. var c = a.execFn.call(b)
  4612. b.options[a.optionName] !== !1
  4613. ? c &&
  4614. utils.each(c, function (a, c) {
  4615. switch (c.toLowerCase()) {
  4616. case 'shortcutkey':
  4617. b.addshortcutkey(a)
  4618. break
  4619. case 'bindevents':
  4620. utils.each(a, function (a, c) {
  4621. b.addListener(c, a)
  4622. })
  4623. break
  4624. case 'bindmultievents':
  4625. utils.each(utils.isArray(a) ? a : [a], function (a) {
  4626. var c = utils.trim(a.type).split(/\s+/)
  4627. utils.each(c, function (c) {
  4628. b.addListener(c, a.handler)
  4629. })
  4630. })
  4631. break
  4632. case 'commands':
  4633. utils.each(a, function (a, c) {
  4634. b.commands[c] = a
  4635. })
  4636. break
  4637. case 'outputrule':
  4638. b.addOutputRule(a)
  4639. break
  4640. case 'inputrule':
  4641. b.addInputRule(a)
  4642. break
  4643. case 'defaultoptions':
  4644. b.setOpt(a)
  4645. }
  4646. })
  4647. : a.afterDisabled && a.afterDisabled.call(b)
  4648. }),
  4649. utils.each(UE.plugins, function (a) {
  4650. a.call(b)
  4651. })
  4652. },
  4653. run: function (b, c) {
  4654. var d = a[b]
  4655. d && d.exeFn.call(c)
  4656. }
  4657. }
  4658. })()
  4659. var keymap = (UE.keymap = {
  4660. Backspace: 8,
  4661. Tab: 9,
  4662. Enter: 13,
  4663. Shift: 16,
  4664. Control: 17,
  4665. Alt: 18,
  4666. CapsLock: 20,
  4667. Esc: 27,
  4668. Spacebar: 32,
  4669. PageUp: 33,
  4670. PageDown: 34,
  4671. End: 35,
  4672. Home: 36,
  4673. Left: 37,
  4674. Up: 38,
  4675. Right: 39,
  4676. Down: 40,
  4677. Insert: 45,
  4678. Del: 46,
  4679. NumLock: 144,
  4680. Cmd: 91,
  4681. '=': 187,
  4682. '-': 189,
  4683. b: 66,
  4684. i: 73,
  4685. z: 90,
  4686. y: 89,
  4687. v: 86,
  4688. x: 88,
  4689. s: 83,
  4690. n: 78
  4691. }),
  4692. LocalStorage = (UE.LocalStorage = (function () {
  4693. function a() {
  4694. var a = document.createElement('div')
  4695. return (
  4696. (a.style.display = 'none'),
  4697. a.addBehavior
  4698. ? (a.addBehavior('#default#userdata'),
  4699. {
  4700. getItem: function (b) {
  4701. var d = null
  4702. try {
  4703. document.body.appendChild(a),
  4704. a.load(c),
  4705. (d = a.getAttribute(b)),
  4706. document.body.removeChild(a)
  4707. } catch (e) {}
  4708. return d
  4709. },
  4710. setItem: function (b, d) {
  4711. document.body.appendChild(a),
  4712. a.setAttribute(b, d),
  4713. a.save(c),
  4714. document.body.removeChild(a)
  4715. },
  4716. removeItem: function (b) {
  4717. document.body.appendChild(a),
  4718. a.removeAttribute(b),
  4719. a.save(c),
  4720. document.body.removeChild(a)
  4721. }
  4722. })
  4723. : null
  4724. )
  4725. }
  4726. var b = window.localStorage || a() || null,
  4727. c = 'localStorage'
  4728. return {
  4729. saveLocalData: function (a, c) {
  4730. return !(!b || !c) && (b.setItem(a, c), !0)
  4731. },
  4732. getLocalData: function (a) {
  4733. return b ? b.getItem(a) : null
  4734. },
  4735. removeItem: function (a) {
  4736. b && b.removeItem(a)
  4737. }
  4738. }
  4739. })())
  4740. !(function () {
  4741. var a = 'ueditor_preference'
  4742. ;(UE.Editor.prototype.setPreferences = function (b, c) {
  4743. var d = {}
  4744. utils.isString(b) ? (d[b] = c) : (d = b)
  4745. var e = LocalStorage.getLocalData(a)
  4746. e && (e = utils.str2json(e)) ? utils.extend(e, d) : (e = d),
  4747. e && LocalStorage.saveLocalData(a, utils.json2str(e))
  4748. }),
  4749. (UE.Editor.prototype.getPreferences = function (b) {
  4750. var c = LocalStorage.getLocalData(a)
  4751. return c && (c = utils.str2json(c)) ? (b ? c[b] : c) : null
  4752. }),
  4753. (UE.Editor.prototype.removePreferences = function (b) {
  4754. var c = LocalStorage.getLocalData(a)
  4755. c && (c = utils.str2json(c)) && ((c[b] = void 0), delete c[b]),
  4756. c && LocalStorage.saveLocalData(a, utils.json2str(c))
  4757. })
  4758. })(),
  4759. (UE.plugins.defaultfilter = function () {
  4760. var a = this
  4761. a.setOpt({ allowDivTransToP: !0, disabledTableInTable: !0 }),
  4762. a.addInputRule(function (b) {
  4763. function c(a) {
  4764. for (; a && 'element' == a.type; ) {
  4765. if ('td' == a.tagName) return !0
  4766. a = a.parentNode
  4767. }
  4768. return !1
  4769. }
  4770. var d,
  4771. e = this.options.allowDivTransToP
  4772. b.traversal(function (b) {
  4773. if ('element' == b.type) {
  4774. if (
  4775. !dtd.$cdata[b.tagName] &&
  4776. a.options.autoClearEmptyNode &&
  4777. dtd.$inline[b.tagName] &&
  4778. !dtd.$empty[b.tagName] &&
  4779. (!b.attrs || utils.isEmptyObject(b.attrs))
  4780. )
  4781. return void (b.firstChild()
  4782. ? 'span' != b.tagName ||
  4783. (b.attrs && !utils.isEmptyObject(b.attrs)) ||
  4784. b.parentNode.removeChild(b, !0)
  4785. : b.parentNode.removeChild(b))
  4786. switch (b.tagName) {
  4787. case 'style':
  4788. case 'script':
  4789. b.setAttr({
  4790. cdata_tag: b.tagName,
  4791. cdata_data: b.innerHTML() || '',
  4792. _ue_custom_node_: 'true'
  4793. }),
  4794. (b.tagName = 'div'),
  4795. b.innerHTML('')
  4796. break
  4797. case 'a':
  4798. ;(d = b.getAttr('href')) && b.setAttr('_href', d)
  4799. break
  4800. case 'img':
  4801. if ((d = b.getAttr('src')) && /^data:/.test(d)) {
  4802. b.parentNode.removeChild(b)
  4803. break
  4804. }
  4805. b.setAttr('_src', b.getAttr('src'))
  4806. break
  4807. case 'span':
  4808. browser.webkit &&
  4809. (d = b.getStyle('white-space')) &&
  4810. /nowrap|normal/.test(d) &&
  4811. (b.setStyle('white-space', ''),
  4812. a.options.autoClearEmptyNode &&
  4813. utils.isEmptyObject(b.attrs) &&
  4814. b.parentNode.removeChild(b, !0)),
  4815. (d = b.getAttr('id')),
  4816. d &&
  4817. /^_baidu_bookmark_/i.test(d) &&
  4818. b.parentNode.removeChild(b)
  4819. break
  4820. case 'p':
  4821. ;(d = b.getAttr('align')) &&
  4822. (b.setAttr('align'), b.setStyle('text-align', d)),
  4823. utils.each(b.children, function (a) {
  4824. if ('element' == a.type && 'p' == a.tagName) {
  4825. var c = a.nextSibling()
  4826. b.parentNode.insertAfter(a, b)
  4827. for (var d = a; c; ) {
  4828. var e = c.nextSibling()
  4829. b.parentNode.insertAfter(c, d), (d = c), (c = e)
  4830. }
  4831. return !1
  4832. }
  4833. }),
  4834. b.firstChild() ||
  4835. b.innerHTML(browser.ie ? '&nbsp;' : '<br/>')
  4836. break
  4837. case 'div':
  4838. if (b.getAttr('cdata_tag')) break
  4839. if (
  4840. ((d = b.getAttr('class')), d && /^line number\d+/.test(d))
  4841. )
  4842. break
  4843. if (!e) break
  4844. for (
  4845. var f, g = UE.uNode.createElement('p');
  4846. (f = b.firstChild());
  4847. )
  4848. 'text' != f.type && UE.dom.dtd.$block[f.tagName]
  4849. ? g.firstChild()
  4850. ? (b.parentNode.insertBefore(g, b),
  4851. (g = UE.uNode.createElement('p')))
  4852. : b.parentNode.insertBefore(f, b)
  4853. : g.appendChild(f)
  4854. g.firstChild() && b.parentNode.insertBefore(g, b),
  4855. b.parentNode.removeChild(b)
  4856. break
  4857. case 'dl':
  4858. b.tagName = 'ul'
  4859. break
  4860. case 'dt':
  4861. case 'dd':
  4862. b.tagName = 'li'
  4863. break
  4864. case 'li':
  4865. var h = b.getAttr('class')
  4866. ;(h && /list\-/.test(h)) || b.setAttr()
  4867. var i = b.getNodesByTagName('ol ul')
  4868. UE.utils.each(i, function (a) {
  4869. b.parentNode.insertAfter(a, b)
  4870. })
  4871. break
  4872. case 'td':
  4873. case 'th':
  4874. case 'caption':
  4875. ;(b.children && b.children.length) ||
  4876. b.appendChild(
  4877. browser.ie11below
  4878. ? UE.uNode.createText(' ')
  4879. : UE.uNode.createElement('br')
  4880. )
  4881. break
  4882. case 'table':
  4883. a.options.disabledTableInTable &&
  4884. c(b) &&
  4885. (b.parentNode.insertBefore(
  4886. UE.uNode.createText(b.innerText()),
  4887. b
  4888. ),
  4889. b.parentNode.removeChild(b))
  4890. }
  4891. }
  4892. })
  4893. }),
  4894. a.addOutputRule(function (b) {
  4895. var c
  4896. b.traversal(function (b) {
  4897. if ('element' == b.type) {
  4898. if (
  4899. a.options.autoClearEmptyNode &&
  4900. dtd.$inline[b.tagName] &&
  4901. !dtd.$empty[b.tagName] &&
  4902. (!b.attrs || utils.isEmptyObject(b.attrs))
  4903. )
  4904. return void (b.firstChild()
  4905. ? 'span' != b.tagName ||
  4906. (b.attrs && !utils.isEmptyObject(b.attrs)) ||
  4907. b.parentNode.removeChild(b, !0)
  4908. : b.parentNode.removeChild(b))
  4909. switch (b.tagName) {
  4910. case 'div':
  4911. ;(c = b.getAttr('cdata_tag')) &&
  4912. ((b.tagName = c),
  4913. b.appendChild(UE.uNode.createText(b.getAttr('cdata_data'))),
  4914. b.setAttr({
  4915. cdata_tag: '',
  4916. cdata_data: '',
  4917. _ue_custom_node_: ''
  4918. }))
  4919. break
  4920. case 'a':
  4921. ;(c = b.getAttr('_href')) &&
  4922. b.setAttr({ href: utils.html(c), _href: '' })
  4923. break
  4924. case 'span':
  4925. ;(c = b.getAttr('id')),
  4926. c &&
  4927. /^_baidu_bookmark_/i.test(c) &&
  4928. b.parentNode.removeChild(b)
  4929. break
  4930. case 'img':
  4931. ;(c = b.getAttr('_src')) &&
  4932. b.setAttr({ src: b.getAttr('_src'), _src: '' })
  4933. }
  4934. }
  4935. })
  4936. })
  4937. }),
  4938. (UE.commands.inserthtml = {
  4939. execCommand: function (a, b, c) {
  4940. var d,
  4941. e,
  4942. f = this
  4943. if (b && f.fireEvent('beforeinserthtml', b) !== !0) {
  4944. if (
  4945. ((d = f.selection.getRange()),
  4946. (e = d.document.createElement('div')),
  4947. (e.style.display = 'inline'),
  4948. !c)
  4949. ) {
  4950. var g = UE.htmlparser(b)
  4951. f.options.filterRules && UE.filterNode(g, f.options.filterRules),
  4952. f.filterInputRule(g),
  4953. (b = g.toHtml())
  4954. }
  4955. if (((e.innerHTML = utils.trim(b)), !d.collapsed)) {
  4956. var h = d.startContainer
  4957. if (
  4958. (domUtils.isFillChar(h) && d.setStartBefore(h),
  4959. (h = d.endContainer),
  4960. domUtils.isFillChar(h) && d.setEndAfter(h),
  4961. d.txtToElmBoundary(),
  4962. d.endContainer &&
  4963. 1 == d.endContainer.nodeType &&
  4964. ((h = d.endContainer.childNodes[d.endOffset]),
  4965. h && domUtils.isBr(h) && d.setEndAfter(h)),
  4966. 0 == d.startOffset &&
  4967. ((h = d.startContainer),
  4968. domUtils.isBoundaryNode(h, 'firstChild') &&
  4969. ((h = d.endContainer),
  4970. d.endOffset ==
  4971. (3 == h.nodeType
  4972. ? h.nodeValue.length
  4973. : h.childNodes.length) &&
  4974. domUtils.isBoundaryNode(h, 'lastChild') &&
  4975. ((f.body.innerHTML =
  4976. '<p>' + (browser.ie ? '' : '<br/>') + '</p>'),
  4977. d.setStart(f.body.firstChild, 0).collapse(!0)))),
  4978. !d.collapsed && d.deleteContents(),
  4979. 1 == d.startContainer.nodeType)
  4980. ) {
  4981. var i,
  4982. j = d.startContainer.childNodes[d.startOffset]
  4983. if (
  4984. j &&
  4985. domUtils.isBlockElm(j) &&
  4986. (i = j.previousSibling) &&
  4987. domUtils.isBlockElm(i)
  4988. ) {
  4989. for (
  4990. d.setEnd(i, i.childNodes.length).collapse();
  4991. j.firstChild;
  4992. )
  4993. i.appendChild(j.firstChild)
  4994. domUtils.remove(j)
  4995. }
  4996. }
  4997. }
  4998. var j,
  4999. k,
  5000. i,
  5001. l,
  5002. m,
  5003. n = 0
  5004. d.inFillChar() &&
  5005. ((j = d.startContainer),
  5006. domUtils.isFillChar(j)
  5007. ? (d.setStartBefore(j).collapse(!0), domUtils.remove(j))
  5008. : domUtils.isFillChar(j, !0) &&
  5009. ((j.nodeValue = j.nodeValue.replace(fillCharReg, '')),
  5010. d.startOffset--,
  5011. d.collapsed && d.collapse(!0)))
  5012. var o = domUtils.findParentByTagName(d.startContainer, 'li', !0)
  5013. if (o) {
  5014. for (var p, q; (j = e.firstChild); ) {
  5015. for (
  5016. ;
  5017. j &&
  5018. (3 == j.nodeType ||
  5019. !domUtils.isBlockElm(j) ||
  5020. 'HR' == j.tagName);
  5021. )
  5022. (p = j.nextSibling),
  5023. d.insertNode(j).collapse(),
  5024. (q = j),
  5025. (j = p)
  5026. if (j)
  5027. if (/^(ol|ul)$/i.test(j.tagName)) {
  5028. for (; j.firstChild; )
  5029. (q = j.firstChild),
  5030. domUtils.insertAfter(o, j.firstChild),
  5031. (o = o.nextSibling)
  5032. domUtils.remove(j)
  5033. } else {
  5034. var r
  5035. ;(p = j.nextSibling),
  5036. (r = f.document.createElement('li')),
  5037. domUtils.insertAfter(o, r),
  5038. r.appendChild(j),
  5039. (q = j),
  5040. (j = p),
  5041. (o = r)
  5042. }
  5043. }
  5044. ;(o = domUtils.findParentByTagName(d.startContainer, 'li', !0)),
  5045. domUtils.isEmptyBlock(o) && domUtils.remove(o),
  5046. q && d.setStartAfter(q).collapse(!0).select(!0)
  5047. } else {
  5048. for (; (j = e.firstChild); ) {
  5049. if (n) {
  5050. for (
  5051. var s = f.document.createElement('p');
  5052. j && (3 == j.nodeType || !dtd.$block[j.tagName]);
  5053. )
  5054. (m = j.nextSibling), s.appendChild(j), (j = m)
  5055. s.firstChild && (j = s)
  5056. }
  5057. if (
  5058. (d.insertNode(j),
  5059. (m = j.nextSibling),
  5060. !n &&
  5061. j.nodeType == domUtils.NODE_ELEMENT &&
  5062. domUtils.isBlockElm(j) &&
  5063. ((k = domUtils.findParent(j, function (a) {
  5064. return domUtils.isBlockElm(a)
  5065. })),
  5066. k &&
  5067. 'body' != k.tagName.toLowerCase() &&
  5068. (!dtd[k.tagName][j.nodeName] || j.parentNode !== k)))
  5069. ) {
  5070. if (dtd[k.tagName][j.nodeName])
  5071. for (l = j.parentNode; l !== k; ) (i = l), (l = l.parentNode)
  5072. else i = k
  5073. domUtils.breakParent(j, i || l)
  5074. var i = j.previousSibling
  5075. domUtils.trimWhiteTextNode(i),
  5076. i.childNodes.length || domUtils.remove(i),
  5077. !browser.ie &&
  5078. (p = j.nextSibling) &&
  5079. domUtils.isBlockElm(p) &&
  5080. p.lastChild &&
  5081. !domUtils.isBr(p.lastChild) &&
  5082. p.appendChild(f.document.createElement('br')),
  5083. (n = 1)
  5084. }
  5085. var p = j.nextSibling
  5086. if (!e.firstChild && p && domUtils.isBlockElm(p)) {
  5087. d.setStart(p, 0).collapse(!0)
  5088. break
  5089. }
  5090. d.setEndAfter(j).collapse()
  5091. }
  5092. if (
  5093. ((j = d.startContainer),
  5094. m && domUtils.isBr(m) && domUtils.remove(m),
  5095. domUtils.isBlockElm(j) && domUtils.isEmptyNode(j))
  5096. )
  5097. if ((m = j.nextSibling))
  5098. domUtils.remove(j),
  5099. 1 == m.nodeType &&
  5100. dtd.$block[m.tagName] &&
  5101. d.setStart(m, 0).collapse(!0).shrinkBoundary()
  5102. else
  5103. try {
  5104. j.innerHTML = browser.ie ? domUtils.fillChar : '<br/>'
  5105. } catch (t) {
  5106. d.setStartBefore(j), domUtils.remove(j)
  5107. }
  5108. try {
  5109. d.select(!0)
  5110. } catch (t) {}
  5111. }
  5112. setTimeout(function () {
  5113. ;(d = f.selection.getRange()),
  5114. d.scrollToView(
  5115. f.autoHeightEnabled,
  5116. f.autoHeightEnabled ? domUtils.getXY(f.iframe).y : 0
  5117. ),
  5118. f.fireEvent('afterinserthtml', b)
  5119. }, 200)
  5120. }
  5121. }
  5122. }),
  5123. (UE.plugins.autotypeset = function () {
  5124. function a(a, b) {
  5125. return a && 3 != a.nodeType
  5126. ? domUtils.isBr(a)
  5127. ? 1
  5128. : a && a.parentNode && l[a.tagName.toLowerCase()]
  5129. ? (g && g.contains(a)) || a.getAttribute('pagebreak')
  5130. ? 0
  5131. : b
  5132. ? !domUtils.isEmptyBlock(a)
  5133. : domUtils.isEmptyBlock(
  5134. a,
  5135. new RegExp('[\\s' + domUtils.fillChar + ']', 'g')
  5136. )
  5137. : void 0
  5138. : 0
  5139. }
  5140. function b(a) {
  5141. a.style.cssText ||
  5142. (domUtils.removeAttributes(a, ['style']),
  5143. 'span' == a.tagName.toLowerCase() &&
  5144. domUtils.hasNoAttributes(a) &&
  5145. domUtils.remove(a, !0))
  5146. }
  5147. function c(c, f) {
  5148. var h,
  5149. l = this
  5150. if (f) {
  5151. if (!i.pasteFilter) return
  5152. ;(h = l.document.createElement('div')), (h.innerHTML = f.html)
  5153. } else h = l.document.body
  5154. for (
  5155. var m, n = domUtils.getElementsByTagName(h, '*'), o = 0;
  5156. (m = n[o++]);
  5157. )
  5158. if (l.fireEvent('excludeNodeinautotype', m) !== !0) {
  5159. if (
  5160. (i.clearFontSize &&
  5161. m.style.fontSize &&
  5162. (domUtils.removeStyle(m, 'font-size'), b(m)),
  5163. i.clearFontFamily &&
  5164. m.style.fontFamily &&
  5165. (domUtils.removeStyle(m, 'font-family'), b(m)),
  5166. a(m))
  5167. ) {
  5168. if (i.mergeEmptyline)
  5169. for (
  5170. var p, q = m.nextSibling, r = domUtils.isBr(m);
  5171. a(q) &&
  5172. ((p = q),
  5173. (q = p.nextSibling),
  5174. !r || (q && (!q || domUtils.isBr(q))));
  5175. )
  5176. domUtils.remove(p)
  5177. if (
  5178. i.removeEmptyline &&
  5179. domUtils.inDoc(m, h) &&
  5180. !k[m.parentNode.tagName.toLowerCase()]
  5181. ) {
  5182. if (
  5183. domUtils.isBr(m) &&
  5184. ((q = m.nextSibling), q && !domUtils.isBr(q))
  5185. )
  5186. continue
  5187. domUtils.remove(m)
  5188. continue
  5189. }
  5190. }
  5191. if (
  5192. (a(m, !0) &&
  5193. 'SPAN' != m.tagName &&
  5194. (i.indent && (m.style.textIndent = i.indentValue),
  5195. i.textAlign && (m.style.textAlign = i.textAlign)),
  5196. i.removeClass && m.className && !j[m.className.toLowerCase()])
  5197. ) {
  5198. if (g && g.contains(m)) continue
  5199. domUtils.removeAttributes(m, ['class'])
  5200. }
  5201. if (
  5202. i.imageBlockLine &&
  5203. 'img' == m.tagName.toLowerCase() &&
  5204. !m.getAttribute('emotion')
  5205. )
  5206. if (f) {
  5207. var s = m
  5208. switch (i.imageBlockLine) {
  5209. case 'left':
  5210. case 'right':
  5211. case 'none':
  5212. for (
  5213. var p, t, q, u = s.parentNode;
  5214. dtd.$inline[u.tagName] || 'A' == u.tagName;
  5215. )
  5216. u = u.parentNode
  5217. if (
  5218. ((p = u),
  5219. 'P' == p.tagName &&
  5220. 'center' == domUtils.getStyle(p, 'text-align') &&
  5221. !domUtils.isBody(p) &&
  5222. 1 ==
  5223. domUtils.getChildCount(p, function (a) {
  5224. return (
  5225. !domUtils.isBr(a) && !domUtils.isWhitespace(a)
  5226. )
  5227. }))
  5228. )
  5229. if (
  5230. ((t = p.previousSibling),
  5231. (q = p.nextSibling),
  5232. t &&
  5233. q &&
  5234. 1 == t.nodeType &&
  5235. 1 == q.nodeType &&
  5236. t.tagName == q.tagName &&
  5237. domUtils.isBlockElm(t))
  5238. ) {
  5239. for (t.appendChild(p.firstChild); q.firstChild; )
  5240. t.appendChild(q.firstChild)
  5241. domUtils.remove(p), domUtils.remove(q)
  5242. } else domUtils.setStyle(p, 'text-align', '')
  5243. domUtils.setStyle(s, 'float', i.imageBlockLine)
  5244. break
  5245. case 'center':
  5246. if ('center' != l.queryCommandValue('imagefloat')) {
  5247. for (
  5248. u = s.parentNode,
  5249. domUtils.setStyle(s, 'float', 'none'),
  5250. p = s;
  5251. u &&
  5252. 1 ==
  5253. domUtils.getChildCount(u, function (a) {
  5254. return (
  5255. !domUtils.isBr(a) && !domUtils.isWhitespace(a)
  5256. )
  5257. }) &&
  5258. (dtd.$inline[u.tagName] || 'A' == u.tagName);
  5259. )
  5260. (p = u), (u = u.parentNode)
  5261. var v = l.document.createElement('p')
  5262. domUtils.setAttributes(v, { style: 'text-align:center' }),
  5263. p.parentNode.insertBefore(v, p),
  5264. v.appendChild(p),
  5265. domUtils.setStyle(p, 'float', '')
  5266. }
  5267. }
  5268. } else {
  5269. var w = l.selection.getRange()
  5270. w.selectNode(m).select(),
  5271. l.execCommand('imagefloat', i.imageBlockLine)
  5272. }
  5273. i.removeEmptyNode &&
  5274. i.removeTagNames[m.tagName.toLowerCase()] &&
  5275. domUtils.hasNoAttributes(m) &&
  5276. domUtils.isEmptyBlock(m) &&
  5277. domUtils.remove(m)
  5278. }
  5279. if (i.tobdc) {
  5280. var x = UE.htmlparser(h.innerHTML)
  5281. x.traversal(function (a) {
  5282. 'text' == a.type && (a.data = e(a.data))
  5283. }),
  5284. (h.innerHTML = x.toHtml())
  5285. }
  5286. if (i.bdc2sb) {
  5287. var x = UE.htmlparser(h.innerHTML)
  5288. x.traversal(function (a) {
  5289. 'text' == a.type && (a.data = d(a.data))
  5290. }),
  5291. (h.innerHTML = x.toHtml())
  5292. }
  5293. f && (f.html = h.innerHTML)
  5294. }
  5295. function d(a) {
  5296. for (var b = '', c = 0; c < a.length; c++) {
  5297. var d = a.charCodeAt(c)
  5298. b +=
  5299. d >= 65281 && d <= 65373
  5300. ? String.fromCharCode(a.charCodeAt(c) - 65248)
  5301. : 12288 == d
  5302. ? String.fromCharCode(a.charCodeAt(c) - 12288 + 32)
  5303. : a.charAt(c)
  5304. }
  5305. return b
  5306. }
  5307. function e(a) {
  5308. a = utils.html(a)
  5309. for (var b = '', c = 0; c < a.length; c++)
  5310. b +=
  5311. 32 == a.charCodeAt(c)
  5312. ? String.fromCharCode(12288)
  5313. : a.charCodeAt(c) < 127
  5314. ? String.fromCharCode(a.charCodeAt(c) + 65248)
  5315. : a.charAt(c)
  5316. return b
  5317. }
  5318. function f() {
  5319. var a = h.getPreferences('autotypeset')
  5320. utils.extend(h.options.autotypeset, a)
  5321. }
  5322. this.setOpt({
  5323. autotypeset: {
  5324. mergeEmptyline: !0,
  5325. removeClass: !0,
  5326. removeEmptyline: !1,
  5327. textAlign: 'left',
  5328. imageBlockLine: 'center',
  5329. pasteFilter: !1,
  5330. clearFontSize: !1,
  5331. clearFontFamily: !1,
  5332. removeEmptyNode: !1,
  5333. removeTagNames: utils.extend({ div: 1 }, dtd.$removeEmpty),
  5334. indent: !1,
  5335. indentValue: '2em',
  5336. bdc2sb: !1,
  5337. tobdc: !1
  5338. }
  5339. })
  5340. var g,
  5341. h = this,
  5342. i = h.options.autotypeset,
  5343. j = { selectTdClass: 1, pagebreak: 1, anchorclass: 1 },
  5344. k = { li: 1 },
  5345. l = {
  5346. div: 1,
  5347. p: 1,
  5348. blockquote: 1,
  5349. center: 1,
  5350. h1: 1,
  5351. h2: 1,
  5352. h3: 1,
  5353. h4: 1,
  5354. h5: 1,
  5355. h6: 1,
  5356. span: 1
  5357. }
  5358. i &&
  5359. (f(),
  5360. i.pasteFilter && h.addListener('beforepaste', c),
  5361. (h.commands.autotypeset = {
  5362. execCommand: function () {
  5363. h.removeListener('beforepaste', c),
  5364. i.pasteFilter && h.addListener('beforepaste', c),
  5365. c.call(h)
  5366. }
  5367. }))
  5368. }),
  5369. UE.plugin.register('autosubmit', function () {
  5370. return {
  5371. shortcutkey: { autosubmit: 'ctrl+13' },
  5372. commands: {
  5373. autosubmit: {
  5374. execCommand: function () {
  5375. var a = this,
  5376. b = domUtils.findParentByTagName(a.iframe, 'form', !1)
  5377. if (b) {
  5378. if (a.fireEvent('beforesubmit') === !1) return
  5379. a.sync(), b.submit()
  5380. }
  5381. }
  5382. }
  5383. }
  5384. }
  5385. }),
  5386. UE.plugin.register('background', function () {
  5387. function a(a) {
  5388. var b = {},
  5389. c = a.split(';')
  5390. return (
  5391. utils.each(c, function (a) {
  5392. var c = a.indexOf(':'),
  5393. d = utils.trim(a.substr(0, c)).toLowerCase()
  5394. d && (b[d] = utils.trim(a.substr(c + 1) || ''))
  5395. }),
  5396. b
  5397. )
  5398. }
  5399. function b(a) {
  5400. if (a) {
  5401. var b = []
  5402. for (var c in a) a.hasOwnProperty(c) && b.push(c + ':' + a[c] + '; ')
  5403. utils.cssRule(
  5404. e,
  5405. b.length ? 'body{' + b.join('') + '}' : '',
  5406. d.document
  5407. )
  5408. } else utils.cssRule(e, '', d.document)
  5409. }
  5410. var c,
  5411. d = this,
  5412. e = 'editor_background',
  5413. f = new RegExp('body[\\s]*\\{(.+)\\}', 'i'),
  5414. g = d.hasContents
  5415. return (
  5416. (d.hasContents = function () {
  5417. return !!d.queryCommandValue('background') || g.apply(d, arguments)
  5418. }),
  5419. {
  5420. bindEvents: {
  5421. getAllHtml: function (a, b) {
  5422. var c = this.body,
  5423. e = domUtils.getComputedStyle(c, 'background-image'),
  5424. f = ''
  5425. f =
  5426. e.indexOf(d.options.imagePath) > 0
  5427. ? e
  5428. .substring(e.indexOf(d.options.imagePath), e.length - 1)
  5429. .replace(/"|\(|\)/gi, '')
  5430. : 'none' != e
  5431. ? e.replace(/url\("?|"?\)/gi, '')
  5432. : ''
  5433. var g = '<style type="text/css">body{',
  5434. h = {
  5435. 'background-color':
  5436. domUtils.getComputedStyle(c, 'background-color') ||
  5437. '#ffffff',
  5438. 'background-image': f ? 'url(' + f + ')' : '',
  5439. 'background-repeat':
  5440. domUtils.getComputedStyle(c, 'background-repeat') || '',
  5441. 'background-position': browser.ie
  5442. ? domUtils.getComputedStyle(c, 'background-position-x') +
  5443. ' ' +
  5444. domUtils.getComputedStyle(c, 'background-position-y')
  5445. : domUtils.getComputedStyle(c, 'background-position'),
  5446. height: domUtils.getComputedStyle(c, 'height')
  5447. }
  5448. for (var i in h)
  5449. h.hasOwnProperty(i) && (g += i + ':' + h[i] + '; ')
  5450. ;(g += '}</style> '), b.push(g)
  5451. },
  5452. aftersetcontent: function () {
  5453. 0 == c && b()
  5454. }
  5455. },
  5456. inputRule: function (d) {
  5457. ;(c = !1),
  5458. utils.each(d.getNodesByTagName('p'), function (d) {
  5459. var e = d.getAttr('data-background')
  5460. e && ((c = !0), b(a(e)), d.parentNode.removeChild(d))
  5461. })
  5462. },
  5463. outputRule: function (a) {
  5464. var b = this,
  5465. c = (utils.cssRule(e, b.document) || '')
  5466. .replace(/[\n\r]+/g, '')
  5467. .match(f)
  5468. c &&
  5469. a.appendChild(
  5470. UE.uNode.createElement(
  5471. '<p style="display:none;" data-background="' +
  5472. utils.trim(c[1].replace(/"/g, '').replace(/[\s]+/g, ' ')) +
  5473. '"><br/></p>'
  5474. )
  5475. )
  5476. },
  5477. commands: {
  5478. background: {
  5479. execCommand: function (a, c) {
  5480. b(c)
  5481. },
  5482. queryCommandValue: function () {
  5483. var b = this,
  5484. c = (utils.cssRule(e, b.document) || '')
  5485. .replace(/[\n\r]+/g, '')
  5486. .match(f)
  5487. return c ? a(c[1]) : null
  5488. },
  5489. notNeedUndo: !0
  5490. }
  5491. }
  5492. }
  5493. )
  5494. }),
  5495. (UE.commands.imagefloat = {
  5496. execCommand: function (a, b) {
  5497. var c = this,
  5498. d = c.selection.getRange()
  5499. if (!d.collapsed) {
  5500. var e = d.getClosedNode()
  5501. if (e && 'IMG' == e.tagName)
  5502. switch (b) {
  5503. case 'left':
  5504. case 'right':
  5505. case 'none':
  5506. for (
  5507. var f, g, h, i = e.parentNode;
  5508. dtd.$inline[i.tagName] || 'A' == i.tagName;
  5509. )
  5510. i = i.parentNode
  5511. if (
  5512. ((f = i),
  5513. 'P' == f.tagName &&
  5514. 'center' == domUtils.getStyle(f, 'text-align'))
  5515. ) {
  5516. if (
  5517. !domUtils.isBody(f) &&
  5518. 1 ==
  5519. domUtils.getChildCount(f, function (a) {
  5520. return !domUtils.isBr(a) && !domUtils.isWhitespace(a)
  5521. })
  5522. )
  5523. if (
  5524. ((g = f.previousSibling),
  5525. (h = f.nextSibling),
  5526. g &&
  5527. h &&
  5528. 1 == g.nodeType &&
  5529. 1 == h.nodeType &&
  5530. g.tagName == h.tagName &&
  5531. domUtils.isBlockElm(g))
  5532. ) {
  5533. for (g.appendChild(f.firstChild); h.firstChild; )
  5534. g.appendChild(h.firstChild)
  5535. domUtils.remove(f), domUtils.remove(h)
  5536. } else domUtils.setStyle(f, 'text-align', '')
  5537. d.selectNode(e).select()
  5538. }
  5539. domUtils.setStyle(e, 'float', 'none' == b ? '' : b),
  5540. 'none' == b && domUtils.removeAttributes(e, 'align')
  5541. break
  5542. case 'center':
  5543. if ('center' != c.queryCommandValue('imagefloat')) {
  5544. for (
  5545. i = e.parentNode,
  5546. domUtils.setStyle(e, 'float', ''),
  5547. domUtils.removeAttributes(e, 'align'),
  5548. f = e;
  5549. i &&
  5550. 1 ==
  5551. domUtils.getChildCount(i, function (a) {
  5552. return !domUtils.isBr(a) && !domUtils.isWhitespace(a)
  5553. }) &&
  5554. (dtd.$inline[i.tagName] || 'A' == i.tagName);
  5555. )
  5556. (f = i), (i = i.parentNode)
  5557. d.setStartBefore(f).setCursor(!1),
  5558. (i = c.document.createElement('div')),
  5559. i.appendChild(f),
  5560. domUtils.setStyle(f, 'float', ''),
  5561. c.execCommand(
  5562. 'insertHtml',
  5563. '<p id="_img_parent_tmp" style="text-align:center">' +
  5564. i.innerHTML +
  5565. '</p>'
  5566. ),
  5567. (f = c.document.getElementById('_img_parent_tmp')),
  5568. f.removeAttribute('id'),
  5569. (f = f.firstChild),
  5570. d.selectNode(f).select(),
  5571. (h = f.parentNode.nextSibling),
  5572. h && domUtils.isEmptyNode(h) && domUtils.remove(h)
  5573. }
  5574. }
  5575. }
  5576. },
  5577. queryCommandValue: function () {
  5578. var a,
  5579. b,
  5580. c = this.selection.getRange()
  5581. return c.collapsed
  5582. ? 'none'
  5583. : ((a = c.getClosedNode()),
  5584. a && 1 == a.nodeType && 'IMG' == a.tagName
  5585. ? ((b =
  5586. domUtils.getComputedStyle(a, 'float') ||
  5587. a.getAttribute('align')),
  5588. 'none' == b &&
  5589. (b =
  5590. 'center' ==
  5591. domUtils.getComputedStyle(a.parentNode, 'text-align')
  5592. ? 'center'
  5593. : b),
  5594. { left: 1, right: 1, center: 1 }[b] ? b : 'none')
  5595. : 'none')
  5596. },
  5597. queryCommandState: function () {
  5598. var a,
  5599. b = this.selection.getRange()
  5600. return b.collapsed
  5601. ? -1
  5602. : ((a = b.getClosedNode()),
  5603. a && 1 == a.nodeType && 'IMG' == a.tagName ? 0 : -1)
  5604. }
  5605. }),
  5606. (UE.commands.insertimage = {
  5607. execCommand: function (a, b) {
  5608. function c(a) {
  5609. utils.each(
  5610. 'width,height,border,hspace,vspace'.split(','),
  5611. function (b) {
  5612. a[b] && (a[b] = parseInt(a[b], 10) || 0)
  5613. }
  5614. ),
  5615. utils.each('src,_src'.split(','), function (b) {
  5616. a[b] && (a[b] = utils.unhtmlForUrl(a[b]))
  5617. }),
  5618. utils.each('title,alt'.split(','), function (b) {
  5619. a[b] && (a[b] = utils.unhtml(a[b]))
  5620. })
  5621. }
  5622. if (((b = utils.isArray(b) ? b : [b]), b.length)) {
  5623. var d = this,
  5624. e = d.selection.getRange(),
  5625. f = e.getClosedNode()
  5626. if (d.fireEvent('beforeinsertimage', b) !== !0) {
  5627. if (
  5628. !f ||
  5629. !/img/i.test(f.tagName) ||
  5630. ('edui-faked-video' == f.className &&
  5631. f.className.indexOf('edui-upload-video') == -1) ||
  5632. f.getAttribute('word_img')
  5633. ) {
  5634. var g,
  5635. h = [],
  5636. i = ''
  5637. if (((g = b[0]), 1 == b.length))
  5638. c(g),
  5639. (i =
  5640. '<img src="' +
  5641. g.src +
  5642. '" ' +
  5643. (g._src ? ' _src="' + g._src + '" ' : '') +
  5644. (g.width ? 'width="' + g.width + '" ' : '') +
  5645. (g.height ? ' height="' + g.height + '" ' : '') +
  5646. ('left' == g.floatStyle || 'right' == g.floatStyle
  5647. ? ' style="float:' + g.floatStyle + ';"'
  5648. : '') +
  5649. (g.title && '' != g.title
  5650. ? ' title="' + g.title + '"'
  5651. : '') +
  5652. (g.border && '0' != g.border
  5653. ? ' border="' + g.border + '"'
  5654. : '') +
  5655. (g.alt && '' != g.alt ? ' alt="' + g.alt + '"' : '') +
  5656. (g.hspace && '0' != g.hspace
  5657. ? ' hspace = "' + g.hspace + '"'
  5658. : '') +
  5659. (g.vspace && '0' != g.vspace
  5660. ? ' vspace = "' + g.vspace + '"'
  5661. : '') +
  5662. '/>'),
  5663. 'center' == g.floatStyle &&
  5664. (i = '<p style="text-align: center">' + i + '</p>'),
  5665. h.push(i)
  5666. else
  5667. for (var j = 0; (g = b[j++]); )
  5668. c(g),
  5669. (i =
  5670. '<p ' +
  5671. ('center' == g.floatStyle
  5672. ? 'style="text-align: center" '
  5673. : '') +
  5674. '><img src="' +
  5675. g.src +
  5676. '" ' +
  5677. (g.width ? 'width="' + g.width + '" ' : '') +
  5678. (g._src ? ' _src="' + g._src + '" ' : '') +
  5679. (g.height ? ' height="' + g.height + '" ' : '') +
  5680. ' style="' +
  5681. (g.floatStyle && 'center' != g.floatStyle
  5682. ? 'float:' + g.floatStyle + ';'
  5683. : '') +
  5684. (g.border || '') +
  5685. '" ' +
  5686. (g.title ? ' title="' + g.title + '"' : '') +
  5687. ' /></p>'),
  5688. h.push(i)
  5689. d.execCommand('insertHtml', h.join(''))
  5690. } else {
  5691. var k = b.shift(),
  5692. l = k.floatStyle
  5693. delete k.floatStyle,
  5694. domUtils.setAttributes(f, k),
  5695. d.execCommand('imagefloat', l),
  5696. b.length > 0 &&
  5697. (e.setStartAfter(f).setCursor(!1, !0),
  5698. d.execCommand('insertimage', b))
  5699. }
  5700. d.fireEvent('afterinsertimage', b)
  5701. }
  5702. }
  5703. }
  5704. }),
  5705. (UE.plugins.justify = function () {
  5706. var a = domUtils.isBlockElm,
  5707. b = { left: 1, right: 1, center: 1, justify: 1 },
  5708. c = function (b, c) {
  5709. var d = b.createBookmark(),
  5710. e = function (a) {
  5711. return 1 == a.nodeType
  5712. ? 'br' != a.tagName.toLowerCase() && !domUtils.isBookmarkNode(a)
  5713. : !domUtils.isWhitespace(a)
  5714. }
  5715. b.enlarge(!0)
  5716. for (
  5717. var f,
  5718. g = b.createBookmark(),
  5719. h = domUtils.getNextDomNode(g.start, !1, e),
  5720. i = b.cloneRange();
  5721. h &&
  5722. !(domUtils.getPosition(h, g.end) & domUtils.POSITION_FOLLOWING);
  5723. )
  5724. if (3 != h.nodeType && a(h)) h = domUtils.getNextDomNode(h, !0, e)
  5725. else {
  5726. for (i.setStartBefore(h); h && h !== g.end && !a(h); )
  5727. (f = h),
  5728. (h = domUtils.getNextDomNode(h, !1, null, function (b) {
  5729. return !a(b)
  5730. }))
  5731. i.setEndAfter(f)
  5732. var j = i.getCommonAncestor()
  5733. if (!domUtils.isBody(j) && a(j))
  5734. domUtils.setStyles(
  5735. j,
  5736. utils.isString(c) ? { 'text-align': c } : c
  5737. ),
  5738. (h = j)
  5739. else {
  5740. var k = b.document.createElement('p')
  5741. domUtils.setStyles(
  5742. k,
  5743. utils.isString(c) ? { 'text-align': c } : c
  5744. )
  5745. var l = i.extractContents()
  5746. k.appendChild(l), i.insertNode(k), (h = k)
  5747. }
  5748. h = domUtils.getNextDomNode(h, !1, e)
  5749. }
  5750. return b.moveToBookmark(g).moveToBookmark(d)
  5751. }
  5752. UE.commands.justify = {
  5753. execCommand: function (a, b) {
  5754. var d,
  5755. e = this.selection.getRange()
  5756. return (
  5757. e.collapsed &&
  5758. ((d = this.document.createTextNode('p')), e.insertNode(d)),
  5759. c(e, b),
  5760. d && (e.setStartBefore(d).collapse(!0), domUtils.remove(d)),
  5761. e.select(),
  5762. !0
  5763. )
  5764. },
  5765. queryCommandValue: function () {
  5766. var a = this.selection.getStart(),
  5767. c = domUtils.getComputedStyle(a, 'text-align')
  5768. return b[c] ? c : 'left'
  5769. },
  5770. queryCommandState: function () {
  5771. var a = this.selection.getStart(),
  5772. b =
  5773. a && domUtils.findParentByTagName(a, ['td', 'th', 'caption'], !0)
  5774. return b ? -1 : 0
  5775. }
  5776. }
  5777. }),
  5778. (UE.plugins.font = function () {
  5779. function a(a) {
  5780. for (
  5781. var b;
  5782. (b = a.parentNode) &&
  5783. 'SPAN' == b.tagName &&
  5784. 1 ==
  5785. domUtils.getChildCount(b, function (a) {
  5786. return !domUtils.isBookmarkNode(a) && !domUtils.isBr(a)
  5787. });
  5788. )
  5789. (b.style.cssText += a.style.cssText), domUtils.remove(a, !0), (a = b)
  5790. }
  5791. function b(a, b, c) {
  5792. if (
  5793. g[b] &&
  5794. (a.adjustmentBoundary(),
  5795. !a.collapsed && 1 == a.startContainer.nodeType)
  5796. ) {
  5797. var d = a.startContainer.childNodes[a.startOffset]
  5798. if (d && domUtils.isTagNode(d, 'span')) {
  5799. var e = a.createBookmark()
  5800. utils.each(domUtils.getElementsByTagName(d, 'span'), function (a) {
  5801. a.parentNode &&
  5802. !domUtils.isBookmarkNode(a) &&
  5803. (('backcolor' == b &&
  5804. domUtils
  5805. .getComputedStyle(a, 'background-color')
  5806. .toLowerCase() === c) ||
  5807. (domUtils.removeStyle(a, g[b]),
  5808. 0 == a.style.cssText.replace(/^\s+$/, '').length &&
  5809. domUtils.remove(a, !0)))
  5810. }),
  5811. a.moveToBookmark(e)
  5812. }
  5813. }
  5814. }
  5815. function c(c, d, e) {
  5816. var f,
  5817. g = c.collapsed,
  5818. h = c.createBookmark()
  5819. if (g)
  5820. for (f = h.start.parentNode; dtd.$inline[f.tagName]; )
  5821. f = f.parentNode
  5822. else f = domUtils.getCommonAncestor(h.start, h.end)
  5823. utils.each(domUtils.getElementsByTagName(f, 'span'), function (b) {
  5824. if (b.parentNode && !domUtils.isBookmarkNode(b)) {
  5825. if (/\s*border\s*:\s*none;?\s*/i.test(b.style.cssText))
  5826. return void (/^\s*border\s*:\s*none;?\s*$/.test(b.style.cssText)
  5827. ? domUtils.remove(b, !0)
  5828. : domUtils.removeStyle(b, 'border'))
  5829. if (
  5830. (/border/i.test(b.style.cssText) &&
  5831. 'SPAN' == b.parentNode.tagName &&
  5832. /border/i.test(b.parentNode.style.cssText) &&
  5833. (b.style.cssText = b.style.cssText.replace(
  5834. /border[^:]*:[^;]+;?/gi,
  5835. ''
  5836. )),
  5837. 'fontborder' != d || 'none' != e)
  5838. )
  5839. for (
  5840. var c = b.nextSibling;
  5841. c && 1 == c.nodeType && 'SPAN' == c.tagName;
  5842. )
  5843. if (domUtils.isBookmarkNode(c) && 'fontborder' == d)
  5844. b.appendChild(c), (c = b.nextSibling)
  5845. else {
  5846. if (
  5847. (c.style.cssText == b.style.cssText &&
  5848. (domUtils.moveChild(c, b), domUtils.remove(c)),
  5849. b.nextSibling === c)
  5850. )
  5851. break
  5852. c = b.nextSibling
  5853. }
  5854. if ((a(b), browser.ie && browser.version > 8)) {
  5855. var f = domUtils.findParent(b, function (a) {
  5856. return (
  5857. 'SPAN' == a.tagName &&
  5858. /background-color/.test(a.style.cssText)
  5859. )
  5860. })
  5861. f &&
  5862. !/background-color/.test(b.style.cssText) &&
  5863. (b.style.backgroundColor = f.style.backgroundColor)
  5864. }
  5865. }
  5866. }),
  5867. c.moveToBookmark(h),
  5868. b(c, d, e)
  5869. }
  5870. var d = this,
  5871. e = {
  5872. forecolor: 'color',
  5873. backcolor: 'background-color',
  5874. fontsize: 'font-size',
  5875. fontfamily: 'font-family',
  5876. underline: 'text-decoration',
  5877. strikethrough: 'text-decoration',
  5878. fontborder: 'border'
  5879. },
  5880. f = { underline: 1, strikethrough: 1, fontborder: 1 },
  5881. g = {
  5882. forecolor: 'color',
  5883. backcolor: 'background-color',
  5884. fontsize: 'font-size',
  5885. fontfamily: 'font-family'
  5886. }
  5887. d.setOpt({
  5888. fontfamily: [
  5889. { name: 'songti', val: '宋体,SimSun' },
  5890. { name: 'yahei', val: '微软雅黑,Microsoft YaHei' },
  5891. { name: 'kaiti', val: '楷体,楷体_GB2312, SimKai' },
  5892. { name: 'heiti', val: '黑体, SimHei' },
  5893. { name: 'lishu', val: '隶书, SimLi' },
  5894. { name: 'andaleMono', val: 'andale mono' },
  5895. { name: 'arial', val: 'arial, helvetica,sans-serif' },
  5896. { name: 'arialBlack', val: 'arial black,avant garde' },
  5897. { name: 'comicSansMs', val: 'comic sans ms' },
  5898. { name: 'impact', val: 'impact,chicago' },
  5899. { name: 'timesNewRoman', val: 'times new roman' }
  5900. ],
  5901. fontsize: [10, 11, 12, 14, 16, 18, 20, 24, 36]
  5902. }),
  5903. d.addInputRule(function (a) {
  5904. utils.each(a.getNodesByTagName('u s del font strike'), function (a) {
  5905. if ('font' == a.tagName) {
  5906. var b = []
  5907. for (var c in a.attrs)
  5908. switch (c) {
  5909. case 'size':
  5910. b.push(
  5911. 'font-size:' +
  5912. ({
  5913. 1: '10',
  5914. 2: '12',
  5915. 3: '16',
  5916. 4: '18',
  5917. 5: '24',
  5918. 6: '32',
  5919. 7: '48'
  5920. }[a.attrs[c]] || a.attrs[c]) +
  5921. 'px'
  5922. )
  5923. break
  5924. case 'color':
  5925. b.push('color:' + a.attrs[c])
  5926. break
  5927. case 'face':
  5928. b.push('font-family:' + a.attrs[c])
  5929. break
  5930. case 'style':
  5931. b.push(a.attrs[c])
  5932. }
  5933. a.attrs = { style: b.join(';') }
  5934. } else {
  5935. var d = 'u' == a.tagName ? 'underline' : 'line-through'
  5936. a.attrs = {
  5937. style: (a.getAttr('style') || '') + 'text-decoration:' + d + ';'
  5938. }
  5939. }
  5940. a.tagName = 'span'
  5941. })
  5942. })
  5943. for (var h in e)
  5944. !(function (a, b) {
  5945. UE.commands[a] = {
  5946. execCommand: function (d, e) {
  5947. e =
  5948. e ||
  5949. (this.queryCommandState(d)
  5950. ? 'none'
  5951. : 'underline' == d
  5952. ? 'underline'
  5953. : 'fontborder' == d
  5954. ? '1px solid #000'
  5955. : 'line-through')
  5956. var g,
  5957. h = this,
  5958. i = this.selection.getRange()
  5959. if ('default' == e)
  5960. i.collapsed &&
  5961. ((g = h.document.createTextNode('font')),
  5962. i.insertNode(g).select()),
  5963. h.execCommand('removeFormat', 'span,a', b),
  5964. g && (i.setStartBefore(g).collapse(!0), domUtils.remove(g)),
  5965. c(i, d, e),
  5966. i.select()
  5967. else if (i.collapsed) {
  5968. var j = domUtils.findParentByTagName(
  5969. i.startContainer,
  5970. 'span',
  5971. !0
  5972. )
  5973. if (
  5974. ((g = h.document.createTextNode('font')),
  5975. !j ||
  5976. j.children.length ||
  5977. j[browser.ie ? 'innerText' : 'textContent'].replace(
  5978. fillCharReg,
  5979. ''
  5980. ).length)
  5981. ) {
  5982. if (
  5983. (i.insertNode(g),
  5984. i.selectNode(g).select(),
  5985. (j = i.document.createElement('span')),
  5986. f[a])
  5987. ) {
  5988. if (domUtils.findParentByTagName(g, 'a', !0))
  5989. return (
  5990. i.setStartBefore(g).setCursor(), void domUtils.remove(g)
  5991. )
  5992. h.execCommand('removeFormat', 'span,a', b)
  5993. }
  5994. if (
  5995. ((j.style.cssText = b + ':' + e),
  5996. g.parentNode.insertBefore(j, g),
  5997. !browser.ie || (browser.ie && 9 == browser.version))
  5998. )
  5999. for (var k = j.parentNode; !domUtils.isBlockElm(k); )
  6000. 'SPAN' == k.tagName &&
  6001. (j.style.cssText =
  6002. k.style.cssText + ';' + j.style.cssText),
  6003. (k = k.parentNode)
  6004. opera
  6005. ? setTimeout(function () {
  6006. i.setStart(j, 0).collapse(!0), c(i, d, e), i.select()
  6007. })
  6008. : (i.setStart(j, 0).collapse(!0), c(i, d, e), i.select())
  6009. } else
  6010. i.insertNode(g),
  6011. f[a] &&
  6012. (i.selectNode(g).select(),
  6013. h.execCommand('removeFormat', 'span,a', b, null),
  6014. (j = domUtils.findParentByTagName(g, 'span', !0)),
  6015. i.setStartBefore(g)),
  6016. j && (j.style.cssText += ';' + b + ':' + e),
  6017. i.collapse(!0).select()
  6018. domUtils.remove(g)
  6019. } else
  6020. f[a] &&
  6021. h.queryCommandValue(a) &&
  6022. h.execCommand('removeFormat', 'span,a', b),
  6023. (i = h.selection.getRange()),
  6024. i.applyInlineStyle('span', { style: b + ':' + e }),
  6025. c(i, d, e),
  6026. i.select()
  6027. return !0
  6028. },
  6029. queryCommandValue: function (a) {
  6030. var c = this.selection.getStart()
  6031. if ('underline' == a || 'strikethrough' == a) {
  6032. for (
  6033. var d, e = c;
  6034. e && !domUtils.isBlockElm(e) && !domUtils.isBody(e);
  6035. ) {
  6036. if (
  6037. 1 == e.nodeType &&
  6038. ((d = domUtils.getComputedStyle(e, b)), 'none' != d)
  6039. )
  6040. return d
  6041. e = e.parentNode
  6042. }
  6043. return 'none'
  6044. }
  6045. if ('fontborder' == a) {
  6046. for (var f, g = c; g && dtd.$inline[g.tagName]; ) {
  6047. if (
  6048. (f = domUtils.getComputedStyle(g, 'border')) &&
  6049. /1px/.test(f) &&
  6050. /solid/.test(f)
  6051. )
  6052. return f
  6053. g = g.parentNode
  6054. }
  6055. return ''
  6056. }
  6057. if ('FontSize' == a) {
  6058. var h = domUtils.getComputedStyle(c, b),
  6059. g = /^([\d\.]+)(\w+)$/.exec(h)
  6060. return g ? Math.floor(g[1]) + g[2] : h
  6061. }
  6062. return domUtils.getComputedStyle(c, b)
  6063. },
  6064. queryCommandState: function (a) {
  6065. if (!f[a]) return 0
  6066. var b = this.queryCommandValue(a)
  6067. return 'fontborder' == a
  6068. ? /1px/.test(b) && /solid/.test(b)
  6069. : 'underline' == a
  6070. ? /underline/.test(b)
  6071. : /line\-through/.test(b)
  6072. }
  6073. }
  6074. })(h, e[h])
  6075. }),
  6076. (UE.plugins.link = function () {
  6077. function a(a) {
  6078. var b = a.startContainer,
  6079. c = a.endContainer
  6080. ;(b = domUtils.findParentByTagName(b, 'a', !0)) && a.setStartBefore(b),
  6081. (c = domUtils.findParentByTagName(c, 'a', !0)) && a.setEndAfter(c)
  6082. }
  6083. function b(b, c, d) {
  6084. var e = b.cloneRange(),
  6085. f = d.queryCommandValue('link')
  6086. a((b = b.adjustmentBoundary()))
  6087. var g = b.startContainer
  6088. if (
  6089. (1 == g.nodeType &&
  6090. f &&
  6091. ((g = g.childNodes[b.startOffset]),
  6092. g &&
  6093. 1 == g.nodeType &&
  6094. 'A' == g.tagName &&
  6095. /^(?:https?|ftp|file)\s*:\s*\/\//.test(
  6096. g[browser.ie ? 'innerText' : 'textContent']
  6097. ) &&
  6098. (g[browser.ie ? 'innerText' : 'textContent'] = utils.html(
  6099. c.textValue || c.href
  6100. ))),
  6101. (e.collapsed && !f) ||
  6102. (b.removeInlineStyle('a'), (e = b.cloneRange())),
  6103. e.collapsed)
  6104. ) {
  6105. var h = b.document.createElement('a'),
  6106. i = ''
  6107. c.textValue
  6108. ? ((i = utils.html(c.textValue)), delete c.textValue)
  6109. : (i = utils.html(c.href)),
  6110. domUtils.setAttributes(h, c),
  6111. (g = domUtils.findParentByTagName(e.startContainer, 'a', !0)),
  6112. g &&
  6113. domUtils.isInNodeEndBoundary(e, g) &&
  6114. b.setStartAfter(g).collapse(!0),
  6115. (h[browser.ie ? 'innerText' : 'textContent'] = i),
  6116. b.insertNode(h).selectNode(h)
  6117. } else b.applyInlineStyle('a', c)
  6118. }
  6119. ;(UE.commands.unlink = {
  6120. execCommand: function () {
  6121. var b,
  6122. c = this.selection.getRange()
  6123. ;(c.collapsed &&
  6124. !domUtils.findParentByTagName(c.startContainer, 'a', !0)) ||
  6125. ((b = c.createBookmark()),
  6126. a(c),
  6127. c.removeInlineStyle('a').moveToBookmark(b).select())
  6128. },
  6129. queryCommandState: function () {
  6130. return !this.highlight && this.queryCommandValue('link') ? 0 : -1
  6131. }
  6132. }),
  6133. (UE.commands.link = {
  6134. execCommand: function (a, c) {
  6135. var d
  6136. c._href && (c._href = utils.unhtml(c._href, /[<">]/g)),
  6137. c.href && (c.href = utils.unhtml(c.href, /[<">]/g)),
  6138. c.textValue &&
  6139. (c.textValue = utils.unhtml(c.textValue, /[<">]/g)),
  6140. b((d = this.selection.getRange()), c, this),
  6141. d.collapse().select(!0)
  6142. },
  6143. queryCommandValue: function () {
  6144. var a,
  6145. b = this.selection.getRange()
  6146. if (!b.collapsed) {
  6147. b.shrinkBoundary()
  6148. var c =
  6149. 3 != b.startContainer.nodeType &&
  6150. b.startContainer.childNodes[b.startOffset]
  6151. ? b.startContainer.childNodes[b.startOffset]
  6152. : b.startContainer,
  6153. d =
  6154. 3 == b.endContainer.nodeType || 0 == b.endOffset
  6155. ? b.endContainer
  6156. : b.endContainer.childNodes[b.endOffset - 1],
  6157. e = b.getCommonAncestor()
  6158. if (
  6159. ((a = domUtils.findParentByTagName(e, 'a', !0)),
  6160. !a && 1 == e.nodeType)
  6161. )
  6162. for (
  6163. var f, g, h, i = e.getElementsByTagName('a'), j = 0;
  6164. (h = i[j++]);
  6165. )
  6166. if (
  6167. ((f = domUtils.getPosition(h, c)),
  6168. (g = domUtils.getPosition(h, d)),
  6169. (f & domUtils.POSITION_FOLLOWING ||
  6170. f & domUtils.POSITION_CONTAINS) &&
  6171. (g & domUtils.POSITION_PRECEDING ||
  6172. g & domUtils.POSITION_CONTAINS))
  6173. ) {
  6174. a = h
  6175. break
  6176. }
  6177. return a
  6178. }
  6179. if (
  6180. ((a = b.startContainer),
  6181. (a = 1 == a.nodeType ? a : a.parentNode),
  6182. a &&
  6183. (a = domUtils.findParentByTagName(a, 'a', !0)) &&
  6184. !domUtils.isInNodeEndBoundary(b, a))
  6185. )
  6186. return a
  6187. },
  6188. queryCommandState: function () {
  6189. var a = this.selection.getRange().getClosedNode(),
  6190. b =
  6191. a &&
  6192. ('edui-faked-video' == a.className ||
  6193. a.className.indexOf('edui-upload-video') != -1)
  6194. return b ? -1 : 0
  6195. }
  6196. })
  6197. }),
  6198. (UE.plugins.insertframe = function () {
  6199. function a() {
  6200. b._iframe && delete b._iframe
  6201. }
  6202. var b = this
  6203. b.addListener('selectionchange', function () {
  6204. a()
  6205. })
  6206. }),
  6207. (UE.commands.scrawl = {
  6208. queryCommandState: function () {
  6209. return browser.ie && browser.version <= 8 ? -1 : 0
  6210. }
  6211. }),
  6212. (UE.plugins.removeformat = function () {
  6213. var a = this
  6214. a.setOpt({
  6215. removeFormatTags:
  6216. 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var',
  6217. removeFormatAttributes:
  6218. 'class,style,lang,width,height,align,hspace,valign'
  6219. }),
  6220. (a.commands.removeformat = {
  6221. execCommand: function (a, b, c, d, e) {
  6222. function f(a) {
  6223. if (3 == a.nodeType || 'span' != a.tagName.toLowerCase()) return 0
  6224. if (browser.ie) {
  6225. var b = a.attributes
  6226. if (b.length) {
  6227. for (var c = 0, d = b.length; c < d; c++)
  6228. if (b[c].specified) return 0
  6229. return 1
  6230. }
  6231. }
  6232. return !a.attributes.length
  6233. }
  6234. function g(a) {
  6235. var b = a.createBookmark()
  6236. if ((a.collapsed && a.enlarge(!0), !e)) {
  6237. var d = domUtils.findParentByTagName(a.startContainer, 'a', !0)
  6238. d && a.setStartBefore(d),
  6239. (d = domUtils.findParentByTagName(a.endContainer, 'a', !0)),
  6240. d && a.setEndAfter(d)
  6241. }
  6242. for (
  6243. h = a.createBookmark(), p = h.start;
  6244. (i = p.parentNode) && !domUtils.isBlockElm(i);
  6245. )
  6246. domUtils.breakParent(p, i), domUtils.clearEmptySibling(p)
  6247. if (h.end) {
  6248. for (p = h.end; (i = p.parentNode) && !domUtils.isBlockElm(i); )
  6249. domUtils.breakParent(p, i), domUtils.clearEmptySibling(p)
  6250. for (
  6251. var g, l = domUtils.getNextDomNode(h.start, !1, m);
  6252. l && l != h.end;
  6253. )
  6254. (g = domUtils.getNextDomNode(l, !0, m)),
  6255. dtd.$empty[l.tagName.toLowerCase()] ||
  6256. domUtils.isBookmarkNode(l) ||
  6257. (j.test(l.tagName)
  6258. ? c
  6259. ? (domUtils.removeStyle(l, c),
  6260. f(l) &&
  6261. 'text-decoration' != c &&
  6262. domUtils.remove(l, !0))
  6263. : domUtils.remove(l, !0)
  6264. : dtd.$tableContent[l.tagName] ||
  6265. dtd.$list[l.tagName] ||
  6266. (domUtils.removeAttributes(l, k),
  6267. f(l) && domUtils.remove(l, !0))),
  6268. (l = g)
  6269. }
  6270. var n = h.start.parentNode
  6271. !domUtils.isBlockElm(n) ||
  6272. dtd.$tableContent[n.tagName] ||
  6273. dtd.$list[n.tagName] ||
  6274. domUtils.removeAttributes(n, k),
  6275. (n = h.end.parentNode),
  6276. h.end &&
  6277. domUtils.isBlockElm(n) &&
  6278. !dtd.$tableContent[n.tagName] &&
  6279. !dtd.$list[n.tagName] &&
  6280. domUtils.removeAttributes(n, k),
  6281. a.moveToBookmark(h).moveToBookmark(b)
  6282. for (
  6283. var o, p = a.startContainer, q = a.collapsed;
  6284. 1 == p.nodeType &&
  6285. domUtils.isEmptyNode(p) &&
  6286. dtd.$removeEmpty[p.tagName];
  6287. )
  6288. (o = p.parentNode),
  6289. a.setStartBefore(p),
  6290. a.startContainer === a.endContainer && a.endOffset--,
  6291. domUtils.remove(p),
  6292. (p = o)
  6293. if (!q)
  6294. for (
  6295. p = a.endContainer;
  6296. 1 == p.nodeType &&
  6297. domUtils.isEmptyNode(p) &&
  6298. dtd.$removeEmpty[p.tagName];
  6299. )
  6300. (o = p.parentNode),
  6301. a.setEndBefore(p),
  6302. domUtils.remove(p),
  6303. (p = o)
  6304. }
  6305. var h,
  6306. i,
  6307. j = new RegExp(
  6308. '^(?:' +
  6309. (b || this.options.removeFormatTags).replace(/,/g, '|') +
  6310. ')$',
  6311. 'i'
  6312. ),
  6313. k = c
  6314. ? []
  6315. : (d || this.options.removeFormatAttributes).split(','),
  6316. l = new dom.Range(this.document),
  6317. m = function (a) {
  6318. return 1 == a.nodeType
  6319. }
  6320. ;(l = this.selection.getRange()), g(l), l.select()
  6321. }
  6322. })
  6323. }),
  6324. (UE.plugins.blockquote = function () {
  6325. function a(a) {
  6326. return domUtils.filterNodeList(
  6327. a.selection.getStartElementPath(),
  6328. 'blockquote'
  6329. )
  6330. }
  6331. var b = this
  6332. b.commands.blockquote = {
  6333. execCommand: function (b, c) {
  6334. var d = this.selection.getRange(),
  6335. e = a(this),
  6336. f = dtd.blockquote,
  6337. g = d.createBookmark()
  6338. if (e) {
  6339. var h = d.startContainer,
  6340. i = domUtils.isBlockElm(h)
  6341. ? h
  6342. : domUtils.findParent(h, function (a) {
  6343. return domUtils.isBlockElm(a)
  6344. }),
  6345. j = d.endContainer,
  6346. k = domUtils.isBlockElm(j)
  6347. ? j
  6348. : domUtils.findParent(j, function (a) {
  6349. return domUtils.isBlockElm(a)
  6350. })
  6351. ;(i = domUtils.findParentByTagName(i, 'li', !0) || i),
  6352. (k = domUtils.findParentByTagName(k, 'li', !0) || k),
  6353. 'LI' == i.tagName ||
  6354. 'TD' == i.tagName ||
  6355. i === e ||
  6356. domUtils.isBody(i)
  6357. ? domUtils.remove(e, !0)
  6358. : domUtils.breakParent(i, e),
  6359. i !== k &&
  6360. ((e = domUtils.findParentByTagName(k, 'blockquote')),
  6361. e &&
  6362. ('LI' == k.tagName || 'TD' == k.tagName || domUtils.isBody(k)
  6363. ? e.parentNode && domUtils.remove(e, !0)
  6364. : domUtils.breakParent(k, e)))
  6365. for (
  6366. var l,
  6367. m = domUtils.getElementsByTagName(this.document, 'blockquote'),
  6368. n = 0;
  6369. (l = m[n++]);
  6370. )
  6371. l.childNodes.length
  6372. ? domUtils.getPosition(l, i) & domUtils.POSITION_FOLLOWING &&
  6373. domUtils.getPosition(l, k) & domUtils.POSITION_PRECEDING &&
  6374. domUtils.remove(l, !0)
  6375. : domUtils.remove(l)
  6376. } else {
  6377. for (
  6378. var o = d.cloneRange(),
  6379. p =
  6380. 1 == o.startContainer.nodeType
  6381. ? o.startContainer
  6382. : o.startContainer.parentNode,
  6383. q = p,
  6384. r = 1;
  6385. ;
  6386. ) {
  6387. if (domUtils.isBody(p)) {
  6388. q !== p
  6389. ? d.collapsed
  6390. ? (o.selectNode(q), (r = 0))
  6391. : o.setStartBefore(q)
  6392. : o.setStart(p, 0)
  6393. break
  6394. }
  6395. if (!f[p.tagName]) {
  6396. d.collapsed ? o.selectNode(q) : o.setStartBefore(q)
  6397. break
  6398. }
  6399. ;(q = p), (p = p.parentNode)
  6400. }
  6401. if (r)
  6402. for (
  6403. q =
  6404. p =
  6405. p =
  6406. 1 == o.endContainer.nodeType
  6407. ? o.endContainer
  6408. : o.endContainer.parentNode;
  6409. ;
  6410. ) {
  6411. if (domUtils.isBody(p)) {
  6412. q !== p ? o.setEndAfter(q) : o.setEnd(p, p.childNodes.length)
  6413. break
  6414. }
  6415. if (!f[p.tagName]) {
  6416. o.setEndAfter(q)
  6417. break
  6418. }
  6419. ;(q = p), (p = p.parentNode)
  6420. }
  6421. ;(p = d.document.createElement('blockquote')),
  6422. domUtils.setAttributes(p, c),
  6423. p.appendChild(o.extractContents()),
  6424. o.insertNode(p)
  6425. for (
  6426. var s, t = domUtils.getElementsByTagName(p, 'blockquote'), n = 0;
  6427. (s = t[n++]);
  6428. )
  6429. s.parentNode && domUtils.remove(s, !0)
  6430. }
  6431. d.moveToBookmark(g).select()
  6432. },
  6433. queryCommandState: function () {
  6434. return a(this) ? 1 : 0
  6435. }
  6436. }
  6437. }),
  6438. (UE.commands.touppercase = UE.commands.tolowercase =
  6439. {
  6440. execCommand: function (a) {
  6441. var b = this,
  6442. c = b.selection.getRange()
  6443. if (c.collapsed) return c
  6444. for (
  6445. var d = c.createBookmark(),
  6446. e = d.end,
  6447. f = function (a) {
  6448. return !domUtils.isBr(a) && !domUtils.isWhitespace(a)
  6449. },
  6450. g = domUtils.getNextDomNode(d.start, !1, f);
  6451. g &&
  6452. domUtils.getPosition(g, e) & domUtils.POSITION_PRECEDING &&
  6453. (3 == g.nodeType &&
  6454. (g.nodeValue =
  6455. g.nodeValue[
  6456. 'touppercase' == a ? 'toUpperCase' : 'toLowerCase'
  6457. ]()),
  6458. (g = domUtils.getNextDomNode(g, !0, f)),
  6459. g !== e);
  6460. );
  6461. c.moveToBookmark(d).select()
  6462. }
  6463. }),
  6464. (UE.commands.indent = {
  6465. execCommand: function () {
  6466. var a = this,
  6467. b = a.queryCommandState('indent')
  6468. ? '0em'
  6469. : a.options.indentValue || '2em'
  6470. a.execCommand('Paragraph', 'p', { style: 'text-indent:' + b })
  6471. },
  6472. queryCommandState: function () {
  6473. var a = domUtils.filterNodeList(
  6474. this.selection.getStartElementPath(),
  6475. 'p h1 h2 h3 h4 h5 h6'
  6476. )
  6477. return a && a.style.textIndent && parseInt(a.style.textIndent) ? 1 : 0
  6478. }
  6479. }),
  6480. (UE.commands.print = {
  6481. execCommand: function () {
  6482. this.window.print()
  6483. },
  6484. notNeedUndo: 1
  6485. }),
  6486. (UE.commands.preview = {
  6487. execCommand: function () {
  6488. var a = window.open('', '_blank', ''),
  6489. b = a.document
  6490. b.open(),
  6491. b.write(
  6492. '<!DOCTYPE html><html><head><meta charset="utf-8"/><script src="' +
  6493. this.options.UEDITOR_HOME_URL +
  6494. "ueditor.parse.js\"></script><script>setTimeout(function(){uParse('div',{rootPath: '" +
  6495. this.options.UEDITOR_HOME_URL +
  6496. "'})},300)</script></head><body><div>" +
  6497. this.getContent(null, null, !0) +
  6498. '</div></body></html>'
  6499. ),
  6500. b.close()
  6501. },
  6502. notNeedUndo: 1
  6503. }),
  6504. (UE.plugins.selectall = function () {
  6505. var a = this
  6506. ;(a.commands.selectall = {
  6507. execCommand: function () {
  6508. var a = this,
  6509. b = a.body,
  6510. c = a.selection.getRange()
  6511. c.selectNodeContents(b),
  6512. domUtils.isEmptyBlock(b) &&
  6513. (browser.opera &&
  6514. b.firstChild &&
  6515. 1 == b.firstChild.nodeType &&
  6516. c.setStartAtFirst(b.firstChild),
  6517. c.collapse(!0)),
  6518. c.select(!0)
  6519. },
  6520. notNeedUndo: 1
  6521. }),
  6522. a.addshortcutkey({ selectAll: 'ctrl+65' })
  6523. }),
  6524. (UE.plugins.paragraph = function () {
  6525. var a = this,
  6526. b = domUtils.isBlockElm,
  6527. c = ['TD', 'LI', 'PRE'],
  6528. d = function (a, d, e, f) {
  6529. var g,
  6530. h = a.createBookmark(),
  6531. i = function (a) {
  6532. return 1 == a.nodeType
  6533. ? 'br' != a.tagName.toLowerCase() && !domUtils.isBookmarkNode(a)
  6534. : !domUtils.isWhitespace(a)
  6535. }
  6536. a.enlarge(!0)
  6537. for (
  6538. var j,
  6539. k = a.createBookmark(),
  6540. l = domUtils.getNextDomNode(k.start, !1, i),
  6541. m = a.cloneRange();
  6542. l &&
  6543. !(domUtils.getPosition(l, k.end) & domUtils.POSITION_FOLLOWING);
  6544. )
  6545. if (3 != l.nodeType && b(l)) l = domUtils.getNextDomNode(l, !0, i)
  6546. else {
  6547. for (m.setStartBefore(l); l && l !== k.end && !b(l); )
  6548. (j = l),
  6549. (l = domUtils.getNextDomNode(l, !1, null, function (a) {
  6550. return !b(a)
  6551. }))
  6552. m.setEndAfter(j),
  6553. (g = a.document.createElement(d)),
  6554. e &&
  6555. (domUtils.setAttributes(g, e),
  6556. f &&
  6557. 'customstyle' == f &&
  6558. e.style &&
  6559. (g.style.cssText = e.style)),
  6560. g.appendChild(m.extractContents()),
  6561. domUtils.isEmptyNode(g) && domUtils.fillChar(a.document, g),
  6562. m.insertNode(g)
  6563. var n = g.parentNode
  6564. b(n) &&
  6565. !domUtils.isBody(g.parentNode) &&
  6566. utils.indexOf(c, n.tagName) == -1 &&
  6567. ((f && 'customstyle' == f) ||
  6568. (n.getAttribute('dir') &&
  6569. g.setAttribute('dir', n.getAttribute('dir')),
  6570. n.style.cssText &&
  6571. (g.style.cssText = n.style.cssText + ';' + g.style.cssText),
  6572. n.style.textAlign &&
  6573. !g.style.textAlign &&
  6574. (g.style.textAlign = n.style.textAlign),
  6575. n.style.textIndent &&
  6576. !g.style.textIndent &&
  6577. (g.style.textIndent = n.style.textIndent),
  6578. n.style.padding &&
  6579. !g.style.padding &&
  6580. (g.style.padding = n.style.padding)),
  6581. e && /h\d/i.test(n.tagName) && !/h\d/i.test(g.tagName)
  6582. ? (domUtils.setAttributes(n, e),
  6583. f &&
  6584. 'customstyle' == f &&
  6585. e.style &&
  6586. (n.style.cssText = e.style),
  6587. domUtils.remove(g, !0),
  6588. (g = n))
  6589. : domUtils.remove(g.parentNode, !0)),
  6590. (l = utils.indexOf(c, n.tagName) != -1 ? n : g),
  6591. (l = domUtils.getNextDomNode(l, !1, i))
  6592. }
  6593. return a.moveToBookmark(k).moveToBookmark(h)
  6594. }
  6595. a.setOpt('paragraph', {
  6596. p: '',
  6597. h1: '',
  6598. h2: '',
  6599. h3: '',
  6600. h4: '',
  6601. h5: '',
  6602. h6: ''
  6603. }),
  6604. (a.commands.paragraph = {
  6605. execCommand: function (a, b, c, e) {
  6606. var f = this.selection.getRange()
  6607. if (f.collapsed) {
  6608. var g = this.document.createTextNode('p')
  6609. if ((f.insertNode(g), browser.ie)) {
  6610. var h = g.previousSibling
  6611. h && domUtils.isWhitespace(h) && domUtils.remove(h),
  6612. (h = g.nextSibling),
  6613. h && domUtils.isWhitespace(h) && domUtils.remove(h)
  6614. }
  6615. }
  6616. if (
  6617. ((f = d(f, b, c, e)),
  6618. g &&
  6619. (f.setStartBefore(g).collapse(!0),
  6620. (pN = g.parentNode),
  6621. domUtils.remove(g),
  6622. domUtils.isBlockElm(pN) &&
  6623. domUtils.isEmptyNode(pN) &&
  6624. domUtils.fillNode(this.document, pN)),
  6625. browser.gecko && f.collapsed && 1 == f.startContainer.nodeType)
  6626. ) {
  6627. var i = f.startContainer.childNodes[f.startOffset]
  6628. i &&
  6629. 1 == i.nodeType &&
  6630. i.tagName.toLowerCase() == b &&
  6631. f.setStart(i, 0).collapse(!0)
  6632. }
  6633. return f.select(), !0
  6634. },
  6635. queryCommandValue: function () {
  6636. var a = domUtils.filterNodeList(
  6637. this.selection.getStartElementPath(),
  6638. 'p h1 h2 h3 h4 h5 h6'
  6639. )
  6640. return a ? a.tagName.toLowerCase() : ''
  6641. }
  6642. })
  6643. }),
  6644. (function () {
  6645. var a = domUtils.isBlockElm,
  6646. b = function (a) {
  6647. return domUtils.filterNodeList(
  6648. a.selection.getStartElementPath(),
  6649. function (a) {
  6650. return a && 1 == a.nodeType && a.getAttribute('dir')
  6651. }
  6652. )
  6653. },
  6654. c = function (c, d, e) {
  6655. var f,
  6656. g = function (a) {
  6657. return 1 == a.nodeType
  6658. ? !domUtils.isBookmarkNode(a)
  6659. : !domUtils.isWhitespace(a)
  6660. },
  6661. h = b(d)
  6662. if (h && c.collapsed) return h.setAttribute('dir', e), c
  6663. ;(f = c.createBookmark()), c.enlarge(!0)
  6664. for (
  6665. var i,
  6666. j = c.createBookmark(),
  6667. k = domUtils.getNextDomNode(j.start, !1, g),
  6668. l = c.cloneRange();
  6669. k &&
  6670. !(domUtils.getPosition(k, j.end) & domUtils.POSITION_FOLLOWING);
  6671. )
  6672. if (3 != k.nodeType && a(k)) k = domUtils.getNextDomNode(k, !0, g)
  6673. else {
  6674. for (l.setStartBefore(k); k && k !== j.end && !a(k); )
  6675. (i = k),
  6676. (k = domUtils.getNextDomNode(k, !1, null, function (b) {
  6677. return !a(b)
  6678. }))
  6679. l.setEndAfter(i)
  6680. var m = l.getCommonAncestor()
  6681. if (!domUtils.isBody(m) && a(m)) m.setAttribute('dir', e), (k = m)
  6682. else {
  6683. var n = c.document.createElement('p')
  6684. n.setAttribute('dir', e)
  6685. var o = l.extractContents()
  6686. n.appendChild(o), l.insertNode(n), (k = n)
  6687. }
  6688. k = domUtils.getNextDomNode(k, !1, g)
  6689. }
  6690. return c.moveToBookmark(j).moveToBookmark(f)
  6691. }
  6692. UE.commands.directionality = {
  6693. execCommand: function (a, b) {
  6694. var d = this.selection.getRange()
  6695. if (d.collapsed) {
  6696. var e = this.document.createTextNode('d')
  6697. d.insertNode(e)
  6698. }
  6699. return (
  6700. c(d, this, b),
  6701. e && (d.setStartBefore(e).collapse(!0), domUtils.remove(e)),
  6702. d.select(),
  6703. !0
  6704. )
  6705. },
  6706. queryCommandValue: function () {
  6707. var a = b(this)
  6708. return a ? a.getAttribute('dir') : 'ltr'
  6709. }
  6710. }
  6711. })(),
  6712. (UE.plugins.horizontal = function () {
  6713. var a = this
  6714. ;(a.commands.horizontal = {
  6715. execCommand: function (a) {
  6716. var b = this
  6717. if (b.queryCommandState(a) !== -1) {
  6718. b.execCommand('insertHtml', '<hr>')
  6719. var c = b.selection.getRange(),
  6720. d = c.startContainer
  6721. if (1 == d.nodeType && !d.childNodes[c.startOffset]) {
  6722. var e
  6723. ;(e = d.childNodes[c.startOffset - 1]) &&
  6724. 1 == e.nodeType &&
  6725. 'HR' == e.tagName &&
  6726. ('p' == b.options.enterTag
  6727. ? ((e = b.document.createElement('p')),
  6728. c.insertNode(e),
  6729. c.setStart(e, 0).setCursor())
  6730. : ((e = b.document.createElement('br')),
  6731. c.insertNode(e),
  6732. c.setStartBefore(e).setCursor()))
  6733. }
  6734. return !0
  6735. }
  6736. },
  6737. queryCommandState: function () {
  6738. return domUtils.filterNodeList(
  6739. this.selection.getStartElementPath(),
  6740. 'table'
  6741. )
  6742. ? -1
  6743. : 0
  6744. }
  6745. }),
  6746. a.addListener('delkeydown', function (a, b) {
  6747. var c = this.selection.getRange()
  6748. if ((c.txtToElmBoundary(!0), domUtils.isStartInblock(c))) {
  6749. var d = c.startContainer,
  6750. e = d.previousSibling
  6751. if (e && domUtils.isTagNode(e, 'hr'))
  6752. return (
  6753. domUtils.remove(e), c.select(), domUtils.preventDefault(b), !0
  6754. )
  6755. }
  6756. })
  6757. }),
  6758. (UE.commands.time = UE.commands.date =
  6759. {
  6760. execCommand: function (a, b) {
  6761. function c(a, b) {
  6762. var c = ('0' + a.getHours()).slice(-2),
  6763. d = ('0' + a.getMinutes()).slice(-2),
  6764. e = ('0' + a.getSeconds()).slice(-2)
  6765. return (
  6766. (b = b || 'hh:ii:ss'),
  6767. b.replace(/hh/gi, c).replace(/ii/gi, d).replace(/ss/gi, e)
  6768. )
  6769. }
  6770. function d(a, b) {
  6771. var c = ('000' + a.getFullYear()).slice(-4),
  6772. d = c.slice(-2),
  6773. e = ('0' + (a.getMonth() + 1)).slice(-2),
  6774. f = ('0' + a.getDate()).slice(-2)
  6775. return (
  6776. (b = b || 'yyyy-mm-dd'),
  6777. b
  6778. .replace(/yyyy/gi, c)
  6779. .replace(/yy/gi, d)
  6780. .replace(/mm/gi, e)
  6781. .replace(/dd/gi, f)
  6782. )
  6783. }
  6784. var e = new Date()
  6785. this.execCommand('insertHtml', 'time' == a ? c(e, b) : d(e, b))
  6786. }
  6787. }),
  6788. (UE.plugins.rowspacing = function () {
  6789. var a = this
  6790. a.setOpt({
  6791. rowspacingtop: ['5', '10', '15', '20', '25'],
  6792. rowspacingbottom: ['5', '10', '15', '20', '25']
  6793. }),
  6794. (a.commands.rowspacing = {
  6795. execCommand: function (a, b, c) {
  6796. return (
  6797. this.execCommand('paragraph', 'p', {
  6798. style: 'margin-' + c + ':' + b + 'px'
  6799. }),
  6800. !0
  6801. )
  6802. },
  6803. queryCommandValue: function (a, b) {
  6804. var c,
  6805. d = domUtils.filterNodeList(
  6806. this.selection.getStartElementPath(),
  6807. function (a) {
  6808. return domUtils.isBlockElm(a)
  6809. }
  6810. )
  6811. return d
  6812. ? ((c = domUtils
  6813. .getComputedStyle(d, 'margin-' + b)
  6814. .replace(/[^\d]/g, '')),
  6815. c ? c : 0)
  6816. : 0
  6817. }
  6818. })
  6819. }),
  6820. (UE.plugins.lineheight = function () {
  6821. var a = this
  6822. a.setOpt({ lineheight: ['1', '1.5', '1.75', '2', '3', '4', '5'] }),
  6823. (a.commands.lineheight = {
  6824. execCommand: function (a, b) {
  6825. return (
  6826. this.execCommand('paragraph', 'p', {
  6827. style: 'line-height:' + ('1' == b ? 'normal' : b + 'em')
  6828. }),
  6829. !0
  6830. )
  6831. },
  6832. queryCommandValue: function () {
  6833. var a = domUtils.filterNodeList(
  6834. this.selection.getStartElementPath(),
  6835. function (a) {
  6836. return domUtils.isBlockElm(a)
  6837. }
  6838. )
  6839. if (a) {
  6840. var b = domUtils.getComputedStyle(a, 'line-height')
  6841. return 'normal' == b ? 1 : b.replace(/[^\d.]*/gi, '')
  6842. }
  6843. }
  6844. })
  6845. }),
  6846. (UE.plugins.insertcode = function () {
  6847. var a = this
  6848. a.ready(function () {
  6849. utils.cssRule(
  6850. 'pre',
  6851. 'pre{margin:.5em 0;padding:.4em .6em;border-radius:8px;background:#f8f8f8;}',
  6852. a.document
  6853. )
  6854. }),
  6855. a.setOpt('insertcode', {
  6856. as3: 'ActionScript3',
  6857. bash: 'Bash/Shell',
  6858. cpp: 'C/C++',
  6859. css: 'Css',
  6860. cf: 'CodeFunction',
  6861. 'c#': 'C#',
  6862. delphi: 'Delphi',
  6863. diff: 'Diff',
  6864. erlang: 'Erlang',
  6865. groovy: 'Groovy',
  6866. html: 'Html',
  6867. java: 'Java',
  6868. jfx: 'JavaFx',
  6869. js: 'Javascript',
  6870. pl: 'Perl',
  6871. php: 'Php',
  6872. plain: 'Plain Text',
  6873. ps: 'PowerShell',
  6874. python: 'Python',
  6875. ruby: 'Ruby',
  6876. scala: 'Scala',
  6877. sql: 'Sql',
  6878. vb: 'Vb',
  6879. xml: 'Xml'
  6880. }),
  6881. (a.commands.insertcode = {
  6882. execCommand: function (a, b) {
  6883. var c = this,
  6884. d = c.selection.getRange(),
  6885. e = domUtils.findParentByTagName(d.startContainer, 'pre', !0)
  6886. if (e) e.className = 'brush:' + b + ';toolbar:false;'
  6887. else {
  6888. var f = ''
  6889. if (d.collapsed)
  6890. f =
  6891. browser.ie && browser.ie11below
  6892. ? browser.version <= 8
  6893. ? '&nbsp;'
  6894. : ''
  6895. : '<br/>'
  6896. else {
  6897. var g = d.extractContents(),
  6898. h = c.document.createElement('div')
  6899. h.appendChild(g),
  6900. utils.each(
  6901. UE.filterNode(
  6902. UE.htmlparser(h.innerHTML.replace(/[\r\t]/g, '')),
  6903. c.options.filterTxtRules
  6904. ).children,
  6905. function (a) {
  6906. if (
  6907. browser.ie &&
  6908. browser.ie11below &&
  6909. browser.version > 8
  6910. )
  6911. 'element' == a.type
  6912. ? 'br' == a.tagName
  6913. ? (f += '\n')
  6914. : dtd.$empty[a.tagName] ||
  6915. (utils.each(a.children, function (b) {
  6916. 'element' == b.type
  6917. ? 'br' == b.tagName
  6918. ? (f += '\n')
  6919. : dtd.$empty[a.tagName] ||
  6920. (f += b.innerText())
  6921. : (f += b.data)
  6922. }),
  6923. /\n$/.test(f) || (f += '\n'))
  6924. : (f += a.data + '\n'),
  6925. !a.nextSibling() &&
  6926. /\n$/.test(f) &&
  6927. (f = f.replace(/\n$/, ''))
  6928. else if (browser.ie && browser.ie11below)
  6929. 'element' == a.type
  6930. ? 'br' == a.tagName
  6931. ? (f += '<br>')
  6932. : dtd.$empty[a.tagName] ||
  6933. (utils.each(a.children, function (b) {
  6934. 'element' == b.type
  6935. ? 'br' == b.tagName
  6936. ? (f += '<br>')
  6937. : dtd.$empty[a.tagName] ||
  6938. (f += b.innerText())
  6939. : (f += b.data)
  6940. }),
  6941. /br>$/.test(f) || (f += '<br>'))
  6942. : (f += a.data + '<br>'),
  6943. !a.nextSibling() &&
  6944. /<br>$/.test(f) &&
  6945. (f = f.replace(/<br>$/, ''))
  6946. else if (
  6947. ((f +=
  6948. 'element' == a.type
  6949. ? dtd.$empty[a.tagName]
  6950. ? ''
  6951. : a.innerText()
  6952. : a.data),
  6953. !/br\/?\s*>$/.test(f))
  6954. ) {
  6955. if (!a.nextSibling()) return
  6956. f += '<br>'
  6957. }
  6958. }
  6959. )
  6960. }
  6961. c.execCommand(
  6962. 'inserthtml',
  6963. '<pre id="coder"class="brush:' +
  6964. b +
  6965. ';toolbar:false">' +
  6966. f +
  6967. '</pre>',
  6968. !0
  6969. ),
  6970. (e = c.document.getElementById('coder')),
  6971. domUtils.removeAttributes(e, 'id')
  6972. var i = e.previousSibling
  6973. i &&
  6974. ((3 == i.nodeType &&
  6975. 1 == i.nodeValue.length &&
  6976. browser.ie &&
  6977. 6 == browser.version) ||
  6978. domUtils.isEmptyBlock(i)) &&
  6979. domUtils.remove(i)
  6980. var d = c.selection.getRange()
  6981. domUtils.isEmptyBlock(e)
  6982. ? d.setStart(e, 0).setCursor(!1, !0)
  6983. : d.selectNodeContents(e).select()
  6984. }
  6985. },
  6986. queryCommandValue: function () {
  6987. var a = this.selection.getStartElementPath(),
  6988. b = ''
  6989. return (
  6990. utils.each(a, function (a) {
  6991. if ('PRE' == a.nodeName) {
  6992. var c = a.className.match(/brush:([^;]+)/)
  6993. return (b = c && c[1] ? c[1] : ''), !1
  6994. }
  6995. }),
  6996. b
  6997. )
  6998. }
  6999. }),
  7000. a.addInputRule(function (a) {
  7001. utils.each(a.getNodesByTagName('pre'), function (a) {
  7002. var b = a.getNodesByTagName('br')
  7003. if (b.length)
  7004. return void (
  7005. browser.ie &&
  7006. browser.ie11below &&
  7007. browser.version > 8 &&
  7008. utils.each(b, function (a) {
  7009. var b = UE.uNode.createText('\n')
  7010. a.parentNode.insertBefore(b, a), a.parentNode.removeChild(a)
  7011. })
  7012. )
  7013. if (!(browser.ie && browser.ie11below && browser.version > 8)) {
  7014. var c = a.innerText().split(/\n/)
  7015. a.innerHTML(''),
  7016. utils.each(c, function (b) {
  7017. b.length && a.appendChild(UE.uNode.createText(b)),
  7018. a.appendChild(UE.uNode.createElement('br'))
  7019. })
  7020. }
  7021. })
  7022. }),
  7023. a.addOutputRule(function (a) {
  7024. utils.each(a.getNodesByTagName('pre'), function (a) {
  7025. var b = ''
  7026. utils.each(a.children, function (a) {
  7027. b +=
  7028. 'text' == a.type
  7029. ? a.data.replace(/[ ]/g, '&nbsp;').replace(/\n$/, '')
  7030. : 'br' == a.tagName
  7031. ? '\n'
  7032. : dtd.$empty[a.tagName]
  7033. ? a.innerText()
  7034. : ''
  7035. }),
  7036. a.innerText(b.replace(/(&nbsp;|\n)+$/, ''))
  7037. })
  7038. }),
  7039. (a.notNeedCodeQuery = {
  7040. help: 1,
  7041. undo: 1,
  7042. redo: 1,
  7043. source: 1,
  7044. print: 1,
  7045. searchreplace: 1,
  7046. fullscreen: 1,
  7047. preview: 1,
  7048. insertparagraph: 1,
  7049. elementpath: 1,
  7050. insertcode: 1,
  7051. inserthtml: 1,
  7052. selectall: 1
  7053. })
  7054. a.queryCommandState
  7055. ;(a.queryCommandState = function (a) {
  7056. var b = this
  7057. return !b.notNeedCodeQuery[a.toLowerCase()] &&
  7058. b.selection &&
  7059. b.queryCommandValue('insertcode')
  7060. ? -1
  7061. : UE.Editor.prototype.queryCommandState.apply(this, arguments)
  7062. }),
  7063. a.addListener('beforeenterkeydown', function () {
  7064. var b = a.selection.getRange(),
  7065. c = domUtils.findParentByTagName(b.startContainer, 'pre', !0)
  7066. if (c) {
  7067. if (
  7068. (a.fireEvent('saveScene'),
  7069. b.collapsed || b.deleteContents(),
  7070. !browser.ie || browser.ie9above)
  7071. ) {
  7072. var c,
  7073. d = a.document.createElement('br')
  7074. b.insertNode(d).setStartAfter(d).collapse(!0)
  7075. var e = d.nextSibling
  7076. e || (browser.ie && !(browser.version > 10))
  7077. ? b.setStartAfter(d)
  7078. : b.insertNode(d.cloneNode(!1)),
  7079. (c = d.previousSibling)
  7080. for (var f; c; )
  7081. if (
  7082. ((f = c), (c = c.previousSibling), !c || 'BR' == c.nodeName)
  7083. ) {
  7084. c = f
  7085. break
  7086. }
  7087. if (c) {
  7088. for (
  7089. var g = '';
  7090. c &&
  7091. 'BR' != c.nodeName &&
  7092. new RegExp('^[\\s' + domUtils.fillChar + ']*$').test(
  7093. c.nodeValue
  7094. );
  7095. )
  7096. (g += c.nodeValue), (c = c.nextSibling)
  7097. if ('BR' != c.nodeName) {
  7098. var h = c.nodeValue.match(
  7099. new RegExp('^([\\s' + domUtils.fillChar + ']+)')
  7100. )
  7101. h && h[1] && (g += h[1])
  7102. }
  7103. g &&
  7104. ((g = a.document.createTextNode(g)),
  7105. b.insertNode(g).setStartAfter(g))
  7106. }
  7107. b.collapse(!0).select(!0)
  7108. } else if (browser.version > 8) {
  7109. var i = a.document.createTextNode('\n'),
  7110. j = b.startContainer
  7111. if (0 == b.startOffset) {
  7112. var k = j.previousSibling
  7113. if (k) {
  7114. b.insertNode(i)
  7115. var l = a.document.createTextNode(' ')
  7116. b.setStartAfter(i)
  7117. .insertNode(l)
  7118. .setStart(l, 0)
  7119. .collapse(!0)
  7120. .select(!0)
  7121. }
  7122. } else {
  7123. b.insertNode(i).setStartAfter(i)
  7124. var l = a.document.createTextNode(' ')
  7125. ;(j = b.startContainer.childNodes[b.startOffset]),
  7126. j && !/^\n/.test(j.nodeValue) && b.setStartBefore(i),
  7127. b.insertNode(l).setStart(l, 0).collapse(!0).select(!0)
  7128. }
  7129. } else {
  7130. var d = a.document.createElement('br')
  7131. b.insertNode(d),
  7132. b.insertNode(a.document.createTextNode(domUtils.fillChar)),
  7133. b.setStartAfter(d),
  7134. (c = d.previousSibling)
  7135. for (var f; c; )
  7136. if (
  7137. ((f = c), (c = c.previousSibling), !c || 'BR' == c.nodeName)
  7138. ) {
  7139. c = f
  7140. break
  7141. }
  7142. if (c) {
  7143. for (
  7144. var g = '';
  7145. c &&
  7146. 'BR' != c.nodeName &&
  7147. new RegExp('^[ ' + domUtils.fillChar + ']*$').test(
  7148. c.nodeValue
  7149. );
  7150. )
  7151. (g += c.nodeValue), (c = c.nextSibling)
  7152. if ('BR' != c.nodeName) {
  7153. var h = c.nodeValue.match(
  7154. new RegExp('^([ ' + domUtils.fillChar + ']+)')
  7155. )
  7156. h && h[1] && (g += h[1])
  7157. }
  7158. ;(g = a.document.createTextNode(g)),
  7159. b.insertNode(g).setStartAfter(g)
  7160. }
  7161. b.collapse(!0).select()
  7162. }
  7163. return a.fireEvent('saveScene'), !0
  7164. }
  7165. }),
  7166. a.addListener('tabkeydown', function (b, c) {
  7167. var d = a.selection.getRange(),
  7168. e = domUtils.findParentByTagName(d.startContainer, 'pre', !0)
  7169. if (e) {
  7170. if ((a.fireEvent('saveScene'), c.shiftKey));
  7171. else if (d.collapsed) {
  7172. var f = a.document.createTextNode(' ')
  7173. d.insertNode(f).setStartAfter(f).collapse(!0).select(!0)
  7174. } else {
  7175. for (
  7176. var g = d.createBookmark(), h = g.start.previousSibling;
  7177. h;
  7178. ) {
  7179. if (e.firstChild === h && !domUtils.isBr(h)) {
  7180. e.insertBefore(a.document.createTextNode(' '), h)
  7181. break
  7182. }
  7183. if (domUtils.isBr(h)) {
  7184. e.insertBefore(
  7185. a.document.createTextNode(' '),
  7186. h.nextSibling
  7187. )
  7188. break
  7189. }
  7190. h = h.previousSibling
  7191. }
  7192. var i = g.end
  7193. for (
  7194. h = g.start.nextSibling,
  7195. e.firstChild === g.start &&
  7196. e.insertBefore(
  7197. a.document.createTextNode(' '),
  7198. h.nextSibling
  7199. );
  7200. h && h !== i;
  7201. ) {
  7202. if (domUtils.isBr(h) && h.nextSibling) {
  7203. if (h.nextSibling === i) break
  7204. e.insertBefore(
  7205. a.document.createTextNode(' '),
  7206. h.nextSibling
  7207. )
  7208. }
  7209. h = h.nextSibling
  7210. }
  7211. d.moveToBookmark(g).select()
  7212. }
  7213. return a.fireEvent('saveScene'), !0
  7214. }
  7215. }),
  7216. a.addListener('beforeinserthtml', function (a, b) {
  7217. var c = this,
  7218. d = c.selection.getRange(),
  7219. e = domUtils.findParentByTagName(d.startContainer, 'pre', !0)
  7220. if (e) {
  7221. d.collapsed || d.deleteContents()
  7222. var f = ''
  7223. if (browser.ie && browser.version > 8) {
  7224. utils.each(
  7225. UE.filterNode(UE.htmlparser(b), c.options.filterTxtRules)
  7226. .children,
  7227. function (a) {
  7228. 'element' == a.type
  7229. ? 'br' == a.tagName
  7230. ? (f += '\n')
  7231. : dtd.$empty[a.tagName] ||
  7232. (utils.each(a.children, function (b) {
  7233. 'element' == b.type
  7234. ? 'br' == b.tagName
  7235. ? (f += '\n')
  7236. : dtd.$empty[a.tagName] || (f += b.innerText())
  7237. : (f += b.data)
  7238. }),
  7239. /\n$/.test(f) || (f += '\n'))
  7240. : (f += a.data + '\n'),
  7241. !a.nextSibling() &&
  7242. /\n$/.test(f) &&
  7243. (f = f.replace(/\n$/, ''))
  7244. }
  7245. )
  7246. var g = c.document.createTextNode(
  7247. utils.html(f.replace(/&nbsp;/g, ' '))
  7248. )
  7249. d.insertNode(g).selectNode(g).select()
  7250. } else {
  7251. var h = c.document.createDocumentFragment()
  7252. utils.each(
  7253. UE.filterNode(UE.htmlparser(b), c.options.filterTxtRules)
  7254. .children,
  7255. function (a) {
  7256. 'element' == a.type
  7257. ? 'br' == a.tagName
  7258. ? h.appendChild(c.document.createElement('br'))
  7259. : dtd.$empty[a.tagName] ||
  7260. (utils.each(a.children, function (b) {
  7261. 'element' == b.type
  7262. ? 'br' == b.tagName
  7263. ? h.appendChild(c.document.createElement('br'))
  7264. : dtd.$empty[a.tagName] ||
  7265. h.appendChild(
  7266. c.document.createTextNode(
  7267. utils.html(
  7268. b.innerText().replace(/&nbsp;/g, ' ')
  7269. )
  7270. )
  7271. )
  7272. : h.appendChild(
  7273. c.document.createTextNode(
  7274. utils.html(b.data.replace(/&nbsp;/g, ' '))
  7275. )
  7276. )
  7277. }),
  7278. 'BR' != h.lastChild.nodeName &&
  7279. h.appendChild(c.document.createElement('br')))
  7280. : h.appendChild(
  7281. c.document.createTextNode(
  7282. utils.html(a.data.replace(/&nbsp;/g, ' '))
  7283. )
  7284. ),
  7285. a.nextSibling() ||
  7286. 'BR' != h.lastChild.nodeName ||
  7287. h.removeChild(h.lastChild)
  7288. }
  7289. ),
  7290. d.insertNode(h).select()
  7291. }
  7292. return !0
  7293. }
  7294. }),
  7295. a.addListener('keydown', function (a, b) {
  7296. var c = this,
  7297. d = b.keyCode || b.which
  7298. if (40 == d) {
  7299. var e,
  7300. f = c.selection.getRange(),
  7301. g = f.startContainer
  7302. if (
  7303. f.collapsed &&
  7304. (e = domUtils.findParentByTagName(f.startContainer, 'pre', !0)) &&
  7305. !e.nextSibling
  7306. ) {
  7307. for (var h = e.lastChild; h && 'BR' == h.nodeName; )
  7308. h = h.previousSibling
  7309. ;(h === g ||
  7310. (f.startContainer === e &&
  7311. f.startOffset == e.childNodes.length)) &&
  7312. (c.execCommand('insertparagraph'), domUtils.preventDefault(b))
  7313. }
  7314. }
  7315. }),
  7316. a.addListener('delkeydown', function (b, c) {
  7317. var d = this.selection.getRange()
  7318. d.txtToElmBoundary(!0)
  7319. var e = d.startContainer
  7320. if (
  7321. domUtils.isTagNode(e, 'pre') &&
  7322. d.collapsed &&
  7323. domUtils.isStartInblock(d)
  7324. ) {
  7325. var f = a.document.createElement('p')
  7326. return (
  7327. domUtils.fillNode(a.document, f),
  7328. e.parentNode.insertBefore(f, e),
  7329. domUtils.remove(e),
  7330. d.setStart(f, 0).setCursor(!1, !0),
  7331. domUtils.preventDefault(c),
  7332. !0
  7333. )
  7334. }
  7335. })
  7336. }),
  7337. (UE.commands.cleardoc = {
  7338. execCommand: function (a) {
  7339. var b = this,
  7340. c = b.options.enterTag,
  7341. d = b.selection.getRange()
  7342. 'br' == c
  7343. ? ((b.body.innerHTML = '<br/>'), d.setStart(b.body, 0).setCursor())
  7344. : ((b.body.innerHTML = '<p>' + (ie ? '' : '<br/>') + '</p>'),
  7345. d.setStart(b.body.firstChild, 0).setCursor(!1, !0)),
  7346. setTimeout(function () {
  7347. b.fireEvent('clearDoc')
  7348. }, 0)
  7349. }
  7350. }),
  7351. UE.plugin.register('anchor', function () {
  7352. return {
  7353. bindEvents: {
  7354. ready: function () {
  7355. utils.cssRule(
  7356. 'anchor',
  7357. ".anchorclass{background: url('" +
  7358. this.options.themePath +
  7359. this.options.theme +
  7360. "/images/anchor.gif') no-repeat scroll left center transparent;cursor: auto;display: inline-block;height: 16px;width: 15px;}",
  7361. this.document
  7362. )
  7363. }
  7364. },
  7365. outputRule: function (a) {
  7366. utils.each(a.getNodesByTagName('img'), function (a) {
  7367. var b
  7368. ;(b = a.getAttr('anchorname')) &&
  7369. ((a.tagName = 'a'),
  7370. a.setAttr({ anchorname: '', name: b, class: '' }))
  7371. })
  7372. },
  7373. inputRule: function (a) {
  7374. utils.each(a.getNodesByTagName('a'), function (a) {
  7375. var b
  7376. ;(b = a.getAttr('name')) &&
  7377. !a.getAttr('href') &&
  7378. ((a.tagName = 'img'),
  7379. a.setAttr({
  7380. anchorname: a.getAttr('name'),
  7381. class: 'anchorclass'
  7382. }),
  7383. a.setAttr('name'))
  7384. })
  7385. },
  7386. commands: {
  7387. anchor: {
  7388. execCommand: function (a, b) {
  7389. var c = this.selection.getRange(),
  7390. d = c.getClosedNode()
  7391. if (d && d.getAttribute('anchorname'))
  7392. b
  7393. ? d.setAttribute('anchorname', b)
  7394. : (c.setStartBefore(d).setCursor(), domUtils.remove(d))
  7395. else if (b) {
  7396. var e = this.document.createElement('img')
  7397. c.collapse(!0),
  7398. domUtils.setAttributes(e, {
  7399. anchorname: b,
  7400. class: 'anchorclass'
  7401. }),
  7402. c.insertNode(e).setStartAfter(e).setCursor(!1, !0)
  7403. }
  7404. }
  7405. }
  7406. }
  7407. }
  7408. }),
  7409. (UE.plugins.wordcount = function () {
  7410. var a = this
  7411. a.setOpt('wordCount', !0),
  7412. a.addListener('contentchange', function () {
  7413. a.fireEvent('wordcount')
  7414. })
  7415. var b
  7416. a.addListener('ready', function () {
  7417. var a = this
  7418. domUtils.on(a.body, 'keyup', function (c) {
  7419. var d = c.keyCode || c.which,
  7420. e = { 16: 1, 18: 1, 20: 1, 37: 1, 38: 1, 39: 1, 40: 1 }
  7421. d in e ||
  7422. (clearTimeout(b),
  7423. (b = setTimeout(function () {
  7424. a.fireEvent('wordcount')
  7425. }, 200)))
  7426. })
  7427. })
  7428. }),
  7429. (UE.plugins.pagebreak = function () {
  7430. function a(a) {
  7431. if (domUtils.isEmptyBlock(a)) {
  7432. for (
  7433. var b, d = a.firstChild;
  7434. d && 1 == d.nodeType && domUtils.isEmptyBlock(d);
  7435. )
  7436. (b = d), (d = d.firstChild)
  7437. !b && (b = a), domUtils.fillNode(c.document, b)
  7438. }
  7439. }
  7440. function b(a) {
  7441. return (
  7442. a &&
  7443. 1 == a.nodeType &&
  7444. 'HR' == a.tagName &&
  7445. 'pagebreak' == a.className
  7446. )
  7447. }
  7448. var c = this,
  7449. d = ['td']
  7450. c.setOpt('pageBreakTag', '_ueditor_page_break_tag_'),
  7451. c.ready(function () {
  7452. utils.cssRule(
  7453. 'pagebreak',
  7454. '.pagebreak{display:block;clear:both !important;cursor:default !important;width: 100% !important;margin:0;}',
  7455. c.document
  7456. )
  7457. }),
  7458. c.addInputRule(function (a) {
  7459. a.traversal(function (a) {
  7460. if ('text' == a.type && a.data == c.options.pageBreakTag) {
  7461. var b = UE.uNode.createElement(
  7462. '<hr class="pagebreak" noshade="noshade" size="5" style="-webkit-user-select: none;">'
  7463. )
  7464. a.parentNode.insertBefore(b, a), a.parentNode.removeChild(a)
  7465. }
  7466. })
  7467. }),
  7468. c.addOutputRule(function (a) {
  7469. utils.each(a.getNodesByTagName('hr'), function (a) {
  7470. if ('pagebreak' == a.getAttr('class')) {
  7471. var b = UE.uNode.createText(c.options.pageBreakTag)
  7472. a.parentNode.insertBefore(b, a), a.parentNode.removeChild(a)
  7473. }
  7474. })
  7475. }),
  7476. (c.commands.pagebreak = {
  7477. execCommand: function () {
  7478. var e = c.selection.getRange(),
  7479. f = c.document.createElement('hr')
  7480. domUtils.setAttributes(f, {
  7481. class: 'pagebreak',
  7482. noshade: 'noshade',
  7483. size: '5'
  7484. }),
  7485. domUtils.unSelectable(f)
  7486. var g,
  7487. h = domUtils.findParentByTagName(e.startContainer, d, !0),
  7488. i = []
  7489. if (h)
  7490. switch (h.tagName) {
  7491. case 'TD':
  7492. if (((g = h.parentNode), g.previousSibling))
  7493. g.parentNode.insertBefore(f, g),
  7494. (i = domUtils.findParents(f))
  7495. else {
  7496. var j = domUtils.findParentByTagName(g, 'table')
  7497. j.parentNode.insertBefore(f, j),
  7498. (i = domUtils.findParents(f, !0))
  7499. }
  7500. ;(g = i[1]),
  7501. f !== g && domUtils.breakParent(f, g),
  7502. c.fireEvent('afteradjusttable', c.document)
  7503. }
  7504. else {
  7505. if (!e.collapsed) {
  7506. e.deleteContents()
  7507. for (
  7508. var k = e.startContainer;
  7509. !domUtils.isBody(k) &&
  7510. domUtils.isBlockElm(k) &&
  7511. domUtils.isEmptyNode(k);
  7512. )
  7513. e.setStartBefore(k).collapse(!0),
  7514. domUtils.remove(k),
  7515. (k = e.startContainer)
  7516. }
  7517. e.insertNode(f)
  7518. for (var l, g = f.parentNode; !domUtils.isBody(g); )
  7519. domUtils.breakParent(f, g),
  7520. (l = f.nextSibling),
  7521. l && domUtils.isEmptyBlock(l) && domUtils.remove(l),
  7522. (g = f.parentNode)
  7523. l = f.nextSibling
  7524. var m = f.previousSibling
  7525. if ((b(m) ? domUtils.remove(m) : m && a(m), l))
  7526. b(l) ? domUtils.remove(l) : a(l), e.setEndAfter(f).collapse(!1)
  7527. else {
  7528. var n = c.document.createElement('p')
  7529. f.parentNode.appendChild(n),
  7530. domUtils.fillNode(c.document, n),
  7531. e.setStart(n, 0).collapse(!0)
  7532. }
  7533. e.select(!0)
  7534. }
  7535. }
  7536. })
  7537. }),
  7538. UE.plugin.register('wordimage', function () {
  7539. var a = this,
  7540. b = []
  7541. return {
  7542. commands: {
  7543. wordimage: {
  7544. execCommand: function () {
  7545. for (
  7546. var b,
  7547. c = domUtils.getElementsByTagName(a.body, 'img'),
  7548. d = [],
  7549. e = 0;
  7550. (b = c[e++]);
  7551. ) {
  7552. var f = b.getAttribute('word_img')
  7553. f && d.push(f)
  7554. }
  7555. return d
  7556. },
  7557. queryCommandState: function () {
  7558. b = domUtils.getElementsByTagName(a.body, 'img')
  7559. for (var c, d = 0; (c = b[d++]); )
  7560. if (c.getAttribute('word_img')) return 1
  7561. return -1
  7562. },
  7563. notNeedUndo: !0
  7564. }
  7565. },
  7566. inputRule: function (b) {
  7567. utils.each(b.getNodesByTagName('img'), function (b) {
  7568. var c = b.attrs,
  7569. d = parseInt(c.width) < 128 || parseInt(c.height) < 43,
  7570. e = a.options,
  7571. f = e.UEDITOR_HOME_URL + 'themes/default/images/spacer.gif'
  7572. c.src &&
  7573. /^(?:(file:\/+))/.test(c.src) &&
  7574. b.setAttr({
  7575. width: c.width,
  7576. height: c.height,
  7577. alt: c.alt,
  7578. word_img: c.src,
  7579. src: f,
  7580. style:
  7581. 'background:url(' +
  7582. (d
  7583. ? e.themePath + e.theme + '/images/word.gif'
  7584. : e.langPath + e.lang + '/images/localimage.png') +
  7585. ') no-repeat center center;border:1px solid #ddd'
  7586. })
  7587. })
  7588. }
  7589. }
  7590. }),
  7591. (UE.plugins.dragdrop = function () {
  7592. var a = this
  7593. a.ready(function () {
  7594. domUtils.on(this.body, 'dragend', function () {
  7595. var b = a.selection.getRange(),
  7596. c = b.getClosedNode() || a.selection.getStart()
  7597. if (c && 'IMG' == c.tagName) {
  7598. for (
  7599. var d, e = c.previousSibling;
  7600. (d = c.nextSibling) &&
  7601. 1 == d.nodeType &&
  7602. 'SPAN' == d.tagName &&
  7603. !d.firstChild;
  7604. )
  7605. domUtils.remove(d)
  7606. ;((!e || 1 != e.nodeType || domUtils.isEmptyBlock(e)) && e) ||
  7607. (d && (!d || domUtils.isEmptyBlock(d))) ||
  7608. (e && 'P' == e.tagName && !domUtils.isEmptyBlock(e)
  7609. ? (e.appendChild(c),
  7610. domUtils.moveChild(d, e),
  7611. domUtils.remove(d))
  7612. : d &&
  7613. 'P' == d.tagName &&
  7614. !domUtils.isEmptyBlock(d) &&
  7615. d.insertBefore(c, d.firstChild),
  7616. e &&
  7617. 'P' == e.tagName &&
  7618. domUtils.isEmptyBlock(e) &&
  7619. domUtils.remove(e),
  7620. d &&
  7621. 'P' == d.tagName &&
  7622. domUtils.isEmptyBlock(d) &&
  7623. domUtils.remove(d),
  7624. b.selectNode(c).select(),
  7625. a.fireEvent('saveScene'))
  7626. }
  7627. })
  7628. }),
  7629. a.addListener('keyup', function (b, c) {
  7630. var d = c.keyCode || c.which
  7631. if (13 == d) {
  7632. var e,
  7633. f = a.selection.getRange()
  7634. ;(e = domUtils.findParentByTagName(f.startContainer, 'p', !0)) &&
  7635. 'center' == domUtils.getComputedStyle(e, 'text-align') &&
  7636. domUtils.removeStyle(e, 'text-align')
  7637. }
  7638. })
  7639. }),
  7640. (UE.plugins.undo = function () {
  7641. function a(a, b) {
  7642. if (a.length != b.length) return 0
  7643. for (var c = 0, d = a.length; c < d; c++) if (a[c] != b[c]) return 0
  7644. return 1
  7645. }
  7646. function b(b, c) {
  7647. return b.collapsed != c.collapsed
  7648. ? 0
  7649. : a(b.startAddress, c.startAddress) && a(b.endAddress, c.endAddress)
  7650. ? 1
  7651. : 0
  7652. }
  7653. function c() {
  7654. ;(this.list = []),
  7655. (this.index = 0),
  7656. (this.hasUndo = !1),
  7657. (this.hasRedo = !1),
  7658. (this.undo = function () {
  7659. if (this.hasUndo) {
  7660. if (!this.list[this.index - 1] && 1 == this.list.length)
  7661. return void this.reset()
  7662. for (
  7663. ;
  7664. this.list[this.index].content ==
  7665. this.list[this.index - 1].content;
  7666. )
  7667. if ((this.index--, 0 == this.index)) return this.restore(0)
  7668. this.restore(--this.index)
  7669. }
  7670. }),
  7671. (this.redo = function () {
  7672. if (this.hasRedo) {
  7673. for (
  7674. ;
  7675. this.list[this.index].content ==
  7676. this.list[this.index + 1].content;
  7677. )
  7678. if ((this.index++, this.index == this.list.length - 1))
  7679. return this.restore(this.index)
  7680. this.restore(++this.index)
  7681. }
  7682. }),
  7683. (this.restore = function () {
  7684. var a = this.editor,
  7685. b = this.list[this.index],
  7686. c = UE.htmlparser(b.content.replace(h, ''))
  7687. ;(a.options.autoClearEmptyNode = !1),
  7688. a.filterInputRule(c),
  7689. (a.options.autoClearEmptyNode = j),
  7690. (a.document.body.innerHTML = c.toHtml()),
  7691. a.fireEvent('afterscencerestore'),
  7692. browser.ie &&
  7693. utils.each(
  7694. domUtils.getElementsByTagName(a.document, 'td th caption p'),
  7695. function (b) {
  7696. domUtils.isEmptyNode(b) && domUtils.fillNode(a.document, b)
  7697. }
  7698. )
  7699. try {
  7700. var d = new dom.Range(a.document).moveToAddress(b.address)
  7701. d.select(i[d.startContainer.nodeName.toLowerCase()])
  7702. } catch (e) {}
  7703. this.update(), this.clearKey(), a.fireEvent('reset', !0)
  7704. }),
  7705. (this.getScene = function () {
  7706. var a = this.editor,
  7707. b = a.selection.getRange(),
  7708. c = b.createAddress(!1, !0)
  7709. a.fireEvent('beforegetscene')
  7710. var d = UE.htmlparser(a.body.innerHTML)
  7711. ;(a.options.autoClearEmptyNode = !1),
  7712. a.filterOutputRule(d),
  7713. (a.options.autoClearEmptyNode = j)
  7714. var e = d.toHtml()
  7715. return a.fireEvent('aftergetscene'), { address: c, content: e }
  7716. }),
  7717. (this.save = function (a, c) {
  7718. clearTimeout(d)
  7719. var g = this.getScene(c),
  7720. h = this.list[this.index]
  7721. h && h.content != g.content && e.trigger('contentchange'),
  7722. (h &&
  7723. h.content == g.content &&
  7724. (a ? 1 : b(h.address, g.address))) ||
  7725. ((this.list = this.list.slice(0, this.index + 1)),
  7726. this.list.push(g),
  7727. this.list.length > f && this.list.shift(),
  7728. (this.index = this.list.length - 1),
  7729. this.clearKey(),
  7730. this.update())
  7731. }),
  7732. (this.update = function () {
  7733. ;(this.hasRedo = !!this.list[this.index + 1]),
  7734. (this.hasUndo = !!this.list[this.index - 1])
  7735. }),
  7736. (this.reset = function () {
  7737. ;(this.list = []),
  7738. (this.index = 0),
  7739. (this.hasUndo = !1),
  7740. (this.hasRedo = !1),
  7741. this.clearKey()
  7742. }),
  7743. (this.clearKey = function () {
  7744. ;(m = 0), (k = null)
  7745. })
  7746. }
  7747. var d,
  7748. e = this,
  7749. f = e.options.maxUndoCount || 20,
  7750. g = e.options.maxInputCount || 20,
  7751. h = new RegExp(domUtils.fillChar + '|</hr>', 'gi'),
  7752. i = { ol: 1, ul: 1, table: 1, tbody: 1, tr: 1, body: 1 },
  7753. j = e.options.autoClearEmptyNode
  7754. ;(e.undoManger = new c()),
  7755. (e.undoManger.editor = e),
  7756. e.addListener('saveScene', function () {
  7757. var a = Array.prototype.splice.call(arguments, 1)
  7758. this.undoManger.save.apply(this.undoManger, a)
  7759. }),
  7760. e.addListener('reset', function (a, b) {
  7761. b || this.undoManger.reset()
  7762. }),
  7763. (e.commands.redo = e.commands.undo =
  7764. {
  7765. execCommand: function (a) {
  7766. this.undoManger[a]()
  7767. },
  7768. queryCommandState: function (a) {
  7769. return this.undoManger[
  7770. 'has' + ('undo' == a.toLowerCase() ? 'Undo' : 'Redo')
  7771. ]
  7772. ? 0
  7773. : -1
  7774. },
  7775. notNeedUndo: 1
  7776. })
  7777. var k,
  7778. l = { 16: 1, 17: 1, 18: 1, 37: 1, 38: 1, 39: 1, 40: 1 },
  7779. m = 0,
  7780. n = !1
  7781. e.addListener('ready', function () {
  7782. domUtils.on(this.body, 'compositionstart', function () {
  7783. n = !0
  7784. }),
  7785. domUtils.on(this.body, 'compositionend', function () {
  7786. n = !1
  7787. })
  7788. }),
  7789. e.addshortcutkey({ Undo: 'ctrl+90', Redo: 'ctrl+89' })
  7790. var o = !0
  7791. e.addListener('keydown', function (a, b) {
  7792. function c(a) {
  7793. a.undoManger.save(!1, !0), a.fireEvent('selectionchange')
  7794. }
  7795. var e = this,
  7796. f = b.keyCode || b.which
  7797. if (!(l[f] || b.ctrlKey || b.metaKey || b.shiftKey || b.altKey)) {
  7798. if (n) return
  7799. if (!e.selection.getRange().collapsed)
  7800. return e.undoManger.save(!1, !0), void (o = !1)
  7801. 0 == e.undoManger.list.length && e.undoManger.save(!0),
  7802. clearTimeout(d),
  7803. (d = setTimeout(function () {
  7804. if (n)
  7805. var a = setInterval(function () {
  7806. n || (c(e), clearInterval(a))
  7807. }, 300)
  7808. else c(e)
  7809. }, 200)),
  7810. (k = f),
  7811. m++,
  7812. m >= g && c(e)
  7813. }
  7814. }),
  7815. e.addListener('keyup', function (a, b) {
  7816. var c = b.keyCode || b.which
  7817. if (!(l[c] || b.ctrlKey || b.metaKey || b.shiftKey || b.altKey)) {
  7818. if (n) return
  7819. o || (this.undoManger.save(!1, !0), (o = !0))
  7820. }
  7821. }),
  7822. (e.stopCmdUndo = function () {
  7823. e.__hasEnterExecCommand = !0
  7824. }),
  7825. (e.startCmdUndo = function () {
  7826. e.__hasEnterExecCommand = !1
  7827. })
  7828. }),
  7829. UE.plugin.register('copy', function () {
  7830. function a() {
  7831. ZeroClipboard.config({
  7832. debug: !1,
  7833. swfPath:
  7834. b.options.UEDITOR_HOME_URL +
  7835. 'third-party/zeroclipboard/ZeroClipboard.swf'
  7836. })
  7837. var a = (b.zeroclipboard = new ZeroClipboard())
  7838. a.on('copy', function (a) {
  7839. var c = a.client,
  7840. d = b.selection.getRange(),
  7841. e = document.createElement('div')
  7842. e.appendChild(d.cloneContents()),
  7843. c.setText(e.innerText || e.textContent),
  7844. c.setHtml(e.innerHTML),
  7845. d.select()
  7846. }),
  7847. a.on('mouseover mouseout', function (a) {
  7848. var b = a.target
  7849. 'mouseover' == a.type
  7850. ? domUtils.addClass(b, 'edui-state-hover')
  7851. : 'mouseout' == a.type &&
  7852. domUtils.removeClasses(b, 'edui-state-hover')
  7853. }),
  7854. a.on('wrongflash noflash', function () {
  7855. ZeroClipboard.destroy()
  7856. })
  7857. }
  7858. var b = this
  7859. return {
  7860. bindEvents: {
  7861. ready: function () {
  7862. browser.ie ||
  7863. (window.ZeroClipboard
  7864. ? a()
  7865. : utils.loadFile(
  7866. document,
  7867. {
  7868. src:
  7869. b.options.UEDITOR_HOME_URL +
  7870. 'third-party/zeroclipboard/ZeroClipboard.js',
  7871. tag: 'script',
  7872. type: 'text/javascript',
  7873. defer: 'defer'
  7874. },
  7875. function () {
  7876. a()
  7877. }
  7878. ))
  7879. }
  7880. },
  7881. commands: {
  7882. copy: {
  7883. execCommand: function (a) {
  7884. b.document.execCommand('copy') || alert(b.getLang('copymsg'))
  7885. }
  7886. }
  7887. }
  7888. }
  7889. }),
  7890. (UE.plugins.paste = function () {
  7891. function a(a) {
  7892. var b = this.document
  7893. if (!b.getElementById('baidu_pastebin')) {
  7894. var c = this.selection.getRange(),
  7895. d = c.createBookmark(),
  7896. e = b.createElement('div')
  7897. ;(e.id = 'baidu_pastebin'),
  7898. browser.webkit &&
  7899. e.appendChild(
  7900. b.createTextNode(domUtils.fillChar + domUtils.fillChar)
  7901. ),
  7902. b.body.appendChild(e),
  7903. (d.start.style.display = ''),
  7904. (e.style.cssText =
  7905. 'position:absolute;width:1px;height:1px;overflow:hidden;left:-1000px;white-space:nowrap;top:' +
  7906. domUtils.getXY(d.start).y +
  7907. 'px'),
  7908. c.selectNodeContents(e).select(!0),
  7909. setTimeout(function () {
  7910. if (browser.webkit)
  7911. for (
  7912. var f, g = 0, h = b.querySelectorAll('#baidu_pastebin');
  7913. (f = h[g++]);
  7914. ) {
  7915. if (!domUtils.isEmptyNode(f)) {
  7916. e = f
  7917. break
  7918. }
  7919. domUtils.remove(f)
  7920. }
  7921. try {
  7922. e.parentNode.removeChild(e)
  7923. } catch (i) {}
  7924. c.moveToBookmark(d).select(!0), a(e)
  7925. }, 0)
  7926. }
  7927. }
  7928. function b(a) {
  7929. return a.replace(/<(\/?)([\w\-]+)([^>]*)>/gi, function (a, b, c, d) {
  7930. return (
  7931. (c = c.toLowerCase()),
  7932. { img: 1 }[c]
  7933. ? a
  7934. : ((d = d.replace(
  7935. /([\w\-]*?)\s*=\s*(("([^"]*)")|('([^']*)')|([^\s>]+))/gi,
  7936. function (a, b, c) {
  7937. return { src: 1, href: 1, name: 1 }[b.toLowerCase()]
  7938. ? b + '=' + c + ' '
  7939. : ''
  7940. }
  7941. )),
  7942. { span: 1, div: 1 }[c]
  7943. ? ''
  7944. : '<' + b + c + ' ' + utils.trim(d) + '>')
  7945. )
  7946. })
  7947. }
  7948. function c(a) {
  7949. var c
  7950. if (a.firstChild) {
  7951. for (
  7952. var h, i = domUtils.getElementsByTagName(a, 'span'), j = 0;
  7953. (h = i[j++]);
  7954. )
  7955. ('_baidu_cut_start' != h.id && '_baidu_cut_end' != h.id) ||
  7956. domUtils.remove(h)
  7957. if (browser.webkit) {
  7958. for (
  7959. var k, l = a.querySelectorAll('div br'), j = 0;
  7960. (k = l[j++]);
  7961. ) {
  7962. var m = k.parentNode
  7963. 'DIV' == m.tagName &&
  7964. 1 == m.childNodes.length &&
  7965. ((m.innerHTML = '<p><br/></p>'), domUtils.remove(m))
  7966. }
  7967. for (
  7968. var n, o = a.querySelectorAll('#baidu_pastebin'), j = 0;
  7969. (n = o[j++]);
  7970. ) {
  7971. var p = d.document.createElement('p')
  7972. for (n.parentNode.insertBefore(p, n); n.firstChild; )
  7973. p.appendChild(n.firstChild)
  7974. domUtils.remove(n)
  7975. }
  7976. for (var q, r = a.querySelectorAll('meta'), j = 0; (q = r[j++]); )
  7977. domUtils.remove(q)
  7978. var l = a.querySelectorAll('br')
  7979. for (j = 0; (q = l[j++]); )
  7980. /^apple-/i.test(q.className) && domUtils.remove(q)
  7981. }
  7982. if (browser.gecko) {
  7983. var s = a.querySelectorAll('[_moz_dirty]')
  7984. for (j = 0; (q = s[j++]); ) q.removeAttribute('_moz_dirty')
  7985. }
  7986. if (!browser.ie)
  7987. for (
  7988. var q, t = a.querySelectorAll('span.Apple-style-span'), j = 0;
  7989. (q = t[j++]);
  7990. )
  7991. domUtils.remove(q, !0)
  7992. ;(c = a.innerHTML), (c = UE.filterWord(c))
  7993. var u = UE.htmlparser(c)
  7994. if (
  7995. (d.options.filterRules && UE.filterNode(u, d.options.filterRules),
  7996. d.filterInputRule(u),
  7997. browser.webkit)
  7998. ) {
  7999. var v = u.lastChild()
  8000. v && 'element' == v.type && 'br' == v.tagName && u.removeChild(v),
  8001. utils.each(d.body.querySelectorAll('div'), function (a) {
  8002. domUtils.isEmptyBlock(a) && domUtils.remove(a, !0)
  8003. })
  8004. }
  8005. if (
  8006. ((c = { html: u.toHtml() }),
  8007. d.fireEvent('beforepaste', c, u),
  8008. !c.html)
  8009. )
  8010. return
  8011. ;(u = UE.htmlparser(c.html, !0)),
  8012. 1 === d.queryCommandState('pasteplain')
  8013. ? d.execCommand(
  8014. 'insertHtml',
  8015. UE.filterNode(u, d.options.filterTxtRules).toHtml(),
  8016. !0
  8017. )
  8018. : (UE.filterNode(u, d.options.filterTxtRules),
  8019. (e = u.toHtml()),
  8020. (f = c.html),
  8021. (g = d.selection.getRange().createAddress(!0)),
  8022. d.execCommand(
  8023. 'insertHtml',
  8024. d.getOpt('retainOnlyLabelPasted') === !0 ? b(f) : f,
  8025. !0
  8026. )),
  8027. d.fireEvent('afterpaste', c)
  8028. }
  8029. }
  8030. var d = this
  8031. d.setOpt({ retainOnlyLabelPasted: !1 })
  8032. var e, f, g
  8033. d.addListener('pasteTransfer', function (a, c) {
  8034. if (g && e && f && e != f) {
  8035. var h = d.selection.getRange()
  8036. if ((h.moveToAddress(g, !0), !h.collapsed)) {
  8037. for (; !domUtils.isBody(h.startContainer); ) {
  8038. var i = h.startContainer
  8039. if (1 == i.nodeType) {
  8040. if (((i = i.childNodes[h.startOffset]), !i)) {
  8041. h.setStartBefore(h.startContainer)
  8042. continue
  8043. }
  8044. var j = i.previousSibling
  8045. j &&
  8046. 3 == j.nodeType &&
  8047. new RegExp('^[\n\r\t ' + domUtils.fillChar + ']*$').test(
  8048. j.nodeValue
  8049. ) &&
  8050. h.setStartBefore(j)
  8051. }
  8052. if (0 != h.startOffset) break
  8053. h.setStartBefore(h.startContainer)
  8054. }
  8055. for (; !domUtils.isBody(h.endContainer); ) {
  8056. var k = h.endContainer
  8057. if (1 == k.nodeType) {
  8058. if (((k = k.childNodes[h.endOffset]), !k)) {
  8059. h.setEndAfter(h.endContainer)
  8060. continue
  8061. }
  8062. var l = k.nextSibling
  8063. l &&
  8064. 3 == l.nodeType &&
  8065. new RegExp('^[\n\r\t' + domUtils.fillChar + ']*$').test(
  8066. l.nodeValue
  8067. ) &&
  8068. h.setEndAfter(l)
  8069. }
  8070. if (
  8071. h.endOffset !=
  8072. h.endContainer[
  8073. 3 == h.endContainer.nodeType ? 'nodeValue' : 'childNodes'
  8074. ].length
  8075. )
  8076. break
  8077. h.setEndAfter(h.endContainer)
  8078. }
  8079. }
  8080. h.deleteContents(), h.select(!0), (d.__hasEnterExecCommand = !0)
  8081. var m = f
  8082. 2 === c ? (m = b(m)) : c && (m = e),
  8083. d.execCommand('inserthtml', m, !0),
  8084. (d.__hasEnterExecCommand = !1)
  8085. for (
  8086. var n = d.selection.getRange();
  8087. !domUtils.isBody(n.startContainer) &&
  8088. !n.startOffset &&
  8089. n.startContainer[
  8090. 3 == n.startContainer.nodeType ? 'nodeValue' : 'childNodes'
  8091. ].length;
  8092. )
  8093. n.setStartBefore(n.startContainer)
  8094. var o = n.createAddress(!0)
  8095. g.endAddress = o.startAddress
  8096. }
  8097. }),
  8098. d.addListener('ready', function () {
  8099. domUtils.on(d.body, 'cut', function () {
  8100. var a = d.selection.getRange()
  8101. !a.collapsed && d.undoManger && d.undoManger.save()
  8102. }),
  8103. domUtils.on(
  8104. d.body,
  8105. browser.ie || browser.opera ? 'keydown' : 'paste',
  8106. function (b) {
  8107. ;((!browser.ie && !browser.opera) ||
  8108. ((b.ctrlKey || b.metaKey) && '86' == b.keyCode)) &&
  8109. a.call(d, function (a) {
  8110. c(a)
  8111. })
  8112. }
  8113. )
  8114. }),
  8115. (d.commands.paste = {
  8116. execCommand: function (b) {
  8117. browser.ie
  8118. ? (a.call(d, function (a) {
  8119. c(a)
  8120. }),
  8121. d.document.execCommand('paste'))
  8122. : alert(d.getLang('pastemsg'))
  8123. }
  8124. })
  8125. }),
  8126. (UE.plugins.pasteplain = function () {
  8127. var a = this
  8128. a.setOpt({
  8129. pasteplain: !1,
  8130. filterTxtRules: (function () {
  8131. function a(a) {
  8132. ;(a.tagName = 'p'), a.setStyle()
  8133. }
  8134. function b(a) {
  8135. a.parentNode.removeChild(a, !0)
  8136. }
  8137. return {
  8138. '-': 'script style object iframe embed input select',
  8139. p: { $: {} },
  8140. br: { $: {} },
  8141. div: function (a) {
  8142. for (
  8143. var b, c = UE.uNode.createElement('p');
  8144. (b = a.firstChild());
  8145. )
  8146. 'text' != b.type && UE.dom.dtd.$block[b.tagName]
  8147. ? c.firstChild()
  8148. ? (a.parentNode.insertBefore(c, a),
  8149. (c = UE.uNode.createElement('p')))
  8150. : a.parentNode.insertBefore(b, a)
  8151. : c.appendChild(b)
  8152. c.firstChild() && a.parentNode.insertBefore(c, a),
  8153. a.parentNode.removeChild(a)
  8154. },
  8155. ol: b,
  8156. ul: b,
  8157. dl: b,
  8158. dt: b,
  8159. dd: b,
  8160. li: b,
  8161. caption: a,
  8162. th: a,
  8163. tr: a,
  8164. h1: a,
  8165. h2: a,
  8166. h3: a,
  8167. h4: a,
  8168. h5: a,
  8169. h6: a,
  8170. td: function (a) {
  8171. var b = !!a.innerText()
  8172. b &&
  8173. a.parentNode.insertAfter(
  8174. UE.uNode.createText(' &nbsp; &nbsp;'),
  8175. a
  8176. ),
  8177. a.parentNode.removeChild(a, a.innerText())
  8178. }
  8179. }
  8180. })()
  8181. })
  8182. var b = a.options.pasteplain
  8183. a.commands.pasteplain = {
  8184. queryCommandState: function () {
  8185. return b ? 1 : 0
  8186. },
  8187. execCommand: function () {
  8188. b = 0 | !b
  8189. },
  8190. notNeedUndo: 1
  8191. }
  8192. }),
  8193. (UE.plugins.list = function () {
  8194. function a(a) {
  8195. var b = []
  8196. for (var c in a) b.push(c)
  8197. return b
  8198. }
  8199. function b(a) {
  8200. var b = a.className
  8201. return domUtils.hasClass(a, /custom_/)
  8202. ? b.match(/custom_(\w+)/)[1]
  8203. : domUtils.getStyle(a, 'list-style-type')
  8204. }
  8205. function c(a, c) {
  8206. utils.each(domUtils.getElementsByTagName(a, 'ol ul'), function (f) {
  8207. if (domUtils.inDoc(f, a)) {
  8208. var g = f.parentNode
  8209. if (g.tagName == f.tagName) {
  8210. var h = b(f) || ('OL' == f.tagName ? 'decimal' : 'disc'),
  8211. i = b(g) || ('OL' == g.tagName ? 'decimal' : 'disc')
  8212. if (h == i) {
  8213. var l = utils.indexOf(k[f.tagName], h)
  8214. ;(l = l + 1 == k[f.tagName].length ? 0 : l + 1),
  8215. e(f, k[f.tagName][l])
  8216. }
  8217. }
  8218. var m = 0,
  8219. n = 2
  8220. domUtils.hasClass(f, /custom_/)
  8221. ? (/[ou]l/i.test(g.tagName) && domUtils.hasClass(g, /custom_/)) ||
  8222. (n = 1)
  8223. : /[ou]l/i.test(g.tagName) &&
  8224. domUtils.hasClass(g, /custom_/) &&
  8225. (n = 3)
  8226. var o = domUtils.getStyle(f, 'list-style-type')
  8227. o && (f.style.cssText = 'list-style-type:' + o),
  8228. (f.className =
  8229. utils.trim(f.className.replace(/list-paddingleft-\w+/, '')) +
  8230. ' list-paddingleft-' +
  8231. n),
  8232. utils.each(domUtils.getElementsByTagName(f, 'li'), function (a) {
  8233. if ((a.style.cssText && (a.style.cssText = ''), !a.firstChild))
  8234. return void domUtils.remove(a)
  8235. if (a.parentNode === f) {
  8236. if ((m++, domUtils.hasClass(f, /custom_/))) {
  8237. var c = 1,
  8238. d = b(f)
  8239. if ('OL' == f.tagName) {
  8240. if (d)
  8241. switch (d) {
  8242. case 'cn':
  8243. case 'cn1':
  8244. case 'cn2':
  8245. m > 10 && (m % 10 == 0 || (m > 10 && m < 20))
  8246. ? (c = 2)
  8247. : m > 20 && (c = 3)
  8248. break
  8249. case 'num2':
  8250. m > 9 && (c = 2)
  8251. }
  8252. a.className =
  8253. 'list-' + j[d] + m + ' list-' + d + '-paddingleft-' + c
  8254. } else
  8255. a.className =
  8256. 'list-' + j[d] + ' list-' + d + '-paddingleft'
  8257. } else a.className = a.className.replace(/list-[\w\-]+/gi, '')
  8258. var e = a.getAttribute('class')
  8259. null === e ||
  8260. e.replace(/\s/g, '') ||
  8261. domUtils.removeAttributes(a, 'class')
  8262. }
  8263. }),
  8264. !c &&
  8265. d(
  8266. f,
  8267. f.tagName.toLowerCase(),
  8268. b(f) || domUtils.getStyle(f, 'list-style-type'),
  8269. !0
  8270. )
  8271. }
  8272. })
  8273. }
  8274. function d(a, d, e, f) {
  8275. var g = a.nextSibling
  8276. g &&
  8277. 1 == g.nodeType &&
  8278. g.tagName.toLowerCase() == d &&
  8279. (b(g) ||
  8280. domUtils.getStyle(g, 'list-style-type') ||
  8281. ('ol' == d ? 'decimal' : 'disc')) == e &&
  8282. (domUtils.moveChild(g, a),
  8283. 0 == g.childNodes.length && domUtils.remove(g)),
  8284. g && domUtils.isFillChar(g) && domUtils.remove(g)
  8285. var h = a.previousSibling
  8286. h &&
  8287. 1 == h.nodeType &&
  8288. h.tagName.toLowerCase() == d &&
  8289. (b(h) ||
  8290. domUtils.getStyle(h, 'list-style-type') ||
  8291. ('ol' == d ? 'decimal' : 'disc')) == e &&
  8292. domUtils.moveChild(a, h),
  8293. h && domUtils.isFillChar(h) && domUtils.remove(h),
  8294. !f && domUtils.isEmptyBlock(a) && domUtils.remove(a),
  8295. b(a) && c(a.ownerDocument, !0)
  8296. }
  8297. function e(a, b) {
  8298. j[b] && (a.className = 'custom_' + b)
  8299. try {
  8300. domUtils.setStyle(a, 'list-style-type', b)
  8301. } catch (c) {}
  8302. }
  8303. function f(a) {
  8304. var b = a.previousSibling
  8305. b && domUtils.isEmptyBlock(b) && domUtils.remove(b),
  8306. (b = a.nextSibling),
  8307. b && domUtils.isEmptyBlock(b) && domUtils.remove(b)
  8308. }
  8309. function g(a) {
  8310. for (; a && !domUtils.isBody(a); ) {
  8311. if ('TABLE' == a.nodeName) return null
  8312. if ('LI' == a.nodeName) return a
  8313. a = a.parentNode
  8314. }
  8315. }
  8316. var h = this,
  8317. i = { TD: 1, PRE: 1, BLOCKQUOTE: 1 },
  8318. j = {
  8319. cn: 'cn-1-',
  8320. cn1: 'cn-2-',
  8321. cn2: 'cn-3-',
  8322. num: 'num-1-',
  8323. num1: 'num-2-',
  8324. num2: 'num-3-',
  8325. dash: 'dash',
  8326. dot: 'dot'
  8327. }
  8328. h.setOpt({
  8329. autoTransWordToList: !1,
  8330. insertorderedlist: {
  8331. num: '',
  8332. num1: '',
  8333. num2: '',
  8334. cn: '',
  8335. cn1: '',
  8336. cn2: '',
  8337. decimal: '',
  8338. 'lower-alpha': '',
  8339. 'lower-roman': '',
  8340. 'upper-alpha': '',
  8341. 'upper-roman': ''
  8342. },
  8343. insertunorderedlist: {
  8344. circle: '',
  8345. disc: '',
  8346. square: '',
  8347. dash: '',
  8348. dot: ''
  8349. },
  8350. listDefaultPaddingLeft: '30',
  8351. listiconpath: 'http://bs.baidu.com/listicon/',
  8352. maxListLevel: -1,
  8353. disablePInList: !1
  8354. })
  8355. var k = {
  8356. OL: a(h.options.insertorderedlist),
  8357. UL: a(h.options.insertunorderedlist)
  8358. },
  8359. l = h.options.listiconpath
  8360. for (var m in j)
  8361. h.options.insertorderedlist.hasOwnProperty(m) ||
  8362. h.options.insertunorderedlist.hasOwnProperty(m) ||
  8363. delete j[m]
  8364. h.ready(function () {
  8365. var a = []
  8366. for (var b in j) {
  8367. if ('dash' == b || 'dot' == b)
  8368. a.push(
  8369. 'li.list-' + j[b] + '{background-image:url(' + l + j[b] + '.gif)}'
  8370. ),
  8371. a.push(
  8372. 'ul.custom_' +
  8373. b +
  8374. '{list-style:none;}ul.custom_' +
  8375. b +
  8376. ' li{background-position:0 3px;background-repeat:no-repeat}'
  8377. )
  8378. else {
  8379. for (var c = 0; c < 99; c++)
  8380. a.push(
  8381. 'li.list-' +
  8382. j[b] +
  8383. c +
  8384. '{background-image:url(' +
  8385. l +
  8386. 'list-' +
  8387. j[b] +
  8388. c +
  8389. '.gif)}'
  8390. )
  8391. a.push(
  8392. 'ol.custom_' +
  8393. b +
  8394. '{list-style:none;}ol.custom_' +
  8395. b +
  8396. ' li{background-position:0 3px;background-repeat:no-repeat}'
  8397. )
  8398. }
  8399. switch (b) {
  8400. case 'cn':
  8401. a.push('li.list-' + b + '-paddingleft-1{padding-left:25px}'),
  8402. a.push('li.list-' + b + '-paddingleft-2{padding-left:40px}'),
  8403. a.push('li.list-' + b + '-paddingleft-3{padding-left:55px}')
  8404. break
  8405. case 'cn1':
  8406. a.push('li.list-' + b + '-paddingleft-1{padding-left:30px}'),
  8407. a.push('li.list-' + b + '-paddingleft-2{padding-left:40px}'),
  8408. a.push('li.list-' + b + '-paddingleft-3{padding-left:55px}')
  8409. break
  8410. case 'cn2':
  8411. a.push('li.list-' + b + '-paddingleft-1{padding-left:40px}'),
  8412. a.push('li.list-' + b + '-paddingleft-2{padding-left:55px}'),
  8413. a.push('li.list-' + b + '-paddingleft-3{padding-left:68px}')
  8414. break
  8415. case 'num':
  8416. case 'num1':
  8417. a.push('li.list-' + b + '-paddingleft-1{padding-left:25px}')
  8418. break
  8419. case 'num2':
  8420. a.push('li.list-' + b + '-paddingleft-1{padding-left:35px}'),
  8421. a.push('li.list-' + b + '-paddingleft-2{padding-left:40px}')
  8422. break
  8423. case 'dash':
  8424. a.push('li.list-' + b + '-paddingleft{padding-left:35px}')
  8425. break
  8426. case 'dot':
  8427. a.push('li.list-' + b + '-paddingleft{padding-left:20px}')
  8428. }
  8429. }
  8430. a.push('.list-paddingleft-1{padding-left:0}'),
  8431. a.push(
  8432. '.list-paddingleft-2{padding-left:' +
  8433. h.options.listDefaultPaddingLeft +
  8434. 'px}'
  8435. ),
  8436. a.push(
  8437. '.list-paddingleft-3{padding-left:' +
  8438. 2 * h.options.listDefaultPaddingLeft +
  8439. 'px}'
  8440. ),
  8441. utils.cssRule(
  8442. 'list',
  8443. 'ol,ul{margin:0;pading:0;' +
  8444. (browser.ie ? '' : 'width:95%') +
  8445. '}li{clear:both;}' +
  8446. a.join('\n'),
  8447. h.document
  8448. )
  8449. }),
  8450. h.ready(function () {
  8451. domUtils.on(h.body, 'cut', function () {
  8452. setTimeout(function () {
  8453. var a,
  8454. b = h.selection.getRange()
  8455. if (
  8456. !b.collapsed &&
  8457. (a = domUtils.findParentByTagName(
  8458. b.startContainer,
  8459. 'li',
  8460. !0
  8461. )) &&
  8462. !a.nextSibling &&
  8463. domUtils.isEmptyBlock(a)
  8464. ) {
  8465. var c,
  8466. d = a.parentNode
  8467. if ((c = d.previousSibling))
  8468. domUtils.remove(d),
  8469. b.setStartAtLast(c).collapse(!0),
  8470. b.select(!0)
  8471. else if ((c = d.nextSibling))
  8472. domUtils.remove(d),
  8473. b.setStartAtFirst(c).collapse(!0),
  8474. b.select(!0)
  8475. else {
  8476. var e = h.document.createElement('p')
  8477. domUtils.fillNode(h.document, e),
  8478. d.parentNode.insertBefore(e, d),
  8479. domUtils.remove(d),
  8480. b.setStart(e, 0).collapse(!0),
  8481. b.select(!0)
  8482. }
  8483. }
  8484. })
  8485. })
  8486. }),
  8487. h.addListener('beforepaste', function (a, c) {
  8488. var d,
  8489. e = this,
  8490. f = e.selection.getRange(),
  8491. g = UE.htmlparser(c.html, !0)
  8492. if ((d = domUtils.findParentByTagName(f.startContainer, 'li', !0))) {
  8493. var h = d.parentNode,
  8494. i = 'OL' == h.tagName ? 'ul' : 'ol'
  8495. utils.each(g.getNodesByTagName(i), function (c) {
  8496. if (((c.tagName = h.tagName), c.setAttr(), c.parentNode === g))
  8497. a = b(h) || ('OL' == h.tagName ? 'decimal' : 'disc')
  8498. else {
  8499. var d = c.parentNode.getAttr('class')
  8500. ;(a =
  8501. d && /custom_/.test(d)
  8502. ? d.match(/custom_(\w+)/)[1]
  8503. : c.parentNode.getStyle('list-style-type')),
  8504. a || (a = 'OL' == h.tagName ? 'decimal' : 'disc')
  8505. }
  8506. var e = utils.indexOf(k[h.tagName], a)
  8507. c.parentNode !== g &&
  8508. (e = e + 1 == k[h.tagName].length ? 0 : e + 1)
  8509. var f = k[h.tagName][e]
  8510. j[f]
  8511. ? c.setAttr('class', 'custom_' + f)
  8512. : c.setStyle('list-style-type', f)
  8513. })
  8514. }
  8515. c.html = g.toHtml()
  8516. }),
  8517. h.getOpt('disablePInList') === !0 &&
  8518. h.addOutputRule(function (a) {
  8519. utils.each(a.getNodesByTagName('li'), function (a) {
  8520. var b = [],
  8521. c = 0
  8522. utils.each(a.children, function (d) {
  8523. if ('p' == d.tagName) {
  8524. for (var e; (e = d.children.pop()); )
  8525. b.splice(c, 0, e), (e.parentNode = a), (lastNode = e)
  8526. if (
  8527. ((e = b[b.length - 1]),
  8528. !e || 'element' != e.type || 'br' != e.tagName)
  8529. ) {
  8530. var f = UE.uNode.createElement('br')
  8531. ;(f.parentNode = a), b.push(f)
  8532. }
  8533. c = b.length
  8534. }
  8535. }),
  8536. b.length && (a.children = b)
  8537. })
  8538. }),
  8539. h.addInputRule(function (a) {
  8540. function b(a, b) {
  8541. var e = b.firstChild()
  8542. if (
  8543. e &&
  8544. 'element' == e.type &&
  8545. 'span' == e.tagName &&
  8546. /Wingdings|Symbol/.test(e.getStyle('font-family'))
  8547. ) {
  8548. for (var f in d) if (d[f] == e.data) return f
  8549. return 'disc'
  8550. }
  8551. for (var f in c) if (c[f].test(a)) return f
  8552. }
  8553. if (
  8554. (utils.each(a.getNodesByTagName('li'), function (a) {
  8555. for (
  8556. var b, c = UE.uNode.createElement('p'), d = 0;
  8557. (b = a.children[d]);
  8558. )
  8559. 'text' == b.type || dtd.p[b.tagName]
  8560. ? c.appendChild(b)
  8561. : c.firstChild()
  8562. ? (a.insertBefore(c, b),
  8563. (c = UE.uNode.createElement('p')),
  8564. (d += 2))
  8565. : d++
  8566. ;((c.firstChild() && !c.parentNode) || !a.firstChild()) &&
  8567. a.appendChild(c),
  8568. c.firstChild() || c.innerHTML(browser.ie ? '&nbsp;' : '<br/>')
  8569. var e = a.firstChild(),
  8570. f = e.lastChild()
  8571. f && 'text' == f.type && /^\s*$/.test(f.data) && e.removeChild(f)
  8572. }),
  8573. h.options.autoTransWordToList)
  8574. ) {
  8575. var c = {
  8576. num1: /^\d+\)/,
  8577. decimal: /^\d+\./,
  8578. 'lower-alpha': /^[a-z]+\)/,
  8579. 'upper-alpha': /^[A-Z]+\./,
  8580. cn: /^[\u4E00\u4E8C\u4E09\u56DB\u516d\u4e94\u4e03\u516b\u4e5d]+[\u3001]/,
  8581. cn2: /^\([\u4E00\u4E8C\u4E09\u56DB\u516d\u4e94\u4e03\u516b\u4e5d]+\)/
  8582. },
  8583. d = { square: 'n' }
  8584. utils.each(a.getNodesByTagName('p'), function (a) {
  8585. function d(a, b, d) {
  8586. if ('ol' == a.tagName)
  8587. if (browser.ie) {
  8588. var e = b.firstChild()
  8589. 'element' == e.type &&
  8590. 'span' == e.tagName &&
  8591. c[d].test(e.innerText()) &&
  8592. b.removeChild(e)
  8593. } else b.innerHTML(b.innerHTML().replace(c[d], ''))
  8594. else b.removeChild(b.firstChild())
  8595. var f = UE.uNode.createElement('li')
  8596. f.appendChild(b), a.appendChild(f)
  8597. }
  8598. if ('MsoListParagraph' == a.getAttr('class')) {
  8599. a.setStyle('margin', ''),
  8600. a.setStyle('margin-left', ''),
  8601. a.setAttr('class', '')
  8602. var e,
  8603. f = a,
  8604. g = a
  8605. if ('li' != a.parentNode.tagName && (e = b(a.innerText(), a))) {
  8606. var i = UE.uNode.createElement(
  8607. h.options.insertorderedlist.hasOwnProperty(e) ? 'ol' : 'ul'
  8608. )
  8609. for (
  8610. j[e]
  8611. ? i.setAttr('class', 'custom_' + e)
  8612. : i.setStyle('list-style-type', e);
  8613. a && 'li' != a.parentNode.tagName && b(a.innerText(), a);
  8614. )
  8615. (f = a.nextSibling()),
  8616. f || a.parentNode.insertBefore(i, a),
  8617. d(i, a, e),
  8618. (a = f)
  8619. !i.parentNode &&
  8620. a &&
  8621. a.parentNode &&
  8622. a.parentNode.insertBefore(i, a)
  8623. }
  8624. var k = g.firstChild()
  8625. k &&
  8626. 'element' == k.type &&
  8627. 'span' == k.tagName &&
  8628. /^\s*(&nbsp;)+\s*$/.test(k.innerText()) &&
  8629. k.parentNode.removeChild(k)
  8630. }
  8631. })
  8632. }
  8633. }),
  8634. h.addListener('contentchange', function () {
  8635. c(h.document)
  8636. }),
  8637. h.addListener('keydown', function (a, b) {
  8638. function c() {
  8639. b.preventDefault ? b.preventDefault() : (b.returnValue = !1),
  8640. h.fireEvent('contentchange'),
  8641. h.undoManger && h.undoManger.save()
  8642. }
  8643. function d(a, b) {
  8644. for (; a && !domUtils.isBody(a); ) {
  8645. if (b(a)) return null
  8646. if (1 == a.nodeType && /[ou]l/i.test(a.tagName)) return a
  8647. a = a.parentNode
  8648. }
  8649. return null
  8650. }
  8651. var e = b.keyCode || b.which
  8652. if (13 == e && !b.shiftKey) {
  8653. var g = h.selection.getRange(),
  8654. i = domUtils.findParent(
  8655. g.startContainer,
  8656. function (a) {
  8657. return domUtils.isBlockElm(a)
  8658. },
  8659. !0
  8660. ),
  8661. j = domUtils.findParentByTagName(g.startContainer, 'li', !0)
  8662. if (i && 'PRE' != i.tagName && !j) {
  8663. var k = i.innerHTML.replace(
  8664. new RegExp(domUtils.fillChar, 'g'),
  8665. ''
  8666. )
  8667. ;/^\s*1\s*\.[^\d]/.test(k) &&
  8668. ((i.innerHTML = k.replace(/^\s*1\s*\./, '')),
  8669. g.setStartAtLast(i).collapse(!0).select(),
  8670. (h.__hasEnterExecCommand = !0),
  8671. h.execCommand('insertorderedlist'),
  8672. (h.__hasEnterExecCommand = !1))
  8673. }
  8674. var l = h.selection.getRange(),
  8675. m = d(l.startContainer, function (a) {
  8676. return 'TABLE' == a.tagName
  8677. }),
  8678. n = l.collapsed
  8679. ? m
  8680. : d(l.endContainer, function (a) {
  8681. return 'TABLE' == a.tagName
  8682. })
  8683. if (m && n && m === n) {
  8684. if (!l.collapsed) {
  8685. if (
  8686. ((m = domUtils.findParentByTagName(
  8687. l.startContainer,
  8688. 'li',
  8689. !0
  8690. )),
  8691. (n = domUtils.findParentByTagName(l.endContainer, 'li', !0)),
  8692. !m || !n || m !== n)
  8693. ) {
  8694. var o = l.cloneRange(),
  8695. p = o.collapse(!1).createBookmark()
  8696. l.deleteContents(), o.moveToBookmark(p)
  8697. var j = domUtils.findParentByTagName(
  8698. o.startContainer,
  8699. 'li',
  8700. !0
  8701. )
  8702. return f(j), o.select(), void c()
  8703. }
  8704. if (
  8705. (l.deleteContents(),
  8706. (j = domUtils.findParentByTagName(
  8707. l.startContainer,
  8708. 'li',
  8709. !0
  8710. )),
  8711. j && domUtils.isEmptyBlock(j))
  8712. )
  8713. return (
  8714. (v = j.previousSibling),
  8715. (next = j.nextSibling),
  8716. (s = h.document.createElement('p')),
  8717. domUtils.fillNode(h.document, s),
  8718. (q = j.parentNode),
  8719. v && next
  8720. ? (l.setStart(next, 0).collapse(!0).select(!0),
  8721. domUtils.remove(j))
  8722. : ((v || next) && v
  8723. ? j.parentNode.parentNode.insertBefore(
  8724. s,
  8725. q.nextSibling
  8726. )
  8727. : q.parentNode.insertBefore(s, q),
  8728. domUtils.remove(j),
  8729. q.firstChild || domUtils.remove(q),
  8730. l.setStart(s, 0).setCursor()),
  8731. void c()
  8732. )
  8733. }
  8734. if (
  8735. (j = domUtils.findParentByTagName(l.startContainer, 'li', !0))
  8736. ) {
  8737. if (domUtils.isEmptyBlock(j)) {
  8738. p = l.createBookmark()
  8739. var q = j.parentNode
  8740. if (
  8741. (j !== q.lastChild
  8742. ? (domUtils.breakParent(j, q), f(j))
  8743. : (q.parentNode.insertBefore(j, q.nextSibling),
  8744. domUtils.isEmptyNode(q) && domUtils.remove(q)),
  8745. !dtd.$list[j.parentNode.tagName])
  8746. )
  8747. if (domUtils.isBlockElm(j.firstChild))
  8748. domUtils.remove(j, !0)
  8749. else {
  8750. for (
  8751. s = h.document.createElement('p'),
  8752. j.parentNode.insertBefore(s, j);
  8753. j.firstChild;
  8754. )
  8755. s.appendChild(j.firstChild)
  8756. domUtils.remove(j)
  8757. }
  8758. l.moveToBookmark(p).select()
  8759. } else {
  8760. var r = j.firstChild
  8761. if (!r || !domUtils.isBlockElm(r)) {
  8762. var s = h.document.createElement('p')
  8763. for (
  8764. !j.firstChild && domUtils.fillNode(h.document, s);
  8765. j.firstChild;
  8766. )
  8767. s.appendChild(j.firstChild)
  8768. j.appendChild(s), (r = s)
  8769. }
  8770. var t = h.document.createElement('span')
  8771. l.insertNode(t), domUtils.breakParent(t, j)
  8772. var u = t.nextSibling
  8773. ;(r = u.firstChild),
  8774. r ||
  8775. ((s = h.document.createElement('p')),
  8776. domUtils.fillNode(h.document, s),
  8777. u.appendChild(s),
  8778. (r = s)),
  8779. domUtils.isEmptyNode(r) &&
  8780. ((r.innerHTML = ''), domUtils.fillNode(h.document, r)),
  8781. l.setStart(r, 0).collapse(!0).shrinkBoundary().select(),
  8782. domUtils.remove(t)
  8783. var v = u.previousSibling
  8784. v &&
  8785. domUtils.isEmptyBlock(v) &&
  8786. ((v.innerHTML = '<p></p>'),
  8787. domUtils.fillNode(h.document, v.firstChild))
  8788. }
  8789. c()
  8790. }
  8791. }
  8792. }
  8793. if (
  8794. 8 == e &&
  8795. ((l = h.selection.getRange()),
  8796. l.collapsed &&
  8797. domUtils.isStartInblock(l) &&
  8798. ((o = l.cloneRange().trimBoundary()),
  8799. (j = domUtils.findParentByTagName(l.startContainer, 'li', !0)),
  8800. j && domUtils.isStartInblock(o)))
  8801. ) {
  8802. if (
  8803. ((m = domUtils.findParentByTagName(l.startContainer, 'p', !0)),
  8804. m && m !== j.firstChild)
  8805. ) {
  8806. var q = domUtils.findParentByTagName(m, ['ol', 'ul'])
  8807. return (
  8808. domUtils.breakParent(m, q),
  8809. f(m),
  8810. h.fireEvent('contentchange'),
  8811. l.setStart(m, 0).setCursor(!1, !0),
  8812. h.fireEvent('saveScene'),
  8813. void domUtils.preventDefault(b)
  8814. )
  8815. }
  8816. if (j && (v = j.previousSibling)) {
  8817. if (46 == e && j.childNodes.length) return
  8818. if (
  8819. (dtd.$list[v.tagName] && (v = v.lastChild),
  8820. h.undoManger && h.undoManger.save(),
  8821. (r = j.firstChild),
  8822. domUtils.isBlockElm(r))
  8823. )
  8824. if (domUtils.isEmptyNode(r))
  8825. for (
  8826. v.appendChild(r), l.setStart(r, 0).setCursor(!1, !0);
  8827. j.firstChild;
  8828. )
  8829. v.appendChild(j.firstChild)
  8830. else
  8831. (t = h.document.createElement('span')),
  8832. l.insertNode(t),
  8833. domUtils.isEmptyBlock(v) && (v.innerHTML = ''),
  8834. domUtils.moveChild(j, v),
  8835. l.setStartBefore(t).collapse(!0).select(!0),
  8836. domUtils.remove(t)
  8837. else if (domUtils.isEmptyNode(j)) {
  8838. var s = h.document.createElement('p')
  8839. v.appendChild(s), l.setStart(s, 0).setCursor()
  8840. } else
  8841. for (
  8842. l.setEnd(v, v.childNodes.length).collapse().select(!0);
  8843. j.firstChild;
  8844. )
  8845. v.appendChild(j.firstChild)
  8846. return (
  8847. domUtils.remove(j),
  8848. h.fireEvent('contentchange'),
  8849. h.fireEvent('saveScene'),
  8850. void domUtils.preventDefault(b)
  8851. )
  8852. }
  8853. if (j && !j.previousSibling) {
  8854. var q = j.parentNode,
  8855. p = l.createBookmark()
  8856. if (domUtils.isTagNode(q.parentNode, 'ol ul'))
  8857. q.parentNode.insertBefore(j, q),
  8858. domUtils.isEmptyNode(q) && domUtils.remove(q)
  8859. else {
  8860. for (; j.firstChild; )
  8861. q.parentNode.insertBefore(j.firstChild, q)
  8862. domUtils.remove(j),
  8863. domUtils.isEmptyNode(q) && domUtils.remove(q)
  8864. }
  8865. return (
  8866. l.moveToBookmark(p).setCursor(!1, !0),
  8867. h.fireEvent('contentchange'),
  8868. h.fireEvent('saveScene'),
  8869. void domUtils.preventDefault(b)
  8870. )
  8871. }
  8872. }
  8873. }),
  8874. h.addListener('keyup', function (a, c) {
  8875. var e = c.keyCode || c.which
  8876. if (8 == e) {
  8877. var f,
  8878. g = h.selection.getRange()
  8879. ;(f = domUtils.findParentByTagName(
  8880. g.startContainer,
  8881. ['ol', 'ul'],
  8882. !0
  8883. )) &&
  8884. d(
  8885. f,
  8886. f.tagName.toLowerCase(),
  8887. b(f) || domUtils.getComputedStyle(f, 'list-style-type'),
  8888. !0
  8889. )
  8890. }
  8891. }),
  8892. h.addListener('tabkeydown', function () {
  8893. function a(a) {
  8894. if (h.options.maxListLevel != -1) {
  8895. for (var b = a.parentNode, c = 0; /[ou]l/i.test(b.tagName); )
  8896. c++, (b = b.parentNode)
  8897. if (c >= h.options.maxListLevel) return !0
  8898. }
  8899. }
  8900. var c = h.selection.getRange(),
  8901. f = domUtils.findParentByTagName(c.startContainer, 'li', !0)
  8902. if (f) {
  8903. var g
  8904. if (!c.collapsed) {
  8905. h.fireEvent('saveScene'), (g = c.createBookmark())
  8906. for (var i, j, l = 0, m = domUtils.findParents(f); (j = m[l++]); )
  8907. if (domUtils.isTagNode(j, 'ol ul')) {
  8908. i = j
  8909. break
  8910. }
  8911. var n = f
  8912. if (g.end)
  8913. for (
  8914. ;
  8915. n &&
  8916. !(
  8917. domUtils.getPosition(n, g.end) & domUtils.POSITION_FOLLOWING
  8918. );
  8919. )
  8920. if (a(n))
  8921. n = domUtils.getNextDomNode(n, !1, null, function (a) {
  8922. return a !== i
  8923. })
  8924. else {
  8925. var o = n.parentNode,
  8926. p = h.document.createElement(o.tagName),
  8927. q = utils.indexOf(
  8928. k[p.tagName],
  8929. b(o) || domUtils.getComputedStyle(o, 'list-style-type')
  8930. ),
  8931. r = q + 1 == k[p.tagName].length ? 0 : q + 1,
  8932. s = k[p.tagName][r]
  8933. for (
  8934. e(p, s), o.insertBefore(p, n);
  8935. n &&
  8936. !(
  8937. domUtils.getPosition(n, g.end) &
  8938. domUtils.POSITION_FOLLOWING
  8939. );
  8940. ) {
  8941. if (
  8942. ((f = n.nextSibling),
  8943. p.appendChild(n),
  8944. !f || domUtils.isTagNode(f, 'ol ul'))
  8945. ) {
  8946. if (f)
  8947. for (; (f = f.firstChild) && 'LI' != f.tagName; );
  8948. else
  8949. f = domUtils.getNextDomNode(
  8950. n,
  8951. !1,
  8952. null,
  8953. function (a) {
  8954. return a !== i
  8955. }
  8956. )
  8957. break
  8958. }
  8959. n = f
  8960. }
  8961. d(p, p.tagName.toLowerCase(), s), (n = f)
  8962. }
  8963. return (
  8964. h.fireEvent('contentchange'), c.moveToBookmark(g).select(), !0
  8965. )
  8966. }
  8967. if (a(f)) return !0
  8968. var o = f.parentNode,
  8969. p = h.document.createElement(o.tagName),
  8970. q = utils.indexOf(
  8971. k[p.tagName],
  8972. b(o) || domUtils.getComputedStyle(o, 'list-style-type')
  8973. )
  8974. q = q + 1 == k[p.tagName].length ? 0 : q + 1
  8975. var s = k[p.tagName][q]
  8976. if ((e(p, s), domUtils.isStartInblock(c)))
  8977. return (
  8978. h.fireEvent('saveScene'),
  8979. (g = c.createBookmark()),
  8980. o.insertBefore(p, f),
  8981. p.appendChild(f),
  8982. d(p, p.tagName.toLowerCase(), s),
  8983. h.fireEvent('contentchange'),
  8984. c.moveToBookmark(g).select(!0),
  8985. !0
  8986. )
  8987. }
  8988. }),
  8989. (h.commands.insertorderedlist = h.commands.insertunorderedlist =
  8990. {
  8991. execCommand: function (a, c) {
  8992. c ||
  8993. (c =
  8994. 'insertorderedlist' == a.toLowerCase() ? 'decimal' : 'disc')
  8995. var f = this,
  8996. h = this.selection.getRange(),
  8997. j = function (a) {
  8998. return 1 == a.nodeType
  8999. ? 'br' != a.tagName.toLowerCase()
  9000. : !domUtils.isWhitespace(a)
  9001. },
  9002. k = 'insertorderedlist' == a.toLowerCase() ? 'ol' : 'ul',
  9003. l = f.document.createDocumentFragment()
  9004. h.adjustmentBoundary().shrinkBoundary()
  9005. var m,
  9006. n,
  9007. o,
  9008. p,
  9009. q = h.createBookmark(!0),
  9010. r = g(f.document.getElementById(q.start)),
  9011. s = 0,
  9012. t = g(f.document.getElementById(q.end)),
  9013. u = 0
  9014. if (r || t) {
  9015. if (
  9016. (r && (m = r.parentNode),
  9017. q.end || (t = r),
  9018. t && (n = t.parentNode),
  9019. m === n)
  9020. ) {
  9021. for (; r !== t; ) {
  9022. if (
  9023. ((p = r),
  9024. (r = r.nextSibling),
  9025. !domUtils.isBlockElm(p.firstChild))
  9026. ) {
  9027. for (
  9028. var v = f.document.createElement('p');
  9029. p.firstChild;
  9030. )
  9031. v.appendChild(p.firstChild)
  9032. p.appendChild(v)
  9033. }
  9034. l.appendChild(p)
  9035. }
  9036. if (
  9037. ((p = f.document.createElement('span')),
  9038. m.insertBefore(p, t),
  9039. !domUtils.isBlockElm(t.firstChild))
  9040. ) {
  9041. for (v = f.document.createElement('p'); t.firstChild; )
  9042. v.appendChild(t.firstChild)
  9043. t.appendChild(v)
  9044. }
  9045. l.appendChild(t),
  9046. domUtils.breakParent(p, m),
  9047. domUtils.isEmptyNode(p.previousSibling) &&
  9048. domUtils.remove(p.previousSibling),
  9049. domUtils.isEmptyNode(p.nextSibling) &&
  9050. domUtils.remove(p.nextSibling)
  9051. var w =
  9052. b(m) ||
  9053. domUtils.getComputedStyle(m, 'list-style-type') ||
  9054. ('insertorderedlist' == a.toLowerCase()
  9055. ? 'decimal'
  9056. : 'disc')
  9057. if (m.tagName.toLowerCase() == k && w == c) {
  9058. for (
  9059. var x, y = 0, z = f.document.createDocumentFragment();
  9060. (x = l.firstChild);
  9061. )
  9062. if (domUtils.isTagNode(x, 'ol ul')) z.appendChild(x)
  9063. else
  9064. for (; x.firstChild; )
  9065. z.appendChild(x.firstChild), domUtils.remove(x)
  9066. p.parentNode.insertBefore(z, p)
  9067. } else
  9068. (o = f.document.createElement(k)),
  9069. e(o, c),
  9070. o.appendChild(l),
  9071. p.parentNode.insertBefore(o, p)
  9072. return (
  9073. domUtils.remove(p),
  9074. o && d(o, k, c),
  9075. void h.moveToBookmark(q).select()
  9076. )
  9077. }
  9078. if (r) {
  9079. for (; r; ) {
  9080. if (((p = r.nextSibling), domUtils.isTagNode(r, 'ol ul')))
  9081. l.appendChild(r)
  9082. else {
  9083. for (
  9084. var A = f.document.createDocumentFragment(), B = 0;
  9085. r.firstChild;
  9086. )
  9087. domUtils.isBlockElm(r.firstChild) && (B = 1),
  9088. A.appendChild(r.firstChild)
  9089. if (B) l.appendChild(A)
  9090. else {
  9091. var C = f.document.createElement('p')
  9092. C.appendChild(A), l.appendChild(C)
  9093. }
  9094. domUtils.remove(r)
  9095. }
  9096. r = p
  9097. }
  9098. m.parentNode.insertBefore(l, m.nextSibling),
  9099. domUtils.isEmptyNode(m)
  9100. ? (h.setStartBefore(m), domUtils.remove(m))
  9101. : h.setStartAfter(m),
  9102. (s = 1)
  9103. }
  9104. if (t && domUtils.inDoc(n, f.document)) {
  9105. for (r = n.firstChild; r && r !== t; ) {
  9106. if (((p = r.nextSibling), domUtils.isTagNode(r, 'ol ul')))
  9107. l.appendChild(r)
  9108. else {
  9109. for (
  9110. A = f.document.createDocumentFragment(), B = 0;
  9111. r.firstChild;
  9112. )
  9113. domUtils.isBlockElm(r.firstChild) && (B = 1),
  9114. A.appendChild(r.firstChild)
  9115. B
  9116. ? l.appendChild(A)
  9117. : ((C = f.document.createElement('p')),
  9118. C.appendChild(A),
  9119. l.appendChild(C)),
  9120. domUtils.remove(r)
  9121. }
  9122. r = p
  9123. }
  9124. var D = domUtils.createElement(f.document, 'div', {
  9125. tmpDiv: 1
  9126. })
  9127. domUtils.moveChild(t, D),
  9128. l.appendChild(D),
  9129. domUtils.remove(t),
  9130. n.parentNode.insertBefore(l, n),
  9131. h.setEndBefore(n),
  9132. domUtils.isEmptyNode(n) && domUtils.remove(n),
  9133. (u = 1)
  9134. }
  9135. }
  9136. s || h.setStartBefore(f.document.getElementById(q.start)),
  9137. q.end && !u && h.setEndAfter(f.document.getElementById(q.end)),
  9138. h.enlarge(!0, function (a) {
  9139. return i[a.tagName]
  9140. }),
  9141. (l = f.document.createDocumentFragment())
  9142. for (
  9143. var E,
  9144. F = h.createBookmark(),
  9145. G = domUtils.getNextDomNode(F.start, !1, j),
  9146. H = h.cloneRange(),
  9147. I = domUtils.isBlockElm;
  9148. G &&
  9149. G !== F.end &&
  9150. domUtils.getPosition(G, F.end) & domUtils.POSITION_PRECEDING;
  9151. )
  9152. if (3 == G.nodeType || dtd.li[G.tagName]) {
  9153. if (1 == G.nodeType && dtd.$list[G.tagName]) {
  9154. for (; G.firstChild; ) l.appendChild(G.firstChild)
  9155. ;(E = domUtils.getNextDomNode(G, !1, j)),
  9156. domUtils.remove(G),
  9157. (G = E)
  9158. continue
  9159. }
  9160. for (
  9161. E = G, H.setStartBefore(G);
  9162. G && G !== F.end && (!I(G) || domUtils.isBookmarkNode(G));
  9163. )
  9164. (E = G),
  9165. (G = domUtils.getNextDomNode(G, !1, null, function (a) {
  9166. return !i[a.tagName]
  9167. }))
  9168. G &&
  9169. I(G) &&
  9170. ((p = domUtils.getNextDomNode(E, !1, j)),
  9171. p &&
  9172. domUtils.isBookmarkNode(p) &&
  9173. ((G = domUtils.getNextDomNode(p, !1, j)), (E = p))),
  9174. H.setEndAfter(E),
  9175. (G = domUtils.getNextDomNode(E, !1, j))
  9176. var J = h.document.createElement('li')
  9177. if (
  9178. (J.appendChild(H.extractContents()),
  9179. domUtils.isEmptyNode(J))
  9180. ) {
  9181. for (var E = h.document.createElement('p'); J.firstChild; )
  9182. E.appendChild(J.firstChild)
  9183. J.appendChild(E)
  9184. }
  9185. l.appendChild(J)
  9186. } else G = domUtils.getNextDomNode(G, !0, j)
  9187. h.moveToBookmark(F).collapse(!0),
  9188. (o = f.document.createElement(k)),
  9189. e(o, c),
  9190. o.appendChild(l),
  9191. h.insertNode(o),
  9192. d(o, k, c)
  9193. for (
  9194. var x, y = 0, K = domUtils.getElementsByTagName(o, 'div');
  9195. (x = K[y++]);
  9196. )
  9197. x.getAttribute('tmpDiv') && domUtils.remove(x, !0)
  9198. h.moveToBookmark(q).select()
  9199. },
  9200. queryCommandState: function (a) {
  9201. for (
  9202. var b,
  9203. c = 'insertorderedlist' == a.toLowerCase() ? 'ol' : 'ul',
  9204. d = this.selection.getStartElementPath(),
  9205. e = 0;
  9206. (b = d[e++]);
  9207. ) {
  9208. if ('TABLE' == b.nodeName) return 0
  9209. if (c == b.nodeName.toLowerCase()) return 1
  9210. }
  9211. return 0
  9212. },
  9213. queryCommandValue: function (a) {
  9214. for (
  9215. var c,
  9216. d,
  9217. e = 'insertorderedlist' == a.toLowerCase() ? 'ol' : 'ul',
  9218. f = this.selection.getStartElementPath(),
  9219. g = 0;
  9220. (d = f[g++]);
  9221. ) {
  9222. if ('TABLE' == d.nodeName) {
  9223. c = null
  9224. break
  9225. }
  9226. if (e == d.nodeName.toLowerCase()) {
  9227. c = d
  9228. break
  9229. }
  9230. }
  9231. return c
  9232. ? b(c) || domUtils.getComputedStyle(c, 'list-style-type')
  9233. : null
  9234. }
  9235. })
  9236. }),
  9237. (function () {
  9238. var a = {
  9239. textarea: function (a, b) {
  9240. var c = b.ownerDocument.createElement('textarea')
  9241. return (
  9242. (c.style.cssText =
  9243. 'position:absolute;resize:none;width:100%;height:100%;border:0;padding:0;margin:0;overflow-y:auto;'),
  9244. browser.ie &&
  9245. browser.version < 8 &&
  9246. ((c.style.width = b.offsetWidth + 'px'),
  9247. (c.style.height = b.offsetHeight + 'px'),
  9248. (b.onresize = function () {
  9249. ;(c.style.width = b.offsetWidth + 'px'),
  9250. (c.style.height = b.offsetHeight + 'px')
  9251. })),
  9252. b.appendChild(c),
  9253. {
  9254. setContent: function (a) {
  9255. c.value = a
  9256. },
  9257. getContent: function () {
  9258. return c.value
  9259. },
  9260. select: function () {
  9261. var a
  9262. browser.ie
  9263. ? ((a = c.createTextRange()), a.collapse(!0), a.select())
  9264. : (c.setSelectionRange(0, 0), c.focus())
  9265. },
  9266. dispose: function () {
  9267. b.removeChild(c), (b.onresize = null), (c = null), (b = null)
  9268. }
  9269. }
  9270. )
  9271. },
  9272. codemirror: function (a, b) {
  9273. var c = window.CodeMirror(b, {
  9274. mode: 'text/html',
  9275. tabMode: 'indent',
  9276. lineNumbers: !0,
  9277. lineWrapping: !0
  9278. }),
  9279. d = c.getWrapperElement()
  9280. return (
  9281. (d.style.cssText =
  9282. 'position:absolute;left:0;top:0;width:100%;height:100%;font-family:consolas,"Courier new",monospace;font-size:13px;'),
  9283. (c.getScrollerElement().style.cssText =
  9284. 'position:absolute;left:0;top:0;width:100%;height:100%;'),
  9285. c.refresh(),
  9286. {
  9287. getCodeMirror: function () {
  9288. return c
  9289. },
  9290. setContent: function (a) {
  9291. c.setValue(a)
  9292. },
  9293. getContent: function () {
  9294. return c.getValue()
  9295. },
  9296. select: function () {
  9297. c.focus()
  9298. },
  9299. dispose: function () {
  9300. b.removeChild(d), (d = null), (c = null)
  9301. }
  9302. }
  9303. )
  9304. }
  9305. }
  9306. UE.plugins.source = function () {
  9307. function b(b) {
  9308. return a[
  9309. 'codemirror' == f.sourceEditor && window.CodeMirror
  9310. ? 'codemirror'
  9311. : 'textarea'
  9312. ](e, b)
  9313. }
  9314. var c,
  9315. d,
  9316. e = this,
  9317. f = this.options,
  9318. g = !1
  9319. ;(f.sourceEditor = browser.ie
  9320. ? 'textarea'
  9321. : f.sourceEditor || 'codemirror'),
  9322. e.setOpt({ sourceEditorFirst: !1 })
  9323. var h, i, j
  9324. e.commands.source = {
  9325. execCommand: function () {
  9326. if ((g = !g)) {
  9327. ;(j = e.selection.getRange().createAddress(!1, !0)),
  9328. e.undoManger && e.undoManger.save(!0),
  9329. browser.gecko && (e.body.contentEditable = !1),
  9330. (h = e.iframe.style.cssText),
  9331. (e.iframe.style.cssText +=
  9332. 'position:absolute;left:-32768px;top:-32768px;'),
  9333. e.fireEvent('beforegetcontent')
  9334. var a = UE.htmlparser(e.body.innerHTML)
  9335. e.filterOutputRule(a),
  9336. a.traversal(function (a) {
  9337. if ('element' == a.type)
  9338. switch (a.tagName) {
  9339. case 'td':
  9340. case 'th':
  9341. case 'caption':
  9342. a.children &&
  9343. 1 == a.children.length &&
  9344. 'br' == a.firstChild().tagName &&
  9345. a.removeChild(a.firstChild())
  9346. break
  9347. case 'pre':
  9348. a.innerText(a.innerText().replace(/&nbsp;/g, ' '))
  9349. }
  9350. }),
  9351. e.fireEvent('aftergetcontent')
  9352. var f = a.toHtml(!0)
  9353. ;(c = b(e.iframe.parentNode)),
  9354. c.setContent(f),
  9355. (d = e.setContent),
  9356. (e.setContent = function (a) {
  9357. var b = UE.htmlparser(a)
  9358. e.filterInputRule(b), (a = b.toHtml()), c.setContent(a)
  9359. }),
  9360. setTimeout(function () {
  9361. c.select(),
  9362. e.addListener('fullscreenchanged', function () {
  9363. try {
  9364. c.getCodeMirror().refresh()
  9365. } catch (a) {}
  9366. })
  9367. }),
  9368. (i = e.getContent),
  9369. (e.getContent = function () {
  9370. return (
  9371. c.getContent() ||
  9372. '<p>' + (browser.ie ? '' : '<br/>') + '</p>'
  9373. )
  9374. })
  9375. } else {
  9376. e.iframe.style.cssText = h
  9377. var k =
  9378. c.getContent() || '<p>' + (browser.ie ? '' : '<br/>') + '</p>'
  9379. ;(k = k.replace(
  9380. new RegExp('[\\r\\t\\n ]*</?(\\w+)\\s*(?:[^>]*)>', 'g'),
  9381. function (a, b) {
  9382. return b && !dtd.$inlineWithA[b.toLowerCase()]
  9383. ? a.replace(/(^[\n\r\t ]*)|([\n\r\t ]*$)/g, '')
  9384. : a.replace(/(^[\n\r\t]*)|([\n\r\t]*$)/g, '')
  9385. }
  9386. )),
  9387. (e.setContent = d),
  9388. e.setContent(k),
  9389. c.dispose(),
  9390. (c = null),
  9391. (e.getContent = i)
  9392. var l = e.body.firstChild
  9393. if (
  9394. (l ||
  9395. ((e.body.innerHTML =
  9396. '<p>' + (browser.ie ? '' : '<br/>') + '</p>'),
  9397. (l = e.body.firstChild)),
  9398. e.undoManger && e.undoManger.save(!0),
  9399. browser.gecko)
  9400. ) {
  9401. var m = document.createElement('input')
  9402. ;(m.style.cssText = 'position:absolute;left:0;top:-32768px'),
  9403. document.body.appendChild(m),
  9404. (e.body.contentEditable = !1),
  9405. setTimeout(function () {
  9406. domUtils.setViewportOffset(m, { left: -32768, top: 0 }),
  9407. m.focus(),
  9408. setTimeout(function () {
  9409. ;(e.body.contentEditable = !0),
  9410. e.selection.getRange().moveToAddress(j).select(!0),
  9411. domUtils.remove(m)
  9412. })
  9413. })
  9414. } else
  9415. try {
  9416. e.selection.getRange().moveToAddress(j).select(!0)
  9417. } catch (n) {}
  9418. }
  9419. this.fireEvent('sourcemodechanged', g)
  9420. },
  9421. queryCommandState: function () {
  9422. return 0 | g
  9423. },
  9424. notNeedUndo: 1
  9425. }
  9426. var k = e.queryCommandState
  9427. ;(e.queryCommandState = function (a) {
  9428. return (
  9429. (a = a.toLowerCase()),
  9430. g
  9431. ? a in { source: 1, fullscreen: 1 }
  9432. ? 1
  9433. : -1
  9434. : k.apply(this, arguments)
  9435. )
  9436. }),
  9437. 'codemirror' == f.sourceEditor &&
  9438. e.addListener('ready', function () {
  9439. utils.loadFile(
  9440. document,
  9441. {
  9442. src:
  9443. f.codeMirrorJsUrl ||
  9444. f.UEDITOR_HOME_URL + 'third-party/codemirror/codemirror.js',
  9445. tag: 'script',
  9446. type: 'text/javascript',
  9447. defer: 'defer'
  9448. },
  9449. function () {
  9450. f.sourceEditorFirst &&
  9451. setTimeout(function () {
  9452. e.execCommand('source')
  9453. }, 0)
  9454. }
  9455. ),
  9456. utils.loadFile(document, {
  9457. tag: 'link',
  9458. rel: 'stylesheet',
  9459. type: 'text/css',
  9460. href:
  9461. f.codeMirrorCssUrl ||
  9462. f.UEDITOR_HOME_URL + 'third-party/codemirror/codemirror.css'
  9463. })
  9464. })
  9465. }
  9466. })(),
  9467. (UE.plugins.enterkey = function () {
  9468. var a,
  9469. b = this,
  9470. c = b.options.enterTag
  9471. b.addListener('keyup', function (c, d) {
  9472. var e = d.keyCode || d.which
  9473. if (13 == e) {
  9474. var f,
  9475. g = b.selection.getRange(),
  9476. h = g.startContainer
  9477. if (browser.ie) b.fireEvent('saveScene', !0, !0)
  9478. else {
  9479. if (/h\d/i.test(a)) {
  9480. if (browser.gecko) {
  9481. var i = domUtils.findParentByTagName(
  9482. h,
  9483. [
  9484. 'h1',
  9485. 'h2',
  9486. 'h3',
  9487. 'h4',
  9488. 'h5',
  9489. 'h6',
  9490. 'blockquote',
  9491. 'caption',
  9492. 'table'
  9493. ],
  9494. !0
  9495. )
  9496. i || (b.document.execCommand('formatBlock', !1, '<p>'), (f = 1))
  9497. } else if (1 == h.nodeType) {
  9498. var j,
  9499. k = b.document.createTextNode('')
  9500. if (
  9501. (g.insertNode(k),
  9502. (j = domUtils.findParentByTagName(k, 'div', !0)))
  9503. ) {
  9504. for (var l = b.document.createElement('p'); j.firstChild; )
  9505. l.appendChild(j.firstChild)
  9506. j.parentNode.insertBefore(l, j),
  9507. domUtils.remove(j),
  9508. g.setStartBefore(k).setCursor(),
  9509. (f = 1)
  9510. }
  9511. domUtils.remove(k)
  9512. }
  9513. b.undoManger && f && b.undoManger.save()
  9514. }
  9515. browser.opera && g.select()
  9516. }
  9517. }
  9518. }),
  9519. b.addListener('keydown', function (d, e) {
  9520. var f = e.keyCode || e.which
  9521. if (13 == f) {
  9522. if (b.fireEvent('beforeenterkeydown'))
  9523. return void domUtils.preventDefault(e)
  9524. b.fireEvent('saveScene', !0, !0), (a = '')
  9525. var g = b.selection.getRange()
  9526. if (!g.collapsed) {
  9527. var h = g.startContainer,
  9528. i = g.endContainer,
  9529. j = domUtils.findParentByTagName(h, 'td', !0),
  9530. k = domUtils.findParentByTagName(i, 'td', !0)
  9531. if ((j && k && j !== k) || (!j && k) || (j && !k))
  9532. return void (e.preventDefault
  9533. ? e.preventDefault()
  9534. : (e.returnValue = !1))
  9535. }
  9536. if ('p' == c)
  9537. browser.ie ||
  9538. ((h = domUtils.findParentByTagName(
  9539. g.startContainer,
  9540. [
  9541. 'ol',
  9542. 'ul',
  9543. 'p',
  9544. 'h1',
  9545. 'h2',
  9546. 'h3',
  9547. 'h4',
  9548. 'h5',
  9549. 'h6',
  9550. 'blockquote',
  9551. 'caption'
  9552. ],
  9553. !0
  9554. )),
  9555. h || browser.opera
  9556. ? ((a = h.tagName),
  9557. 'p' == h.tagName.toLowerCase() &&
  9558. browser.gecko &&
  9559. domUtils.removeDirtyAttr(h))
  9560. : (b.document.execCommand('formatBlock', !1, '<p>'),
  9561. browser.gecko &&
  9562. ((g = b.selection.getRange()),
  9563. (h = domUtils.findParentByTagName(
  9564. g.startContainer,
  9565. 'p',
  9566. !0
  9567. )),
  9568. h && domUtils.removeDirtyAttr(h))))
  9569. else if (
  9570. (e.preventDefault ? e.preventDefault() : (e.returnValue = !1),
  9571. g.collapsed)
  9572. ) {
  9573. ;(m = g.document.createElement('br')), g.insertNode(m)
  9574. var l = m.parentNode
  9575. l.lastChild === m
  9576. ? (m.parentNode.insertBefore(m.cloneNode(!0), m),
  9577. g.setStartBefore(m))
  9578. : g.setStartAfter(m),
  9579. g.setCursor()
  9580. } else if (
  9581. (g.deleteContents(),
  9582. (h = g.startContainer),
  9583. 1 == h.nodeType && (h = h.childNodes[g.startOffset]))
  9584. ) {
  9585. for (; 1 == h.nodeType; ) {
  9586. if (dtd.$empty[h.tagName])
  9587. return (
  9588. g.setStartBefore(h).setCursor(),
  9589. b.undoManger && b.undoManger.save(),
  9590. !1
  9591. )
  9592. if (!h.firstChild) {
  9593. var m = g.document.createElement('br')
  9594. return (
  9595. h.appendChild(m),
  9596. g.setStart(h, 0).setCursor(),
  9597. b.undoManger && b.undoManger.save(),
  9598. !1
  9599. )
  9600. }
  9601. h = h.firstChild
  9602. }
  9603. h === g.startContainer.childNodes[g.startOffset]
  9604. ? ((m = g.document.createElement('br')),
  9605. g.insertNode(m).setCursor())
  9606. : g.setStart(h, 0).setCursor()
  9607. } else
  9608. (m = g.document.createElement('br')),
  9609. g.insertNode(m).setStartAfter(m).setCursor()
  9610. }
  9611. })
  9612. }),
  9613. (UE.plugins.keystrokes = function () {
  9614. var a = this,
  9615. b = !0
  9616. a.addListener('keydown', function (c, d) {
  9617. var e = d.keyCode || d.which,
  9618. f = a.selection.getRange()
  9619. if (
  9620. !f.collapsed &&
  9621. !(d.ctrlKey || d.shiftKey || d.altKey || d.metaKey) &&
  9622. ((e >= 65 && e <= 90) ||
  9623. (e >= 48 && e <= 57) ||
  9624. (e >= 96 && e <= 111) ||
  9625. { 13: 1, 8: 1, 46: 1 }[e])
  9626. ) {
  9627. var g = f.startContainer
  9628. if (
  9629. (domUtils.isFillChar(g) && f.setStartBefore(g),
  9630. (g = f.endContainer),
  9631. domUtils.isFillChar(g) && f.setEndAfter(g),
  9632. f.txtToElmBoundary(),
  9633. f.endContainer &&
  9634. 1 == f.endContainer.nodeType &&
  9635. ((g = f.endContainer.childNodes[f.endOffset]),
  9636. g && domUtils.isBr(g) && f.setEndAfter(g)),
  9637. 0 == f.startOffset &&
  9638. ((g = f.startContainer),
  9639. domUtils.isBoundaryNode(g, 'firstChild') &&
  9640. ((g = f.endContainer),
  9641. f.endOffset ==
  9642. (3 == g.nodeType
  9643. ? g.nodeValue.length
  9644. : g.childNodes.length) &&
  9645. domUtils.isBoundaryNode(g, 'lastChild'))))
  9646. )
  9647. return (
  9648. a.fireEvent('saveScene'),
  9649. (a.body.innerHTML = '<p>' + (browser.ie ? '' : '<br/>') + '</p>'),
  9650. f.setStart(a.body.firstChild, 0).setCursor(!1, !0),
  9651. void a._selectionChange()
  9652. )
  9653. }
  9654. if (e == keymap.Backspace) {
  9655. if (
  9656. ((f = a.selection.getRange()),
  9657. (b = f.collapsed),
  9658. a.fireEvent('delkeydown', d))
  9659. )
  9660. return
  9661. var h, i
  9662. if (
  9663. (f.collapsed &&
  9664. f.inFillChar() &&
  9665. ((h = f.startContainer),
  9666. domUtils.isFillChar(h)
  9667. ? (f.setStartBefore(h).shrinkBoundary(!0).collapse(!0),
  9668. domUtils.remove(h))
  9669. : ((h.nodeValue = h.nodeValue.replace(
  9670. new RegExp('^' + domUtils.fillChar),
  9671. ''
  9672. )),
  9673. f.startOffset--,
  9674. f.collapse(!0).select(!0))),
  9675. (h = f.getClosedNode()))
  9676. )
  9677. return (
  9678. a.fireEvent('saveScene'),
  9679. f.setStartBefore(h),
  9680. domUtils.remove(h),
  9681. f.setCursor(),
  9682. a.fireEvent('saveScene'),
  9683. void domUtils.preventDefault(d)
  9684. )
  9685. if (
  9686. !browser.ie &&
  9687. ((h = domUtils.findParentByTagName(f.startContainer, 'table', !0)),
  9688. (i = domUtils.findParentByTagName(f.endContainer, 'table', !0)),
  9689. (h && !i) || (!h && i) || h !== i)
  9690. )
  9691. return void d.preventDefault()
  9692. }
  9693. if (e == keymap.Tab) {
  9694. var j = { ol: 1, ul: 1, table: 1 }
  9695. if (a.fireEvent('tabkeydown', d))
  9696. return void domUtils.preventDefault(d)
  9697. var k = a.selection.getRange()
  9698. a.fireEvent('saveScene')
  9699. for (
  9700. var l = 0,
  9701. m = '',
  9702. n = a.options.tabSize || 4,
  9703. o = a.options.tabNode || '&nbsp;';
  9704. l < n;
  9705. l++
  9706. )
  9707. m += o
  9708. var p = a.document.createElement('span')
  9709. if (((p.innerHTML = m + domUtils.fillChar), k.collapsed))
  9710. k.insertNode(p.cloneNode(!0).firstChild).setCursor(!0)
  9711. else {
  9712. var q = function (a) {
  9713. return domUtils.isBlockElm(a) && !j[a.tagName.toLowerCase()]
  9714. }
  9715. if (
  9716. ((h = domUtils.findParent(k.startContainer, q, !0)),
  9717. (i = domUtils.findParent(k.endContainer, q, !0)),
  9718. h && i && h === i)
  9719. )
  9720. k.deleteContents(),
  9721. k.insertNode(p.cloneNode(!0).firstChild).setCursor(!0)
  9722. else {
  9723. var r = k.createBookmark()
  9724. k.enlarge(!0)
  9725. for (
  9726. var s = k.createBookmark(),
  9727. t = domUtils.getNextDomNode(s.start, !1, q);
  9728. t &&
  9729. !(domUtils.getPosition(t, s.end) & domUtils.POSITION_FOLLOWING);
  9730. )
  9731. t.insertBefore(p.cloneNode(!0).firstChild, t.firstChild),
  9732. (t = domUtils.getNextDomNode(t, !1, q))
  9733. k.moveToBookmark(s).moveToBookmark(r).select()
  9734. }
  9735. }
  9736. domUtils.preventDefault(d)
  9737. }
  9738. if (
  9739. browser.gecko &&
  9740. 46 == e &&
  9741. ((k = a.selection.getRange()),
  9742. k.collapsed && ((h = k.startContainer), domUtils.isEmptyBlock(h)))
  9743. ) {
  9744. for (
  9745. var u = h.parentNode;
  9746. 1 == domUtils.getChildCount(u) && !domUtils.isBody(u);
  9747. )
  9748. (h = u), (u = u.parentNode)
  9749. return void (h === u.lastChild && d.preventDefault())
  9750. }
  9751. }),
  9752. a.addListener('keyup', function (a, c) {
  9753. var d,
  9754. e = c.keyCode || c.which,
  9755. f = this
  9756. if (e == keymap.Backspace) {
  9757. if (f.fireEvent('delkeyup')) return
  9758. if (((d = f.selection.getRange()), d.collapsed)) {
  9759. var g,
  9760. h = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
  9761. if (
  9762. (g = domUtils.findParentByTagName(d.startContainer, h, !0)) &&
  9763. domUtils.isEmptyBlock(g)
  9764. ) {
  9765. var i = g.previousSibling
  9766. if (i && 'TABLE' != i.nodeName)
  9767. return (
  9768. domUtils.remove(g),
  9769. void d.setStartAtLast(i).setCursor(!1, !0)
  9770. )
  9771. var j = g.nextSibling
  9772. if (j && 'TABLE' != j.nodeName)
  9773. return (
  9774. domUtils.remove(g),
  9775. void d.setStartAtFirst(j).setCursor(!1, !0)
  9776. )
  9777. }
  9778. if (domUtils.isBody(d.startContainer)) {
  9779. var g = domUtils.createElement(f.document, 'p', {
  9780. innerHTML: browser.ie ? domUtils.fillChar : '<br/>'
  9781. })
  9782. d.insertNode(g).setStart(g, 0).setCursor(!1, !0)
  9783. }
  9784. }
  9785. if (
  9786. !b &&
  9787. (3 == d.startContainer.nodeType ||
  9788. (1 == d.startContainer.nodeType &&
  9789. domUtils.isEmptyBlock(d.startContainer)))
  9790. )
  9791. if (browser.ie) {
  9792. var k = d.document.createElement('span')
  9793. d.insertNode(k).setStartBefore(k).collapse(!0),
  9794. d.select(),
  9795. domUtils.remove(k)
  9796. } else d.select()
  9797. }
  9798. })
  9799. }),
  9800. (UE.plugins.fiximgclick = (function () {
  9801. function a() {
  9802. ;(this.editor = null),
  9803. (this.resizer = null),
  9804. (this.cover = null),
  9805. (this.doc = document),
  9806. (this.prePos = { x: 0, y: 0 }),
  9807. (this.startPos = { x: 0, y: 0 })
  9808. }
  9809. var b = !1
  9810. return (
  9811. (function () {
  9812. var c = [
  9813. [0, 0, -1, -1],
  9814. [0, 0, 0, -1],
  9815. [0, 0, 1, -1],
  9816. [0, 0, -1, 0],
  9817. [0, 0, 1, 0],
  9818. [0, 0, -1, 1],
  9819. [0, 0, 0, 1],
  9820. [0, 0, 1, 1]
  9821. ]
  9822. a.prototype = {
  9823. init: function (a) {
  9824. var b = this
  9825. ;(b.editor = a),
  9826. (b.startPos = this.prePos = { x: 0, y: 0 }),
  9827. (b.dragId = -1)
  9828. var c = [],
  9829. d = (b.cover = document.createElement('div')),
  9830. e = (b.resizer = document.createElement('div'))
  9831. for (
  9832. d.id = b.editor.ui.id + '_imagescale_cover',
  9833. d.style.cssText =
  9834. 'position:absolute;display:none;z-index:' +
  9835. b.editor.options.zIndex +
  9836. ';filter:alpha(opacity=0); opacity:0;background:#CCC;',
  9837. domUtils.on(d, 'mousedown click', function () {
  9838. b.hide()
  9839. }),
  9840. i = 0;
  9841. i < 8;
  9842. i++
  9843. )
  9844. c.push(
  9845. '<span class="edui-editor-imagescale-hand' + i + '"></span>'
  9846. )
  9847. ;(e.id = b.editor.ui.id + '_imagescale'),
  9848. (e.className = 'edui-editor-imagescale'),
  9849. (e.innerHTML = c.join('')),
  9850. (e.style.cssText +=
  9851. ';display:none;border:1px solid #3b77ff;z-index:' +
  9852. b.editor.options.zIndex +
  9853. ';'),
  9854. b.editor.ui.getDom().appendChild(d),
  9855. b.editor.ui.getDom().appendChild(e),
  9856. b.initStyle(),
  9857. b.initEvents()
  9858. },
  9859. initStyle: function () {
  9860. utils.cssRule(
  9861. 'imagescale',
  9862. '.edui-editor-imagescale{display:none;position:absolute;border:1px solid #38B2CE;cursor:hand;-webkit-box-sizing: content-box;-moz-box-sizing: content-box;box-sizing: content-box;}.edui-editor-imagescale span{position:absolute;width:6px;height:6px;overflow:hidden;font-size:0px;display:block;background-color:#3C9DD0;}.edui-editor-imagescale .edui-editor-imagescale-hand0{cursor:nw-resize;top:0;margin-top:-4px;left:0;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand1{cursor:n-resize;top:0;margin-top:-4px;left:50%;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand2{cursor:ne-resize;top:0;margin-top:-4px;left:100%;margin-left:-3px;}.edui-editor-imagescale .edui-editor-imagescale-hand3{cursor:w-resize;top:50%;margin-top:-4px;left:0;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand4{cursor:e-resize;top:50%;margin-top:-4px;left:100%;margin-left:-3px;}.edui-editor-imagescale .edui-editor-imagescale-hand5{cursor:sw-resize;top:100%;margin-top:-3px;left:0;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand6{cursor:s-resize;top:100%;margin-top:-3px;left:50%;margin-left:-4px;}.edui-editor-imagescale .edui-editor-imagescale-hand7{cursor:se-resize;top:100%;margin-top:-3px;left:100%;margin-left:-3px;}'
  9863. )
  9864. },
  9865. initEvents: function () {
  9866. var a = this
  9867. ;(a.startPos.x = a.startPos.y = 0), (a.isDraging = !1)
  9868. },
  9869. _eventHandler: function (a) {
  9870. var c = this
  9871. switch (a.type) {
  9872. case 'mousedown':
  9873. var d,
  9874. d = a.target || a.srcElement
  9875. d.className.indexOf('edui-editor-imagescale-hand') != -1 &&
  9876. c.dragId == -1 &&
  9877. ((c.dragId = d.className.slice(-1)),
  9878. (c.startPos.x = c.prePos.x = a.clientX),
  9879. (c.startPos.y = c.prePos.y = a.clientY),
  9880. domUtils.on(
  9881. c.doc,
  9882. 'mousemove',
  9883. c.proxy(c._eventHandler, c)
  9884. ))
  9885. break
  9886. case 'mousemove':
  9887. c.dragId != -1 &&
  9888. (c.updateContainerStyle(c.dragId, {
  9889. x: a.clientX - c.prePos.x,
  9890. y: a.clientY - c.prePos.y
  9891. }),
  9892. (c.prePos.x = a.clientX),
  9893. (c.prePos.y = a.clientY),
  9894. (b = !0),
  9895. c.updateTargetElement())
  9896. break
  9897. case 'mouseup':
  9898. c.dragId != -1 &&
  9899. (c.updateContainerStyle(c.dragId, {
  9900. x: a.clientX - c.prePos.x,
  9901. y: a.clientY - c.prePos.y
  9902. }),
  9903. c.updateTargetElement(),
  9904. c.target.parentNode && c.attachTo(c.target),
  9905. (c.dragId = -1)),
  9906. domUtils.un(
  9907. c.doc,
  9908. 'mousemove',
  9909. c.proxy(c._eventHandler, c)
  9910. ),
  9911. b && ((b = !1), c.editor.fireEvent('contentchange'))
  9912. }
  9913. },
  9914. updateTargetElement: function () {
  9915. var a = this
  9916. domUtils.setStyles(a.target, {
  9917. width: a.resizer.style.width,
  9918. height: a.resizer.style.height
  9919. }),
  9920. (a.target.width = parseInt(a.resizer.style.width)),
  9921. (a.target.height = parseInt(a.resizer.style.height)),
  9922. a.attachTo(a.target)
  9923. },
  9924. updateContainerStyle: function (a, b) {
  9925. var d,
  9926. e = this,
  9927. f = e.resizer
  9928. 0 != c[a][0] &&
  9929. ((d = parseInt(f.style.left) + b.x),
  9930. (f.style.left = e._validScaledProp('left', d) + 'px')),
  9931. 0 != c[a][1] &&
  9932. ((d = parseInt(f.style.top) + b.y),
  9933. (f.style.top = e._validScaledProp('top', d) + 'px')),
  9934. 0 != c[a][2] &&
  9935. ((d = f.clientWidth + c[a][2] * b.x),
  9936. (f.style.width = e._validScaledProp('width', d) + 'px')),
  9937. 0 != c[a][3] &&
  9938. ((d = f.clientHeight + c[a][3] * b.y),
  9939. (f.style.height = e._validScaledProp('height', d) + 'px'))
  9940. },
  9941. _validScaledProp: function (a, b) {
  9942. var c = this.resizer,
  9943. d = document
  9944. switch (((b = isNaN(b) ? 0 : b), a)) {
  9945. case 'left':
  9946. return b < 0
  9947. ? 0
  9948. : b + c.clientWidth > d.clientWidth
  9949. ? d.clientWidth - c.clientWidth
  9950. : b
  9951. case 'top':
  9952. return b < 0
  9953. ? 0
  9954. : b + c.clientHeight > d.clientHeight
  9955. ? d.clientHeight - c.clientHeight
  9956. : b
  9957. case 'width':
  9958. return b <= 0
  9959. ? 1
  9960. : b + c.offsetLeft > d.clientWidth
  9961. ? d.clientWidth - c.offsetLeft
  9962. : b
  9963. case 'height':
  9964. return b <= 0
  9965. ? 1
  9966. : b + c.offsetTop > d.clientHeight
  9967. ? d.clientHeight - c.offsetTop
  9968. : b
  9969. }
  9970. },
  9971. hideCover: function () {
  9972. this.cover.style.display = 'none'
  9973. },
  9974. showCover: function () {
  9975. var a = this,
  9976. b = domUtils.getXY(a.editor.ui.getDom()),
  9977. c = domUtils.getXY(a.editor.iframe)
  9978. domUtils.setStyles(a.cover, {
  9979. width: a.editor.iframe.offsetWidth + 'px',
  9980. height: a.editor.iframe.offsetHeight + 'px',
  9981. top: c.y - b.y + 'px',
  9982. left: c.x - b.x + 'px',
  9983. position: 'absolute',
  9984. display: ''
  9985. })
  9986. },
  9987. show: function (a) {
  9988. var b = this
  9989. ;(b.resizer.style.display = 'block'),
  9990. a && b.attachTo(a),
  9991. domUtils.on(
  9992. this.resizer,
  9993. 'mousedown',
  9994. b.proxy(b._eventHandler, b)
  9995. ),
  9996. domUtils.on(b.doc, 'mouseup', b.proxy(b._eventHandler, b)),
  9997. b.showCover(),
  9998. b.editor.fireEvent('afterscaleshow', b),
  9999. b.editor.fireEvent('saveScene')
  10000. },
  10001. hide: function () {
  10002. var a = this
  10003. a.hideCover(),
  10004. (a.resizer.style.display = 'none'),
  10005. domUtils.un(
  10006. a.resizer,
  10007. 'mousedown',
  10008. a.proxy(a._eventHandler, a)
  10009. ),
  10010. domUtils.un(a.doc, 'mouseup', a.proxy(a._eventHandler, a)),
  10011. a.editor.fireEvent('afterscalehide', a)
  10012. },
  10013. proxy: function (a, b) {
  10014. return function (c) {
  10015. return a.apply(b || this, arguments)
  10016. }
  10017. },
  10018. attachTo: function (a) {
  10019. var b = this,
  10020. c = (b.target = a),
  10021. d = this.resizer,
  10022. e = domUtils.getXY(c),
  10023. f = domUtils.getXY(b.editor.iframe),
  10024. g = domUtils.getXY(d.parentNode)
  10025. domUtils.setStyles(d, {
  10026. width: c.width + 'px',
  10027. height: c.height + 'px',
  10028. left:
  10029. f.x +
  10030. e.x -
  10031. b.editor.document.body.scrollLeft -
  10032. g.x -
  10033. parseInt(d.style.borderLeftWidth) +
  10034. 'px',
  10035. top:
  10036. f.y +
  10037. e.y -
  10038. b.editor.document.body.scrollTop -
  10039. g.y -
  10040. parseInt(d.style.borderTopWidth) +
  10041. 'px'
  10042. })
  10043. }
  10044. }
  10045. })(),
  10046. function () {
  10047. var b,
  10048. c = this
  10049. c.setOpt('imageScaleEnabled', !0),
  10050. !browser.ie &&
  10051. c.options.imageScaleEnabled &&
  10052. c.addListener('click', function (d, e) {
  10053. var f = c.selection.getRange(),
  10054. g = f.getClosedNode()
  10055. if (
  10056. g &&
  10057. 'IMG' == g.tagName &&
  10058. 'false' != c.body.contentEditable
  10059. ) {
  10060. if (
  10061. g.className.indexOf('edui-faked-music') != -1 ||
  10062. g.getAttribute('anchorname') ||
  10063. domUtils.hasClass(g, 'loadingclass') ||
  10064. domUtils.hasClass(g, 'loaderrorclass')
  10065. )
  10066. return
  10067. if (!b) {
  10068. ;(b = new a()),
  10069. b.init(c),
  10070. c.ui.getDom().appendChild(b.resizer)
  10071. var h,
  10072. i = function (a) {
  10073. b.hide(),
  10074. b.target &&
  10075. c.selection.getRange().selectNode(b.target).select()
  10076. },
  10077. j = function (a) {
  10078. var b = a.target || a.srcElement
  10079. !b ||
  10080. (void 0 !== b.className &&
  10081. b.className.indexOf('edui-editor-imagescale') !=
  10082. -1) ||
  10083. i(a)
  10084. }
  10085. c.addListener('afterscaleshow', function (a) {
  10086. c.addListener('beforekeydown', i),
  10087. c.addListener('beforemousedown', j),
  10088. domUtils.on(document, 'keydown', i),
  10089. domUtils.on(document, 'mousedown', j),
  10090. c.selection.getNative().removeAllRanges()
  10091. }),
  10092. c.addListener('afterscalehide', function (a) {
  10093. c.removeListener('beforekeydown', i),
  10094. c.removeListener('beforemousedown', j),
  10095. domUtils.un(document, 'keydown', i),
  10096. domUtils.un(document, 'mousedown', j)
  10097. var d = b.target
  10098. d.parentNode &&
  10099. c.selection.getRange().selectNode(d).select()
  10100. }),
  10101. domUtils.on(b.resizer, 'mousedown', function (a) {
  10102. c.selection.getNative().removeAllRanges()
  10103. var d = a.target || a.srcElement
  10104. d &&
  10105. d.className.indexOf('edui-editor-imagescale-hand') ==
  10106. -1 &&
  10107. (h = setTimeout(function () {
  10108. b.hide(),
  10109. b.target &&
  10110. c.selection.getRange().selectNode(d).select()
  10111. }, 200))
  10112. }),
  10113. domUtils.on(b.resizer, 'mouseup', function (a) {
  10114. var b = a.target || a.srcElement
  10115. b &&
  10116. b.className.indexOf('edui-editor-imagescale-hand') ==
  10117. -1 &&
  10118. clearTimeout(h)
  10119. })
  10120. }
  10121. b.show(g)
  10122. } else b && 'none' != b.resizer.style.display && b.hide()
  10123. }),
  10124. browser.webkit &&
  10125. c.addListener('click', function (a, b) {
  10126. if (
  10127. 'IMG' == b.target.tagName &&
  10128. 'false' != c.body.contentEditable
  10129. ) {
  10130. var d = new dom.Range(c.document)
  10131. d.selectNode(b.target).select()
  10132. }
  10133. })
  10134. }
  10135. )
  10136. })()),
  10137. UE.plugin.register(
  10138. 'autolink',
  10139. function () {
  10140. var a = 0
  10141. return browser.ie
  10142. ? {}
  10143. : {
  10144. bindEvents: {
  10145. reset: function () {
  10146. a = 0
  10147. },
  10148. keydown: function (a, b) {
  10149. var c = this,
  10150. d = b.keyCode || b.which
  10151. if (32 == d || 13 == d) {
  10152. for (
  10153. var e,
  10154. f,
  10155. g = c.selection.getNative(),
  10156. h = g.getRangeAt(0).cloneRange(),
  10157. i = h.startContainer;
  10158. 1 == i.nodeType &&
  10159. h.startOffset > 0 &&
  10160. (i = h.startContainer.childNodes[h.startOffset - 1]);
  10161. )
  10162. h.setStart(
  10163. i,
  10164. 1 == i.nodeType
  10165. ? i.childNodes.length
  10166. : i.nodeValue.length
  10167. ),
  10168. h.collapse(!0),
  10169. (i = h.startContainer)
  10170. do {
  10171. if (0 == h.startOffset) {
  10172. for (
  10173. i = h.startContainer.previousSibling;
  10174. i && 1 == i.nodeType;
  10175. )
  10176. i = i.lastChild
  10177. if (!i || domUtils.isFillChar(i)) break
  10178. e = i.nodeValue.length
  10179. } else (i = h.startContainer), (e = h.startOffset)
  10180. h.setStart(i, e - 1), (f = h.toString().charCodeAt(0))
  10181. } while (160 != f && 32 != f)
  10182. if (
  10183. h
  10184. .toString()
  10185. .replace(new RegExp(domUtils.fillChar, 'g'), '')
  10186. .match(
  10187. /(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i
  10188. )
  10189. ) {
  10190. for (
  10191. ;
  10192. h.toString().length &&
  10193. !/^(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i.test(
  10194. h.toString()
  10195. );
  10196. )
  10197. try {
  10198. h.setStart(h.startContainer, h.startOffset + 1)
  10199. } catch (j) {
  10200. for (
  10201. var i = h.startContainer;
  10202. !(next = i.nextSibling);
  10203. ) {
  10204. if (domUtils.isBody(i)) return
  10205. i = i.parentNode
  10206. }
  10207. h.setStart(next, 0)
  10208. }
  10209. if (
  10210. domUtils.findParentByTagName(h.startContainer, 'a', !0)
  10211. )
  10212. return
  10213. var k,
  10214. l = c.document.createElement('a'),
  10215. m = c.document.createTextNode(' ')
  10216. c.undoManger && c.undoManger.save(),
  10217. l.appendChild(h.extractContents()),
  10218. (l.href = l.innerHTML =
  10219. l.innerHTML.replace(/<[^>]+>/g, '')),
  10220. (k = l
  10221. .getAttribute('href')
  10222. .replace(new RegExp(domUtils.fillChar, 'g'), '')),
  10223. (k = /^(?:https?:\/\/)/gi.test(k) ? k : 'http://' + k),
  10224. l.setAttribute('_src', utils.html(k)),
  10225. (l.href = utils.html(k)),
  10226. h.insertNode(l),
  10227. l.parentNode.insertBefore(m, l.nextSibling),
  10228. h.setStart(m, 0),
  10229. h.collapse(!0),
  10230. g.removeAllRanges(),
  10231. g.addRange(h),
  10232. c.undoManger && c.undoManger.save()
  10233. }
  10234. }
  10235. }
  10236. }
  10237. }
  10238. },
  10239. function () {
  10240. function a(a) {
  10241. if (3 == a.nodeType) return null
  10242. if ('A' == a.nodeName) return a
  10243. for (var b = a.lastChild; b; ) {
  10244. if ('A' == b.nodeName) return b
  10245. if (3 == b.nodeType) {
  10246. if (domUtils.isWhitespace(b)) {
  10247. b = b.previousSibling
  10248. continue
  10249. }
  10250. return null
  10251. }
  10252. b = b.lastChild
  10253. }
  10254. }
  10255. var b = { 37: 1, 38: 1, 39: 1, 40: 1, 13: 1, 32: 1 }
  10256. browser.ie &&
  10257. this.addListener('keyup', function (c, d) {
  10258. var e = this,
  10259. f = d.keyCode
  10260. if (b[f]) {
  10261. var g = e.selection.getRange(),
  10262. h = g.startContainer
  10263. if (13 == f) {
  10264. for (; h && !domUtils.isBody(h) && !domUtils.isBlockElm(h); )
  10265. h = h.parentNode
  10266. if (h && !domUtils.isBody(h) && 'P' == h.nodeName) {
  10267. var i = h.previousSibling
  10268. if (i && 1 == i.nodeType) {
  10269. var i = a(i)
  10270. i && !i.getAttribute('_href') && domUtils.remove(i, !0)
  10271. }
  10272. }
  10273. } else if (32 == f)
  10274. 3 == h.nodeType &&
  10275. /^\s$/.test(h.nodeValue) &&
  10276. ((h = h.previousSibling),
  10277. h &&
  10278. 'A' == h.nodeName &&
  10279. !h.getAttribute('_href') &&
  10280. domUtils.remove(h, !0))
  10281. else if (
  10282. ((h = domUtils.findParentByTagName(h, 'a', !0)),
  10283. h && !h.getAttribute('_href'))
  10284. ) {
  10285. var j = g.createBookmark()
  10286. domUtils.remove(h, !0), g.moveToBookmark(j).select(!0)
  10287. }
  10288. }
  10289. })
  10290. }
  10291. ),
  10292. (UE.plugins.autoheight = function () {
  10293. function a() {
  10294. var a = this
  10295. clearTimeout(e),
  10296. f ||
  10297. ((!a.queryCommandState ||
  10298. (a.queryCommandState && 1 != a.queryCommandState('source'))) &&
  10299. (e = setTimeout(function () {
  10300. for (var b = a.body.lastChild; b && 1 != b.nodeType; )
  10301. b = b.previousSibling
  10302. b &&
  10303. 1 == b.nodeType &&
  10304. ((b.style.clear = 'both'),
  10305. (d = Math.max(
  10306. domUtils.getXY(b).y + b.offsetHeight + 25,
  10307. Math.max(h.minFrameHeight, h.initialFrameHeight)
  10308. )),
  10309. d != g &&
  10310. (d !== parseInt(a.iframe.parentNode.style.height) &&
  10311. (a.iframe.parentNode.style.height = d + 'px'),
  10312. (a.body.style.height = d + 'px'),
  10313. (g = d)),
  10314. domUtils.removeStyle(b, 'clear'))
  10315. }, 50)))
  10316. }
  10317. var b = this
  10318. if (
  10319. ((b.autoHeightEnabled = b.options.autoHeightEnabled !== !1),
  10320. b.autoHeightEnabled)
  10321. ) {
  10322. var c,
  10323. d,
  10324. e,
  10325. f,
  10326. g = 0,
  10327. h = b.options
  10328. b.addListener('fullscreenchanged', function (a, b) {
  10329. f = b
  10330. }),
  10331. b.addListener('destroy', function () {
  10332. b.removeListener('contentchange afterinserthtml keyup mouseup', a)
  10333. }),
  10334. (b.enableAutoHeight = function () {
  10335. var b = this
  10336. if (b.autoHeightEnabled) {
  10337. var d = b.document
  10338. ;(b.autoHeightEnabled = !0),
  10339. (c = d.body.style.overflowY),
  10340. (d.body.style.overflowY = 'hidden'),
  10341. b.addListener('contentchange afterinserthtml keyup mouseup', a),
  10342. setTimeout(
  10343. function () {
  10344. a.call(b)
  10345. },
  10346. browser.gecko ? 100 : 0
  10347. ),
  10348. b.fireEvent('autoheightchanged', b.autoHeightEnabled)
  10349. }
  10350. }),
  10351. (b.disableAutoHeight = function () {
  10352. ;(b.body.style.overflowY = c || ''),
  10353. b.removeListener('contentchange', a),
  10354. b.removeListener('keyup', a),
  10355. b.removeListener('mouseup', a),
  10356. (b.autoHeightEnabled = !1),
  10357. b.fireEvent('autoheightchanged', b.autoHeightEnabled)
  10358. }),
  10359. b.on('setHeight', function () {
  10360. b.disableAutoHeight()
  10361. }),
  10362. b.addListener('ready', function () {
  10363. b.enableAutoHeight()
  10364. var c
  10365. domUtils.on(
  10366. browser.ie ? b.body : b.document,
  10367. browser.webkit ? 'dragover' : 'drop',
  10368. function () {
  10369. clearTimeout(c),
  10370. (c = setTimeout(function () {
  10371. a.call(b)
  10372. }, 100))
  10373. }
  10374. )
  10375. var d
  10376. window.onscroll = function () {
  10377. null === d
  10378. ? (d = this.scrollY)
  10379. : 0 == this.scrollY &&
  10380. 0 != d &&
  10381. (b.window.scrollTo(0, 0), (d = null))
  10382. }
  10383. })
  10384. }
  10385. }),
  10386. (UE.plugins.autofloat = function () {
  10387. function a() {
  10388. return UE.ui ? 1 : (alert(g.autofloatMsg), 0)
  10389. }
  10390. function b() {
  10391. var a = document.body.style
  10392. ;(a.backgroundImage = 'url("about:blank")'),
  10393. (a.backgroundAttachment = 'fixed')
  10394. }
  10395. function c() {
  10396. var a = domUtils.getXY(k),
  10397. b = domUtils.getComputedStyle(k, 'position'),
  10398. c = domUtils.getComputedStyle(k, 'left')
  10399. ;(k.style.width = k.offsetWidth + 'px'),
  10400. (k.style.zIndex = 1 * f.options.zIndex + 1),
  10401. k.parentNode.insertBefore(q, k),
  10402. o || (p && browser.ie)
  10403. ? ('absolute' != k.style.position &&
  10404. (k.style.position = 'absolute'),
  10405. (k.style.top =
  10406. (document.body.scrollTop ||
  10407. document.documentElement.scrollTop) -
  10408. l +
  10409. i +
  10410. 'px'))
  10411. : (browser.ie7Compat &&
  10412. r &&
  10413. ((r = !1),
  10414. (k.style.left =
  10415. domUtils.getXY(k).x -
  10416. document.documentElement.getBoundingClientRect().left +
  10417. 2 +
  10418. 'px')),
  10419. 'fixed' != k.style.position &&
  10420. ((k.style.position = 'fixed'),
  10421. (k.style.top = i + 'px'),
  10422. ('absolute' == b || 'relative' == b) &&
  10423. parseFloat(c) &&
  10424. (k.style.left = a.x + 'px')))
  10425. }
  10426. function d() {
  10427. ;(r = !0),
  10428. q.parentNode && q.parentNode.removeChild(q),
  10429. (k.style.cssText = j)
  10430. }
  10431. function e() {
  10432. var a = m(f.container),
  10433. b = f.options.toolbarTopOffset || 0
  10434. a.top < 0 && a.bottom - k.offsetHeight > b ? c() : d()
  10435. }
  10436. var f = this,
  10437. g = f.getLang()
  10438. f.setOpt({ topOffset: 0 })
  10439. var h = f.options.autoFloatEnabled !== !1,
  10440. i = f.options.topOffset
  10441. if (h) {
  10442. var j,
  10443. k,
  10444. l,
  10445. m,
  10446. n = UE.ui.uiUtils,
  10447. o = browser.ie && browser.version <= 6,
  10448. p = browser.quirks,
  10449. q = document.createElement('div'),
  10450. r = !0,
  10451. s = utils.defer(
  10452. function () {
  10453. e()
  10454. },
  10455. browser.ie ? 200 : 100,
  10456. !0
  10457. )
  10458. f.addListener('destroy', function () {
  10459. domUtils.un(window, ['scroll', 'resize'], e),
  10460. f.removeListener('keydown', s)
  10461. }),
  10462. f.addListener('ready', function () {
  10463. if (a(f)) {
  10464. if (!f.ui) return
  10465. ;(m = n.getClientRect),
  10466. (k = f.ui.getDom('toolbarbox')),
  10467. (l = m(k).top),
  10468. (j = k.style.cssText),
  10469. (q.style.height = k.offsetHeight + 'px'),
  10470. o && b(),
  10471. domUtils.on(window, ['scroll', 'resize'], e),
  10472. f.addListener('keydown', s),
  10473. f.addListener('beforefullscreenchange', function (a, b) {
  10474. b && d()
  10475. }),
  10476. f.addListener('fullscreenchanged', function (a, b) {
  10477. b || e()
  10478. }),
  10479. f.addListener('sourcemodechanged', function (a, b) {
  10480. setTimeout(function () {
  10481. e()
  10482. }, 0)
  10483. }),
  10484. f.addListener('clearDoc', function () {
  10485. setTimeout(function () {
  10486. e()
  10487. }, 0)
  10488. })
  10489. }
  10490. })
  10491. }
  10492. }),
  10493. (UE.plugins.video = function () {
  10494. function a(a, b, d, e, f, g, h) {
  10495. ;(a = utils.unhtmlForUrl(a)),
  10496. (f = utils.unhtml(f)),
  10497. (g = utils.unhtml(g).trim()),
  10498. (b = parseInt(b, 10) || 0),
  10499. (d = parseInt(d, 10) || 0)
  10500. var i
  10501. switch (h) {
  10502. case 'image':
  10503. i =
  10504. '<img ' +
  10505. (e ? 'id="' + e + '"' : '') +
  10506. ' width="' +
  10507. b +
  10508. '" height="' +
  10509. d +
  10510. '" _url="' +
  10511. a +
  10512. '" class="' +
  10513. g.replace(/\bvideo-js\b/, '') +
  10514. '" src="' +
  10515. c.options.UEDITOR_HOME_URL +
  10516. 'themes/default/images/spacer.gif" style="background:url(' +
  10517. c.options.UEDITOR_HOME_URL +
  10518. 'themes/default/images/videologo.gif) no-repeat center center; border:1px solid gray;' +
  10519. (f ? 'float:' + f + ';' : '') +
  10520. '" />'
  10521. break
  10522. case 'embed':
  10523. i =
  10524. '<embed type="application/x-shockwave-flash" class="' +
  10525. g +
  10526. '" pluginspage="http://www.macromedia.com/go/getflashplayer" src="' +
  10527. utils.html(a) +
  10528. '" width="' +
  10529. b +
  10530. '" height="' +
  10531. d +
  10532. '"' +
  10533. (f ? ' style="float:' + f + '"' : '') +
  10534. ' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" >'
  10535. break
  10536. case 'video':
  10537. var j = a.substr(a.lastIndexOf('.') + 1)
  10538. 'ogv' == j && (j = 'ogg'),
  10539. (i =
  10540. '<video' +
  10541. (e ? ' id="' + e + '"' : '') +
  10542. ' class="' +
  10543. g +
  10544. ' video-js" ' +
  10545. (f ? ' style="float:' + f + '"' : '') +
  10546. ' controls preload="none" width="' +
  10547. b +
  10548. '" height="' +
  10549. d +
  10550. '" src="' +
  10551. a +
  10552. '" data-setup="{}"><source src="' +
  10553. a +
  10554. '" type="video/' +
  10555. j +
  10556. '" /></video>')
  10557. }
  10558. return i
  10559. }
  10560. function b(b, c) {
  10561. utils.each(
  10562. b.getNodesByTagName(c ? 'img' : 'embed video'),
  10563. function (b) {
  10564. var d = b.getAttr('class')
  10565. if (d && d.indexOf('edui-faked-video') != -1) {
  10566. var e = a(
  10567. c ? b.getAttr('_url') : b.getAttr('src'),
  10568. b.getAttr('width'),
  10569. b.getAttr('height'),
  10570. null,
  10571. b.getStyle('float') || '',
  10572. d,
  10573. c ? 'embed' : 'image'
  10574. )
  10575. b.parentNode.replaceChild(UE.uNode.createElement(e), b)
  10576. }
  10577. if (d && d.indexOf('edui-upload-video') != -1) {
  10578. var e = a(
  10579. c ? b.getAttr('_url') : b.getAttr('src'),
  10580. b.getAttr('width'),
  10581. b.getAttr('height'),
  10582. null,
  10583. b.getStyle('float') || '',
  10584. d,
  10585. c ? 'video' : 'image'
  10586. )
  10587. b.parentNode.replaceChild(UE.uNode.createElement(e), b)
  10588. }
  10589. }
  10590. )
  10591. }
  10592. var c = this
  10593. c.addOutputRule(function (a) {
  10594. b(a, !0)
  10595. }),
  10596. c.addInputRule(function (a) {
  10597. b(a)
  10598. }),
  10599. (c.commands.insertvideo = {
  10600. execCommand: function (b, d, e) {
  10601. d = utils.isArray(d) ? d : [d]
  10602. for (
  10603. var f, g, h = [], i = 'tmpVedio', j = 0, k = d.length;
  10604. j < k;
  10605. j++
  10606. )
  10607. (g = d[j]),
  10608. (f =
  10609. 'upload' == e
  10610. ? 'edui-upload-video video-js vjs-default-skin'
  10611. : 'edui-faked-video'),
  10612. h.push(
  10613. a(
  10614. g.url,
  10615. g.width || 420,
  10616. g.height || 280,
  10617. i + j,
  10618. null,
  10619. f,
  10620. 'image'
  10621. )
  10622. )
  10623. c.execCommand('inserthtml', h.join(''), !0)
  10624. for (
  10625. var l = this.selection.getRange(), j = 0, k = d.length;
  10626. j < k;
  10627. j++
  10628. ) {
  10629. var m = this.document.getElementById('tmpVedio' + j)
  10630. domUtils.removeAttributes(m, 'id'),
  10631. l.selectNode(m).select(),
  10632. c.execCommand('imagefloat', d[j].align)
  10633. }
  10634. },
  10635. queryCommandState: function () {
  10636. var a = c.selection.getRange().getClosedNode(),
  10637. b =
  10638. a &&
  10639. ('edui-faked-video' == a.className ||
  10640. a.className.indexOf('edui-upload-video') != -1)
  10641. return b ? 1 : 0
  10642. }
  10643. })
  10644. }),
  10645. (function () {
  10646. function a(a) {}
  10647. var b = (UE.UETable = function (a) {
  10648. ;(this.table = a),
  10649. (this.indexTable = []),
  10650. (this.selectedTds = []),
  10651. (this.cellsRange = {}),
  10652. this.update(a)
  10653. })
  10654. ;(b.removeSelectedClass = function (a) {
  10655. utils.each(a, function (a) {
  10656. domUtils.removeClasses(a, 'selectTdClass')
  10657. })
  10658. }),
  10659. (b.addSelectedClass = function (a) {
  10660. utils.each(a, function (a) {
  10661. domUtils.addClass(a, 'selectTdClass')
  10662. })
  10663. }),
  10664. (b.isEmptyBlock = function (a) {
  10665. var b = new RegExp(domUtils.fillChar, 'g')
  10666. if (
  10667. a[browser.ie ? 'innerText' : 'textContent']
  10668. .replace(/^\s*$/, '')
  10669. .replace(b, '').length > 0
  10670. )
  10671. return 0
  10672. for (var c in dtd.$isNotEmpty)
  10673. if (
  10674. dtd.$isNotEmpty.hasOwnProperty(c) &&
  10675. a.getElementsByTagName(c).length
  10676. )
  10677. return 0
  10678. return 1
  10679. }),
  10680. (b.getWidth = function (a) {
  10681. return a ? parseInt(domUtils.getComputedStyle(a, 'width'), 10) : 0
  10682. }),
  10683. (b.getTableCellAlignState = function (a) {
  10684. !utils.isArray(a) && (a = [a])
  10685. var b = {},
  10686. c = ['align', 'valign'],
  10687. d = null,
  10688. e = !0
  10689. return (
  10690. utils.each(a, function (a) {
  10691. return (
  10692. utils.each(c, function (c) {
  10693. if (((d = a.getAttribute(c)), !b[c] && d)) b[c] = d
  10694. else if (!b[c] || d !== b[c]) return (e = !1), !1
  10695. }),
  10696. e
  10697. )
  10698. }),
  10699. e ? b : null
  10700. )
  10701. }),
  10702. (b.getTableItemsByRange = function (a) {
  10703. var b = a.selection.getStart()
  10704. b &&
  10705. b.id &&
  10706. 0 === b.id.indexOf('_baidu_bookmark_start_') &&
  10707. b.nextSibling &&
  10708. (b = b.nextSibling)
  10709. var c = b && domUtils.findParentByTagName(b, ['td', 'th'], !0),
  10710. d = c && c.parentNode,
  10711. e = b && domUtils.findParentByTagName(b, 'caption', !0),
  10712. f = e ? e.parentNode : d && d.parentNode.parentNode
  10713. return { cell: c, tr: d, table: f, caption: e }
  10714. }),
  10715. (b.getUETableBySelected = function (a) {
  10716. var c = b.getTableItemsByRange(a).table
  10717. return c && c.ueTable && c.ueTable.selectedTds.length
  10718. ? c.ueTable
  10719. : null
  10720. }),
  10721. (b.getDefaultValue = function (a, b) {
  10722. var c,
  10723. d,
  10724. e,
  10725. f,
  10726. g = { thin: '0px', medium: '1px', thick: '2px' }
  10727. if (b)
  10728. return (
  10729. (h = b.getElementsByTagName('td')[0]),
  10730. (f = domUtils.getComputedStyle(b, 'border-left-width')),
  10731. (c = parseInt(g[f] || f, 10)),
  10732. (f = domUtils.getComputedStyle(h, 'padding-left')),
  10733. (d = parseInt(g[f] || f, 10)),
  10734. (f = domUtils.getComputedStyle(h, 'border-left-width')),
  10735. (e = parseInt(g[f] || f, 10)),
  10736. { tableBorder: c, tdPadding: d, tdBorder: e }
  10737. )
  10738. ;(b = a.document.createElement('table')),
  10739. (b.insertRow(0).insertCell(0).innerHTML = 'xxx'),
  10740. a.body.appendChild(b)
  10741. var h = b.getElementsByTagName('td')[0]
  10742. return (
  10743. (f = domUtils.getComputedStyle(b, 'border-left-width')),
  10744. (c = parseInt(g[f] || f, 10)),
  10745. (f = domUtils.getComputedStyle(h, 'padding-left')),
  10746. (d = parseInt(g[f] || f, 10)),
  10747. (f = domUtils.getComputedStyle(h, 'border-left-width')),
  10748. (e = parseInt(g[f] || f, 10)),
  10749. domUtils.remove(b),
  10750. { tableBorder: c, tdPadding: d, tdBorder: e }
  10751. )
  10752. }),
  10753. (b.getUETable = function (a) {
  10754. var c = a.tagName.toLowerCase()
  10755. return (
  10756. (a =
  10757. 'td' == c || 'th' == c || 'caption' == c
  10758. ? domUtils.findParentByTagName(a, 'table', !0)
  10759. : a),
  10760. a.ueTable || (a.ueTable = new b(a)),
  10761. a.ueTable
  10762. )
  10763. }),
  10764. (b.cloneCell = function (a, b, c) {
  10765. if (!a || utils.isString(a))
  10766. return this.table.ownerDocument.createElement(a || 'td')
  10767. var d = domUtils.hasClass(a, 'selectTdClass')
  10768. d && domUtils.removeClasses(a, 'selectTdClass')
  10769. var e = a.cloneNode(!0)
  10770. return (
  10771. b && (e.rowSpan = e.colSpan = 1),
  10772. !c && domUtils.removeAttributes(e, 'width height'),
  10773. !c && domUtils.removeAttributes(e, 'style'),
  10774. (e.style.borderLeftStyle = ''),
  10775. (e.style.borderTopStyle = ''),
  10776. (e.style.borderLeftColor = a.style.borderRightColor),
  10777. (e.style.borderLeftWidth = a.style.borderRightWidth),
  10778. (e.style.borderTopColor = a.style.borderBottomColor),
  10779. (e.style.borderTopWidth = a.style.borderBottomWidth),
  10780. d && domUtils.addClass(a, 'selectTdClass'),
  10781. e
  10782. )
  10783. }),
  10784. (b.prototype = {
  10785. getMaxRows: function () {
  10786. for (var a, b = this.table.rows, c = 1, d = 0; (a = b[d]); d++) {
  10787. for (var e, f = 1, g = 0; (e = a.cells[g++]); )
  10788. f = Math.max(e.rowSpan || 1, f)
  10789. c = Math.max(f + d, c)
  10790. }
  10791. return c
  10792. },
  10793. getMaxCols: function () {
  10794. for (
  10795. var a, b = this.table.rows, c = 0, d = {}, e = 0;
  10796. (a = b[e]);
  10797. e++
  10798. ) {
  10799. for (var f, g = 0, h = 0; (f = a.cells[h++]); )
  10800. if (((g += f.colSpan || 1), f.rowSpan && f.rowSpan > 1))
  10801. for (var i = 1; i < f.rowSpan; i++)
  10802. d['row_' + (e + i)]
  10803. ? d['row_' + (e + i)]++
  10804. : (d['row_' + (e + i)] = f.colSpan || 1)
  10805. ;(g += d['row_' + e] || 0), (c = Math.max(g, c))
  10806. }
  10807. return c
  10808. },
  10809. getCellColIndex: function (a) {},
  10810. getHSideCell: function (b, c) {
  10811. try {
  10812. var d,
  10813. e,
  10814. f = this.getCellInfo(b),
  10815. g = this.selectedTds.length,
  10816. h = this.cellsRange
  10817. return (!c && (g ? !h.beginColIndex : !f.colIndex)) ||
  10818. (c &&
  10819. (g
  10820. ? h.endColIndex == this.colsNum - 1
  10821. : f.colIndex == this.colsNum - 1))
  10822. ? null
  10823. : ((d = g ? h.beginRowIndex : f.rowIndex),
  10824. (e = c
  10825. ? g
  10826. ? h.endColIndex + 1
  10827. : f.colIndex + 1
  10828. : g
  10829. ? h.beginColIndex - 1
  10830. : f.colIndex < 1
  10831. ? 0
  10832. : f.colIndex - 1),
  10833. this.getCell(
  10834. this.indexTable[d][e].rowIndex,
  10835. this.indexTable[d][e].cellIndex
  10836. ))
  10837. } catch (i) {
  10838. a(i)
  10839. }
  10840. },
  10841. getTabNextCell: function (a, b) {
  10842. var c,
  10843. d = this.getCellInfo(a),
  10844. e = b || d.rowIndex,
  10845. f = d.colIndex + 1 + (d.colSpan - 1)
  10846. try {
  10847. c = this.getCell(
  10848. this.indexTable[e][f].rowIndex,
  10849. this.indexTable[e][f].cellIndex
  10850. )
  10851. } catch (g) {
  10852. try {
  10853. ;(e = 1 * e + 1),
  10854. (f = 0),
  10855. (c = this.getCell(
  10856. this.indexTable[e][f].rowIndex,
  10857. this.indexTable[e][f].cellIndex
  10858. ))
  10859. } catch (g) {}
  10860. }
  10861. return c
  10862. },
  10863. getVSideCell: function (b, c, d) {
  10864. try {
  10865. var e,
  10866. f,
  10867. g = this.getCellInfo(b),
  10868. h = this.selectedTds.length && !d,
  10869. i = this.cellsRange
  10870. return (!c && 0 == g.rowIndex) ||
  10871. (c &&
  10872. (h
  10873. ? i.endRowIndex == this.rowsNum - 1
  10874. : g.rowIndex + g.rowSpan > this.rowsNum - 1))
  10875. ? null
  10876. : ((e = c
  10877. ? h
  10878. ? i.endRowIndex + 1
  10879. : g.rowIndex + g.rowSpan
  10880. : h
  10881. ? i.beginRowIndex - 1
  10882. : g.rowIndex - 1),
  10883. (f = h ? i.beginColIndex : g.colIndex),
  10884. this.getCell(
  10885. this.indexTable[e][f].rowIndex,
  10886. this.indexTable[e][f].cellIndex
  10887. ))
  10888. } catch (j) {
  10889. a(j)
  10890. }
  10891. },
  10892. getSameEndPosCells: function (b, c) {
  10893. try {
  10894. for (
  10895. var d = 'x' === c.toLowerCase(),
  10896. e =
  10897. domUtils.getXY(b)[d ? 'x' : 'y'] +
  10898. b['offset' + (d ? 'Width' : 'Height')],
  10899. f = this.table.rows,
  10900. g = null,
  10901. h = [],
  10902. i = 0;
  10903. i < this.rowsNum;
  10904. i++
  10905. ) {
  10906. g = f[i].cells
  10907. for (var j, k = 0; (j = g[k++]); ) {
  10908. var l =
  10909. domUtils.getXY(j)[d ? 'x' : 'y'] +
  10910. j['offset' + (d ? 'Width' : 'Height')]
  10911. if (l > e && d) break
  10912. if (
  10913. (b == j || e == l) &&
  10914. (1 == j[d ? 'colSpan' : 'rowSpan'] && h.push(j), d)
  10915. )
  10916. break
  10917. }
  10918. }
  10919. return h
  10920. } catch (m) {
  10921. a(m)
  10922. }
  10923. },
  10924. setCellContent: function (a, b) {
  10925. a.innerHTML = b || (browser.ie ? domUtils.fillChar : '<br />')
  10926. },
  10927. cloneCell: b.cloneCell,
  10928. getSameStartPosXCells: function (b) {
  10929. try {
  10930. for (
  10931. var c,
  10932. d = domUtils.getXY(b).x + b.offsetWidth,
  10933. e = this.table.rows,
  10934. f = [],
  10935. g = 0;
  10936. g < this.rowsNum;
  10937. g++
  10938. ) {
  10939. c = e[g].cells
  10940. for (var h, i = 0; (h = c[i++]); ) {
  10941. var j = domUtils.getXY(h).x
  10942. if (j > d) break
  10943. if (j == d && 1 == h.colSpan) {
  10944. f.push(h)
  10945. break
  10946. }
  10947. }
  10948. }
  10949. return f
  10950. } catch (k) {
  10951. a(k)
  10952. }
  10953. },
  10954. update: function (a) {
  10955. ;(this.table = a || this.table),
  10956. (this.selectedTds = []),
  10957. (this.cellsRange = {}),
  10958. (this.indexTable = [])
  10959. for (
  10960. var b = this.table.rows,
  10961. c = this.getMaxRows(),
  10962. d = c - b.length,
  10963. e = this.getMaxCols();
  10964. d--;
  10965. )
  10966. this.table.insertRow(b.length)
  10967. ;(this.rowsNum = c), (this.colsNum = e)
  10968. for (var f = 0, g = b.length; f < g; f++)
  10969. this.indexTable[f] = new Array(e)
  10970. for (var h, i = 0; (h = b[i]); i++)
  10971. for (var j, k = 0, l = h.cells; (j = l[k]); k++) {
  10972. j.rowSpan > c && (j.rowSpan = c)
  10973. for (
  10974. var m = k, n = j.rowSpan || 1, o = j.colSpan || 1;
  10975. this.indexTable[i][m];
  10976. )
  10977. m++
  10978. for (var p = 0; p < n; p++)
  10979. for (var q = 0; q < o; q++)
  10980. this.indexTable[i + p][m + q] = {
  10981. rowIndex: i,
  10982. cellIndex: k,
  10983. colIndex: m,
  10984. rowSpan: n,
  10985. colSpan: o
  10986. }
  10987. }
  10988. for (p = 0; p < c; p++)
  10989. for (q = 0; q < e; q++)
  10990. void 0 === this.indexTable[p][q] &&
  10991. ((h = b[p]),
  10992. (j = h.cells[h.cells.length - 1]),
  10993. (j = j
  10994. ? j.cloneNode(!0)
  10995. : this.table.ownerDocument.createElement('td')),
  10996. this.setCellContent(j),
  10997. 1 !== j.colSpan && (j.colSpan = 1),
  10998. 1 !== j.rowSpan && (j.rowSpan = 1),
  10999. h.appendChild(j),
  11000. (this.indexTable[p][q] = {
  11001. rowIndex: p,
  11002. cellIndex: j.cellIndex,
  11003. colIndex: q,
  11004. rowSpan: 1,
  11005. colSpan: 1
  11006. }))
  11007. var r = domUtils.getElementsByTagName(this.table, 'td'),
  11008. s = []
  11009. if (
  11010. (utils.each(r, function (a) {
  11011. domUtils.hasClass(a, 'selectTdClass') && s.push(a)
  11012. }),
  11013. s.length)
  11014. ) {
  11015. var t = s[0],
  11016. u = s[s.length - 1],
  11017. v = this.getCellInfo(t),
  11018. w = this.getCellInfo(u)
  11019. ;(this.selectedTds = s),
  11020. (this.cellsRange = {
  11021. beginRowIndex: v.rowIndex,
  11022. beginColIndex: v.colIndex,
  11023. endRowIndex: w.rowIndex + w.rowSpan - 1,
  11024. endColIndex: w.colIndex + w.colSpan - 1
  11025. })
  11026. }
  11027. if (!domUtils.hasClass(this.table.rows[0], 'firstRow')) {
  11028. domUtils.addClass(this.table.rows[0], 'firstRow')
  11029. for (var f = 1; f < this.table.rows.length; f++)
  11030. domUtils.removeClasses(this.table.rows[f], 'firstRow')
  11031. }
  11032. },
  11033. getCellInfo: function (a) {
  11034. if (a)
  11035. for (
  11036. var b = a.cellIndex,
  11037. c = a.parentNode.rowIndex,
  11038. d = this.indexTable[c],
  11039. e = this.colsNum,
  11040. f = b;
  11041. f < e;
  11042. f++
  11043. ) {
  11044. var g = d[f]
  11045. if (g.rowIndex === c && g.cellIndex === b) return g
  11046. }
  11047. },
  11048. getCell: function (a, b) {
  11049. return (a < this.rowsNum && this.table.rows[a].cells[b]) || null
  11050. },
  11051. deleteCell: function (a, b) {
  11052. b = 'number' == typeof b ? b : a.parentNode.rowIndex
  11053. var c = this.table.rows[b]
  11054. c.deleteCell(a.cellIndex)
  11055. },
  11056. getCellsRange: function (a, b) {
  11057. function c(a, b, e, f) {
  11058. var g,
  11059. h,
  11060. i,
  11061. j = a,
  11062. k = b,
  11063. l = e,
  11064. m = f
  11065. if (a > 0)
  11066. for (h = b; h < f; h++)
  11067. (g = d.indexTable[a][h]),
  11068. (i = g.rowIndex),
  11069. i < a && (j = Math.min(i, j))
  11070. if (f < d.colsNum)
  11071. for (i = a; i < e; i++)
  11072. (g = d.indexTable[i][f]),
  11073. (h = g.colIndex + g.colSpan - 1),
  11074. h > f && (m = Math.max(h, m))
  11075. if (e < d.rowsNum)
  11076. for (h = b; h < f; h++)
  11077. (g = d.indexTable[e][h]),
  11078. (i = g.rowIndex + g.rowSpan - 1),
  11079. i > e && (l = Math.max(i, l))
  11080. if (b > 0)
  11081. for (i = a; i < e; i++)
  11082. (g = d.indexTable[i][b]),
  11083. (h = g.colIndex),
  11084. h < b && (k = Math.min(g.colIndex, k))
  11085. return j != a || k != b || l != e || m != f
  11086. ? c(j, k, l, m)
  11087. : {
  11088. beginRowIndex: a,
  11089. beginColIndex: b,
  11090. endRowIndex: e,
  11091. endColIndex: f
  11092. }
  11093. }
  11094. try {
  11095. var d = this,
  11096. e = d.getCellInfo(a)
  11097. if (a === b)
  11098. return {
  11099. beginRowIndex: e.rowIndex,
  11100. beginColIndex: e.colIndex,
  11101. endRowIndex: e.rowIndex + e.rowSpan - 1,
  11102. endColIndex: e.colIndex + e.colSpan - 1
  11103. }
  11104. var f = d.getCellInfo(b),
  11105. g = Math.min(e.rowIndex, f.rowIndex),
  11106. h = Math.min(e.colIndex, f.colIndex),
  11107. i = Math.max(
  11108. e.rowIndex + e.rowSpan - 1,
  11109. f.rowIndex + f.rowSpan - 1
  11110. ),
  11111. j = Math.max(
  11112. e.colIndex + e.colSpan - 1,
  11113. f.colIndex + f.colSpan - 1
  11114. )
  11115. return c(g, h, i, j)
  11116. } catch (k) {}
  11117. },
  11118. getCells: function (a) {
  11119. this.clearSelected()
  11120. for (
  11121. var b,
  11122. c,
  11123. d,
  11124. e = a.beginRowIndex,
  11125. f = a.beginColIndex,
  11126. g = a.endRowIndex,
  11127. h = a.endColIndex,
  11128. i = {},
  11129. j = [],
  11130. k = e;
  11131. k <= g;
  11132. k++
  11133. )
  11134. for (var l = f; l <= h; l++) {
  11135. ;(b = this.indexTable[k][l]), (c = b.rowIndex), (d = b.colIndex)
  11136. var m = c + '|' + d
  11137. if (!i[m]) {
  11138. if (
  11139. ((i[m] = 1),
  11140. c < k ||
  11141. d < l ||
  11142. c + b.rowSpan - 1 > g ||
  11143. d + b.colSpan - 1 > h)
  11144. )
  11145. return null
  11146. j.push(this.getCell(c, b.cellIndex))
  11147. }
  11148. }
  11149. return j
  11150. },
  11151. clearSelected: function () {
  11152. b.removeSelectedClass(this.selectedTds),
  11153. (this.selectedTds = []),
  11154. (this.cellsRange = {})
  11155. },
  11156. setSelected: function (a) {
  11157. var c = this.getCells(a)
  11158. b.addSelectedClass(c), (this.selectedTds = c), (this.cellsRange = a)
  11159. },
  11160. isFullRow: function () {
  11161. var a = this.cellsRange
  11162. return a.endColIndex - a.beginColIndex + 1 == this.colsNum
  11163. },
  11164. isFullCol: function () {
  11165. var a = this.cellsRange,
  11166. b = this.table,
  11167. c = b.getElementsByTagName('th'),
  11168. d = a.endRowIndex - a.beginRowIndex + 1
  11169. return c.length
  11170. ? d == this.rowsNum || d == this.rowsNum - 1
  11171. : d == this.rowsNum
  11172. },
  11173. getNextCell: function (b, c, d) {
  11174. try {
  11175. var e,
  11176. f,
  11177. g = this.getCellInfo(b),
  11178. h = this.selectedTds.length && !d,
  11179. i = this.cellsRange
  11180. return (!c && 0 == g.rowIndex) ||
  11181. (c &&
  11182. (h
  11183. ? i.endRowIndex == this.rowsNum - 1
  11184. : g.rowIndex + g.rowSpan > this.rowsNum - 1))
  11185. ? null
  11186. : ((e = c
  11187. ? h
  11188. ? i.endRowIndex + 1
  11189. : g.rowIndex + g.rowSpan
  11190. : h
  11191. ? i.beginRowIndex - 1
  11192. : g.rowIndex - 1),
  11193. (f = h ? i.beginColIndex : g.colIndex),
  11194. this.getCell(
  11195. this.indexTable[e][f].rowIndex,
  11196. this.indexTable[e][f].cellIndex
  11197. ))
  11198. } catch (j) {
  11199. a(j)
  11200. }
  11201. },
  11202. getPreviewCell: function (b, c) {
  11203. try {
  11204. var d,
  11205. e,
  11206. f = this.getCellInfo(b),
  11207. g = this.selectedTds.length,
  11208. h = this.cellsRange
  11209. return (!c && (g ? !h.beginColIndex : !f.colIndex)) ||
  11210. (c &&
  11211. (g
  11212. ? h.endColIndex == this.colsNum - 1
  11213. : f.rowIndex > this.colsNum - 1))
  11214. ? null
  11215. : ((d = c
  11216. ? g
  11217. ? h.beginRowIndex
  11218. : f.rowIndex < 1
  11219. ? 0
  11220. : f.rowIndex - 1
  11221. : g
  11222. ? h.beginRowIndex
  11223. : f.rowIndex),
  11224. (e = c
  11225. ? g
  11226. ? h.endColIndex + 1
  11227. : f.colIndex
  11228. : g
  11229. ? h.beginColIndex - 1
  11230. : f.colIndex < 1
  11231. ? 0
  11232. : f.colIndex - 1),
  11233. this.getCell(
  11234. this.indexTable[d][e].rowIndex,
  11235. this.indexTable[d][e].cellIndex
  11236. ))
  11237. } catch (i) {
  11238. a(i)
  11239. }
  11240. },
  11241. moveContent: function (a, c) {
  11242. if (!b.isEmptyBlock(c)) {
  11243. if (b.isEmptyBlock(a)) return void (a.innerHTML = c.innerHTML)
  11244. var d = a.lastChild
  11245. for (
  11246. (3 != d.nodeType && dtd.$block[d.tagName]) ||
  11247. a.appendChild(a.ownerDocument.createElement('br'));
  11248. (d = c.firstChild);
  11249. )
  11250. a.appendChild(d)
  11251. }
  11252. },
  11253. mergeRight: function (a) {
  11254. var b = this.getCellInfo(a),
  11255. c = b.colIndex + b.colSpan,
  11256. d = this.indexTable[b.rowIndex][c],
  11257. e = this.getCell(d.rowIndex, d.cellIndex)
  11258. ;(a.colSpan = b.colSpan + d.colSpan),
  11259. a.removeAttribute('width'),
  11260. this.moveContent(a, e),
  11261. this.deleteCell(e, d.rowIndex),
  11262. this.update()
  11263. },
  11264. mergeDown: function (a) {
  11265. var b = this.getCellInfo(a),
  11266. c = b.rowIndex + b.rowSpan,
  11267. d = this.indexTable[c][b.colIndex],
  11268. e = this.getCell(d.rowIndex, d.cellIndex)
  11269. ;(a.rowSpan = b.rowSpan + d.rowSpan),
  11270. a.removeAttribute('height'),
  11271. this.moveContent(a, e),
  11272. this.deleteCell(e, d.rowIndex),
  11273. this.update()
  11274. },
  11275. mergeRange: function () {
  11276. var a = this.cellsRange,
  11277. b = this.getCell(
  11278. a.beginRowIndex,
  11279. this.indexTable[a.beginRowIndex][a.beginColIndex].cellIndex
  11280. )
  11281. if ('TH' == b.tagName && a.endRowIndex !== a.beginRowIndex) {
  11282. var c = this.indexTable,
  11283. d = this.getCellInfo(b)
  11284. ;(b = this.getCell(1, c[1][d.colIndex].cellIndex)),
  11285. (a = this.getCellsRange(
  11286. b,
  11287. this.getCell(
  11288. c[this.rowsNum - 1][d.colIndex].rowIndex,
  11289. c[this.rowsNum - 1][d.colIndex].cellIndex
  11290. )
  11291. ))
  11292. }
  11293. for (var e, f = this.getCells(a), g = 0; (e = f[g++]); )
  11294. e !== b && (this.moveContent(b, e), this.deleteCell(e))
  11295. if (
  11296. ((b.rowSpan = a.endRowIndex - a.beginRowIndex + 1),
  11297. b.rowSpan > 1 && b.removeAttribute('height'),
  11298. (b.colSpan = a.endColIndex - a.beginColIndex + 1),
  11299. b.colSpan > 1 && b.removeAttribute('width'),
  11300. b.rowSpan == this.rowsNum && 1 != b.colSpan && (b.colSpan = 1),
  11301. b.colSpan == this.colsNum && 1 != b.rowSpan)
  11302. ) {
  11303. var h = b.parentNode.rowIndex
  11304. if (this.table.deleteRow)
  11305. for (var g = h + 1, i = h + 1, j = b.rowSpan; g < j; g++)
  11306. this.table.deleteRow(i)
  11307. else
  11308. for (var g = 0, j = b.rowSpan - 1; g < j; g++) {
  11309. var k = this.table.rows[h + 1]
  11310. k.parentNode.removeChild(k)
  11311. }
  11312. b.rowSpan = 1
  11313. }
  11314. this.update()
  11315. },
  11316. insertRow: function (a, b) {
  11317. function c(a, b, c) {
  11318. if (0 == a) {
  11319. var d = c.nextSibling || c.previousSibling,
  11320. e = d.cells[a]
  11321. 'TH' == e.tagName &&
  11322. ((e = b.ownerDocument.createElement('th')),
  11323. e.appendChild(b.firstChild),
  11324. c.insertBefore(e, b),
  11325. domUtils.remove(b))
  11326. } else if ('TH' == b.tagName) {
  11327. var f = b.ownerDocument.createElement('td')
  11328. f.appendChild(b.firstChild),
  11329. c.insertBefore(f, b),
  11330. domUtils.remove(b)
  11331. }
  11332. }
  11333. var d,
  11334. e = this.colsNum,
  11335. f = this.table,
  11336. g = f.insertRow(a),
  11337. h = 'string' == typeof b && 'TH' == b.toUpperCase()
  11338. if (0 == a || a == this.rowsNum)
  11339. for (var i = 0; i < e; i++)
  11340. (d = this.cloneCell(b, !0)),
  11341. this.setCellContent(d),
  11342. d.getAttribute('vAlign') &&
  11343. d.setAttribute('vAlign', d.getAttribute('vAlign')),
  11344. g.appendChild(d),
  11345. h || c(i, d, g)
  11346. else {
  11347. var j = this.indexTable[a]
  11348. for (i = 0; i < e; i++) {
  11349. var k = j[i]
  11350. k.rowIndex < a
  11351. ? ((d = this.getCell(k.rowIndex, k.cellIndex)),
  11352. (d.rowSpan = k.rowSpan + 1))
  11353. : ((d = this.cloneCell(b, !0)),
  11354. this.setCellContent(d),
  11355. g.appendChild(d)),
  11356. h || c(i, d, g)
  11357. }
  11358. }
  11359. return this.update(), g
  11360. },
  11361. deleteRow: function (a) {
  11362. for (
  11363. var b = this.table.rows[a],
  11364. c = this.indexTable[a],
  11365. d = this.colsNum,
  11366. e = 0,
  11367. f = 0;
  11368. f < d;
  11369. ) {
  11370. var g = c[f],
  11371. h = this.getCell(g.rowIndex, g.cellIndex)
  11372. if (h.rowSpan > 1 && g.rowIndex == a) {
  11373. var i = h.cloneNode(!0)
  11374. ;(i.rowSpan = h.rowSpan - 1),
  11375. (i.innerHTML = ''),
  11376. (h.rowSpan = 1)
  11377. var j,
  11378. k = a + 1,
  11379. l = this.table.rows[k],
  11380. m = this.getPreviewMergedCellsNum(k, f) - e
  11381. m < f
  11382. ? ((j = f - m - 1), domUtils.insertAfter(l.cells[j], i))
  11383. : l.cells.length && l.insertBefore(i, l.cells[0]),
  11384. (e += 1)
  11385. }
  11386. f += h.colSpan || 1
  11387. }
  11388. var n = [],
  11389. o = {}
  11390. for (f = 0; f < d; f++) {
  11391. var p = c[f].rowIndex,
  11392. q = c[f].cellIndex,
  11393. r = p + '_' + q
  11394. o[r] || ((o[r] = 1), (h = this.getCell(p, q)), n.push(h))
  11395. }
  11396. var s = []
  11397. utils.each(n, function (a) {
  11398. 1 == a.rowSpan ? a.parentNode.removeChild(a) : s.push(a)
  11399. }),
  11400. utils.each(s, function (a) {
  11401. a.rowSpan--
  11402. }),
  11403. b.parentNode.removeChild(b),
  11404. this.update()
  11405. },
  11406. insertCol: function (a, b, c) {
  11407. function d(a, b, c) {
  11408. if (0 == a) {
  11409. var d = b.nextSibling || b.previousSibling
  11410. 'TH' == d.tagName &&
  11411. ((d = b.ownerDocument.createElement('th')),
  11412. d.appendChild(b.firstChild),
  11413. c.insertBefore(d, b),
  11414. domUtils.remove(b))
  11415. } else if ('TH' == b.tagName) {
  11416. var e = b.ownerDocument.createElement('td')
  11417. e.appendChild(b.firstChild),
  11418. c.insertBefore(e, b),
  11419. domUtils.remove(b)
  11420. }
  11421. }
  11422. var e,
  11423. f,
  11424. g,
  11425. h = this.rowsNum,
  11426. i = 0,
  11427. j = parseInt(
  11428. (this.table.offsetWidth -
  11429. 20 * (this.colsNum + 1) -
  11430. (this.colsNum + 1)) /
  11431. (this.colsNum + 1),
  11432. 10
  11433. ),
  11434. k = 'string' == typeof b && 'TH' == b.toUpperCase()
  11435. if (0 == a || a == this.colsNum)
  11436. for (; i < h; i++)
  11437. (e = this.table.rows[i]),
  11438. (g = e.cells[0 == a ? a : e.cells.length]),
  11439. (f = this.cloneCell(b, !0)),
  11440. this.setCellContent(f),
  11441. f.setAttribute('vAlign', f.getAttribute('vAlign')),
  11442. g && f.setAttribute('width', g.getAttribute('width')),
  11443. a
  11444. ? domUtils.insertAfter(e.cells[e.cells.length - 1], f)
  11445. : e.insertBefore(f, e.cells[0]),
  11446. k || d(i, f, e)
  11447. else
  11448. for (; i < h; i++) {
  11449. var l = this.indexTable[i][a]
  11450. l.colIndex < a
  11451. ? ((f = this.getCell(l.rowIndex, l.cellIndex)),
  11452. (f.colSpan = l.colSpan + 1))
  11453. : ((e = this.table.rows[i]),
  11454. (g = e.cells[l.cellIndex]),
  11455. (f = this.cloneCell(b, !0)),
  11456. this.setCellContent(f),
  11457. f.setAttribute('vAlign', f.getAttribute('vAlign')),
  11458. g && f.setAttribute('width', g.getAttribute('width')),
  11459. g ? e.insertBefore(f, g) : e.appendChild(f)),
  11460. k || d(i, f, e)
  11461. }
  11462. this.update(),
  11463. this.updateWidth(j, c || { tdPadding: 10, tdBorder: 1 })
  11464. },
  11465. updateWidth: function (a, c) {
  11466. var d = this.table,
  11467. e = b.getWidth(d) - 2 * c.tdPadding - c.tdBorder + a
  11468. if (e < d.ownerDocument.body.offsetWidth)
  11469. return void d.setAttribute('width', e)
  11470. var f = domUtils.getElementsByTagName(this.table, 'td th')
  11471. utils.each(f, function (b) {
  11472. b.setAttribute('width', a)
  11473. })
  11474. },
  11475. deleteCol: function (a) {
  11476. for (
  11477. var b = this.indexTable,
  11478. c = this.table.rows,
  11479. d = this.table.getAttribute('width'),
  11480. e = 0,
  11481. f = this.rowsNum,
  11482. g = {},
  11483. h = 0;
  11484. h < f;
  11485. ) {
  11486. var i = b[h],
  11487. j = i[a],
  11488. k = j.rowIndex + '_' + j.colIndex
  11489. if (!g[k]) {
  11490. g[k] = 1
  11491. var l = this.getCell(j.rowIndex, j.cellIndex)
  11492. e ||
  11493. (e = l && parseInt(l.offsetWidth / l.colSpan, 10).toFixed(0)),
  11494. l.colSpan > 1 ? l.colSpan-- : c[h].deleteCell(j.cellIndex),
  11495. (h += j.rowSpan || 1)
  11496. }
  11497. }
  11498. this.table.setAttribute('width', d - e), this.update()
  11499. },
  11500. splitToCells: function (a) {
  11501. var b = this,
  11502. c = this.splitToRows(a)
  11503. utils.each(c, function (a) {
  11504. b.splitToCols(a)
  11505. })
  11506. },
  11507. splitToRows: function (a) {
  11508. var b = this.getCellInfo(a),
  11509. c = b.rowIndex,
  11510. d = b.colIndex,
  11511. e = []
  11512. ;(a.rowSpan = 1), e.push(a)
  11513. for (var f = c, g = c + b.rowSpan; f < g; f++)
  11514. if (f != c) {
  11515. var h = this.table.rows[f],
  11516. i = h.insertCell(d - this.getPreviewMergedCellsNum(f, d))
  11517. ;(i.colSpan = b.colSpan),
  11518. this.setCellContent(i),
  11519. i.setAttribute('vAlign', a.getAttribute('vAlign')),
  11520. i.setAttribute('align', a.getAttribute('align')),
  11521. a.style.cssText && (i.style.cssText = a.style.cssText),
  11522. e.push(i)
  11523. }
  11524. return this.update(), e
  11525. },
  11526. getPreviewMergedCellsNum: function (a, b) {
  11527. for (var c = this.indexTable[a], d = 0, e = 0; e < b; ) {
  11528. var f = c[e].colSpan,
  11529. g = c[e].rowIndex
  11530. ;(d += f - (g == a ? 1 : 0)), (e += f)
  11531. }
  11532. return d
  11533. },
  11534. splitToCols: function (a) {
  11535. var b = (a.offsetWidth / a.colSpan - 22).toFixed(0),
  11536. c = this.getCellInfo(a),
  11537. d = c.rowIndex,
  11538. e = c.colIndex,
  11539. f = []
  11540. ;(a.colSpan = 1), a.setAttribute('width', b), f.push(a)
  11541. for (var g = e, h = e + c.colSpan; g < h; g++)
  11542. if (g != e) {
  11543. var i = this.table.rows[d],
  11544. j = i.insertCell(this.indexTable[d][g].cellIndex + 1)
  11545. if (
  11546. ((j.rowSpan = c.rowSpan),
  11547. this.setCellContent(j),
  11548. j.setAttribute('vAlign', a.getAttribute('vAlign')),
  11549. j.setAttribute('align', a.getAttribute('align')),
  11550. j.setAttribute('width', b),
  11551. a.style.cssText && (j.style.cssText = a.style.cssText),
  11552. 'TH' == a.tagName)
  11553. ) {
  11554. var k = a.ownerDocument.createElement('th')
  11555. k.appendChild(j.firstChild),
  11556. k.setAttribute('vAlign', a.getAttribute('vAlign')),
  11557. (k.rowSpan = j.rowSpan),
  11558. i.insertBefore(k, j),
  11559. domUtils.remove(j)
  11560. }
  11561. f.push(j)
  11562. }
  11563. return this.update(), f
  11564. },
  11565. isLastCell: function (a, b, c) {
  11566. ;(b = b || this.rowsNum), (c = c || this.colsNum)
  11567. var d = this.getCellInfo(a)
  11568. return d.rowIndex + d.rowSpan == b && d.colIndex + d.colSpan == c
  11569. },
  11570. getLastCell: function (a) {
  11571. a = a || this.table.getElementsByTagName('td')
  11572. var b,
  11573. c = (this.getCellInfo(a[0]), this),
  11574. d = a[0],
  11575. e = d.parentNode,
  11576. f = 0,
  11577. g = 0
  11578. return (
  11579. utils.each(a, function (a) {
  11580. a.parentNode == e && (g += a.colSpan || 1),
  11581. (f += a.rowSpan * a.colSpan || 1)
  11582. }),
  11583. (b = f / g),
  11584. utils.each(a, function (a) {
  11585. if (c.isLastCell(a, b, g)) return (d = a), !1
  11586. }),
  11587. d
  11588. )
  11589. },
  11590. selectRow: function (a) {
  11591. var b = this.indexTable[a],
  11592. c = this.getCell(b[0].rowIndex, b[0].cellIndex),
  11593. d = this.getCell(
  11594. b[this.colsNum - 1].rowIndex,
  11595. b[this.colsNum - 1].cellIndex
  11596. ),
  11597. e = this.getCellsRange(c, d)
  11598. this.setSelected(e)
  11599. },
  11600. selectTable: function () {
  11601. var a = this.table.getElementsByTagName('td'),
  11602. b = this.getCellsRange(a[0], a[a.length - 1])
  11603. this.setSelected(b)
  11604. },
  11605. setBackground: function (a, b) {
  11606. if ('string' == typeof b)
  11607. utils.each(a, function (a) {
  11608. a.style.backgroundColor = b
  11609. })
  11610. else if ('object' == typeof b) {
  11611. b = utils.extend({ repeat: !0, colorList: ['#ddd', '#fff'] }, b)
  11612. for (
  11613. var c,
  11614. d = this.getCellInfo(a[0]).rowIndex,
  11615. e = 0,
  11616. f = b.colorList,
  11617. g = function (a, b, c) {
  11618. return a[b] ? a[b] : c ? a[b % a.length] : ''
  11619. },
  11620. h = 0;
  11621. (c = a[h++]);
  11622. ) {
  11623. var i = this.getCellInfo(c)
  11624. c.style.backgroundColor = g(
  11625. f,
  11626. d + e == i.rowIndex ? e : ++e,
  11627. b.repeat
  11628. )
  11629. }
  11630. }
  11631. },
  11632. removeBackground: function (a) {
  11633. utils.each(a, function (a) {
  11634. a.style.backgroundColor = ''
  11635. })
  11636. }
  11637. })
  11638. })(),
  11639. (function () {
  11640. function a(a, c) {
  11641. var d = domUtils.getElementsByTagName(a, 'td th')
  11642. utils.each(d, function (a) {
  11643. a.removeAttribute('width')
  11644. }),
  11645. a.setAttribute('width', b(c, !0, g(c, a)))
  11646. var e = []
  11647. setTimeout(function () {
  11648. utils.each(d, function (a) {
  11649. 1 == a.colSpan && e.push(a.offsetWidth)
  11650. }),
  11651. utils.each(d, function (a, b) {
  11652. 1 == a.colSpan && a.setAttribute('width', e[b] + '')
  11653. })
  11654. }, 0)
  11655. }
  11656. function b(a, b, c) {
  11657. var d = a.body
  11658. return (
  11659. d.offsetWidth -
  11660. (b
  11661. ? 2 * parseInt(domUtils.getComputedStyle(d, 'margin-left'), 10)
  11662. : 0) -
  11663. 2 * c.tableBorder -
  11664. (a.options.offsetWidth || 0)
  11665. )
  11666. }
  11667. function c(a) {
  11668. var b = e(a).cell
  11669. if (b) {
  11670. var c = h(b)
  11671. return c.selectedTds.length ? c.selectedTds : [b]
  11672. }
  11673. return []
  11674. }
  11675. var d = UE.UETable,
  11676. e = function (a) {
  11677. return d.getTableItemsByRange(a)
  11678. },
  11679. f = function (a) {
  11680. return d.getUETableBySelected(a)
  11681. },
  11682. g = function (a, b) {
  11683. return d.getDefaultValue(a, b)
  11684. },
  11685. h = function (a) {
  11686. return d.getUETable(a)
  11687. }
  11688. ;(UE.commands.inserttable = {
  11689. queryCommandState: function () {
  11690. return e(this).table ? -1 : 0
  11691. },
  11692. execCommand: function (a, b) {
  11693. function c(a, b) {
  11694. for (var c = [], d = a.numRows, e = a.numCols, f = 0; f < d; f++) {
  11695. c.push('<tr' + (0 == f ? ' class="firstRow"' : '') + '>')
  11696. for (var g = 0; g < e; g++)
  11697. c.push(
  11698. '<td width="' +
  11699. b +
  11700. '" vAlign="' +
  11701. a.tdvalign +
  11702. '" >' +
  11703. (browser.ie && browser.version < 11
  11704. ? domUtils.fillChar
  11705. : '<br/>') +
  11706. '</td>'
  11707. )
  11708. c.push('</tr>')
  11709. }
  11710. return '<table><tbody>' + c.join('') + '</tbody></table>'
  11711. }
  11712. b ||
  11713. (b = utils.extend(
  11714. {},
  11715. {
  11716. numCols: this.options.defaultCols,
  11717. numRows: this.options.defaultRows,
  11718. tdvalign: this.options.tdvalign
  11719. }
  11720. ))
  11721. var d = this,
  11722. e = this.selection.getRange(),
  11723. f = e.startContainer,
  11724. h =
  11725. domUtils.findParent(
  11726. f,
  11727. function (a) {
  11728. return domUtils.isBlockElm(a)
  11729. },
  11730. !0
  11731. ) || d.body,
  11732. i = g(d),
  11733. j = h.offsetWidth,
  11734. k = Math.floor(j / b.numCols - 2 * i.tdPadding - i.tdBorder)
  11735. !b.tdvalign && (b.tdvalign = d.options.tdvalign),
  11736. d.execCommand('inserthtml', c(b, k))
  11737. }
  11738. }),
  11739. (UE.commands.insertparagraphbeforetable = {
  11740. queryCommandState: function () {
  11741. return e(this).cell ? 0 : -1
  11742. },
  11743. execCommand: function () {
  11744. var a = e(this).table
  11745. if (a) {
  11746. var b = this.document.createElement('p')
  11747. ;(b.innerHTML = browser.ie ? '&nbsp;' : '<br />'),
  11748. a.parentNode.insertBefore(b, a),
  11749. this.selection.getRange().setStart(b, 0).setCursor()
  11750. }
  11751. }
  11752. }),
  11753. (UE.commands.deletetable = {
  11754. queryCommandState: function () {
  11755. var a = this.selection.getRange()
  11756. return domUtils.findParentByTagName(a.startContainer, 'table', !0)
  11757. ? 0
  11758. : -1
  11759. },
  11760. execCommand: function (a, b) {
  11761. var c = this.selection.getRange()
  11762. if (
  11763. (b =
  11764. b ||
  11765. domUtils.findParentByTagName(c.startContainer, 'table', !0))
  11766. ) {
  11767. var d = b.nextSibling
  11768. d ||
  11769. ((d = domUtils.createElement(this.document, 'p', {
  11770. innerHTML: browser.ie ? domUtils.fillChar : '<br/>'
  11771. })),
  11772. b.parentNode.insertBefore(d, b)),
  11773. domUtils.remove(b),
  11774. (c = this.selection.getRange()),
  11775. 3 == d.nodeType ? c.setStartBefore(d) : c.setStart(d, 0),
  11776. c.setCursor(!1, !0),
  11777. this.fireEvent('tablehasdeleted')
  11778. }
  11779. }
  11780. }),
  11781. (UE.commands.cellalign = {
  11782. queryCommandState: function () {
  11783. return c(this).length ? 0 : -1
  11784. },
  11785. execCommand: function (a, b) {
  11786. var d = c(this)
  11787. if (d.length)
  11788. for (var e, f = 0; (e = d[f++]); ) e.setAttribute('align', b)
  11789. }
  11790. }),
  11791. (UE.commands.cellvalign = {
  11792. queryCommandState: function () {
  11793. return c(this).length ? 0 : -1
  11794. },
  11795. execCommand: function (a, b) {
  11796. var d = c(this)
  11797. if (d.length)
  11798. for (var e, f = 0; (e = d[f++]); ) e.setAttribute('vAlign', b)
  11799. }
  11800. }),
  11801. (UE.commands.insertcaption = {
  11802. queryCommandState: function () {
  11803. var a = e(this).table
  11804. return a && 0 == a.getElementsByTagName('caption').length ? 1 : -1
  11805. },
  11806. execCommand: function () {
  11807. var a = e(this).table
  11808. if (a) {
  11809. var b = this.document.createElement('caption')
  11810. ;(b.innerHTML = browser.ie ? domUtils.fillChar : '<br/>'),
  11811. a.insertBefore(b, a.firstChild)
  11812. var c = this.selection.getRange()
  11813. c.setStart(b, 0).setCursor()
  11814. }
  11815. }
  11816. }),
  11817. (UE.commands.deletecaption = {
  11818. queryCommandState: function () {
  11819. var a = this.selection.getRange(),
  11820. b = domUtils.findParentByTagName(a.startContainer, 'table')
  11821. return b
  11822. ? 0 == b.getElementsByTagName('caption').length
  11823. ? -1
  11824. : 1
  11825. : -1
  11826. },
  11827. execCommand: function () {
  11828. var a = this.selection.getRange(),
  11829. b = domUtils.findParentByTagName(a.startContainer, 'table')
  11830. if (b) {
  11831. domUtils.remove(b.getElementsByTagName('caption')[0])
  11832. var c = this.selection.getRange()
  11833. c.setStart(b.rows[0].cells[0], 0).setCursor()
  11834. }
  11835. }
  11836. }),
  11837. (UE.commands.inserttitle = {
  11838. queryCommandState: function () {
  11839. var a = e(this).table
  11840. if (a) {
  11841. var b = a.rows[0]
  11842. return 'th' != b.cells[b.cells.length - 1].tagName.toLowerCase()
  11843. ? 0
  11844. : -1
  11845. }
  11846. return -1
  11847. },
  11848. execCommand: function () {
  11849. var a = e(this).table
  11850. a && h(a).insertRow(0, 'th')
  11851. var b = a.getElementsByTagName('th')[0]
  11852. this.selection.getRange().setStart(b, 0).setCursor(!1, !0)
  11853. }
  11854. }),
  11855. (UE.commands.deletetitle = {
  11856. queryCommandState: function () {
  11857. var a = e(this).table
  11858. if (a) {
  11859. var b = a.rows[0]
  11860. return 'th' == b.cells[b.cells.length - 1].tagName.toLowerCase()
  11861. ? 0
  11862. : -1
  11863. }
  11864. return -1
  11865. },
  11866. execCommand: function () {
  11867. var a = e(this).table
  11868. a && domUtils.remove(a.rows[0])
  11869. var b = a.getElementsByTagName('td')[0]
  11870. this.selection.getRange().setStart(b, 0).setCursor(!1, !0)
  11871. }
  11872. }),
  11873. (UE.commands.inserttitlecol = {
  11874. queryCommandState: function () {
  11875. var a = e(this).table
  11876. if (a) {
  11877. var b = a.rows[a.rows.length - 1]
  11878. return b.getElementsByTagName('th').length ? -1 : 0
  11879. }
  11880. return -1
  11881. },
  11882. execCommand: function (b) {
  11883. var c = e(this).table
  11884. c && h(c).insertCol(0, 'th'), a(c, this)
  11885. var d = c.getElementsByTagName('th')[0]
  11886. this.selection.getRange().setStart(d, 0).setCursor(!1, !0)
  11887. }
  11888. }),
  11889. (UE.commands.deletetitlecol = {
  11890. queryCommandState: function () {
  11891. var a = e(this).table
  11892. if (a) {
  11893. var b = a.rows[a.rows.length - 1]
  11894. return b.getElementsByTagName('th').length ? 0 : -1
  11895. }
  11896. return -1
  11897. },
  11898. execCommand: function () {
  11899. var b = e(this).table
  11900. if (b)
  11901. for (var c = 0; c < b.rows.length; c++)
  11902. domUtils.remove(b.rows[c].children[0])
  11903. a(b, this)
  11904. var d = b.getElementsByTagName('td')[0]
  11905. this.selection.getRange().setStart(d, 0).setCursor(!1, !0)
  11906. }
  11907. }),
  11908. (UE.commands.mergeright = {
  11909. queryCommandState: function (a) {
  11910. var b = e(this),
  11911. c = b.table,
  11912. d = b.cell
  11913. if (!c || !d) return -1
  11914. var f = h(c)
  11915. if (f.selectedTds.length) return -1
  11916. var g = f.getCellInfo(d),
  11917. i = g.colIndex + g.colSpan
  11918. if (i >= f.colsNum) return -1
  11919. var j = f.indexTable[g.rowIndex][i],
  11920. k = c.rows[j.rowIndex].cells[j.cellIndex]
  11921. return k &&
  11922. d.tagName == k.tagName &&
  11923. j.rowIndex == g.rowIndex &&
  11924. j.rowSpan == g.rowSpan
  11925. ? 0
  11926. : -1
  11927. },
  11928. execCommand: function (a) {
  11929. var b = this.selection.getRange(),
  11930. c = b.createBookmark(!0),
  11931. d = e(this).cell,
  11932. f = h(d)
  11933. f.mergeRight(d), b.moveToBookmark(c).select()
  11934. }
  11935. }),
  11936. (UE.commands.mergedown = {
  11937. queryCommandState: function (a) {
  11938. var b = e(this),
  11939. c = b.table,
  11940. d = b.cell
  11941. if (!c || !d) return -1
  11942. var f = h(c)
  11943. if (f.selectedTds.length) return -1
  11944. var g = f.getCellInfo(d),
  11945. i = g.rowIndex + g.rowSpan
  11946. if (i >= f.rowsNum) return -1
  11947. var j = f.indexTable[i][g.colIndex],
  11948. k = c.rows[j.rowIndex].cells[j.cellIndex]
  11949. return k &&
  11950. d.tagName == k.tagName &&
  11951. j.colIndex == g.colIndex &&
  11952. j.colSpan == g.colSpan
  11953. ? 0
  11954. : -1
  11955. },
  11956. execCommand: function () {
  11957. var a = this.selection.getRange(),
  11958. b = a.createBookmark(!0),
  11959. c = e(this).cell,
  11960. d = h(c)
  11961. d.mergeDown(c), a.moveToBookmark(b).select()
  11962. }
  11963. }),
  11964. (UE.commands.mergecells = {
  11965. queryCommandState: function () {
  11966. return f(this) ? 0 : -1
  11967. },
  11968. execCommand: function () {
  11969. var a = f(this)
  11970. if (a && a.selectedTds.length) {
  11971. var b = a.selectedTds[0]
  11972. a.mergeRange()
  11973. var c = this.selection.getRange()
  11974. domUtils.isEmptyBlock(b)
  11975. ? c.setStart(b, 0).collapse(!0)
  11976. : c.selectNodeContents(b),
  11977. c.select()
  11978. }
  11979. }
  11980. }),
  11981. (UE.commands.insertrow = {
  11982. queryCommandState: function () {
  11983. var a = e(this),
  11984. b = a.cell
  11985. return b &&
  11986. ('TD' == b.tagName ||
  11987. ('TH' == b.tagName && a.tr !== a.table.rows[0])) &&
  11988. h(a.table).rowsNum < this.options.maxRowNum
  11989. ? 0
  11990. : -1
  11991. },
  11992. execCommand: function () {
  11993. var a = this.selection.getRange(),
  11994. b = a.createBookmark(!0),
  11995. c = e(this),
  11996. d = c.cell,
  11997. f = c.table,
  11998. g = h(f),
  11999. i = g.getCellInfo(d)
  12000. if (g.selectedTds.length)
  12001. for (
  12002. var j = g.cellsRange,
  12003. k = 0,
  12004. l = j.endRowIndex - j.beginRowIndex + 1;
  12005. k < l;
  12006. k++
  12007. )
  12008. g.insertRow(j.beginRowIndex, d)
  12009. else g.insertRow(i.rowIndex, d)
  12010. a.moveToBookmark(b).select(),
  12011. 'enabled' === f.getAttribute('interlaced') &&
  12012. this.fireEvent('interlacetable', f)
  12013. }
  12014. }),
  12015. (UE.commands.insertrownext = {
  12016. queryCommandState: function () {
  12017. var a = e(this),
  12018. b = a.cell
  12019. return b &&
  12020. 'TD' == b.tagName &&
  12021. h(a.table).rowsNum < this.options.maxRowNum
  12022. ? 0
  12023. : -1
  12024. },
  12025. execCommand: function () {
  12026. var a = this.selection.getRange(),
  12027. b = a.createBookmark(!0),
  12028. c = e(this),
  12029. d = c.cell,
  12030. f = c.table,
  12031. g = h(f),
  12032. i = g.getCellInfo(d)
  12033. if (g.selectedTds.length)
  12034. for (
  12035. var j = g.cellsRange,
  12036. k = 0,
  12037. l = j.endRowIndex - j.beginRowIndex + 1;
  12038. k < l;
  12039. k++
  12040. )
  12041. g.insertRow(j.endRowIndex + 1, d)
  12042. else g.insertRow(i.rowIndex + i.rowSpan, d)
  12043. a.moveToBookmark(b).select(),
  12044. 'enabled' === f.getAttribute('interlaced') &&
  12045. this.fireEvent('interlacetable', f)
  12046. }
  12047. }),
  12048. (UE.commands.deleterow = {
  12049. queryCommandState: function () {
  12050. var a = e(this)
  12051. return a.cell ? 0 : -1
  12052. },
  12053. execCommand: function () {
  12054. var a = e(this).cell,
  12055. b = h(a),
  12056. c = b.cellsRange,
  12057. d = b.getCellInfo(a),
  12058. f = b.getVSideCell(a),
  12059. g = b.getVSideCell(a, !0),
  12060. i = this.selection.getRange()
  12061. if (utils.isEmptyObject(c)) b.deleteRow(d.rowIndex)
  12062. else
  12063. for (var j = c.beginRowIndex; j < c.endRowIndex + 1; j++)
  12064. b.deleteRow(c.beginRowIndex)
  12065. var k = b.table
  12066. if (k.getElementsByTagName('td').length)
  12067. if (
  12068. 1 == d.rowSpan ||
  12069. d.rowSpan == c.endRowIndex - c.beginRowIndex + 1
  12070. )
  12071. (g || f) && i.selectNodeContents(g || f).setCursor(!1, !0)
  12072. else {
  12073. var l = b.getCell(
  12074. d.rowIndex,
  12075. b.indexTable[d.rowIndex][d.colIndex].cellIndex
  12076. )
  12077. l && i.selectNodeContents(l).setCursor(!1, !0)
  12078. }
  12079. else {
  12080. var m = k.nextSibling
  12081. domUtils.remove(k), m && i.setStart(m, 0).setCursor(!1, !0)
  12082. }
  12083. 'enabled' === k.getAttribute('interlaced') &&
  12084. this.fireEvent('interlacetable', k)
  12085. }
  12086. }),
  12087. (UE.commands.insertcol = {
  12088. queryCommandState: function (a) {
  12089. var b = e(this),
  12090. c = b.cell
  12091. return c &&
  12092. ('TD' == c.tagName ||
  12093. ('TH' == c.tagName && c !== b.tr.cells[0])) &&
  12094. h(b.table).colsNum < this.options.maxColNum
  12095. ? 0
  12096. : -1
  12097. },
  12098. execCommand: function (a) {
  12099. var b = this.selection.getRange(),
  12100. c = b.createBookmark(!0)
  12101. if (this.queryCommandState(a) != -1) {
  12102. var d = e(this).cell,
  12103. f = h(d),
  12104. g = f.getCellInfo(d)
  12105. if (f.selectedTds.length)
  12106. for (
  12107. var i = f.cellsRange,
  12108. j = 0,
  12109. k = i.endColIndex - i.beginColIndex + 1;
  12110. j < k;
  12111. j++
  12112. )
  12113. f.insertCol(i.beginColIndex, d)
  12114. else f.insertCol(g.colIndex, d)
  12115. b.moveToBookmark(c).select(!0)
  12116. }
  12117. }
  12118. }),
  12119. (UE.commands.insertcolnext = {
  12120. queryCommandState: function () {
  12121. var a = e(this),
  12122. b = a.cell
  12123. return b && h(a.table).colsNum < this.options.maxColNum ? 0 : -1
  12124. },
  12125. execCommand: function () {
  12126. var a = this.selection.getRange(),
  12127. b = a.createBookmark(!0),
  12128. c = e(this).cell,
  12129. d = h(c),
  12130. f = d.getCellInfo(c)
  12131. if (d.selectedTds.length)
  12132. for (
  12133. var g = d.cellsRange,
  12134. i = 0,
  12135. j = g.endColIndex - g.beginColIndex + 1;
  12136. i < j;
  12137. i++
  12138. )
  12139. d.insertCol(g.endColIndex + 1, c)
  12140. else d.insertCol(f.colIndex + f.colSpan, c)
  12141. a.moveToBookmark(b).select()
  12142. }
  12143. }),
  12144. (UE.commands.deletecol = {
  12145. queryCommandState: function () {
  12146. var a = e(this)
  12147. return a.cell ? 0 : -1
  12148. },
  12149. execCommand: function () {
  12150. var a = e(this).cell,
  12151. b = h(a),
  12152. c = b.cellsRange,
  12153. d = b.getCellInfo(a),
  12154. f = b.getHSideCell(a),
  12155. g = b.getHSideCell(a, !0)
  12156. if (utils.isEmptyObject(c)) b.deleteCol(d.colIndex)
  12157. else
  12158. for (var i = c.beginColIndex; i < c.endColIndex + 1; i++)
  12159. b.deleteCol(c.beginColIndex)
  12160. var j = b.table,
  12161. k = this.selection.getRange()
  12162. if (j.getElementsByTagName('td').length)
  12163. domUtils.inDoc(a, this.document)
  12164. ? k.setStart(a, 0).setCursor(!1, !0)
  12165. : g && domUtils.inDoc(g, this.document)
  12166. ? k.selectNodeContents(g).setCursor(!1, !0)
  12167. : f &&
  12168. domUtils.inDoc(f, this.document) &&
  12169. k.selectNodeContents(f).setCursor(!0, !0)
  12170. else {
  12171. var l = j.nextSibling
  12172. domUtils.remove(j), l && k.setStart(l, 0).setCursor(!1, !0)
  12173. }
  12174. }
  12175. }),
  12176. (UE.commands.splittocells = {
  12177. queryCommandState: function () {
  12178. var a = e(this),
  12179. b = a.cell
  12180. if (!b) return -1
  12181. var c = h(a.table)
  12182. return c.selectedTds.length > 0
  12183. ? -1
  12184. : b && (b.colSpan > 1 || b.rowSpan > 1)
  12185. ? 0
  12186. : -1
  12187. },
  12188. execCommand: function () {
  12189. var a = this.selection.getRange(),
  12190. b = a.createBookmark(!0),
  12191. c = e(this).cell,
  12192. d = h(c)
  12193. d.splitToCells(c), a.moveToBookmark(b).select()
  12194. }
  12195. }),
  12196. (UE.commands.splittorows = {
  12197. queryCommandState: function () {
  12198. var a = e(this),
  12199. b = a.cell
  12200. if (!b) return -1
  12201. var c = h(a.table)
  12202. return c.selectedTds.length > 0 ? -1 : b && b.rowSpan > 1 ? 0 : -1
  12203. },
  12204. execCommand: function () {
  12205. var a = this.selection.getRange(),
  12206. b = a.createBookmark(!0),
  12207. c = e(this).cell,
  12208. d = h(c)
  12209. d.splitToRows(c), a.moveToBookmark(b).select()
  12210. }
  12211. }),
  12212. (UE.commands.splittocols = {
  12213. queryCommandState: function () {
  12214. var a = e(this),
  12215. b = a.cell
  12216. if (!b) return -1
  12217. var c = h(a.table)
  12218. return c.selectedTds.length > 0 ? -1 : b && b.colSpan > 1 ? 0 : -1
  12219. },
  12220. execCommand: function () {
  12221. var a = this.selection.getRange(),
  12222. b = a.createBookmark(!0),
  12223. c = e(this).cell,
  12224. d = h(c)
  12225. d.splitToCols(c), a.moveToBookmark(b).select()
  12226. }
  12227. }),
  12228. (UE.commands.adaptbytext = UE.commands.adaptbywindow =
  12229. {
  12230. queryCommandState: function () {
  12231. return e(this).table ? 0 : -1
  12232. },
  12233. execCommand: function (b) {
  12234. var c = e(this),
  12235. d = c.table
  12236. if (d)
  12237. if ('adaptbywindow' == b) a(d, this)
  12238. else {
  12239. var f = domUtils.getElementsByTagName(d, 'td th')
  12240. utils.each(f, function (a) {
  12241. a.removeAttribute('width')
  12242. }),
  12243. d.removeAttribute('width')
  12244. }
  12245. }
  12246. }),
  12247. (UE.commands.averagedistributecol = {
  12248. queryCommandState: function () {
  12249. var a = f(this)
  12250. return a && (a.isFullRow() || a.isFullCol()) ? 0 : -1
  12251. },
  12252. execCommand: function (a) {
  12253. function b() {
  12254. var a,
  12255. b = e.table,
  12256. c = 0,
  12257. f = 0,
  12258. h = g(d, b)
  12259. if (e.isFullRow()) (c = b.offsetWidth), (f = e.colsNum)
  12260. else
  12261. for (
  12262. var i,
  12263. j = e.cellsRange.beginColIndex,
  12264. k = e.cellsRange.endColIndex,
  12265. l = j;
  12266. l <= k;
  12267. )
  12268. (i = e.selectedTds[l]),
  12269. (c += i.offsetWidth),
  12270. (l += i.colSpan),
  12271. (f += 1)
  12272. return (a = Math.ceil(c / f) - 2 * h.tdBorder - 2 * h.tdPadding)
  12273. }
  12274. function c(a) {
  12275. utils.each(
  12276. domUtils.getElementsByTagName(e.table, 'th'),
  12277. function (a) {
  12278. a.setAttribute('width', '')
  12279. }
  12280. )
  12281. var b = e.isFullRow()
  12282. ? domUtils.getElementsByTagName(e.table, 'td')
  12283. : e.selectedTds
  12284. utils.each(b, function (b) {
  12285. 1 == b.colSpan && b.setAttribute('width', a)
  12286. })
  12287. }
  12288. var d = this,
  12289. e = f(d)
  12290. e && e.selectedTds.length && c(b())
  12291. }
  12292. }),
  12293. (UE.commands.averagedistributerow = {
  12294. queryCommandState: function () {
  12295. var a = f(this)
  12296. return a
  12297. ? a.selectedTds && /th/gi.test(a.selectedTds[0].tagName)
  12298. ? -1
  12299. : a.isFullRow() || a.isFullCol()
  12300. ? 0
  12301. : -1
  12302. : -1
  12303. },
  12304. execCommand: function (a) {
  12305. function b() {
  12306. var a,
  12307. b,
  12308. c = 0,
  12309. f = e.table,
  12310. h = g(d, f),
  12311. i = parseInt(
  12312. domUtils.getComputedStyle(
  12313. f.getElementsByTagName('td')[0],
  12314. 'padding-top'
  12315. )
  12316. )
  12317. if (e.isFullCol()) {
  12318. var j,
  12319. k,
  12320. l = domUtils.getElementsByTagName(f, 'caption'),
  12321. m = domUtils.getElementsByTagName(f, 'th')
  12322. l.length > 0 && (j = l[0].offsetHeight),
  12323. m.length > 0 && (k = m[0].offsetHeight),
  12324. (c = f.offsetHeight - (j || 0) - (k || 0)),
  12325. (b = 0 == m.length ? e.rowsNum : e.rowsNum - 1)
  12326. } else {
  12327. for (
  12328. var n = e.cellsRange.beginRowIndex,
  12329. o = e.cellsRange.endRowIndex,
  12330. p = 0,
  12331. q = domUtils.getElementsByTagName(f, 'tr'),
  12332. r = n;
  12333. r <= o;
  12334. r++
  12335. )
  12336. (c += q[r].offsetHeight), (p += 1)
  12337. b = p
  12338. }
  12339. return (a =
  12340. browser.ie && browser.version < 9
  12341. ? Math.ceil(c / b)
  12342. : Math.ceil(c / b) - 2 * h.tdBorder - 2 * i)
  12343. }
  12344. function c(a) {
  12345. var b = e.isFullCol()
  12346. ? domUtils.getElementsByTagName(e.table, 'td')
  12347. : e.selectedTds
  12348. utils.each(b, function (b) {
  12349. 1 == b.rowSpan && b.setAttribute('height', a)
  12350. })
  12351. }
  12352. var d = this,
  12353. e = f(d)
  12354. e && e.selectedTds.length && c(b())
  12355. }
  12356. }),
  12357. (UE.commands.cellalignment = {
  12358. queryCommandState: function () {
  12359. return e(this).table ? 0 : -1
  12360. },
  12361. execCommand: function (a, b) {
  12362. var c = this,
  12363. d = f(c)
  12364. if (d)
  12365. utils.each(d.selectedTds, function (a) {
  12366. domUtils.setAttributes(a, b)
  12367. })
  12368. else {
  12369. var e = c.selection.getStart(),
  12370. g =
  12371. e &&
  12372. domUtils.findParentByTagName(e, ['td', 'th', 'caption'], !0)
  12373. ;/caption/gi.test(g.tagName)
  12374. ? ((g.style.textAlign = b.align),
  12375. (g.style.verticalAlign = b.vAlign))
  12376. : domUtils.setAttributes(g, b),
  12377. c.selection.getRange().setCursor(!0)
  12378. }
  12379. },
  12380. queryCommandValue: function (a) {
  12381. var b = e(this).cell
  12382. if ((b || (b = c(this)[0]), b)) {
  12383. var d = UE.UETable.getUETable(b).selectedTds
  12384. return !d.length && (d = b), UE.UETable.getTableCellAlignState(d)
  12385. }
  12386. return null
  12387. }
  12388. }),
  12389. (UE.commands.tablealignment = {
  12390. queryCommandState: function () {
  12391. return browser.ie && browser.version < 8
  12392. ? -1
  12393. : e(this).table
  12394. ? 0
  12395. : -1
  12396. },
  12397. execCommand: function (a, b) {
  12398. var c = this,
  12399. d = c.selection.getStart(),
  12400. e = d && domUtils.findParentByTagName(d, ['table'], !0)
  12401. e && e.setAttribute('align', b)
  12402. }
  12403. }),
  12404. (UE.commands.edittable = {
  12405. queryCommandState: function () {
  12406. return e(this).table ? 0 : -1
  12407. },
  12408. execCommand: function (a, b) {
  12409. var c = this.selection.getRange(),
  12410. d = domUtils.findParentByTagName(c.startContainer, 'table')
  12411. if (d) {
  12412. var e = domUtils
  12413. .getElementsByTagName(d, 'td')
  12414. .concat(
  12415. domUtils.getElementsByTagName(d, 'th'),
  12416. domUtils.getElementsByTagName(d, 'caption')
  12417. )
  12418. utils.each(e, function (a) {
  12419. a.style.borderColor = b
  12420. })
  12421. }
  12422. }
  12423. }),
  12424. (UE.commands.edittd = {
  12425. queryCommandState: function () {
  12426. return e(this).table ? 0 : -1
  12427. },
  12428. execCommand: function (a, b) {
  12429. var c = this,
  12430. d = f(c)
  12431. if (d)
  12432. utils.each(d.selectedTds, function (a) {
  12433. a.style.backgroundColor = b
  12434. })
  12435. else {
  12436. var e = c.selection.getStart(),
  12437. g =
  12438. e &&
  12439. domUtils.findParentByTagName(e, ['td', 'th', 'caption'], !0)
  12440. g && (g.style.backgroundColor = b)
  12441. }
  12442. }
  12443. }),
  12444. (UE.commands.settablebackground = {
  12445. queryCommandState: function () {
  12446. return c(this).length > 1 ? 0 : -1
  12447. },
  12448. execCommand: function (a, b) {
  12449. var d, e
  12450. ;(d = c(this)), (e = h(d[0])), e.setBackground(d, b)
  12451. }
  12452. }),
  12453. (UE.commands.cleartablebackground = {
  12454. queryCommandState: function () {
  12455. var a = c(this)
  12456. if (!a.length) return -1
  12457. for (var b, d = 0; (b = a[d++]); )
  12458. if ('' !== b.style.backgroundColor) return 0
  12459. return -1
  12460. },
  12461. execCommand: function () {
  12462. var a = c(this),
  12463. b = h(a[0])
  12464. b.removeBackground(a)
  12465. }
  12466. }),
  12467. (UE.commands.interlacetable = UE.commands.uninterlacetable =
  12468. {
  12469. queryCommandState: function (a) {
  12470. var b = e(this).table
  12471. if (!b) return -1
  12472. var c = b.getAttribute('interlaced')
  12473. return 'interlacetable' == a
  12474. ? 'enabled' === c
  12475. ? -1
  12476. : 0
  12477. : c && 'disabled' !== c
  12478. ? 0
  12479. : -1
  12480. },
  12481. execCommand: function (a, b) {
  12482. var c = e(this).table
  12483. 'interlacetable' == a
  12484. ? (c.setAttribute('interlaced', 'enabled'),
  12485. this.fireEvent('interlacetable', c, b))
  12486. : (c.setAttribute('interlaced', 'disabled'),
  12487. this.fireEvent('uninterlacetable', c))
  12488. }
  12489. }),
  12490. (UE.commands.setbordervisible = {
  12491. queryCommandState: function (a) {
  12492. var b = e(this).table
  12493. return b ? 0 : -1
  12494. },
  12495. execCommand: function () {
  12496. var a = e(this).table
  12497. utils.each(domUtils.getElementsByTagName(a, 'td'), function (a) {
  12498. ;(a.style.borderWidth = '1px'), (a.style.borderStyle = 'solid')
  12499. })
  12500. }
  12501. })
  12502. })(),
  12503. (UE.plugins.table = function () {
  12504. function a(a) {}
  12505. function b(a, b) {
  12506. c(a, 'width', !0), c(a, 'height', !0)
  12507. }
  12508. function c(a, b, c) {
  12509. a.style[b] &&
  12510. (c && a.setAttribute(b, parseInt(a.style[b], 10)), (a.style[b] = ''))
  12511. }
  12512. function d(a) {
  12513. if ('TD' == a.tagName || 'TH' == a.tagName) return a
  12514. var b
  12515. return (b =
  12516. domUtils.findParentByTagName(a, 'td', !0) ||
  12517. domUtils.findParentByTagName(a, 'th', !0))
  12518. ? b
  12519. : null
  12520. }
  12521. function e(a) {
  12522. var b = new RegExp(domUtils.fillChar, 'g')
  12523. if (
  12524. a[browser.ie ? 'innerText' : 'textContent']
  12525. .replace(/^\s*$/, '')
  12526. .replace(b, '').length > 0
  12527. )
  12528. return 0
  12529. for (var c in dtd.$isNotEmpty)
  12530. if (a.getElementsByTagName(c).length) return 0
  12531. return 1
  12532. }
  12533. function f(a) {
  12534. return a.pageX || a.pageY
  12535. ? { x: a.pageX, y: a.pageY }
  12536. : {
  12537. x:
  12538. a.clientX +
  12539. N.document.body.scrollLeft -
  12540. N.document.body.clientLeft,
  12541. y:
  12542. a.clientY +
  12543. N.document.body.scrollTop -
  12544. N.document.body.clientTop
  12545. }
  12546. }
  12547. function g(b) {
  12548. if (!A())
  12549. try {
  12550. var c,
  12551. e = d(b.target || b.srcElement)
  12552. if (
  12553. (R &&
  12554. ((N.body.style.webkitUserSelect = 'none'),
  12555. (Math.abs(V.x - b.clientX) > T ||
  12556. Math.abs(V.y - b.clientY) > T) &&
  12557. (t(), (R = !1), (U = 0), v(b))),
  12558. ca && ha)
  12559. )
  12560. return (
  12561. (U = 0),
  12562. (N.body.style.webkitUserSelect = 'none'),
  12563. N.selection
  12564. .getNative()
  12565. [browser.ie9below ? 'empty' : 'removeAllRanges'](),
  12566. (c = f(b)),
  12567. m(N, !0, ca, c, e),
  12568. void ('h' == ca
  12569. ? (ga.style.left = k(ha, b) + 'px')
  12570. : 'v' == ca && (ga.style.top = l(ha, b) + 'px'))
  12571. )
  12572. if (e) {
  12573. if (N.fireEvent('excludetable', e) === !0) return
  12574. c = f(b)
  12575. var g = n(e, c),
  12576. i = domUtils.findParentByTagName(e, 'table', !0)
  12577. if (j(i, e, b, !0)) {
  12578. if (N.fireEvent('excludetable', i) === !0) return
  12579. N.body.style.cursor =
  12580. 'url(' + N.options.cursorpath + 'h.png),pointer'
  12581. } else if (j(i, e, b)) {
  12582. if (N.fireEvent('excludetable', i) === !0) return
  12583. N.body.style.cursor =
  12584. 'url(' + N.options.cursorpath + 'v.png),pointer'
  12585. } else {
  12586. N.body.style.cursor = 'text'
  12587. ;/\d/.test(g) &&
  12588. ((g = g.replace(/\d/, '')),
  12589. (e = Y(e).getPreviewCell(e, 'v' == g))),
  12590. m(N, !!e && !!g, e ? g : '', c, e)
  12591. }
  12592. } else h(!1, i, N)
  12593. } catch (o) {
  12594. a(o)
  12595. }
  12596. }
  12597. function h(a, b, c) {
  12598. if (a) i(b, c)
  12599. else {
  12600. if (fa) return
  12601. la = setTimeout(function () {
  12602. !fa && ea && ea.parentNode && ea.parentNode.removeChild(ea)
  12603. }, 2e3)
  12604. }
  12605. }
  12606. function i(a, b) {
  12607. function c(c, d) {
  12608. clearTimeout(g),
  12609. (g = setTimeout(function () {
  12610. b.fireEvent('tableClicked', a, d)
  12611. }, 300))
  12612. }
  12613. function d(c) {
  12614. clearTimeout(g)
  12615. var d = Y(a),
  12616. e = a.rows[0].cells[0],
  12617. f = d.getLastCell(),
  12618. h = d.getCellsRange(e, f)
  12619. b.selection.getRange().setStart(e, 0).setCursor(!1, !0),
  12620. d.setSelected(h)
  12621. }
  12622. var e = domUtils.getXY(a),
  12623. f = a.ownerDocument
  12624. if (ea && ea.parentNode) return ea
  12625. ;(ea = f.createElement('div')),
  12626. (ea.contentEditable = !1),
  12627. (ea.innerHTML = ''),
  12628. (ea.style.cssText =
  12629. 'width:15px;height:15px;background-image:url(' +
  12630. b.options.UEDITOR_HOME_URL +
  12631. 'dialogs/table/dragicon.png);position: absolute;cursor:move;top:' +
  12632. (e.y - 15) +
  12633. 'px;left:' +
  12634. e.x +
  12635. 'px;'),
  12636. domUtils.unSelectable(ea),
  12637. (ea.onmouseover = function (a) {
  12638. fa = !0
  12639. }),
  12640. (ea.onmouseout = function (a) {
  12641. fa = !1
  12642. }),
  12643. domUtils.on(ea, 'click', function (a, b) {
  12644. c(b, this)
  12645. }),
  12646. domUtils.on(ea, 'dblclick', function (a, b) {
  12647. d(b)
  12648. }),
  12649. domUtils.on(ea, 'dragstart', function (a, b) {
  12650. domUtils.preventDefault(b)
  12651. })
  12652. var g
  12653. f.body.appendChild(ea)
  12654. }
  12655. function j(a, b, c, d) {
  12656. var e = f(c),
  12657. g = n(b, e)
  12658. if (d) {
  12659. var h = a.getElementsByTagName('caption')[0],
  12660. i = h ? h.offsetHeight : 0
  12661. return 'v1' == g && e.y - domUtils.getXY(a).y - i < 8
  12662. }
  12663. return 'h1' == g && e.x - domUtils.getXY(a).x < 8
  12664. }
  12665. function k(a, b) {
  12666. var c = Y(a)
  12667. if (c) {
  12668. var d = c.getSameEndPosCells(a, 'x')[0],
  12669. e = c.getSameStartPosXCells(a)[0],
  12670. g = f(b).x,
  12671. h = (d ? domUtils.getXY(d).x : domUtils.getXY(c.table).x) + 20,
  12672. i = e
  12673. ? domUtils.getXY(e).x + e.offsetWidth - 20
  12674. : N.body.offsetWidth + 5 ||
  12675. parseInt(domUtils.getComputedStyle(N.body, 'width'), 10)
  12676. return (h += Q), (i -= Q), g < h ? h : g > i ? i : g
  12677. }
  12678. }
  12679. function l(b, c) {
  12680. try {
  12681. var d = domUtils.getXY(b).y,
  12682. e = f(c).y
  12683. return e < d ? d : e
  12684. } catch (g) {
  12685. a(g)
  12686. }
  12687. }
  12688. function m(b, c, d, e, f) {
  12689. try {
  12690. ;(b.body.style.cursor =
  12691. 'h' == d ? 'col-resize' : 'v' == d ? 'row-resize' : 'text'),
  12692. browser.ie &&
  12693. (!d || ia || Z(b) ? I(b) : (H(b, b.document), J(d, f))),
  12694. (da = c)
  12695. } catch (g) {
  12696. a(g)
  12697. }
  12698. }
  12699. function n(a, b) {
  12700. var c = domUtils.getXY(a)
  12701. return c
  12702. ? c.x + a.offsetWidth - b.x < S
  12703. ? 'h'
  12704. : b.x - c.x < S
  12705. ? 'h1'
  12706. : c.y + a.offsetHeight - b.y < S
  12707. ? 'v'
  12708. : b.y - c.y < S
  12709. ? 'v1'
  12710. : ''
  12711. : ''
  12712. }
  12713. function o(a, b) {
  12714. if (!A())
  12715. if (((V = { x: b.clientX, y: b.clientY }), 2 == b.button)) {
  12716. var c = Z(N),
  12717. d = !1
  12718. if (c) {
  12719. var e = M(N, b)
  12720. utils.each(c.selectedTds, function (a) {
  12721. a === e && (d = !0)
  12722. }),
  12723. d
  12724. ? ((e = c.selectedTds[0]),
  12725. setTimeout(function () {
  12726. N.selection.getRange().setStart(e, 0).setCursor(!1, !0)
  12727. }, 0))
  12728. : (_(domUtils.getElementsByTagName(N.body, 'th td')),
  12729. c.clearSelected())
  12730. }
  12731. } else q(b)
  12732. }
  12733. function p(a) {
  12734. ;(U = 0), (a = a || N.window.event)
  12735. var b = d(a.target || a.srcElement)
  12736. if (b) {
  12737. var c
  12738. if ((c = n(b, f(a)))) {
  12739. if ((I(N), 'h1' == c))
  12740. if (
  12741. ((c = 'h'), j(domUtils.findParentByTagName(b, 'table'), b, a))
  12742. )
  12743. N.execCommand('adaptbywindow')
  12744. else if ((b = Y(b).getPreviewCell(b))) {
  12745. var e = N.selection.getRange()
  12746. e.selectNodeContents(b).setCursor(!0, !0)
  12747. }
  12748. if ('h' == c) {
  12749. var g = Y(b),
  12750. h = g.table,
  12751. i = C(b, h, !0)
  12752. ;(i = s(i, 'left')), (g.width = g.offsetWidth)
  12753. var k = [],
  12754. l = []
  12755. utils.each(i, function (a) {
  12756. k.push(a.offsetWidth)
  12757. }),
  12758. utils.each(i, function (a) {
  12759. a.removeAttribute('width')
  12760. }),
  12761. window.setTimeout(function () {
  12762. var a = !0
  12763. utils.each(i, function (b, c) {
  12764. var d = b.offsetWidth
  12765. return d > k[c] ? ((a = !1), !1) : void l.push(d)
  12766. })
  12767. var b = a ? l : k
  12768. utils.each(i, function (a, c) {
  12769. a.width = b[c] - G()
  12770. })
  12771. }, 0)
  12772. }
  12773. }
  12774. }
  12775. }
  12776. function q(a) {
  12777. if (
  12778. (_(domUtils.getElementsByTagName(N.body, 'td th')),
  12779. utils.each(N.document.getElementsByTagName('table'), function (a) {
  12780. a.ueTable = null
  12781. }),
  12782. (aa = M(N, a)))
  12783. ) {
  12784. var b = domUtils.findParentByTagName(aa, 'table', !0)
  12785. ;(ut = Y(b)),
  12786. ut && ut.clearSelected(),
  12787. da
  12788. ? r(a)
  12789. : ((N.document.body.style.webkitUserSelect = ''),
  12790. (ia = !0),
  12791. N.addListener('mouseover', x))
  12792. }
  12793. }
  12794. function r(a) {
  12795. browser.ie && (a = u(a)),
  12796. t(),
  12797. (R = !0),
  12798. (O = setTimeout(function () {
  12799. v(a)
  12800. }, W))
  12801. }
  12802. function s(a, b) {
  12803. for (var c = [], d = null, e = 0, f = a.length; e < f; e++)
  12804. (d = a[e][b]), d && c.push(d)
  12805. return c
  12806. }
  12807. function t() {
  12808. O && clearTimeout(O), (O = null)
  12809. }
  12810. function u(a) {
  12811. var b = [
  12812. 'pageX',
  12813. 'pageY',
  12814. 'clientX',
  12815. 'clientY',
  12816. 'srcElement',
  12817. 'target'
  12818. ],
  12819. c = {}
  12820. if (a)
  12821. for (var d, e, f = 0; (d = b[f]); f++) (e = a[d]), e && (c[d] = e)
  12822. return c
  12823. }
  12824. function v(a) {
  12825. if (((R = !1), (aa = a.target || a.srcElement))) {
  12826. var b = n(aa, f(a))
  12827. ;/\d/.test(b) &&
  12828. ((b = b.replace(/\d/, '')),
  12829. (aa = Y(aa).getPreviewCell(aa, 'v' == b))),
  12830. I(N),
  12831. H(N, N.document),
  12832. N.fireEvent('saveScene'),
  12833. J(b, aa),
  12834. (ia = !0),
  12835. (ca = b),
  12836. (ha = aa)
  12837. }
  12838. }
  12839. function w(a, b) {
  12840. if (!A()) {
  12841. if (
  12842. (t(),
  12843. (R = !1),
  12844. da &&
  12845. ((U = ++U % 3),
  12846. (V = { x: b.clientX, y: b.clientY }),
  12847. (P = setTimeout(function () {
  12848. U > 0 && U--
  12849. }, W)),
  12850. 2 === U))
  12851. )
  12852. return (U = 0), void p(b)
  12853. if (2 != b.button) {
  12854. var c = this,
  12855. d = c.selection.getRange(),
  12856. e = domUtils.findParentByTagName(d.startContainer, 'table', !0),
  12857. f = domUtils.findParentByTagName(d.endContainer, 'table', !0)
  12858. if (
  12859. ((e || f) &&
  12860. (e === f
  12861. ? ((e = domUtils.findParentByTagName(
  12862. d.startContainer,
  12863. ['td', 'th', 'caption'],
  12864. !0
  12865. )),
  12866. (f = domUtils.findParentByTagName(
  12867. d.endContainer,
  12868. ['td', 'th', 'caption'],
  12869. !0
  12870. )),
  12871. e !== f && c.selection.clearRange())
  12872. : c.selection.clearRange()),
  12873. (ia = !1),
  12874. (c.document.body.style.webkitUserSelect = ''),
  12875. ca &&
  12876. ha &&
  12877. (c.selection
  12878. .getNative()
  12879. [browser.ie9below ? 'empty' : 'removeAllRanges'](),
  12880. (U = 0),
  12881. (ga = c.document.getElementById('ue_tableDragLine'))))
  12882. ) {
  12883. var g = domUtils.getXY(ha),
  12884. h = domUtils.getXY(ga)
  12885. switch (ca) {
  12886. case 'h':
  12887. z(ha, h.x - g.x)
  12888. break
  12889. case 'v':
  12890. B(ha, h.y - g.y - ha.offsetHeight)
  12891. }
  12892. return (ca = ''), (ha = null), I(c), void c.fireEvent('saveScene')
  12893. }
  12894. if (aa) {
  12895. var i = Y(aa),
  12896. j = i ? i.selectedTds[0] : null
  12897. if (j)
  12898. (d = new dom.Range(c.document)),
  12899. domUtils.isEmptyBlock(j)
  12900. ? d.setStart(j, 0).setCursor(!1, !0)
  12901. : d.selectNodeContents(j).shrinkBoundary().setCursor(!1, !0)
  12902. else if (
  12903. ((d = c.selection.getRange().shrinkBoundary()), !d.collapsed)
  12904. ) {
  12905. var e = domUtils.findParentByTagName(
  12906. d.startContainer,
  12907. ['td', 'th'],
  12908. !0
  12909. ),
  12910. f = domUtils.findParentByTagName(
  12911. d.endContainer,
  12912. ['td', 'th'],
  12913. !0
  12914. )
  12915. ;((e && !f) || (!e && f) || (e && f && e !== f)) &&
  12916. d.setCursor(!1, !0)
  12917. }
  12918. ;(aa = null), c.removeListener('mouseover', x)
  12919. } else {
  12920. var k = domUtils.findParentByTagName(
  12921. b.target || b.srcElement,
  12922. 'td',
  12923. !0
  12924. )
  12925. if (
  12926. (k ||
  12927. (k = domUtils.findParentByTagName(
  12928. b.target || b.srcElement,
  12929. 'th',
  12930. !0
  12931. )),
  12932. k && ('TD' == k.tagName || 'TH' == k.tagName))
  12933. ) {
  12934. if (c.fireEvent('excludetable', k) === !0) return
  12935. ;(d = new dom.Range(c.document)),
  12936. d.setStart(k, 0).setCursor(!1, !0)
  12937. }
  12938. }
  12939. c._selectionChange(250, b)
  12940. }
  12941. }
  12942. }
  12943. function x(a, b) {
  12944. if (!A()) {
  12945. var c = this,
  12946. d = b.target || b.srcElement
  12947. if (
  12948. ((ba =
  12949. domUtils.findParentByTagName(d, 'td', !0) ||
  12950. domUtils.findParentByTagName(d, 'th', !0)),
  12951. aa &&
  12952. ba &&
  12953. (('TD' == aa.tagName && 'TD' == ba.tagName) ||
  12954. ('TH' == aa.tagName && 'TH' == ba.tagName)) &&
  12955. domUtils.findParentByTagName(aa, 'table') ==
  12956. domUtils.findParentByTagName(ba, 'table'))
  12957. ) {
  12958. var e = Y(ba)
  12959. if (aa != ba) {
  12960. ;(c.document.body.style.webkitUserSelect = 'none'),
  12961. c.selection
  12962. .getNative()
  12963. [browser.ie9below ? 'empty' : 'removeAllRanges']()
  12964. var f = e.getCellsRange(aa, ba)
  12965. e.setSelected(f)
  12966. } else
  12967. (c.document.body.style.webkitUserSelect = ''), e.clearSelected()
  12968. }
  12969. b.preventDefault ? b.preventDefault() : (b.returnValue = !1)
  12970. }
  12971. }
  12972. function y(a, b, c) {
  12973. var d = parseInt(domUtils.getComputedStyle(a, 'line-height'), 10),
  12974. e = c + b
  12975. ;(b = e < d ? d : e),
  12976. a.style.height && (a.style.height = ''),
  12977. 1 == a.rowSpan
  12978. ? a.setAttribute('height', b)
  12979. : a.removeAttribute && a.removeAttribute('height')
  12980. }
  12981. function z(a, b) {
  12982. var c = Y(a)
  12983. if (c) {
  12984. var d = c.table,
  12985. e = C(a, d)
  12986. if (
  12987. ((d.style.width = ''),
  12988. d.removeAttribute('width'),
  12989. (b = D(b, a, e)),
  12990. a.nextSibling)
  12991. ) {
  12992. utils.each(e, function (a) {
  12993. ;(a.left.width = +a.left.width + b),
  12994. a.right && (a.right.width = +a.right.width - b)
  12995. })
  12996. } else
  12997. utils.each(e, function (a) {
  12998. a.left.width -= -b
  12999. })
  13000. }
  13001. }
  13002. function A() {
  13003. return 'false' === N.body.contentEditable
  13004. }
  13005. function B(a, b) {
  13006. if (!(Math.abs(b) < 10)) {
  13007. var c = Y(a)
  13008. if (c)
  13009. for (
  13010. var d,
  13011. e = c.getSameEndPosCells(a, 'y'),
  13012. f = e[0] ? e[0].offsetHeight : 0,
  13013. g = 0;
  13014. (d = e[g++]);
  13015. )
  13016. y(d, b, f)
  13017. }
  13018. }
  13019. function C(a, b, c) {
  13020. if ((b || (b = domUtils.findParentByTagName(a, 'table')), !b))
  13021. return null
  13022. for (var d = (domUtils.getNodeIndex(a), a), e = b.rows, f = 0; d; )
  13023. 1 === d.nodeType && (f += d.colSpan || 1), (d = d.previousSibling)
  13024. d = null
  13025. var g = []
  13026. return (
  13027. utils.each(e, function (a) {
  13028. var b = a.cells,
  13029. d = 0
  13030. utils.each(b, function (a) {
  13031. return (
  13032. (d += a.colSpan || 1),
  13033. d === f
  13034. ? (g.push({ left: a, right: a.nextSibling || null }), !1)
  13035. : d > f
  13036. ? (c && g.push({ left: a }), !1)
  13037. : void 0
  13038. )
  13039. })
  13040. }),
  13041. g
  13042. )
  13043. }
  13044. function D(a, b, c) {
  13045. if (((a -= G()), a < 0)) return 0
  13046. a -= E(b)
  13047. var d = a < 0 ? 'left' : 'right'
  13048. return (
  13049. (a = Math.abs(a)),
  13050. utils.each(c, function (b) {
  13051. var c = b[d]
  13052. c && (a = Math.min(a, E(c) - Q))
  13053. }),
  13054. (a = a < 0 ? 0 : a),
  13055. 'left' === d ? -a : a
  13056. )
  13057. }
  13058. function E(a) {
  13059. var b = 0,
  13060. b = a.offsetWidth - G()
  13061. a.nextSibling || (b -= F(a)), (b = b < 0 ? 0 : b)
  13062. try {
  13063. a.width = b
  13064. } catch (c) {}
  13065. return b
  13066. }
  13067. function F(a) {
  13068. if (
  13069. ((tab = domUtils.findParentByTagName(a, 'table', !1)),
  13070. void 0 === tab.offsetVal)
  13071. ) {
  13072. var b = a.previousSibling
  13073. b
  13074. ? (tab.offsetVal =
  13075. a.offsetWidth - b.offsetWidth === X.borderWidth
  13076. ? X.borderWidth
  13077. : 0)
  13078. : (tab.offsetVal = 0)
  13079. }
  13080. return tab.offsetVal
  13081. }
  13082. function G() {
  13083. if (void 0 === X.tabcellSpace) {
  13084. var a = N.document.createElement('table'),
  13085. b = N.document.createElement('tbody'),
  13086. c = N.document.createElement('tr'),
  13087. d = N.document.createElement('td'),
  13088. e = null
  13089. ;(d.style.cssText = 'border: 0;'),
  13090. (d.width = 1),
  13091. c.appendChild(d),
  13092. c.appendChild((e = d.cloneNode(!1))),
  13093. b.appendChild(c),
  13094. a.appendChild(b),
  13095. (a.style.cssText = 'visibility: hidden;'),
  13096. N.body.appendChild(a),
  13097. (X.paddingSpace = d.offsetWidth - 1)
  13098. var f = a.offsetWidth
  13099. ;(d.style.cssText = ''),
  13100. (e.style.cssText = ''),
  13101. (X.borderWidth = (a.offsetWidth - f) / 3),
  13102. (X.tabcellSpace = X.paddingSpace + X.borderWidth),
  13103. N.body.removeChild(a)
  13104. }
  13105. return (
  13106. (G = function () {
  13107. return X.tabcellSpace
  13108. }),
  13109. X.tabcellSpace
  13110. )
  13111. }
  13112. function H(a, b) {
  13113. ia ||
  13114. ((ga = a.document.createElement('div')),
  13115. domUtils.setAttributes(ga, {
  13116. id: 'ue_tableDragLine',
  13117. unselectable: 'on',
  13118. contenteditable: !1,
  13119. onresizestart: 'return false',
  13120. ondragstart: 'return false',
  13121. onselectstart: 'return false',
  13122. style:
  13123. 'background-color:blue;position:absolute;padding:0;margin:0;background-image:none;border:0px none;opacity:0;filter:alpha(opacity=0)'
  13124. }),
  13125. a.body.appendChild(ga))
  13126. }
  13127. function I(a) {
  13128. if (!ia)
  13129. for (var b; (b = a.document.getElementById('ue_tableDragLine')); )
  13130. domUtils.remove(b)
  13131. }
  13132. function J(a, b) {
  13133. if (b) {
  13134. var c,
  13135. d = domUtils.findParentByTagName(b, 'table'),
  13136. e = d.getElementsByTagName('caption'),
  13137. f = d.offsetWidth,
  13138. g = d.offsetHeight - (e.length > 0 ? e[0].offsetHeight : 0),
  13139. h = domUtils.getXY(d),
  13140. i = domUtils.getXY(b)
  13141. switch (a) {
  13142. case 'h':
  13143. ;(c =
  13144. 'height:' +
  13145. g +
  13146. 'px;top:' +
  13147. (h.y + (e.length > 0 ? e[0].offsetHeight : 0)) +
  13148. 'px;left:' +
  13149. (i.x + b.offsetWidth)),
  13150. (ga.style.cssText =
  13151. c +
  13152. 'px;position: absolute;display:block;background-color:blue;width:1px;border:0; color:blue;opacity:.3;filter:alpha(opacity=30)')
  13153. break
  13154. case 'v':
  13155. ;(c =
  13156. 'width:' +
  13157. f +
  13158. 'px;left:' +
  13159. h.x +
  13160. 'px;top:' +
  13161. (i.y + b.offsetHeight)),
  13162. (ga.style.cssText =
  13163. c +
  13164. 'px;overflow:hidden;position: absolute;display:block;background-color:blue;height:1px;border:0;color:blue;opacity:.2;filter:alpha(opacity=20)')
  13165. }
  13166. }
  13167. }
  13168. function K(a, b) {
  13169. for (
  13170. var c, d, e = domUtils.getElementsByTagName(a.body, 'table'), f = 0;
  13171. (d = e[f++]);
  13172. ) {
  13173. var g = domUtils.getElementsByTagName(d, 'td')
  13174. g[0] &&
  13175. (b
  13176. ? ((c = g[0].style.borderColor.replace(/\s/g, '')),
  13177. /(#ffffff)|(rgb\(255,255,255\))/gi.test(c) &&
  13178. domUtils.addClass(d, 'noBorderTable'))
  13179. : domUtils.removeClasses(d, 'noBorderTable'))
  13180. }
  13181. }
  13182. function L(a, b, c) {
  13183. var d = a.body
  13184. return (
  13185. d.offsetWidth -
  13186. (b
  13187. ? 2 * parseInt(domUtils.getComputedStyle(d, 'margin-left'), 10)
  13188. : 0) -
  13189. 2 * c.tableBorder -
  13190. (a.options.offsetWidth || 0)
  13191. )
  13192. }
  13193. function M(a, b) {
  13194. var c = domUtils.findParentByTagName(
  13195. b.target || b.srcElement,
  13196. ['td', 'th'],
  13197. !0
  13198. ),
  13199. d = null
  13200. if (!c) return null
  13201. if (((d = n(c, f(b))), !c)) return null
  13202. if ('h1' === d && c.previousSibling) {
  13203. var e = domUtils.getXY(c),
  13204. g = c.offsetWidth
  13205. Math.abs(e.x + g - b.clientX) > g / 3 && (c = c.previousSibling)
  13206. } else if ('v1' === d && c.parentNode.previousSibling) {
  13207. var e = domUtils.getXY(c),
  13208. h = c.offsetHeight
  13209. Math.abs(e.y + h - b.clientY) > h / 3 &&
  13210. (c = c.parentNode.previousSibling.firstChild)
  13211. }
  13212. return c && a.fireEvent('excludetable', c) !== !0 ? c : null
  13213. }
  13214. var N = this,
  13215. O = null,
  13216. P = null,
  13217. Q = 5,
  13218. R = !1,
  13219. S = 5,
  13220. T = 10,
  13221. U = 0,
  13222. V = null,
  13223. W = 360,
  13224. X = UE.UETable,
  13225. Y = function (a) {
  13226. return X.getUETable(a)
  13227. },
  13228. Z = function (a) {
  13229. return X.getUETableBySelected(a)
  13230. },
  13231. $ = function (a, b) {
  13232. return X.getDefaultValue(a, b)
  13233. },
  13234. _ = function (a) {
  13235. return X.removeSelectedClass(a)
  13236. }
  13237. N.ready(function () {
  13238. var a = this,
  13239. b = a.selection.getText
  13240. a.selection.getText = function () {
  13241. var c = Z(a)
  13242. if (c) {
  13243. var d = ''
  13244. return (
  13245. utils.each(c.selectedTds, function (a) {
  13246. d += a[browser.ie ? 'innerText' : 'textContent']
  13247. }),
  13248. d
  13249. )
  13250. }
  13251. return b.call(a.selection)
  13252. }
  13253. })
  13254. var aa = null,
  13255. ba = null,
  13256. ca = '',
  13257. da = !1,
  13258. ea = null,
  13259. fa = !1,
  13260. ga = null,
  13261. ha = null,
  13262. ia = !1,
  13263. ja = !0
  13264. N.setOpt({
  13265. maxColNum: 20,
  13266. maxRowNum: 100,
  13267. defaultCols: 5,
  13268. defaultRows: 5,
  13269. tdvalign: 'top',
  13270. cursorpath:
  13271. N.options.UEDITOR_HOME_URL + 'themes/default/images/cursor_',
  13272. tableDragable: !1,
  13273. classList: [
  13274. 'ue-table-interlace-color-single',
  13275. 'ue-table-interlace-color-double'
  13276. ]
  13277. }),
  13278. (N.getUETable = Y)
  13279. var ka = {
  13280. deletetable: 1,
  13281. inserttable: 1,
  13282. cellvalign: 1,
  13283. insertcaption: 1,
  13284. deletecaption: 1,
  13285. inserttitle: 1,
  13286. deletetitle: 1,
  13287. mergeright: 1,
  13288. mergedown: 1,
  13289. mergecells: 1,
  13290. insertrow: 1,
  13291. insertrownext: 1,
  13292. deleterow: 1,
  13293. insertcol: 1,
  13294. insertcolnext: 1,
  13295. deletecol: 1,
  13296. splittocells: 1,
  13297. splittorows: 1,
  13298. splittocols: 1,
  13299. adaptbytext: 1,
  13300. adaptbywindow: 1,
  13301. adaptbycustomer: 1,
  13302. insertparagraph: 1,
  13303. insertparagraphbeforetable: 1,
  13304. averagedistributecol: 1,
  13305. averagedistributerow: 1
  13306. }
  13307. N.ready(function () {
  13308. utils.cssRule(
  13309. 'table',
  13310. '.selectTdClass{background-color:#edf5fa !important}table.noBorderTable td,table.noBorderTable th,table.noBorderTable caption{border:1px dashed #ddd !important}table{margin-bottom:10px;border-collapse:collapse;display:table;}td,th{padding: 5px 10px;border: 1px solid #DDD;}caption{border:1px dashed #DDD;border-bottom:0;padding:3px;text-align:center;}th{border-top:1px solid #BBB;background-color:#F7F7F7;}table tr.firstRow th{border-top-width:2px;}.ue-table-interlace-color-single{ background-color: #fcfcfc; } .ue-table-interlace-color-double{ background-color: #f7faff; }td p{margin:0;padding:0;}',
  13311. N.document
  13312. )
  13313. var a, c, f
  13314. N.addListener('keydown', function (b, d) {
  13315. var g = this,
  13316. h = d.keyCode || d.which
  13317. if (8 == h) {
  13318. var i = Z(g)
  13319. i &&
  13320. i.selectedTds.length &&
  13321. (i.isFullCol()
  13322. ? g.execCommand('deletecol')
  13323. : i.isFullRow()
  13324. ? g.execCommand('deleterow')
  13325. : g.fireEvent('delcells'),
  13326. domUtils.preventDefault(d))
  13327. var j = domUtils.findParentByTagName(
  13328. g.selection.getStart(),
  13329. 'caption',
  13330. !0
  13331. ),
  13332. k = g.selection.getRange()
  13333. if (k.collapsed && j && e(j)) {
  13334. g.fireEvent('saveScene')
  13335. var l = j.parentNode
  13336. domUtils.remove(j),
  13337. l && k.setStart(l.rows[0].cells[0], 0).setCursor(!1, !0),
  13338. g.fireEvent('saveScene')
  13339. }
  13340. }
  13341. if (46 == h && (i = Z(g))) {
  13342. g.fireEvent('saveScene')
  13343. for (var m, n = 0; (m = i.selectedTds[n++]); )
  13344. domUtils.fillNode(g.document, m)
  13345. g.fireEvent('saveScene'), domUtils.preventDefault(d)
  13346. }
  13347. if (13 == h) {
  13348. var o = g.selection.getRange(),
  13349. j = domUtils.findParentByTagName(o.startContainer, 'caption', !0)
  13350. if (j) {
  13351. var l = domUtils.findParentByTagName(j, 'table')
  13352. return (
  13353. o.collapsed
  13354. ? j && o.setStart(l.rows[0].cells[0], 0).setCursor(!1, !0)
  13355. : (o.deleteContents(), g.fireEvent('saveScene')),
  13356. void domUtils.preventDefault(d)
  13357. )
  13358. }
  13359. if (o.collapsed) {
  13360. var l = domUtils.findParentByTagName(o.startContainer, 'table')
  13361. if (l) {
  13362. var p = l.rows[0].cells[0],
  13363. q = domUtils.findParentByTagName(
  13364. g.selection.getStart(),
  13365. ['td', 'th'],
  13366. !0
  13367. ),
  13368. r = l.previousSibling
  13369. if (
  13370. p === q &&
  13371. (!r || (1 == r.nodeType && 'TABLE' == r.tagName)) &&
  13372. domUtils.isStartInblock(o)
  13373. ) {
  13374. var s = domUtils.findParent(
  13375. g.selection.getStart(),
  13376. function (a) {
  13377. return domUtils.isBlockElm(a)
  13378. },
  13379. !0
  13380. )
  13381. s &&
  13382. (/t(h|d)/i.test(s.tagName) || s === q.firstChild) &&
  13383. (g.execCommand('insertparagraphbeforetable'),
  13384. domUtils.preventDefault(d))
  13385. }
  13386. }
  13387. }
  13388. }
  13389. if ((d.ctrlKey || d.metaKey) && '67' == d.keyCode) {
  13390. a = null
  13391. var i = Z(g)
  13392. if (i) {
  13393. var t = i.selectedTds
  13394. ;(c = i.isFullCol()),
  13395. (f = i.isFullRow()),
  13396. (a = [[i.cloneCell(t[0], null, !0)]])
  13397. for (var m, n = 1; (m = t[n]); n++)
  13398. m.parentNode !== t[n - 1].parentNode
  13399. ? a.push([i.cloneCell(m, null, !0)])
  13400. : a[a.length - 1].push(i.cloneCell(m, null, !0))
  13401. }
  13402. }
  13403. }),
  13404. N.addListener('tablehasdeleted', function () {
  13405. m(this, !1, '', null), ea && domUtils.remove(ea)
  13406. }),
  13407. N.addListener('beforepaste', function (d, g) {
  13408. var h = this,
  13409. i = h.selection.getRange()
  13410. if (domUtils.findParentByTagName(i.startContainer, 'caption', !0)) {
  13411. var j = h.document.createElement('div')
  13412. return (
  13413. (j.innerHTML = g.html),
  13414. void (g.html =
  13415. j[browser.ie9below ? 'innerText' : 'textContent'])
  13416. )
  13417. }
  13418. var k = Z(h)
  13419. if (a) {
  13420. h.fireEvent('saveScene')
  13421. var l,
  13422. m,
  13423. i = h.selection.getRange(),
  13424. n = domUtils.findParentByTagName(
  13425. i.startContainer,
  13426. ['td', 'th'],
  13427. !0
  13428. )
  13429. if (n) {
  13430. var o = Y(n)
  13431. if (f) {
  13432. var p = o.getCellInfo(n).rowIndex
  13433. 'TH' == n.tagName && p++
  13434. for (var q, r = 0; (q = a[r++]); ) {
  13435. for (
  13436. var s, t = o.insertRow(p++, 'td'), u = 0;
  13437. (s = q[u]);
  13438. u++
  13439. ) {
  13440. var v = t.cells[u]
  13441. v || (v = t.insertCell(u)),
  13442. (v.innerHTML = s.innerHTML),
  13443. s.getAttribute('width') &&
  13444. v.setAttribute('width', s.getAttribute('width')),
  13445. s.getAttribute('vAlign') &&
  13446. v.setAttribute('vAlign', s.getAttribute('vAlign')),
  13447. s.getAttribute('align') &&
  13448. v.setAttribute('align', s.getAttribute('align')),
  13449. s.style.cssText && (v.style.cssText = s.style.cssText)
  13450. }
  13451. for (var s, u = 0; (s = t.cells[u]) && q[u]; u++)
  13452. (s.innerHTML = q[u].innerHTML),
  13453. q[u].getAttribute('width') &&
  13454. s.setAttribute('width', q[u].getAttribute('width')),
  13455. q[u].getAttribute('vAlign') &&
  13456. s.setAttribute('vAlign', q[u].getAttribute('vAlign')),
  13457. q[u].getAttribute('align') &&
  13458. s.setAttribute('align', q[u].getAttribute('align')),
  13459. q[u].style.cssText &&
  13460. (s.style.cssText = q[u].style.cssText)
  13461. }
  13462. } else {
  13463. if (c) {
  13464. y = o.getCellInfo(n)
  13465. for (var s, w = 0, u = 0, q = a[0]; (s = q[u++]); )
  13466. w += s.colSpan || 1
  13467. for (h.__hasEnterExecCommand = !0, r = 0; r < w; r++)
  13468. h.execCommand('insertcol')
  13469. ;(h.__hasEnterExecCommand = !1),
  13470. (n = o.table.rows[0].cells[y.cellIndex]),
  13471. 'TH' == n.tagName &&
  13472. (n = o.table.rows[1].cells[y.cellIndex])
  13473. }
  13474. for (var q, r = 0; (q = a[r++]); ) {
  13475. l = n
  13476. for (var s, u = 0; (s = q[u++]); )
  13477. if (n)
  13478. (n.innerHTML = s.innerHTML),
  13479. s.getAttribute('width') &&
  13480. n.setAttribute('width', s.getAttribute('width')),
  13481. s.getAttribute('vAlign') &&
  13482. n.setAttribute('vAlign', s.getAttribute('vAlign')),
  13483. s.getAttribute('align') &&
  13484. n.setAttribute('align', s.getAttribute('align')),
  13485. s.style.cssText &&
  13486. (n.style.cssText = s.style.cssText),
  13487. (m = n),
  13488. (n = n.nextSibling)
  13489. else {
  13490. var x = s.cloneNode(!0)
  13491. domUtils.removeAttributes(x, [
  13492. 'class',
  13493. 'rowSpan',
  13494. 'colSpan'
  13495. ]),
  13496. m.parentNode.appendChild(x)
  13497. }
  13498. if (((n = o.getNextCell(l, !0, !0)), !a[r])) break
  13499. if (!n) {
  13500. var y = o.getCellInfo(l)
  13501. o.table.insertRow(o.table.rows.length),
  13502. o.update(),
  13503. (n = o.getVSideCell(l, !0))
  13504. }
  13505. }
  13506. }
  13507. o.update()
  13508. } else {
  13509. k = h.document.createElement('table')
  13510. for (var q, r = 0; (q = a[r++]); ) {
  13511. for (
  13512. var s, t = k.insertRow(k.rows.length), u = 0;
  13513. (s = q[u++]);
  13514. )
  13515. (x = X.cloneCell(s, null, !0)),
  13516. domUtils.removeAttributes(x, ['class']),
  13517. t.appendChild(x)
  13518. 2 == u && x.rowSpan > 1 && (x.rowSpan = 1)
  13519. }
  13520. var z = $(h),
  13521. A =
  13522. h.body.offsetWidth -
  13523. (ja
  13524. ? 2 *
  13525. parseInt(
  13526. domUtils.getComputedStyle(h.body, 'margin-left'),
  13527. 10
  13528. )
  13529. : 0) -
  13530. 2 * z.tableBorder -
  13531. (h.options.offsetWidth || 0)
  13532. h.execCommand(
  13533. 'insertHTML',
  13534. '<table ' +
  13535. (c && f ? 'width="' + A + '"' : '') +
  13536. '>' +
  13537. k.innerHTML
  13538. .replace(/>\s*</g, '><')
  13539. .replace(/\bth\b/gi, 'td') +
  13540. '</table>'
  13541. )
  13542. }
  13543. return (
  13544. h.fireEvent('contentchange'),
  13545. h.fireEvent('saveScene'),
  13546. (g.html = ''),
  13547. !0
  13548. )
  13549. }
  13550. var B,
  13551. j = h.document.createElement('div')
  13552. ;(j.innerHTML = g.html),
  13553. (B = j.getElementsByTagName('table')),
  13554. domUtils.findParentByTagName(h.selection.getStart(), 'table')
  13555. ? (utils.each(B, function (a) {
  13556. domUtils.remove(a)
  13557. }),
  13558. domUtils.findParentByTagName(
  13559. h.selection.getStart(),
  13560. 'caption',
  13561. !0
  13562. ) &&
  13563. (j.innerHTML = j[browser.ie ? 'innerText' : 'textContent']))
  13564. : utils.each(B, function (a) {
  13565. b(a, !0),
  13566. domUtils.removeAttributes(a, ['style', 'border']),
  13567. utils.each(
  13568. domUtils.getElementsByTagName(a, 'td'),
  13569. function (a) {
  13570. e(a) && domUtils.fillNode(h.document, a), b(a, !0)
  13571. }
  13572. )
  13573. }),
  13574. (g.html = j.innerHTML)
  13575. }),
  13576. N.addListener('afterpaste', function () {
  13577. utils.each(
  13578. domUtils.getElementsByTagName(N.body, 'table'),
  13579. function (a) {
  13580. if (a.offsetWidth > N.body.offsetWidth) {
  13581. var b = $(N, a)
  13582. a.style.width =
  13583. N.body.offsetWidth -
  13584. (ja
  13585. ? 2 *
  13586. parseInt(
  13587. domUtils.getComputedStyle(N.body, 'margin-left'),
  13588. 10
  13589. )
  13590. : 0) -
  13591. 2 * b.tableBorder -
  13592. (N.options.offsetWidth || 0) +
  13593. 'px'
  13594. }
  13595. }
  13596. )
  13597. }),
  13598. N.addListener('blur', function () {
  13599. a = null
  13600. })
  13601. var i
  13602. N.addListener('keydown', function () {
  13603. clearTimeout(i),
  13604. (i = setTimeout(function () {
  13605. var a = N.selection.getRange(),
  13606. b = domUtils.findParentByTagName(
  13607. a.startContainer,
  13608. ['th', 'td'],
  13609. !0
  13610. )
  13611. if (b) {
  13612. var c = b.parentNode.parentNode.parentNode
  13613. c.offsetWidth > c.getAttribute('width') &&
  13614. (b.style.wordBreak = 'break-all')
  13615. }
  13616. }, 100))
  13617. }),
  13618. N.addListener('selectionchange', function () {
  13619. m(N, !1, '', null)
  13620. }),
  13621. N.addListener('contentchange', function () {
  13622. var a = this
  13623. if ((I(a), !Z(a))) {
  13624. var b = a.selection.getRange(),
  13625. c = b.startContainer
  13626. ;(c = domUtils.findParentByTagName(c, ['td', 'th'], !0)),
  13627. utils.each(
  13628. domUtils.getElementsByTagName(a.document, 'table'),
  13629. function (b) {
  13630. a.fireEvent('excludetable', b) !== !0 &&
  13631. ((b.ueTable = new X(b)),
  13632. (b.onmouseover = function () {
  13633. a.fireEvent('tablemouseover', b)
  13634. }),
  13635. (b.onmousemove = function () {
  13636. a.fireEvent('tablemousemove', b),
  13637. a.options.tableDragable && h(!0, this, a),
  13638. utils.defer(function () {
  13639. a.fireEvent('contentchange', 50)
  13640. }, !0)
  13641. }),
  13642. (b.onmouseout = function () {
  13643. a.fireEvent('tablemouseout', b),
  13644. m(a, !1, '', null),
  13645. I(a)
  13646. }),
  13647. (b.onclick = function (b) {
  13648. b = a.window.event || b
  13649. var c = d(b.target || b.srcElement)
  13650. if (c) {
  13651. var e,
  13652. f = Y(c),
  13653. g = f.table,
  13654. h = f.getCellInfo(c),
  13655. i = a.selection.getRange()
  13656. if (j(g, c, b, !0)) {
  13657. var k = f.getCell(
  13658. f.indexTable[f.rowsNum - 1][h.colIndex].rowIndex,
  13659. f.indexTable[f.rowsNum - 1][h.colIndex].cellIndex
  13660. )
  13661. return void (b.shiftKey && f.selectedTds.length
  13662. ? f.selectedTds[0] !== k
  13663. ? ((e = f.getCellsRange(f.selectedTds[0], k)),
  13664. f.setSelected(e))
  13665. : i && i.selectNodeContents(k).select()
  13666. : c !== k
  13667. ? ((e = f.getCellsRange(c, k)), f.setSelected(e))
  13668. : i && i.selectNodeContents(k).select())
  13669. }
  13670. if (j(g, c, b)) {
  13671. var l = f.getCell(
  13672. f.indexTable[h.rowIndex][f.colsNum - 1].rowIndex,
  13673. f.indexTable[h.rowIndex][f.colsNum - 1].cellIndex
  13674. )
  13675. b.shiftKey && f.selectedTds.length
  13676. ? f.selectedTds[0] !== l
  13677. ? ((e = f.getCellsRange(f.selectedTds[0], l)),
  13678. f.setSelected(e))
  13679. : i && i.selectNodeContents(l).select()
  13680. : c !== l
  13681. ? ((e = f.getCellsRange(c, l)), f.setSelected(e))
  13682. : i && i.selectNodeContents(l).select()
  13683. }
  13684. }
  13685. }))
  13686. }
  13687. ),
  13688. K(a, !0)
  13689. }
  13690. }),
  13691. domUtils.on(N.document, 'mousemove', g),
  13692. domUtils.on(N.document, 'mouseout', function (a) {
  13693. var b = a.target || a.srcElement
  13694. 'TABLE' == b.tagName && m(N, !1, '', null)
  13695. }),
  13696. N.addListener('interlacetable', function (a, b, c) {
  13697. if (b)
  13698. for (
  13699. var d = this,
  13700. e = b.rows,
  13701. f = e.length,
  13702. g = function (a, b, c) {
  13703. return a[b] ? a[b] : c ? a[b % a.length] : ''
  13704. },
  13705. h = 0;
  13706. h < f;
  13707. h++
  13708. )
  13709. e[h].className = g(c || d.options.classList, h, !0)
  13710. }),
  13711. N.addListener('uninterlacetable', function (a, b) {
  13712. if (b)
  13713. for (
  13714. var c = this,
  13715. d = b.rows,
  13716. e = c.options.classList,
  13717. f = d.length,
  13718. g = 0;
  13719. g < f;
  13720. g++
  13721. )
  13722. domUtils.removeClasses(d[g], e)
  13723. }),
  13724. N.addListener('mousedown', o),
  13725. N.addListener('mouseup', w),
  13726. domUtils.on(N.body, 'dragstart', function (a) {
  13727. w.call(N, 'dragstart', a)
  13728. }),
  13729. N.addOutputRule(function (a) {
  13730. utils.each(a.getNodesByTagName('div'), function (a) {
  13731. 'ue_tableDragLine' == a.getAttr('id') &&
  13732. a.parentNode.removeChild(a)
  13733. })
  13734. })
  13735. var k = 0
  13736. N.addListener('mousedown', function () {
  13737. k = 0
  13738. }),
  13739. N.addListener('tabkeydown', function () {
  13740. var a = this.selection.getRange(),
  13741. b = a.getCommonAncestor(!0, !0),
  13742. c = domUtils.findParentByTagName(b, 'table')
  13743. if (c) {
  13744. if (domUtils.findParentByTagName(b, 'caption', !0)) {
  13745. var d = domUtils.getElementsByTagName(c, 'th td')
  13746. d && d.length && a.setStart(d[0], 0).setCursor(!1, !0)
  13747. } else {
  13748. var d = domUtils.findParentByTagName(b, ['td', 'th'], !0),
  13749. f = Y(d)
  13750. k = d.rowSpan > 1 ? k : f.getCellInfo(d).rowIndex
  13751. var g = f.getTabNextCell(d, k)
  13752. g
  13753. ? e(g)
  13754. ? a.setStart(g, 0).setCursor(!1, !0)
  13755. : a.selectNodeContents(g).select()
  13756. : (N.fireEvent('saveScene'),
  13757. (N.__hasEnterExecCommand = !0),
  13758. this.execCommand('insertrownext'),
  13759. (N.__hasEnterExecCommand = !1),
  13760. (a = this.selection.getRange()),
  13761. a
  13762. .setStart(c.rows[c.rows.length - 1].cells[0], 0)
  13763. .setCursor(),
  13764. N.fireEvent('saveScene'))
  13765. }
  13766. return !0
  13767. }
  13768. }),
  13769. browser.ie &&
  13770. N.addListener('selectionchange', function () {
  13771. m(this, !1, '', null)
  13772. }),
  13773. N.addListener('keydown', function (a, b) {
  13774. var c = this,
  13775. d = b.keyCode || b.which
  13776. if (8 != d && 46 != d) {
  13777. var e = !(b.ctrlKey || b.metaKey || b.shiftKey || b.altKey)
  13778. e && _(domUtils.getElementsByTagName(c.body, 'td'))
  13779. var f = Z(c)
  13780. f && e && f.clearSelected()
  13781. }
  13782. }),
  13783. N.addListener('beforegetcontent', function () {
  13784. K(this, !1),
  13785. browser.ie &&
  13786. utils.each(
  13787. this.document.getElementsByTagName('caption'),
  13788. function (a) {
  13789. domUtils.isEmptyNode(a) && (a.innerHTML = '&nbsp;')
  13790. }
  13791. )
  13792. }),
  13793. N.addListener('aftergetcontent', function () {
  13794. K(this, !0)
  13795. }),
  13796. N.addListener('getAllHtml', function () {
  13797. _(N.document.getElementsByTagName('td'))
  13798. }),
  13799. N.addListener('fullscreenchanged', function (a, b) {
  13800. if (!b) {
  13801. var c = this.body.offsetWidth / document.body.offsetWidth,
  13802. d = domUtils.getElementsByTagName(this.body, 'table')
  13803. utils.each(d, function (a) {
  13804. if (a.offsetWidth < N.body.offsetWidth) return !1
  13805. var b = domUtils.getElementsByTagName(a, 'td'),
  13806. d = []
  13807. utils.each(b, function (a) {
  13808. d.push(a.offsetWidth)
  13809. })
  13810. for (var e, f = 0; (e = b[f]); f++)
  13811. e.setAttribute('width', Math.floor(d[f] * c))
  13812. a.setAttribute('width', Math.floor(L(N, ja, $(N))))
  13813. })
  13814. }
  13815. })
  13816. var l = N.execCommand
  13817. N.execCommand = function (a, b) {
  13818. var c = this
  13819. a = a.toLowerCase()
  13820. var d,
  13821. f,
  13822. g = Z(c),
  13823. h = new dom.Range(c.document),
  13824. i = c.commands[a] || UE.commands[a]
  13825. if (i) {
  13826. if (!g || ka[a] || i.notNeedUndo || c.__hasEnterExecCommand)
  13827. f = l.apply(c, arguments)
  13828. else {
  13829. ;(c.__hasEnterExecCommand = !0),
  13830. c.fireEvent('beforeexeccommand', a),
  13831. (d = g.selectedTds)
  13832. for (var j, k, m, n = -2, o = -2, p = 0; (m = d[p]); p++)
  13833. e(m)
  13834. ? h.setStart(m, 0).setCursor(!1, !0)
  13835. : h.selectNode(m).select(!0),
  13836. (k = c.queryCommandState(a)),
  13837. (j = c.queryCommandValue(a)),
  13838. k != -1 &&
  13839. ((n === k && o === j) ||
  13840. ((c._ignoreContentChange = !0),
  13841. (f = l.apply(c, arguments)),
  13842. (c._ignoreContentChange = !1)),
  13843. (n = c.queryCommandState(a)),
  13844. (o = c.queryCommandValue(a)),
  13845. domUtils.isEmptyBlock(m) &&
  13846. domUtils.fillNode(c.document, m))
  13847. h.setStart(d[0], 0).shrinkBoundary(!0).setCursor(!1, !0),
  13848. c.fireEvent('contentchange'),
  13849. c.fireEvent('afterexeccommand', a),
  13850. (c.__hasEnterExecCommand = !1),
  13851. c._selectionChange()
  13852. }
  13853. return f
  13854. }
  13855. }
  13856. })
  13857. var la
  13858. }),
  13859. (UE.UETable.prototype.sortTable = function (a, b) {
  13860. var c = this.table,
  13861. d = c.rows,
  13862. e = [],
  13863. f = 'TH' === d[0].cells[0].tagName,
  13864. g = 0
  13865. if (this.selectedTds.length) {
  13866. for (
  13867. var h = this.cellsRange, i = h.endRowIndex + 1, j = h.beginRowIndex;
  13868. j < i;
  13869. j++
  13870. )
  13871. e[j] = d[j]
  13872. e.splice(0, h.beginRowIndex),
  13873. (g = h.endRowIndex + 1 === this.rowsNum ? 0 : h.endRowIndex + 1)
  13874. } else for (var j = 0, i = d.length; j < i; j++) e[j] = d[j]
  13875. var k = {
  13876. reversecurrent: function (a, b) {
  13877. return 1
  13878. },
  13879. orderbyasc: function (a, b) {
  13880. var c = a.innerText || a.textContent,
  13881. d = b.innerText || b.textContent
  13882. return c.localeCompare(d)
  13883. },
  13884. reversebyasc: function (a, b) {
  13885. var c = a.innerHTML,
  13886. d = b.innerHTML
  13887. return d.localeCompare(c)
  13888. },
  13889. orderbynum: function (a, b) {
  13890. var c = a[browser.ie ? 'innerText' : 'textContent'].match(/\d+/),
  13891. d = b[browser.ie ? 'innerText' : 'textContent'].match(/\d+/)
  13892. return c && (c = +c[0]), d && (d = +d[0]), (c || 0) - (d || 0)
  13893. },
  13894. reversebynum: function (a, b) {
  13895. var c = a[browser.ie ? 'innerText' : 'textContent'].match(/\d+/),
  13896. d = b[browser.ie ? 'innerText' : 'textContent'].match(/\d+/)
  13897. return c && (c = +c[0]), d && (d = +d[0]), (d || 0) - (c || 0)
  13898. }
  13899. }
  13900. c.setAttribute(
  13901. 'data-sort-type',
  13902. b && 'string' == typeof b && k[b] ? b : ''
  13903. ),
  13904. f && e.splice(0, 1),
  13905. (e = utils.sort(e, function (c, d) {
  13906. var e
  13907. return (e =
  13908. b && 'function' == typeof b
  13909. ? b.call(this, c.cells[a], d.cells[a])
  13910. : b && 'number' == typeof b
  13911. ? 1
  13912. : b && 'string' == typeof b && k[b]
  13913. ? k[b].call(this, c.cells[a], d.cells[a])
  13914. : k.orderbyasc.call(this, c.cells[a], d.cells[a]))
  13915. }))
  13916. for (
  13917. var l = c.ownerDocument.createDocumentFragment(), m = 0, i = e.length;
  13918. m < i;
  13919. m++
  13920. )
  13921. l.appendChild(e[m])
  13922. var n = c.getElementsByTagName('tbody')[0]
  13923. g
  13924. ? n.insertBefore(l, d[g - h.endRowIndex + h.beginRowIndex - 1])
  13925. : n.appendChild(l)
  13926. }),
  13927. (UE.plugins.tablesort = function () {
  13928. var a = this,
  13929. b = UE.UETable,
  13930. c = function (a) {
  13931. return b.getUETable(a)
  13932. },
  13933. d = function (a) {
  13934. return b.getTableItemsByRange(a)
  13935. }
  13936. a.ready(function () {
  13937. utils.cssRule(
  13938. 'tablesort',
  13939. 'table.sortEnabled tr.firstRow th,table.sortEnabled tr.firstRow td{padding-right:20px;background-repeat: no-repeat;background-position: center right; background-image:url(' +
  13940. a.options.themePath +
  13941. a.options.theme +
  13942. '/images/sortable.png);}',
  13943. a.document
  13944. ),
  13945. a.addListener('afterexeccommand', function (a, b) {
  13946. ;('mergeright' != b && 'mergedown' != b && 'mergecells' != b) ||
  13947. this.execCommand('disablesort')
  13948. })
  13949. }),
  13950. (UE.commands.sorttable = {
  13951. queryCommandState: function () {
  13952. var a = this,
  13953. b = d(a)
  13954. if (!b.cell) return -1
  13955. for (
  13956. var c, e = b.table, f = e.getElementsByTagName('td'), g = 0;
  13957. (c = f[g++]);
  13958. )
  13959. if (1 != c.rowSpan || 1 != c.colSpan) return -1
  13960. return 0
  13961. },
  13962. execCommand: function (a, b) {
  13963. var e = this,
  13964. f = e.selection.getRange(),
  13965. g = f.createBookmark(!0),
  13966. h = d(e),
  13967. i = h.cell,
  13968. j = c(h.table),
  13969. k = j.getCellInfo(i)
  13970. j.sortTable(k.cellIndex, b), f.moveToBookmark(g)
  13971. try {
  13972. f.select()
  13973. } catch (l) {}
  13974. }
  13975. }),
  13976. (UE.commands.enablesort = UE.commands.disablesort =
  13977. {
  13978. queryCommandState: function (a) {
  13979. var b = d(this).table
  13980. if (b && 'enablesort' == a)
  13981. for (
  13982. var c = domUtils.getElementsByTagName(b, 'th td'), e = 0;
  13983. e < c.length;
  13984. e++
  13985. )
  13986. if (
  13987. c[e].getAttribute('colspan') > 1 ||
  13988. c[e].getAttribute('rowspan') > 1
  13989. )
  13990. return -1
  13991. return b
  13992. ? ('enablesort' == a) ^
  13993. ('sortEnabled' != b.getAttribute('data-sort'))
  13994. ? -1
  13995. : 0
  13996. : -1
  13997. },
  13998. execCommand: function (a) {
  13999. var b = d(this).table
  14000. b.setAttribute(
  14001. 'data-sort',
  14002. 'enablesort' == a ? 'sortEnabled' : 'sortDisabled'
  14003. ),
  14004. 'enablesort' == a
  14005. ? domUtils.addClass(b, 'sortEnabled')
  14006. : domUtils.removeClasses(b, 'sortEnabled')
  14007. }
  14008. })
  14009. }),
  14010. (UE.plugins.contextmenu = function () {
  14011. var a = this
  14012. if (
  14013. (a.setOpt('enableContextMenu', !0),
  14014. a.getOpt('enableContextMenu') !== !1)
  14015. ) {
  14016. var b,
  14017. c = a.getLang('contextMenu'),
  14018. d = a.options.contextMenu || [
  14019. { label: c.selectall, cmdName: 'selectall' },
  14020. {
  14021. label: c.cleardoc,
  14022. cmdName: 'cleardoc',
  14023. exec: function () {
  14024. confirm(c.confirmclear) && this.execCommand('cleardoc')
  14025. }
  14026. },
  14027. '-',
  14028. { label: c.unlink, cmdName: 'unlink' },
  14029. '-',
  14030. {
  14031. group: c.paragraph,
  14032. icon: 'justifyjustify',
  14033. subMenu: [
  14034. { label: c.justifyleft, cmdName: 'justify', value: 'left' },
  14035. { label: c.justifyright, cmdName: 'justify', value: 'right' },
  14036. { label: c.justifycenter, cmdName: 'justify', value: 'center' },
  14037. {
  14038. label: c.justifyjustify,
  14039. cmdName: 'justify',
  14040. value: 'justify'
  14041. }
  14042. ]
  14043. },
  14044. '-',
  14045. {
  14046. group: c.table,
  14047. icon: 'table',
  14048. subMenu: [
  14049. { label: c.inserttable, cmdName: 'inserttable' },
  14050. { label: c.deletetable, cmdName: 'deletetable' },
  14051. '-',
  14052. { label: c.deleterow, cmdName: 'deleterow' },
  14053. { label: c.deletecol, cmdName: 'deletecol' },
  14054. { label: c.insertcol, cmdName: 'insertcol' },
  14055. { label: c.insertcolnext, cmdName: 'insertcolnext' },
  14056. { label: c.insertrow, cmdName: 'insertrow' },
  14057. { label: c.insertrownext, cmdName: 'insertrownext' },
  14058. '-',
  14059. { label: c.insertcaption, cmdName: 'insertcaption' },
  14060. { label: c.deletecaption, cmdName: 'deletecaption' },
  14061. { label: c.inserttitle, cmdName: 'inserttitle' },
  14062. { label: c.deletetitle, cmdName: 'deletetitle' },
  14063. { label: c.inserttitlecol, cmdName: 'inserttitlecol' },
  14064. { label: c.deletetitlecol, cmdName: 'deletetitlecol' },
  14065. '-',
  14066. { label: c.mergecells, cmdName: 'mergecells' },
  14067. { label: c.mergeright, cmdName: 'mergeright' },
  14068. { label: c.mergedown, cmdName: 'mergedown' },
  14069. '-',
  14070. { label: c.splittorows, cmdName: 'splittorows' },
  14071. { label: c.splittocols, cmdName: 'splittocols' },
  14072. { label: c.splittocells, cmdName: 'splittocells' },
  14073. '-',
  14074. { label: c.averageDiseRow, cmdName: 'averagedistributerow' },
  14075. { label: c.averageDisCol, cmdName: 'averagedistributecol' },
  14076. '-',
  14077. {
  14078. label: c.edittd,
  14079. cmdName: 'edittd',
  14080. exec: function () {
  14081. UE.ui.edittd && new UE.ui.edittd(this),
  14082. this.getDialog('edittd').open()
  14083. }
  14084. },
  14085. {
  14086. label: c.edittable,
  14087. cmdName: 'edittable',
  14088. exec: function () {
  14089. UE.ui.edittable && new UE.ui.edittable(this),
  14090. this.getDialog('edittable').open()
  14091. }
  14092. },
  14093. { label: c.setbordervisible, cmdName: 'setbordervisible' }
  14094. ]
  14095. },
  14096. {
  14097. group: c.tablesort,
  14098. icon: 'tablesort',
  14099. subMenu: [
  14100. { label: c.enablesort, cmdName: 'enablesort' },
  14101. { label: c.disablesort, cmdName: 'disablesort' },
  14102. '-',
  14103. {
  14104. label: c.reversecurrent,
  14105. cmdName: 'sorttable',
  14106. value: 'reversecurrent'
  14107. },
  14108. {
  14109. label: c.orderbyasc,
  14110. cmdName: 'sorttable',
  14111. value: 'orderbyasc'
  14112. },
  14113. {
  14114. label: c.reversebyasc,
  14115. cmdName: 'sorttable',
  14116. value: 'reversebyasc'
  14117. },
  14118. {
  14119. label: c.orderbynum,
  14120. cmdName: 'sorttable',
  14121. value: 'orderbynum'
  14122. },
  14123. {
  14124. label: c.reversebynum,
  14125. cmdName: 'sorttable',
  14126. value: 'reversebynum'
  14127. }
  14128. ]
  14129. },
  14130. {
  14131. group: c.borderbk,
  14132. icon: 'borderBack',
  14133. subMenu: [
  14134. {
  14135. label: c.setcolor,
  14136. cmdName: 'interlacetable',
  14137. exec: function () {
  14138. this.execCommand('interlacetable')
  14139. }
  14140. },
  14141. {
  14142. label: c.unsetcolor,
  14143. cmdName: 'uninterlacetable',
  14144. exec: function () {
  14145. this.execCommand('uninterlacetable')
  14146. }
  14147. },
  14148. {
  14149. label: c.setbackground,
  14150. cmdName: 'settablebackground',
  14151. exec: function () {
  14152. this.execCommand('settablebackground', {
  14153. repeat: !0,
  14154. colorList: ['#bbb', '#ccc']
  14155. })
  14156. }
  14157. },
  14158. {
  14159. label: c.unsetbackground,
  14160. cmdName: 'cleartablebackground',
  14161. exec: function () {
  14162. this.execCommand('cleartablebackground')
  14163. }
  14164. },
  14165. {
  14166. label: c.redandblue,
  14167. cmdName: 'settablebackground',
  14168. exec: function () {
  14169. this.execCommand('settablebackground', {
  14170. repeat: !0,
  14171. colorList: ['red', 'blue']
  14172. })
  14173. }
  14174. },
  14175. {
  14176. label: c.threecolorgradient,
  14177. cmdName: 'settablebackground',
  14178. exec: function () {
  14179. this.execCommand('settablebackground', {
  14180. repeat: !0,
  14181. colorList: ['#aaa', '#bbb', '#ccc']
  14182. })
  14183. }
  14184. }
  14185. ]
  14186. },
  14187. {
  14188. group: c.aligntd,
  14189. icon: 'aligntd',
  14190. subMenu: [
  14191. {
  14192. cmdName: 'cellalignment',
  14193. value: { align: 'left', vAlign: 'top' }
  14194. },
  14195. {
  14196. cmdName: 'cellalignment',
  14197. value: { align: 'center', vAlign: 'top' }
  14198. },
  14199. {
  14200. cmdName: 'cellalignment',
  14201. value: { align: 'right', vAlign: 'top' }
  14202. },
  14203. {
  14204. cmdName: 'cellalignment',
  14205. value: { align: 'left', vAlign: 'middle' }
  14206. },
  14207. {
  14208. cmdName: 'cellalignment',
  14209. value: { align: 'center', vAlign: 'middle' }
  14210. },
  14211. {
  14212. cmdName: 'cellalignment',
  14213. value: { align: 'right', vAlign: 'middle' }
  14214. },
  14215. {
  14216. cmdName: 'cellalignment',
  14217. value: { align: 'left', vAlign: 'bottom' }
  14218. },
  14219. {
  14220. cmdName: 'cellalignment',
  14221. value: { align: 'center', vAlign: 'bottom' }
  14222. },
  14223. {
  14224. cmdName: 'cellalignment',
  14225. value: { align: 'right', vAlign: 'bottom' }
  14226. }
  14227. ]
  14228. },
  14229. {
  14230. group: c.aligntable,
  14231. icon: 'aligntable',
  14232. subMenu: [
  14233. {
  14234. cmdName: 'tablealignment',
  14235. className: 'left',
  14236. label: c.tableleft,
  14237. value: 'left'
  14238. },
  14239. {
  14240. cmdName: 'tablealignment',
  14241. className: 'center',
  14242. label: c.tablecenter,
  14243. value: 'center'
  14244. },
  14245. {
  14246. cmdName: 'tablealignment',
  14247. className: 'right',
  14248. label: c.tableright,
  14249. value: 'right'
  14250. }
  14251. ]
  14252. },
  14253. '-',
  14254. {
  14255. label: c.insertparagraphbefore,
  14256. cmdName: 'insertparagraph',
  14257. value: !0
  14258. },
  14259. { label: c.insertparagraphafter, cmdName: 'insertparagraph' },
  14260. { label: c.copy, cmdName: 'copy' },
  14261. { label: c.paste, cmdName: 'paste' }
  14262. ]
  14263. if (d.length) {
  14264. var e = UE.ui.uiUtils
  14265. a.addListener('contextmenu', function (f, g) {
  14266. var h = e.getViewportOffsetByEvent(g)
  14267. a.fireEvent('beforeselectionchange'), b && b.destroy()
  14268. for (var i, j = 0, k = []; (i = d[j]); j++) {
  14269. var l
  14270. !(function (b) {
  14271. function d() {
  14272. switch (b.icon) {
  14273. case 'table':
  14274. return a.getLang('contextMenu.table')
  14275. case 'justifyjustify':
  14276. return a.getLang('contextMenu.paragraph')
  14277. case 'aligntd':
  14278. return a.getLang('contextMenu.aligntd')
  14279. case 'aligntable':
  14280. return a.getLang('contextMenu.aligntable')
  14281. case 'tablesort':
  14282. return c.tablesort
  14283. case 'borderBack':
  14284. return c.borderbk
  14285. default:
  14286. return ''
  14287. }
  14288. }
  14289. if ('-' == b) (l = k[k.length - 1]) && '-' !== l && k.push('-')
  14290. else if (b.hasOwnProperty('group')) {
  14291. for (var e, f = 0, g = []; (e = b.subMenu[f]); f++)
  14292. !(function (b) {
  14293. '-' == b
  14294. ? (l = g[g.length - 1]) && '-' !== l
  14295. ? g.push('-')
  14296. : g.splice(g.length - 1)
  14297. : (a.commands[b.cmdName] ||
  14298. UE.commands[b.cmdName] ||
  14299. b.query) &&
  14300. (b.query
  14301. ? b.query()
  14302. : a.queryCommandState(b.cmdName)) > -1 &&
  14303. g.push({
  14304. label:
  14305. b.label ||
  14306. a.getLang(
  14307. 'contextMenu.' + b.cmdName + (b.value || '')
  14308. ) ||
  14309. '',
  14310. className:
  14311. 'edui-for-' +
  14312. b.cmdName +
  14313. (b.className
  14314. ? ' edui-for-' + b.cmdName + '-' + b.className
  14315. : ''),
  14316. onclick: b.exec
  14317. ? function () {
  14318. b.exec.call(a)
  14319. }
  14320. : function () {
  14321. a.execCommand(b.cmdName, b.value)
  14322. }
  14323. })
  14324. })(e)
  14325. g.length &&
  14326. k.push({
  14327. label: d(),
  14328. className: 'edui-for-' + b.icon,
  14329. subMenu: { items: g, editor: a }
  14330. })
  14331. } else
  14332. (a.commands[b.cmdName] ||
  14333. UE.commands[b.cmdName] ||
  14334. b.query) &&
  14335. (b.query
  14336. ? b.query.call(a)
  14337. : a.queryCommandState(b.cmdName)) > -1 &&
  14338. k.push({
  14339. label: b.label || a.getLang('contextMenu.' + b.cmdName),
  14340. className:
  14341. 'edui-for-' +
  14342. (b.icon ? b.icon : b.cmdName + (b.value || '')),
  14343. onclick: b.exec
  14344. ? function () {
  14345. b.exec.call(a)
  14346. }
  14347. : function () {
  14348. a.execCommand(b.cmdName, b.value)
  14349. }
  14350. })
  14351. })(i)
  14352. }
  14353. if (
  14354. ('-' == k[k.length - 1] && k.pop(),
  14355. (b = new UE.ui.Menu({
  14356. items: k,
  14357. className: 'edui-contextmenu',
  14358. editor: a
  14359. })),
  14360. b.render(),
  14361. b.showAt(h),
  14362. a.fireEvent('aftershowcontextmenu', b),
  14363. domUtils.preventDefault(g),
  14364. browser.ie)
  14365. ) {
  14366. var m
  14367. try {
  14368. m = a.selection.getNative().createRange()
  14369. } catch (n) {
  14370. return
  14371. }
  14372. if (m.item) {
  14373. var o = new dom.Range(a.document)
  14374. o.selectNode(m.item(0)).select(!0, !0)
  14375. }
  14376. }
  14377. }),
  14378. a.addListener('aftershowcontextmenu', function (b, c) {
  14379. if (a.zeroclipboard) {
  14380. var d = c.items
  14381. for (var e in d)
  14382. 'edui-for-copy' == d[e].className &&
  14383. a.zeroclipboard.clip(d[e].getDom())
  14384. }
  14385. })
  14386. }
  14387. }
  14388. }),
  14389. (UE.plugins.shortcutmenu = function () {
  14390. var a,
  14391. b = this,
  14392. c = b.options.shortcutMenu || []
  14393. c.length &&
  14394. (b.addListener('contextmenu mouseup', function (b, d) {
  14395. var e = this,
  14396. f = {
  14397. type: b,
  14398. target: d.target || d.srcElement,
  14399. screenX: d.screenX,
  14400. screenY: d.screenY,
  14401. clientX: d.clientX,
  14402. clientY: d.clientY
  14403. }
  14404. if (
  14405. (setTimeout(function () {
  14406. var d = e.selection.getRange()
  14407. ;(d.collapsed !== !1 && 'contextmenu' != b) ||
  14408. (a ||
  14409. ((a = new baidu.editor.ui.ShortCutMenu({
  14410. editor: e,
  14411. items: c,
  14412. theme: e.options.theme,
  14413. className: 'edui-shortcutmenu'
  14414. })),
  14415. a.render(),
  14416. e.fireEvent('afterrendershortcutmenu', a)),
  14417. a.show(f, !!UE.plugins.contextmenu))
  14418. }),
  14419. 'contextmenu' == b &&
  14420. (domUtils.preventDefault(d), browser.ie9below))
  14421. ) {
  14422. var g
  14423. try {
  14424. g = e.selection.getNative().createRange()
  14425. } catch (d) {
  14426. return
  14427. }
  14428. if (g.item) {
  14429. var h = new dom.Range(e.document)
  14430. h.selectNode(g.item(0)).select(!0, !0)
  14431. }
  14432. }
  14433. }),
  14434. b.addListener('keydown', function (b) {
  14435. 'keydown' == b && a && !a.isHidden && a.hide()
  14436. }))
  14437. }),
  14438. (UE.plugins.basestyle = function () {
  14439. var a = {
  14440. bold: ['strong', 'b'],
  14441. italic: ['em', 'i'],
  14442. subscript: ['sub'],
  14443. superscript: ['sup']
  14444. },
  14445. b = function (a, b) {
  14446. return domUtils.filterNodeList(a.selection.getStartElementPath(), b)
  14447. },
  14448. c = this
  14449. c.addshortcutkey({
  14450. Bold: 'ctrl+66',
  14451. Italic: 'ctrl+73',
  14452. Underline: 'ctrl+85'
  14453. }),
  14454. c.addInputRule(function (a) {
  14455. utils.each(a.getNodesByTagName('b i'), function (a) {
  14456. switch (a.tagName) {
  14457. case 'b':
  14458. a.tagName = 'strong'
  14459. break
  14460. case 'i':
  14461. a.tagName = 'em'
  14462. }
  14463. })
  14464. })
  14465. for (var d in a)
  14466. !(function (a, d) {
  14467. c.commands[a] = {
  14468. execCommand: function (a) {
  14469. var e = c.selection.getRange(),
  14470. f = b(this, d)
  14471. if (e.collapsed) {
  14472. if (f) {
  14473. var g = c.document.createTextNode('')
  14474. e.insertNode(g).removeInlineStyle(d),
  14475. e.setStartBefore(g),
  14476. domUtils.remove(g)
  14477. } else {
  14478. var h = e.document.createElement(d[0])
  14479. ;('superscript' != a && 'subscript' != a) ||
  14480. ((g = c.document.createTextNode('')),
  14481. e
  14482. .insertNode(g)
  14483. .removeInlineStyle(['sub', 'sup'])
  14484. .setStartBefore(g)
  14485. .collapse(!0)),
  14486. e.insertNode(h).setStart(h, 0)
  14487. }
  14488. e.collapse(!0)
  14489. } else
  14490. ('superscript' != a && 'subscript' != a) ||
  14491. (f && f.tagName.toLowerCase() == a) ||
  14492. e.removeInlineStyle(['sub', 'sup']),
  14493. f ? e.removeInlineStyle(d) : e.applyInlineStyle(d[0])
  14494. e.select()
  14495. },
  14496. queryCommandState: function () {
  14497. return b(this, d) ? 1 : 0
  14498. }
  14499. }
  14500. })(d, a[d])
  14501. }),
  14502. (UE.plugins.elementpath = function () {
  14503. var a,
  14504. b,
  14505. c = this
  14506. c.setOpt('elementPathEnabled', !0),
  14507. c.options.elementPathEnabled &&
  14508. (c.commands.elementpath = {
  14509. execCommand: function (d, e) {
  14510. var f = b[e],
  14511. g = c.selection.getRange()
  14512. ;(a = 1 * e), g.selectNode(f).select()
  14513. },
  14514. queryCommandValue: function () {
  14515. var c = [].concat(this.selection.getStartElementPath()).reverse(),
  14516. d = []
  14517. b = c
  14518. for (var e, f = 0; (e = c[f]); f++)
  14519. if (3 != e.nodeType) {
  14520. var g = e.tagName.toLowerCase()
  14521. if (
  14522. ('img' == g &&
  14523. e.getAttribute('anchorname') &&
  14524. (g = 'anchor'),
  14525. (d[f] = g),
  14526. a == f)
  14527. ) {
  14528. a = -1
  14529. break
  14530. }
  14531. }
  14532. return d
  14533. }
  14534. })
  14535. }),
  14536. (UE.plugins.formatmatch = function () {
  14537. function a(f, g) {
  14538. function h(a) {
  14539. return (
  14540. m && a.selectNode(m),
  14541. a.applyInlineStyle(d[d.length - 1].tagName, null, d)
  14542. )
  14543. }
  14544. if (browser.webkit) var i = 'IMG' == g.target.tagName ? g.target : null
  14545. c.undoManger && c.undoManger.save()
  14546. var j = c.selection.getRange(),
  14547. k = i || j.getClosedNode()
  14548. if (b && k && 'IMG' == k.tagName)
  14549. (k.style.cssText +=
  14550. ';float:' +
  14551. (b.style.cssFloat || b.style.styleFloat || 'none') +
  14552. ';display:' +
  14553. (b.style.display || 'inline')),
  14554. (b = null)
  14555. else if (!b) {
  14556. var l = j.collapsed
  14557. if (l) {
  14558. var m = c.document.createTextNode('match')
  14559. j.insertNode(m).select()
  14560. }
  14561. c.__hasEnterExecCommand = !0
  14562. var n = c.options.removeFormatAttributes
  14563. ;(c.options.removeFormatAttributes = ''),
  14564. c.execCommand('removeformat'),
  14565. (c.options.removeFormatAttributes = n),
  14566. (c.__hasEnterExecCommand = !1),
  14567. (j = c.selection.getRange()),
  14568. d.length && h(j),
  14569. m && j.setStartBefore(m).collapse(!0),
  14570. j.select(),
  14571. m && domUtils.remove(m)
  14572. }
  14573. c.undoManger && c.undoManger.save(),
  14574. c.removeListener('mouseup', a),
  14575. (e = 0)
  14576. }
  14577. var b,
  14578. c = this,
  14579. d = [],
  14580. e = 0
  14581. c.addListener('reset', function () {
  14582. ;(d = []), (e = 0)
  14583. }),
  14584. (c.commands.formatmatch = {
  14585. execCommand: function (f) {
  14586. if (e) return (e = 0), (d = []), void c.removeListener('mouseup', a)
  14587. var g = c.selection.getRange()
  14588. if (((b = g.getClosedNode()), !b || 'IMG' != b.tagName)) {
  14589. g.collapse(!0).shrinkBoundary()
  14590. var h = g.startContainer
  14591. d = domUtils.findParents(h, !0, function (a) {
  14592. return !domUtils.isBlockElm(a) && 1 == a.nodeType
  14593. })
  14594. for (var i, j = 0; (i = d[j]); j++)
  14595. if ('A' == i.tagName) {
  14596. d.splice(j, 1)
  14597. break
  14598. }
  14599. }
  14600. c.addListener('mouseup', a), (e = 1)
  14601. },
  14602. queryCommandState: function () {
  14603. return e
  14604. },
  14605. notNeedUndo: 1
  14606. })
  14607. }),
  14608. UE.plugin.register('searchreplace', function () {
  14609. function a(a, b, c) {
  14610. var d = b.searchStr
  14611. b.dir == -1 &&
  14612. ((a = a.split('').reverse().join('')),
  14613. (d = d.split('').reverse().join('')),
  14614. (c = a.length - c))
  14615. for (
  14616. var e, f = new RegExp(d, 'g' + (b.casesensitive ? '' : 'i'));
  14617. (e = f.exec(a));
  14618. )
  14619. if (e.index >= c)
  14620. return b.dir == -1
  14621. ? a.length - e.index - b.searchStr.length
  14622. : e.index
  14623. return -1
  14624. }
  14625. function b(b, c, d) {
  14626. var e,
  14627. f,
  14628. h = d.all || 1 == d.dir ? 'getNextDomNode' : 'getPreDomNode'
  14629. domUtils.isBody(b) && (b = b.firstChild)
  14630. for (var i = 1; b; ) {
  14631. if (
  14632. ((e =
  14633. 3 == b.nodeType
  14634. ? b.nodeValue
  14635. : b[browser.ie ? 'innerText' : 'textContent']),
  14636. (f = a(e, d, c)),
  14637. (i = 0),
  14638. f != -1)
  14639. )
  14640. return { node: b, index: f }
  14641. for (b = domUtils[h](b); b && g[b.nodeName.toLowerCase()]; )
  14642. b = domUtils[h](b, !0)
  14643. b &&
  14644. (c =
  14645. d.dir == -1
  14646. ? (3 == b.nodeType
  14647. ? b.nodeValue
  14648. : b[browser.ie ? 'innerText' : 'textContent']
  14649. ).length
  14650. : 0)
  14651. }
  14652. }
  14653. function c(a, b, d) {
  14654. for (var e, f = 0, g = a.firstChild, h = 0; g; ) {
  14655. if (3 == g.nodeType) {
  14656. if (
  14657. ((h = g.nodeValue.replace(
  14658. /(^[\t\r\n]+)|([\t\r\n]+$)/,
  14659. ''
  14660. ).length),
  14661. (f += h),
  14662. f >= b)
  14663. )
  14664. return { node: g, index: h - (f - b) }
  14665. } else if (
  14666. !dtd.$empty[g.tagName] &&
  14667. ((h = g[browser.ie ? 'innerText' : 'textContent'].replace(
  14668. /(^[\t\r\n]+)|([\t\r\n]+$)/,
  14669. ''
  14670. ).length),
  14671. (f += h),
  14672. f >= b && (e = c(g, h - (f - b), d)))
  14673. )
  14674. return e
  14675. g = domUtils.getNextDomNode(g)
  14676. }
  14677. }
  14678. function d(a, d) {
  14679. var f,
  14680. g = a.selection.getRange(),
  14681. h = d.searchStr,
  14682. i = a.document.createElement('span')
  14683. if (
  14684. ((i.innerHTML = '$$ueditor_searchreplace_key$$'),
  14685. g.shrinkBoundary(!0),
  14686. !g.collapsed)
  14687. ) {
  14688. g.select()
  14689. var j = a.selection.getText()
  14690. if (
  14691. new RegExp(
  14692. '^' + d.searchStr + '$',
  14693. d.casesensitive ? '' : 'i'
  14694. ).test(j)
  14695. ) {
  14696. if (void 0 != d.replaceStr)
  14697. return e(g, d.replaceStr), g.select(), !0
  14698. g.collapse(d.dir == -1)
  14699. }
  14700. }
  14701. g.insertNode(i), g.enlargeToBlockElm(!0), (f = g.startContainer)
  14702. var k = f[browser.ie ? 'innerText' : 'textContent'].indexOf(
  14703. '$$ueditor_searchreplace_key$$'
  14704. )
  14705. g.setStartBefore(i), domUtils.remove(i)
  14706. var l = b(f, k, d)
  14707. if (l) {
  14708. var m = c(l.node, l.index, h),
  14709. n = c(l.node, l.index + h.length, h)
  14710. return (
  14711. g.setStart(m.node, m.index).setEnd(n.node, n.index),
  14712. void 0 !== d.replaceStr && e(g, d.replaceStr),
  14713. g.select(),
  14714. !0
  14715. )
  14716. }
  14717. g.setCursor()
  14718. }
  14719. function e(a, b) {
  14720. ;(b = f.document.createTextNode(b)), a.deleteContents().insertNode(b)
  14721. }
  14722. var f = this,
  14723. g = { table: 1, tbody: 1, tr: 1, ol: 1, ul: 1 }
  14724. return {
  14725. commands: {
  14726. searchreplace: {
  14727. execCommand: function (a, b) {
  14728. utils.extend(b, { all: !1, casesensitive: !1, dir: 1 }, !0)
  14729. var c = 0
  14730. if (b.all) {
  14731. var e = f.selection.getRange(),
  14732. g = f.body.firstChild
  14733. for (
  14734. g && 1 == g.nodeType
  14735. ? (e.setStart(g, 0), e.shrinkBoundary(!0))
  14736. : 3 == g.nodeType && e.setStartBefore(g),
  14737. e.collapse(!0).select(!0),
  14738. void 0 !== b.replaceStr && f.fireEvent('saveScene');
  14739. d(this, b);
  14740. )
  14741. c++
  14742. c && f.fireEvent('saveScene')
  14743. } else
  14744. void 0 !== b.replaceStr && f.fireEvent('saveScene'),
  14745. d(this, b) && c++,
  14746. c && f.fireEvent('saveScene')
  14747. return c
  14748. },
  14749. notNeedUndo: 1
  14750. }
  14751. }
  14752. }
  14753. }),
  14754. (UE.plugins.customstyle = function () {
  14755. var a = this
  14756. a.setOpt({
  14757. customstyle: [
  14758. {
  14759. tag: 'h1',
  14760. name: 'tc',
  14761. style:
  14762. 'font-size:32px;font-weight:bold;border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:center;margin:0 0 20px 0;'
  14763. },
  14764. {
  14765. tag: 'h1',
  14766. name: 'tl',
  14767. style:
  14768. 'font-size:32px;font-weight:bold;border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:left;margin:0 0 10px 0;'
  14769. },
  14770. {
  14771. tag: 'span',
  14772. name: 'im',
  14773. style:
  14774. 'font-size:16px;font-style:italic;font-weight:bold;line-height:18px;'
  14775. },
  14776. {
  14777. tag: 'span',
  14778. name: 'hi',
  14779. style:
  14780. 'font-size:16px;font-style:italic;font-weight:bold;color:rgb(51, 153, 204);line-height:18px;'
  14781. }
  14782. ]
  14783. }),
  14784. (a.commands.customstyle = {
  14785. execCommand: function (a, b) {
  14786. var c,
  14787. d,
  14788. e = this,
  14789. f = b.tag,
  14790. g = domUtils.findParent(
  14791. e.selection.getStart(),
  14792. function (a) {
  14793. return a.getAttribute('label')
  14794. },
  14795. !0
  14796. ),
  14797. h = {}
  14798. for (var i in b) void 0 !== b[i] && (h[i] = b[i])
  14799. if ((delete h.tag, g && g.getAttribute('label') == b.label)) {
  14800. if (
  14801. ((c = this.selection.getRange()),
  14802. (d = c.createBookmark()),
  14803. c.collapsed)
  14804. )
  14805. if (dtd.$block[g.tagName]) {
  14806. var j = e.document.createElement('p')
  14807. domUtils.moveChild(g, j),
  14808. g.parentNode.insertBefore(j, g),
  14809. domUtils.remove(g)
  14810. } else domUtils.remove(g, !0)
  14811. else {
  14812. var k = domUtils.getCommonAncestor(d.start, d.end),
  14813. l = domUtils.getElementsByTagName(k, f)
  14814. new RegExp(f, 'i').test(k.tagName) && l.push(k)
  14815. for (var m, n = 0; (m = l[n++]); )
  14816. if (m.getAttribute('label') == b.label) {
  14817. var o = domUtils.getPosition(m, d.start),
  14818. p = domUtils.getPosition(m, d.end)
  14819. if (
  14820. (o & domUtils.POSITION_FOLLOWING ||
  14821. o & domUtils.POSITION_CONTAINS) &&
  14822. (p & domUtils.POSITION_PRECEDING ||
  14823. p & domUtils.POSITION_CONTAINS) &&
  14824. dtd.$block[f]
  14825. ) {
  14826. var j = e.document.createElement('p')
  14827. domUtils.moveChild(m, j), m.parentNode.insertBefore(j, m)
  14828. }
  14829. domUtils.remove(m, !0)
  14830. }
  14831. ;(g = domUtils.findParent(
  14832. k,
  14833. function (a) {
  14834. return a.getAttribute('label') == b.label
  14835. },
  14836. !0
  14837. )),
  14838. g && domUtils.remove(g, !0)
  14839. }
  14840. c.moveToBookmark(d).select()
  14841. } else if (dtd.$block[f]) {
  14842. if (
  14843. (this.execCommand('paragraph', f, h, 'customstyle'),
  14844. (c = e.selection.getRange()),
  14845. !c.collapsed)
  14846. ) {
  14847. c.collapse(),
  14848. (g = domUtils.findParent(
  14849. e.selection.getStart(),
  14850. function (a) {
  14851. return a.getAttribute('label') == b.label
  14852. },
  14853. !0
  14854. ))
  14855. var q = e.document.createElement('p')
  14856. domUtils.insertAfter(g, q),
  14857. domUtils.fillNode(e.document, q),
  14858. c.setStart(q, 0).setCursor()
  14859. }
  14860. } else {
  14861. if (((c = e.selection.getRange()), c.collapsed))
  14862. return (
  14863. (g = e.document.createElement(f)),
  14864. domUtils.setAttributes(g, h),
  14865. void c.insertNode(g).setStart(g, 0).setCursor()
  14866. )
  14867. ;(d = c.createBookmark()),
  14868. c.applyInlineStyle(f, h).moveToBookmark(d).select()
  14869. }
  14870. },
  14871. queryCommandValue: function () {
  14872. var a = domUtils.filterNodeList(
  14873. this.selection.getStartElementPath(),
  14874. function (a) {
  14875. return a.getAttribute('label')
  14876. }
  14877. )
  14878. return a ? a.getAttribute('label') : ''
  14879. }
  14880. }),
  14881. a.addListener('keyup', function (b, c) {
  14882. var d = c.keyCode || c.which
  14883. if (32 == d || 13 == d) {
  14884. var e = a.selection.getRange()
  14885. if (e.collapsed) {
  14886. var f = domUtils.findParent(
  14887. a.selection.getStart(),
  14888. function (a) {
  14889. return a.getAttribute('label')
  14890. },
  14891. !0
  14892. )
  14893. if (f && dtd.$block[f.tagName] && domUtils.isEmptyNode(f)) {
  14894. var g = a.document.createElement('p')
  14895. domUtils.insertAfter(f, g),
  14896. domUtils.fillNode(a.document, g),
  14897. domUtils.remove(f),
  14898. e.setStart(g, 0).setCursor()
  14899. }
  14900. }
  14901. }
  14902. })
  14903. }),
  14904. (UE.plugins.catchremoteimage = function () {
  14905. var me = this,
  14906. ajax = UE.ajax
  14907. me.options.catchRemoteImageEnable !== !1 &&
  14908. (me.setOpt({ catchRemoteImageEnable: !1 }),
  14909. me.addListener('afterpaste', function () {
  14910. me.fireEvent('catchRemoteImage')
  14911. }),
  14912. me.addListener('catchRemoteImage', function () {
  14913. function catchremoteimage(a, b) {
  14914. var c =
  14915. utils.serializeParam(me.queryCommandValue('serverparam')) || '',
  14916. d = utils.formatUrl(
  14917. catcherActionUrl +
  14918. (catcherActionUrl.indexOf('?') == -1 ? '?' : '&') +
  14919. c
  14920. ),
  14921. e = utils.isCrossDomainUrl(d),
  14922. f = {
  14923. method: 'POST',
  14924. dataType: e ? 'jsonp' : '',
  14925. timeout: 6e4,
  14926. onsuccess: b.success,
  14927. onerror: b.error
  14928. }
  14929. ;(f[catcherFieldName] = a), ajax.request(d, f)
  14930. }
  14931. for (
  14932. var catcherLocalDomain = me.getOpt('catcherLocalDomain'),
  14933. catcherActionUrl = me.getActionUrl(
  14934. me.getOpt('catcherActionName')
  14935. ),
  14936. catcherUrlPrefix = me.getOpt('catcherUrlPrefix'),
  14937. catcherFieldName = me.getOpt('catcherFieldName'),
  14938. remoteImages = [],
  14939. imgs = domUtils.getElementsByTagName(me.document, 'img'),
  14940. test = function (a, b) {
  14941. if (a.indexOf(location.host) != -1 || /(^\.)|(^\/)/.test(a))
  14942. return !0
  14943. if (b)
  14944. for (var c, d = 0; (c = b[d++]); )
  14945. if (a.indexOf(c) !== -1) return !0
  14946. return !1
  14947. },
  14948. i = 0,
  14949. ci;
  14950. (ci = imgs[i++]);
  14951. )
  14952. if (!ci.getAttribute('word_img')) {
  14953. var src = ci.getAttribute('_src') || ci.src || ''
  14954. ;/^(https?|ftp):/i.test(src) &&
  14955. !test(src, catcherLocalDomain) &&
  14956. remoteImages.push(src)
  14957. }
  14958. remoteImages.length &&
  14959. catchremoteimage(remoteImages, {
  14960. success: function (r) {
  14961. try {
  14962. var info =
  14963. void 0 !== r.state ? r : eval('(' + r.responseText + ')')
  14964. } catch (e) {
  14965. return
  14966. }
  14967. var i,
  14968. j,
  14969. ci,
  14970. cj,
  14971. oldSrc,
  14972. newSrc,
  14973. list = info.list
  14974. for (i = 0; (ci = imgs[i++]); )
  14975. for (
  14976. oldSrc = ci.getAttribute('_src') || ci.src || '', j = 0;
  14977. (cj = list[j++]);
  14978. )
  14979. if (oldSrc == cj.source && 'SUCCESS' == cj.state) {
  14980. ;(newSrc = catcherUrlPrefix + cj.url),
  14981. domUtils.setAttributes(ci, {
  14982. src: newSrc,
  14983. _src: newSrc
  14984. })
  14985. break
  14986. }
  14987. me.fireEvent('catchremotesuccess')
  14988. },
  14989. error: function () {
  14990. me.fireEvent('catchremoteerror')
  14991. }
  14992. })
  14993. }))
  14994. }),
  14995. UE.plugin.register('snapscreen', function () {
  14996. function getLocation(a) {
  14997. var b,
  14998. c = document.createElement('a'),
  14999. d = utils.serializeParam(me.queryCommandValue('serverparam')) || ''
  15000. return (
  15001. (c.href = a),
  15002. browser.ie && (c.href = c.href),
  15003. (b = c.search),
  15004. d &&
  15005. ((b = b + (b.indexOf('?') == -1 ? '?' : '&') + d),
  15006. (b = b.replace(/[&]+/gi, '&'))),
  15007. {
  15008. port: c.port,
  15009. hostname: c.hostname,
  15010. path: c.pathname + b || +c.hash
  15011. }
  15012. )
  15013. }
  15014. var me = this,
  15015. snapplugin
  15016. return {
  15017. commands: {
  15018. snapscreen: {
  15019. execCommand: function (cmd) {
  15020. function onSuccess(rs) {
  15021. try {
  15022. if (((rs = eval('(' + rs + ')')), 'SUCCESS' == rs.state)) {
  15023. var opt = me.options
  15024. me.execCommand('insertimage', {
  15025. src: opt.snapscreenUrlPrefix + rs.url,
  15026. _src: opt.snapscreenUrlPrefix + rs.url,
  15027. alt: rs.title || '',
  15028. floatStyle: opt.snapscreenImgAlign
  15029. })
  15030. } else alert(rs.state)
  15031. } catch (e) {
  15032. alert(lang.callBackErrorMsg)
  15033. }
  15034. }
  15035. var url,
  15036. local,
  15037. res,
  15038. lang = me.getLang('snapScreen_plugin')
  15039. if (!snapplugin) {
  15040. var container = me.container,
  15041. doc = me.container.ownerDocument || me.container.document
  15042. snapplugin = doc.createElement('object')
  15043. try {
  15044. snapplugin.type = 'application/x-pluginbaidusnap'
  15045. } catch (e) {
  15046. return
  15047. }
  15048. ;(snapplugin.style.cssText =
  15049. 'position:absolute;left:-9999px;width:0;height:0;'),
  15050. snapplugin.setAttribute('width', '0'),
  15051. snapplugin.setAttribute('height', '0'),
  15052. container.appendChild(snapplugin)
  15053. }
  15054. ;(url = me.getActionUrl(me.getOpt('snapscreenActionName'))),
  15055. (local = getLocation(url)),
  15056. setTimeout(function () {
  15057. try {
  15058. res = snapplugin.saveSnapshot(
  15059. local.hostname,
  15060. local.path,
  15061. local.port
  15062. )
  15063. } catch (a) {
  15064. return void me.ui._dialogs.snapscreenDialog.open()
  15065. }
  15066. onSuccess(res)
  15067. }, 50)
  15068. },
  15069. queryCommandState: function () {
  15070. return navigator.userAgent.indexOf('Windows', 0) != -1 ? 0 : -1
  15071. }
  15072. }
  15073. }
  15074. }
  15075. }),
  15076. (UE.commands.insertparagraph = {
  15077. execCommand: function (a, b) {
  15078. for (
  15079. var c, d = this, e = d.selection.getRange(), f = e.startContainer;
  15080. f && !domUtils.isBody(f);
  15081. )
  15082. (c = f), (f = f.parentNode)
  15083. if (c) {
  15084. var g = d.document.createElement('p')
  15085. b
  15086. ? c.parentNode.insertBefore(g, c)
  15087. : c.parentNode.insertBefore(g, c.nextSibling),
  15088. domUtils.fillNode(d.document, g),
  15089. e.setStart(g, 0).setCursor(!1, !0)
  15090. }
  15091. }
  15092. }),
  15093. UE.plugin.register('webapp', function () {
  15094. function a(a, c) {
  15095. return c
  15096. ? '<iframe class="edui-faked-webapp" title="' +
  15097. a.title +
  15098. '" ' +
  15099. (a.align && !a.cssfloat ? 'align="' + a.align + '"' : '') +
  15100. (a.cssfloat ? 'style="float:' + a.cssfloat + '"' : '') +
  15101. 'width="' +
  15102. a.width +
  15103. '" height="' +
  15104. a.height +
  15105. '" scrolling="no" frameborder="0" src="' +
  15106. a.url +
  15107. '" logo_url = "' +
  15108. a.logo +
  15109. '"></iframe>'
  15110. : '<img title="' +
  15111. a.title +
  15112. '" width="' +
  15113. a.width +
  15114. '" height="' +
  15115. a.height +
  15116. '" src="' +
  15117. b.options.UEDITOR_HOME_URL +
  15118. 'themes/default/images/spacer.gif" _logo_url="' +
  15119. a.logo +
  15120. '" style="background:url(' +
  15121. a.logo +
  15122. ') no-repeat center center; border:1px solid gray;" class="edui-faked-webapp" _url="' +
  15123. a.url +
  15124. '" ' +
  15125. (a.align && !a.cssfloat ? 'align="' + a.align + '"' : '') +
  15126. (a.cssfloat ? 'style="float:' + a.cssfloat + '"' : '') +
  15127. '/>'
  15128. }
  15129. var b = this
  15130. return {
  15131. outputRule: function (b) {
  15132. utils.each(b.getNodesByTagName('img'), function (b) {
  15133. var c
  15134. if ('edui-faked-webapp' == b.getAttr('class')) {
  15135. c = a(
  15136. {
  15137. title: b.getAttr('title'),
  15138. width: b.getAttr('width'),
  15139. height: b.getAttr('height'),
  15140. align: b.getAttr('align'),
  15141. cssfloat: b.getStyle('float'),
  15142. url: b.getAttr('_url'),
  15143. logo: b.getAttr('_logo_url')
  15144. },
  15145. !0
  15146. )
  15147. var d = UE.uNode.createElement(c)
  15148. b.parentNode.replaceChild(d, b)
  15149. }
  15150. })
  15151. },
  15152. inputRule: function (b) {
  15153. utils.each(b.getNodesByTagName('iframe'), function (b) {
  15154. if ('edui-faked-webapp' == b.getAttr('class')) {
  15155. var c = UE.uNode.createElement(
  15156. a({
  15157. title: b.getAttr('title'),
  15158. width: b.getAttr('width'),
  15159. height: b.getAttr('height'),
  15160. align: b.getAttr('align'),
  15161. cssfloat: b.getStyle('float'),
  15162. url: b.getAttr('src'),
  15163. logo: b.getAttr('logo_url')
  15164. })
  15165. )
  15166. b.parentNode.replaceChild(c, b)
  15167. }
  15168. })
  15169. },
  15170. commands: {
  15171. webapp: {
  15172. execCommand: function (b, c) {
  15173. var d = this,
  15174. e = a(utils.extend(c, { align: 'none' }), !1)
  15175. d.execCommand('inserthtml', e)
  15176. },
  15177. queryCommandState: function () {
  15178. var a = this,
  15179. b = a.selection.getRange().getClosedNode(),
  15180. c = b && 'edui-faked-webapp' == b.className
  15181. return c ? 1 : 0
  15182. }
  15183. }
  15184. }
  15185. }
  15186. }),
  15187. (UE.plugins.template = function () {
  15188. ;(UE.commands.template = {
  15189. execCommand: function (a, b) {
  15190. b.html && this.execCommand('inserthtml', b.html)
  15191. }
  15192. }),
  15193. this.addListener('click', function (a, b) {
  15194. var c = b.target || b.srcElement,
  15195. d = this.selection.getRange(),
  15196. e = domUtils.findParent(
  15197. c,
  15198. function (a) {
  15199. if (a.className && domUtils.hasClass(a, 'ue_t')) return a
  15200. },
  15201. !0
  15202. )
  15203. e && d.selectNode(e).shrinkBoundary().select()
  15204. }),
  15205. this.addListener('keydown', function (a, b) {
  15206. var c = this.selection.getRange()
  15207. if (
  15208. !c.collapsed &&
  15209. !(b.ctrlKey || b.metaKey || b.shiftKey || b.altKey)
  15210. ) {
  15211. var d = domUtils.findParent(
  15212. c.startContainer,
  15213. function (a) {
  15214. if (a.className && domUtils.hasClass(a, 'ue_t')) return a
  15215. },
  15216. !0
  15217. )
  15218. d && domUtils.removeClasses(d, ['ue_t'])
  15219. }
  15220. })
  15221. }),
  15222. UE.plugin.register('music', function () {
  15223. function a(a, c, d, e, f, g) {
  15224. return g
  15225. ? '<embed type="application/x-shockwave-flash" class="edui-faked-music" pluginspage="http://www.macromedia.com/go/getflashplayer" src="' +
  15226. a +
  15227. '" width="' +
  15228. c +
  15229. '" height="' +
  15230. d +
  15231. '" ' +
  15232. (e && !f ? 'align="' + e + '"' : '') +
  15233. (f ? 'style="float:' + f + '"' : '') +
  15234. ' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" >'
  15235. : '<img ' +
  15236. (e && !f ? 'align="' + e + '"' : '') +
  15237. (f ? 'style="float:' + f + '"' : '') +
  15238. ' width="' +
  15239. c +
  15240. '" height="' +
  15241. d +
  15242. '" _url="' +
  15243. a +
  15244. '" class="edui-faked-music" src="' +
  15245. b.options.langPath +
  15246. b.options.lang +
  15247. '/images/music.png" />'
  15248. }
  15249. var b = this
  15250. return {
  15251. outputRule: function (b) {
  15252. utils.each(b.getNodesByTagName('img'), function (b) {
  15253. var c
  15254. if ('edui-faked-music' == b.getAttr('class')) {
  15255. var d = b.getStyle('float'),
  15256. e = b.getAttr('align')
  15257. c = a(
  15258. b.getAttr('_url'),
  15259. b.getAttr('width'),
  15260. b.getAttr('height'),
  15261. e,
  15262. d,
  15263. !0
  15264. )
  15265. var f = UE.uNode.createElement(c)
  15266. b.parentNode.replaceChild(f, b)
  15267. }
  15268. })
  15269. },
  15270. inputRule: function (b) {
  15271. utils.each(b.getNodesByTagName('embed'), function (b) {
  15272. if ('edui-faked-music' == b.getAttr('class')) {
  15273. var c = b.getStyle('float'),
  15274. d = b.getAttr('align')
  15275. html = a(
  15276. b.getAttr('src'),
  15277. b.getAttr('width'),
  15278. b.getAttr('height'),
  15279. d,
  15280. c,
  15281. !1
  15282. )
  15283. var e = UE.uNode.createElement(html)
  15284. b.parentNode.replaceChild(e, b)
  15285. }
  15286. })
  15287. },
  15288. commands: {
  15289. music: {
  15290. execCommand: function (b, c) {
  15291. var d = this,
  15292. e = a(c.url, c.width || 400, c.height || 95, 'none', !1)
  15293. d.execCommand('inserthtml', e)
  15294. },
  15295. queryCommandState: function () {
  15296. var a = this,
  15297. b = a.selection.getRange().getClosedNode(),
  15298. c = b && 'edui-faked-music' == b.className
  15299. return c ? 1 : 0
  15300. }
  15301. }
  15302. }
  15303. }
  15304. }),
  15305. UE.plugin.register('autoupload', function () {
  15306. function a(a, b) {
  15307. var c,
  15308. d,
  15309. e,
  15310. f,
  15311. g,
  15312. h,
  15313. i,
  15314. j,
  15315. k = b,
  15316. l = /image\/\w+/i.test(a.type) ? 'image' : 'file',
  15317. m = 'loading_' + (+new Date()).toString(36)
  15318. if (
  15319. ((c = k.getOpt(l + 'FieldName')),
  15320. (d = k.getOpt(l + 'UrlPrefix')),
  15321. (e = k.getOpt(l + 'MaxSize')),
  15322. (f = k.getOpt(l + 'AllowFiles')),
  15323. (g = k.getActionUrl(k.getOpt(l + 'ActionName'))),
  15324. (i = function (a) {
  15325. var b = k.document.getElementById(m)
  15326. b && domUtils.remove(b),
  15327. k.fireEvent('showmessage', {
  15328. id: m,
  15329. content: a,
  15330. type: 'error',
  15331. timeout: 4e3
  15332. })
  15333. }),
  15334. 'image' == l
  15335. ? ((h =
  15336. '<img class="loadingclass" id="' +
  15337. m +
  15338. '" src="' +
  15339. k.options.themePath +
  15340. k.options.theme +
  15341. '/images/spacer.gif" title="' +
  15342. (k.getLang('autoupload.loading') || '') +
  15343. '" >'),
  15344. (j = function (a) {
  15345. var b = d + a.url,
  15346. c = k.document.getElementById(m)
  15347. c &&
  15348. (c.setAttribute('src', b),
  15349. c.setAttribute('_src', b),
  15350. c.setAttribute('title', a.title || ''),
  15351. c.setAttribute('alt', a.original || ''),
  15352. c.removeAttribute('id'),
  15353. domUtils.removeClasses(c, 'loadingclass'))
  15354. }))
  15355. : ((h =
  15356. '<p><img class="loadingclass" id="' +
  15357. m +
  15358. '" src="' +
  15359. k.options.themePath +
  15360. k.options.theme +
  15361. '/images/spacer.gif" title="' +
  15362. (k.getLang('autoupload.loading') || '') +
  15363. '" ></p>'),
  15364. (j = function (a) {
  15365. var b = d + a.url,
  15366. c = k.document.getElementById(m),
  15367. e = k.selection.getRange(),
  15368. f = e.createBookmark()
  15369. e.selectNode(c).select(),
  15370. k.execCommand('insertfile', { url: b }),
  15371. e.moveToBookmark(f).select()
  15372. })),
  15373. k.execCommand('inserthtml', h),
  15374. !k.getOpt(l + 'ActionName'))
  15375. )
  15376. return void i(k.getLang('autoupload.errorLoadConfig'))
  15377. if (a.size > e) return void i(k.getLang('autoupload.exceedSizeError'))
  15378. var n = a.name ? a.name.substr(a.name.lastIndexOf('.')) : ''
  15379. if (
  15380. (n && 'image' != l) ||
  15381. (f && (f.join('') + '.').indexOf(n.toLowerCase() + '.') == -1)
  15382. )
  15383. return void i(k.getLang('autoupload.exceedTypeError'))
  15384. var o = new XMLHttpRequest(),
  15385. p = new FormData(),
  15386. q = utils.serializeParam(k.queryCommandValue('serverparam')) || '',
  15387. r = utils.formatUrl(g + (g.indexOf('?') == -1 ? '?' : '&') + q)
  15388. p.append(c, a, a.name || 'blob.' + a.type.substr('image/'.length)),
  15389. p.append('type', 'ajax'),
  15390. o.open('post', r, !0),
  15391. o.setRequestHeader('X-Requested-With', 'XMLHttpRequest'),
  15392. o.addEventListener('load', function (a) {
  15393. try {
  15394. var b = new Function('return ' + utils.trim(a.target.response))()
  15395. 'SUCCESS' == b.state && b.url ? j(b) : i(b.state)
  15396. } catch (c) {
  15397. i(k.getLang('autoupload.loadError'))
  15398. }
  15399. }),
  15400. o.send(p)
  15401. }
  15402. function b(a) {
  15403. return a.clipboardData &&
  15404. a.clipboardData.items &&
  15405. 1 == a.clipboardData.items.length &&
  15406. /^image\//.test(a.clipboardData.items[0].type)
  15407. ? a.clipboardData.items
  15408. : null
  15409. }
  15410. function c(a) {
  15411. return a.dataTransfer && a.dataTransfer.files
  15412. ? a.dataTransfer.files
  15413. : null
  15414. }
  15415. return {
  15416. outputRule: function (a) {
  15417. utils.each(a.getNodesByTagName('img'), function (a) {
  15418. ;/\b(loaderrorclass)|(bloaderrorclass)\b/.test(
  15419. a.getAttr('class')
  15420. ) && a.parentNode.removeChild(a)
  15421. }),
  15422. utils.each(a.getNodesByTagName('p'), function (a) {
  15423. ;/\bloadpara\b/.test(a.getAttr('class')) &&
  15424. a.parentNode.removeChild(a)
  15425. })
  15426. },
  15427. bindEvents: {
  15428. ready: function (d) {
  15429. var e = this
  15430. window.FormData &&
  15431. window.FileReader &&
  15432. (domUtils.on(e.body, 'paste drop', function (d) {
  15433. var f,
  15434. g = !1
  15435. if ((f = 'paste' == d.type ? b(d) : c(d))) {
  15436. for (var h, i = f.length; i--; )
  15437. (h = f[i]),
  15438. h.getAsFile && (h = h.getAsFile()),
  15439. h && h.size > 0 && (a(h, e), (g = !0))
  15440. g && d.preventDefault()
  15441. }
  15442. }),
  15443. domUtils.on(e.body, 'dragover', function (a) {
  15444. 'Files' == a.dataTransfer.types[0] && a.preventDefault()
  15445. }),
  15446. utils.cssRule(
  15447. 'loading',
  15448. ".loadingclass{display:inline-block;cursor:default;background: url('" +
  15449. this.options.themePath +
  15450. this.options.theme +
  15451. "/images/loading.gif') no-repeat center center transparent;border:1px solid #cccccc;margin-left:1px;height: 22px;width: 22px;}\n.loaderrorclass{display:inline-block;cursor:default;background: url('" +
  15452. this.options.themePath +
  15453. this.options.theme +
  15454. "/images/loaderror.png') no-repeat center center transparent;border:1px solid #cccccc;margin-right:1px;height: 22px;width: 22px;}",
  15455. this.document
  15456. ))
  15457. }
  15458. }
  15459. }
  15460. }),
  15461. UE.plugin.register('autosave', function () {
  15462. function a(a) {
  15463. var f
  15464. if (!(new Date() - c < d)) {
  15465. if (!a.hasContents()) return void (e && b.removePreferences(e))
  15466. ;(c = new Date()),
  15467. (a._saveFlag = null),
  15468. (f = b.body.innerHTML),
  15469. a.fireEvent('beforeautosave', { content: f }) !== !1 &&
  15470. (b.setPreferences(e, f),
  15471. a.fireEvent('afterautosave', { content: f }))
  15472. }
  15473. }
  15474. var b = this,
  15475. c = new Date(),
  15476. d = 20,
  15477. e = null
  15478. return {
  15479. defaultOptions: { saveInterval: 500, enableAutoSave: !0 },
  15480. bindEvents: {
  15481. ready: function () {
  15482. var a = '-drafts-data',
  15483. c = null
  15484. ;(c = b.key
  15485. ? b.key + a
  15486. : (b.container.parentNode.id || 'ue-common') + a),
  15487. (e =
  15488. (location.protocol + location.host + location.pathname).replace(
  15489. /[.:\/]/g,
  15490. '_'
  15491. ) + c)
  15492. },
  15493. contentchange: function () {
  15494. b.getOpt('enableAutoSave') &&
  15495. e &&
  15496. (b._saveFlag && window.clearTimeout(b._saveFlag),
  15497. b.options.saveInterval > 0
  15498. ? (b._saveFlag = window.setTimeout(function () {
  15499. a(b)
  15500. }, b.options.saveInterval))
  15501. : a(b))
  15502. }
  15503. },
  15504. commands: {
  15505. clearlocaldata: {
  15506. execCommand: function (a, c) {
  15507. e && b.getPreferences(e) && b.removePreferences(e)
  15508. },
  15509. notNeedUndo: !0,
  15510. ignoreContentChange: !0
  15511. },
  15512. getlocaldata: {
  15513. execCommand: function (a, c) {
  15514. return e ? b.getPreferences(e) || '' : ''
  15515. },
  15516. notNeedUndo: !0,
  15517. ignoreContentChange: !0
  15518. },
  15519. drafts: {
  15520. execCommand: function (a, c) {
  15521. e &&
  15522. ((b.body.innerHTML =
  15523. b.getPreferences(e) || '<p>' + domUtils.fillHtml + '</p>'),
  15524. b.focus(!0))
  15525. },
  15526. queryCommandState: function () {
  15527. return e ? (null === b.getPreferences(e) ? -1 : 0) : -1
  15528. },
  15529. notNeedUndo: !0,
  15530. ignoreContentChange: !0
  15531. }
  15532. }
  15533. }
  15534. }),
  15535. UE.plugin.register('charts', function () {
  15536. function a(a) {
  15537. var b = null,
  15538. c = 0
  15539. if (a.rows.length < 2) return !1
  15540. if (a.rows[0].cells.length < 2) return !1
  15541. ;(b = a.rows[0].cells), (c = b.length)
  15542. for (var d, e = 0; (d = b[e]); e++)
  15543. if ('th' !== d.tagName.toLowerCase()) return !1
  15544. for (var f, e = 1; (f = a.rows[e]); e++) {
  15545. if (f.cells.length != c) return !1
  15546. if ('th' !== f.cells[0].tagName.toLowerCase()) return !1
  15547. for (var d, g = 1; (d = f.cells[g]); g++) {
  15548. var h = utils.trim(d.innerText || d.textContent || '')
  15549. if (
  15550. ((h = h
  15551. .replace(new RegExp(UE.dom.domUtils.fillChar, 'g'), '')
  15552. .replace(/^\s+|\s+$/g, '')),
  15553. !/^\d*\.?\d+$/.test(h))
  15554. )
  15555. return !1
  15556. }
  15557. }
  15558. return !0
  15559. }
  15560. var b = this
  15561. return {
  15562. bindEvents: { chartserror: function () {} },
  15563. commands: {
  15564. charts: {
  15565. execCommand: function (c, d) {
  15566. var e = domUtils.findParentByTagName(
  15567. this.selection.getRange().startContainer,
  15568. 'table',
  15569. !0
  15570. ),
  15571. f = [],
  15572. g = {}
  15573. if (!e) return !1
  15574. if (!a(e)) return b.fireEvent('chartserror'), !1
  15575. ;(g.title = d.title || ''),
  15576. (g.subTitle = d.subTitle || ''),
  15577. (g.xTitle = d.xTitle || ''),
  15578. (g.yTitle = d.yTitle || ''),
  15579. (g.suffix = d.suffix || ''),
  15580. (g.tip = d.tip || ''),
  15581. (g.dataFormat = d.tableDataFormat || ''),
  15582. (g.chartType = d.chartType || 0)
  15583. for (var h in g) g.hasOwnProperty(h) && f.push(h + ':' + g[h])
  15584. e.setAttribute('data-chart', f.join(';')),
  15585. domUtils.addClass(e, 'edui-charts-table')
  15586. },
  15587. queryCommandState: function (b, c) {
  15588. var d = domUtils.findParentByTagName(
  15589. this.selection.getRange().startContainer,
  15590. 'table',
  15591. !0
  15592. )
  15593. return d && a(d) ? 0 : -1
  15594. }
  15595. }
  15596. },
  15597. inputRule: function (a) {
  15598. utils.each(a.getNodesByTagName('table'), function (a) {
  15599. void 0 !== a.getAttr('data-chart') && a.setAttr('style')
  15600. })
  15601. },
  15602. outputRule: function (a) {
  15603. utils.each(a.getNodesByTagName('table'), function (a) {
  15604. void 0 !== a.getAttr('data-chart') &&
  15605. a.setAttr('style', 'display: none;')
  15606. })
  15607. }
  15608. }
  15609. }),
  15610. UE.plugin.register('section', function () {
  15611. function a(a) {
  15612. ;(this.tag = ''),
  15613. (this.level = -1),
  15614. (this.dom = null),
  15615. (this.nextSection = null),
  15616. (this.previousSection = null),
  15617. (this.parentSection = null),
  15618. (this.startAddress = []),
  15619. (this.endAddress = []),
  15620. (this.children = [])
  15621. }
  15622. function b(b) {
  15623. var c = new a()
  15624. return utils.extend(c, b)
  15625. }
  15626. function c(a, b) {
  15627. for (var c = b, d = 0; d < a.length; d++) {
  15628. if (!c.childNodes) return null
  15629. c = c.childNodes[a[d]]
  15630. }
  15631. return c
  15632. }
  15633. var d = this
  15634. return {
  15635. bindMultiEvents: {
  15636. type: 'aftersetcontent afterscencerestore',
  15637. handler: function () {
  15638. d.fireEvent('updateSections')
  15639. }
  15640. },
  15641. bindEvents: {
  15642. ready: function () {
  15643. d.fireEvent('updateSections'),
  15644. domUtils.on(d.body, 'drop paste', function () {
  15645. d.fireEvent('updateSections')
  15646. })
  15647. },
  15648. afterexeccommand: function (a, b) {
  15649. 'paragraph' == b && d.fireEvent('updateSections')
  15650. },
  15651. keyup: function (a, b) {
  15652. var c = this,
  15653. d = c.selection.getRange()
  15654. if (1 != d.collapsed) c.fireEvent('updateSections')
  15655. else {
  15656. var e = b.keyCode || b.which
  15657. ;(13 != e && 8 != e && 46 != e) || c.fireEvent('updateSections')
  15658. }
  15659. }
  15660. },
  15661. commands: {
  15662. getsections: {
  15663. execCommand: function (a, c) {
  15664. function d(a) {
  15665. for (var b = 0; b < f.length; b++) if (f[b](a)) return b
  15666. return -1
  15667. }
  15668. function e(a, c) {
  15669. for (
  15670. var f, g, i, k = null, l = a.childNodes, m = 0, n = l.length;
  15671. m < n;
  15672. m++
  15673. )
  15674. if (((i = l[m]), (f = d(i)), f >= 0)) {
  15675. var o = h.selection
  15676. .getRange()
  15677. .selectNode(i)
  15678. .createAddress(!0).startAddress,
  15679. p = b({
  15680. tag: i.tagName,
  15681. title: i.innerText || i.textContent || '',
  15682. level: f,
  15683. dom: i,
  15684. startAddress: utils.clone(o, []),
  15685. endAddress: utils.clone(o, []),
  15686. children: []
  15687. })
  15688. for (
  15689. j.nextSection = p, p.previousSection = j, g = j;
  15690. f <= g.level;
  15691. )
  15692. g = g.parentSection
  15693. ;(p.parentSection = g), g.children.push(p), (k = j = p)
  15694. } else
  15695. 1 === i.nodeType && e(i, c),
  15696. k && k.endAddress[k.endAddress.length - 1]++
  15697. }
  15698. for (
  15699. var f = c || ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], g = 0;
  15700. g < f.length;
  15701. g++
  15702. )
  15703. 'string' == typeof f[g]
  15704. ? (f[g] = (function (a) {
  15705. return function (b) {
  15706. return b.tagName == a.toUpperCase()
  15707. }
  15708. })(f[g]))
  15709. : 'function' != typeof f[g] &&
  15710. (f[g] = function (a) {
  15711. return null
  15712. })
  15713. var h = this,
  15714. i = b({ level: -1, title: 'root' }),
  15715. j = i
  15716. return e(h.body, i), i
  15717. },
  15718. notNeedUndo: !0
  15719. },
  15720. movesection: {
  15721. execCommand: function (a, b, d, e) {
  15722. function f(a, b, c) {
  15723. for (
  15724. var d = !1, e = !1, f = 0;
  15725. f < a.length && !(f >= c.length);
  15726. f++
  15727. ) {
  15728. if (c[f] > a[f]) {
  15729. d = !0
  15730. break
  15731. }
  15732. if (c[f] < a[f]) break
  15733. }
  15734. for (var f = 0; f < b.length && !(f >= c.length); f++) {
  15735. if (c[f] < a[f]) {
  15736. e = !0
  15737. break
  15738. }
  15739. if (c[f] > a[f]) break
  15740. }
  15741. return d && e
  15742. }
  15743. var g,
  15744. h,
  15745. i = this
  15746. if (
  15747. b &&
  15748. d &&
  15749. d.level != -1 &&
  15750. ((g = e ? d.endAddress : d.startAddress),
  15751. (h = c(g, i.body)),
  15752. g && h && !f(b.startAddress, b.endAddress, g))
  15753. ) {
  15754. var j,
  15755. k,
  15756. l = c(b.startAddress, i.body),
  15757. m = c(b.endAddress, i.body)
  15758. if (e)
  15759. for (
  15760. j = m;
  15761. j &&
  15762. !(
  15763. domUtils.getPosition(l, j) & domUtils.POSITION_FOLLOWING
  15764. ) &&
  15765. ((k = j.previousSibling),
  15766. domUtils.insertAfter(h, j),
  15767. j != l);
  15768. )
  15769. j = k
  15770. else
  15771. for (
  15772. j = l;
  15773. j &&
  15774. !(
  15775. domUtils.getPosition(j, m) & domUtils.POSITION_FOLLOWING
  15776. ) &&
  15777. ((k = j.nextSibling),
  15778. h.parentNode.insertBefore(j, h),
  15779. j != m);
  15780. )
  15781. j = k
  15782. i.fireEvent('updateSections')
  15783. }
  15784. }
  15785. },
  15786. deletesection: {
  15787. execCommand: function (a, b, c) {
  15788. function d(a) {
  15789. for (var b = e.body, c = 0; c < a.length; c++) {
  15790. if (!b.childNodes) return null
  15791. b = b.childNodes[a[c]]
  15792. }
  15793. return b
  15794. }
  15795. var e = this
  15796. if (b) {
  15797. var f,
  15798. g = d(b.startAddress),
  15799. h = d(b.endAddress),
  15800. i = g
  15801. if (c) domUtils.remove(i)
  15802. else
  15803. for (
  15804. ;
  15805. i &&
  15806. domUtils.inDoc(h, e.document) &&
  15807. !(domUtils.getPosition(i, h) & domUtils.POSITION_FOLLOWING);
  15808. )
  15809. (f = i.nextSibling), domUtils.remove(i), (i = f)
  15810. e.fireEvent('updateSections')
  15811. }
  15812. }
  15813. },
  15814. selectsection: {
  15815. execCommand: function (a, b) {
  15816. if (!b && !b.dom) return !1
  15817. var c = this,
  15818. d = c.selection.getRange(),
  15819. e = {
  15820. startAddress: utils.clone(b.startAddress, []),
  15821. endAddress: utils.clone(b.endAddress, [])
  15822. }
  15823. return (
  15824. e.endAddress[e.endAddress.length - 1]++,
  15825. d.moveToAddress(e).select().scrollToView(),
  15826. !0
  15827. )
  15828. },
  15829. notNeedUndo: !0
  15830. },
  15831. scrolltosection: {
  15832. execCommand: function (a, b) {
  15833. if (!b && !b.dom) return !1
  15834. var c = this,
  15835. d = c.selection.getRange(),
  15836. e = { startAddress: b.startAddress, endAddress: b.endAddress }
  15837. return (
  15838. e.endAddress[e.endAddress.length - 1]++,
  15839. d.moveToAddress(e).scrollToView(),
  15840. !0
  15841. )
  15842. },
  15843. notNeedUndo: !0
  15844. }
  15845. }
  15846. }
  15847. }),
  15848. UE.plugin.register('simpleupload', function () {
  15849. function a() {
  15850. var a = b.offsetWidth || 20,
  15851. e = b.offsetHeight || 20,
  15852. f =
  15853. 'display:block;width:' +
  15854. a +
  15855. 'px;height:' +
  15856. e +
  15857. 'px;overflow:hidden;border:0;margin:0;padding:0;position:absolute;top:0;left:0;filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity: 0;opacity: 0;cursor:pointer;',
  15858. g = document.createElement('form'),
  15859. h = document.createElement('input')
  15860. ;(g.id = 'edui_form_' + d),
  15861. (g.enctype = 'multipart/form-data'),
  15862. (g.style = f),
  15863. (h.id = 'edui_input_' + d),
  15864. (h.type = 'file'),
  15865. (h.accept = 'image/*'),
  15866. (h.name = c.options.imageFieldName),
  15867. (h.style = f),
  15868. g.appendChild(h),
  15869. b.appendChild(g),
  15870. h.addEventListener('change', function (a) {
  15871. function b(a) {
  15872. if (d) {
  15873. var b = c.document.getElementById(d)
  15874. b && domUtils.remove(b),
  15875. c.fireEvent('showmessage', {
  15876. id: d,
  15877. content: a,
  15878. type: 'error',
  15879. timeout: 4e3
  15880. })
  15881. }
  15882. }
  15883. if (h.value) {
  15884. var d = 'loading_' + (+new Date()).toString(36),
  15885. e = c.getActionUrl(c.getOpt('imageActionName')),
  15886. f =
  15887. utils.serializeParam(c.queryCommandValue('serverparam')) ||
  15888. '',
  15889. i = utils.formatUrl(e + (e.indexOf('?') == -1 ? '?' : '&') + f),
  15890. j = c.getOpt('imageAllowFiles')
  15891. if (
  15892. (c.focus(),
  15893. c.execCommand(
  15894. 'inserthtml',
  15895. '<img class="loadingclass" id="' +
  15896. d +
  15897. '" src="' +
  15898. c.options.themePath +
  15899. c.options.theme +
  15900. '/images/spacer.gif" title="' +
  15901. (c.getLang('simpleupload.loading') || '') +
  15902. '" >'
  15903. ),
  15904. !c.getOpt('imageActionName'))
  15905. )
  15906. return void b(c.getLang('autoupload.errorLoadConfig'))
  15907. var k = h.value,
  15908. l = k ? k.substr(k.lastIndexOf('.')) : ''
  15909. if (
  15910. !l ||
  15911. (j && (j.join('') + '.').indexOf(l.toLowerCase() + '.') == -1)
  15912. )
  15913. return void b(c.getLang('simpleupload.exceedTypeError'))
  15914. var m = new XMLHttpRequest()
  15915. if (
  15916. (m.open('post', i, !0),
  15917. c.options.headers &&
  15918. '[object Object]' ===
  15919. Object.prototype.toString.apply(c.options.headers))
  15920. )
  15921. for (var n in c.options.headers)
  15922. m.setRequestHeader(n, c.options.headers[n])
  15923. ;(m.onload = function () {
  15924. if ((m.status >= 200 && m.status < 300) || 304 == m.status) {
  15925. var a = JSON.parse(m.responseText),
  15926. e = c.options.imageUrlPrefix + a.url
  15927. 'SUCCESS' == a.state && a.url
  15928. ? ((loader = c.document.getElementById(d)),
  15929. loader.setAttribute('src', e),
  15930. loader.setAttribute('_src', e),
  15931. loader.setAttribute('title', a.title || ''),
  15932. loader.setAttribute('alt', a.original || ''),
  15933. loader.removeAttribute('id'),
  15934. domUtils.removeClasses(loader, 'loadingclass'),
  15935. c.fireEvent('contentchange'))
  15936. : b(a.state)
  15937. } else b(c.getLang('simpleupload.loadError'))
  15938. }),
  15939. (m.onerror = function () {
  15940. b(c.getLang('simpleupload.loadError'))
  15941. }),
  15942. m.send(new FormData(g)),
  15943. g.reset()
  15944. }
  15945. })
  15946. }
  15947. var b,
  15948. c = this,
  15949. d = (+new Date()).toString(36)
  15950. return {
  15951. bindEvents: {
  15952. ready: function () {
  15953. utils.cssRule(
  15954. 'loading',
  15955. ".loadingclass{display:inline-block;cursor:default;background: url('" +
  15956. this.options.themePath +
  15957. this.options.theme +
  15958. "/images/loading.gif') no-repeat center center transparent;border:1px solid #cccccc;margin-right:1px;height: 22px;width: 22px;}\n.loaderrorclass{display:inline-block;cursor:default;background: url('" +
  15959. this.options.themePath +
  15960. this.options.theme +
  15961. "/images/loaderror.png') no-repeat center center transparent;border:1px solid #cccccc;margin-right:1px;height: 22px;width: 22px;}",
  15962. this.document
  15963. )
  15964. },
  15965. simpleuploadbtnready: function (d, e) {
  15966. ;(b = e), c.afterConfigReady(a)
  15967. }
  15968. },
  15969. outputRule: function (a) {
  15970. utils.each(a.getNodesByTagName('img'), function (a) {
  15971. ;/\b(loaderrorclass)|(bloaderrorclass)\b/.test(
  15972. a.getAttr('class')
  15973. ) && a.parentNode.removeChild(a)
  15974. })
  15975. }
  15976. }
  15977. }),
  15978. UE.plugin.register('serverparam', function () {
  15979. var a = {}
  15980. return {
  15981. commands: {
  15982. serverparam: {
  15983. execCommand: function (b, c, d) {
  15984. void 0 === c || null === c
  15985. ? (a = {})
  15986. : utils.isString(c)
  15987. ? void 0 === d || null === d
  15988. ? delete a[c]
  15989. : (a[c] = d)
  15990. : utils.isObject(c)
  15991. ? utils.extend(a, c, !0)
  15992. : utils.isFunction(c) && utils.extend(a, c(), !0)
  15993. },
  15994. queryCommandValue: function () {
  15995. return a || {}
  15996. }
  15997. }
  15998. }
  15999. }
  16000. }),
  16001. UE.plugin.register('insertfile', function () {
  16002. function a(a) {
  16003. var b = a.substr(a.lastIndexOf('.') + 1).toLowerCase(),
  16004. c = {
  16005. rar: 'icon_rar.gif',
  16006. zip: 'icon_rar.gif',
  16007. tar: 'icon_rar.gif',
  16008. gz: 'icon_rar.gif',
  16009. bz2: 'icon_rar.gif',
  16010. doc: 'icon_doc.gif',
  16011. docx: 'icon_doc.gif',
  16012. pdf: 'icon_pdf.gif',
  16013. mp3: 'icon_mp3.gif',
  16014. xls: 'icon_xls.gif',
  16015. chm: 'icon_chm.gif',
  16016. ppt: 'icon_ppt.gif',
  16017. pptx: 'icon_ppt.gif',
  16018. avi: 'icon_mv.gif',
  16019. rmvb: 'icon_mv.gif',
  16020. wmv: 'icon_mv.gif',
  16021. flv: 'icon_mv.gif',
  16022. swf: 'icon_mv.gif',
  16023. rm: 'icon_mv.gif',
  16024. exe: 'icon_exe.gif',
  16025. psd: 'icon_psd.gif',
  16026. txt: 'icon_txt.gif',
  16027. jpg: 'icon_jpg.gif',
  16028. png: 'icon_jpg.gif',
  16029. jpeg: 'icon_jpg.gif',
  16030. gif: 'icon_jpg.gif',
  16031. ico: 'icon_jpg.gif',
  16032. bmp: 'icon_jpg.gif'
  16033. }
  16034. return c[b] ? c[b] : c.txt
  16035. }
  16036. var b = this
  16037. return {
  16038. commands: {
  16039. insertfile: {
  16040. execCommand: function (c, d) {
  16041. d = utils.isArray(d) ? d : [d]
  16042. var e,
  16043. f,
  16044. g,
  16045. h,
  16046. i = '',
  16047. j = b.getOpt('UEDITOR_HOME_URL'),
  16048. k =
  16049. j +
  16050. ('/' == j.substr(j.length - 1) ? '' : '/') +
  16051. 'dialogs/attachment/fileTypeImages/'
  16052. for (e = 0; e < d.length; e++)
  16053. (f = d[e]),
  16054. (g = k + a(f.url)),
  16055. (h = f.title || f.url.substr(f.url.lastIndexOf('/') + 1)),
  16056. (i +=
  16057. '<p style="line-height: 16px;"><img style="vertical-align: middle; margin-right: 2px;" src="' +
  16058. g +
  16059. '" _src="' +
  16060. g +
  16061. '" /><a style="font-size:12px; color:#0066cc;" href="' +
  16062. f.url +
  16063. '" title="' +
  16064. h +
  16065. '">' +
  16066. h +
  16067. '</a></p>')
  16068. b.execCommand('insertHtml', i)
  16069. }
  16070. }
  16071. }
  16072. }
  16073. }),
  16074. (UE.plugins.xssFilter = function () {
  16075. function a(a) {
  16076. var b = a.tagName,
  16077. d = a.attrs
  16078. return c.hasOwnProperty(b)
  16079. ? void UE.utils.each(d, function (d, e) {
  16080. c[b].indexOf(e) === -1 && a.setAttr(e)
  16081. })
  16082. : (a.parentNode.removeChild(a), !1)
  16083. }
  16084. var b = UEDITOR_CONFIG,
  16085. c = b.whitList
  16086. c &&
  16087. b.xssFilterRules &&
  16088. (this.options.filterRules = (function () {
  16089. var b = {}
  16090. return (
  16091. UE.utils.each(c, function (c, d) {
  16092. b[d] = function (b) {
  16093. return a(b)
  16094. }
  16095. }),
  16096. b
  16097. )
  16098. })())
  16099. var d = []
  16100. UE.utils.each(c, function (a, b) {
  16101. d.push(b)
  16102. }),
  16103. c &&
  16104. b.inputXssFilter &&
  16105. this.addInputRule(function (b) {
  16106. b.traversal(function (b) {
  16107. return 'element' === b.type && void a(b)
  16108. })
  16109. }),
  16110. c &&
  16111. b.outputXssFilter &&
  16112. this.addOutputRule(function (b) {
  16113. b.traversal(function (b) {
  16114. return 'element' === b.type && void a(b)
  16115. })
  16116. })
  16117. })
  16118. var baidu = baidu || {}
  16119. ;(baidu.editor = baidu.editor || {}),
  16120. (UE.ui = baidu.editor.ui = {}),
  16121. (function () {
  16122. function a() {
  16123. var a = document.getElementById('edui_fixedlayer')
  16124. i.setViewportOffset(a, { left: 0, top: 0 })
  16125. }
  16126. function b(b) {
  16127. d.on(window, 'scroll', a),
  16128. d.on(window, 'resize', baidu.editor.utils.defer(a, 0, !0))
  16129. }
  16130. var c = baidu.editor.browser,
  16131. d = baidu.editor.dom.domUtils,
  16132. e = '$EDITORUI',
  16133. f = (window[e] = {}),
  16134. g = 'ID' + e,
  16135. h = 0,
  16136. i = (baidu.editor.ui.uiUtils = {
  16137. uid: function (a) {
  16138. return a ? a[g] || (a[g] = ++h) : ++h
  16139. },
  16140. hook: function (a, b) {
  16141. var c
  16142. return (
  16143. a && a._callbacks
  16144. ? (c = a)
  16145. : ((c = function () {
  16146. var b
  16147. a && (b = a.apply(this, arguments))
  16148. for (var d = c._callbacks, e = d.length; e--; ) {
  16149. var f = d[e].apply(this, arguments)
  16150. void 0 === b && (b = f)
  16151. }
  16152. return b
  16153. }),
  16154. (c._callbacks = [])),
  16155. c._callbacks.push(b),
  16156. c
  16157. )
  16158. },
  16159. createElementByHtml: function (a) {
  16160. var b = document.createElement('div')
  16161. return (
  16162. (b.innerHTML = a),
  16163. (b = b.firstChild),
  16164. b.parentNode.removeChild(b),
  16165. b
  16166. )
  16167. },
  16168. getViewportElement: function () {
  16169. return c.ie && c.quirks ? document.body : document.documentElement
  16170. },
  16171. getClientRect: function (a) {
  16172. var b
  16173. try {
  16174. b = a.getBoundingClientRect()
  16175. } catch (c) {
  16176. b = { left: 0, top: 0, height: 0, width: 0 }
  16177. }
  16178. for (
  16179. var e,
  16180. f = {
  16181. left: Math.round(b.left),
  16182. top: Math.round(b.top),
  16183. height: Math.round(b.bottom - b.top),
  16184. width: Math.round(b.right - b.left)
  16185. };
  16186. (e = a.ownerDocument) !== document &&
  16187. (a = d.getWindow(e).frameElement);
  16188. )
  16189. (b = a.getBoundingClientRect()),
  16190. (f.left += b.left),
  16191. (f.top += b.top)
  16192. return (
  16193. (f.bottom = f.top + f.height), (f.right = f.left + f.width), f
  16194. )
  16195. },
  16196. getViewportRect: function () {
  16197. var a = i.getViewportElement(),
  16198. b = 0 | (window.innerWidth || a.clientWidth),
  16199. c = 0 | (window.innerHeight || a.clientHeight)
  16200. return { left: 0, top: 0, height: c, width: b, bottom: c, right: b }
  16201. },
  16202. setViewportOffset: function (a, b) {
  16203. var c = i.getFixedLayer()
  16204. a.parentNode === c
  16205. ? ((a.style.left = b.left + 'px'), (a.style.top = b.top + 'px'))
  16206. : d.setViewportOffset(a, b)
  16207. },
  16208. getEventOffset: function (a) {
  16209. var b = a.target || a.srcElement,
  16210. c = i.getClientRect(b),
  16211. d = i.getViewportOffsetByEvent(a)
  16212. return { left: d.left - c.left, top: d.top - c.top }
  16213. },
  16214. getViewportOffsetByEvent: function (a) {
  16215. var b = a.target || a.srcElement,
  16216. c = d.getWindow(b).frameElement,
  16217. e = { left: a.clientX, top: a.clientY }
  16218. if (c && b.ownerDocument !== document) {
  16219. var f = i.getClientRect(c)
  16220. ;(e.left += f.left), (e.top += f.top)
  16221. }
  16222. return e
  16223. },
  16224. setGlobal: function (a, b) {
  16225. return (f[a] = b), e + '["' + a + '"]'
  16226. },
  16227. unsetGlobal: function (a) {
  16228. delete f[a]
  16229. },
  16230. copyAttributes: function (a, b) {
  16231. for (var e = b.attributes, f = e.length; f--; ) {
  16232. var g = e[f]
  16233. 'style' == g.nodeName ||
  16234. 'class' == g.nodeName ||
  16235. (c.ie && !g.specified) ||
  16236. a.setAttribute(g.nodeName, g.nodeValue)
  16237. }
  16238. b.className && d.addClass(a, b.className),
  16239. b.style.cssText && (a.style.cssText += ';' + b.style.cssText)
  16240. },
  16241. removeStyle: function (a, b) {
  16242. if (a.style.removeProperty) a.style.removeProperty(b)
  16243. else {
  16244. if (!a.style.removeAttribute) throw ''
  16245. a.style.removeAttribute(b)
  16246. }
  16247. },
  16248. contains: function (a, b) {
  16249. return (
  16250. a &&
  16251. b &&
  16252. a !== b &&
  16253. (a.contains ? a.contains(b) : 16 & a.compareDocumentPosition(b))
  16254. )
  16255. },
  16256. startDrag: function (a, b, c) {
  16257. function d(a) {
  16258. var c = a.clientX - g,
  16259. d = a.clientY - h
  16260. b.ondragmove(c, d, a),
  16261. a.stopPropagation ? a.stopPropagation() : (a.cancelBubble = !0)
  16262. }
  16263. function e(a) {
  16264. c.removeEventListener('mousemove', d, !0),
  16265. c.removeEventListener('mouseup', e, !0),
  16266. window.removeEventListener('mouseup', e, !0),
  16267. b.ondragstop()
  16268. }
  16269. function f() {
  16270. i.releaseCapture(),
  16271. i.detachEvent('onmousemove', d),
  16272. i.detachEvent('onmouseup', f),
  16273. i.detachEvent('onlosecaptrue', f),
  16274. b.ondragstop()
  16275. }
  16276. var c = c || document,
  16277. g = a.clientX,
  16278. h = a.clientY
  16279. if (c.addEventListener)
  16280. c.addEventListener('mousemove', d, !0),
  16281. c.addEventListener('mouseup', e, !0),
  16282. window.addEventListener('mouseup', e, !0),
  16283. a.preventDefault()
  16284. else {
  16285. var i = a.srcElement
  16286. i.setCapture(),
  16287. i.attachEvent('onmousemove', d),
  16288. i.attachEvent('onmouseup', f),
  16289. i.attachEvent('onlosecaptrue', f),
  16290. (a.returnValue = !1)
  16291. }
  16292. b.ondragstart()
  16293. },
  16294. getFixedLayer: function () {
  16295. var d = document.getElementById('edui_fixedlayer')
  16296. return (
  16297. null == d &&
  16298. ((d = document.createElement('div')),
  16299. (d.id = 'edui_fixedlayer'),
  16300. document.body.appendChild(d),
  16301. c.ie && c.version <= 8
  16302. ? ((d.style.position = 'absolute'), b(), setTimeout(a))
  16303. : (d.style.position = 'fixed'),
  16304. (d.style.left = '0'),
  16305. (d.style.top = '0'),
  16306. (d.style.width = '0'),
  16307. (d.style.height = '0')),
  16308. d
  16309. )
  16310. },
  16311. makeUnselectable: function (a) {
  16312. if (c.opera || (c.ie && c.version < 9)) {
  16313. if (((a.unselectable = 'on'), a.hasChildNodes()))
  16314. for (var b = 0; b < a.childNodes.length; b++)
  16315. 1 == a.childNodes[b].nodeType &&
  16316. i.makeUnselectable(a.childNodes[b])
  16317. } else
  16318. void 0 !== a.style.MozUserSelect
  16319. ? (a.style.MozUserSelect = 'none')
  16320. : void 0 !== a.style.WebkitUserSelect
  16321. ? (a.style.WebkitUserSelect = 'none')
  16322. : void 0 !== a.style.KhtmlUserSelect &&
  16323. (a.style.KhtmlUserSelect = 'none')
  16324. }
  16325. })
  16326. })(),
  16327. (function () {
  16328. var a = baidu.editor.utils,
  16329. b = baidu.editor.ui.uiUtils,
  16330. c = baidu.editor.EventBase,
  16331. d = (baidu.editor.ui.UIBase = function () {})
  16332. ;(d.prototype = {
  16333. className: '',
  16334. uiName: '',
  16335. initOptions: function (a) {
  16336. var c = this
  16337. for (var d in a) c[d] = a[d]
  16338. this.id = this.id || 'edui' + b.uid()
  16339. },
  16340. initUIBase: function () {
  16341. this._globalKey = a.unhtml(b.setGlobal(this.id, this))
  16342. },
  16343. render: function (a) {
  16344. for (
  16345. var c,
  16346. d = this.renderHtml(),
  16347. e = b.createElementByHtml(d),
  16348. f = domUtils.getElementsByTagName(e, '*'),
  16349. g = 'edui-' + (this.theme || this.editor.options.theme),
  16350. h = document.getElementById('edui_fixedlayer'),
  16351. i = 0;
  16352. (c = f[i++]);
  16353. )
  16354. domUtils.addClass(c, g)
  16355. domUtils.addClass(e, g),
  16356. h && ((h.className = ''), domUtils.addClass(h, g))
  16357. var j = this.getDom()
  16358. null != j
  16359. ? (j.parentNode.replaceChild(e, j), b.copyAttributes(e, j))
  16360. : ('string' == typeof a && (a = document.getElementById(a)),
  16361. (a = a || b.getFixedLayer()),
  16362. domUtils.addClass(a, g),
  16363. a.appendChild(e)),
  16364. this.postRender()
  16365. },
  16366. getDom: function (a) {
  16367. return a
  16368. ? document.getElementById(this.id + '_' + a)
  16369. : document.getElementById(this.id)
  16370. },
  16371. postRender: function () {
  16372. this.fireEvent('postrender')
  16373. },
  16374. getHtmlTpl: function () {
  16375. return ''
  16376. },
  16377. formatHtml: function (a) {
  16378. var b = 'edui-' + this.uiName
  16379. return a
  16380. .replace(/##/g, this.id)
  16381. .replace(/%%-/g, this.uiName ? b + '-' : '')
  16382. .replace(/%%/g, (this.uiName ? b : '') + ' ' + this.className)
  16383. .replace(/\$\$/g, this._globalKey)
  16384. },
  16385. renderHtml: function () {
  16386. return this.formatHtml(this.getHtmlTpl())
  16387. },
  16388. dispose: function () {
  16389. var a = this.getDom()
  16390. a && baidu.editor.dom.domUtils.remove(a), b.unsetGlobal(this.id)
  16391. }
  16392. }),
  16393. a.inherits(d, c)
  16394. })(),
  16395. (function () {
  16396. var a = baidu.editor.utils,
  16397. b = baidu.editor.ui.UIBase,
  16398. c = (baidu.editor.ui.Separator = function (a) {
  16399. this.initOptions(a), this.initSeparator()
  16400. })
  16401. ;(c.prototype = {
  16402. uiName: 'separator',
  16403. initSeparator: function () {
  16404. this.initUIBase()
  16405. },
  16406. getHtmlTpl: function () {
  16407. return '<div id="##" class="edui-box %%"></div>'
  16408. }
  16409. }),
  16410. a.inherits(c, b)
  16411. })(),
  16412. (function () {
  16413. var a = baidu.editor.utils,
  16414. b = baidu.editor.dom.domUtils,
  16415. c = baidu.editor.ui.UIBase,
  16416. d = baidu.editor.ui.uiUtils,
  16417. e = (baidu.editor.ui.Mask = function (a) {
  16418. this.initOptions(a), this.initUIBase()
  16419. })
  16420. ;(e.prototype = {
  16421. getHtmlTpl: function () {
  16422. return '<div id="##" class="edui-mask %%" onclick="return $$._onClick(event, this);" onmousedown="return $$._onMouseDown(event, this);"></div>'
  16423. },
  16424. postRender: function () {
  16425. var a = this
  16426. b.on(window, 'resize', function () {
  16427. setTimeout(function () {
  16428. a.isHidden() || a._fill()
  16429. })
  16430. })
  16431. },
  16432. show: function (a) {
  16433. this._fill(),
  16434. (this.getDom().style.display = ''),
  16435. (this.getDom().style.zIndex = a)
  16436. },
  16437. hide: function () {
  16438. ;(this.getDom().style.display = 'none'),
  16439. (this.getDom().style.zIndex = '')
  16440. },
  16441. isHidden: function () {
  16442. return 'none' == this.getDom().style.display
  16443. },
  16444. _onMouseDown: function () {
  16445. return !1
  16446. },
  16447. _onClick: function (a, b) {
  16448. this.fireEvent('click', a, b)
  16449. },
  16450. _fill: function () {
  16451. var a = this.getDom(),
  16452. b = d.getViewportRect()
  16453. ;(a.style.width = b.width + 'px'), (a.style.height = b.height + 'px')
  16454. }
  16455. }),
  16456. a.inherits(e, c)
  16457. })(),
  16458. (function () {
  16459. function a(a, b) {
  16460. for (var c = 0; c < g.length; c++) {
  16461. var d = g[c]
  16462. if (!d.isHidden() && d.queryAutoHide(b) !== !1) {
  16463. if (
  16464. a &&
  16465. /scroll/gi.test(a.type) &&
  16466. 'edui-wordpastepop' == d.className
  16467. )
  16468. return
  16469. d.hide()
  16470. }
  16471. }
  16472. g.length && d.editor.fireEvent('afterhidepop')
  16473. }
  16474. var b = baidu.editor.utils,
  16475. c = baidu.editor.ui.uiUtils,
  16476. d = baidu.editor.dom.domUtils,
  16477. e = baidu.editor.ui.UIBase,
  16478. f = (baidu.editor.ui.Popup = function (a) {
  16479. this.initOptions(a), this.initPopup()
  16480. }),
  16481. g = []
  16482. f.postHide = a
  16483. var h = [
  16484. 'edui-anchor-topleft',
  16485. 'edui-anchor-topright',
  16486. 'edui-anchor-bottomleft',
  16487. 'edui-anchor-bottomright'
  16488. ]
  16489. ;(f.prototype = {
  16490. SHADOW_RADIUS: 5,
  16491. content: null,
  16492. _hidden: !1,
  16493. autoRender: !0,
  16494. canSideLeft: !0,
  16495. canSideUp: !0,
  16496. initPopup: function () {
  16497. this.initUIBase(), g.push(this)
  16498. },
  16499. getHtmlTpl: function () {
  16500. return (
  16501. '<div id="##" class="edui-popup %%" onmousedown="return false;"> <div id="##_body" class="edui-popup-body"> <iframe style="position:absolute;z-index:-1;left:0;top:0;background-color: transparent;" frameborder="0" width="100%" height="100%" src="about:blank"></iframe> <div class="edui-shadow"></div> <div id="##_content" class="edui-popup-content">' +
  16502. this.getContentHtmlTpl() +
  16503. ' </div> </div></div>'
  16504. )
  16505. },
  16506. getContentHtmlTpl: function () {
  16507. return this.content
  16508. ? 'string' == typeof this.content
  16509. ? this.content
  16510. : this.content.renderHtml()
  16511. : ''
  16512. },
  16513. _UIBase_postRender: e.prototype.postRender,
  16514. postRender: function () {
  16515. if (
  16516. (this.content instanceof e && this.content.postRender(),
  16517. this.captureWheel && !this.captured)
  16518. ) {
  16519. this.captured = !0
  16520. var a =
  16521. (document.documentElement.clientHeight ||
  16522. document.body.clientHeight) - 80,
  16523. b = this.getDom().offsetHeight,
  16524. f = c.getClientRect(this.combox.getDom()).top,
  16525. g = this.getDom('content'),
  16526. h = this.getDom('body').getElementsByTagName('iframe'),
  16527. i = this
  16528. for (h.length && (h = h[0]); f + b > a; ) b -= 30
  16529. ;(g.style.height = b + 'px'),
  16530. h && (h.style.height = b + 'px'),
  16531. window.XMLHttpRequest
  16532. ? d.on(
  16533. g,
  16534. 'onmousewheel' in document.body
  16535. ? 'mousewheel'
  16536. : 'DOMMouseScroll',
  16537. function (a) {
  16538. a.preventDefault
  16539. ? a.preventDefault()
  16540. : (a.returnValue = !1),
  16541. a.wheelDelta
  16542. ? (g.scrollTop -= (a.wheelDelta / 120) * 60)
  16543. : (g.scrollTop -= (a.detail / -3) * 60)
  16544. }
  16545. )
  16546. : d.on(this.getDom(), 'mousewheel', function (a) {
  16547. ;(a.returnValue = !1),
  16548. (i.getDom('content').scrollTop -=
  16549. (a.wheelDelta / 120) * 60)
  16550. })
  16551. }
  16552. this.fireEvent('postRenderAfter'),
  16553. this.hide(!0),
  16554. this._UIBase_postRender()
  16555. },
  16556. _doAutoRender: function () {
  16557. !this.getDom() && this.autoRender && this.render()
  16558. },
  16559. mesureSize: function () {
  16560. var a = this.getDom('content')
  16561. return c.getClientRect(a)
  16562. },
  16563. fitSize: function () {
  16564. if (this.captureWheel && this.sized) return this.__size
  16565. this.sized = !0
  16566. var a = this.getDom('body')
  16567. ;(a.style.width = ''), (a.style.height = '')
  16568. var b = this.mesureSize()
  16569. if (this.captureWheel) {
  16570. a.style.width = -(-20 - b.width) + 'px'
  16571. var c = parseInt(this.getDom('content').style.height, 10)
  16572. !window.isNaN(c) && (b.height = c)
  16573. } else a.style.width = b.width + 'px'
  16574. return (
  16575. (a.style.height = b.height + 'px'),
  16576. (this.__size = b),
  16577. this.captureWheel &&
  16578. (this.getDom('content').style.overflow = 'auto'),
  16579. b
  16580. )
  16581. },
  16582. showAnchor: function (a, b) {
  16583. this.showAnchorRect(c.getClientRect(a), b)
  16584. },
  16585. showAnchorRect: function (a, b, e) {
  16586. this._doAutoRender()
  16587. var f = c.getViewportRect()
  16588. ;(this.getDom().style.visibility = 'hidden'), this._show()
  16589. var g,
  16590. i,
  16591. j,
  16592. k,
  16593. l = this.fitSize()
  16594. b
  16595. ? ((g =
  16596. this.canSideLeft &&
  16597. a.right + l.width > f.right &&
  16598. a.left > l.width),
  16599. (i =
  16600. this.canSideUp &&
  16601. a.top + l.height > f.bottom &&
  16602. a.bottom > l.height),
  16603. (j = g ? a.left - l.width : a.right),
  16604. (k = i ? a.bottom - l.height : a.top))
  16605. : ((g =
  16606. this.canSideLeft &&
  16607. a.right + l.width > f.right &&
  16608. a.left > l.width),
  16609. (i =
  16610. this.canSideUp &&
  16611. a.top + l.height > f.bottom &&
  16612. a.bottom > l.height),
  16613. (j = g ? a.right - l.width : a.left),
  16614. (k = i ? a.top - l.height : a.bottom))
  16615. var m = this.getDom()
  16616. c.setViewportOffset(m, { left: j, top: k }),
  16617. d.removeClasses(m, h),
  16618. (m.className += ' ' + h[2 * (i ? 1 : 0) + (g ? 1 : 0)]),
  16619. this.editor &&
  16620. ((m.style.zIndex = 1 * this.editor.container.style.zIndex + 10),
  16621. (baidu.editor.ui.uiUtils.getFixedLayer().style.zIndex =
  16622. m.style.zIndex - 1)),
  16623. (this.getDom().style.visibility = 'visible')
  16624. },
  16625. showAt: function (a) {
  16626. var b = a.left,
  16627. c = a.top,
  16628. d = { left: b, top: c, right: b, bottom: c, height: 0, width: 0 }
  16629. this.showAnchorRect(d, !1, !0)
  16630. },
  16631. _show: function () {
  16632. if (this._hidden) {
  16633. var a = this.getDom()
  16634. ;(a.style.display = ''), (this._hidden = !1), this.fireEvent('show')
  16635. }
  16636. },
  16637. isHidden: function () {
  16638. return this._hidden
  16639. },
  16640. show: function () {
  16641. this._doAutoRender(), this._show()
  16642. },
  16643. hide: function (a) {
  16644. !this._hidden &&
  16645. this.getDom() &&
  16646. ((this.getDom().style.display = 'none'),
  16647. (this._hidden = !0),
  16648. a || this.fireEvent('hide'))
  16649. },
  16650. queryAutoHide: function (a) {
  16651. return !a || !c.contains(this.getDom(), a)
  16652. }
  16653. }),
  16654. b.inherits(f, e),
  16655. d.on(document, 'mousedown', function (b) {
  16656. var c = b.target || b.srcElement
  16657. a(b, c)
  16658. }),
  16659. d.on(window, 'scroll', function (b, c) {
  16660. a(b, c)
  16661. })
  16662. })(),
  16663. (function () {
  16664. function a(a, b) {
  16665. for (
  16666. var c =
  16667. '<div id="##" class="edui-colorpicker %%"><div class="edui-colorpicker-topbar edui-clearfix"><div unselectable="on" id="##_preview" class="edui-colorpicker-preview"></div><div unselectable="on" class="edui-colorpicker-nocolor" onclick="$$._onPickNoColor(event, this);">' +
  16668. a +
  16669. '</div></div><table class="edui-box" style="border-collapse: collapse;" onmouseover="$$._onTableOver(event, this);" onmouseout="$$._onTableOut(event, this);" onclick="return $$._onTableClick(event, this);" cellspacing="0" cellpadding="0"><tr style="border-bottom: 1px solid #ddd;font-size: 13px;line-height: 25px;color:#39C;padding-top: 2px"><td colspan="10">' +
  16670. b.getLang('themeColor') +
  16671. '</td> </tr><tr class="edui-colorpicker-tablefirstrow" >',
  16672. d = 0;
  16673. d < e.length;
  16674. d++
  16675. )
  16676. d &&
  16677. d % 10 === 0 &&
  16678. (c +=
  16679. '</tr>' +
  16680. (60 == d
  16681. ? '<tr style="border-bottom: 1px solid #ddd;font-size: 13px;line-height: 25px;color:#39C;"><td colspan="10">' +
  16682. b.getLang('standardColor') +
  16683. '</td></tr>'
  16684. : '') +
  16685. '<tr' +
  16686. (60 == d ? ' class="edui-colorpicker-tablefirstrow"' : '') +
  16687. '>'),
  16688. (c +=
  16689. d < 70
  16690. ? '<td style="padding: 0 2px;"><a hidefocus title="' +
  16691. e[d] +
  16692. '" onclick="return false;" href="javascript:" unselectable="on" class="edui-box edui-colorpicker-colorcell" data-color="#' +
  16693. e[d] +
  16694. '" style="background-color:#' +
  16695. e[d] +
  16696. ';border:solid #ccc;' +
  16697. (d < 10 || d >= 60
  16698. ? 'border-width:1px;'
  16699. : d >= 10 && d < 20
  16700. ? 'border-width:1px 1px 0 1px;'
  16701. : 'border-width:0 1px 0 1px;') +
  16702. '"></a></td>'
  16703. : '')
  16704. return (c += '</tr></table></div>')
  16705. }
  16706. var b = baidu.editor.utils,
  16707. c = baidu.editor.ui.UIBase,
  16708. d = (baidu.editor.ui.ColorPicker = function (a) {
  16709. this.initOptions(a),
  16710. (this.noColorText =
  16711. this.noColorText || this.editor.getLang('clearColor')),
  16712. this.initUIBase()
  16713. })
  16714. ;(d.prototype = {
  16715. getHtmlTpl: function () {
  16716. return a(this.noColorText, this.editor)
  16717. },
  16718. _onTableClick: function (a) {
  16719. var b = a.target || a.srcElement,
  16720. c = b.getAttribute('data-color')
  16721. c && this.fireEvent('pickcolor', c)
  16722. },
  16723. _onTableOver: function (a) {
  16724. var b = a.target || a.srcElement,
  16725. c = b.getAttribute('data-color')
  16726. c && (this.getDom('preview').style.backgroundColor = c)
  16727. },
  16728. _onTableOut: function () {
  16729. this.getDom('preview').style.backgroundColor = ''
  16730. },
  16731. _onPickNoColor: function () {
  16732. this.fireEvent('picknocolor')
  16733. }
  16734. }),
  16735. b.inherits(d, c)
  16736. var e =
  16737. 'ffffff,000000,eeece1,1f497d,4f81bd,c0504d,9bbb59,8064a2,4bacc6,f79646,f2f2f2,7f7f7f,ddd9c3,c6d9f0,dbe5f1,f2dcdb,ebf1dd,e5e0ec,dbeef3,fdeada,d8d8d8,595959,c4bd97,8db3e2,b8cce4,e5b9b7,d7e3bc,ccc1d9,b7dde8,fbd5b5,bfbfbf,3f3f3f,938953,548dd4,95b3d7,d99694,c3d69b,b2a2c7,92cddc,fac08f,a5a5a5,262626,494429,17365d,366092,953734,76923c,5f497a,31859b,e36c09,7f7f7f,0c0c0c,1d1b10,0f243e,244061,632423,4f6128,3f3151,205867,974806,c00000,ff0000,ffc000,ffff00,92d050,00b050,00b0f0,0070c0,002060,7030a0,'.split(
  16738. ','
  16739. )
  16740. })(),
  16741. (function () {
  16742. var a = baidu.editor.utils,
  16743. b = baidu.editor.ui.uiUtils,
  16744. c = baidu.editor.ui.UIBase,
  16745. d = (baidu.editor.ui.TablePicker = function (a) {
  16746. this.initOptions(a), this.initTablePicker()
  16747. })
  16748. ;(d.prototype = {
  16749. defaultNumRows: 10,
  16750. defaultNumCols: 10,
  16751. maxNumRows: 20,
  16752. maxNumCols: 20,
  16753. numRows: 10,
  16754. numCols: 10,
  16755. lengthOfCellSide: 22,
  16756. initTablePicker: function () {
  16757. this.initUIBase()
  16758. },
  16759. getHtmlTpl: function () {
  16760. return '<div id="##" class="edui-tablepicker %%"><div class="edui-tablepicker-body"><div class="edui-infoarea"><span id="##_label" class="edui-label"></span></div><div class="edui-pickarea" onmousemove="$$._onMouseMove(event, this);" onmouseover="$$._onMouseOver(event, this);" onmouseout="$$._onMouseOut(event, this);" onclick="$$._onClick(event, this);"><div id="##_overlay" class="edui-overlay"></div></div></div></div>'
  16761. },
  16762. _UIBase_render: c.prototype.render,
  16763. render: function (a) {
  16764. this._UIBase_render(a),
  16765. (this.getDom('label').innerHTML =
  16766. '0' +
  16767. this.editor.getLang('t_row') +
  16768. ' x 0' +
  16769. this.editor.getLang('t_col'))
  16770. },
  16771. _track: function (a, b) {
  16772. var c = this.getDom('overlay').style,
  16773. d = this.lengthOfCellSide
  16774. ;(c.width = a * d + 'px'), (c.height = b * d + 'px')
  16775. var e = this.getDom('label')
  16776. ;(e.innerHTML =
  16777. a +
  16778. this.editor.getLang('t_col') +
  16779. ' x ' +
  16780. b +
  16781. this.editor.getLang('t_row')),
  16782. (this.numCols = a),
  16783. (this.numRows = b)
  16784. },
  16785. _onMouseOver: function (a, c) {
  16786. var d = a.relatedTarget || a.fromElement
  16787. b.contains(c, d) ||
  16788. c === d ||
  16789. ((this.getDom('label').innerHTML =
  16790. '0' +
  16791. this.editor.getLang('t_col') +
  16792. ' x 0' +
  16793. this.editor.getLang('t_row')),
  16794. (this.getDom('overlay').style.visibility = ''))
  16795. },
  16796. _onMouseOut: function (a, c) {
  16797. var d = a.relatedTarget || a.toElement
  16798. b.contains(c, d) ||
  16799. c === d ||
  16800. ((this.getDom('label').innerHTML =
  16801. '0' +
  16802. this.editor.getLang('t_col') +
  16803. ' x 0' +
  16804. this.editor.getLang('t_row')),
  16805. (this.getDom('overlay').style.visibility = 'hidden'))
  16806. },
  16807. _onMouseMove: function (a, c) {
  16808. var d = (this.getDom('overlay').style, b.getEventOffset(a)),
  16809. e = this.lengthOfCellSide,
  16810. f = Math.ceil(d.left / e),
  16811. g = Math.ceil(d.top / e)
  16812. this._track(f, g)
  16813. },
  16814. _onClick: function () {
  16815. this.fireEvent('picktable', this.numCols, this.numRows)
  16816. }
  16817. }),
  16818. a.inherits(d, c)
  16819. })(),
  16820. (function () {
  16821. var a = baidu.editor.browser,
  16822. b = baidu.editor.dom.domUtils,
  16823. c = baidu.editor.ui.uiUtils,
  16824. d =
  16825. 'onmousedown="$$.Stateful_onMouseDown(event, this);" onmouseup="$$.Stateful_onMouseUp(event, this);"' +
  16826. (a.ie
  16827. ? ' onmouseenter="$$.Stateful_onMouseEnter(event, this);" onmouseleave="$$.Stateful_onMouseLeave(event, this);"'
  16828. : ' onmouseover="$$.Stateful_onMouseOver(event, this);" onmouseout="$$.Stateful_onMouseOut(event, this);"')
  16829. baidu.editor.ui.Stateful = {
  16830. alwalysHoverable: !1,
  16831. target: null,
  16832. Stateful_init: function () {
  16833. ;(this._Stateful_dGetHtmlTpl = this.getHtmlTpl),
  16834. (this.getHtmlTpl = this.Stateful_getHtmlTpl)
  16835. },
  16836. Stateful_getHtmlTpl: function () {
  16837. var a = this._Stateful_dGetHtmlTpl()
  16838. return a.replace(/stateful/g, function () {
  16839. return d
  16840. })
  16841. },
  16842. Stateful_onMouseEnter: function (a, b) {
  16843. ;(this.target = b),
  16844. (this.isDisabled() && !this.alwalysHoverable) ||
  16845. (this.addState('hover'), this.fireEvent('over'))
  16846. },
  16847. Stateful_onMouseLeave: function (a, b) {
  16848. ;(this.isDisabled() && !this.alwalysHoverable) ||
  16849. (this.removeState('hover'),
  16850. this.removeState('active'),
  16851. this.fireEvent('out'))
  16852. },
  16853. Stateful_onMouseOver: function (a, b) {
  16854. var d = a.relatedTarget
  16855. c.contains(b, d) || b === d || this.Stateful_onMouseEnter(a, b)
  16856. },
  16857. Stateful_onMouseOut: function (a, b) {
  16858. var d = a.relatedTarget
  16859. c.contains(b, d) || b === d || this.Stateful_onMouseLeave(a, b)
  16860. },
  16861. Stateful_onMouseDown: function (a, b) {
  16862. this.isDisabled() || this.addState('active')
  16863. },
  16864. Stateful_onMouseUp: function (a, b) {
  16865. this.isDisabled() || this.removeState('active')
  16866. },
  16867. Stateful_postRender: function () {
  16868. this.disabled &&
  16869. !this.hasState('disabled') &&
  16870. this.addState('disabled')
  16871. },
  16872. hasState: function (a) {
  16873. return b.hasClass(this.getStateDom(), 'edui-state-' + a)
  16874. },
  16875. addState: function (a) {
  16876. this.hasState(a) ||
  16877. (this.getStateDom().className += ' edui-state-' + a)
  16878. },
  16879. removeState: function (a) {
  16880. this.hasState(a) &&
  16881. b.removeClasses(this.getStateDom(), ['edui-state-' + a])
  16882. },
  16883. getStateDom: function () {
  16884. return this.getDom('state')
  16885. },
  16886. isChecked: function () {
  16887. return this.hasState('checked')
  16888. },
  16889. setChecked: function (a) {
  16890. !this.isDisabled() && a
  16891. ? this.addState('checked')
  16892. : this.removeState('checked')
  16893. },
  16894. isDisabled: function () {
  16895. return this.hasState('disabled')
  16896. },
  16897. setDisabled: function (a) {
  16898. a
  16899. ? (this.removeState('hover'),
  16900. this.removeState('checked'),
  16901. this.removeState('active'),
  16902. this.addState('disabled'))
  16903. : this.removeState('disabled')
  16904. }
  16905. }
  16906. })(),
  16907. (function () {
  16908. var a = baidu.editor.utils,
  16909. b = baidu.editor.ui.UIBase,
  16910. c = baidu.editor.ui.Stateful,
  16911. d = (baidu.editor.ui.Button = function (a) {
  16912. if (a.name) {
  16913. var b = a.name,
  16914. c = a.cssRules
  16915. a.className || (a.className = 'edui-for-' + b),
  16916. (a.cssRules =
  16917. '.edui-default .edui-for-' + b + ' .edui-icon {' + c + '}')
  16918. }
  16919. this.initOptions(a), this.initButton()
  16920. })
  16921. ;(d.prototype = {
  16922. uiName: 'button',
  16923. label: '',
  16924. title: '',
  16925. showIcon: !0,
  16926. showText: !0,
  16927. cssRules: '',
  16928. initButton: function () {
  16929. this.initUIBase(),
  16930. this.Stateful_init(),
  16931. this.cssRules &&
  16932. a.cssRule('edui-customize-' + this.name + '-style', this.cssRules)
  16933. },
  16934. getHtmlTpl: function () {
  16935. return (
  16936. '<div id="##" class="edui-box %%"><div id="##_state" stateful><div class="%%-wrap"><div id="##_body" unselectable="on" ' +
  16937. (this.title ? 'title="' + this.title + '"' : '') +
  16938. ' class="%%-body" onmousedown="return $$._onMouseDown(event, this);" onclick="return $$._onClick(event, this);">' +
  16939. (this.showIcon ? '<div class="edui-box edui-icon"></div>' : '') +
  16940. (this.showText
  16941. ? '<div class="edui-box edui-label">' + this.label + '</div>'
  16942. : '') +
  16943. '</div></div></div></div>'
  16944. )
  16945. },
  16946. postRender: function () {
  16947. this.Stateful_postRender(), this.setDisabled(this.disabled)
  16948. },
  16949. _onMouseDown: function (a) {
  16950. var b = a.target || a.srcElement,
  16951. c = b && b.tagName && b.tagName.toLowerCase()
  16952. if ('input' == c || 'object' == c || 'object' == c) return !1
  16953. },
  16954. _onClick: function () {
  16955. this.isDisabled() || this.fireEvent('click')
  16956. },
  16957. setTitle: function (a) {
  16958. var b = this.getDom('label')
  16959. b.innerHTML = a
  16960. }
  16961. }),
  16962. a.inherits(d, b),
  16963. a.extend(d.prototype, c)
  16964. })(),
  16965. (function () {
  16966. var a = baidu.editor.utils,
  16967. b = baidu.editor.ui.uiUtils,
  16968. c = (baidu.editor.dom.domUtils, baidu.editor.ui.UIBase),
  16969. d = baidu.editor.ui.Stateful,
  16970. e = (baidu.editor.ui.SplitButton = function (a) {
  16971. this.initOptions(a), this.initSplitButton()
  16972. })
  16973. ;(e.prototype = {
  16974. popup: null,
  16975. uiName: 'splitbutton',
  16976. title: '',
  16977. initSplitButton: function () {
  16978. this.initUIBase(), this.Stateful_init()
  16979. if (null != this.popup) {
  16980. var a = this.popup
  16981. ;(this.popup = null), this.setPopup(a)
  16982. }
  16983. },
  16984. _UIBase_postRender: c.prototype.postRender,
  16985. postRender: function () {
  16986. this.Stateful_postRender(), this._UIBase_postRender()
  16987. },
  16988. setPopup: function (c) {
  16989. this.popup !== c &&
  16990. (null != this.popup && this.popup.dispose(),
  16991. c.addListener('show', a.bind(this._onPopupShow, this)),
  16992. c.addListener('hide', a.bind(this._onPopupHide, this)),
  16993. c.addListener(
  16994. 'postrender',
  16995. a.bind(function () {
  16996. c
  16997. .getDom('body')
  16998. .appendChild(
  16999. b.createElementByHtml(
  17000. '<div id="' +
  17001. this.popup.id +
  17002. '_bordereraser" class="edui-bordereraser edui-background" style="width:' +
  17003. (b.getClientRect(this.getDom()).width + 20) +
  17004. 'px"></div>'
  17005. )
  17006. ),
  17007. (c.getDom().className += ' ' + this.className)
  17008. }, this)
  17009. ),
  17010. (this.popup = c))
  17011. },
  17012. _onPopupShow: function () {
  17013. this.addState('opened')
  17014. },
  17015. _onPopupHide: function () {
  17016. this.removeState('opened')
  17017. },
  17018. getHtmlTpl: function () {
  17019. return (
  17020. '<div id="##" class="edui-box %%"><div ' +
  17021. (this.title ? 'title="' + this.title + '"' : '') +
  17022. ' id="##_state" stateful><div class="%%-body"><div id="##_button_body" class="edui-box edui-button-body" onclick="$$._onButtonClick(event, this);"><div class="edui-box edui-icon"></div></div><div class="edui-box edui-splitborder"></div><div class="edui-box edui-arrow" onclick="$$._onArrowClick();"></div></div></div></div>'
  17023. )
  17024. },
  17025. showPopup: function () {
  17026. var a = b.getClientRect(this.getDom())
  17027. ;(a.top -= this.popup.SHADOW_RADIUS),
  17028. (a.height += this.popup.SHADOW_RADIUS),
  17029. this.popup.showAnchorRect(a)
  17030. },
  17031. _onArrowClick: function (a, b) {
  17032. this.isDisabled() || this.showPopup()
  17033. },
  17034. _onButtonClick: function () {
  17035. this.isDisabled() || this.fireEvent('buttonclick')
  17036. }
  17037. }),
  17038. a.inherits(e, c),
  17039. a.extend(e.prototype, d, !0)
  17040. })(),
  17041. (function () {
  17042. var a = baidu.editor.utils,
  17043. b = baidu.editor.ui.uiUtils,
  17044. c = baidu.editor.ui.ColorPicker,
  17045. d = baidu.editor.ui.Popup,
  17046. e = baidu.editor.ui.SplitButton,
  17047. f = (baidu.editor.ui.ColorButton = function (a) {
  17048. this.initOptions(a), this.initColorButton()
  17049. })
  17050. ;(f.prototype = {
  17051. initColorButton: function () {
  17052. var a = this
  17053. ;(this.popup = new d({
  17054. content: new c({
  17055. noColorText: a.editor.getLang('clearColor'),
  17056. editor: a.editor,
  17057. onpickcolor: function (b, c) {
  17058. a._onPickColor(c)
  17059. },
  17060. onpicknocolor: function (b, c) {
  17061. a._onPickNoColor(c)
  17062. }
  17063. }),
  17064. editor: a.editor
  17065. })),
  17066. this.initSplitButton()
  17067. },
  17068. _SplitButton_postRender: e.prototype.postRender,
  17069. postRender: function () {
  17070. this._SplitButton_postRender(),
  17071. this.getDom('button_body').appendChild(
  17072. b.createElementByHtml(
  17073. '<div id="' +
  17074. this.id +
  17075. '_colorlump" class="edui-colorlump"></div>'
  17076. )
  17077. ),
  17078. (this.getDom().className += ' edui-colorbutton')
  17079. },
  17080. setColor: function (a) {
  17081. ;(this.getDom('colorlump').style.backgroundColor = a),
  17082. (this.color = a)
  17083. },
  17084. _onPickColor: function (a) {
  17085. this.fireEvent('pickcolor', a) !== !1 &&
  17086. (this.setColor(a), this.popup.hide())
  17087. },
  17088. _onPickNoColor: function (a) {
  17089. this.fireEvent('picknocolor') !== !1 && this.popup.hide()
  17090. }
  17091. }),
  17092. a.inherits(f, e)
  17093. })(),
  17094. (function () {
  17095. var a = baidu.editor.utils,
  17096. b = baidu.editor.ui.Popup,
  17097. c = baidu.editor.ui.TablePicker,
  17098. d = baidu.editor.ui.SplitButton,
  17099. e = (baidu.editor.ui.TableButton = function (a) {
  17100. this.initOptions(a), this.initTableButton()
  17101. })
  17102. ;(e.prototype = {
  17103. initTableButton: function () {
  17104. var a = this
  17105. ;(this.popup = new b({
  17106. content: new c({
  17107. editor: a.editor,
  17108. onpicktable: function (b, c, d) {
  17109. a._onPickTable(c, d)
  17110. }
  17111. }),
  17112. editor: a.editor
  17113. })),
  17114. this.initSplitButton()
  17115. },
  17116. _onPickTable: function (a, b) {
  17117. this.fireEvent('picktable', a, b) !== !1 && this.popup.hide()
  17118. }
  17119. }),
  17120. a.inherits(e, d)
  17121. })(),
  17122. (function () {
  17123. var a = baidu.editor.utils,
  17124. b = baidu.editor.ui.UIBase,
  17125. c = (baidu.editor.ui.AutoTypeSetPicker = function (a) {
  17126. this.initOptions(a), this.initAutoTypeSetPicker()
  17127. })
  17128. ;(c.prototype = {
  17129. initAutoTypeSetPicker: function () {
  17130. this.initUIBase()
  17131. },
  17132. getHtmlTpl: function () {
  17133. var a = this.editor,
  17134. b = a.options.autotypeset,
  17135. c = a.getLang('autoTypeSet'),
  17136. d = 'textAlignValue' + a.uid,
  17137. e = 'imageBlockLineValue' + a.uid,
  17138. f = 'symbolConverValue' + a.uid
  17139. return (
  17140. '<div id="##" class="edui-autotypesetpicker %%"><div class="edui-autotypesetpicker-body"><table ><tr><td nowrap><input type="checkbox" name="mergeEmptyline" ' +
  17141. (b.mergeEmptyline ? 'checked' : '') +
  17142. '>' +
  17143. c.mergeLine +
  17144. '</td><td colspan="2"><input type="checkbox" name="removeEmptyline" ' +
  17145. (b.removeEmptyline ? 'checked' : '') +
  17146. '>' +
  17147. c.delLine +
  17148. '</td></tr><tr><td nowrap><input type="checkbox" name="removeClass" ' +
  17149. (b.removeClass ? 'checked' : '') +
  17150. '>' +
  17151. c.removeFormat +
  17152. '</td><td colspan="2"><input type="checkbox" name="indent" ' +
  17153. (b.indent ? 'checked' : '') +
  17154. '>' +
  17155. c.indent +
  17156. '</td></tr><tr><td nowrap><input type="checkbox" name="textAlign" ' +
  17157. (b.textAlign ? 'checked' : '') +
  17158. '>' +
  17159. c.alignment +
  17160. '</td><td colspan="2" id="' +
  17161. d +
  17162. '"><input type="radio" name="' +
  17163. d +
  17164. '" value="left" ' +
  17165. (b.textAlign && 'left' == b.textAlign ? 'checked' : '') +
  17166. '>' +
  17167. a.getLang('justifyleft') +
  17168. '<input type="radio" name="' +
  17169. d +
  17170. '" value="center" ' +
  17171. (b.textAlign && 'center' == b.textAlign ? 'checked' : '') +
  17172. '>' +
  17173. a.getLang('justifycenter') +
  17174. '<input type="radio" name="' +
  17175. d +
  17176. '" value="right" ' +
  17177. (b.textAlign && 'right' == b.textAlign ? 'checked' : '') +
  17178. '>' +
  17179. a.getLang('justifyright') +
  17180. '</td></tr><tr><td nowrap><input type="checkbox" name="imageBlockLine" ' +
  17181. (b.imageBlockLine ? 'checked' : '') +
  17182. '>' +
  17183. c.imageFloat +
  17184. '</td><td nowrap id="' +
  17185. e +
  17186. '"><input type="radio" name="' +
  17187. e +
  17188. '" value="none" ' +
  17189. (b.imageBlockLine && 'none' == b.imageBlockLine ? 'checked' : '') +
  17190. '>' +
  17191. a.getLang('default') +
  17192. '<input type="radio" name="' +
  17193. e +
  17194. '" value="left" ' +
  17195. (b.imageBlockLine && 'left' == b.imageBlockLine ? 'checked' : '') +
  17196. '>' +
  17197. a.getLang('justifyleft') +
  17198. '<input type="radio" name="' +
  17199. e +
  17200. '" value="center" ' +
  17201. (b.imageBlockLine && 'center' == b.imageBlockLine
  17202. ? 'checked'
  17203. : '') +
  17204. '>' +
  17205. a.getLang('justifycenter') +
  17206. '<input type="radio" name="' +
  17207. e +
  17208. '" value="right" ' +
  17209. (b.imageBlockLine && 'right' == b.imageBlockLine ? 'checked' : '') +
  17210. '>' +
  17211. a.getLang('justifyright') +
  17212. '</td></tr><tr><td nowrap><input type="checkbox" name="clearFontSize" ' +
  17213. (b.clearFontSize ? 'checked' : '') +
  17214. '>' +
  17215. c.removeFontsize +
  17216. '</td><td colspan="2"><input type="checkbox" name="clearFontFamily" ' +
  17217. (b.clearFontFamily ? 'checked' : '') +
  17218. '>' +
  17219. c.removeFontFamily +
  17220. '</td></tr><tr><td nowrap colspan="3"><input type="checkbox" name="removeEmptyNode" ' +
  17221. (b.removeEmptyNode ? 'checked' : '') +
  17222. '>' +
  17223. c.removeHtml +
  17224. '</td></tr><tr><td nowrap colspan="3"><input type="checkbox" name="pasteFilter" ' +
  17225. (b.pasteFilter ? 'checked' : '') +
  17226. '>' +
  17227. c.pasteFilter +
  17228. '</td></tr><tr><td nowrap><input type="checkbox" name="symbolConver" ' +
  17229. (b.bdc2sb || b.tobdc ? 'checked' : '') +
  17230. '>' +
  17231. c.symbol +
  17232. '</td><td id="' +
  17233. f +
  17234. '"><input type="radio" name="bdc" value="bdc2sb" ' +
  17235. (b.bdc2sb ? 'checked' : '') +
  17236. '>' +
  17237. c.bdc2sb +
  17238. '<input type="radio" name="bdc" value="tobdc" ' +
  17239. (b.tobdc ? 'checked' : '') +
  17240. '>' +
  17241. c.tobdc +
  17242. '</td><td nowrap align="right"><button >' +
  17243. c.run +
  17244. '</button></td></tr></table></div></div>'
  17245. )
  17246. },
  17247. _UIBase_render: b.prototype.render
  17248. }),
  17249. a.inherits(c, b)
  17250. })(),
  17251. (function () {
  17252. function a(a) {
  17253. for (
  17254. var c,
  17255. d = {},
  17256. e = a.getDom(),
  17257. f = a.editor.uid,
  17258. g = null,
  17259. h = null,
  17260. i = domUtils.getElementsByTagName(e, 'input'),
  17261. j = i.length - 1;
  17262. (c = i[j--]);
  17263. )
  17264. if (((g = c.getAttribute('type')), 'checkbox' == g))
  17265. if (
  17266. ((h = c.getAttribute('name')), d[h] && delete d[h], c.checked)
  17267. ) {
  17268. var k = document.getElementById(h + 'Value' + f)
  17269. if (k) {
  17270. if (/input/gi.test(k.tagName)) d[h] = k.value
  17271. else
  17272. for (
  17273. var l,
  17274. m = k.getElementsByTagName('input'),
  17275. n = m.length - 1;
  17276. (l = m[n--]);
  17277. )
  17278. if (l.checked) {
  17279. d[h] = l.value
  17280. break
  17281. }
  17282. } else d[h] = !0
  17283. } else d[h] = !1
  17284. else d[c.getAttribute('value')] = c.checked
  17285. for (
  17286. var o, p = domUtils.getElementsByTagName(e, 'select'), j = 0;
  17287. (o = p[j++]);
  17288. ) {
  17289. var q = o.getAttribute('name')
  17290. d[q] = d[q] ? o.value : ''
  17291. }
  17292. b.extend(a.editor.options.autotypeset, d),
  17293. a.editor.setPreferences('autotypeset', d)
  17294. }
  17295. var b = baidu.editor.utils,
  17296. c = baidu.editor.ui.Popup,
  17297. d = baidu.editor.ui.AutoTypeSetPicker,
  17298. e = baidu.editor.ui.SplitButton,
  17299. f = (baidu.editor.ui.AutoTypeSetButton = function (a) {
  17300. this.initOptions(a), this.initAutoTypeSetButton()
  17301. })
  17302. ;(f.prototype = {
  17303. initAutoTypeSetButton: function () {
  17304. var b = this
  17305. this.popup = new c({
  17306. content: new d({ editor: b.editor }),
  17307. editor: b.editor,
  17308. hide: function () {
  17309. !this._hidden &&
  17310. this.getDom() &&
  17311. (a(this),
  17312. (this.getDom().style.display = 'none'),
  17313. (this._hidden = !0),
  17314. this.fireEvent('hide'))
  17315. }
  17316. })
  17317. var e = 0
  17318. this.popup.addListener('postRenderAfter', function () {
  17319. var c = this
  17320. if (!e) {
  17321. var d = this.getDom(),
  17322. f = d.getElementsByTagName('button')[0]
  17323. ;(f.onclick = function () {
  17324. a(c), b.editor.execCommand('autotypeset'), c.hide()
  17325. }),
  17326. domUtils.on(d, 'click', function (d) {
  17327. var e = d.target || d.srcElement,
  17328. f = b.editor.uid
  17329. if (e && 'INPUT' == e.tagName) {
  17330. if (
  17331. 'imageBlockLine' == e.name ||
  17332. 'textAlign' == e.name ||
  17333. 'symbolConver' == e.name
  17334. )
  17335. for (
  17336. var g = e.checked,
  17337. h = document.getElementById(e.name + 'Value' + f),
  17338. i = h.getElementsByTagName('input'),
  17339. j = {
  17340. imageBlockLine: 'none',
  17341. textAlign: 'left',
  17342. symbolConver: 'tobdc'
  17343. },
  17344. k = 0;
  17345. k < i.length;
  17346. k++
  17347. )
  17348. g
  17349. ? i[k].value == j[e.name] &&
  17350. (i[k].checked = 'checked')
  17351. : (i[k].checked = !1)
  17352. if (
  17353. e.name == 'imageBlockLineValue' + f ||
  17354. e.name == 'textAlignValue' + f ||
  17355. 'bdc' == e.name
  17356. ) {
  17357. var l =
  17358. e.parentNode.previousSibling.getElementsByTagName(
  17359. 'input'
  17360. )
  17361. l && (l[0].checked = !0)
  17362. }
  17363. a(c)
  17364. }
  17365. }),
  17366. (e = 1)
  17367. }
  17368. }),
  17369. this.initSplitButton()
  17370. }
  17371. }),
  17372. b.inherits(f, e)
  17373. })(),
  17374. (function () {
  17375. var a = baidu.editor.utils,
  17376. b = baidu.editor.ui.Popup,
  17377. c = baidu.editor.ui.Stateful,
  17378. d = baidu.editor.ui.UIBase,
  17379. e = (baidu.editor.ui.CellAlignPicker = function (a) {
  17380. this.initOptions(a), this.initSelected(), this.initCellAlignPicker()
  17381. })
  17382. ;(e.prototype = {
  17383. initSelected: function () {
  17384. var a = {
  17385. valign: { top: 0, middle: 1, bottom: 2 },
  17386. align: { left: 0, center: 1, right: 2 },
  17387. count: 3
  17388. }
  17389. this.selected &&
  17390. (this.selectedIndex =
  17391. a.valign[this.selected.valign] * a.count +
  17392. a.align[this.selected.align])
  17393. },
  17394. initCellAlignPicker: function () {
  17395. this.initUIBase(), this.Stateful_init()
  17396. },
  17397. getHtmlTpl: function () {
  17398. for (
  17399. var a = ['left', 'center', 'right'],
  17400. b = 9,
  17401. c = null,
  17402. d = -1,
  17403. e = [],
  17404. f = 0;
  17405. f < b;
  17406. f++
  17407. )
  17408. (c =
  17409. this.selectedIndex === f
  17410. ? ' class="edui-cellalign-selected" '
  17411. : ''),
  17412. (d = f % 3),
  17413. 0 === d && e.push('<tr>'),
  17414. e.push(
  17415. '<td index="' +
  17416. f +
  17417. '" ' +
  17418. c +
  17419. ' stateful><div class="edui-icon edui-' +
  17420. a[d] +
  17421. '"></div></td>'
  17422. ),
  17423. 2 === d && e.push('</tr>')
  17424. return (
  17425. '<div id="##" class="edui-cellalignpicker %%"><div class="edui-cellalignpicker-body"><table onclick="$$._onClick(event);">' +
  17426. e.join('') +
  17427. '</table></div></div>'
  17428. )
  17429. },
  17430. getStateDom: function () {
  17431. return this.target
  17432. },
  17433. _onClick: function (a) {
  17434. var c = a.target || a.srcElement
  17435. ;/icon/.test(c.className) &&
  17436. (this.items[c.parentNode.getAttribute('index')].onclick(),
  17437. b.postHide(a))
  17438. },
  17439. _UIBase_render: d.prototype.render
  17440. }),
  17441. a.inherits(e, d),
  17442. a.extend(e.prototype, c, !0)
  17443. })(),
  17444. (function () {
  17445. var a = baidu.editor.utils,
  17446. b = baidu.editor.ui.Stateful,
  17447. c = baidu.editor.ui.uiUtils,
  17448. d = baidu.editor.ui.UIBase,
  17449. e = (baidu.editor.ui.PastePicker = function (a) {
  17450. this.initOptions(a), this.initPastePicker()
  17451. })
  17452. ;(e.prototype = {
  17453. initPastePicker: function () {
  17454. this.initUIBase(), this.Stateful_init()
  17455. },
  17456. getHtmlTpl: function () {
  17457. return (
  17458. '<div class="edui-pasteicon" onclick="$$._onClick(this)"></div><div class="edui-pastecontainer"><div class="edui-title">' +
  17459. this.editor.getLang('pasteOpt') +
  17460. '</div><div class="edui-button"><div title="' +
  17461. this.editor.getLang('pasteSourceFormat') +
  17462. '" onclick="$$.format(false)" stateful><div class="edui-richtxticon"></div></div><div title="' +
  17463. this.editor.getLang('tagFormat') +
  17464. '" onclick="$$.format(2)" stateful><div class="edui-tagicon"></div></div><div title="' +
  17465. this.editor.getLang('pasteTextFormat') +
  17466. '" onclick="$$.format(true)" stateful><div class="edui-plaintxticon"></div></div></div></div></div>'
  17467. )
  17468. },
  17469. getStateDom: function () {
  17470. return this.target
  17471. },
  17472. format: function (a) {
  17473. ;(this.editor.ui._isTransfer = !0),
  17474. this.editor.fireEvent('pasteTransfer', a)
  17475. },
  17476. _onClick: function (a) {
  17477. var b = domUtils.getNextDomNode(a),
  17478. d = c.getViewportRect().height,
  17479. e = c.getClientRect(b)
  17480. e.top + e.height > d
  17481. ? (b.style.top = -e.height - a.offsetHeight + 'px')
  17482. : (b.style.top = ''),
  17483. /hidden/gi.test(domUtils.getComputedStyle(b, 'visibility'))
  17484. ? ((b.style.visibility = 'visible'),
  17485. domUtils.addClass(a, 'edui-state-opened'))
  17486. : ((b.style.visibility = 'hidden'),
  17487. domUtils.removeClasses(a, 'edui-state-opened'))
  17488. },
  17489. _UIBase_render: d.prototype.render
  17490. }),
  17491. a.inherits(e, d),
  17492. a.extend(e.prototype, b, !0)
  17493. })(),
  17494. (function () {
  17495. var a = baidu.editor.utils,
  17496. b = baidu.editor.ui.uiUtils,
  17497. c = baidu.editor.ui.UIBase,
  17498. d = (baidu.editor.ui.Toolbar = function (a) {
  17499. this.initOptions(a), this.initToolbar()
  17500. })
  17501. ;(d.prototype = {
  17502. items: null,
  17503. initToolbar: function () {
  17504. ;(this.items = this.items || []), this.initUIBase()
  17505. },
  17506. add: function (a, b) {
  17507. void 0 === b ? this.items.push(a) : this.items.splice(b, 0, a)
  17508. },
  17509. getHtmlTpl: function () {
  17510. for (var a = [], b = 0; b < this.items.length; b++)
  17511. a[b] = this.items[b].renderHtml()
  17512. return (
  17513. '<div id="##" class="edui-toolbar %%" onselectstart="return false;" onmousedown="return $$._onMouseDown(event, this);">' +
  17514. a.join('') +
  17515. '</div>'
  17516. )
  17517. },
  17518. postRender: function () {
  17519. for (var a = this.getDom(), c = 0; c < this.items.length; c++)
  17520. this.items[c].postRender()
  17521. b.makeUnselectable(a)
  17522. },
  17523. _onMouseDown: function (a) {
  17524. var b = a.target || a.srcElement,
  17525. c = b && b.tagName && b.tagName.toLowerCase()
  17526. if ('input' == c || 'object' == c || 'object' == c) return !1
  17527. }
  17528. }),
  17529. a.inherits(d, c)
  17530. })(),
  17531. (function () {
  17532. var a = baidu.editor.utils,
  17533. b = baidu.editor.dom.domUtils,
  17534. c = baidu.editor.ui.uiUtils,
  17535. d = baidu.editor.ui.UIBase,
  17536. e = baidu.editor.ui.Popup,
  17537. f = baidu.editor.ui.Stateful,
  17538. g = baidu.editor.ui.CellAlignPicker,
  17539. h = (baidu.editor.ui.Menu = function (a) {
  17540. this.initOptions(a), this.initMenu()
  17541. }),
  17542. i = {
  17543. renderHtml: function () {
  17544. return '<div class="edui-menuitem edui-menuseparator"><div class="edui-menuseparator-inner"></div></div>'
  17545. },
  17546. postRender: function () {},
  17547. queryAutoHide: function () {
  17548. return !0
  17549. }
  17550. }
  17551. ;(h.prototype = {
  17552. items: null,
  17553. uiName: 'menu',
  17554. initMenu: function () {
  17555. ;(this.items = this.items || []), this.initPopup(), this.initItems()
  17556. },
  17557. initItems: function () {
  17558. for (var a = 0; a < this.items.length; a++) {
  17559. var b = this.items[a]
  17560. '-' == b
  17561. ? (this.items[a] = this.getSeparator())
  17562. : b instanceof j ||
  17563. ((b.editor = this.editor),
  17564. (b.theme = this.editor.options.theme),
  17565. (this.items[a] = this.createItem(b)))
  17566. }
  17567. },
  17568. getSeparator: function () {
  17569. return i
  17570. },
  17571. createItem: function (a) {
  17572. return (a.menu = this), new j(a)
  17573. },
  17574. _Popup_getContentHtmlTpl: e.prototype.getContentHtmlTpl,
  17575. getContentHtmlTpl: function () {
  17576. if (0 == this.items.length) return this._Popup_getContentHtmlTpl()
  17577. for (var a = [], b = 0; b < this.items.length; b++) {
  17578. var c = this.items[b]
  17579. a[b] = c.renderHtml()
  17580. }
  17581. return '<div class="%%-body">' + a.join('') + '</div>'
  17582. },
  17583. _Popup_postRender: e.prototype.postRender,
  17584. postRender: function () {
  17585. for (var a = this, d = 0; d < this.items.length; d++) {
  17586. var e = this.items[d]
  17587. ;(e.ownerMenu = this), e.postRender()
  17588. }
  17589. b.on(this.getDom(), 'mouseover', function (b) {
  17590. b = b || event
  17591. var d = b.relatedTarget || b.fromElement,
  17592. e = a.getDom()
  17593. c.contains(e, d) || e === d || a.fireEvent('over')
  17594. }),
  17595. this._Popup_postRender()
  17596. },
  17597. queryAutoHide: function (a) {
  17598. if (a) {
  17599. if (c.contains(this.getDom(), a)) return !1
  17600. for (var b = 0; b < this.items.length; b++) {
  17601. var d = this.items[b]
  17602. if (d.queryAutoHide(a) === !1) return !1
  17603. }
  17604. }
  17605. },
  17606. clearItems: function () {
  17607. for (var a = 0; a < this.items.length; a++) {
  17608. var b = this.items[a]
  17609. clearTimeout(b._showingTimer),
  17610. clearTimeout(b._closingTimer),
  17611. b.subMenu && b.subMenu.destroy()
  17612. }
  17613. this.items = []
  17614. },
  17615. destroy: function () {
  17616. this.getDom() && b.remove(this.getDom()), this.clearItems()
  17617. },
  17618. dispose: function () {
  17619. this.destroy()
  17620. }
  17621. }),
  17622. a.inherits(h, e)
  17623. var j = (baidu.editor.ui.MenuItem = function (a) {
  17624. if (
  17625. (this.initOptions(a),
  17626. this.initUIBase(),
  17627. this.Stateful_init(),
  17628. this.subMenu && !(this.subMenu instanceof h))
  17629. )
  17630. if (a.className && a.className.indexOf('aligntd') != -1) {
  17631. var c = this
  17632. ;(this.subMenu.selected =
  17633. this.editor.queryCommandValue('cellalignment')),
  17634. (this.subMenu = new e({
  17635. content: new g(this.subMenu),
  17636. parentMenu: c,
  17637. editor: c.editor,
  17638. destroy: function () {
  17639. this.getDom() && b.remove(this.getDom())
  17640. }
  17641. })),
  17642. this.subMenu.addListener('postRenderAfter', function () {
  17643. b.on(this.getDom(), 'mouseover', function () {
  17644. c.addState('opened')
  17645. })
  17646. })
  17647. } else this.subMenu = new h(this.subMenu)
  17648. })
  17649. ;(j.prototype = {
  17650. label: '',
  17651. subMenu: null,
  17652. ownerMenu: null,
  17653. uiName: 'menuitem',
  17654. alwalysHoverable: !0,
  17655. getHtmlTpl: function () {
  17656. return (
  17657. '<div id="##" class="%%" stateful onclick="$$._onClick(event, this);"><div class="%%-body">' +
  17658. this.renderLabelHtml() +
  17659. '</div></div>'
  17660. )
  17661. },
  17662. postRender: function () {
  17663. var a = this
  17664. this.addListener('over', function () {
  17665. a.ownerMenu.fireEvent('submenuover', a),
  17666. a.subMenu && a.delayShowSubMenu()
  17667. }),
  17668. this.subMenu &&
  17669. ((this.getDom().className += ' edui-hassubmenu'),
  17670. this.subMenu.render(),
  17671. this.addListener('out', function () {
  17672. a.delayHideSubMenu()
  17673. }),
  17674. this.subMenu.addListener('over', function () {
  17675. clearTimeout(a._closingTimer),
  17676. (a._closingTimer = null),
  17677. a.addState('opened')
  17678. }),
  17679. this.ownerMenu.addListener('hide', function () {
  17680. a.hideSubMenu()
  17681. }),
  17682. this.ownerMenu.addListener('submenuover', function (b, c) {
  17683. c !== a && a.delayHideSubMenu()
  17684. }),
  17685. (this.subMenu._bakQueryAutoHide = this.subMenu.queryAutoHide),
  17686. (this.subMenu.queryAutoHide = function (b) {
  17687. return (
  17688. (!b || !c.contains(a.getDom(), b)) &&
  17689. this._bakQueryAutoHide(b)
  17690. )
  17691. })),
  17692. (this.getDom().style.tabIndex = '-1'),
  17693. c.makeUnselectable(this.getDom()),
  17694. this.Stateful_postRender()
  17695. },
  17696. delayShowSubMenu: function () {
  17697. var a = this
  17698. a.isDisabled() ||
  17699. (a.addState('opened'),
  17700. clearTimeout(a._showingTimer),
  17701. clearTimeout(a._closingTimer),
  17702. (a._closingTimer = null),
  17703. (a._showingTimer = setTimeout(function () {
  17704. a.showSubMenu()
  17705. }, 250)))
  17706. },
  17707. delayHideSubMenu: function () {
  17708. var a = this
  17709. a.isDisabled() ||
  17710. (a.removeState('opened'),
  17711. clearTimeout(a._showingTimer),
  17712. a._closingTimer ||
  17713. (a._closingTimer = setTimeout(function () {
  17714. a.hasState('opened') || a.hideSubMenu(),
  17715. (a._closingTimer = null)
  17716. }, 400)))
  17717. },
  17718. renderLabelHtml: function () {
  17719. return (
  17720. '<div class="edui-arrow"></div><div class="edui-box edui-icon"></div><div class="edui-box edui-label %%-label">' +
  17721. (this.label || '') +
  17722. '</div>'
  17723. )
  17724. },
  17725. getStateDom: function () {
  17726. return this.getDom()
  17727. },
  17728. queryAutoHide: function (a) {
  17729. if (this.subMenu && this.hasState('opened'))
  17730. return this.subMenu.queryAutoHide(a)
  17731. },
  17732. _onClick: function (a, b) {
  17733. this.hasState('disabled') ||
  17734. (this.fireEvent('click', a, b) !== !1 &&
  17735. (this.subMenu ? this.showSubMenu() : e.postHide(a)))
  17736. },
  17737. showSubMenu: function () {
  17738. var a = c.getClientRect(this.getDom())
  17739. ;(a.right -= 5),
  17740. (a.left += 2),
  17741. (a.width -= 7),
  17742. (a.top -= 4),
  17743. (a.bottom += 4),
  17744. (a.height += 8),
  17745. this.subMenu.showAnchorRect(a, !0, !0)
  17746. },
  17747. hideSubMenu: function () {
  17748. this.subMenu.hide()
  17749. }
  17750. }),
  17751. a.inherits(j, d),
  17752. a.extend(j.prototype, f, !0)
  17753. })(),
  17754. (function () {
  17755. var a = baidu.editor.utils,
  17756. b = baidu.editor.ui.uiUtils,
  17757. c = baidu.editor.ui.Menu,
  17758. d = baidu.editor.ui.SplitButton,
  17759. e = (baidu.editor.ui.Combox = function (a) {
  17760. this.initOptions(a), this.initCombox()
  17761. })
  17762. ;(e.prototype = {
  17763. uiName: 'combox',
  17764. onbuttonclick: function () {
  17765. this.showPopup()
  17766. },
  17767. initCombox: function () {
  17768. var a = this
  17769. this.items = this.items || []
  17770. for (var b = 0; b < this.items.length; b++) {
  17771. var d = this.items[b]
  17772. ;(d.uiName = 'listitem'),
  17773. (d.index = b),
  17774. (d.onclick = function () {
  17775. a.selectByIndex(this.index)
  17776. })
  17777. }
  17778. ;(this.popup = new c({
  17779. items: this.items,
  17780. uiName: 'list',
  17781. editor: this.editor,
  17782. captureWheel: !0,
  17783. combox: this
  17784. })),
  17785. this.initSplitButton()
  17786. },
  17787. _SplitButton_postRender: d.prototype.postRender,
  17788. postRender: function () {
  17789. this._SplitButton_postRender(),
  17790. this.setLabel(this.label || ''),
  17791. this.setValue(this.initValue || '')
  17792. },
  17793. showPopup: function () {
  17794. var a = b.getClientRect(this.getDom())
  17795. ;(a.top += 1),
  17796. (a.bottom -= 1),
  17797. (a.height -= 2),
  17798. this.popup.showAnchorRect(a)
  17799. },
  17800. getValue: function () {
  17801. return this.value
  17802. },
  17803. setValue: function (a) {
  17804. var b = this.indexByValue(a)
  17805. b != -1
  17806. ? ((this.selectedIndex = b),
  17807. this.setLabel(this.items[b].label),
  17808. (this.value = this.items[b].value))
  17809. : ((this.selectedIndex = -1),
  17810. this.setLabel(this.getLabelForUnknowValue(a)),
  17811. (this.value = a))
  17812. },
  17813. setLabel: function (a) {
  17814. ;(this.getDom('button_body').innerHTML = a), (this.label = a)
  17815. },
  17816. getLabelForUnknowValue: function (a) {
  17817. return a
  17818. },
  17819. indexByValue: function (a) {
  17820. for (var b = 0; b < this.items.length; b++)
  17821. if (a == this.items[b].value) return b
  17822. return -1
  17823. },
  17824. getItem: function (a) {
  17825. return this.items[a]
  17826. },
  17827. selectByIndex: function (a) {
  17828. a < this.items.length &&
  17829. this.fireEvent('select', a) !== !1 &&
  17830. ((this.selectedIndex = a),
  17831. (this.value = this.items[a].value),
  17832. this.setLabel(this.items[a].label))
  17833. }
  17834. }),
  17835. a.inherits(e, d)
  17836. })(),
  17837. (function () {
  17838. var a,
  17839. b,
  17840. c,
  17841. d = baidu.editor.utils,
  17842. e = baidu.editor.dom.domUtils,
  17843. f = baidu.editor.ui.uiUtils,
  17844. g = baidu.editor.ui.Mask,
  17845. h = baidu.editor.ui.UIBase,
  17846. i = baidu.editor.ui.Button,
  17847. j = (baidu.editor.ui.Dialog = function (a) {
  17848. if (a.name) {
  17849. var b = a.name,
  17850. c = a.cssRules
  17851. a.className || (a.className = 'edui-for-' + b),
  17852. c &&
  17853. (a.cssRules =
  17854. '.edui-default .edui-for-' +
  17855. b +
  17856. ' .edui-dialog-content {' +
  17857. c +
  17858. '}')
  17859. }
  17860. this.initOptions(
  17861. d.extend(
  17862. {
  17863. autoReset: !0,
  17864. draggable: !0,
  17865. onok: function () {},
  17866. oncancel: function () {},
  17867. onclose: function (a, b) {
  17868. return b ? this.onok() : this.oncancel()
  17869. },
  17870. holdScroll: !1
  17871. },
  17872. a
  17873. )
  17874. ),
  17875. this.initDialog()
  17876. })
  17877. ;(j.prototype = {
  17878. draggable: !1,
  17879. uiName: 'dialog',
  17880. initDialog: function () {
  17881. var e = this,
  17882. f = this.editor.options.theme
  17883. if (
  17884. (this.cssRules &&
  17885. d.cssRule(
  17886. 'edui-customize-' + this.name + '-style',
  17887. this.cssRules
  17888. ),
  17889. this.initUIBase(),
  17890. (this.modalMask =
  17891. a ||
  17892. (a = new g({
  17893. className: 'edui-dialog-modalmask',
  17894. theme: f,
  17895. onclick: function () {
  17896. c && c.close(!1)
  17897. }
  17898. }))),
  17899. (this.dragMask =
  17900. b ||
  17901. (b = new g({ className: 'edui-dialog-dragmask', theme: f }))),
  17902. (this.closeButton = new i({
  17903. className: 'edui-dialog-closebutton',
  17904. title: e.closeDialog,
  17905. theme: f,
  17906. onclick: function () {
  17907. e.close(!1)
  17908. }
  17909. })),
  17910. this.fullscreen && this.initResizeEvent(),
  17911. this.buttons)
  17912. )
  17913. for (var h = 0; h < this.buttons.length; h++)
  17914. this.buttons[h] instanceof i ||
  17915. (this.buttons[h] = new i(
  17916. d.extend(this.buttons[h], { editor: this.editor }, !0)
  17917. ))
  17918. },
  17919. initResizeEvent: function () {
  17920. var a = this
  17921. e.on(window, 'resize', function () {
  17922. a._hidden ||
  17923. void 0 === a._hidden ||
  17924. (a.__resizeTimer && window.clearTimeout(a.__resizeTimer),
  17925. (a.__resizeTimer = window.setTimeout(function () {
  17926. a.__resizeTimer = null
  17927. var b = a.getDom(),
  17928. c = a.getDom('content'),
  17929. d = UE.ui.uiUtils.getClientRect(b),
  17930. e = UE.ui.uiUtils.getClientRect(c),
  17931. g = f.getViewportRect()
  17932. ;(c.style.width = g.width - d.width + e.width + 'px'),
  17933. (c.style.height = g.height - d.height + e.height + 'px'),
  17934. (b.style.width = g.width + 'px'),
  17935. (b.style.height = g.height + 'px'),
  17936. a.fireEvent('resize')
  17937. }, 100)))
  17938. })
  17939. },
  17940. fitSize: function () {
  17941. var a = this.getDom('body'),
  17942. b = this.mesureSize()
  17943. return (
  17944. (a.style.width = b.width + 'px'),
  17945. (a.style.height = b.height + 'px'),
  17946. b
  17947. )
  17948. },
  17949. safeSetOffset: function (a) {
  17950. var b = this,
  17951. c = b.getDom(),
  17952. d = f.getViewportRect(),
  17953. e = f.getClientRect(c),
  17954. g = a.left
  17955. g + e.width > d.right && (g = d.right - e.width)
  17956. var h = a.top
  17957. h + e.height > d.bottom && (h = d.bottom - e.height),
  17958. (c.style.left = Math.max(g, 0) + 'px'),
  17959. (c.style.top = Math.max(h, 0) + 'px')
  17960. },
  17961. showAtCenter: function () {
  17962. var a = f.getViewportRect()
  17963. if (this.fullscreen) {
  17964. var b = this.getDom(),
  17965. c = this.getDom('content')
  17966. b.style.display = 'block'
  17967. var d = UE.ui.uiUtils.getClientRect(b),
  17968. g = UE.ui.uiUtils.getClientRect(c)
  17969. ;(b.style.left = '-100000px'),
  17970. (c.style.width = a.width - d.width + g.width + 'px'),
  17971. (c.style.height = a.height - d.height + g.height + 'px'),
  17972. (b.style.width = a.width + 'px'),
  17973. (b.style.height = a.height + 'px'),
  17974. (b.style.left = 0),
  17975. (this._originalContext = {
  17976. html: {
  17977. overflowX: document.documentElement.style.overflowX,
  17978. overflowY: document.documentElement.style.overflowY
  17979. },
  17980. body: {
  17981. overflowX: document.body.style.overflowX,
  17982. overflowY: document.body.style.overflowY
  17983. }
  17984. }),
  17985. (document.documentElement.style.overflowX = 'hidden'),
  17986. (document.documentElement.style.overflowY = 'hidden'),
  17987. (document.body.style.overflowX = 'hidden'),
  17988. (document.body.style.overflowY = 'hidden')
  17989. } else {
  17990. this.getDom().style.display = ''
  17991. var h = this.fitSize(),
  17992. i = 0 | this.getDom('titlebar').offsetHeight,
  17993. j = a.width / 2 - h.width / 2,
  17994. k = a.height / 2 - (h.height - i) / 2 - i,
  17995. l = this.getDom()
  17996. this.safeSetOffset({
  17997. left: Math.max(0 | j, 0),
  17998. top: Math.max(0 | k, 0)
  17999. }),
  18000. e.hasClass(l, 'edui-state-centered') ||
  18001. (l.className += ' edui-state-centered')
  18002. }
  18003. this._show()
  18004. },
  18005. getContentHtml: function () {
  18006. var a = ''
  18007. return (
  18008. 'string' == typeof this.content
  18009. ? (a = this.content)
  18010. : this.iframeUrl &&
  18011. (a =
  18012. '<span id="' +
  18013. this.id +
  18014. '_contmask" class="dialogcontmask"></span><iframe id="' +
  18015. this.id +
  18016. '_iframe" class="%%-iframe" height="100%" width="100%" frameborder="0" src="' +
  18017. this.iframeUrl +
  18018. '"></iframe>'),
  18019. a
  18020. )
  18021. },
  18022. getHtmlTpl: function () {
  18023. var a = ''
  18024. if (this.buttons) {
  18025. for (var b = [], c = 0; c < this.buttons.length; c++)
  18026. b[c] = this.buttons[c].renderHtml()
  18027. a =
  18028. '<div class="%%-foot"><div id="##_buttons" class="%%-buttons">' +
  18029. b.join('') +
  18030. '</div></div>'
  18031. }
  18032. return (
  18033. '<div id="##" class="%%"><div ' +
  18034. (this.fullscreen
  18035. ? 'class="%%-wrap edui-dialog-fullscreen-flag"'
  18036. : 'class="%%"') +
  18037. '><div id="##_body" class="%%-body"><div class="%%-shadow"></div><div id="##_titlebar" class="%%-titlebar"><div class="%%-draghandle" onmousedown="$$._onTitlebarMouseDown(event, this);"><span class="%%-caption">' +
  18038. (this.title || '') +
  18039. '</span></div>' +
  18040. this.closeButton.renderHtml() +
  18041. '</div><div id="##_content" class="%%-content">' +
  18042. (this.autoReset ? '' : this.getContentHtml()) +
  18043. '</div>' +
  18044. a +
  18045. '</div></div></div>'
  18046. )
  18047. },
  18048. postRender: function () {
  18049. this.modalMask.getDom() ||
  18050. (this.modalMask.render(), this.modalMask.hide()),
  18051. this.dragMask.getDom() ||
  18052. (this.dragMask.render(), this.dragMask.hide())
  18053. var a = this
  18054. if (
  18055. (this.addListener('show', function () {
  18056. a.modalMask.show(this.getDom().style.zIndex - 2)
  18057. }),
  18058. this.addListener('hide', function () {
  18059. a.modalMask.hide()
  18060. }),
  18061. this.buttons)
  18062. )
  18063. for (var b = 0; b < this.buttons.length; b++)
  18064. this.buttons[b].postRender()
  18065. e.on(window, 'resize', function () {
  18066. setTimeout(function () {
  18067. a.isHidden() || a.safeSetOffset(f.getClientRect(a.getDom()))
  18068. })
  18069. }),
  18070. this._hide()
  18071. },
  18072. mesureSize: function () {
  18073. var a = this.getDom('body'),
  18074. b = f.getClientRect(this.getDom('content')).width,
  18075. c = a.style
  18076. return (c.width = b), f.getClientRect(a)
  18077. },
  18078. _onTitlebarMouseDown: function (a, b) {
  18079. if (this.draggable) {
  18080. var c,
  18081. d = (f.getViewportRect(), this)
  18082. f.startDrag(a, {
  18083. ondragstart: function () {
  18084. ;(c = f.getClientRect(d.getDom())),
  18085. (d.getDom('contmask').style.visibility = 'visible'),
  18086. d.dragMask.show(d.getDom().style.zIndex - 1)
  18087. },
  18088. ondragmove: function (a, b) {
  18089. var e = c.left + a,
  18090. f = c.top + b
  18091. d.safeSetOffset({ left: e, top: f })
  18092. },
  18093. ondragstop: function () {
  18094. ;(d.getDom('contmask').style.visibility = 'hidden'),
  18095. e.removeClasses(d.getDom(), ['edui-state-centered']),
  18096. d.dragMask.hide()
  18097. }
  18098. })
  18099. }
  18100. },
  18101. reset: function () {
  18102. ;(this.getDom('content').innerHTML = this.getContentHtml()),
  18103. this.fireEvent('dialogafterreset')
  18104. },
  18105. _show: function () {
  18106. this._hidden &&
  18107. ((this.getDom().style.display = ''),
  18108. this.editor.container.style.zIndex &&
  18109. (this.getDom().style.zIndex =
  18110. 1 * this.editor.container.style.zIndex + 10),
  18111. (this._hidden = !1),
  18112. this.fireEvent('show'),
  18113. (baidu.editor.ui.uiUtils.getFixedLayer().style.zIndex =
  18114. this.getDom().style.zIndex - 4))
  18115. },
  18116. isHidden: function () {
  18117. return this._hidden
  18118. },
  18119. _hide: function () {
  18120. if (!this._hidden) {
  18121. var a = this.getDom()
  18122. ;(a.style.display = 'none'),
  18123. (a.style.zIndex = ''),
  18124. (a.style.width = ''),
  18125. (a.style.height = ''),
  18126. (this._hidden = !0),
  18127. this.fireEvent('hide')
  18128. }
  18129. },
  18130. open: function () {
  18131. if (this.autoReset)
  18132. try {
  18133. this.reset()
  18134. } catch (a) {
  18135. this.render(), this.open()
  18136. }
  18137. if ((this.showAtCenter(), this.iframeUrl))
  18138. try {
  18139. this.getDom('iframe').focus()
  18140. } catch (b) {}
  18141. c = this
  18142. },
  18143. _onCloseButtonClick: function (a, b) {
  18144. this.close(!1)
  18145. },
  18146. close: function (a) {
  18147. if (this.fireEvent('close', a) !== !1) {
  18148. this.fullscreen &&
  18149. ((document.documentElement.style.overflowX =
  18150. this._originalContext.html.overflowX),
  18151. (document.documentElement.style.overflowY =
  18152. this._originalContext.html.overflowY),
  18153. (document.body.style.overflowX =
  18154. this._originalContext.body.overflowX),
  18155. (document.body.style.overflowY =
  18156. this._originalContext.body.overflowY),
  18157. delete this._originalContext),
  18158. this._hide()
  18159. var b = this.getDom('content'),
  18160. c = this.getDom('iframe')
  18161. if (b && c) {
  18162. var d = c.contentDocument || c.contentWindow.document
  18163. d && (d.body.innerHTML = ''), e.remove(b)
  18164. }
  18165. }
  18166. }
  18167. }),
  18168. d.inherits(j, h)
  18169. })(),
  18170. (function () {
  18171. var a = baidu.editor.utils,
  18172. b = baidu.editor.ui.Menu,
  18173. c = baidu.editor.ui.SplitButton,
  18174. d = (baidu.editor.ui.MenuButton = function (a) {
  18175. this.initOptions(a), this.initMenuButton()
  18176. })
  18177. ;(d.prototype = {
  18178. initMenuButton: function () {
  18179. var a = this
  18180. ;(this.uiName = 'menubutton'),
  18181. (this.popup = new b({
  18182. items: a.items,
  18183. className: a.className,
  18184. editor: a.editor
  18185. })),
  18186. this.popup.addListener('show', function () {
  18187. for (var b = this, c = 0; c < b.items.length; c++)
  18188. b.items[c].removeState('checked'),
  18189. b.items[c].value == a._value &&
  18190. (b.items[c].addState('checked'), (this.value = a._value))
  18191. }),
  18192. this.initSplitButton()
  18193. },
  18194. setValue: function (a) {
  18195. this._value = a
  18196. }
  18197. }),
  18198. a.inherits(d, c)
  18199. })(),
  18200. (function () {
  18201. var a = baidu.editor.utils,
  18202. b = baidu.editor.ui.Popup,
  18203. c = baidu.editor.ui.SplitButton,
  18204. d = (baidu.editor.ui.MultiMenuPop = function (a) {
  18205. this.initOptions(a), this.initMultiMenu()
  18206. })
  18207. ;(d.prototype = {
  18208. initMultiMenu: function () {
  18209. var a = this
  18210. ;(this.popup = new b({
  18211. content: '',
  18212. editor: a.editor,
  18213. iframe_rendered: !1,
  18214. onshow: function () {
  18215. this.iframe_rendered ||
  18216. ((this.iframe_rendered = !0),
  18217. (this.getDom('content').innerHTML =
  18218. '<iframe id="' +
  18219. a.id +
  18220. '_iframe" src="' +
  18221. a.iframeUrl +
  18222. '" frameborder="0"></iframe>'),
  18223. a.editor.container.style.zIndex &&
  18224. (this.getDom().style.zIndex =
  18225. 1 * a.editor.container.style.zIndex + 1))
  18226. }
  18227. })),
  18228. (this.onbuttonclick = function () {
  18229. this.showPopup()
  18230. }),
  18231. this.initSplitButton()
  18232. }
  18233. }),
  18234. a.inherits(d, c)
  18235. })(),
  18236. (function () {
  18237. function a(a) {
  18238. var b = a.target || a.srcElement,
  18239. c = g.findParent(
  18240. b,
  18241. function (a) {
  18242. return (
  18243. g.hasClass(a, 'edui-shortcutmenu') ||
  18244. g.hasClass(a, 'edui-popup')
  18245. )
  18246. },
  18247. !0
  18248. )
  18249. if (!c) for (var d, e = 0; (d = h[e++]); ) d.hide()
  18250. }
  18251. var b,
  18252. c = baidu.editor.ui,
  18253. d = c.UIBase,
  18254. e = c.uiUtils,
  18255. f = baidu.editor.utils,
  18256. g = baidu.editor.dom.domUtils,
  18257. h = [],
  18258. i = !1,
  18259. j = (c.ShortCutMenu = function (a) {
  18260. this.initOptions(a), this.initShortCutMenu()
  18261. })
  18262. ;(j.postHide = a),
  18263. (j.prototype = {
  18264. isHidden: !0,
  18265. SPACE: 5,
  18266. initShortCutMenu: function () {
  18267. ;(this.items = this.items || []),
  18268. this.initUIBase(),
  18269. this.initItems(),
  18270. this.initEvent(),
  18271. h.push(this)
  18272. },
  18273. initEvent: function () {
  18274. var a = this,
  18275. c = a.editor.document
  18276. g.on(c, 'mousemove', function (c) {
  18277. if (a.isHidden === !1) {
  18278. if (a.getSubMenuMark() || 'contextmenu' == a.eventType) return
  18279. var d = !0,
  18280. e = a.getDom(),
  18281. f = e.offsetWidth,
  18282. g = e.offsetHeight,
  18283. h = f / 2 + a.SPACE,
  18284. i = g / 2,
  18285. j = Math.abs(c.screenX - a.left),
  18286. k = Math.abs(c.screenY - a.top)
  18287. clearTimeout(b),
  18288. (b = setTimeout(function () {
  18289. k > 0 && k < i
  18290. ? a.setOpacity(e, '1')
  18291. : k > i && k < i + 70
  18292. ? (a.setOpacity(e, '0.5'), (d = !1))
  18293. : k > i + 70 && k < i + 140 && a.hide(),
  18294. d && j > 0 && j < h
  18295. ? a.setOpacity(e, '1')
  18296. : j > h && j < h + 70
  18297. ? a.setOpacity(e, '0.5')
  18298. : j > h + 70 && j < h + 140 && a.hide()
  18299. }))
  18300. }
  18301. }),
  18302. browser.chrome &&
  18303. g.on(c, 'mouseout', function (b) {
  18304. var c = b.relatedTarget || b.toElement
  18305. ;(null != c && 'HTML' != c.tagName) || a.hide()
  18306. }),
  18307. a.editor.addListener('afterhidepop', function () {
  18308. a.isHidden || (i = !0)
  18309. })
  18310. },
  18311. initItems: function () {
  18312. if (f.isArray(this.items))
  18313. for (var a = 0, b = this.items.length; a < b; a++) {
  18314. var d = this.items[a].toLowerCase()
  18315. c[d] &&
  18316. ((this.items[a] = new c[d](this.editor)),
  18317. (this.items[a].className += ' edui-shortcutsubmenu '))
  18318. }
  18319. },
  18320. setOpacity: function (a, b) {
  18321. browser.ie && browser.version < 9
  18322. ? (a.style.filter =
  18323. 'alpha(opacity = ' + 100 * parseFloat(b) + ');')
  18324. : (a.style.opacity = b)
  18325. },
  18326. getSubMenuMark: function () {
  18327. i = !1
  18328. for (
  18329. var a,
  18330. b = e.getFixedLayer(),
  18331. c = g.getElementsByTagName(b, 'div', function (a) {
  18332. return g.hasClass(a, 'edui-shortcutsubmenu edui-popup')
  18333. }),
  18334. d = 0;
  18335. (a = c[d++]);
  18336. )
  18337. 'none' != a.style.display && (i = !0)
  18338. return i
  18339. },
  18340. show: function (a, b) {
  18341. function c(a) {
  18342. a.left < 0 && (a.left = 0),
  18343. a.top < 0 && (a.top = 0),
  18344. (i.style.cssText =
  18345. 'position:absolute;left:' +
  18346. a.left +
  18347. 'px;top:' +
  18348. a.top +
  18349. 'px;')
  18350. }
  18351. function d(a) {
  18352. a.tagName || (a = a.getDom()),
  18353. (h.left = parseInt(a.style.left)),
  18354. (h.top = parseInt(a.style.top)),
  18355. (h.top -= i.offsetHeight + 15),
  18356. c(h)
  18357. }
  18358. var f = this,
  18359. h = {},
  18360. i = this.getDom(),
  18361. j = e.getFixedLayer()
  18362. if (
  18363. ((f.eventType = a.type),
  18364. (i.style.cssText = 'display:block;left:-9999px'),
  18365. 'contextmenu' == a.type && b)
  18366. ) {
  18367. var k = g.getElementsByTagName(j, 'div', 'edui-contextmenu')[0]
  18368. k
  18369. ? d(k)
  18370. : f.editor.addListener('aftershowcontextmenu', function (a, b) {
  18371. d(b)
  18372. })
  18373. } else
  18374. (h = e.getViewportOffsetByEvent(a)),
  18375. (h.top -= i.offsetHeight + f.SPACE),
  18376. (h.left += f.SPACE + 20),
  18377. c(h),
  18378. f.setOpacity(i, 0.2)
  18379. ;(f.isHidden = !1),
  18380. (f.left = a.screenX + i.offsetWidth / 2 - f.SPACE),
  18381. (f.top = a.screenY - i.offsetHeight / 2 - f.SPACE),
  18382. f.editor &&
  18383. ((i.style.zIndex = 1 * f.editor.container.style.zIndex + 10),
  18384. (j.style.zIndex = i.style.zIndex - 1))
  18385. },
  18386. hide: function () {
  18387. this.getDom() && (this.getDom().style.display = 'none'),
  18388. (this.isHidden = !0)
  18389. },
  18390. postRender: function () {
  18391. if (f.isArray(this.items))
  18392. for (var a, b = 0; (a = this.items[b++]); ) a.postRender()
  18393. },
  18394. getHtmlTpl: function () {
  18395. var a
  18396. if (f.isArray(this.items)) {
  18397. a = []
  18398. for (var b = 0; b < this.items.length; b++)
  18399. a[b] = this.items[b].renderHtml()
  18400. a = a.join('')
  18401. } else a = this.items
  18402. return (
  18403. '<div id="##" class="%% edui-toolbar" data-src="shortcutmenu" onmousedown="return false;" onselectstart="return false;" >' +
  18404. a +
  18405. '</div>'
  18406. )
  18407. }
  18408. }),
  18409. f.inherits(j, d),
  18410. g.on(document, 'mousedown', function (b) {
  18411. a(b)
  18412. }),
  18413. g.on(window, 'scroll', function (b) {
  18414. a(b)
  18415. })
  18416. })(),
  18417. (function () {
  18418. var a = baidu.editor.utils,
  18419. b = baidu.editor.ui.UIBase,
  18420. c = (baidu.editor.ui.Breakline = function (a) {
  18421. this.initOptions(a), this.initSeparator()
  18422. })
  18423. ;(c.prototype = {
  18424. uiName: 'Breakline',
  18425. initSeparator: function () {
  18426. this.initUIBase()
  18427. },
  18428. getHtmlTpl: function () {
  18429. return '<br/>'
  18430. }
  18431. }),
  18432. a.inherits(c, b)
  18433. })(),
  18434. (function () {
  18435. var a = baidu.editor.utils,
  18436. b = baidu.editor.dom.domUtils,
  18437. c = baidu.editor.ui.UIBase,
  18438. d = (baidu.editor.ui.Message = function (a) {
  18439. this.initOptions(a), this.initMessage()
  18440. })
  18441. ;(d.prototype = {
  18442. initMessage: function () {
  18443. this.initUIBase()
  18444. },
  18445. getHtmlTpl: function () {
  18446. return '<div id="##" class="edui-message %%"> <div id="##_closer" class="edui-message-closer">×</div> <div id="##_body" class="edui-message-body edui-message-type-info"> <iframe style="position:absolute;z-index:-1;left:0;top:0;background-color: transparent;" frameborder="0" width="100%" height="100%" src="about:blank"></iframe> <div class="edui-shadow"></div> <div id="##_content" class="edui-message-content"> </div> </div></div>'
  18447. },
  18448. reset: function (a) {
  18449. var b = this
  18450. a.keepshow ||
  18451. (clearTimeout(this.timer),
  18452. (b.timer = setTimeout(function () {
  18453. b.hide()
  18454. }, a.timeout || 4e3))),
  18455. void 0 !== a.content && b.setContent(a.content),
  18456. void 0 !== a.type && b.setType(a.type),
  18457. b.show()
  18458. },
  18459. postRender: function () {
  18460. var a = this,
  18461. c = this.getDom('closer')
  18462. c &&
  18463. b.on(c, 'click', function () {
  18464. a.hide()
  18465. })
  18466. },
  18467. setContent: function (a) {
  18468. this.getDom('content').innerHTML = a
  18469. },
  18470. setType: function (a) {
  18471. a = a || 'info'
  18472. var b = this.getDom('body')
  18473. b.className = b.className.replace(
  18474. /edui-message-type-[\w-]+/,
  18475. 'edui-message-type-' + a
  18476. )
  18477. },
  18478. getContent: function () {
  18479. return this.getDom('content').innerHTML
  18480. },
  18481. getType: function () {
  18482. var a = this.getDom('body').match(/edui-message-type-([\w-]+)/)
  18483. return a ? a[1] : ''
  18484. },
  18485. show: function () {
  18486. this.getDom().style.display = 'block'
  18487. },
  18488. hide: function () {
  18489. var a = this.getDom()
  18490. a &&
  18491. ((a.style.display = 'none'),
  18492. a.parentNode && a.parentNode.removeChild(a))
  18493. }
  18494. }),
  18495. a.inherits(d, c)
  18496. })(),
  18497. (function () {
  18498. var a = baidu.editor.utils,
  18499. b = baidu.editor.ui,
  18500. c = b.Dialog
  18501. ;(b.buttons = {}),
  18502. (b.Dialog = function (a) {
  18503. var b = new c(a)
  18504. return (
  18505. b.addListener('hide', function () {
  18506. if (b.editor) {
  18507. var a = b.editor
  18508. try {
  18509. if (browser.gecko) {
  18510. var c = a.window.scrollY,
  18511. d = a.window.scrollX
  18512. a.body.focus(), a.window.scrollTo(d, c)
  18513. } else a.focus()
  18514. } catch (e) {}
  18515. }
  18516. }),
  18517. b
  18518. )
  18519. })
  18520. for (
  18521. var d,
  18522. e = {
  18523. anchor: '~/dialogs/anchor/anchor.html',
  18524. insertimage: '~/dialogs/image/image.html',
  18525. link: '~/dialogs/link/link.html',
  18526. spechars: '~/dialogs/spechars/spechars.html',
  18527. searchreplace: '~/dialogs/searchreplace/searchreplace.html',
  18528. map: '~/dialogs/map/map.html',
  18529. gmap: '~/dialogs/gmap/gmap.html',
  18530. insertvideo: '~/dialogs/video/video.html',
  18531. help: '~/dialogs/help/help.html',
  18532. preview: '~/dialogs/preview/preview.html',
  18533. emotion: '~/dialogs/emotion/emotion.html',
  18534. wordimage: '~/dialogs/wordimage/wordimage.html',
  18535. attachment: '~/dialogs/attachment/attachment.html',
  18536. insertframe: '~/dialogs/insertframe/insertframe.html',
  18537. edittip: '~/dialogs/table/edittip.html',
  18538. edittable: '~/dialogs/table/edittable.html',
  18539. edittd: '~/dialogs/table/edittd.html',
  18540. webapp: '~/dialogs/webapp/webapp.html',
  18541. snapscreen: '~/dialogs/snapscreen/snapscreen.html',
  18542. scrawl: '~/dialogs/scrawl/scrawl.html',
  18543. music: '~/dialogs/music/music.html',
  18544. template: '~/dialogs/template/template.html',
  18545. background: '~/dialogs/background/background.html',
  18546. charts: '~/dialogs/charts/charts.html'
  18547. },
  18548. f = [
  18549. 'undo',
  18550. 'redo',
  18551. 'formatmatch',
  18552. 'bold',
  18553. 'italic',
  18554. 'underline',
  18555. 'fontborder',
  18556. 'touppercase',
  18557. 'tolowercase',
  18558. 'strikethrough',
  18559. 'subscript',
  18560. 'superscript',
  18561. 'source',
  18562. 'indent',
  18563. 'outdent',
  18564. 'blockquote',
  18565. 'pasteplain',
  18566. 'pagebreak',
  18567. 'selectall',
  18568. 'print',
  18569. 'horizontal',
  18570. 'removeformat',
  18571. 'time',
  18572. 'date',
  18573. 'unlink',
  18574. 'insertparagraphbeforetable',
  18575. 'insertrow',
  18576. 'insertcol',
  18577. 'mergeright',
  18578. 'mergedown',
  18579. 'deleterow',
  18580. 'deletecol',
  18581. 'splittorows',
  18582. 'splittocols',
  18583. 'splittocells',
  18584. 'mergecells',
  18585. 'deletetable',
  18586. 'drafts'
  18587. ],
  18588. g = 0;
  18589. (d = f[g++]);
  18590. )
  18591. (d = d.toLowerCase()),
  18592. (b[d] = (function (a) {
  18593. return function (c) {
  18594. var d = new b.Button({
  18595. className: 'edui-for-' + a,
  18596. title:
  18597. c.options.labelMap[a] || c.getLang('labelMap.' + a) || '',
  18598. onclick: function () {
  18599. c.execCommand(a)
  18600. },
  18601. theme: c.options.theme,
  18602. showText: !1
  18603. })
  18604. return (
  18605. (b.buttons[a] = d),
  18606. c.addListener('selectionchange', function (b, e, f) {
  18607. var g = c.queryCommandState(a)
  18608. g == -1
  18609. ? (d.setDisabled(!0), d.setChecked(!1))
  18610. : f || (d.setDisabled(!1), d.setChecked(g))
  18611. }),
  18612. d
  18613. )
  18614. }
  18615. })(d))
  18616. b.cleardoc = function (a) {
  18617. var c = new b.Button({
  18618. className: 'edui-for-cleardoc',
  18619. title:
  18620. a.options.labelMap.cleardoc || a.getLang('labelMap.cleardoc') || '',
  18621. theme: a.options.theme,
  18622. onclick: function () {
  18623. confirm(a.getLang('confirmClear')) && a.execCommand('cleardoc')
  18624. }
  18625. })
  18626. return (
  18627. (b.buttons.cleardoc = c),
  18628. a.addListener('selectionchange', function () {
  18629. c.setDisabled(a.queryCommandState('cleardoc') == -1)
  18630. }),
  18631. c
  18632. )
  18633. }
  18634. var h = {
  18635. justify: ['left', 'right', 'center', 'justify'],
  18636. imagefloat: ['none', 'left', 'center', 'right'],
  18637. directionality: ['ltr', 'rtl']
  18638. }
  18639. for (var i in h)
  18640. !(function (a, c) {
  18641. for (var d, e = 0; (d = c[e++]); )
  18642. !(function (c) {
  18643. b[a.replace('float', '') + c] = function (d) {
  18644. var e = new b.Button({
  18645. className: 'edui-for-' + a.replace('float', '') + c,
  18646. title:
  18647. d.options.labelMap[a.replace('float', '') + c] ||
  18648. d.getLang('labelMap.' + a.replace('float', '') + c) ||
  18649. '',
  18650. theme: d.options.theme,
  18651. onclick: function () {
  18652. d.execCommand(a, c)
  18653. }
  18654. })
  18655. return (
  18656. (b.buttons[a] = e),
  18657. d.addListener('selectionchange', function (b, f, g) {
  18658. e.setDisabled(d.queryCommandState(a) == -1),
  18659. e.setChecked(d.queryCommandValue(a) == c && !g)
  18660. }),
  18661. e
  18662. )
  18663. }
  18664. })(d)
  18665. })(i, h[i])
  18666. for (var d, g = 0; (d = ['backcolor', 'forecolor'][g++]); )
  18667. b[d] = (function (a) {
  18668. return function (c) {
  18669. var d = new b.ColorButton({
  18670. className: 'edui-for-' + a,
  18671. color: 'default',
  18672. title: c.options.labelMap[a] || c.getLang('labelMap.' + a) || '',
  18673. editor: c,
  18674. onpickcolor: function (b, d) {
  18675. c.execCommand(a, d)
  18676. },
  18677. onpicknocolor: function () {
  18678. c.execCommand(a, 'default'),
  18679. this.setColor('transparent'),
  18680. (this.color = 'default')
  18681. },
  18682. onbuttonclick: function () {
  18683. c.execCommand(a, this.color)
  18684. }
  18685. })
  18686. return (
  18687. (b.buttons[a] = d),
  18688. c.addListener('selectionchange', function () {
  18689. d.setDisabled(c.queryCommandState(a) == -1)
  18690. }),
  18691. d
  18692. )
  18693. }
  18694. })(d)
  18695. var j = {
  18696. noOk: ['searchreplace', 'help', 'spechars', 'webapp', 'preview'],
  18697. ok: [
  18698. 'attachment',
  18699. 'anchor',
  18700. 'link',
  18701. 'insertimage',
  18702. 'map',
  18703. 'gmap',
  18704. 'insertframe',
  18705. 'wordimage',
  18706. 'insertvideo',
  18707. 'insertframe',
  18708. 'edittip',
  18709. 'edittable',
  18710. 'edittd',
  18711. 'scrawl',
  18712. 'template',
  18713. 'music',
  18714. 'background',
  18715. 'charts'
  18716. ]
  18717. }
  18718. for (var i in j)
  18719. !(function (c, d) {
  18720. for (var f, g = 0; (f = d[g++]); )
  18721. (browser.opera && 'searchreplace' === f) ||
  18722. !(function (d) {
  18723. b[d] = function (f, g, h) {
  18724. ;(g = g || (f.options.iframeUrlMap || {})[d] || e[d]),
  18725. (h =
  18726. f.options.labelMap[d] || f.getLang('labelMap.' + d) || '')
  18727. var i
  18728. g &&
  18729. ((i = new b.Dialog(
  18730. a.extend(
  18731. {
  18732. iframeUrl: f.ui.mapUrl(g),
  18733. editor: f,
  18734. className: 'edui-for-' + d,
  18735. title: h,
  18736. holdScroll: 'insertimage' === d,
  18737. fullscreen: /charts|preview/.test(d),
  18738. closeDialog: f.getLang('closeDialog')
  18739. },
  18740. 'ok' == c
  18741. ? {
  18742. buttons: [
  18743. {
  18744. className: 'edui-okbutton',
  18745. label: f.getLang('ok'),
  18746. editor: f,
  18747. onclick: function () {
  18748. i.close(!0)
  18749. }
  18750. },
  18751. {
  18752. className: 'edui-cancelbutton',
  18753. label: f.getLang('cancel'),
  18754. editor: f,
  18755. onclick: function () {
  18756. i.close(!1)
  18757. }
  18758. }
  18759. ]
  18760. }
  18761. : {}
  18762. )
  18763. )),
  18764. (f.ui._dialogs[d + 'Dialog'] = i))
  18765. var j = new b.Button({
  18766. className: 'edui-for-' + d,
  18767. title: h,
  18768. onclick: function () {
  18769. if (i)
  18770. switch (d) {
  18771. case 'wordimage':
  18772. var a = f.execCommand('wordimage')
  18773. a && a.length && (i.render(), i.open())
  18774. break
  18775. case 'scrawl':
  18776. f.queryCommandState('scrawl') != -1 &&
  18777. (i.render(), i.open())
  18778. break
  18779. default:
  18780. i.render(), i.open()
  18781. }
  18782. },
  18783. theme: f.options.theme,
  18784. disabled:
  18785. ('scrawl' == d && f.queryCommandState('scrawl') == -1) ||
  18786. 'charts' == d
  18787. })
  18788. return (
  18789. (b.buttons[d] = j),
  18790. f.addListener('selectionchange', function () {
  18791. var a = { edittable: 1 }
  18792. if (!(d in a)) {
  18793. var b = f.queryCommandState(d)
  18794. j.getDom() && (j.setDisabled(b == -1), j.setChecked(b))
  18795. }
  18796. }),
  18797. j
  18798. )
  18799. }
  18800. })(f.toLowerCase())
  18801. })(i, j[i])
  18802. ;(b.snapscreen = function (a, c, d) {
  18803. d =
  18804. a.options.labelMap.snapscreen ||
  18805. a.getLang('labelMap.snapscreen') ||
  18806. ''
  18807. var f = new b.Button({
  18808. className: 'edui-for-snapscreen',
  18809. title: d,
  18810. onclick: function () {
  18811. a.execCommand('snapscreen')
  18812. },
  18813. theme: a.options.theme
  18814. })
  18815. if (
  18816. ((b.buttons.snapscreen = f),
  18817. (c = c || (a.options.iframeUrlMap || {}).snapscreen || e.snapscreen))
  18818. ) {
  18819. var g = new b.Dialog({
  18820. iframeUrl: a.ui.mapUrl(c),
  18821. editor: a,
  18822. className: 'edui-for-snapscreen',
  18823. title: d,
  18824. buttons: [
  18825. {
  18826. className: 'edui-okbutton',
  18827. label: a.getLang('ok'),
  18828. editor: a,
  18829. onclick: function () {
  18830. g.close(!0)
  18831. }
  18832. },
  18833. {
  18834. className: 'edui-cancelbutton',
  18835. label: a.getLang('cancel'),
  18836. editor: a,
  18837. onclick: function () {
  18838. g.close(!1)
  18839. }
  18840. }
  18841. ]
  18842. })
  18843. g.render(), (a.ui._dialogs.snapscreenDialog = g)
  18844. }
  18845. return (
  18846. a.addListener('selectionchange', function () {
  18847. f.setDisabled(a.queryCommandState('snapscreen') == -1)
  18848. }),
  18849. f
  18850. )
  18851. }),
  18852. (b.insertcode = function (c, d, e) {
  18853. ;(d = c.options.insertcode || []),
  18854. (e =
  18855. c.options.labelMap.insertcode ||
  18856. c.getLang('labelMap.insertcode') ||
  18857. '')
  18858. var f = []
  18859. a.each(d, function (a, b) {
  18860. f.push({
  18861. label: a,
  18862. value: b,
  18863. theme: c.options.theme,
  18864. renderLabelHtml: function () {
  18865. return (
  18866. '<div class="edui-label %%-label" >' +
  18867. (this.label || '') +
  18868. '</div>'
  18869. )
  18870. }
  18871. })
  18872. })
  18873. var g = new b.Combox({
  18874. editor: c,
  18875. items: f,
  18876. onselect: function (a, b) {
  18877. c.execCommand('insertcode', this.items[b].value)
  18878. },
  18879. onbuttonclick: function () {
  18880. this.showPopup()
  18881. },
  18882. title: e,
  18883. initValue: e,
  18884. className: 'edui-for-insertcode',
  18885. indexByValue: function (a) {
  18886. if (a)
  18887. for (var b, c = 0; (b = this.items[c]); c++)
  18888. if (b.value.indexOf(a) != -1) return c
  18889. return -1
  18890. }
  18891. })
  18892. return (
  18893. (b.buttons.insertcode = g),
  18894. c.addListener('selectionchange', function (a, b, d) {
  18895. if (!d) {
  18896. var f = c.queryCommandState('insertcode')
  18897. if (f == -1) g.setDisabled(!0)
  18898. else {
  18899. g.setDisabled(!1)
  18900. var h = c.queryCommandValue('insertcode')
  18901. if (!h) return void g.setValue(e)
  18902. h && (h = h.replace(/['"]/g, '').split(',')[0]), g.setValue(h)
  18903. }
  18904. }
  18905. }),
  18906. g
  18907. )
  18908. }),
  18909. (b.fontfamily = function (c, d, e) {
  18910. if (
  18911. ((d = c.options.fontfamily || []),
  18912. (e =
  18913. c.options.labelMap.fontfamily ||
  18914. c.getLang('labelMap.fontfamily') ||
  18915. ''),
  18916. d.length)
  18917. ) {
  18918. for (var f, g = 0, h = []; (f = d[g]); g++) {
  18919. var i = c.getLang('fontfamily')[f.name] || ''
  18920. !(function (b, d) {
  18921. h.push({
  18922. label: b,
  18923. value: d,
  18924. theme: c.options.theme,
  18925. renderLabelHtml: function () {
  18926. return (
  18927. '<div class="edui-label %%-label" style="font-family:' +
  18928. a.unhtml(this.value) +
  18929. '">' +
  18930. (this.label || '') +
  18931. '</div>'
  18932. )
  18933. }
  18934. })
  18935. })(f.label || i, f.val)
  18936. }
  18937. var j = new b.Combox({
  18938. editor: c,
  18939. items: h,
  18940. onselect: function (a, b) {
  18941. c.execCommand('FontFamily', this.items[b].value)
  18942. },
  18943. onbuttonclick: function () {
  18944. this.showPopup()
  18945. },
  18946. title: e,
  18947. initValue: e,
  18948. className: 'edui-for-fontfamily',
  18949. indexByValue: function (a) {
  18950. if (a)
  18951. for (var b, c = 0; (b = this.items[c]); c++)
  18952. if (b.value.indexOf(a) != -1) return c
  18953. return -1
  18954. }
  18955. })
  18956. return (
  18957. (b.buttons.fontfamily = j),
  18958. c.addListener('selectionchange', function (a, b, d) {
  18959. if (!d) {
  18960. var e = c.queryCommandState('FontFamily')
  18961. if (e == -1) j.setDisabled(!0)
  18962. else {
  18963. j.setDisabled(!1)
  18964. var f = c.queryCommandValue('FontFamily')
  18965. f && (f = f.replace(/['"]/g, '').split(',')[0]),
  18966. j.setValue(f)
  18967. }
  18968. }
  18969. }),
  18970. j
  18971. )
  18972. }
  18973. }),
  18974. (b.fontsize = function (a, c, d) {
  18975. if (
  18976. ((d =
  18977. a.options.labelMap.fontsize ||
  18978. a.getLang('labelMap.fontsize') ||
  18979. ''),
  18980. (c = c || a.options.fontsize || []),
  18981. c.length)
  18982. ) {
  18983. for (var e = [], f = 0; f < c.length; f++) {
  18984. var g = c[f] + 'px'
  18985. e.push({
  18986. label: g,
  18987. value: g,
  18988. theme: a.options.theme,
  18989. renderLabelHtml: function () {
  18990. return (
  18991. '<div class="edui-label %%-label" style="line-height:1;font-size:' +
  18992. this.value +
  18993. '">' +
  18994. (this.label || '') +
  18995. '</div>'
  18996. )
  18997. }
  18998. })
  18999. }
  19000. var h = new b.Combox({
  19001. editor: a,
  19002. items: e,
  19003. title: d,
  19004. initValue: d,
  19005. onselect: function (b, c) {
  19006. a.execCommand('FontSize', this.items[c].value)
  19007. },
  19008. onbuttonclick: function () {
  19009. this.showPopup()
  19010. },
  19011. className: 'edui-for-fontsize'
  19012. })
  19013. return (
  19014. (b.buttons.fontsize = h),
  19015. a.addListener('selectionchange', function (b, c, d) {
  19016. if (!d) {
  19017. var e = a.queryCommandState('FontSize')
  19018. e == -1
  19019. ? h.setDisabled(!0)
  19020. : (h.setDisabled(!1),
  19021. h.setValue(a.queryCommandValue('FontSize')))
  19022. }
  19023. }),
  19024. h
  19025. )
  19026. }
  19027. }),
  19028. (b.paragraph = function (c, d, e) {
  19029. if (
  19030. ((e =
  19031. c.options.labelMap.paragraph ||
  19032. c.getLang('labelMap.paragraph') ||
  19033. ''),
  19034. (d = c.options.paragraph || []),
  19035. !a.isEmptyObject(d))
  19036. ) {
  19037. var f = []
  19038. for (var g in d)
  19039. f.push({
  19040. value: g,
  19041. label: d[g] || c.getLang('paragraph')[g],
  19042. theme: c.options.theme,
  19043. renderLabelHtml: function () {
  19044. return (
  19045. '<div class="edui-label %%-label"><span class="edui-for-' +
  19046. this.value +
  19047. '">' +
  19048. (this.label || '') +
  19049. '</span></div>'
  19050. )
  19051. }
  19052. })
  19053. var h = new b.Combox({
  19054. editor: c,
  19055. items: f,
  19056. title: e,
  19057. initValue: e,
  19058. className: 'edui-for-paragraph',
  19059. onselect: function (a, b) {
  19060. c.execCommand('Paragraph', this.items[b].value)
  19061. },
  19062. onbuttonclick: function () {
  19063. this.showPopup()
  19064. }
  19065. })
  19066. return (
  19067. (b.buttons.paragraph = h),
  19068. c.addListener('selectionchange', function (a, b, d) {
  19069. if (!d) {
  19070. var e = c.queryCommandState('Paragraph')
  19071. if (e == -1) h.setDisabled(!0)
  19072. else {
  19073. h.setDisabled(!1)
  19074. var f = c.queryCommandValue('Paragraph'),
  19075. g = h.indexByValue(f)
  19076. g != -1 ? h.setValue(f) : h.setValue(h.initValue)
  19077. }
  19078. }
  19079. }),
  19080. h
  19081. )
  19082. }
  19083. }),
  19084. (b.customstyle = function (a) {
  19085. var c = a.options.customstyle || [],
  19086. d =
  19087. a.options.labelMap.customstyle ||
  19088. a.getLang('labelMap.customstyle') ||
  19089. ''
  19090. if (c.length) {
  19091. for (
  19092. var e, f = a.getLang('customstyle'), g = 0, h = [];
  19093. (e = c[g++]);
  19094. )
  19095. !(function (b) {
  19096. var c = {}
  19097. ;(c.label = b.label ? b.label : f[b.name]),
  19098. (c.style = b.style),
  19099. (c.className = b.className),
  19100. (c.tag = b.tag),
  19101. h.push({
  19102. label: c.label,
  19103. value: c,
  19104. theme: a.options.theme,
  19105. renderLabelHtml: function () {
  19106. return (
  19107. '<div class="edui-label %%-label"><' +
  19108. c.tag +
  19109. ' ' +
  19110. (c.className ? ' class="' + c.className + '"' : '') +
  19111. (c.style ? ' style="' + c.style + '"' : '') +
  19112. '>' +
  19113. c.label +
  19114. '</' +
  19115. c.tag +
  19116. '></div>'
  19117. )
  19118. }
  19119. })
  19120. })(e)
  19121. var i = new b.Combox({
  19122. editor: a,
  19123. items: h,
  19124. title: d,
  19125. initValue: d,
  19126. className: 'edui-for-customstyle',
  19127. onselect: function (b, c) {
  19128. a.execCommand('customstyle', this.items[c].value)
  19129. },
  19130. onbuttonclick: function () {
  19131. this.showPopup()
  19132. },
  19133. indexByValue: function (a) {
  19134. for (var b, c = 0; (b = this.items[c++]); )
  19135. if (b.label == a) return c - 1
  19136. return -1
  19137. }
  19138. })
  19139. return (
  19140. (b.buttons.customstyle = i),
  19141. a.addListener('selectionchange', function (b, c, d) {
  19142. if (!d) {
  19143. var e = a.queryCommandState('customstyle')
  19144. if (e == -1) i.setDisabled(!0)
  19145. else {
  19146. i.setDisabled(!1)
  19147. var f = a.queryCommandValue('customstyle'),
  19148. g = i.indexByValue(f)
  19149. g != -1 ? i.setValue(f) : i.setValue(i.initValue)
  19150. }
  19151. }
  19152. }),
  19153. i
  19154. )
  19155. }
  19156. }),
  19157. (b.inserttable = function (a, c, d) {
  19158. d =
  19159. a.options.labelMap.inserttable ||
  19160. a.getLang('labelMap.inserttable') ||
  19161. ''
  19162. var e = new b.TableButton({
  19163. editor: a,
  19164. title: d,
  19165. className: 'edui-for-inserttable',
  19166. onpicktable: function (b, c, d) {
  19167. a.execCommand('InsertTable', {
  19168. numRows: d,
  19169. numCols: c,
  19170. border: 1
  19171. })
  19172. },
  19173. onbuttonclick: function () {
  19174. this.showPopup()
  19175. }
  19176. })
  19177. return (
  19178. (b.buttons.inserttable = e),
  19179. a.addListener('selectionchange', function () {
  19180. e.setDisabled(a.queryCommandState('inserttable') == -1)
  19181. }),
  19182. e
  19183. )
  19184. }),
  19185. (b.lineheight = function (a) {
  19186. var c = a.options.lineheight || []
  19187. if (c.length) {
  19188. for (var d, e = 0, f = []; (d = c[e++]); )
  19189. f.push({
  19190. label: d,
  19191. value: d,
  19192. theme: a.options.theme,
  19193. onclick: function () {
  19194. a.execCommand('lineheight', this.value)
  19195. }
  19196. })
  19197. var g = new b.MenuButton({
  19198. editor: a,
  19199. className: 'edui-for-lineheight',
  19200. title:
  19201. a.options.labelMap.lineheight ||
  19202. a.getLang('labelMap.lineheight') ||
  19203. '',
  19204. items: f,
  19205. onbuttonclick: function () {
  19206. var b = a.queryCommandValue('LineHeight') || this.value
  19207. a.execCommand('LineHeight', b)
  19208. }
  19209. })
  19210. return (
  19211. (b.buttons.lineheight = g),
  19212. a.addListener('selectionchange', function () {
  19213. var b = a.queryCommandState('LineHeight')
  19214. if (b == -1) g.setDisabled(!0)
  19215. else {
  19216. g.setDisabled(!1)
  19217. var c = a.queryCommandValue('LineHeight')
  19218. c && g.setValue((c + '').replace(/cm/, '')), g.setChecked(b)
  19219. }
  19220. }),
  19221. g
  19222. )
  19223. }
  19224. })
  19225. for (var k, l = ['top', 'bottom'], m = 0; (k = l[m++]); )
  19226. !(function (a) {
  19227. b['rowspacing' + a] = function (c) {
  19228. var d = c.options['rowspacing' + a] || []
  19229. if (!d.length) return null
  19230. for (var e, f = 0, g = []; (e = d[f++]); )
  19231. g.push({
  19232. label: e,
  19233. value: e,
  19234. theme: c.options.theme,
  19235. onclick: function () {
  19236. c.execCommand('rowspacing', this.value, a)
  19237. }
  19238. })
  19239. var h = new b.MenuButton({
  19240. editor: c,
  19241. className: 'edui-for-rowspacing' + a,
  19242. title:
  19243. c.options.labelMap['rowspacing' + a] ||
  19244. c.getLang('labelMap.rowspacing' + a) ||
  19245. '',
  19246. items: g,
  19247. onbuttonclick: function () {
  19248. var b = c.queryCommandValue('rowspacing', a) || this.value
  19249. c.execCommand('rowspacing', b, a)
  19250. }
  19251. })
  19252. return (
  19253. (b.buttons[a] = h),
  19254. c.addListener('selectionchange', function () {
  19255. var b = c.queryCommandState('rowspacing', a)
  19256. if (b == -1) h.setDisabled(!0)
  19257. else {
  19258. h.setDisabled(!1)
  19259. var d = c.queryCommandValue('rowspacing', a)
  19260. d && h.setValue((d + '').replace(/%/, '')), h.setChecked(b)
  19261. }
  19262. }),
  19263. h
  19264. )
  19265. }
  19266. })(k)
  19267. for (
  19268. var n, o = ['insertorderedlist', 'insertunorderedlist'], p = 0;
  19269. (n = o[p++]);
  19270. )
  19271. !(function (a) {
  19272. b[a] = function (c) {
  19273. var d = c.options[a],
  19274. e = function () {
  19275. c.execCommand(a, this.value)
  19276. },
  19277. f = []
  19278. for (var g in d)
  19279. f.push({
  19280. label: d[g] || c.getLang()[a][g] || '',
  19281. value: g,
  19282. theme: c.options.theme,
  19283. onclick: e
  19284. })
  19285. var h = new b.MenuButton({
  19286. editor: c,
  19287. className: 'edui-for-' + a,
  19288. title: c.getLang('labelMap.' + a) || '',
  19289. items: f,
  19290. onbuttonclick: function () {
  19291. var b = c.queryCommandValue(a) || this.value
  19292. c.execCommand(a, b)
  19293. }
  19294. })
  19295. return (
  19296. (b.buttons[a] = h),
  19297. c.addListener('selectionchange', function () {
  19298. var b = c.queryCommandState(a)
  19299. if (b == -1) h.setDisabled(!0)
  19300. else {
  19301. h.setDisabled(!1)
  19302. var d = c.queryCommandValue(a)
  19303. h.setValue(d), h.setChecked(b)
  19304. }
  19305. }),
  19306. h
  19307. )
  19308. }
  19309. })(n)
  19310. ;(b.fullscreen = function (a, c) {
  19311. c =
  19312. a.options.labelMap.fullscreen ||
  19313. a.getLang('labelMap.fullscreen') ||
  19314. ''
  19315. var d = new b.Button({
  19316. className: 'edui-for-fullscreen',
  19317. title: c,
  19318. theme: a.options.theme,
  19319. onclick: function () {
  19320. a.ui && a.ui.setFullScreen(!a.ui.isFullScreen()),
  19321. this.setChecked(a.ui.isFullScreen())
  19322. }
  19323. })
  19324. return (
  19325. (b.buttons.fullscreen = d),
  19326. a.addListener('selectionchange', function () {
  19327. var b = a.queryCommandState('fullscreen')
  19328. d.setDisabled(b == -1), d.setChecked(a.ui.isFullScreen())
  19329. }),
  19330. d
  19331. )
  19332. }),
  19333. (b.emotion = function (a, c) {
  19334. var d = 'emotion',
  19335. f = new b.MultiMenuPop({
  19336. title: a.options.labelMap[d] || a.getLang('labelMap.' + d) || '',
  19337. editor: a,
  19338. className: 'edui-for-' + d,
  19339. iframeUrl: a.ui.mapUrl(
  19340. c || (a.options.iframeUrlMap || {})[d] || e[d]
  19341. )
  19342. })
  19343. return (
  19344. (b.buttons[d] = f),
  19345. a.addListener('selectionchange', function () {
  19346. f.setDisabled(a.queryCommandState(d) == -1)
  19347. }),
  19348. f
  19349. )
  19350. }),
  19351. (b.autotypeset = function (a) {
  19352. var c = new b.AutoTypeSetButton({
  19353. editor: a,
  19354. title:
  19355. a.options.labelMap.autotypeset ||
  19356. a.getLang('labelMap.autotypeset') ||
  19357. '',
  19358. className: 'edui-for-autotypeset',
  19359. onbuttonclick: function () {
  19360. a.execCommand('autotypeset')
  19361. }
  19362. })
  19363. return (
  19364. (b.buttons.autotypeset = c),
  19365. a.addListener('selectionchange', function () {
  19366. c.setDisabled(a.queryCommandState('autotypeset') == -1)
  19367. }),
  19368. c
  19369. )
  19370. }),
  19371. (b.simpleupload = function (a) {
  19372. var c = 'simpleupload',
  19373. d = new b.Button({
  19374. className: 'edui-for-' + c,
  19375. title: a.options.labelMap[c] || a.getLang('labelMap.' + c) || '',
  19376. onclick: function () {},
  19377. theme: a.options.theme,
  19378. showText: !1
  19379. })
  19380. return (
  19381. (b.buttons[c] = d),
  19382. a.addListener('ready', function () {
  19383. var b = d.getDom('body'),
  19384. c = b.children[0]
  19385. a.fireEvent('simpleuploadbtnready', c)
  19386. }),
  19387. a.addListener('selectionchange', function (b, e, f) {
  19388. var g = a.queryCommandState(c)
  19389. g == -1
  19390. ? (d.setDisabled(!0), d.setChecked(!1))
  19391. : f || (d.setDisabled(!1), d.setChecked(g))
  19392. }),
  19393. d
  19394. )
  19395. })
  19396. })(),
  19397. (function () {
  19398. function a(a) {
  19399. this.initOptions(a), this.initEditorUI()
  19400. }
  19401. var b = baidu.editor.utils,
  19402. c = baidu.editor.ui.uiUtils,
  19403. d = baidu.editor.ui.UIBase,
  19404. e = baidu.editor.dom.domUtils,
  19405. f = []
  19406. ;(a.prototype = {
  19407. uiName: 'editor',
  19408. initEditorUI: function () {
  19409. function a(a, b) {
  19410. a.setOpt({
  19411. wordCount: !0,
  19412. maximumWords: 1e4,
  19413. wordCountMsg: a.options.wordCountMsg || a.getLang('wordCountMsg'),
  19414. wordOverFlowMsg:
  19415. a.options.wordOverFlowMsg || a.getLang('wordOverFlowMsg')
  19416. })
  19417. var c = a.options,
  19418. d = c.maximumWords,
  19419. e = c.wordCountMsg,
  19420. f = c.wordOverFlowMsg,
  19421. g = b.getDom('wordcount')
  19422. if (c.wordCount) {
  19423. var h = a.getContentLength(!0)
  19424. h > d
  19425. ? ((g.innerHTML = f), a.fireEvent('wordcountoverflow'))
  19426. : (g.innerHTML = e
  19427. .replace('{#leave}', d - h)
  19428. .replace('{#count}', h))
  19429. }
  19430. }
  19431. ;(this.editor.ui = this),
  19432. (this._dialogs = {}),
  19433. this.initUIBase(),
  19434. this._initToolbars()
  19435. var b = this.editor,
  19436. c = this
  19437. b.addListener('ready', function () {
  19438. function d() {
  19439. a(b, c), e.un(b.document, 'click', arguments.callee)
  19440. }
  19441. ;(b.getDialog = function (a) {
  19442. return b.ui._dialogs[a + 'Dialog']
  19443. }),
  19444. e.on(b.window, 'scroll', function (a) {
  19445. baidu.editor.ui.Popup.postHide(a)
  19446. }),
  19447. (b.ui._actualFrameWidth = b.options.initialFrameWidth),
  19448. UE.browser.ie &&
  19449. 6 === UE.browser.version &&
  19450. b.container.ownerDocument.execCommand(
  19451. 'BackgroundImageCache',
  19452. !1,
  19453. !0
  19454. ),
  19455. b.options.elementPathEnabled &&
  19456. (b.ui.getDom('elementpath').innerHTML =
  19457. '<div class="edui-editor-breadcrumb">' +
  19458. b.getLang('elementPathTip') +
  19459. ':</div>'),
  19460. b.options.wordCount &&
  19461. (e.on(b.document, 'click', d),
  19462. (b.ui.getDom('wordcount').innerHTML =
  19463. b.getLang('wordCountTip'))),
  19464. b.ui._scale(),
  19465. b.options.scaleEnabled
  19466. ? (b.autoHeightEnabled && b.disableAutoHeight(),
  19467. c.enableScale())
  19468. : c.disableScale(),
  19469. b.options.elementPathEnabled ||
  19470. b.options.wordCount ||
  19471. b.options.scaleEnabled ||
  19472. ((b.ui.getDom('elementpath').style.display = 'none'),
  19473. (b.ui.getDom('wordcount').style.display = 'none'),
  19474. (b.ui.getDom('scale').style.display = 'none')),
  19475. b.selection.isFocus() && b.fireEvent('selectionchange', !1, !0)
  19476. }),
  19477. b.addListener('mousedown', function (a, b) {
  19478. var c = b.target || b.srcElement
  19479. baidu.editor.ui.Popup.postHide(b, c),
  19480. baidu.editor.ui.ShortCutMenu.postHide(b)
  19481. }),
  19482. b.addListener('delcells', function () {
  19483. UE.ui.edittip && new UE.ui.edittip(b),
  19484. b.getDialog('edittip').open()
  19485. })
  19486. var d,
  19487. f,
  19488. g = !1
  19489. b.addListener('afterpaste', function () {
  19490. b.queryCommandState('pasteplain') ||
  19491. (baidu.editor.ui.PastePicker &&
  19492. ((d = new baidu.editor.ui.Popup({
  19493. content: new baidu.editor.ui.PastePicker({ editor: b }),
  19494. editor: b,
  19495. className: 'edui-wordpastepop'
  19496. })),
  19497. d.render()),
  19498. (g = !0))
  19499. }),
  19500. b.addListener('afterinserthtml', function () {
  19501. clearTimeout(f),
  19502. (f = setTimeout(function () {
  19503. if (d && (g || b.ui._isTransfer)) {
  19504. if (d.isHidden()) {
  19505. var a = e.createElement(b.document, 'span', {
  19506. style: 'line-height:0px;',
  19507. innerHTML: '\ufeff'
  19508. }),
  19509. c = b.selection.getRange()
  19510. c.insertNode(a)
  19511. var f = getDomNode(a, 'firstChild', 'previousSibling')
  19512. f && d.showAnchor(3 == f.nodeType ? f.parentNode : f),
  19513. e.remove(a)
  19514. } else d.show()
  19515. delete b.ui._isTransfer, (g = !1)
  19516. }
  19517. }, 200))
  19518. }),
  19519. b.addListener('contextmenu', function (a, b) {
  19520. baidu.editor.ui.Popup.postHide(b)
  19521. }),
  19522. b.addListener('keydown', function (a, b) {
  19523. d && d.dispose(b)
  19524. var c = b.keyCode || b.which
  19525. b.altKey && 90 == c && UE.ui.buttons.fullscreen.onclick()
  19526. }),
  19527. b.addListener('wordcount', function (b) {
  19528. a(this, c)
  19529. }),
  19530. b.addListener('selectionchange', function () {
  19531. b.options.elementPathEnabled &&
  19532. c[
  19533. (b.queryCommandState('elementpath') == -1 ? 'dis' : 'en') +
  19534. 'ableElementPath'
  19535. ](),
  19536. b.options.scaleEnabled &&
  19537. c[
  19538. (b.queryCommandState('scale') == -1 ? 'dis' : 'en') +
  19539. 'ableScale'
  19540. ]()
  19541. })
  19542. var h = new baidu.editor.ui.Popup({
  19543. editor: b,
  19544. content: '',
  19545. className: 'edui-bubble',
  19546. _onEditButtonClick: function () {
  19547. this.hide(), b.ui._dialogs.linkDialog.open()
  19548. },
  19549. _onImgEditButtonClick: function (a) {
  19550. this.hide(), b.ui._dialogs[a] && b.ui._dialogs[a].open()
  19551. },
  19552. _onImgSetFloat: function (a) {
  19553. this.hide(), b.execCommand('imagefloat', a)
  19554. },
  19555. _setIframeAlign: function (a) {
  19556. var b = h.anchorEl,
  19557. c = b.cloneNode(!0)
  19558. switch (a) {
  19559. case -2:
  19560. c.setAttribute('align', '')
  19561. break
  19562. case -1:
  19563. c.setAttribute('align', 'left')
  19564. break
  19565. case 1:
  19566. c.setAttribute('align', 'right')
  19567. }
  19568. b.parentNode.insertBefore(c, b),
  19569. e.remove(b),
  19570. (h.anchorEl = c),
  19571. h.showAnchor(h.anchorEl)
  19572. },
  19573. _updateIframe: function () {
  19574. var a = (b._iframe = h.anchorEl)
  19575. e.hasClass(a, 'ueditor_baidumap')
  19576. ? (b.selection.getRange().selectNode(a).select(),
  19577. b.ui._dialogs.mapDialog.open(),
  19578. h.hide())
  19579. : (b.ui._dialogs.insertframeDialog.open(), h.hide())
  19580. },
  19581. _onRemoveButtonClick: function (a) {
  19582. b.execCommand(a), this.hide()
  19583. },
  19584. queryAutoHide: function (a) {
  19585. return a &&
  19586. a.ownerDocument == b.document &&
  19587. ('img' == a.tagName.toLowerCase() ||
  19588. e.findParentByTagName(a, 'a', !0))
  19589. ? a !== h.anchorEl
  19590. : baidu.editor.ui.Popup.prototype.queryAutoHide.call(this, a)
  19591. }
  19592. })
  19593. h.render(),
  19594. b.options.imagePopup &&
  19595. (b.addListener('mouseover', function (a, c) {
  19596. c = c || window.event
  19597. var d = c.target || c.srcElement
  19598. if (
  19599. b.ui._dialogs.insertframeDialog &&
  19600. /iframe/gi.test(d.tagName)
  19601. ) {
  19602. var e = h.formatHtml(
  19603. '<nobr>' +
  19604. b.getLang('property') +
  19605. ': <span onclick=$$._setIframeAlign(-2) class="edui-clickable">' +
  19606. b.getLang('default') +
  19607. '</span>&nbsp;&nbsp;<span onclick=$$._setIframeAlign(-1) class="edui-clickable">' +
  19608. b.getLang('justifyleft') +
  19609. '</span>&nbsp;&nbsp;<span onclick=$$._setIframeAlign(1) class="edui-clickable">' +
  19610. b.getLang('justifyright') +
  19611. '</span>&nbsp;&nbsp; <span onclick="$$._updateIframe( this);" class="edui-clickable">' +
  19612. b.getLang('modify') +
  19613. '</span></nobr>'
  19614. )
  19615. e
  19616. ? ((h.getDom('content').innerHTML = e),
  19617. (h.anchorEl = d),
  19618. h.showAnchor(h.anchorEl))
  19619. : h.hide()
  19620. }
  19621. }),
  19622. b.addListener('selectionchange', function (a, c) {
  19623. if (c) {
  19624. var d = '',
  19625. f = '',
  19626. g = b.selection.getRange().getClosedNode(),
  19627. i = b.ui._dialogs
  19628. if (g && 'IMG' == g.tagName) {
  19629. var j = 'insertimageDialog'
  19630. if (
  19631. ((g.className.indexOf('edui-faked-video') == -1 &&
  19632. g.className.indexOf('edui-upload-video') == -1) ||
  19633. (j = 'insertvideoDialog'),
  19634. g.className.indexOf('edui-faked-webapp') != -1 &&
  19635. (j = 'webappDialog'),
  19636. g.src.indexOf('http://api.map.baidu.com') != -1 &&
  19637. (j = 'mapDialog'),
  19638. g.className.indexOf('edui-faked-music') != -1 &&
  19639. (j = 'musicDialog'),
  19640. g.src.indexOf(
  19641. 'http://maps.google.com/maps/api/staticmap'
  19642. ) != -1 && (j = 'gmapDialog'),
  19643. g.getAttribute('anchorname') &&
  19644. ((j = 'anchorDialog'),
  19645. (d = h.formatHtml(
  19646. '<nobr>' +
  19647. b.getLang('property') +
  19648. ': <span onclick=$$._onImgEditButtonClick("anchorDialog") class="edui-clickable">' +
  19649. b.getLang('modify') +
  19650. '</span>&nbsp;&nbsp;<span onclick=$$._onRemoveButtonClick(\'anchor\') class="edui-clickable">' +
  19651. b.getLang('delete') +
  19652. '</span></nobr>'
  19653. ))),
  19654. g.getAttribute('word_img') &&
  19655. ((b.word_img = [g.getAttribute('word_img')]),
  19656. (j = 'wordimageDialog')),
  19657. (e.hasClass(g, 'loadingclass') ||
  19658. e.hasClass(g, 'loaderrorclass')) &&
  19659. (j = ''),
  19660. !i[j])
  19661. )
  19662. return
  19663. ;(f =
  19664. '<nobr>' +
  19665. b.getLang('property') +
  19666. ': <span onclick=$$._onImgSetFloat("none") class="edui-clickable">' +
  19667. b.getLang('default') +
  19668. '</span>&nbsp;&nbsp;<span onclick=$$._onImgSetFloat("left") class="edui-clickable">' +
  19669. b.getLang('justifyleft') +
  19670. '</span>&nbsp;&nbsp;<span onclick=$$._onImgSetFloat("right") class="edui-clickable">' +
  19671. b.getLang('justifyright') +
  19672. '</span>&nbsp;&nbsp;<span onclick=$$._onImgSetFloat("center") class="edui-clickable">' +
  19673. b.getLang('justifycenter') +
  19674. '</span>&nbsp;&nbsp;<span onclick="$$._onImgEditButtonClick(\'' +
  19675. j +
  19676. '\');" class="edui-clickable">' +
  19677. b.getLang('modify') +
  19678. '</span></nobr>'),
  19679. !d && (d = h.formatHtml(f))
  19680. }
  19681. if (b.ui._dialogs.linkDialog) {
  19682. var k,
  19683. l = b.queryCommandValue('link')
  19684. if (
  19685. l &&
  19686. (k = l.getAttribute('_href') || l.getAttribute('href', 2))
  19687. ) {
  19688. var m = k
  19689. k.length > 30 && (m = k.substring(0, 20) + '...'),
  19690. d && (d += '<div style="height:5px;"></div>'),
  19691. (d += h.formatHtml(
  19692. '<nobr>' +
  19693. b.getLang('anthorMsg') +
  19694. ': <a target="_blank" href="' +
  19695. k +
  19696. '" title="' +
  19697. k +
  19698. '" >' +
  19699. m +
  19700. '</a> <span class="edui-clickable" onclick="$$._onEditButtonClick();">' +
  19701. b.getLang('modify') +
  19702. '</span> <span class="edui-clickable" onclick="$$._onRemoveButtonClick(\'unlink\');"> ' +
  19703. b.getLang('clear') +
  19704. '</span></nobr>'
  19705. )),
  19706. h.showAnchor(l)
  19707. }
  19708. }
  19709. d
  19710. ? ((h.getDom('content').innerHTML = d),
  19711. (h.anchorEl = g || l),
  19712. h.showAnchor(h.anchorEl))
  19713. : h.hide()
  19714. }
  19715. }))
  19716. },
  19717. _initToolbars: function () {
  19718. for (
  19719. var a = this.editor, b = this.toolbars || [], c = [], d = 0;
  19720. d < b.length;
  19721. d++
  19722. ) {
  19723. for (
  19724. var e = b[d],
  19725. f = new baidu.editor.ui.Toolbar({ theme: a.options.theme }),
  19726. g = 0;
  19727. g < e.length;
  19728. g++
  19729. ) {
  19730. var h = e[g],
  19731. i = null
  19732. if ('string' == typeof h) {
  19733. if (
  19734. ((h = h.toLowerCase()),
  19735. '|' == h && (h = 'Separator'),
  19736. '||' == h && (h = 'Breakline'),
  19737. baidu.editor.ui[h] && (i = new baidu.editor.ui[h](a)),
  19738. 'fullscreen' == h)
  19739. ) {
  19740. c && c[0]
  19741. ? c[0].items.splice(0, 0, i)
  19742. : i && f.items.splice(0, 0, i)
  19743. continue
  19744. }
  19745. } else i = h
  19746. i && i.id && f.add(i)
  19747. }
  19748. c[d] = f
  19749. }
  19750. for (var j in UE._customizeUI) {
  19751. var k,
  19752. l,
  19753. m = UE._customizeUI[j]
  19754. ;(m.id && m.id != a.key) ||
  19755. ((k = m.execFn.call(a, a, j)),
  19756. k &&
  19757. ((l = m.index),
  19758. void 0 === l && (l = f.items.length),
  19759. f.add(k, l)))
  19760. }
  19761. this.toolbars = c
  19762. },
  19763. getHtmlTpl: function () {
  19764. return (
  19765. '<div id="##" class="%%"><div id="##_toolbarbox" class="%%-toolbarbox">' +
  19766. (this.toolbars.length
  19767. ? '<div id="##_toolbarboxouter" class="%%-toolbarboxouter"><div class="%%-toolbarboxinner">' +
  19768. this.renderToolbarBoxHtml() +
  19769. '</div></div>'
  19770. : '') +
  19771. '<div id="##_toolbarmsg" class="%%-toolbarmsg" style="display:none;"><div id = "##_upload_dialog" class="%%-toolbarmsg-upload" onclick="$$.showWordImageDialog();">' +
  19772. this.editor.getLang('clickToUpload') +
  19773. '</div><div class="%%-toolbarmsg-close" onclick="$$.hideToolbarMsg();">x</div><div id="##_toolbarmsg_label" class="%%-toolbarmsg-label"></div><div style="height:0;overflow:hidden;clear:both;"></div></div><div id="##_message_holder" class="%%-messageholder"></div></div><div id="##_iframeholder" class="%%-iframeholder"></div><div id="##_bottombar" class="%%-bottomContainer"><table><tr><td id="##_elementpath" class="%%-bottombar"></td><td id="##_wordcount" class="%%-wordcount"></td><td id="##_scale" class="%%-scale"><div class="%%-icon"></div></td></tr></table></div><div id="##_scalelayer"></div></div>'
  19774. )
  19775. },
  19776. showWordImageDialog: function () {
  19777. this._dialogs.wordimageDialog.open()
  19778. },
  19779. renderToolbarBoxHtml: function () {
  19780. for (var a = [], b = 0; b < this.toolbars.length; b++)
  19781. a.push(this.toolbars[b].renderHtml())
  19782. return a.join('')
  19783. },
  19784. setFullScreen: function (a) {
  19785. var b = this.editor,
  19786. c = b.container.parentNode.parentNode
  19787. if (this._fullscreen != a) {
  19788. if (
  19789. ((this._fullscreen = a),
  19790. this.editor.fireEvent('beforefullscreenchange', a),
  19791. baidu.editor.browser.gecko)
  19792. )
  19793. var d = b.selection.getRange().createBookmark()
  19794. if (a) {
  19795. for (; 'BODY' != c.tagName; ) {
  19796. var e = baidu.editor.dom.domUtils.getComputedStyle(
  19797. c,
  19798. 'position'
  19799. )
  19800. f.push(e), (c.style.position = 'static'), (c = c.parentNode)
  19801. }
  19802. ;(this._bakHtmlOverflow =
  19803. document.documentElement.style.overflow),
  19804. (this._bakBodyOverflow = document.body.style.overflow),
  19805. (this._bakAutoHeight = this.editor.autoHeightEnabled),
  19806. (this._bakScrollTop = Math.max(
  19807. document.documentElement.scrollTop,
  19808. document.body.scrollTop
  19809. )),
  19810. (this._bakEditorContaninerWidth =
  19811. b.iframe.parentNode.offsetWidth),
  19812. this._bakAutoHeight &&
  19813. ((b.autoHeightEnabled = !1), this.editor.disableAutoHeight()),
  19814. (document.documentElement.style.overflow = 'hidden'),
  19815. window.scrollTo(0, window.scrollY),
  19816. (this._bakCssText = this.getDom().style.cssText),
  19817. (this._bakCssText1 = this.getDom('iframeholder').style.cssText),
  19818. (b.iframe.parentNode.style.width = ''),
  19819. this._updateFullScreen()
  19820. } else {
  19821. for (; 'BODY' != c.tagName; )
  19822. (c.style.position = f.shift()), (c = c.parentNode)
  19823. ;(this.getDom().style.cssText = this._bakCssText),
  19824. (this.getDom('iframeholder').style.cssText = this._bakCssText1),
  19825. this._bakAutoHeight &&
  19826. ((b.autoHeightEnabled = !0), this.editor.enableAutoHeight()),
  19827. (document.documentElement.style.overflow =
  19828. this._bakHtmlOverflow),
  19829. (document.body.style.overflow = this._bakBodyOverflow),
  19830. (b.iframe.parentNode.style.width =
  19831. this._bakEditorContaninerWidth + 'px'),
  19832. window.scrollTo(0, this._bakScrollTop)
  19833. }
  19834. if (browser.gecko && 'true' === b.body.contentEditable) {
  19835. var g = document.createElement('input')
  19836. document.body.appendChild(g),
  19837. (b.body.contentEditable = !1),
  19838. setTimeout(function () {
  19839. g.focus(),
  19840. setTimeout(function () {
  19841. ;(b.body.contentEditable = !0),
  19842. b.fireEvent('fullscreenchanged', a),
  19843. b.selection.getRange().moveToBookmark(d).select(!0),
  19844. baidu.editor.dom.domUtils.remove(g),
  19845. a && window.scroll(0, 0)
  19846. }, 0)
  19847. }, 0)
  19848. }
  19849. 'true' === b.body.contentEditable &&
  19850. (this.editor.fireEvent('fullscreenchanged', a),
  19851. this.triggerLayout())
  19852. }
  19853. },
  19854. _updateFullScreen: function () {
  19855. if (this._fullscreen) {
  19856. var a = c.getViewportRect()
  19857. if (
  19858. ((this.getDom().style.cssText =
  19859. 'border:0;position:absolute;left:0;top:' +
  19860. (this.editor.options.topOffset || 0) +
  19861. 'px;width:' +
  19862. a.width +
  19863. 'px;height:' +
  19864. a.height +
  19865. 'px;z-index:' +
  19866. (1 * this.getDom().style.zIndex + 100)),
  19867. c.setViewportOffset(this.getDom(), {
  19868. left: 0,
  19869. top: this.editor.options.topOffset || 0
  19870. }),
  19871. this.editor.setHeight(
  19872. a.height -
  19873. this.getDom('toolbarbox').offsetHeight -
  19874. this.getDom('bottombar').offsetHeight -
  19875. (this.editor.options.topOffset || 0),
  19876. !0
  19877. ),
  19878. browser.gecko)
  19879. )
  19880. try {
  19881. window.onresize()
  19882. } catch (b) {}
  19883. }
  19884. },
  19885. _updateElementPath: function () {
  19886. var a,
  19887. b = this.getDom('elementpath')
  19888. if (
  19889. this.elementPathEnabled &&
  19890. (a = this.editor.queryCommandValue('elementpath'))
  19891. ) {
  19892. for (var c, d = [], e = 0; (c = a[e]); e++)
  19893. d[e] = this.formatHtml(
  19894. '<span unselectable="on" onclick="$$.editor.execCommand(&quot;elementpath&quot;, &quot;' +
  19895. e +
  19896. '&quot;);">' +
  19897. c +
  19898. '</span>'
  19899. )
  19900. b.innerHTML =
  19901. '<div class="edui-editor-breadcrumb" onmousedown="return false;">' +
  19902. this.editor.getLang('elementPathTip') +
  19903. ': ' +
  19904. d.join(' &gt; ') +
  19905. '</div>'
  19906. } else b.style.display = 'none'
  19907. },
  19908. disableElementPath: function () {
  19909. var a = this.getDom('elementpath')
  19910. ;(a.innerHTML = ''),
  19911. (a.style.display = 'none'),
  19912. (this.elementPathEnabled = !1)
  19913. },
  19914. enableElementPath: function () {
  19915. var a = this.getDom('elementpath')
  19916. ;(a.style.display = ''),
  19917. (this.elementPathEnabled = !0),
  19918. this._updateElementPath()
  19919. },
  19920. _scale: function () {
  19921. function a() {
  19922. ;(o = e.getXY(h)),
  19923. p ||
  19924. (p =
  19925. g.options.minFrameHeight + j.offsetHeight + k.offsetHeight),
  19926. (m.style.cssText =
  19927. 'position:absolute;left:0;display:;top:0;background-color:#41ABFF;opacity:0.4;filter: Alpha(opacity=40);width:' +
  19928. h.offsetWidth +
  19929. 'px;height:' +
  19930. h.offsetHeight +
  19931. 'px;z-index:' +
  19932. (g.options.zIndex + 1)),
  19933. e.on(f, 'mousemove', b),
  19934. e.on(i, 'mouseup', c),
  19935. e.on(f, 'mouseup', c)
  19936. }
  19937. function b(a) {
  19938. d()
  19939. var b = a || window.event
  19940. ;(r = b.pageX || f.documentElement.scrollLeft + b.clientX),
  19941. (s = b.pageY || f.documentElement.scrollTop + b.clientY),
  19942. (t = r - o.x),
  19943. (u = s - o.y),
  19944. t >= q && ((n = !0), (m.style.width = t + 'px')),
  19945. u >= p && ((n = !0), (m.style.height = u + 'px'))
  19946. }
  19947. function c() {
  19948. n &&
  19949. ((n = !1),
  19950. (g.ui._actualFrameWidth = m.offsetWidth - 2),
  19951. (h.style.width = g.ui._actualFrameWidth + 'px'),
  19952. g.setHeight(
  19953. m.offsetHeight - k.offsetHeight - j.offsetHeight - 2,
  19954. !0
  19955. )),
  19956. m && (m.style.display = 'none'),
  19957. d(),
  19958. e.un(f, 'mousemove', b),
  19959. e.un(i, 'mouseup', c),
  19960. e.un(f, 'mouseup', c)
  19961. }
  19962. function d() {
  19963. browser.ie
  19964. ? f.selection.clear()
  19965. : window.getSelection().removeAllRanges()
  19966. }
  19967. var f = document,
  19968. g = this.editor,
  19969. h = g.container,
  19970. i = g.document,
  19971. j = this.getDom('toolbarbox'),
  19972. k = this.getDom('bottombar'),
  19973. l = this.getDom('scale'),
  19974. m = this.getDom('scalelayer'),
  19975. n = !1,
  19976. o = null,
  19977. p = 0,
  19978. q = g.options.minFrameWidth,
  19979. r = 0,
  19980. s = 0,
  19981. t = 0,
  19982. u = 0,
  19983. v = this
  19984. this.editor.addListener('fullscreenchanged', function (a, b) {
  19985. if (b) v.disableScale()
  19986. else if (v.editor.options.scaleEnabled) {
  19987. v.enableScale()
  19988. var c = v.editor.document.createElement('span')
  19989. v.editor.body.appendChild(c),
  19990. (v.editor.body.style.height =
  19991. Math.max(e.getXY(c).y, v.editor.iframe.offsetHeight - 20) +
  19992. 'px'),
  19993. e.remove(c)
  19994. }
  19995. }),
  19996. (this.enableScale = function () {
  19997. 1 != g.queryCommandState('source') &&
  19998. ((l.style.display = ''),
  19999. (this.scaleEnabled = !0),
  20000. e.on(l, 'mousedown', a))
  20001. }),
  20002. (this.disableScale = function () {
  20003. ;(l.style.display = 'none'),
  20004. (this.scaleEnabled = !1),
  20005. e.un(l, 'mousedown', a)
  20006. })
  20007. },
  20008. isFullScreen: function () {
  20009. return this._fullscreen
  20010. },
  20011. postRender: function () {
  20012. d.prototype.postRender.call(this)
  20013. for (var a = 0; a < this.toolbars.length; a++)
  20014. this.toolbars[a].postRender()
  20015. var b,
  20016. c = this,
  20017. e = baidu.editor.dom.domUtils,
  20018. f = function () {
  20019. clearTimeout(b),
  20020. (b = setTimeout(function () {
  20021. c._updateFullScreen()
  20022. }))
  20023. }
  20024. e.on(window, 'resize', f),
  20025. c.addListener('destroy', function () {
  20026. e.un(window, 'resize', f), clearTimeout(b)
  20027. })
  20028. },
  20029. showToolbarMsg: function (a, b) {
  20030. if (
  20031. ((this.getDom('toolbarmsg_label').innerHTML = a),
  20032. (this.getDom('toolbarmsg').style.display = ''),
  20033. !b)
  20034. ) {
  20035. var c = this.getDom('upload_dialog')
  20036. c.style.display = 'none'
  20037. }
  20038. },
  20039. hideToolbarMsg: function () {
  20040. this.getDom('toolbarmsg').style.display = 'none'
  20041. },
  20042. mapUrl: function (a) {
  20043. return a
  20044. ? a.replace('~/', this.editor.options.UEDITOR_HOME_URL || '')
  20045. : ''
  20046. },
  20047. triggerLayout: function () {
  20048. var a = this.getDom()
  20049. '1' == a.style.zoom ? (a.style.zoom = '100%') : (a.style.zoom = '1')
  20050. }
  20051. }),
  20052. b.inherits(a, baidu.editor.ui.UIBase)
  20053. var g = {}
  20054. ;(UE.ui.Editor = function (c) {
  20055. var d = new UE.Editor(c)
  20056. ;(d.options.editor = d),
  20057. b.loadFile(document, {
  20058. href: d.options.themePath + d.options.theme + '/css/ueditor.css',
  20059. tag: 'link',
  20060. type: 'text/css',
  20061. rel: 'stylesheet'
  20062. })
  20063. var f = d.render
  20064. return (
  20065. (d.render = function (c) {
  20066. c.constructor === String && ((d.key = c), (g[c] = d)),
  20067. b.domReady(function () {
  20068. function b() {
  20069. if (
  20070. (d.setOpt({
  20071. labelMap: d.options.labelMap || d.getLang('labelMap')
  20072. }),
  20073. new a(d.options),
  20074. c &&
  20075. (c.constructor === String &&
  20076. (c = document.getElementById(c)),
  20077. c &&
  20078. c.getAttribute('name') &&
  20079. (d.options.textarea = c.getAttribute('name')),
  20080. c && /script|textarea/gi.test(c.tagName)))
  20081. ) {
  20082. var b = document.createElement('div')
  20083. c.parentNode.insertBefore(b, c)
  20084. var g = c.value || c.innerHTML
  20085. ;(d.options.initialContent = /^[\t\r\n ]*$/.test(g)
  20086. ? d.options.initialContent
  20087. : g
  20088. .replace(/>[\n\r\t]+([ ]{4})+/g, '>')
  20089. .replace(/[\n\r\t]+([ ]{4})+</g, '<')
  20090. .replace(/>[\n\r\t]+</g, '><')),
  20091. c.className && (b.className = c.className),
  20092. c.style.cssText && (b.style.cssText = c.style.cssText),
  20093. /textarea/i.test(c.tagName)
  20094. ? ((d.textarea = c),
  20095. (d.textarea.style.display = 'none'))
  20096. : c.parentNode.removeChild(c),
  20097. c.id && ((b.id = c.id), e.removeAttributes(c, 'id')),
  20098. (c = b),
  20099. (c.innerHTML = '')
  20100. }
  20101. e.addClass(c, 'edui-' + d.options.theme), d.ui.render(c)
  20102. var h = d.options
  20103. d.container = d.ui.getDom()
  20104. for (
  20105. var i, j = e.findParents(c, !0), k = [], l = 0;
  20106. (i = j[l]);
  20107. l++
  20108. )
  20109. (k[l] = i.style.display), (i.style.display = 'block')
  20110. if (h.initialFrameWidth) h.minFrameWidth = h.initialFrameWidth
  20111. else {
  20112. h.minFrameWidth = h.initialFrameWidth = c.offsetWidth
  20113. var m = c.style.width
  20114. ;/%$/.test(m) && (h.initialFrameWidth = m)
  20115. }
  20116. h.initialFrameHeight
  20117. ? (h.minFrameHeight = h.initialFrameHeight)
  20118. : (h.initialFrameHeight = h.minFrameHeight = c.offsetHeight)
  20119. for (var i, l = 0; (i = j[l]); l++) i.style.display = k[l]
  20120. c.style.height && (c.style.height = ''),
  20121. (d.container.style.width =
  20122. h.initialFrameWidth +
  20123. (/%$/.test(h.initialFrameWidth) ? '' : 'px')),
  20124. (d.container.style.zIndex = h.zIndex),
  20125. f.call(d, d.ui.getDom('iframeholder')),
  20126. d.fireEvent('afteruiready')
  20127. }
  20128. d.langIsReady ? b() : d.addListener('langReady', b)
  20129. })
  20130. }),
  20131. d
  20132. )
  20133. }),
  20134. (UE.getEditor = function (a, b) {
  20135. var c = g[a]
  20136. return c || ((c = g[a] = new UE.ui.Editor(b)), c.render(a)), c
  20137. }),
  20138. (UE.delEditor = function (a) {
  20139. var b
  20140. ;(b = g[a]) && (b.key && b.destroy(), delete g[a])
  20141. }),
  20142. (UE.registerUI = function (a, c, d, e) {
  20143. b.each(a.split(/\s+/), function (a) {
  20144. UE._customizeUI[a] = { id: e, execFn: c, index: d }
  20145. })
  20146. })
  20147. })(),
  20148. UE.registerUI('message', function (a) {
  20149. function b() {
  20150. var a = g.ui.getDom('toolbarbox')
  20151. a && (c.style.top = a.offsetHeight + 3 + 'px'),
  20152. (c.style.zIndex =
  20153. Math.max(g.options.zIndex, g.iframe.style.zIndex) + 1)
  20154. }
  20155. var c,
  20156. d = baidu.editor.ui,
  20157. e = d.Message,
  20158. f = [],
  20159. g = a
  20160. g.addListener('ready', function () {
  20161. ;(c = document.getElementById(g.ui.id + '_message_holder')), b()
  20162. }),
  20163. g.addListener('showmessage', function (a, d) {
  20164. d = utils.isString(d) ? { content: d } : d
  20165. var h = new e({
  20166. timeout: d.timeout,
  20167. type: d.type,
  20168. content: d.content,
  20169. keepshow: d.keepshow,
  20170. editor: g
  20171. }),
  20172. i = d.id || 'msg_' + (+new Date()).toString(36)
  20173. return h.render(c), (f[i] = h), h.reset(d), b(), i
  20174. }),
  20175. g.addListener('updatemessage', function (a, b, d) {
  20176. d = utils.isString(d) ? { content: d } : d
  20177. var e = f[b]
  20178. e.render(c), e && e.reset(d)
  20179. }),
  20180. g.addListener('hidemessage', function (a, b) {
  20181. var c = f[b]
  20182. c && c.hide()
  20183. })
  20184. }),
  20185. UE.registerUI('autosave', function (a) {
  20186. var b = null,
  20187. c = null
  20188. a.on('afterautosave', function () {
  20189. clearTimeout(b),
  20190. (b = setTimeout(function () {
  20191. c && a.trigger('hidemessage', c),
  20192. (c = a.trigger('showmessage', {
  20193. content: a.getLang('autosave.success'),
  20194. timeout: 2e3
  20195. }))
  20196. }, 2e3))
  20197. })
  20198. })
  20199. })()