1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010 |
- /*
- Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
- For licensing, see LICENSE.md or http://ckeditor.com/license
- */
- (function() {
- if(!window.CKEDITOR || !window.CKEDITOR.dom) window.CKEDITOR || (window.CKEDITOR = function() {
- var a = /(^|.*[\\\/])ckeditor\.js(?:\?.*|;.*)?$/i,
- e = {
- timestamp: "F0RF",
- version: "4.4.7 (Standard)",
- revision: "3a35b3d",
- rnd: Math.floor(900 * Math.random()) + 100,
- _: {
- pending: [],
- basePathSrcPattern: a
- },
- status: "unloaded",
- basePath: function() {
- var c = window.CKEDITOR_BASEPATH || "";
- if(!c)
- for(var d = document.getElementsByTagName("script"), b = 0; b < d.length; b++) {
- var f = d[b].src.match(a);
- if(f) {
- c = f[1];
- break
- }
- } - 1 == c.indexOf(":/") &&
- "//" != c.slice(0, 2) && (c = 0 === c.indexOf("/") ? location.href.match(/^.*?:\/\/[^\/]*/)[0] + c : location.href.match(/^[^\?]*\/(?:)/)[0] + c);
- if(!c) throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';
- return c
- }(),
- getUrl: function(a) {
- -1 == a.indexOf(":/") && 0 !== a.indexOf("/") && (a = this.basePath + a);
- this.timestamp && ("/" != a.charAt(a.length - 1) && !/[&?]t=/.test(a)) && (a += (0 <= a.indexOf("?") ? "&" : "?") + "t=" + this.timestamp);
- return a
- },
- domReady: function() {
- function a() {
- try {
- document.addEventListener ? (document.removeEventListener("DOMContentLoaded", a, !1), d()) : document.attachEvent && "complete" === document.readyState && (document.detachEvent("onreadystatechange", a), d())
- } catch(b) {}
- }
- function d() {
- for(var a; a = b.shift();) a()
- }
- var b = [];
- return function(d) {
- function g() {
- try {
- document.documentElement.doScroll("left")
- } catch(k) {
- setTimeout(g, 1);
- return
- }
- a()
- }
- b.push(d);
- "complete" === document.readyState && setTimeout(a, 1);
- if(1 == b.length)
- if(document.addEventListener) document.addEventListener("DOMContentLoaded",
- a, !1), window.addEventListener("load", a, !1);
- else if(document.attachEvent) {
- document.attachEvent("onreadystatechange", a);
- window.attachEvent("onload", a);
- d = !1;
- try {
- d = !window.frameElement
- } catch(e) {}
- document.documentElement.doScroll && d && g()
- }
- }
- }()
- },
- b = window.CKEDITOR_GETURL;
- if(b) {
- var g = e.getUrl;
- e.getUrl = function(a) {
- return b.call(e, a) || g.call(e, a)
- }
- }
- return e
- }()), CKEDITOR.event || (CKEDITOR.event = function() {}, CKEDITOR.event.implementOn = function(a) {
- var e = CKEDITOR.event.prototype,
- b;
- for(b in e) a[b] == null && (a[b] = e[b])
- },
- CKEDITOR.event.prototype = function() {
- function a(a) {
- var c = e(this);
- return c[a] || (c[a] = new b(a))
- }
- var e = function(a) {
- a = a.getPrivate && a.getPrivate() || a._ || (a._ = {});
- return a.events || (a.events = {})
- },
- b = function(a) {
- this.name = a;
- this.listeners = []
- };
- b.prototype = {
- getListenerIndex: function(a) {
- for(var c = 0, d = this.listeners; c < d.length; c++)
- if(d[c].fn == a) return c;
- return -1
- }
- };
- return {
- define: function(b, c) {
- var d = a.call(this, b);
- CKEDITOR.tools.extend(d, c, true)
- },
- on: function(b, c, d, j, f) {
- function h(a, k, f, h) {
- a = {
- name: b,
- sender: this,
- editor: a,
- data: k,
- listenerData: j,
- stop: f,
- cancel: h,
- removeListener: e
- };
- return c.call(d, a) === false ? false : a.data
- }
- function e() {
- n.removeListener(b, c)
- }
- var k = a.call(this, b);
- if(k.getListenerIndex(c) < 0) {
- k = k.listeners;
- d || (d = this);
- isNaN(f) && (f = 10);
- var n = this;
- h.fn = c;
- h.priority = f;
- for(var o = k.length - 1; o >= 0; o--)
- if(k[o].priority <= f) {
- k.splice(o + 1, 0, h);
- return {
- removeListener: e
- }
- }
- k.unshift(h)
- }
- return {
- removeListener: e
- }
- },
- once: function() {
- var a = Array.prototype.slice.call(arguments),
- c = a[1];
- a[1] = function(a) {
- a.removeListener();
- return c.apply(this,
- arguments)
- };
- return this.on.apply(this, a)
- },
- capture: function() {
- CKEDITOR.event.useCapture = 1;
- var a = this.on.apply(this, arguments);
- CKEDITOR.event.useCapture = 0;
- return a
- },
- fire: function() {
- var a = 0,
- c = function() {
- a = 1
- },
- d = 0,
- b = function() {
- d = 1
- };
- return function(f, h, i) {
- var k = e(this)[f],
- f = a,
- n = d;
- a = d = 0;
- if(k) {
- var o = k.listeners;
- if(o.length)
- for(var o = o.slice(0), q, m = 0; m < o.length; m++) {
- if(k.errorProof) try {
- q = o[m].call(this, i, h, c, b)
- } catch(l) {} else q = o[m].call(this, i, h, c, b);
- q === false ? d = 1 : typeof q != "undefined" && (h = q);
- if(a || d) break
- }
- }
- h =
- d ? false : typeof h == "undefined" ? true : h;
- a = f;
- d = n;
- return h
- }
- }(),
- fireOnce: function(a, c, d) {
- c = this.fire(a, c, d);
- delete e(this)[a];
- return c
- },
- removeListener: function(a, c) {
- var d = e(this)[a];
- if(d) {
- var b = d.getListenerIndex(c);
- b >= 0 && d.listeners.splice(b, 1)
- }
- },
- removeAllListeners: function() {
- var a = e(this),
- c;
- for(c in a) delete a[c]
- },
- hasListeners: function(a) {
- return(a = e(this)[a]) && a.listeners.length > 0
- }
- }
- }()), CKEDITOR.editor || (CKEDITOR.editor = function() {
- CKEDITOR._.pending.push([this, arguments]);
- CKEDITOR.event.call(this)
- }, CKEDITOR.editor.prototype.fire =
- function(a, e) {
- a in {
- instanceReady: 1,
- loaded: 1
- } && (this[a] = true);
- return CKEDITOR.event.prototype.fire.call(this, a, e, this)
- }, CKEDITOR.editor.prototype.fireOnce = function(a, e) {
- a in {
- instanceReady: 1,
- loaded: 1
- } && (this[a] = true);
- return CKEDITOR.event.prototype.fireOnce.call(this, a, e, this)
- }, CKEDITOR.event.implementOn(CKEDITOR.editor.prototype)), CKEDITOR.env || (CKEDITOR.env = function() {
- var a = navigator.userAgent.toLowerCase(),
- e = {
- ie: a.indexOf("trident/") > -1,
- webkit: a.indexOf(" applewebkit/") > -1,
- air: a.indexOf(" adobeair/") >
- -1,
- mac: a.indexOf("macintosh") > -1,
- quirks: document.compatMode == "BackCompat" && (!document.documentMode || document.documentMode < 10),
- mobile: a.indexOf("mobile") > -1,
- iOS: /(ipad|iphone|ipod)/.test(a),
- isCustomDomain: function() {
- if(!this.ie) return false;
- var a = document.domain,
- d = window.location.hostname;
- return a != d && a != "[" + d + "]"
- },
- secure: location.protocol == "https:"
- };
- e.gecko = navigator.product == "Gecko" && !e.webkit && !e.ie;
- if(e.webkit) a.indexOf("chrome") > -1 ? e.chrome = true : e.safari = true;
- var b = 0;
- if(e.ie) {
- b = e.quirks || !document.documentMode ?
- parseFloat(a.match(/msie (\d+)/)[1]) : document.documentMode;
- e.ie9Compat = b == 9;
- e.ie8Compat = b == 8;
- e.ie7Compat = b == 7;
- e.ie6Compat = b < 7 || e.quirks
- }
- if(e.gecko) {
- var g = a.match(/rv:([\d\.]+)/);
- if(g) {
- g = g[1].split(".");
- b = g[0] * 1E4 + (g[1] || 0) * 100 + (g[2] || 0) * 1
- }
- }
- e.air && (b = parseFloat(a.match(/ adobeair\/(\d+)/)[1]));
- e.webkit && (b = parseFloat(a.match(/ applewebkit\/(\d+)/)[1]));
- e.version = b;
- e.isCompatible = e.iOS && b >= 534 || !e.mobile && (e.ie && b > 6 || e.gecko && b >= 2E4 || e.air && b >= 1 || e.webkit && b >= 522 || false);
- e.hidpi = window.devicePixelRatio >=
- 2;
- e.needsBrFiller = e.gecko || e.webkit || e.ie && b > 10;
- e.needsNbspFiller = e.ie && b < 11;
- e.cssClass = "cke_browser_" + (e.ie ? "ie" : e.gecko ? "gecko" : e.webkit ? "webkit" : "unknown");
- if(e.quirks) e.cssClass = e.cssClass + " cke_browser_quirks";
- if(e.ie) e.cssClass = e.cssClass + (" cke_browser_ie" + (e.quirks ? "6 cke_browser_iequirks" : e.version));
- if(e.air) e.cssClass = e.cssClass + " cke_browser_air";
- if(e.iOS) e.cssClass = e.cssClass + " cke_browser_ios";
- if(e.hidpi) e.cssClass = e.cssClass + " cke_hidpi";
- return e
- }()), "unloaded" == CKEDITOR.status && function() {
- CKEDITOR.event.implementOn(CKEDITOR);
- CKEDITOR.loadFullCore = function() {
- if(CKEDITOR.status != "basic_ready") CKEDITOR.loadFullCore._load = 1;
- else {
- delete CKEDITOR.loadFullCore;
- var a = document.createElement("script");
- a.type = "text/javascript";
- a.src = CKEDITOR.basePath + "ckeditor.js";
- document.getElementsByTagName("head")[0].appendChild(a)
- }
- };
- CKEDITOR.loadFullCoreTimeout = 0;
- CKEDITOR.add = function(a) {
- (this._.pending || (this._.pending = [])).push(a)
- };
- (function() {
- CKEDITOR.domReady(function() {
- var a = CKEDITOR.loadFullCore,
- e = CKEDITOR.loadFullCoreTimeout;
- if(a) {
- CKEDITOR.status =
- "basic_ready";
- a && a._load ? a() : e && setTimeout(function() {
- CKEDITOR.loadFullCore && CKEDITOR.loadFullCore()
- }, e * 1E3)
- }
- })
- })();
- CKEDITOR.status = "basic_loaded"
- }(), CKEDITOR.dom = {},
- function() {
- var a = [],
- e = CKEDITOR.env.gecko ? "-moz-" : CKEDITOR.env.webkit ? "-webkit-" : CKEDITOR.env.ie ? "-ms-" : "",
- b = /&/g,
- g = />/g,
- c = /</g,
- d = /"/g,
- j = /&/g,
- f = />/g,
- h = /</g,
- i = /"/g;
- CKEDITOR.on("reset", function() {
- a = []
- });
- CKEDITOR.tools = {
- arrayCompare: function(a, c) {
- if(!a && !c) return true;
- if(!a || !c || a.length != c.length) return false;
- for(var d = 0; d <
- a.length; d++)
- if(a[d] != c[d]) return false;
- return true
- },
- clone: function(a) {
- var c;
- if(a && a instanceof Array) {
- c = [];
- for(var d = 0; d < a.length; d++) c[d] = CKEDITOR.tools.clone(a[d]);
- return c
- }
- if(a === null || typeof a != "object" || a instanceof String || a instanceof Number || a instanceof Boolean || a instanceof Date || a instanceof RegExp || a.nodeType || a.window === a) return a;
- c = new a.constructor;
- for(d in a) c[d] = CKEDITOR.tools.clone(a[d]);
- return c
- },
- capitalize: function(a, c) {
- return a.charAt(0).toUpperCase() + (c ? a.slice(1) : a.slice(1).toLowerCase())
- },
- extend: function(a) {
- var c = arguments.length,
- d, b;
- if(typeof(d = arguments[c - 1]) == "boolean") c--;
- else if(typeof(d = arguments[c - 2]) == "boolean") {
- b = arguments[c - 1];
- c = c - 2
- }
- for(var f = 1; f < c; f++) {
- var g = arguments[f],
- j;
- for(j in g)
- if(d === true || a[j] == null)
- if(!b || j in b) a[j] = g[j]
- }
- return a
- },
- prototypedCopy: function(a) {
- var c = function() {};
- c.prototype = a;
- return new c
- },
- copy: function(a) {
- var c = {},
- d;
- for(d in a) c[d] = a[d];
- return c
- },
- isArray: function(a) {
- return Object.prototype.toString.call(a) == "[object Array]"
- },
- isEmpty: function(a) {
- for(var c in a)
- if(a.hasOwnProperty(c)) return false;
- return true
- },
- cssVendorPrefix: function(a, c, d) {
- if(d) return e + a + ":" + c + ";" + a + ":" + c;
- d = {};
- d[a] = c;
- d[e + a] = c;
- return d
- },
- cssStyleToDomStyle: function() {
- var a = document.createElement("div").style,
- c = typeof a.cssFloat != "undefined" ? "cssFloat" : typeof a.styleFloat != "undefined" ? "styleFloat" : "float";
- return function(a) {
- return a == "float" ? c : a.replace(/-./g, function(a) {
- return a.substr(1).toUpperCase()
- })
- }
- }(),
- buildStyleHtml: function(a) {
- for(var a = [].concat(a), c, d = [], b = 0; b < a.length; b++)
- if(c = a[b]) /@import|[{}]/.test(c) ? d.push("<style>" +
- c + "</style>") : d.push('<link type="text/css" rel=stylesheet href="' + c + '">');
- return d.join("")
- },
- htmlEncode: function(a) {
- return("" + a).replace(b, "&").replace(g, ">").replace(c, "<")
- },
- htmlDecode: function(a) {
- return a.replace(j, "&").replace(f, ">").replace(h, "<")
- },
- htmlEncodeAttr: function(a) {
- return a.replace(d, """).replace(c, "<").replace(g, ">")
- },
- htmlDecodeAttr: function(a) {
- return a.replace(i, '"').replace(h, "<").replace(f, ">")
- },
- getNextNumber: function() {
- var a = 0;
- return function() {
- return ++a
- }
- }(),
- getNextId: function() {
- return "cke_" + this.getNextNumber()
- },
- override: function(a, c) {
- var d = c(a);
- d.prototype = a.prototype;
- return d
- },
- setTimeout: function(a, c, d, b, f) {
- f || (f = window);
- d || (d = f);
- return f.setTimeout(function() {
- b ? a.apply(d, [].concat(b)) : a.apply(d)
- }, c || 0)
- },
- trim: function() {
- var a = /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;
- return function(c) {
- return c.replace(a, "")
- }
- }(),
- ltrim: function() {
- var a = /^[ \t\n\r]+/g;
- return function(c) {
- return c.replace(a, "")
- }
- }(),
- rtrim: function() {
- var a = /[ \t\n\r]+$/g;
- return function(c) {
- return c.replace(a,
- "")
- }
- }(),
- indexOf: function(a, c) {
- if(typeof c == "function")
- for(var d = 0, b = a.length; d < b; d++) {
- if(c(a[d])) return d
- } else {
- if(a.indexOf) return a.indexOf(c);
- d = 0;
- for(b = a.length; d < b; d++)
- if(a[d] === c) return d
- }
- return -1
- },
- search: function(a, c) {
- var d = CKEDITOR.tools.indexOf(a, c);
- return d >= 0 ? a[d] : null
- },
- bind: function(a, c) {
- return function() {
- return a.apply(c, arguments)
- }
- },
- createClass: function(a) {
- var c = a.$,
- d = a.base,
- b = a.privates || a._,
- f = a.proto,
- a = a.statics;
- !c && (c = function() {
- d && this.base.apply(this, arguments)
- });
- if(b) var g = c,
- c = function() {
- var a =
- this._ || (this._ = {}),
- c;
- for(c in b) {
- var d = b[c];
- a[c] = typeof d == "function" ? CKEDITOR.tools.bind(d, this) : d
- }
- g.apply(this, arguments)
- };
- if(d) {
- c.prototype = this.prototypedCopy(d.prototype);
- c.prototype.constructor = c;
- c.base = d;
- c.baseProto = d.prototype;
- c.prototype.base = function() {
- this.base = d.prototype.base;
- d.apply(this, arguments);
- this.base = arguments.callee
- }
- }
- f && this.extend(c.prototype, f, true);
- a && this.extend(c, a, true);
- return c
- },
- addFunction: function(c, d) {
- return a.push(function() {
- return c.apply(d || this, arguments)
- }) - 1
- },
- removeFunction: function(c) {
- a[c] = null
- },
- callFunction: function(c) {
- var d = a[c];
- return d && d.apply(window, Array.prototype.slice.call(arguments, 1))
- },
- cssLength: function() {
- var a = /^-?\d+\.?\d*px$/,
- c;
- return function(d) {
- c = CKEDITOR.tools.trim(d + "") + "px";
- return a.test(c) ? c : d || ""
- }
- }(),
- convertToPx: function() {
- var a;
- return function(c) {
- if(!a) {
- a = CKEDITOR.dom.element.createFromHtml('<div style="position:absolute;left:-9999px;top:-9999px;margin:0px;padding:0px;border:0px;"></div>', CKEDITOR.document);
- CKEDITOR.document.getBody().append(a)
- }
- if(!/%$/.test(c)) {
- a.setStyle("width",
- c);
- return a.$.clientWidth
- }
- return c
- }
- }(),
- repeat: function(a, c) {
- return Array(c + 1).join(a)
- },
- tryThese: function() {
- for(var a, c = 0, d = arguments.length; c < d; c++) {
- var b = arguments[c];
- try {
- a = b();
- break
- } catch(f) {}
- }
- return a
- },
- genKey: function() {
- return Array.prototype.slice.call(arguments).join("-")
- },
- defer: function(a) {
- return function() {
- var c = arguments,
- d = this;
- window.setTimeout(function() {
- a.apply(d, c)
- }, 0)
- }
- },
- normalizeCssText: function(a, c) {
- var d = [],
- b, f = CKEDITOR.tools.parseCssText(a, true, c);
- for(b in f) d.push(b + ":" + f[b]);
- d.sort();
- return d.length ? d.join(";") + ";" : ""
- },
- convertRgbToHex: function(a) {
- return a.replace(/(?:rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\))/gi, function(a, c, d, b) {
- a = [c, d, b];
- for(c = 0; c < 3; c++) a[c] = ("0" + parseInt(a[c], 10).toString(16)).slice(-2);
- return "#" + a.join("")
- })
- },
- parseCssText: function(a, c, d) {
- var b = {};
- if(d) {
- d = new CKEDITOR.dom.element("span");
- d.setAttribute("style", a);
- a = CKEDITOR.tools.convertRgbToHex(d.getAttribute("style") || "")
- }
- if(!a || a == ";") return b;
- a.replace(/"/g, '"').replace(/\s*([^:;\s]+)\s*:\s*([^;]+)\s*(?=;|$)/g,
- function(a, d, f) {
- if(c) {
- d = d.toLowerCase();
- d == "font-family" && (f = f.toLowerCase().replace(/["']/g, "").replace(/\s*,\s*/g, ","));
- f = CKEDITOR.tools.trim(f)
- }
- b[d] = f
- });
- return b
- },
- writeCssText: function(a, c) {
- var d, b = [];
- for(d in a) b.push(d + ":" + a[d]);
- c && b.sort();
- return b.join("; ")
- },
- objectCompare: function(a, c, d) {
- var b;
- if(!a && !c) return true;
- if(!a || !c) return false;
- for(b in a)
- if(a[b] != c[b]) return false;
- if(!d)
- for(b in c)
- if(a[b] != c[b]) return false;
- return true
- },
- objectKeys: function(a) {
- var c = [],
- d;
- for(d in a) c.push(d);
- return c
- },
- convertArrayToObject: function(a, c) {
- var d = {};
- arguments.length == 1 && (c = true);
- for(var b = 0, f = a.length; b < f; ++b) d[a[b]] = c;
- return d
- },
- fixDomain: function() {
- for(var a;;) try {
- a = window.parent.document.domain;
- break
- } catch(c) {
- a = a ? a.replace(/.+?(?:\.|$)/, "") : document.domain;
- if(!a) break;
- document.domain = a
- }
- return !!a
- },
- eventsBuffer: function(a, c) {
- function d() {
- f = (new Date).getTime();
- b = false;
- c()
- }
- var b, f = 0;
- return {
- input: function() {
- if(!b) {
- var c = (new Date).getTime() - f;
- c < a ? b = setTimeout(d, a - c) : d()
- }
- },
- reset: function() {
- b && clearTimeout(b);
- b = f = 0
- }
- }
- },
- enableHtml5Elements: function(a, c) {
- for(var d = ["abbr", "article", "aside", "audio", "bdi", "canvas", "data", "datalist", "details", "figcaption", "figure", "footer", "header", "hgroup", "mark", "meter", "nav", "output", "progress", "section", "summary", "time", "video"], b = d.length, f; b--;) {
- f = a.createElement(d[b]);
- c && a.appendChild(f)
- }
- },
- checkIfAnyArrayItemMatches: function(a, c) {
- for(var d = 0, b = a.length; d < b; ++d)
- if(a[d].match(c)) return true;
- return false
- },
- checkIfAnyObjectPropertyMatches: function(a, c) {
- for(var d in a)
- if(d.match(c)) return true;
- return false
- },
- transparentImageData: "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw=="
- }
- }(), CKEDITOR.dtd = function() {
- var a = CKEDITOR.tools.extend,
- e = function(a, c) {
- for(var d = CKEDITOR.tools.clone(a), b = 1; b < arguments.length; b++) {
- var c = arguments[b],
- f;
- for(f in c) delete d[f]
- }
- return d
- },
- b = {},
- g = {},
- c = {
- address: 1,
- article: 1,
- aside: 1,
- blockquote: 1,
- details: 1,
- div: 1,
- dl: 1,
- fieldset: 1,
- figure: 1,
- footer: 1,
- form: 1,
- h1: 1,
- h2: 1,
- h3: 1,
- h4: 1,
- h5: 1,
- h6: 1,
- header: 1,
- hgroup: 1,
- hr: 1,
- main: 1,
- menu: 1,
- nav: 1,
- ol: 1,
- p: 1,
- pre: 1,
- section: 1,
- table: 1,
- ul: 1
- },
- d = {
- command: 1,
- link: 1,
- meta: 1,
- noscript: 1,
- script: 1,
- style: 1
- },
- j = {},
- f = {
- "#": 1
- },
- h = {
- center: 1,
- dir: 1,
- noframes: 1
- };
- a(b, {
- a: 1,
- abbr: 1,
- area: 1,
- audio: 1,
- b: 1,
- bdi: 1,
- bdo: 1,
- br: 1,
- button: 1,
- canvas: 1,
- cite: 1,
- code: 1,
- command: 1,
- datalist: 1,
- del: 1,
- dfn: 1,
- em: 1,
- embed: 1,
- i: 1,
- iframe: 1,
- img: 1,
- input: 1,
- ins: 1,
- kbd: 1,
- keygen: 1,
- label: 1,
- map: 1,
- mark: 1,
- meter: 1,
- noscript: 1,
- object: 1,
- output: 1,
- progress: 1,
- q: 1,
- ruby: 1,
- s: 1,
- samp: 1,
- script: 1,
- select: 1,
- small: 1,
- span: 1,
- strong: 1,
- sub: 1,
- sup: 1,
- textarea: 1,
- time: 1,
- u: 1,
- "var": 1,
- video: 1,
- wbr: 1
- }, f, {
- acronym: 1,
- applet: 1,
- basefont: 1,
- big: 1,
- font: 1,
- isindex: 1,
- strike: 1,
- style: 1,
- tt: 1
- });
- a(g, c, b, h);
- e = {
- a: e(b, {
- a: 1,
- button: 1
- }),
- abbr: b,
- address: g,
- area: j,
- article: g,
- aside: g,
- audio: a({
- source: 1,
- track: 1
- }, g),
- b: b,
- base: j,
- bdi: b,
- bdo: b,
- blockquote: g,
- body: g,
- br: j,
- button: e(b, {
- a: 1,
- button: 1
- }),
- canvas: b,
- caption: g,
- cite: b,
- code: b,
- col: j,
- colgroup: {
- col: 1
- },
- command: j,
- datalist: a({
- option: 1
- }, b),
- dd: g,
- del: b,
- details: a({
- summary: 1
- }, g),
- dfn: b,
- div: g,
- dl: {
- dt: 1,
- dd: 1
- },
- dt: g,
- em: b,
- embed: j,
- fieldset: a({
- legend: 1
- }, g),
- figcaption: g,
- figure: a({
- figcaption: 1
- }, g),
- footer: g,
- form: g,
- h1: b,
- h2: b,
- h3: b,
- h4: b,
- h5: b,
- h6: b,
- head: a({
- title: 1,
- base: 1
- }, d),
- header: g,
- hgroup: {
- h1: 1,
- h2: 1,
- h3: 1,
- h4: 1,
- h5: 1,
- h6: 1
- },
- hr: j,
- html: a({
- head: 1,
- body: 1
- }, g, d),
- i: b,
- iframe: f,
- img: j,
- input: j,
- ins: b,
- kbd: b,
- keygen: j,
- label: b,
- legend: b,
- li: g,
- link: j,
- main: g,
- map: g,
- mark: b,
- menu: a({
- li: 1
- }, g),
- meta: j,
- meter: e(b, {
- meter: 1
- }),
- nav: g,
- noscript: a({
- link: 1,
- meta: 1,
- style: 1
- }, b),
- object: a({
- param: 1
- }, b),
- ol: {
- li: 1
- },
- optgroup: {
- option: 1
- },
- option: f,
- output: b,
- p: b,
- param: j,
- pre: b,
- progress: e(b, {
- progress: 1
- }),
- q: b,
- rp: b,
- rt: b,
- ruby: a({
- rp: 1,
- rt: 1
- }, b),
- s: b,
- samp: b,
- script: f,
- section: g,
- select: {
- optgroup: 1,
- option: 1
- },
- small: b,
- source: j,
- span: b,
- strong: b,
- style: f,
- sub: b,
- summary: b,
- sup: b,
- table: {
- caption: 1,
- colgroup: 1,
- thead: 1,
- tfoot: 1,
- tbody: 1,
- tr: 1
- },
- tbody: {
- tr: 1
- },
- td: g,
- textarea: f,
- tfoot: {
- tr: 1
- },
- th: g,
- thead: {
- tr: 1
- },
- time: e(b, {
- time: 1
- }),
- title: f,
- tr: {
- th: 1,
- td: 1
- },
- track: j,
- u: b,
- ul: {
- li: 1
- },
- "var": b,
- video: a({
- source: 1,
- track: 1
- }, g),
- wbr: j,
- acronym: b,
- applet: a({
- param: 1
- }, g),
- basefont: j,
- big: b,
- center: g,
- dialog: j,
- dir: {
- li: 1
- },
- font: b,
- isindex: j,
- noframes: g,
- strike: b,
- tt: b
- };
- a(e, {
- $block: a({
- audio: 1,
- dd: 1,
- dt: 1,
- figcaption: 1,
- li: 1,
- video: 1
- },
- c, h),
- $blockLimit: {
- article: 1,
- aside: 1,
- audio: 1,
- body: 1,
- caption: 1,
- details: 1,
- dir: 1,
- div: 1,
- dl: 1,
- fieldset: 1,
- figcaption: 1,
- figure: 1,
- footer: 1,
- form: 1,
- header: 1,
- hgroup: 1,
- main: 1,
- menu: 1,
- nav: 1,
- ol: 1,
- section: 1,
- table: 1,
- td: 1,
- th: 1,
- tr: 1,
- ul: 1,
- video: 1
- },
- $cdata: {
- script: 1,
- style: 1
- },
- $editable: {
- address: 1,
- article: 1,
- aside: 1,
- blockquote: 1,
- body: 1,
- details: 1,
- div: 1,
- fieldset: 1,
- figcaption: 1,
- footer: 1,
- form: 1,
- h1: 1,
- h2: 1,
- h3: 1,
- h4: 1,
- h5: 1,
- h6: 1,
- header: 1,
- hgroup: 1,
- main: 1,
- nav: 1,
- p: 1,
- pre: 1,
- section: 1
- },
- $empty: {
- area: 1,
- base: 1,
- basefont: 1,
- br: 1,
- col: 1,
- command: 1,
- dialog: 1,
- embed: 1,
- hr: 1,
- img: 1,
- input: 1,
- isindex: 1,
- keygen: 1,
- link: 1,
- meta: 1,
- param: 1,
- source: 1,
- track: 1,
- wbr: 1
- },
- $inline: b,
- $list: {
- dl: 1,
- ol: 1,
- ul: 1
- },
- $listItem: {
- dd: 1,
- dt: 1,
- li: 1
- },
- $nonBodyContent: a({
- body: 1,
- head: 1,
- html: 1
- }, e.head),
- $nonEditable: {
- applet: 1,
- audio: 1,
- button: 1,
- embed: 1,
- iframe: 1,
- map: 1,
- object: 1,
- option: 1,
- param: 1,
- script: 1,
- textarea: 1,
- video: 1
- },
- $object: {
- applet: 1,
- audio: 1,
- button: 1,
- hr: 1,
- iframe: 1,
- img: 1,
- input: 1,
- object: 1,
- select: 1,
- table: 1,
- textarea: 1,
- video: 1
- },
- $removeEmpty: {
- abbr: 1,
- acronym: 1,
- b: 1,
- bdi: 1,
- bdo: 1,
- big: 1,
- cite: 1,
- code: 1,
- del: 1,
- dfn: 1,
- em: 1,
- font: 1,
- i: 1,
- ins: 1,
- label: 1,
- kbd: 1,
- mark: 1,
- meter: 1,
- output: 1,
- q: 1,
- ruby: 1,
- s: 1,
- samp: 1,
- small: 1,
- span: 1,
- strike: 1,
- strong: 1,
- sub: 1,
- sup: 1,
- time: 1,
- tt: 1,
- u: 1,
- "var": 1
- },
- $tabIndex: {
- a: 1,
- area: 1,
- button: 1,
- input: 1,
- object: 1,
- select: 1,
- textarea: 1
- },
- $tableContent: {
- caption: 1,
- col: 1,
- colgroup: 1,
- tbody: 1,
- td: 1,
- tfoot: 1,
- th: 1,
- thead: 1,
- tr: 1
- },
- $transparent: {
- a: 1,
- audio: 1,
- canvas: 1,
- del: 1,
- ins: 1,
- map: 1,
- noscript: 1,
- object: 1,
- video: 1
- },
- $intermediate: {
- caption: 1,
- colgroup: 1,
- dd: 1,
- dt: 1,
- figcaption: 1,
- legend: 1,
- li: 1,
- optgroup: 1,
- option: 1,
- rp: 1,
- rt: 1,
- summary: 1,
- tbody: 1,
- td: 1,
- tfoot: 1,
- th: 1,
- thead: 1,
- tr: 1
- }
- });
- return e
- }(), CKEDITOR.dom.event = function(a) {
- this.$ = a
- }, CKEDITOR.dom.event.prototype = {
- getKey: function() {
- return this.$.keyCode || this.$.which
- },
- getKeystroke: function() {
- var a = this.getKey();
- if(this.$.ctrlKey || this.$.metaKey) a = a + CKEDITOR.CTRL;
- this.$.shiftKey && (a = a + CKEDITOR.SHIFT);
- this.$.altKey && (a = a + CKEDITOR.ALT);
- return a
- },
- preventDefault: function(a) {
- var e = this.$;
- e.preventDefault ? e.preventDefault() : e.returnValue = false;
- a && this.stopPropagation()
- },
- stopPropagation: function() {
- var a =
- this.$;
- a.stopPropagation ? a.stopPropagation() : a.cancelBubble = true
- },
- getTarget: function() {
- var a = this.$.target || this.$.srcElement;
- return a ? new CKEDITOR.dom.node(a) : null
- },
- getPhase: function() {
- return this.$.eventPhase || 2
- },
- getPageOffset: function() {
- var a = this.getTarget().getDocument().$;
- return {
- x: this.$.pageX || this.$.clientX + (a.documentElement.scrollLeft || a.body.scrollLeft),
- y: this.$.pageY || this.$.clientY + (a.documentElement.scrollTop || a.body.scrollTop)
- }
- }
- }, CKEDITOR.CTRL = 1114112, CKEDITOR.SHIFT = 2228224, CKEDITOR.ALT =
- 4456448, CKEDITOR.EVENT_PHASE_CAPTURING = 1, CKEDITOR.EVENT_PHASE_AT_TARGET = 2, CKEDITOR.EVENT_PHASE_BUBBLING = 3, CKEDITOR.dom.domObject = function(a) {
- if(a) this.$ = a
- }, CKEDITOR.dom.domObject.prototype = function() {
- var a = function(a, b) {
- return function(g) {
- typeof CKEDITOR != "undefined" && a.fire(b, new CKEDITOR.dom.event(g))
- }
- };
- return {
- getPrivate: function() {
- var a;
- if(!(a = this.getCustomData("_"))) this.setCustomData("_", a = {});
- return a
- },
- on: function(e) {
- var b = this.getCustomData("_cke_nativeListeners");
- if(!b) {
- b = {};
- this.setCustomData("_cke_nativeListeners",
- b)
- }
- if(!b[e]) {
- b = b[e] = a(this, e);
- this.$.addEventListener ? this.$.addEventListener(e, b, !!CKEDITOR.event.useCapture) : this.$.attachEvent && this.$.attachEvent("on" + e, b)
- }
- return CKEDITOR.event.prototype.on.apply(this, arguments)
- },
- removeListener: function(a) {
- CKEDITOR.event.prototype.removeListener.apply(this, arguments);
- if(!this.hasListeners(a)) {
- var b = this.getCustomData("_cke_nativeListeners"),
- g = b && b[a];
- if(g) {
- this.$.removeEventListener ? this.$.removeEventListener(a, g, false) : this.$.detachEvent && this.$.detachEvent("on" +
- a, g);
- delete b[a]
- }
- }
- },
- removeAllListeners: function() {
- var a = this.getCustomData("_cke_nativeListeners"),
- b;
- for(b in a) {
- var g = a[b];
- this.$.detachEvent ? this.$.detachEvent("on" + b, g) : this.$.removeEventListener && this.$.removeEventListener(b, g, false);
- delete a[b]
- }
- CKEDITOR.event.prototype.removeAllListeners.call(this)
- }
- }
- }(),
- function(a) {
- var e = {};
- CKEDITOR.on("reset", function() {
- e = {}
- });
- a.equals = function(a) {
- try {
- return a && a.$ === this.$
- } catch(g) {
- return false
- }
- };
- a.setCustomData = function(a, g) {
- var c = this.getUniqueId();
- (e[c] ||
- (e[c] = {}))[a] = g;
- return this
- };
- a.getCustomData = function(a) {
- var g = this.$["data-cke-expando"];
- return(g = g && e[g]) && a in g ? g[a] : null
- };
- a.removeCustomData = function(a) {
- var g = this.$["data-cke-expando"],
- g = g && e[g],
- c, d;
- if(g) {
- c = g[a];
- d = a in g;
- delete g[a]
- }
- return d ? c : null
- };
- a.clearCustomData = function() {
- this.removeAllListeners();
- var a = this.$["data-cke-expando"];
- a && delete e[a]
- };
- a.getUniqueId = function() {
- return this.$["data-cke-expando"] || (this.$["data-cke-expando"] = CKEDITOR.tools.getNextNumber())
- };
- CKEDITOR.event.implementOn(a)
- }(CKEDITOR.dom.domObject.prototype),
- CKEDITOR.dom.node = function(a) {
- return a ? new CKEDITOR.dom[a.nodeType == CKEDITOR.NODE_DOCUMENT ? "document" : a.nodeType == CKEDITOR.NODE_ELEMENT ? "element" : a.nodeType == CKEDITOR.NODE_TEXT ? "text" : a.nodeType == CKEDITOR.NODE_COMMENT ? "comment" : a.nodeType == CKEDITOR.NODE_DOCUMENT_FRAGMENT ? "documentFragment" : "domObject"](a) : this
- }, CKEDITOR.dom.node.prototype = new CKEDITOR.dom.domObject, CKEDITOR.NODE_ELEMENT = 1, CKEDITOR.NODE_DOCUMENT = 9, CKEDITOR.NODE_TEXT = 3, CKEDITOR.NODE_COMMENT = 8, CKEDITOR.NODE_DOCUMENT_FRAGMENT = 11, CKEDITOR.POSITION_IDENTICAL =
- 0, CKEDITOR.POSITION_DISCONNECTED = 1, CKEDITOR.POSITION_FOLLOWING = 2, CKEDITOR.POSITION_PRECEDING = 4, CKEDITOR.POSITION_IS_CONTAINED = 8, CKEDITOR.POSITION_CONTAINS = 16, CKEDITOR.tools.extend(CKEDITOR.dom.node.prototype, {
- appendTo: function(a, e) {
- a.append(this, e);
- return a
- },
- clone: function(a, e) {
- var b = this.$.cloneNode(a),
- g = function(c) {
- c["data-cke-expando"] && (c["data-cke-expando"] = false);
- if(c.nodeType == CKEDITOR.NODE_ELEMENT) {
- e || c.removeAttribute("id", false);
- if(a)
- for(var c = c.childNodes, d = 0; d < c.length; d++) g(c[d])
- }
- };
- g(b);
- return new CKEDITOR.dom.node(b)
- },
- hasPrevious: function() {
- return !!this.$.previousSibling
- },
- hasNext: function() {
- return !!this.$.nextSibling
- },
- insertAfter: function(a) {
- a.$.parentNode.insertBefore(this.$, a.$.nextSibling);
- return a
- },
- insertBefore: function(a) {
- a.$.parentNode.insertBefore(this.$, a.$);
- return a
- },
- insertBeforeMe: function(a) {
- this.$.parentNode.insertBefore(a.$, this.$);
- return a
- },
- getAddress: function(a) {
- for(var e = [], b = this.getDocument().$.documentElement, g = this.$; g && g != b;) {
- var c = g.parentNode;
- c && e.unshift(this.getIndex.call({
- $: g
- },
- a));
- g = c
- }
- return e
- },
- getDocument: function() {
- return new CKEDITOR.dom.document(this.$.ownerDocument || this.$.parentNode.ownerDocument)
- },
- getIndex: function(a) {
- function e(a, c) {
- var b = c ? a.nextSibling : a.previousSibling;
- return !b || b.nodeType != CKEDITOR.NODE_TEXT ? null : b.nodeValue ? b : e(b, c)
- }
- var b = this.$,
- g = -1,
- c;
- if(!this.$.parentNode || a && b.nodeType == CKEDITOR.NODE_TEXT && !b.nodeValue && !e(b) && !e(b, true)) return -1;
- do
- if(!a || !(b != this.$ && b.nodeType == CKEDITOR.NODE_TEXT && (c || !b.nodeValue))) {
- g++;
- c = b.nodeType == CKEDITOR.NODE_TEXT
- }
- while(b =
- b.previousSibling);
- return g
- },
- getNextSourceNode: function(a, e, b) {
- if(b && !b.call) var g = b,
- b = function(a) {
- return !a.equals(g)
- };
- var a = !a && this.getFirst && this.getFirst(),
- c;
- if(!a) {
- if(this.type == CKEDITOR.NODE_ELEMENT && b && b(this, true) === false) return null;
- a = this.getNext()
- }
- for(; !a && (c = (c || this).getParent());) {
- if(b && b(c, true) === false) return null;
- a = c.getNext()
- }
- return !a || b && b(a) === false ? null : e && e != a.type ? a.getNextSourceNode(false, e, b) : a
- },
- getPreviousSourceNode: function(a, e, b) {
- if(b && !b.call) var g = b,
- b = function(a) {
- return !a.equals(g)
- };
- var a = !a && this.getLast && this.getLast(),
- c;
- if(!a) {
- if(this.type == CKEDITOR.NODE_ELEMENT && b && b(this, true) === false) return null;
- a = this.getPrevious()
- }
- for(; !a && (c = (c || this).getParent());) {
- if(b && b(c, true) === false) return null;
- a = c.getPrevious()
- }
- return !a || b && b(a) === false ? null : e && a.type != e ? a.getPreviousSourceNode(false, e, b) : a
- },
- getPrevious: function(a) {
- var e = this.$,
- b;
- do b = (e = e.previousSibling) && e.nodeType != 10 && new CKEDITOR.dom.node(e); while (b && a && !a(b));
- return b
- },
- getNext: function(a) {
- var e = this.$,
- b;
- do b = (e = e.nextSibling) &&
- new CKEDITOR.dom.node(e); while (b && a && !a(b));
- return b
- },
- getParent: function(a) {
- var e = this.$.parentNode;
- return e && (e.nodeType == CKEDITOR.NODE_ELEMENT || a && e.nodeType == CKEDITOR.NODE_DOCUMENT_FRAGMENT) ? new CKEDITOR.dom.node(e) : null
- },
- getParents: function(a) {
- var e = this,
- b = [];
- do b[a ? "push" : "unshift"](e); while (e = e.getParent());
- return b
- },
- getCommonAncestor: function(a) {
- if(a.equals(this)) return this;
- if(a.contains && a.contains(this)) return a;
- var e = this.contains ? this : this.getParent();
- do
- if(e.contains(a)) return e;
- while(e =
- e.getParent());
- return null
- },
- getPosition: function(a) {
- var e = this.$,
- b = a.$;
- if(e.compareDocumentPosition) return e.compareDocumentPosition(b);
- if(e == b) return CKEDITOR.POSITION_IDENTICAL;
- if(this.type == CKEDITOR.NODE_ELEMENT && a.type == CKEDITOR.NODE_ELEMENT) {
- if(e.contains) {
- if(e.contains(b)) return CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING;
- if(b.contains(e)) return CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING
- }
- if("sourceIndex" in e) return e.sourceIndex < 0 || b.sourceIndex < 0 ? CKEDITOR.POSITION_DISCONNECTED :
- e.sourceIndex < b.sourceIndex ? CKEDITOR.POSITION_PRECEDING : CKEDITOR.POSITION_FOLLOWING
- }
- for(var e = this.getAddress(), a = a.getAddress(), b = Math.min(e.length, a.length), g = 0; g <= b - 1; g++)
- if(e[g] != a[g]) {
- if(g < b) return e[g] < a[g] ? CKEDITOR.POSITION_PRECEDING : CKEDITOR.POSITION_FOLLOWING;
- break
- }
- return e.length < a.length ? CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING : CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING
- },
- getAscendant: function(a, e) {
- var b = this.$,
- g, c;
- if(!e) b = b.parentNode;
- if(typeof a == "function") {
- c =
- true;
- g = a
- } else {
- c = false;
- g = function(c) {
- c = typeof c.nodeName == "string" ? c.nodeName.toLowerCase() : "";
- return typeof a == "string" ? c == a : c in a
- }
- }
- for(; b;) {
- if(g(c ? new CKEDITOR.dom.node(b) : b)) return new CKEDITOR.dom.node(b);
- try {
- b = b.parentNode
- } catch(d) {
- b = null
- }
- }
- return null
- },
- hasAscendant: function(a, e) {
- var b = this.$;
- if(!e) b = b.parentNode;
- for(; b;) {
- if(b.nodeName && b.nodeName.toLowerCase() == a) return true;
- b = b.parentNode
- }
- return false
- },
- move: function(a, e) {
- a.append(this.remove(), e)
- },
- remove: function(a) {
- var e = this.$,
- b = e.parentNode;
- if(b) {
- if(a)
- for(; a = e.firstChild;) b.insertBefore(e.removeChild(a), e);
- b.removeChild(e)
- }
- return this
- },
- replace: function(a) {
- this.insertBefore(a);
- a.remove()
- },
- trim: function() {
- this.ltrim();
- this.rtrim()
- },
- ltrim: function() {
- for(var a; this.getFirst && (a = this.getFirst());) {
- if(a.type == CKEDITOR.NODE_TEXT) {
- var e = CKEDITOR.tools.ltrim(a.getText()),
- b = a.getLength();
- if(e) {
- if(e.length < b) {
- a.split(b - e.length);
- this.$.removeChild(this.$.firstChild)
- }
- } else {
- a.remove();
- continue
- }
- }
- break
- }
- },
- rtrim: function() {
- for(var a; this.getLast && (a =
- this.getLast());) {
- if(a.type == CKEDITOR.NODE_TEXT) {
- var e = CKEDITOR.tools.rtrim(a.getText()),
- b = a.getLength();
- if(e) {
- if(e.length < b) {
- a.split(e.length);
- this.$.lastChild.parentNode.removeChild(this.$.lastChild)
- }
- } else {
- a.remove();
- continue
- }
- }
- break
- }
- if(CKEDITOR.env.needsBrFiller)(a = this.$.lastChild) && (a.type == 1 && a.nodeName.toLowerCase() == "br") && a.parentNode.removeChild(a)
- },
- isReadOnly: function() {
- var a = this;
- this.type != CKEDITOR.NODE_ELEMENT && (a = this.getParent());
- if(a && typeof a.$.isContentEditable != "undefined") return !(a.$.isContentEditable ||
- a.data("cke-editable"));
- for(; a;) {
- if(a.data("cke-editable")) break;
- if(a.getAttribute("contentEditable") == "false") return true;
- if(a.getAttribute("contentEditable") == "true") break;
- a = a.getParent()
- }
- return !a
- }
- }), CKEDITOR.dom.window = function(a) {
- CKEDITOR.dom.domObject.call(this, a)
- }, CKEDITOR.dom.window.prototype = new CKEDITOR.dom.domObject, CKEDITOR.tools.extend(CKEDITOR.dom.window.prototype, {
- focus: function() {
- this.$.focus()
- },
- getViewPaneSize: function() {
- var a = this.$.document,
- e = a.compatMode == "CSS1Compat";
- return {
- width: (e ?
- a.documentElement.clientWidth : a.body.clientWidth) || 0,
- height: (e ? a.documentElement.clientHeight : a.body.clientHeight) || 0
- }
- },
- getScrollPosition: function() {
- var a = this.$;
- if("pageXOffset" in a) return {
- x: a.pageXOffset || 0,
- y: a.pageYOffset || 0
- };
- a = a.document;
- return {
- x: a.documentElement.scrollLeft || a.body.scrollLeft || 0,
- y: a.documentElement.scrollTop || a.body.scrollTop || 0
- }
- },
- getFrame: function() {
- var a = this.$.frameElement;
- return a ? new CKEDITOR.dom.element.get(a) : null
- }
- }), CKEDITOR.dom.document = function(a) {
- CKEDITOR.dom.domObject.call(this,
- a)
- }, CKEDITOR.dom.document.prototype = new CKEDITOR.dom.domObject, CKEDITOR.tools.extend(CKEDITOR.dom.document.prototype, {
- type: CKEDITOR.NODE_DOCUMENT,
- appendStyleSheet: function(a) {
- if(this.$.createStyleSheet) this.$.createStyleSheet(a);
- else {
- var e = new CKEDITOR.dom.element("link");
- e.setAttributes({
- rel: "stylesheet",
- type: "text/css",
- href: a
- });
- this.getHead().append(e)
- }
- },
- appendStyleText: function(a) {
- if(this.$.createStyleSheet) {
- var e = this.$.createStyleSheet("");
- e.cssText = a
- } else {
- var b = new CKEDITOR.dom.element("style",
- this);
- b.append(new CKEDITOR.dom.text(a, this));
- this.getHead().append(b)
- }
- return e || b.$.sheet
- },
- createElement: function(a, e) {
- var b = new CKEDITOR.dom.element(a, this);
- if(e) {
- e.attributes && b.setAttributes(e.attributes);
- e.styles && b.setStyles(e.styles)
- }
- return b
- },
- createText: function(a) {
- return new CKEDITOR.dom.text(a, this)
- },
- focus: function() {
- this.getWindow().focus()
- },
- getActive: function() {
- var a;
- try {
- a = this.$.activeElement
- } catch(e) {
- return null
- }
- return new CKEDITOR.dom.element(a)
- },
- getById: function(a) {
- return(a = this.$.getElementById(a)) ?
- new CKEDITOR.dom.element(a) : null
- },
- getByAddress: function(a, e) {
- for(var b = this.$.documentElement, g = 0; b && g < a.length; g++) {
- var c = a[g];
- if(e)
- for(var d = -1, j = 0; j < b.childNodes.length; j++) {
- var f = b.childNodes[j];
- if(!(e === true && f.nodeType == 3 && f.previousSibling && f.previousSibling.nodeType == 3)) {
- d++;
- if(d == c) {
- b = f;
- break
- }
- }
- } else b = b.childNodes[c]
- }
- return b ? new CKEDITOR.dom.node(b) : null
- },
- getElementsByTag: function(a, e) {
- !(CKEDITOR.env.ie && document.documentMode <= 8) && e && (a = e + ":" + a);
- return new CKEDITOR.dom.nodeList(this.$.getElementsByTagName(a))
- },
- getHead: function() {
- var a = this.$.getElementsByTagName("head")[0];
- return a = a ? new CKEDITOR.dom.element(a) : this.getDocumentElement().append(new CKEDITOR.dom.element("head"), true)
- },
- getBody: function() {
- return new CKEDITOR.dom.element(this.$.body)
- },
- getDocumentElement: function() {
- return new CKEDITOR.dom.element(this.$.documentElement)
- },
- getWindow: function() {
- return new CKEDITOR.dom.window(this.$.parentWindow || this.$.defaultView)
- },
- write: function(a) {
- this.$.open("text/html", "replace");
- CKEDITOR.env.ie && (a = a.replace(/(?:^\s*<!DOCTYPE[^>]*?>)|^/i,
- '$&\n<script data-cke-temp="1">(' + CKEDITOR.tools.fixDomain + ")();<\/script>"));
- this.$.write(a);
- this.$.close()
- },
- find: function(a) {
- return new CKEDITOR.dom.nodeList(this.$.querySelectorAll(a))
- },
- findOne: function(a) {
- return(a = this.$.querySelector(a)) ? new CKEDITOR.dom.element(a) : null
- },
- _getHtml5ShivFrag: function() {
- var a = this.getCustomData("html5ShivFrag");
- if(!a) {
- a = this.$.createDocumentFragment();
- CKEDITOR.tools.enableHtml5Elements(a, true);
- this.setCustomData("html5ShivFrag", a)
- }
- return a
- }
- }), CKEDITOR.dom.nodeList =
- function(a) {
- this.$ = a
- }, CKEDITOR.dom.nodeList.prototype = {
- count: function() {
- return this.$.length
- },
- getItem: function(a) {
- if(a < 0 || a >= this.$.length) return null;
- return(a = this.$[a]) ? new CKEDITOR.dom.node(a) : null
- }
- }, CKEDITOR.dom.element = function(a, e) {
- typeof a == "string" && (a = (e ? e.$ : document).createElement(a));
- CKEDITOR.dom.domObject.call(this, a)
- }, CKEDITOR.dom.element.get = function(a) {
- return(a = typeof a == "string" ? document.getElementById(a) || document.getElementsByName(a)[0] : a) && (a.$ ? a : new CKEDITOR.dom.element(a))
- }, CKEDITOR.dom.element.prototype =
- new CKEDITOR.dom.node, CKEDITOR.dom.element.createFromHtml = function(a, e) {
- var b = new CKEDITOR.dom.element("div", e);
- b.setHtml(a);
- return b.getFirst().remove()
- }, CKEDITOR.dom.element.setMarker = function(a, e, b, g) {
- var c = e.getCustomData("list_marker_id") || e.setCustomData("list_marker_id", CKEDITOR.tools.getNextNumber()).getCustomData("list_marker_id"),
- d = e.getCustomData("list_marker_names") || e.setCustomData("list_marker_names", {}).getCustomData("list_marker_names");
- a[c] = e;
- d[b] = 1;
- return e.setCustomData(b, g)
- }, CKEDITOR.dom.element.clearAllMarkers =
- function(a) {
- for(var e in a) CKEDITOR.dom.element.clearMarkers(a, a[e], 1)
- }, CKEDITOR.dom.element.clearMarkers = function(a, e, b) {
- var g = e.getCustomData("list_marker_names"),
- c = e.getCustomData("list_marker_id"),
- d;
- for(d in g) e.removeCustomData(d);
- e.removeCustomData("list_marker_names");
- if(b) {
- e.removeCustomData("list_marker_id");
- delete a[c]
- }
- },
- function() {
- function a(a) {
- var d = true;
- if(!a.$.id) {
- a.$.id = "cke_tmp_" + CKEDITOR.tools.getNextNumber();
- d = false
- }
- return function() {
- d || a.removeAttribute("id")
- }
- }
- function e(a, d) {
- return "#" +
- a.$.id + " " + d.split(/,\s*/).join(", #" + a.$.id + " ")
- }
- function b(a) {
- for(var d = 0, b = 0, f = g[a].length; b < f; b++) d = d + (parseInt(this.getComputedStyle(g[a][b]) || 0, 10) || 0);
- return d
- }
- CKEDITOR.tools.extend(CKEDITOR.dom.element.prototype, {
- type: CKEDITOR.NODE_ELEMENT,
- addClass: function(a) {
- var d = this.$.className;
- d && (RegExp("(?:^|\\s)" + a + "(?:\\s|$)", "").test(d) || (d = d + (" " + a)));
- this.$.className = d || a;
- return this
- },
- removeClass: function(a) {
- var d = this.getAttribute("class");
- if(d) {
- a = RegExp("(?:^|\\s+)" + a + "(?=\\s|$)", "i");
- if(a.test(d))(d =
- d.replace(a, "").replace(/^\s+/, "")) ? this.setAttribute("class", d) : this.removeAttribute("class")
- }
- return this
- },
- hasClass: function(a) {
- return RegExp("(?:^|\\s+)" + a + "(?=\\s|$)", "").test(this.getAttribute("class"))
- },
- append: function(a, d) {
- typeof a == "string" && (a = this.getDocument().createElement(a));
- d ? this.$.insertBefore(a.$, this.$.firstChild) : this.$.appendChild(a.$);
- return a
- },
- appendHtml: function(a) {
- if(this.$.childNodes.length) {
- var d = new CKEDITOR.dom.element("div", this.getDocument());
- d.setHtml(a);
- d.moveChildren(this)
- } else this.setHtml(a)
- },
- appendText: function(a) {
- this.$.text != null ? this.$.text = this.$.text + a : this.append(new CKEDITOR.dom.text(a))
- },
- appendBogus: function(a) {
- if(a || CKEDITOR.env.needsBrFiller) {
- for(a = this.getLast(); a && a.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.rtrim(a.getText());) a = a.getPrevious();
- if(!a || !a.is || !a.is("br")) {
- a = this.getDocument().createElement("br");
- CKEDITOR.env.gecko && a.setAttribute("type", "_moz");
- this.append(a)
- }
- }
- },
- breakParent: function(a) {
- var d = new CKEDITOR.dom.range(this.getDocument());
- d.setStartAfter(this);
- d.setEndAfter(a);
- a = d.extractContents();
- d.insertNode(this.remove());
- a.insertAfterNode(this)
- },
- contains: CKEDITOR.env.ie || CKEDITOR.env.webkit ? function(a) {
- var d = this.$;
- return a.type != CKEDITOR.NODE_ELEMENT ? d.contains(a.getParent().$) : d != a.$ && d.contains(a.$)
- } : function(a) {
- return !!(this.$.compareDocumentPosition(a.$) & 16)
- },
- focus: function() {
- function a() {
- try {
- this.$.focus()
- } catch(c) {}
- }
- return function(d) {
- d ? CKEDITOR.tools.setTimeout(a, 100, this) : a.call(this)
- }
- }(),
- getHtml: function() {
- var a = this.$.innerHTML;
- return CKEDITOR.env.ie ?
- a.replace(/<\?[^>]*>/g, "") : a
- },
- getOuterHtml: function() {
- if(this.$.outerHTML) return this.$.outerHTML.replace(/<\?[^>]*>/, "");
- var a = this.$.ownerDocument.createElement("div");
- a.appendChild(this.$.cloneNode(true));
- return a.innerHTML
- },
- getClientRect: function() {
- var a = CKEDITOR.tools.extend({}, this.$.getBoundingClientRect());
- !a.width && (a.width = a.right - a.left);
- !a.height && (a.height = a.bottom - a.top);
- return a
- },
- setHtml: CKEDITOR.env.ie && CKEDITOR.env.version < 9 ? function(a) {
- try {
- var d = this.$;
- if(this.getParent()) return d.innerHTML =
- a;
- var b = this.getDocument()._getHtml5ShivFrag();
- b.appendChild(d);
- d.innerHTML = a;
- b.removeChild(d);
- return a
- } catch(f) {
- this.$.innerHTML = "";
- d = new CKEDITOR.dom.element("body", this.getDocument());
- d.$.innerHTML = a;
- for(d = d.getChildren(); d.count();) this.append(d.getItem(0));
- return a
- }
- } : function(a) {
- return this.$.innerHTML = a
- },
- setText: function() {
- var a = document.createElement("p");
- a.innerHTML = "x";
- a = a.textContent;
- return function(d) {
- this.$[a ? "textContent" : "innerText"] = d
- }
- }(),
- getAttribute: function() {
- var a = function(a) {
- return this.$.getAttribute(a,
- 2)
- };
- return CKEDITOR.env.ie && (CKEDITOR.env.ie7Compat || CKEDITOR.env.quirks) ? function(a) {
- switch(a) {
- case "class":
- a = "className";
- break;
- case "http-equiv":
- a = "httpEquiv";
- break;
- case "name":
- return this.$.name;
- case "tabindex":
- a = this.$.getAttribute(a, 2);
- a !== 0 && this.$.tabIndex === 0 && (a = null);
- return a;
- case "checked":
- a = this.$.attributes.getNamedItem(a);
- return(a.specified ? a.nodeValue : this.$.checked) ? "checked" : null;
- case "hspace":
- case "value":
- return this.$[a];
- case "style":
- return this.$.style.cssText;
- case "contenteditable":
- case "contentEditable":
- return this.$.attributes.getNamedItem("contentEditable").specified ?
- this.$.getAttribute("contentEditable") : null
- }
- return this.$.getAttribute(a, 2)
- } : a
- }(),
- getChildren: function() {
- return new CKEDITOR.dom.nodeList(this.$.childNodes)
- },
- getComputedStyle: CKEDITOR.env.ie ? function(a) {
- return this.$.currentStyle[CKEDITOR.tools.cssStyleToDomStyle(a)]
- } : function(a) {
- var d = this.getWindow().$.getComputedStyle(this.$, null);
- return d ? d.getPropertyValue(a) : ""
- },
- getDtd: function() {
- var a = CKEDITOR.dtd[this.getName()];
- this.getDtd = function() {
- return a
- };
- return a
- },
- getElementsByTag: CKEDITOR.dom.document.prototype.getElementsByTag,
- getTabIndex: CKEDITOR.env.ie ? function() {
- var a = this.$.tabIndex;
- a === 0 && (!CKEDITOR.dtd.$tabIndex[this.getName()] && parseInt(this.getAttribute("tabindex"), 10) !== 0) && (a = -1);
- return a
- } : CKEDITOR.env.webkit ? function() {
- var a = this.$.tabIndex;
- if(a === void 0) {
- a = parseInt(this.getAttribute("tabindex"), 10);
- isNaN(a) && (a = -1)
- }
- return a
- } : function() {
- return this.$.tabIndex
- },
- getText: function() {
- return this.$.textContent || this.$.innerText || ""
- },
- getWindow: function() {
- return this.getDocument().getWindow()
- },
- getId: function() {
- return this.$.id ||
- null
- },
- getNameAtt: function() {
- return this.$.name || null
- },
- getName: function() {
- var a = this.$.nodeName.toLowerCase();
- if(CKEDITOR.env.ie && document.documentMode <= 8) {
- var d = this.$.scopeName;
- d != "HTML" && (a = d.toLowerCase() + ":" + a)
- }
- this.getName = function() {
- return a
- };
- return this.getName()
- },
- getValue: function() {
- return this.$.value
- },
- getFirst: function(a) {
- var d = this.$.firstChild;
- (d = d && new CKEDITOR.dom.node(d)) && (a && !a(d)) && (d = d.getNext(a));
- return d
- },
- getLast: function(a) {
- var d = this.$.lastChild;
- (d = d && new CKEDITOR.dom.node(d)) &&
- (a && !a(d)) && (d = d.getPrevious(a));
- return d
- },
- getStyle: function(a) {
- return this.$.style[CKEDITOR.tools.cssStyleToDomStyle(a)]
- },
- is: function() {
- var a = this.getName();
- if(typeof arguments[0] == "object") return !!arguments[0][a];
- for(var d = 0; d < arguments.length; d++)
- if(arguments[d] == a) return true;
- return false
- },
- isEditable: function(a) {
- var d = this.getName();
- if(this.isReadOnly() || this.getComputedStyle("display") == "none" || this.getComputedStyle("visibility") == "hidden" || CKEDITOR.dtd.$nonEditable[d] || CKEDITOR.dtd.$empty[d] ||
- this.is("a") && (this.data("cke-saved-name") || this.hasAttribute("name")) && !this.getChildCount()) return false;
- if(a !== false) {
- a = CKEDITOR.dtd[d] || CKEDITOR.dtd.span;
- return !(!a || !a["#"])
- }
- return true
- },
- isIdentical: function(a) {
- var d = this.clone(0, 1),
- a = a.clone(0, 1);
- d.removeAttributes(["_moz_dirty", "data-cke-expando", "data-cke-saved-href", "data-cke-saved-name"]);
- a.removeAttributes(["_moz_dirty", "data-cke-expando", "data-cke-saved-href", "data-cke-saved-name"]);
- if(d.$.isEqualNode) {
- d.$.style.cssText = CKEDITOR.tools.normalizeCssText(d.$.style.cssText);
- a.$.style.cssText = CKEDITOR.tools.normalizeCssText(a.$.style.cssText);
- return d.$.isEqualNode(a.$)
- }
- d = d.getOuterHtml();
- a = a.getOuterHtml();
- if(CKEDITOR.env.ie && CKEDITOR.env.version < 9 && this.is("a")) {
- var b = this.getParent();
- if(b.type == CKEDITOR.NODE_ELEMENT) {
- b = b.clone();
- b.setHtml(d);
- d = b.getHtml();
- b.setHtml(a);
- a = b.getHtml()
- }
- }
- return d == a
- },
- isVisible: function() {
- var a = (this.$.offsetHeight || this.$.offsetWidth) && this.getComputedStyle("visibility") != "hidden",
- d, b;
- if(a && CKEDITOR.env.webkit) {
- d = this.getWindow();
- if(!d.equals(CKEDITOR.document.getWindow()) &&
- (b = d.$.frameElement)) a = (new CKEDITOR.dom.element(b)).isVisible()
- }
- return !!a
- },
- isEmptyInlineRemoveable: function() {
- if(!CKEDITOR.dtd.$removeEmpty[this.getName()]) return false;
- for(var a = this.getChildren(), d = 0, b = a.count(); d < b; d++) {
- var f = a.getItem(d);
- if(!(f.type == CKEDITOR.NODE_ELEMENT && f.data("cke-bookmark")) && (f.type == CKEDITOR.NODE_ELEMENT && !f.isEmptyInlineRemoveable() || f.type == CKEDITOR.NODE_TEXT && CKEDITOR.tools.trim(f.getText()))) return false
- }
- return true
- },
- hasAttributes: CKEDITOR.env.ie && (CKEDITOR.env.ie7Compat ||
- CKEDITOR.env.quirks) ? function() {
- for(var a = this.$.attributes, d = 0; d < a.length; d++) {
- var b = a[d];
- switch(b.nodeName) {
- case "class":
- if(this.getAttribute("class")) return true;
- case "data-cke-expando":
- continue;
- default:
- if(b.specified) return true
- }
- }
- return false
- } : function() {
- var a = this.$.attributes,
- d = a.length,
- b = {
- "data-cke-expando": 1,
- _moz_dirty: 1
- };
- return d > 0 && (d > 2 || !b[a[0].nodeName] || d == 2 && !b[a[1].nodeName])
- },
- hasAttribute: function() {
- function a(c) {
- var b = this.$.attributes.getNamedItem(c);
- if(this.getName() == "input") switch(c) {
- case "class":
- return this.$.className.length >
- 0;
- case "checked":
- return !!this.$.checked;
- case "value":
- c = this.getAttribute("type");
- return c == "checkbox" || c == "radio" ? this.$.value != "on" : !!this.$.value
- }
- return !b ? false : b.specified
- }
- return CKEDITOR.env.ie ? CKEDITOR.env.version < 8 ? function(d) {
- return d == "name" ? !!this.$.name : a.call(this, d)
- } : a : function(a) {
- return !!this.$.attributes.getNamedItem(a)
- }
- }(),
- hide: function() {
- this.setStyle("display", "none")
- },
- moveChildren: function(a, d) {
- var b = this.$,
- a = a.$;
- if(b != a) {
- var f;
- if(d)
- for(; f = b.lastChild;) a.insertBefore(b.removeChild(f),
- a.firstChild);
- else
- for(; f = b.firstChild;) a.appendChild(b.removeChild(f))
- }
- },
- mergeSiblings: function() {
- function a(c, b, f) {
- if(b && b.type == CKEDITOR.NODE_ELEMENT) {
- for(var g = []; b.data("cke-bookmark") || b.isEmptyInlineRemoveable();) {
- g.push(b);
- b = f ? b.getNext() : b.getPrevious();
- if(!b || b.type != CKEDITOR.NODE_ELEMENT) return
- }
- if(c.isIdentical(b)) {
- for(var e = f ? c.getLast() : c.getFirst(); g.length;) g.shift().move(c, !f);
- b.moveChildren(c, !f);
- b.remove();
- e && e.type == CKEDITOR.NODE_ELEMENT && e.mergeSiblings()
- }
- }
- }
- return function(d) {
- if(d ===
- false || CKEDITOR.dtd.$removeEmpty[this.getName()] || this.is("a")) {
- a(this, this.getNext(), true);
- a(this, this.getPrevious())
- }
- }
- }(),
- show: function() {
- this.setStyles({
- display: "",
- visibility: ""
- })
- },
- setAttribute: function() {
- var a = function(a, c) {
- this.$.setAttribute(a, c);
- return this
- };
- return CKEDITOR.env.ie && (CKEDITOR.env.ie7Compat || CKEDITOR.env.quirks) ? function(d, b) {
- d == "class" ? this.$.className = b : d == "style" ? this.$.style.cssText = b : d == "tabindex" ? this.$.tabIndex = b : d == "checked" ? this.$.checked = b : d == "contenteditable" ? a.call(this,
- "contentEditable", b) : a.apply(this, arguments);
- return this
- } : CKEDITOR.env.ie8Compat && CKEDITOR.env.secure ? function(b, g) {
- if(b == "src" && g.match(/^http:\/\//)) try {
- a.apply(this, arguments)
- } catch(f) {} else a.apply(this, arguments);
- return this
- } : a
- }(),
- setAttributes: function(a) {
- for(var b in a) this.setAttribute(b, a[b]);
- return this
- },
- setValue: function(a) {
- this.$.value = a;
- return this
- },
- removeAttribute: function() {
- var a = function(a) {
- this.$.removeAttribute(a)
- };
- return CKEDITOR.env.ie && (CKEDITOR.env.ie7Compat || CKEDITOR.env.quirks) ?
- function(a) {
- a == "class" ? a = "className" : a == "tabindex" ? a = "tabIndex" : a == "contenteditable" && (a = "contentEditable");
- this.$.removeAttribute(a)
- } : a
- }(),
- removeAttributes: function(a) {
- if(CKEDITOR.tools.isArray(a))
- for(var b = 0; b < a.length; b++) this.removeAttribute(a[b]);
- else
- for(b in a) a.hasOwnProperty(b) && this.removeAttribute(b)
- },
- removeStyle: function(a) {
- var b = this.$.style;
- if(!b.removeProperty && (a == "border" || a == "margin" || a == "padding")) {
- var g = ["top", "left", "right", "bottom"],
- f;
- a == "border" && (f = ["color", "style", "width"]);
- for(var b = [], h = 0; h < g.length; h++)
- if(f)
- for(var e = 0; e < f.length; e++) b.push([a, g[h], f[e]].join("-"));
- else b.push([a, g[h]].join("-"));
- for(a = 0; a < b.length; a++) this.removeStyle(b[a])
- } else {
- b.removeProperty ? b.removeProperty(a) : b.removeAttribute(CKEDITOR.tools.cssStyleToDomStyle(a));
- this.$.style.cssText || this.removeAttribute("style")
- }
- },
- setStyle: function(a, b) {
- this.$.style[CKEDITOR.tools.cssStyleToDomStyle(a)] = b;
- return this
- },
- setStyles: function(a) {
- for(var b in a) this.setStyle(b, a[b]);
- return this
- },
- setOpacity: function(a) {
- if(CKEDITOR.env.ie &&
- CKEDITOR.env.version < 9) {
- a = Math.round(a * 100);
- this.setStyle("filter", a >= 100 ? "" : "progid:DXImageTransform.Microsoft.Alpha(opacity=" + a + ")")
- } else this.setStyle("opacity", a)
- },
- unselectable: function() {
- this.setStyles(CKEDITOR.tools.cssVendorPrefix("user-select", "none"));
- if(CKEDITOR.env.ie) {
- this.setAttribute("unselectable", "on");
- for(var a, b = this.getElementsByTag("*"), g = 0, f = b.count(); g < f; g++) {
- a = b.getItem(g);
- a.setAttribute("unselectable", "on")
- }
- }
- },
- getPositionedAncestor: function() {
- for(var a = this; a.getName() != "html";) {
- if(a.getComputedStyle("position") !=
- "static") return a;
- a = a.getParent()
- }
- return null
- },
- getDocumentPosition: function(a) {
- var b = 0,
- g = 0,
- f = this.getDocument(),
- h = f.getBody(),
- e = CKEDITOR.env.quirks;
- if(document.documentElement.getBoundingClientRect) {
- var k = this.$.getBoundingClientRect(),
- n = f.$.documentElement,
- o = n.clientTop || h.$.clientTop || 0,
- q = n.clientLeft || h.$.clientLeft || 0,
- m = true;
- if(CKEDITOR.env.ie) {
- m = f.getDocumentElement().contains(this);
- f = f.getBody().contains(this);
- m = e && f || !e && m
- }
- if(m) {
- if(CKEDITOR.env.webkit) {
- b = h.$.scrollLeft || n.scrollLeft;
- g = h.$.scrollTop ||
- n.scrollTop
- } else {
- g = e ? h.$ : n;
- b = g.scrollLeft;
- g = g.scrollTop
- }
- b = k.left + b - q;
- g = k.top + g - o
- }
- } else {
- o = this;
- for(q = null; o && !(o.getName() == "body" || o.getName() == "html");) {
- b = b + (o.$.offsetLeft - o.$.scrollLeft);
- g = g + (o.$.offsetTop - o.$.scrollTop);
- if(!o.equals(this)) {
- b = b + (o.$.clientLeft || 0);
- g = g + (o.$.clientTop || 0)
- }
- for(; q && !q.equals(o);) {
- b = b - q.$.scrollLeft;
- g = g - q.$.scrollTop;
- q = q.getParent()
- }
- q = o;
- o = (k = o.$.offsetParent) ? new CKEDITOR.dom.element(k) : null
- }
- }
- if(a) {
- k = this.getWindow();
- o = a.getWindow();
- if(!k.equals(o) && k.$.frameElement) {
- a =
- (new CKEDITOR.dom.element(k.$.frameElement)).getDocumentPosition(a);
- b = b + a.x;
- g = g + a.y
- }
- }
- if(!document.documentElement.getBoundingClientRect && CKEDITOR.env.gecko && !e) {
- b = b + (this.$.clientLeft ? 1 : 0);
- g = g + (this.$.clientTop ? 1 : 0)
- }
- return {
- x: b,
- y: g
- }
- },
- scrollIntoView: function(a) {
- var b = this.getParent();
- if(b) {
- do {
- (b.$.clientWidth && b.$.clientWidth < b.$.scrollWidth || b.$.clientHeight && b.$.clientHeight < b.$.scrollHeight) && !b.is("body") && this.scrollIntoParent(b, a, 1);
- if(b.is("html")) {
- var g = b.getWindow();
- try {
- var f = g.$.frameElement;
- f && (b = new CKEDITOR.dom.element(f))
- } catch(h) {}
- }
- } while (b = b.getParent())
- }
- },
- scrollIntoParent: function(a, b, g) {
- var f, h, e, k;
- function n(b, d) {
- if(/body|html/.test(a.getName())) a.getWindow().$.scrollBy(b, d);
- else {
- a.$.scrollLeft = a.$.scrollLeft + b;
- a.$.scrollTop = a.$.scrollTop + d
- }
- }
- function o(a, b) {
- var c = {
- x: 0,
- y: 0
- };
- if(!a.is(m ? "body" : "html")) {
- var d = a.$.getBoundingClientRect();
- c.x = d.left;
- c.y = d.top
- }
- d = a.getWindow();
- if(!d.equals(b)) {
- d = o(CKEDITOR.dom.element.get(d.$.frameElement), b);
- c.x = c.x + d.x;
- c.y = c.y + d.y
- }
- return c
- }
- function q(a,
- b) {
- return parseInt(a.getComputedStyle("margin-" + b) || 0, 10) || 0
- }!a && (a = this.getWindow());
- e = a.getDocument();
- var m = e.$.compatMode == "BackCompat";
- a instanceof CKEDITOR.dom.window && (a = m ? e.getBody() : e.getDocumentElement());
- e = a.getWindow();
- h = o(this, e);
- var l = o(a, e),
- p = this.$.offsetHeight;
- f = this.$.offsetWidth;
- var t = a.$.clientHeight,
- s = a.$.clientWidth;
- e = h.x - q(this, "left") - l.x || 0;
- k = h.y - q(this, "top") - l.y || 0;
- f = h.x + f + q(this, "right") - (l.x + s) || 0;
- h = h.y + p + q(this, "bottom") - (l.y + t) || 0;
- if(k < 0 || h > 0) n(0, b === true ? k : b === false ?
- h : k < 0 ? k : h);
- if(g && (e < 0 || f > 0)) n(e < 0 ? e : f, 0)
- },
- setState: function(a, b, g) {
- b = b || "cke";
- switch(a) {
- case CKEDITOR.TRISTATE_ON:
- this.addClass(b + "_on");
- this.removeClass(b + "_off");
- this.removeClass(b + "_disabled");
- g && this.setAttribute("aria-pressed", true);
- g && this.removeAttribute("aria-disabled");
- break;
- case CKEDITOR.TRISTATE_DISABLED:
- this.addClass(b + "_disabled");
- this.removeClass(b + "_off");
- this.removeClass(b + "_on");
- g && this.setAttribute("aria-disabled", true);
- g && this.removeAttribute("aria-pressed");
- break;
- default:
- this.addClass(b +
- "_off");
- this.removeClass(b + "_on");
- this.removeClass(b + "_disabled");
- g && this.removeAttribute("aria-pressed");
- g && this.removeAttribute("aria-disabled")
- }
- },
- getFrameDocument: function() {
- var a = this.$;
- try {
- a.contentWindow.document
- } catch(b) {
- a.src = a.src
- }
- return a && new CKEDITOR.dom.document(a.contentWindow.document)
- },
- copyAttributes: function(a, b) {
- for(var g = this.$.attributes, b = b || {}, f = 0; f < g.length; f++) {
- var h = g[f],
- e = h.nodeName.toLowerCase(),
- k;
- if(!(e in b))
- if(e == "checked" && (k = this.getAttribute(e))) a.setAttribute(e, k);
- else if(!CKEDITOR.env.ie || this.hasAttribute(e)) {
- k = this.getAttribute(e);
- if(k === null) k = h.nodeValue;
- a.setAttribute(e, k)
- }
- }
- if(this.$.style.cssText !== "") a.$.style.cssText = this.$.style.cssText
- },
- renameNode: function(a) {
- if(this.getName() != a) {
- var b = this.getDocument(),
- a = new CKEDITOR.dom.element(a, b);
- this.copyAttributes(a);
- this.moveChildren(a);
- this.getParent() && this.$.parentNode.replaceChild(a.$, this.$);
- a.$["data-cke-expando"] = this.$["data-cke-expando"];
- this.$ = a.$;
- delete this.getName
- }
- },
- getChild: function() {
- function a(b,
- c) {
- var f = b.childNodes;
- if(c >= 0 && c < f.length) return f[c]
- }
- return function(b) {
- var g = this.$;
- if(b.slice)
- for(; b.length > 0 && g;) g = a(g, b.shift());
- else g = a(g, b);
- return g ? new CKEDITOR.dom.node(g) : null
- }
- }(),
- getChildCount: function() {
- return this.$.childNodes.length
- },
- disableContextMenu: function() {
- this.on("contextmenu", function(a) {
- a.data.getTarget().hasClass("cke_enable_context_menu") || a.data.preventDefault()
- })
- },
- getDirection: function(a) {
- return a ? this.getComputedStyle("direction") || this.getDirection() || this.getParent() &&
- this.getParent().getDirection(1) || this.getDocument().$.dir || "ltr" : this.getStyle("direction") || this.getAttribute("dir")
- },
- data: function(a, b) {
- a = "data-" + a;
- if(b === void 0) return this.getAttribute(a);
- b === false ? this.removeAttribute(a) : this.setAttribute(a, b);
- return null
- },
- getEditor: function() {
- var a = CKEDITOR.instances,
- b, g;
- for(b in a) {
- g = a[b];
- if(g.element.equals(this) && g.elementMode != CKEDITOR.ELEMENT_MODE_APPENDTO) return g
- }
- return null
- },
- find: function(b) {
- var d = a(this),
- b = new CKEDITOR.dom.nodeList(this.$.querySelectorAll(e(this,
- b)));
- d();
- return b
- },
- findOne: function(b) {
- var d = a(this),
- b = this.$.querySelector(e(this, b));
- d();
- return b ? new CKEDITOR.dom.element(b) : null
- },
- forEach: function(a, b, g) {
- if(!g && (!b || this.type == b)) var f = a(this);
- if(f !== false)
- for(var g = this.getChildren(), h = 0; h < g.count(); h++) {
- f = g.getItem(h);
- f.type == CKEDITOR.NODE_ELEMENT ? f.forEach(a, b) : (!b || f.type == b) && a(f)
- }
- }
- });
- var g = {
- width: ["border-left-width", "border-right-width", "padding-left", "padding-right"],
- height: ["border-top-width", "border-bottom-width", "padding-top", "padding-bottom"]
- };
- CKEDITOR.dom.element.prototype.setSize = function(a, d, g) {
- if(typeof d == "number") {
- if(g && (!CKEDITOR.env.ie || !CKEDITOR.env.quirks)) d = d - b.call(this, a);
- this.setStyle(a, d + "px")
- }
- };
- CKEDITOR.dom.element.prototype.getSize = function(a, d) {
- var g = Math.max(this.$["offset" + CKEDITOR.tools.capitalize(a)], this.$["client" + CKEDITOR.tools.capitalize(a)]) || 0;
- d && (g = g - b.call(this, a));
- return g
- }
- }(), CKEDITOR.dom.documentFragment = function(a) {
- a = a || CKEDITOR.document;
- this.$ = a.type == CKEDITOR.NODE_DOCUMENT ? a.$.createDocumentFragment() :
- a
- }, CKEDITOR.tools.extend(CKEDITOR.dom.documentFragment.prototype, CKEDITOR.dom.element.prototype, {
- type: CKEDITOR.NODE_DOCUMENT_FRAGMENT,
- insertAfterNode: function(a) {
- a = a.$;
- a.parentNode.insertBefore(this.$, a.nextSibling)
- }
- }, !0, {
- append: 1,
- appendBogus: 1,
- getFirst: 1,
- getLast: 1,
- getParent: 1,
- getNext: 1,
- getPrevious: 1,
- appendTo: 1,
- moveChildren: 1,
- insertBefore: 1,
- insertAfterNode: 1,
- replace: 1,
- trim: 1,
- type: 1,
- ltrim: 1,
- rtrim: 1,
- getDocument: 1,
- getChildCount: 1,
- getChild: 1,
- getChildren: 1
- }),
- function() {
- function a(a, b) {
- var c = this.range;
- if(this._.end) return null;
- if(!this._.start) {
- this._.start = 1;
- if(c.collapsed) {
- this.end();
- return null
- }
- c.optimize()
- }
- var d, f = c.startContainer;
- d = c.endContainer;
- var g = c.startOffset,
- k = c.endOffset,
- h, e = this.guard,
- j = this.type,
- i = a ? "getPreviousSourceNode" : "getNextSourceNode";
- if(!a && !this._.guardLTR) {
- var v = d.type == CKEDITOR.NODE_ELEMENT ? d : d.getParent(),
- r = d.type == CKEDITOR.NODE_ELEMENT ? d.getChild(k) : d.getNext();
- this._.guardLTR = function(a, b) {
- return(!b || !v.equals(a)) && (!r || !a.equals(r)) && (a.type != CKEDITOR.NODE_ELEMENT ||
- !b || !a.equals(c.root))
- }
- }
- if(a && !this._.guardRTL) {
- var y = f.type == CKEDITOR.NODE_ELEMENT ? f : f.getParent(),
- z = f.type == CKEDITOR.NODE_ELEMENT ? g ? f.getChild(g - 1) : null : f.getPrevious();
- this._.guardRTL = function(a, b) {
- return(!b || !y.equals(a)) && (!z || !a.equals(z)) && (a.type != CKEDITOR.NODE_ELEMENT || !b || !a.equals(c.root))
- }
- }
- var B = a ? this._.guardRTL : this._.guardLTR;
- h = e ? function(a, b) {
- return B(a, b) === false ? false : e(a, b)
- } : B;
- if(this.current) d = this.current[i](false, j, h);
- else {
- if(a) d.type == CKEDITOR.NODE_ELEMENT && (d = k > 0 ? d.getChild(k -
- 1) : h(d, true) === false ? null : d.getPreviousSourceNode(true, j, h));
- else {
- d = f;
- if(d.type == CKEDITOR.NODE_ELEMENT && !(d = d.getChild(g))) d = h(f, true) === false ? null : f.getNextSourceNode(true, j, h)
- }
- d && h(d) === false && (d = null)
- }
- for(; d && !this._.end;) {
- this.current = d;
- if(!this.evaluator || this.evaluator(d) !== false) {
- if(!b) return d
- } else if(b && this.evaluator) return false;
- d = d[i](false, j, h)
- }
- this.end();
- return this.current = null
- }
- function e(b) {
- for(var c, d = null; c = a.call(this, b);) d = c;
- return d
- }
- function b(a) {
- if(i(a)) return false;
- if(a.type ==
- CKEDITOR.NODE_TEXT) return true;
- if(a.type == CKEDITOR.NODE_ELEMENT) {
- if(a.is(CKEDITOR.dtd.$inline) || a.is("hr") || a.getAttribute("contenteditable") == "false") return true;
- var b;
- if(b = !CKEDITOR.env.needsBrFiller)
- if(b = a.is(k)) a: {
- b = 0;
- for(var c = a.getChildCount(); b < c; ++b)
- if(!i(a.getChild(b))) {
- b = false;
- break a
- }
- b = true
- }
- if(b) return true
- }
- return false
- }
- CKEDITOR.dom.walker = CKEDITOR.tools.createClass({
- $: function(a) {
- this.range = a;
- this._ = {}
- },
- proto: {
- end: function() {
- this._.end = 1
- },
- next: function() {
- return a.call(this)
- },
- previous: function() {
- return a.call(this,
- 1)
- },
- checkForward: function() {
- return a.call(this, 0, 1) !== false
- },
- checkBackward: function() {
- return a.call(this, 1, 1) !== false
- },
- lastForward: function() {
- return e.call(this)
- },
- lastBackward: function() {
- return e.call(this, 1)
- },
- reset: function() {
- delete this.current;
- this._ = {}
- }
- }
- });
- var g = {
- block: 1,
- "list-item": 1,
- table: 1,
- "table-row-group": 1,
- "table-header-group": 1,
- "table-footer-group": 1,
- "table-row": 1,
- "table-column-group": 1,
- "table-column": 1,
- "table-cell": 1,
- "table-caption": 1
- },
- c = {
- absolute: 1,
- fixed: 1
- };
- CKEDITOR.dom.element.prototype.isBlockBoundary =
- function(a) {
- return this.getComputedStyle("float") == "none" && !(this.getComputedStyle("position") in c) && g[this.getComputedStyle("display")] ? true : !!(this.is(CKEDITOR.dtd.$block) || a && this.is(a))
- };
- CKEDITOR.dom.walker.blockBoundary = function(a) {
- return function(b) {
- return !(b.type == CKEDITOR.NODE_ELEMENT && b.isBlockBoundary(a))
- }
- };
- CKEDITOR.dom.walker.listItemBoundary = function() {
- return this.blockBoundary({
- br: 1
- })
- };
- CKEDITOR.dom.walker.bookmark = function(a, b) {
- function c(a) {
- return a && a.getName && a.getName() == "span" &&
- a.data("cke-bookmark")
- }
- return function(d) {
- var f, g;
- f = d && d.type != CKEDITOR.NODE_ELEMENT && (g = d.getParent()) && c(g);
- f = a ? f : f || c(d);
- return !!(b ^ f)
- }
- };
- CKEDITOR.dom.walker.whitespaces = function(a) {
- return function(b) {
- var c;
- b && b.type == CKEDITOR.NODE_TEXT && (c = !CKEDITOR.tools.trim(b.getText()) || CKEDITOR.env.webkit && b.getText() == "");
- return !!(a ^ c)
- }
- };
- CKEDITOR.dom.walker.invisible = function(a) {
- var b = CKEDITOR.dom.walker.whitespaces(),
- c = CKEDITOR.env.webkit ? 1 : 0;
- return function(d) {
- if(b(d)) d = 1;
- else {
- d.type == CKEDITOR.NODE_TEXT &&
- (d = d.getParent());
- d = d.$.offsetWidth <= c
- }
- return !!(a ^ d)
- }
- };
- CKEDITOR.dom.walker.nodeType = function(a, b) {
- return function(c) {
- return !!(b ^ c.type == a)
- }
- };
- CKEDITOR.dom.walker.bogus = function(a) {
- function b(a) {
- return !j(a) && !f(a)
- }
- return function(c) {
- var f = CKEDITOR.env.needsBrFiller ? c.is && c.is("br") : c.getText && d.test(c.getText());
- if(f) {
- f = c.getParent();
- c = c.getNext(b);
- f = f.isBlockBoundary() && (!c || c.type == CKEDITOR.NODE_ELEMENT && c.isBlockBoundary())
- }
- return !!(a ^ f)
- }
- };
- CKEDITOR.dom.walker.temp = function(a) {
- return function(b) {
- b.type !=
- CKEDITOR.NODE_ELEMENT && (b = b.getParent());
- b = b && b.hasAttribute("data-cke-temp");
- return !!(a ^ b)
- }
- };
- var d = /^[\t\r\n ]*(?: |\xa0)$/,
- j = CKEDITOR.dom.walker.whitespaces(),
- f = CKEDITOR.dom.walker.bookmark(),
- h = CKEDITOR.dom.walker.temp();
- CKEDITOR.dom.walker.ignored = function(a) {
- return function(b) {
- b = j(b) || f(b) || h(b);
- return !!(a ^ b)
- }
- };
- var i = CKEDITOR.dom.walker.ignored(),
- k = function(a) {
- var b = {},
- c;
- for(c in a) CKEDITOR.dtd[c]["#"] && (b[c] = 1);
- return b
- }(CKEDITOR.dtd.$block);
- CKEDITOR.dom.walker.editable = function(a) {
- return function(c) {
- return !!(a ^
- b(c))
- }
- };
- CKEDITOR.dom.element.prototype.getBogus = function() {
- var a = this;
- do a = a.getPreviousSourceNode(); while (f(a) || j(a) || a.type == CKEDITOR.NODE_ELEMENT && a.is(CKEDITOR.dtd.$inline) && !a.is(CKEDITOR.dtd.$empty));
- return a && (CKEDITOR.env.needsBrFiller ? a.is && a.is("br") : a.getText && d.test(a.getText())) ? a : false
- }
- }(), CKEDITOR.dom.range = function(a) {
- this.endOffset = this.endContainer = this.startOffset = this.startContainer = null;
- this.collapsed = true;
- var e = a instanceof CKEDITOR.dom.document;
- this.document = e ? a : a.getDocument();
- this.root = e ? a.getBody() : a
- },
- function() {
- function a() {
- var a = false,
- b = CKEDITOR.dom.walker.whitespaces(),
- c = CKEDITOR.dom.walker.bookmark(true),
- f = CKEDITOR.dom.walker.bogus();
- return function(g) {
- if(c(g) || b(g)) return true;
- if(f(g) && !a) return a = true;
- return g.type == CKEDITOR.NODE_TEXT && (g.hasAscendant("pre") || CKEDITOR.tools.trim(g.getText()).length) || g.type == CKEDITOR.NODE_ELEMENT && !g.is(d) ? false : true
- }
- }
- function e(a) {
- var b = CKEDITOR.dom.walker.whitespaces(),
- c = CKEDITOR.dom.walker.bookmark(1);
- return function(d) {
- return c(d) ||
- b(d) ? true : !a && j(d) || d.type == CKEDITOR.NODE_ELEMENT && d.is(CKEDITOR.dtd.$removeEmpty)
- }
- }
- function b(a) {
- return function() {
- var b;
- return this[a ? "getPreviousNode" : "getNextNode"](function(a) {
- !b && i(a) && (b = a);
- return h(a) && !(j(a) && a.equals(b))
- })
- }
- }
- var g = function(a) {
- a.collapsed = a.startContainer && a.endContainer && a.startContainer.equals(a.endContainer) && a.startOffset == a.endOffset
- },
- c = function(a, b, c, d) {
- a.optimizeBookmark();
- var f = a.startContainer,
- g = a.endContainer,
- h = a.startOffset,
- e = a.endOffset,
- j, i;
- if(g.type == CKEDITOR.NODE_TEXT) g =
- g.split(e);
- else if(g.getChildCount() > 0)
- if(e >= g.getChildCount()) {
- g = g.append(a.document.createText(""));
- i = true
- } else g = g.getChild(e);
- if(f.type == CKEDITOR.NODE_TEXT) {
- f.split(h);
- f.equals(g) && (g = f.getNext())
- } else if(h)
- if(h >= f.getChildCount()) {
- f = f.append(a.document.createText(""));
- j = true
- } else f = f.getChild(h).getPrevious();
- else {
- f = f.append(a.document.createText(""), 1);
- j = true
- }
- var h = f.getParents(),
- e = g.getParents(),
- w, x, v;
- for(w = 0; w < h.length; w++) {
- x = h[w];
- v = e[w];
- if(!x.equals(v)) break
- }
- for(var r = c, y, z, B, A = w; A < h.length; A++) {
- y =
- h[A];
- r && !y.equals(f) && (z = r.append(y.clone()));
- for(y = y.getNext(); y;) {
- if(y.equals(e[A]) || y.equals(g)) break;
- B = y.getNext();
- if(b == 2) r.append(y.clone(true));
- else {
- y.remove();
- b == 1 && r.append(y)
- }
- y = B
- }
- r && (r = z)
- }
- r = c;
- for(c = w; c < e.length; c++) {
- y = e[c];
- b > 0 && !y.equals(g) && (z = r.append(y.clone()));
- if(!h[c] || y.$.parentNode != h[c].$.parentNode)
- for(y = y.getPrevious(); y;) {
- if(y.equals(h[c]) || y.equals(f)) break;
- B = y.getPrevious();
- if(b == 2) r.$.insertBefore(y.$.cloneNode(true), r.$.firstChild);
- else {
- y.remove();
- b == 1 && r.$.insertBefore(y.$,
- r.$.firstChild)
- }
- y = B
- }
- r && (r = z)
- }
- if(b == 2) {
- x = a.startContainer;
- if(x.type == CKEDITOR.NODE_TEXT) {
- x.$.data = x.$.data + x.$.nextSibling.data;
- x.$.parentNode.removeChild(x.$.nextSibling)
- }
- a = a.endContainer;
- if(a.type == CKEDITOR.NODE_TEXT && a.$.nextSibling) {
- a.$.data = a.$.data + a.$.nextSibling.data;
- a.$.parentNode.removeChild(a.$.nextSibling)
- }
- } else {
- if(x && v && (f.$.parentNode != x.$.parentNode || g.$.parentNode != v.$.parentNode)) {
- b = v.getIndex();
- j && v.$.parentNode == f.$.parentNode && b--;
- if(d && x.type == CKEDITOR.NODE_ELEMENT) {
- d = CKEDITOR.dom.element.createFromHtml('<span data-cke-bookmark="1" style="display:none"> </span>',
- a.document);
- d.insertAfter(x);
- x.mergeSiblings(false);
- a.moveToBookmark({
- startNode: d
- })
- } else a.setStart(v.getParent(), b)
- }
- a.collapse(true)
- }
- j && f.remove();
- i && g.$.parentNode && g.remove()
- },
- d = {
- abbr: 1,
- acronym: 1,
- b: 1,
- bdo: 1,
- big: 1,
- cite: 1,
- code: 1,
- del: 1,
- dfn: 1,
- em: 1,
- font: 1,
- i: 1,
- ins: 1,
- label: 1,
- kbd: 1,
- q: 1,
- samp: 1,
- small: 1,
- span: 1,
- strike: 1,
- strong: 1,
- sub: 1,
- sup: 1,
- tt: 1,
- u: 1,
- "var": 1
- },
- j = CKEDITOR.dom.walker.bogus(),
- f = /^[\t\r\n ]*(?: |\xa0)$/,
- h = CKEDITOR.dom.walker.editable(),
- i = CKEDITOR.dom.walker.ignored(true);
- CKEDITOR.dom.range.prototype = {
- clone: function() {
- var a = new CKEDITOR.dom.range(this.root);
- a._setStartContainer(this.startContainer);
- a.startOffset = this.startOffset;
- a._setEndContainer(this.endContainer);
- a.endOffset = this.endOffset;
- a.collapsed = this.collapsed;
- return a
- },
- collapse: function(a) {
- if(a) {
- this._setEndContainer(this.startContainer);
- this.endOffset = this.startOffset
- } else {
- this._setStartContainer(this.endContainer);
- this.startOffset = this.endOffset
- }
- this.collapsed = true
- },
- cloneContents: function() {
- var a = new CKEDITOR.dom.documentFragment(this.document);
- this.collapsed || c(this, 2, a);
- return a
- },
- deleteContents: function(a) {
- this.collapsed || c(this, 0, null, a)
- },
- extractContents: function(a) {
- var b = new CKEDITOR.dom.documentFragment(this.document);
- this.collapsed || c(this, 1, b, a);
- return b
- },
- createBookmark: function(a) {
- var b, c, d, f, g = this.collapsed;
- b = this.document.createElement("span");
- b.data("cke-bookmark", 1);
- b.setStyle("display", "none");
- b.setHtml(" ");
- if(a) {
- d = "cke_bm_" + CKEDITOR.tools.getNextNumber();
- b.setAttribute("id", d + (g ? "C" : "S"))
- }
- if(!g) {
- c = b.clone();
- c.setHtml(" ");
- a && c.setAttribute("id", d + "E");
- f = this.clone();
- f.collapse();
- f.insertNode(c)
- }
- f = this.clone();
- f.collapse(true);
- f.insertNode(b);
- if(c) {
- this.setStartAfter(b);
- this.setEndBefore(c)
- } else this.moveToPosition(b, CKEDITOR.POSITION_AFTER_END);
- return {
- startNode: a ? d + (g ? "C" : "S") : b,
- endNode: a ? d + "E" : c,
- serializable: a,
- collapsed: g
- }
- },
- createBookmark2: function() {
- function a(c) {
- var d = c.container,
- f = c.offset,
- g;
- g = d;
- var h = f;
- g = g.type != CKEDITOR.NODE_ELEMENT || h === 0 || h == g.getChildCount() ? 0 : g.getChild(h - 1).type == CKEDITOR.NODE_TEXT && g.getChild(h).type ==
- CKEDITOR.NODE_TEXT;
- if(g) {
- d = d.getChild(f - 1);
- f = d.getLength()
- }
- d.type == CKEDITOR.NODE_ELEMENT && f > 1 && (f = d.getChild(f - 1).getIndex(true) + 1);
- if(d.type == CKEDITOR.NODE_TEXT) {
- g = d;
- for(h = 0;
- (g = g.getPrevious()) && g.type == CKEDITOR.NODE_TEXT;) h = h + g.getLength();
- g = h;
- if(d.getText()) f = f + g;
- else {
- h = d.getPrevious(b);
- if(g) {
- f = g;
- d = h ? h.getNext() : d.getParent().getFirst()
- } else {
- d = d.getParent();
- f = h ? h.getIndex(true) + 1 : 0
- }
- }
- }
- c.container = d;
- c.offset = f
- }
- var b = CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_TEXT, true);
- return function(b) {
- var c = this.collapsed,
- d = {
- container: this.startContainer,
- offset: this.startOffset
- },
- f = {
- container: this.endContainer,
- offset: this.endOffset
- };
- if(b) {
- a(d);
- c || a(f)
- }
- return {
- start: d.container.getAddress(b),
- end: c ? null : f.container.getAddress(b),
- startOffset: d.offset,
- endOffset: f.offset,
- normalized: b,
- collapsed: c,
- is2: true
- }
- }
- }(),
- moveToBookmark: function(a) {
- if(a.is2) {
- var b = this.document.getByAddress(a.start, a.normalized),
- c = a.startOffset,
- d = a.end && this.document.getByAddress(a.end, a.normalized),
- a = a.endOffset;
- this.setStart(b, c);
- d ? this.setEnd(d, a) :
- this.collapse(true)
- } else {
- b = (c = a.serializable) ? this.document.getById(a.startNode) : a.startNode;
- a = c ? this.document.getById(a.endNode) : a.endNode;
- this.setStartBefore(b);
- b.remove();
- if(a) {
- this.setEndBefore(a);
- a.remove()
- } else this.collapse(true)
- }
- },
- getBoundaryNodes: function() {
- var a = this.startContainer,
- b = this.endContainer,
- c = this.startOffset,
- d = this.endOffset,
- f;
- if(a.type == CKEDITOR.NODE_ELEMENT) {
- f = a.getChildCount();
- if(f > c) a = a.getChild(c);
- else if(f < 1) a = a.getPreviousSourceNode();
- else {
- for(a = a.$; a.lastChild;) a = a.lastChild;
- a = new CKEDITOR.dom.node(a);
- a = a.getNextSourceNode() || a
- }
- }
- if(b.type == CKEDITOR.NODE_ELEMENT) {
- f = b.getChildCount();
- if(f > d) b = b.getChild(d).getPreviousSourceNode(true);
- else if(f < 1) b = b.getPreviousSourceNode();
- else {
- for(b = b.$; b.lastChild;) b = b.lastChild;
- b = new CKEDITOR.dom.node(b)
- }
- }
- a.getPosition(b) & CKEDITOR.POSITION_FOLLOWING && (a = b);
- return {
- startNode: a,
- endNode: b
- }
- },
- getCommonAncestor: function(a, b) {
- var c = this.startContainer,
- d = this.endContainer,
- c = c.equals(d) ? a && c.type == CKEDITOR.NODE_ELEMENT && this.startOffset == this.endOffset -
- 1 ? c.getChild(this.startOffset) : c : c.getCommonAncestor(d);
- return b && !c.is ? c.getParent() : c
- },
- optimize: function() {
- var a = this.startContainer,
- b = this.startOffset;
- a.type != CKEDITOR.NODE_ELEMENT && (b ? b >= a.getLength() && this.setStartAfter(a) : this.setStartBefore(a));
- a = this.endContainer;
- b = this.endOffset;
- a.type != CKEDITOR.NODE_ELEMENT && (b ? b >= a.getLength() && this.setEndAfter(a) : this.setEndBefore(a))
- },
- optimizeBookmark: function() {
- var a = this.startContainer,
- b = this.endContainer;
- a.is && (a.is("span") && a.data("cke-bookmark")) &&
- this.setStartAt(a, CKEDITOR.POSITION_BEFORE_START);
- b && (b.is && b.is("span") && b.data("cke-bookmark")) && this.setEndAt(b, CKEDITOR.POSITION_AFTER_END)
- },
- trim: function(a, b) {
- var c = this.startContainer,
- d = this.startOffset,
- f = this.collapsed;
- if((!a || f) && c && c.type == CKEDITOR.NODE_TEXT) {
- if(d)
- if(d >= c.getLength()) {
- d = c.getIndex() + 1;
- c = c.getParent()
- } else {
- var g = c.split(d),
- d = c.getIndex() + 1,
- c = c.getParent();
- if(this.startContainer.equals(this.endContainer)) this.setEnd(g, this.endOffset - this.startOffset);
- else if(c.equals(this.endContainer)) this.endOffset =
- this.endOffset + 1
- }
- else {
- d = c.getIndex();
- c = c.getParent()
- }
- this.setStart(c, d);
- if(f) {
- this.collapse(true);
- return
- }
- }
- c = this.endContainer;
- d = this.endOffset;
- if(!b && !f && c && c.type == CKEDITOR.NODE_TEXT) {
- if(d) {
- d >= c.getLength() || c.split(d);
- d = c.getIndex() + 1
- } else d = c.getIndex();
- c = c.getParent();
- this.setEnd(c, d)
- }
- },
- enlarge: function(a, b) {
- function c(a) {
- return a && a.type == CKEDITOR.NODE_ELEMENT && a.hasAttribute("contenteditable") ? null : a
- }
- var d = RegExp(/[^\s\ufeff]/);
- switch(a) {
- case CKEDITOR.ENLARGE_INLINE:
- var f = 1;
- case CKEDITOR.ENLARGE_ELEMENT:
- if(this.collapsed) break;
- var g = this.getCommonAncestor(),
- h = this.root,
- e, j, i, w, x, v = false,
- r, y;
- r = this.startContainer;
- var z = this.startOffset;
- if(r.type == CKEDITOR.NODE_TEXT) {
- if(z) {
- r = !CKEDITOR.tools.trim(r.substring(0, z)).length && r;
- v = !!r
- }
- if(r && !(w = r.getPrevious())) i = r.getParent()
- } else {
- z && (w = r.getChild(z - 1) || r.getLast());
- w || (i = r)
- }
- for(i = c(i); i || w;) {
- if(i && !w) {
- !x && i.equals(g) && (x = true);
- if(f ? i.isBlockBoundary() : !h.contains(i)) break;
- if(!v || i.getComputedStyle("display") != "inline") {
- v = false;
- x ? e = i : this.setStartBefore(i)
- }
- w = i.getPrevious()
- }
- for(; w;) {
- r =
- false;
- if(w.type == CKEDITOR.NODE_COMMENT) w = w.getPrevious();
- else {
- if(w.type == CKEDITOR.NODE_TEXT) {
- y = w.getText();
- d.test(y) && (w = null);
- r = /[\s\ufeff]$/.test(y)
- } else if((w.$.offsetWidth > (CKEDITOR.env.webkit ? 1 : 0) || b && w.is("br")) && !w.data("cke-bookmark"))
- if(v && CKEDITOR.dtd.$removeEmpty[w.getName()]) {
- y = w.getText();
- if(d.test(y)) w = null;
- else
- for(var z = w.$.getElementsByTagName("*"), B = 0, A; A = z[B++];)
- if(!CKEDITOR.dtd.$removeEmpty[A.nodeName.toLowerCase()]) {
- w = null;
- break
- }
- w && (r = !!y.length)
- } else w = null;
- r && (v ? x ? e = i : i && this.setStartBefore(i) :
- v = true);
- if(w) {
- r = w.getPrevious();
- if(!i && !r) {
- i = w;
- w = null;
- break
- }
- w = r
- } else i = null
- }
- }
- i && (i = c(i.getParent()))
- }
- r = this.endContainer;
- z = this.endOffset;
- i = w = null;
- x = v = false;
- var G = function(a, b) {
- var c = new CKEDITOR.dom.range(h);
- c.setStart(a, b);
- c.setEndAt(h, CKEDITOR.POSITION_BEFORE_END);
- var c = new CKEDITOR.dom.walker(c),
- f;
- for(c.guard = function(a) {
- return !(a.type == CKEDITOR.NODE_ELEMENT && a.isBlockBoundary())
- }; f = c.next();) {
- if(f.type != CKEDITOR.NODE_TEXT) return false;
- y = f != a ? f.getText() : f.substring(b);
- if(d.test(y)) return false
- }
- return true
- };
- if(r.type == CKEDITOR.NODE_TEXT)
- if(CKEDITOR.tools.trim(r.substring(z)).length) v = true;
- else {
- v = !r.getLength();
- if(z == r.getLength()) {
- if(!(w = r.getNext())) i = r.getParent()
- } else G(r, z) && (i = r.getParent())
- }
- else(w = r.getChild(z)) || (i = r);
- for(; i || w;) {
- if(i && !w) {
- !x && i.equals(g) && (x = true);
- if(f ? i.isBlockBoundary() : !h.contains(i)) break;
- if(!v || i.getComputedStyle("display") != "inline") {
- v = false;
- x ? j = i : i && this.setEndAfter(i)
- }
- w = i.getNext()
- }
- for(; w;) {
- r = false;
- if(w.type == CKEDITOR.NODE_TEXT) {
- y = w.getText();
- G(w, 0) || (w = null);
- r = /^[\s\ufeff]/.test(y)
- } else if(w.type ==
- CKEDITOR.NODE_ELEMENT) {
- if((w.$.offsetWidth > 0 || b && w.is("br")) && !w.data("cke-bookmark"))
- if(v && CKEDITOR.dtd.$removeEmpty[w.getName()]) {
- y = w.getText();
- if(d.test(y)) w = null;
- else {
- z = w.$.getElementsByTagName("*");
- for(B = 0; A = z[B++];)
- if(!CKEDITOR.dtd.$removeEmpty[A.nodeName.toLowerCase()]) {
- w = null;
- break
- }
- }
- w && (r = !!y.length)
- } else w = null
- } else r = 1;
- r && v && (x ? j = i : this.setEndAfter(i));
- if(w) {
- r = w.getNext();
- if(!i && !r) {
- i = w;
- w = null;
- break
- }
- w = r
- } else i = null
- }
- i && (i = c(i.getParent()))
- }
- if(e && j) {
- g = e.contains(j) ? j : e;
- this.setStartBefore(g);
- this.setEndAfter(g)
- }
- break;
- case CKEDITOR.ENLARGE_BLOCK_CONTENTS:
- case CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS:
- i = new CKEDITOR.dom.range(this.root);
- h = this.root;
- i.setStartAt(h, CKEDITOR.POSITION_AFTER_START);
- i.setEnd(this.startContainer, this.startOffset);
- i = new CKEDITOR.dom.walker(i);
- var D, J, C = CKEDITOR.dom.walker.blockBoundary(a == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ? {
- br: 1
- } : null),
- F = null,
- E = function(a) {
- if(a.type == CKEDITOR.NODE_ELEMENT && a.getAttribute("contenteditable") == "false")
- if(F) {
- if(F.equals(a)) {
- F = null;
- return
- }
- } else F =
- a;
- else if(F) return;
- var b = C(a);
- b || (D = a);
- return b
- },
- f = function(a) {
- var b = E(a);
- !b && (a.is && a.is("br")) && (J = a);
- return b
- };
- i.guard = E;
- i = i.lastBackward();
- D = D || h;
- this.setStartAt(D, !D.is("br") && (!i && this.checkStartOfBlock() || i && D.contains(i)) ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_AFTER_END);
- if(a == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS) {
- i = this.clone();
- i = new CKEDITOR.dom.walker(i);
- var I = CKEDITOR.dom.walker.whitespaces(),
- L = CKEDITOR.dom.walker.bookmark();
- i.evaluator = function(a) {
- return !I(a) && !L(a)
- };
- if((i = i.previous()) &&
- i.type == CKEDITOR.NODE_ELEMENT && i.is("br")) break
- }
- i = this.clone();
- i.collapse();
- i.setEndAt(h, CKEDITOR.POSITION_BEFORE_END);
- i = new CKEDITOR.dom.walker(i);
- i.guard = a == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ? f : E;
- D = F = J = null;
- i = i.lastForward();
- D = D || h;
- this.setEndAt(D, !i && this.checkEndOfBlock() || i && D.contains(i) ? CKEDITOR.POSITION_BEFORE_END : CKEDITOR.POSITION_BEFORE_START);
- J && this.setEndAfter(J)
- }
- },
- shrink: function(a, b, c) {
- if(!this.collapsed) {
- var a = a || CKEDITOR.SHRINK_TEXT,
- d = this.clone(),
- f = this.startContainer,
- g = this.endContainer,
- h = this.startOffset,
- e = this.endOffset,
- i = 1,
- j = 1;
- if(f && f.type == CKEDITOR.NODE_TEXT)
- if(h)
- if(h >= f.getLength()) d.setStartAfter(f);
- else {
- d.setStartBefore(f);
- i = 0
- }
- else d.setStartBefore(f);
- if(g && g.type == CKEDITOR.NODE_TEXT)
- if(e)
- if(e >= g.getLength()) d.setEndAfter(g);
- else {
- d.setEndAfter(g);
- j = 0
- }
- else d.setEndBefore(g);
- var d = new CKEDITOR.dom.walker(d),
- w = CKEDITOR.dom.walker.bookmark();
- d.evaluator = function(b) {
- return b.type == (a == CKEDITOR.SHRINK_ELEMENT ? CKEDITOR.NODE_ELEMENT : CKEDITOR.NODE_TEXT)
- };
- var x;
- d.guard = function(b, d) {
- if(w(b)) return true;
- if(a == CKEDITOR.SHRINK_ELEMENT && b.type == CKEDITOR.NODE_TEXT || d && b.equals(x) || c === false && b.type == CKEDITOR.NODE_ELEMENT && b.isBlockBoundary() || b.type == CKEDITOR.NODE_ELEMENT && b.hasAttribute("contenteditable")) return false;
- !d && b.type == CKEDITOR.NODE_ELEMENT && (x = b);
- return true
- };
- if(i)(f = d[a == CKEDITOR.SHRINK_ELEMENT ? "lastForward" : "next"]()) && this.setStartAt(f, b ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_START);
- if(j) {
- d.reset();
- (d = d[a == CKEDITOR.SHRINK_ELEMENT ? "lastBackward" : "previous"]()) && this.setEndAt(d,
- b ? CKEDITOR.POSITION_BEFORE_END : CKEDITOR.POSITION_AFTER_END)
- }
- return !(!i && !j)
- }
- },
- insertNode: function(a) {
- this.optimizeBookmark();
- this.trim(false, true);
- var b = this.startContainer,
- c = b.getChild(this.startOffset);
- c ? a.insertBefore(c) : b.append(a);
- a.getParent() && a.getParent().equals(this.endContainer) && this.endOffset++;
- this.setStartBefore(a)
- },
- moveToPosition: function(a, b) {
- this.setStartAt(a, b);
- this.collapse(true)
- },
- moveToRange: function(a) {
- this.setStart(a.startContainer, a.startOffset);
- this.setEnd(a.endContainer,
- a.endOffset)
- },
- selectNodeContents: function(a) {
- this.setStart(a, 0);
- this.setEnd(a, a.type == CKEDITOR.NODE_TEXT ? a.getLength() : a.getChildCount())
- },
- setStart: function(a, b) {
- if(a.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$empty[a.getName()]) {
- b = a.getIndex();
- a = a.getParent()
- }
- this._setStartContainer(a);
- this.startOffset = b;
- if(!this.endContainer) {
- this._setEndContainer(a);
- this.endOffset = b
- }
- g(this)
- },
- setEnd: function(a, b) {
- if(a.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$empty[a.getName()]) {
- b = a.getIndex() + 1;
- a = a.getParent()
- }
- this._setEndContainer(a);
- this.endOffset = b;
- if(!this.startContainer) {
- this._setStartContainer(a);
- this.startOffset = b
- }
- g(this)
- },
- setStartAfter: function(a) {
- this.setStart(a.getParent(), a.getIndex() + 1)
- },
- setStartBefore: function(a) {
- this.setStart(a.getParent(), a.getIndex())
- },
- setEndAfter: function(a) {
- this.setEnd(a.getParent(), a.getIndex() + 1)
- },
- setEndBefore: function(a) {
- this.setEnd(a.getParent(), a.getIndex())
- },
- setStartAt: function(a, b) {
- switch(b) {
- case CKEDITOR.POSITION_AFTER_START:
- this.setStart(a, 0);
- break;
- case CKEDITOR.POSITION_BEFORE_END:
- a.type ==
- CKEDITOR.NODE_TEXT ? this.setStart(a, a.getLength()) : this.setStart(a, a.getChildCount());
- break;
- case CKEDITOR.POSITION_BEFORE_START:
- this.setStartBefore(a);
- break;
- case CKEDITOR.POSITION_AFTER_END:
- this.setStartAfter(a)
- }
- g(this)
- },
- setEndAt: function(a, b) {
- switch(b) {
- case CKEDITOR.POSITION_AFTER_START:
- this.setEnd(a, 0);
- break;
- case CKEDITOR.POSITION_BEFORE_END:
- a.type == CKEDITOR.NODE_TEXT ? this.setEnd(a, a.getLength()) : this.setEnd(a, a.getChildCount());
- break;
- case CKEDITOR.POSITION_BEFORE_START:
- this.setEndBefore(a);
- break;
- case CKEDITOR.POSITION_AFTER_END:
- this.setEndAfter(a)
- }
- g(this)
- },
- fixBlock: function(a, b) {
- var c = this.createBookmark(),
- d = this.document.createElement(b);
- this.collapse(a);
- this.enlarge(CKEDITOR.ENLARGE_BLOCK_CONTENTS);
- this.extractContents().appendTo(d);
- d.trim();
- d.appendBogus();
- this.insertNode(d);
- this.moveToBookmark(c);
- return d
- },
- splitBlock: function(a) {
- var b = new CKEDITOR.dom.elementPath(this.startContainer, this.root),
- c = new CKEDITOR.dom.elementPath(this.endContainer, this.root),
- d = b.block,
- f = c.block,
- g = null;
- if(!b.blockLimit.equals(c.blockLimit)) return null;
- if(a != "br") {
- if(!d) {
- d = this.fixBlock(true, a);
- f = (new CKEDITOR.dom.elementPath(this.endContainer, this.root)).block
- }
- f || (f = this.fixBlock(false, a))
- }
- a = d && this.checkStartOfBlock();
- b = f && this.checkEndOfBlock();
- this.deleteContents();
- if(d && d.equals(f))
- if(b) {
- g = new CKEDITOR.dom.elementPath(this.startContainer, this.root);
- this.moveToPosition(f, CKEDITOR.POSITION_AFTER_END);
- f = null
- } else if(a) {
- g = new CKEDITOR.dom.elementPath(this.startContainer, this.root);
- this.moveToPosition(d, CKEDITOR.POSITION_BEFORE_START);
- d = null
- } else {
- f =
- this.splitElement(d);
- d.is("ul", "ol") || d.appendBogus()
- }
- return {
- previousBlock: d,
- nextBlock: f,
- wasStartOfBlock: a,
- wasEndOfBlock: b,
- elementPath: g
- }
- },
- splitElement: function(a) {
- if(!this.collapsed) return null;
- this.setEndAt(a, CKEDITOR.POSITION_BEFORE_END);
- var b = this.extractContents(),
- c = a.clone(false);
- b.appendTo(c);
- c.insertAfter(a);
- this.moveToPosition(a, CKEDITOR.POSITION_AFTER_END);
- return c
- },
- removeEmptyBlocksAtEnd: function() {
- function a(d) {
- return function(a) {
- return b(a) || (c(a) || a.type == CKEDITOR.NODE_ELEMENT && a.isEmptyInlineRemoveable()) ||
- d.is("table") && a.is("caption") ? false : true
- }
- }
- var b = CKEDITOR.dom.walker.whitespaces(),
- c = CKEDITOR.dom.walker.bookmark(false);
- return function(b) {
- for(var c = this.createBookmark(), d = this[b ? "endPath" : "startPath"](), f = d.block || d.blockLimit, g; f && !f.equals(d.root) && !f.getFirst(a(f));) {
- g = f.getParent();
- this[b ? "setEndAt" : "setStartAt"](f, CKEDITOR.POSITION_AFTER_END);
- f.remove(1);
- f = g
- }
- this.moveToBookmark(c)
- }
- }(),
- startPath: function() {
- return new CKEDITOR.dom.elementPath(this.startContainer, this.root)
- },
- endPath: function() {
- return new CKEDITOR.dom.elementPath(this.endContainer,
- this.root)
- },
- checkBoundaryOfElement: function(a, b) {
- var c = b == CKEDITOR.START,
- d = this.clone();
- d.collapse(c);
- d[c ? "setStartAt" : "setEndAt"](a, c ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_END);
- d = new CKEDITOR.dom.walker(d);
- d.evaluator = e(c);
- return d[c ? "checkBackward" : "checkForward"]()
- },
- checkStartOfBlock: function() {
- var b = this.startContainer,
- c = this.startOffset;
- if(CKEDITOR.env.ie && c && b.type == CKEDITOR.NODE_TEXT) {
- b = CKEDITOR.tools.ltrim(b.substring(0, c));
- f.test(b) && this.trim(0, 1)
- }
- this.trim();
- b = new CKEDITOR.dom.elementPath(this.startContainer,
- this.root);
- c = this.clone();
- c.collapse(true);
- c.setStartAt(b.block || b.blockLimit, CKEDITOR.POSITION_AFTER_START);
- b = new CKEDITOR.dom.walker(c);
- b.evaluator = a();
- return b.checkBackward()
- },
- checkEndOfBlock: function() {
- var b = this.endContainer,
- c = this.endOffset;
- if(CKEDITOR.env.ie && b.type == CKEDITOR.NODE_TEXT) {
- b = CKEDITOR.tools.rtrim(b.substring(c));
- f.test(b) && this.trim(1, 0)
- }
- this.trim();
- b = new CKEDITOR.dom.elementPath(this.endContainer, this.root);
- c = this.clone();
- c.collapse(false);
- c.setEndAt(b.block || b.blockLimit, CKEDITOR.POSITION_BEFORE_END);
- b = new CKEDITOR.dom.walker(c);
- b.evaluator = a();
- return b.checkForward()
- },
- getPreviousNode: function(a, b, c) {
- var d = this.clone();
- d.collapse(1);
- d.setStartAt(c || this.root, CKEDITOR.POSITION_AFTER_START);
- c = new CKEDITOR.dom.walker(d);
- c.evaluator = a;
- c.guard = b;
- return c.previous()
- },
- getNextNode: function(a, b, c) {
- var d = this.clone();
- d.collapse();
- d.setEndAt(c || this.root, CKEDITOR.POSITION_BEFORE_END);
- c = new CKEDITOR.dom.walker(d);
- c.evaluator = a;
- c.guard = b;
- return c.next()
- },
- checkReadOnly: function() {
- function a(b, c) {
- for(; b;) {
- if(b.type ==
- CKEDITOR.NODE_ELEMENT) {
- if(b.getAttribute("contentEditable") == "false" && !b.data("cke-editable")) return 0;
- if(b.is("html") || b.getAttribute("contentEditable") == "true" && (b.contains(c) || b.equals(c))) break
- }
- b = b.getParent()
- }
- return 1
- }
- return function() {
- var b = this.startContainer,
- c = this.endContainer;
- return !(a(b, c) && a(c, b))
- }
- }(),
- moveToElementEditablePosition: function(a, b) {
- if(a.type == CKEDITOR.NODE_ELEMENT && !a.isEditable(false)) {
- this.moveToPosition(a, b ? CKEDITOR.POSITION_AFTER_END : CKEDITOR.POSITION_BEFORE_START);
- return true
- }
- for(var c =
- 0; a;) {
- if(a.type == CKEDITOR.NODE_TEXT) {
- b && this.endContainer && this.checkEndOfBlock() && f.test(a.getText()) ? this.moveToPosition(a, CKEDITOR.POSITION_BEFORE_START) : this.moveToPosition(a, b ? CKEDITOR.POSITION_AFTER_END : CKEDITOR.POSITION_BEFORE_START);
- c = 1;
- break
- }
- if(a.type == CKEDITOR.NODE_ELEMENT)
- if(a.isEditable()) {
- this.moveToPosition(a, b ? CKEDITOR.POSITION_BEFORE_END : CKEDITOR.POSITION_AFTER_START);
- c = 1
- } else if(b && a.is("br") && this.endContainer && this.checkEndOfBlock()) this.moveToPosition(a, CKEDITOR.POSITION_BEFORE_START);
- else if(a.getAttribute("contenteditable") == "false" && a.is(CKEDITOR.dtd.$block)) {
- this.setStartBefore(a);
- this.setEndAfter(a);
- return true
- }
- var d = a,
- g = c,
- h = void 0;
- d.type == CKEDITOR.NODE_ELEMENT && d.isEditable(false) && (h = d[b ? "getLast" : "getFirst"](i));
- !g && !h && (h = d[b ? "getPrevious" : "getNext"](i));
- a = h
- }
- return !!c
- },
- moveToClosestEditablePosition: function(a, b) {
- var c = new CKEDITOR.dom.range(this.root),
- d = 0,
- f, g = [CKEDITOR.POSITION_AFTER_END, CKEDITOR.POSITION_BEFORE_START];
- c.moveToPosition(a, g[b ? 0 : 1]);
- if(a.is(CKEDITOR.dtd.$block)) {
- if(f =
- c[b ? "getNextEditableNode" : "getPreviousEditableNode"]()) {
- d = 1;
- if(f.type == CKEDITOR.NODE_ELEMENT && f.is(CKEDITOR.dtd.$block) && f.getAttribute("contenteditable") == "false") {
- c.setStartAt(f, CKEDITOR.POSITION_BEFORE_START);
- c.setEndAt(f, CKEDITOR.POSITION_AFTER_END)
- } else c.moveToPosition(f, g[b ? 1 : 0])
- }
- } else d = 1;
- d && this.moveToRange(c);
- return !!d
- },
- moveToElementEditStart: function(a) {
- return this.moveToElementEditablePosition(a)
- },
- moveToElementEditEnd: function(a) {
- return this.moveToElementEditablePosition(a, true)
- },
- getEnclosedNode: function() {
- var a =
- this.clone();
- a.optimize();
- if(a.startContainer.type != CKEDITOR.NODE_ELEMENT || a.endContainer.type != CKEDITOR.NODE_ELEMENT) return null;
- var a = new CKEDITOR.dom.walker(a),
- b = CKEDITOR.dom.walker.bookmark(false, true),
- c = CKEDITOR.dom.walker.whitespaces(true);
- a.evaluator = function(a) {
- return c(a) && b(a)
- };
- var d = a.next();
- a.reset();
- return d && d.equals(a.previous()) ? d : null
- },
- getTouchedStartNode: function() {
- var a = this.startContainer;
- return this.collapsed || a.type != CKEDITOR.NODE_ELEMENT ? a : a.getChild(this.startOffset) || a
- },
- getTouchedEndNode: function() {
- var a =
- this.endContainer;
- return this.collapsed || a.type != CKEDITOR.NODE_ELEMENT ? a : a.getChild(this.endOffset - 1) || a
- },
- getNextEditableNode: b(),
- getPreviousEditableNode: b(1),
- scrollIntoView: function() {
- var a = new CKEDITOR.dom.element.createFromHtml("<span> </span>", this.document),
- b, c, d, f = this.clone();
- f.optimize();
- if(d = f.startContainer.type == CKEDITOR.NODE_TEXT) {
- c = f.startContainer.getText();
- b = f.startContainer.split(f.startOffset);
- a.insertAfter(f.startContainer)
- } else f.insertNode(a);
- a.scrollIntoView();
- if(d) {
- f.startContainer.setText(c);
- b.remove()
- }
- a.remove()
- },
- _setStartContainer: function(a) {
- this.startContainer = a
- },
- _setEndContainer: function(a) {
- this.endContainer = a
- }
- }
- }(), CKEDITOR.POSITION_AFTER_START = 1, CKEDITOR.POSITION_BEFORE_END = 2, CKEDITOR.POSITION_BEFORE_START = 3, CKEDITOR.POSITION_AFTER_END = 4, CKEDITOR.ENLARGE_ELEMENT = 1, CKEDITOR.ENLARGE_BLOCK_CONTENTS = 2, CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS = 3, CKEDITOR.ENLARGE_INLINE = 4, CKEDITOR.START = 1, CKEDITOR.END = 2, CKEDITOR.SHRINK_ELEMENT = 1, CKEDITOR.SHRINK_TEXT = 2, "use strict",
- function() {
- function a(a) {
- if(!(arguments.length <
- 1)) {
- this.range = a;
- this.forceBrBreak = 0;
- this.enlargeBr = 1;
- this.enforceRealBlocks = 0;
- this._ || (this._ = {})
- }
- }
- function e(a) {
- var b = [];
- a.forEach(function(a) {
- if(a.getAttribute("contenteditable") == "true") {
- b.push(a);
- return false
- }
- }, CKEDITOR.NODE_ELEMENT, true);
- return b
- }
- function b(a, c, d, f) {
- a: {
- f == null && (f = e(d));
- for(var g; g = f.shift();)
- if(g.getDtd().p) {
- f = {
- element: g,
- remaining: f
- };
- break a
- }
- f = null
- }
- if(!f) return 0;
- if((g = CKEDITOR.filter.instances[f.element.data("cke-filter")]) && !g.check(c)) return b(a, c, d, f.remaining);c = new CKEDITOR.dom.range(f.element);
- c.selectNodeContents(f.element);c = c.createIterator();c.enlargeBr = a.enlargeBr;c.enforceRealBlocks = a.enforceRealBlocks;c.activeFilter = c.filter = g;a._.nestedEditable = {
- element: f.element,
- container: d,
- remaining: f.remaining,
- iterator: c
- };
- return 1
- }
- function g(a, b, c) {
- if(!b) return false;
- a = a.clone();
- a.collapse(!c);
- return a.checkBoundaryOfElement(b, c ? CKEDITOR.START : CKEDITOR.END)
- }
- var c = /^[\r\n\t ]+$/,
- d = CKEDITOR.dom.walker.bookmark(false, true),
- j = CKEDITOR.dom.walker.whitespaces(true),
- f = function(a) {
- return d(a) && j(a)
- },
- h = {
- dd: 1,
- dt: 1,
- li: 1
- };
- a.prototype = {
- getNextParagraph: function(a) {
- var e, j, o, q, m, a = a || "p";
- if(this._.nestedEditable) {
- if(e = this._.nestedEditable.iterator.getNextParagraph(a)) {
- this.activeFilter = this._.nestedEditable.iterator.activeFilter;
- return e
- }
- this.activeFilter = this.filter;
- if(b(this, a, this._.nestedEditable.container, this._.nestedEditable.remaining)) {
- this.activeFilter = this._.nestedEditable.iterator.activeFilter;
- return this._.nestedEditable.iterator.getNextParagraph(a)
- }
- this._.nestedEditable = null
- }
- if(!this.range.root.getDtd()[a]) return null;
- if(!this._.started) {
- var l = this.range.clone();
- j = l.startPath();
- var p = l.endPath(),
- t = !l.collapsed && g(l, j.block),
- s = !l.collapsed && g(l, p.block, 1);
- l.shrink(CKEDITOR.SHRINK_ELEMENT, true);
- t && l.setStartAt(j.block, CKEDITOR.POSITION_BEFORE_END);
- s && l.setEndAt(p.block, CKEDITOR.POSITION_AFTER_START);
- j = l.endContainer.hasAscendant("pre", true) || l.startContainer.hasAscendant("pre", true);
- l.enlarge(this.forceBrBreak && !j || !this.enlargeBr ? CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS : CKEDITOR.ENLARGE_BLOCK_CONTENTS);
- if(!l.collapsed) {
- j =
- new CKEDITOR.dom.walker(l.clone());
- p = CKEDITOR.dom.walker.bookmark(true, true);
- j.evaluator = p;
- this._.nextNode = j.next();
- j = new CKEDITOR.dom.walker(l.clone());
- j.evaluator = p;
- j = j.previous();
- this._.lastNode = j.getNextSourceNode(true, null, l.root);
- if(this._.lastNode && this._.lastNode.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.trim(this._.lastNode.getText()) && this._.lastNode.getParent().isBlockBoundary()) {
- p = this.range.clone();
- p.moveToPosition(this._.lastNode, CKEDITOR.POSITION_AFTER_END);
- if(p.checkEndOfBlock()) {
- p =
- new CKEDITOR.dom.elementPath(p.endContainer, p.root);
- this._.lastNode = (p.block || p.blockLimit).getNextSourceNode(true)
- }
- }
- if(!this._.lastNode || !l.root.contains(this._.lastNode)) {
- this._.lastNode = this._.docEndMarker = l.document.createText("");
- this._.lastNode.insertAfter(j)
- }
- l = null
- }
- this._.started = 1;
- j = l
- }
- p = this._.nextNode;
- l = this._.lastNode;
- for(this._.nextNode = null; p;) {
- var t = 0,
- s = p.hasAscendant("pre"),
- u = p.type != CKEDITOR.NODE_ELEMENT,
- w = 0;
- if(u) p.type == CKEDITOR.NODE_TEXT && c.test(p.getText()) && (u = 0);
- else {
- var x = p.getName();
- if(CKEDITOR.dtd.$block[x] && p.getAttribute("contenteditable") == "false") {
- e = p;
- b(this, a, e);
- break
- } else if(p.isBlockBoundary(this.forceBrBreak && !s && {
- br: 1
- })) {
- if(x == "br") u = 1;
- else if(!j && !p.getChildCount() && x != "hr") {
- e = p;
- o = p.equals(l);
- break
- }
- if(j) {
- j.setEndAt(p, CKEDITOR.POSITION_BEFORE_START);
- if(x != "br") this._.nextNode = p
- }
- t = 1
- } else {
- if(p.getFirst()) {
- if(!j) {
- j = this.range.clone();
- j.setStartAt(p, CKEDITOR.POSITION_BEFORE_START)
- }
- p = p.getFirst();
- continue
- }
- u = 1
- }
- }
- if(u && !j) {
- j = this.range.clone();
- j.setStartAt(p, CKEDITOR.POSITION_BEFORE_START)
- }
- o =
- (!t || u) && p.equals(l);
- if(j && !t)
- for(; !p.getNext(f) && !o;) {
- x = p.getParent();
- if(x.isBlockBoundary(this.forceBrBreak && !s && {
- br: 1
- })) {
- t = 1;
- u = 0;
- o || x.equals(l);
- j.setEndAt(x, CKEDITOR.POSITION_BEFORE_END);
- break
- }
- p = x;
- u = 1;
- o = p.equals(l);
- w = 1
- }
- u && j.setEndAt(p, CKEDITOR.POSITION_AFTER_END);
- p = this._getNextSourceNode(p, w, l);
- if((o = !p) || t && j) break
- }
- if(!e) {
- if(!j) {
- this._.docEndMarker && this._.docEndMarker.remove();
- return this._.nextNode = null
- }
- e = new CKEDITOR.dom.elementPath(j.startContainer, j.root);
- p = e.blockLimit;
- t = {
- div: 1,
- th: 1,
- td: 1
- };
- e = e.block;
- if(!e && p && !this.enforceRealBlocks && t[p.getName()] && j.checkStartOfBlock() && j.checkEndOfBlock() && !p.equals(j.root)) e = p;
- else if(!e || this.enforceRealBlocks && e.is(h)) {
- e = this.range.document.createElement(a);
- j.extractContents().appendTo(e);
- e.trim();
- j.insertNode(e);
- q = m = true
- } else if(e.getName() != "li") {
- if(!j.checkStartOfBlock() || !j.checkEndOfBlock()) {
- e = e.clone(false);
- j.extractContents().appendTo(e);
- e.trim();
- m = j.splitBlock();
- q = !m.wasStartOfBlock;
- m = !m.wasEndOfBlock;
- j.insertNode(e)
- }
- } else if(!o) this._.nextNode =
- e.equals(l) ? null : this._getNextSourceNode(j.getBoundaryNodes().endNode, 1, l)
- }
- if(q)(q = e.getPrevious()) && q.type == CKEDITOR.NODE_ELEMENT && (q.getName() == "br" ? q.remove() : q.getLast() && q.getLast().$.nodeName.toLowerCase() == "br" && q.getLast().remove());
- if(m)(q = e.getLast()) && q.type == CKEDITOR.NODE_ELEMENT && q.getName() == "br" && (!CKEDITOR.env.needsBrFiller || q.getPrevious(d) || q.getNext(d)) && q.remove();
- if(!this._.nextNode) this._.nextNode = o || e.equals(l) || !l ? null : this._getNextSourceNode(e, 1, l);
- return e
- },
- _getNextSourceNode: function(a,
- b, c) {
- function f(a) {
- return !(a.equals(c) || a.equals(g))
- }
- for(var g = this.range.root, a = a.getNextSourceNode(b, null, f); !d(a);) a = a.getNextSourceNode(b, null, f);
- return a
- }
- };
- CKEDITOR.dom.range.prototype.createIterator = function() {
- return new a(this)
- }
- }(), CKEDITOR.command = function(a, e) {
- this.uiItems = [];
- this.exec = function(b) {
- if(this.state == CKEDITOR.TRISTATE_DISABLED || !this.checkAllowed()) return false;
- this.editorFocus && a.focus();
- return this.fire("exec") === false ? true : e.exec.call(this, a, b) !== false
- };
- this.refresh = function(a,
- b) {
- if(!this.readOnly && a.readOnly) return true;
- if(this.context && !b.isContextFor(this.context)) {
- this.disable();
- return true
- }
- if(!this.checkAllowed(true)) {
- this.disable();
- return true
- }
- this.startDisabled || this.enable();
- this.modes && !this.modes[a.mode] && this.disable();
- return this.fire("refresh", {
- editor: a,
- path: b
- }) === false ? true : e.refresh && e.refresh.apply(this, arguments) !== false
- };
- var b;
- this.checkAllowed = function(g) {
- return !g && typeof b == "boolean" ? b : b = a.activeFilter.checkFeature(this)
- };
- CKEDITOR.tools.extend(this,
- e, {
- modes: {
- wysiwyg: 1
- },
- editorFocus: 1,
- contextSensitive: !!e.context,
- state: CKEDITOR.TRISTATE_DISABLED
- });
- CKEDITOR.event.call(this)
- }, CKEDITOR.command.prototype = {
- enable: function() {
- this.state == CKEDITOR.TRISTATE_DISABLED && this.checkAllowed() && this.setState(!this.preserveState || typeof this.previousState == "undefined" ? CKEDITOR.TRISTATE_OFF : this.previousState)
- },
- disable: function() {
- this.setState(CKEDITOR.TRISTATE_DISABLED)
- },
- setState: function(a) {
- if(this.state == a || a != CKEDITOR.TRISTATE_DISABLED && !this.checkAllowed()) return false;
- this.previousState = this.state;
- this.state = a;
- this.fire("state");
- return true
- },
- toggleState: function() {
- this.state == CKEDITOR.TRISTATE_OFF ? this.setState(CKEDITOR.TRISTATE_ON) : this.state == CKEDITOR.TRISTATE_ON && this.setState(CKEDITOR.TRISTATE_OFF)
- }
- }, CKEDITOR.event.implementOn(CKEDITOR.command.prototype), CKEDITOR.ENTER_P = 1, CKEDITOR.ENTER_BR = 2, CKEDITOR.ENTER_DIV = 3, CKEDITOR.config = {
- customConfig: "config.js",
- autoUpdateElement: !0,
- language: "",
- defaultLanguage: "en",
- contentsLangDirection: "",
- enterMode: CKEDITOR.ENTER_P,
- forceEnterMode: !1,
- shiftEnterMode: CKEDITOR.ENTER_BR,
- docType: "<!DOCTYPE html>",
- bodyId: "",
- bodyClass: "",
- fullPage: !1,
- height: 200,
- extraPlugins: "",
- removePlugins: "",
- protectedSource: [],
- tabIndex: 0,
- width: "",
- baseFloatZIndex: 1E4,
- blockedKeystrokes: [CKEDITOR.CTRL + 66, CKEDITOR.CTRL + 73, CKEDITOR.CTRL + 85]
- },
- function() {
- function a(a, b, c, d, f) {
- var g, h, a = [];
- for(g in b) {
- h = b[g];
- h = typeof h == "boolean" ? {} : typeof h == "function" ? {
- match: h
- } : G(h);
- if(g.charAt(0) != "$") h.elements = g;
- if(c) h.featureName = c.toLowerCase();
- var e = h;
- e.elements = j(e.elements,
- /\s+/) || null;
- e.propertiesOnly = e.propertiesOnly || e.elements === true;
- var i = /\s*,\s*/,
- p = void 0;
- for(p in F) {
- e[p] = j(e[p], i) || null;
- var m = e,
- k = E[p],
- x = j(e[E[p]], i),
- s = e[p],
- w = [],
- l = true,
- C = void 0;
- x ? l = false : x = {};
- for(C in s)
- if(C.charAt(0) == "!") {
- C = C.slice(1);
- w.push(C);
- x[C] = true;
- l = false
- }
- for(; C = w.pop();) {
- s[C] = s["!" + C];
- delete s["!" + C]
- }
- m[k] = (l ? false : x) || null
- }
- e.match = e.match || null;
- d.push(h);
- a.push(h)
- }
- for(var b = f.elements, f = f.generic, n, c = 0, d = a.length; c < d; ++c) {
- g = G(a[c]);
- h = g.classes === true || g.styles === true || g.attributes ===
- true;
- e = g;
- p = k = i = void 0;
- for(i in F) e[i] = t(e[i]);
- m = true;
- for(p in E) {
- i = E[p];
- k = e[i];
- x = [];
- s = void 0;
- for(s in k) s.indexOf("*") > -1 ? x.push(RegExp("^" + s.replace(/\*/g, ".*") + "$")) : x.push(s);
- k = x;
- if(k.length) {
- e[i] = k;
- m = false
- }
- }
- e.nothingRequired = m;
- e.noProperties = !(e.attributes || e.classes || e.styles);
- if(g.elements === true || g.elements === null) f[h ? "unshift" : "push"](g);
- else {
- e = g.elements;
- delete g.elements;
- for(n in e)
- if(b[n]) b[n][h ? "unshift" : "push"](g);
- else b[n] = [g]
- }
- }
- }
- function e(a, c, d, g) {
- if(!a.match || a.match(c))
- if(g || f(a,
- c)) {
- if(!a.propertiesOnly) d.valid = true;
- if(!d.allAttributes) d.allAttributes = b(a.attributes, c.attributes, d.validAttributes);
- if(!d.allStyles) d.allStyles = b(a.styles, c.styles, d.validStyles);
- if(!d.allClasses) {
- a = a.classes;
- c = c.classes;
- g = d.validClasses;
- if(a)
- if(a === true) a = true;
- else {
- for(var h = 0, e = c.length, j; h < e; ++h) {
- j = c[h];
- g[j] || (g[j] = a(j))
- }
- a = false
- }
- else a = false;
- d.allClasses = a
- }
- }
- }
- function b(a, b, c) {
- if(!a) return false;
- if(a === true) return true;
- for(var d in b) c[d] || (c[d] = a(d));
- return false
- }
- function g(a, b, d) {
- if(!a.match ||
- a.match(b)) {
- if(a.noProperties) return false;
- d.hadInvalidAttribute = c(a.attributes, b.attributes) || d.hadInvalidAttribute;
- d.hadInvalidStyle = c(a.styles, b.styles) || d.hadInvalidStyle;
- a = a.classes;
- b = b.classes;
- if(a) {
- for(var f = false, g = a === true, h = b.length; h--;)
- if(g || a(b[h])) {
- b.splice(h, 1);
- f = true
- }
- a = f
- } else a = false;
- d.hadInvalidClass = a || d.hadInvalidClass
- }
- }
- function c(a, b) {
- if(!a) return false;
- var c = false,
- d = a === true,
- f;
- for(f in b)
- if(d || a(f)) {
- delete b[f];
- c = true
- }
- return c
- }
- function d(a, b, c) {
- if(a.disabled || a.customConfig &&
- !c || !b) return false;
- a._.cachedChecks = {};
- return true
- }
- function j(a, b) {
- if(!a) return false;
- if(a === true) return a;
- if(typeof a == "string") {
- a = D(a);
- return a == "*" ? true : CKEDITOR.tools.convertArrayToObject(a.split(b))
- }
- if(CKEDITOR.tools.isArray(a)) return a.length ? CKEDITOR.tools.convertArrayToObject(a) : false;
- var c = {},
- d = 0,
- f;
- for(f in a) {
- c[f] = a[f];
- d++
- }
- return d ? c : false
- }
- function f(a, b) {
- if(a.nothingRequired) return true;
- var c, d, f, g;
- if(f = a.requiredClasses) {
- g = b.classes;
- for(c = 0; c < f.length; ++c) {
- d = f[c];
- if(typeof d == "string") {
- if(CKEDITOR.tools.indexOf(g,
- d) == -1) return false
- } else if(!CKEDITOR.tools.checkIfAnyArrayItemMatches(g, d)) return false
- }
- }
- return h(b.styles, a.requiredStyles) && h(b.attributes, a.requiredAttributes)
- }
- function h(a, b) {
- if(!b) return true;
- for(var c = 0, d; c < b.length; ++c) {
- d = b[c];
- if(typeof d == "string") {
- if(!(d in a)) return false
- } else if(!CKEDITOR.tools.checkIfAnyObjectPropertyMatches(a, d)) return false
- }
- return true
- }
- function i(a) {
- if(!a) return {};
- for(var a = a.split(/\s*,\s*/).sort(), b = {}; a.length;) b[a.shift()] = J;
- return b
- }
- function k(a) {
- for(var b, c, d,
- f, g = {}, h = 1, a = D(a); b = a.match(I);) {
- if(c = b[2]) {
- d = n(c, "styles");
- f = n(c, "attrs");
- c = n(c, "classes")
- } else d = f = c = null;
- g["$" + h++] = {
- elements: b[1],
- classes: c,
- styles: d,
- attributes: f
- };
- a = a.slice(b[0].length)
- }
- return g
- }
- function n(a, b) {
- var c = a.match(L[b]);
- return c ? D(c[1]) : null
- }
- function o(a) {
- var b = a.styleBackup = a.attributes.style,
- c = a.classBackup = a.attributes["class"];
- if(!a.styles) a.styles = CKEDITOR.tools.parseCssText(b || "", 1);
- if(!a.classes) a.classes = c ? c.split(/\s+/) : []
- }
- function q(a, b, c, d) {
- var f = 0,
- h;
- if(d.toHtml) b.name = b.name.replace(H,
- "$1");
- if(d.doCallbacks && a.elementCallbacks) {
- a: for(var j = a.elementCallbacks, i = 0, m = j.length, t; i < m; ++i)
- if(t = j[i](b)) {
- h = t;
- break a
- }if(h) return h
- }
- if(d.doTransform)
- if(h = a._.transformations[b.name]) {
- o(b);
- for(j = 0; j < h.length; ++j) x(a, b, h[j]);
- l(b)
- }
- if(d.doFilter) {
- a: {
- j = b.name;i = a._;a = i.allowedRules.elements[j];h = i.allowedRules.generic;j = i.disallowedRules.elements[j];i = i.disallowedRules.generic;m = d.skipRequired;t = {
- valid: false,
- validAttributes: {},
- validClasses: {},
- validStyles: {},
- allAttributes: false,
- allClasses: false,
- allStyles: false,
- hadInvalidAttribute: false,
- hadInvalidClass: false,
- hadInvalidStyle: false
- };
- var k, s;
- if(!a && !h) a = null;
- else {
- o(b);
- if(j) {
- k = 0;
- for(s = j.length; k < s; ++k)
- if(g(j[k], b, t) === false) {
- a = null;
- break a
- }
- }
- if(i) {
- k = 0;
- for(s = i.length; k < s; ++k) g(i[k], b, t)
- }
- if(a) {
- k = 0;
- for(s = a.length; k < s; ++k) e(a[k], b, t, m)
- }
- if(h) {
- k = 0;
- for(s = h.length; k < s; ++k) e(h[k], b, t, m)
- }
- a = t
- }
- }
- if(!a) {
- c.push(b);
- return A
- }
- if(!a.valid) {
- c.push(b);
- return A
- }
- s = a.validAttributes;
- var w = a.validStyles;h = a.validClasses;
- var j = b.attributes,
- C = b.styles,
- i = b.classes,
- m = b.classBackup,
- n = b.styleBackup,
- v, F, r = [];t = [];
- var u = /^data-cke-/;k = false;delete j.style;delete j["class"];delete b.classBackup;delete b.styleBackup;
- if(!a.allAttributes)
- for(v in j)
- if(!s[v])
- if(u.test(v)) {
- if(v != (F = v.replace(/^data-cke-saved-/, "")) && !s[F]) {
- delete j[v];
- k = true
- }
- } else {
- delete j[v];
- k = true
- }
- if(!a.allStyles || a.hadInvalidStyle) {
- for(v in C) a.allStyles || w[v] ? r.push(v + ":" + C[v]) : k = true;
- if(r.length) j.style = r.sort().join("; ")
- } else if(n) j.style = n;
- if(!a.allClasses || a.hadInvalidClass) {
- for(v = 0; v < i.length; ++v)(a.allClasses ||
- h[i[v]]) && t.push(i[v]);
- t.length && (j["class"] = t.sort().join(" "));
- m && t.length < m.split(/\s+/).length && (k = true)
- } else m && (j["class"] = m);k && (f = A);
- if(!d.skipFinalValidation && !p(b)) {
- c.push(b);
- return A
- }
- }
- if(d.toHtml) b.name = b.name.replace(Q, "cke:$1");
- return f
- }
- function m(a) {
- var b = [],
- c;
- for(c in a) c.indexOf("*") > -1 && b.push(c.replace(/\*/g, ".*"));
- return b.length ? RegExp("^(?:" + b.join("|") + ")$") : null
- }
- function l(a) {
- var b = a.attributes,
- c;
- delete b.style;
- delete b["class"];
- if(c = CKEDITOR.tools.writeCssText(a.styles, true)) b.style =
- c;
- a.classes.length && (b["class"] = a.classes.sort().join(" "))
- }
- function p(a) {
- switch(a.name) {
- case "a":
- if(!a.children.length && !a.attributes.name) return false;
- break;
- case "img":
- if(!a.attributes.src) return false
- }
- return true
- }
- function t(a) {
- if(!a) return false;
- if(a === true) return true;
- var b = m(a);
- return function(c) {
- return c in a || b && c.match(b)
- }
- }
- function s() {
- return new CKEDITOR.htmlParser.element("br")
- }
- function u(a) {
- return a.type == CKEDITOR.NODE_ELEMENT && (a.name == "br" || B.$block[a.name])
- }
- function w(a, b, c) {
- var d = a.name;
- if(B.$empty[d] || !a.children.length)
- if(d == "hr" && b == "br") a.replaceWith(s());
- else {
- a.parent && c.push({
- check: "it",
- el: a.parent
- });
- a.remove()
- }
- else if(B.$block[d] || d == "tr")
- if(b == "br") {
- if(a.previous && !u(a.previous)) {
- b = s();
- b.insertBefore(a)
- }
- if(a.next && !u(a.next)) {
- b = s();
- b.insertAfter(a)
- }
- a.replaceWithChildren()
- } else {
- var d = a.children,
- f;
- b: {
- f = B[b];
- for(var g = 0, h = d.length, e; g < h; ++g) {
- e = d[g];
- if(e.type == CKEDITOR.NODE_ELEMENT && !f[e.name]) {
- f = false;
- break b
- }
- }
- f = true
- }
- if(f) {
- a.name = b;
- a.attributes = {};
- c.push({
- check: "parent-down",
- el: a
- })
- } else {
- f = a.parent;
- for(var g = f.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT || f.name == "body", j, i, h = d.length; h > 0;) {
- e = d[--h];
- if(g && (e.type == CKEDITOR.NODE_TEXT || e.type == CKEDITOR.NODE_ELEMENT && B.$inline[e.name])) {
- if(!j) {
- j = new CKEDITOR.htmlParser.element(b);
- j.insertAfter(a);
- c.push({
- check: "parent-down",
- el: j
- })
- }
- j.add(e, 0)
- } else {
- j = null;
- i = B[f.name] || B.span;
- e.insertAfter(a);
- f.type != CKEDITOR.NODE_DOCUMENT_FRAGMENT && (e.type == CKEDITOR.NODE_ELEMENT && !i[e.name]) && c.push({
- check: "el-up",
- el: e
- })
- }
- }
- a.remove()
- }
- }
- else if(d == "style") a.remove();
- else {
- a.parent && c.push({
- check: "it",
- el: a.parent
- });
- a.replaceWithChildren()
- }
- }
- function x(a, b, c) {
- var d, f;
- for(d = 0; d < c.length; ++d) {
- f = c[d];
- if((!f.check || a.check(f.check, false)) && (!f.left || f.left(b))) {
- f.right(b, O);
- break
- }
- }
- }
- function v(a, b) {
- var c = b.getDefinition(),
- d = c.attributes,
- f = c.styles,
- g, h, e, j;
- if(a.name != c.element) return false;
- for(g in d)
- if(g == "class") {
- c = d[g].split(/\s+/);
- for(e = a.classes.join("|"); j = c.pop();)
- if(e.indexOf(j) == -1) return false
- } else if(a.attributes[g] != d[g]) return false;
- for(h in f)
- if(a.styles[h] !=
- f[h]) return false;
- return true
- }
- function r(a, b) {
- var c, d;
- if(typeof a == "string") c = a;
- else if(a instanceof CKEDITOR.style) d = a;
- else {
- c = a[0];
- d = a[1]
- }
- return [{
- element: c,
- left: d,
- right: function(a, c) {
- c.transform(a, b)
- }
- }]
- }
- function y(a) {
- return function(b) {
- return v(b, a)
- }
- }
- function z(a) {
- return function(b, c) {
- c[a](b)
- }
- }
- var B = CKEDITOR.dtd,
- A = 1,
- G = CKEDITOR.tools.copy,
- D = CKEDITOR.tools.trim,
- J = "cke-test",
- C = ["", "p", "br", "div"];
- CKEDITOR.FILTER_SKIP_TREE = 2;
- CKEDITOR.filter = function(a) {
- this.allowedContent = [];
- this.disallowedContent = [];
- this.elementCallbacks = null;
- this.disabled = false;
- this.editor = null;
- this.id = CKEDITOR.tools.getNextNumber();
- this._ = {
- allowedRules: {
- elements: {},
- generic: []
- },
- disallowedRules: {
- elements: {},
- generic: []
- },
- transformations: {},
- cachedTests: {}
- };
- CKEDITOR.filter.instances[this.id] = this;
- if(a instanceof CKEDITOR.editor) {
- a = this.editor = a;
- this.customConfig = true;
- var b = a.config.allowedContent;
- if(b === true) this.disabled = true;
- else {
- if(!b) this.customConfig = false;
- this.allow(b, "config", 1);
- this.allow(a.config.extraAllowedContent, "extra",
- 1);
- this.allow(C[a.enterMode] + " " + C[a.shiftEnterMode], "default", 1);
- this.disallow(a.config.disallowedContent)
- }
- } else {
- this.customConfig = false;
- this.allow(a, "default", 1)
- }
- };
- CKEDITOR.filter.instances = {};
- CKEDITOR.filter.prototype = {
- allow: function(b, c, f) {
- if(!d(this, b, f)) return false;
- var g, h;
- if(typeof b == "string") b = k(b);
- else if(b instanceof CKEDITOR.style) {
- if(b.toAllowedContentRules) return this.allow(b.toAllowedContentRules(this.editor), c, f);
- g = b.getDefinition();
- b = {};
- f = g.attributes;
- b[g.element] = g = {
- styles: g.styles,
- requiredStyles: g.styles && CKEDITOR.tools.objectKeys(g.styles)
- };
- if(f) {
- f = G(f);
- g.classes = f["class"] ? f["class"].split(/\s+/) : null;
- g.requiredClasses = g.classes;
- delete f["class"];
- g.attributes = f;
- g.requiredAttributes = f && CKEDITOR.tools.objectKeys(f)
- }
- } else if(CKEDITOR.tools.isArray(b)) {
- for(g = 0; g < b.length; ++g) h = this.allow(b[g], c, f);
- return h
- }
- a(this, b, c, this.allowedContent, this._.allowedRules);
- return true
- },
- applyTo: function(a, b, c, d) {
- if(this.disabled) return false;
- var f = this,
- g = [],
- h = this.editor && this.editor.config.protectedSource,
- e, j = false,
- i = {
- doFilter: !c,
- doTransform: true,
- doCallbacks: true,
- toHtml: b
- };
- a.forEach(function(a) {
- if(a.type == CKEDITOR.NODE_ELEMENT) {
- if(a.attributes["data-cke-filter"] == "off") return false;
- if(!b || !(a.name == "span" && ~CKEDITOR.tools.objectKeys(a.attributes).join("|").indexOf("data-cke-"))) {
- e = q(f, a, g, i);
- if(e & A) j = true;
- else if(e & 2) return false
- }
- } else if(a.type == CKEDITOR.NODE_COMMENT && a.value.match(/^\{cke_protected\}(?!\{C\})/)) {
- var c;
- a: {
- var d = decodeURIComponent(a.value.replace(/^\{cke_protected\}/, ""));c = [];
- var p,
- m, t;
- if(h)
- for(m = 0; m < h.length; ++m)
- if((t = d.match(h[m])) && t[0].length == d.length) {
- c = true;
- break a
- }
- d = CKEDITOR.htmlParser.fragment.fromHtml(d);d.children.length == 1 && (p = d.children[0]).type == CKEDITOR.NODE_ELEMENT && q(f, p, c, i);c = !c.length
- }
- c || g.push(a)
- }
- }, null, true);
- g.length && (j = true);
- for(var m, a = [], d = C[d || (this.editor ? this.editor.enterMode : CKEDITOR.ENTER_P)], t; c = g.pop();) c.type == CKEDITOR.NODE_ELEMENT ? w(c, d, a) : c.remove();
- for(; m = a.pop();) {
- c = m.el;
- if(c.parent) {
- t = B[c.parent.name] || B.span;
- switch(m.check) {
- case "it":
- B.$removeEmpty[c.name] &&
- !c.children.length ? w(c, d, a) : p(c) || w(c, d, a);
- break;
- case "el-up":
- c.parent.type != CKEDITOR.NODE_DOCUMENT_FRAGMENT && !t[c.name] && w(c, d, a);
- break;
- case "parent-down":
- c.parent.type != CKEDITOR.NODE_DOCUMENT_FRAGMENT && !t[c.name] && w(c.parent, d, a)
- }
- }
- }
- return j
- },
- checkFeature: function(a) {
- if(this.disabled || !a) return true;
- a.toFeature && (a = a.toFeature(this.editor));
- return !a.requiredContent || this.check(a.requiredContent)
- },
- disable: function() {
- this.disabled = true
- },
- disallow: function(b) {
- if(!d(this, b, true)) return false;
- typeof b ==
- "string" && (b = k(b));
- a(this, b, null, this.disallowedContent, this._.disallowedRules);
- return true
- },
- addContentForms: function(a) {
- if(!this.disabled && a) {
- var b, c, d = [],
- f;
- for(b = 0; b < a.length && !f; ++b) {
- c = a[b];
- if((typeof c == "string" || c instanceof CKEDITOR.style) && this.check(c)) f = c
- }
- if(f) {
- for(b = 0; b < a.length; ++b) d.push(r(a[b], f));
- this.addTransformations(d)
- }
- }
- },
- addElementCallback: function(a) {
- if(!this.elementCallbacks) this.elementCallbacks = [];
- this.elementCallbacks.push(a)
- },
- addFeature: function(a) {
- if(this.disabled || !a) return true;
- a.toFeature && (a = a.toFeature(this.editor));
- this.allow(a.allowedContent, a.name);
- this.addTransformations(a.contentTransformations);
- this.addContentForms(a.contentForms);
- return a.requiredContent && (this.customConfig || this.disallowedContent.length) ? this.check(a.requiredContent) : true
- },
- addTransformations: function(a) {
- var b, c;
- if(!this.disabled && a) {
- var d = this._.transformations,
- f;
- for(f = 0; f < a.length; ++f) {
- b = a[f];
- var g = void 0,
- h = void 0,
- e = void 0,
- j = void 0,
- i = void 0,
- p = void 0;
- c = [];
- for(h = 0; h < b.length; ++h) {
- e = b[h];
- if(typeof e ==
- "string") {
- e = e.split(/\s*:\s*/);
- j = e[0];
- i = null;
- p = e[1]
- } else {
- j = e.check;
- i = e.left;
- p = e.right
- }
- if(!g) {
- g = e;
- g = g.element ? g.element : j ? j.match(/^([a-z0-9]+)/i)[0] : g.left.getDefinition().element
- }
- i instanceof CKEDITOR.style && (i = y(i));
- c.push({
- check: j == g ? null : j,
- left: i,
- right: typeof p == "string" ? z(p) : p
- })
- }
- b = g;
- d[b] || (d[b] = []);
- d[b].push(c)
- }
- }
- },
- check: function(a, b, c) {
- if(this.disabled) return true;
- if(CKEDITOR.tools.isArray(a)) {
- for(var d = a.length; d--;)
- if(this.check(a[d], b, c)) return true;
- return false
- }
- var f, g;
- if(typeof a == "string") {
- g =
- a + "<" + (b === false ? "0" : "1") + (c ? "1" : "0") + ">";
- if(g in this._.cachedChecks) return this._.cachedChecks[g];
- d = k(a).$1;
- f = d.styles;
- var h = d.classes;
- d.name = d.elements;
- d.classes = h = h ? h.split(/\s*,\s*/) : [];
- d.styles = i(f);
- d.attributes = i(d.attributes);
- d.children = [];
- h.length && (d.attributes["class"] = h.join(" "));
- if(f) d.attributes.style = CKEDITOR.tools.writeCssText(d.styles);
- f = d
- } else {
- d = a.getDefinition();
- f = d.styles;
- h = d.attributes || {};
- if(f) {
- f = G(f);
- h.style = CKEDITOR.tools.writeCssText(f, true)
- } else f = {};
- f = {
- name: d.element,
- attributes: h,
- classes: h["class"] ? h["class"].split(/\s+/) : [],
- styles: f,
- children: []
- }
- }
- var h = CKEDITOR.tools.clone(f),
- e = [],
- j;
- if(b !== false && (j = this._.transformations[f.name])) {
- for(d = 0; d < j.length; ++d) x(this, f, j[d]);
- l(f)
- }
- q(this, h, e, {
- doFilter: true,
- doTransform: b !== false,
- skipRequired: !c,
- skipFinalValidation: !c
- });
- b = e.length > 0 ? false : CKEDITOR.tools.objectCompare(f.attributes, h.attributes, true) ? true : false;
- typeof a == "string" && (this._.cachedChecks[g] = b);
- return b
- },
- getAllowedEnterMode: function() {
- var a = ["p", "div", "br"],
- b = {
- p: CKEDITOR.ENTER_P,
- div: CKEDITOR.ENTER_DIV,
- br: CKEDITOR.ENTER_BR
- };
- return function(c, d) {
- var f = a.slice(),
- g;
- if(this.check(C[c])) return c;
- for(d || (f = f.reverse()); g = f.pop();)
- if(this.check(g)) return b[g];
- return CKEDITOR.ENTER_BR
- }
- }(),
- destroy: function() {
- delete CKEDITOR.filter.instances[this.id];
- delete this._;
- delete this.allowedContent;
- delete this.disallowedContent
- }
- };
- var F = {
- styles: 1,
- attributes: 1,
- classes: 1
- },
- E = {
- styles: "requiredStyles",
- attributes: "requiredAttributes",
- classes: "requiredClasses"
- },
- I = /^([a-z0-9\-*\s]+)((?:\s*\{[!\w\-,\s\*]+\}\s*|\s*\[[!\w\-,\s\*]+\]\s*|\s*\([!\w\-,\s\*]+\)\s*){0,3})(?:;\s*|$)/i,
- L = {
- styles: /{([^}]+)}/,
- attrs: /\[([^\]]+)\]/,
- classes: /\(([^\)]+)\)/
- },
- H = /^cke:(object|embed|param)$/,
- Q = /^(object|embed|param)$/,
- O = CKEDITOR.filter.transformationsTools = {
- sizeToStyle: function(a) {
- this.lengthToStyle(a, "width");
- this.lengthToStyle(a, "height")
- },
- sizeToAttribute: function(a) {
- this.lengthToAttribute(a, "width");
- this.lengthToAttribute(a, "height")
- },
- lengthToStyle: function(a, b, c) {
- c = c || b;
- if(!(c in a.styles)) {
- var d = a.attributes[b];
- if(d) {
- /^\d+$/.test(d) && (d = d + "px");
- a.styles[c] = d
- }
- }
- delete a.attributes[b]
- },
- lengthToAttribute: function(a, b, c) {
- c = c || b;
- if(!(c in a.attributes)) {
- var d = a.styles[b],
- f = d && d.match(/^(\d+)(?:\.\d*)?px$/);
- f ? a.attributes[c] = f[1] : d == J && (a.attributes[c] = J)
- }
- delete a.styles[b]
- },
- alignmentToStyle: function(a) {
- if(!("float" in a.styles)) {
- var b = a.attributes.align;
- if(b == "left" || b == "right") a.styles["float"] = b
- }
- delete a.attributes.align
- },
- alignmentToAttribute: function(a) {
- if(!("align" in a.attributes)) {
- var b = a.styles["float"];
- if(b == "left" || b == "right") a.attributes.align = b
- }
- delete a.styles["float"]
- },
- matchesStyle: v,
- transform: function(a, b) {
- if(typeof b == "string") a.name = b;
- else {
- var c = b.getDefinition(),
- d = c.styles,
- f = c.attributes,
- g, h, e, j;
- a.name = c.element;
- for(g in f)
- if(g == "class") {
- c = a.classes.join("|");
- for(e = f[g].split(/\s+/); j = e.pop();) c.indexOf(j) == -1 && a.classes.push(j)
- } else a.attributes[g] = f[g];
- for(h in d) a.styles[h] = d[h]
- }
- }
- }
- }(),
- function() {
- CKEDITOR.focusManager = function(a) {
- if(a.focusManager) return a.focusManager;
- this.hasFocus = false;
- this.currentActive = null;
- this._ = {
- editor: a
- };
- return this
- };
- CKEDITOR.focusManager._ = {
- blurDelay: 200
- };
- CKEDITOR.focusManager.prototype = {
- focus: function(a) {
- this._.timer && clearTimeout(this._.timer);
- if(a) this.currentActive = a;
- if(!this.hasFocus && !this._.locked) {
- (a = CKEDITOR.currentInstance) && a.focusManager.blur(1);
- this.hasFocus = true;
- (a = this._.editor.container) && a.addClass("cke_focus");
- this._.editor.fire("focus")
- }
- },
- lock: function() {
- this._.locked = 1
- },
- unlock: function() {
- delete this._.locked
- },
- blur: function(a) {
- function e() {
- if(this.hasFocus) {
- this.hasFocus = false;
- var a = this._.editor.container;
- a && a.removeClass("cke_focus");
- this._.editor.fire("blur")
- }
- }
- if(!this._.locked) {
- this._.timer && clearTimeout(this._.timer);
- var b = CKEDITOR.focusManager._.blurDelay;
- a || !b ? e.call(this) : this._.timer = CKEDITOR.tools.setTimeout(function() {
- delete this._.timer;
- e.call(this)
- }, b, this)
- }
- },
- add: function(a, e) {
- var b = a.getCustomData("focusmanager");
- if(!b || b != this) {
- b && b.remove(a);
- var b = "focus",
- g = "blur";
- if(e)
- if(CKEDITOR.env.ie) {
- b = "focusin";
- g = "focusout"
- } else CKEDITOR.event.useCapture = 1;
- var c = {
- blur: function() {
- a.equals(this.currentActive) && this.blur()
- },
- focus: function() {
- this.focus(a)
- }
- };
- a.on(b, c.focus, this);
- a.on(g, c.blur, this);
- if(e) CKEDITOR.event.useCapture = 0;
- a.setCustomData("focusmanager", this);
- a.setCustomData("focusmanager_handlers", c)
- }
- },
- remove: function(a) {
- a.removeCustomData("focusmanager");
- var e = a.removeCustomData("focusmanager_handlers");
- a.removeListener("blur", e.blur);
- a.removeListener("focus", e.focus)
- }
- }
- }(), CKEDITOR.keystrokeHandler = function(a) {
- if(a.keystrokeHandler) return a.keystrokeHandler;
- this.keystrokes = {};
- this.blockedKeystrokes = {};
- this._ = {
- editor: a
- };
- return this
- },
- function() {
- var a,
- e = function(b) {
- var b = b.data,
- c = b.getKeystroke(),
- d = this.keystrokes[c],
- e = this._.editor;
- a = e.fire("key", {
- keyCode: c,
- domEvent: b
- }) === false;
- if(!a) {
- d && (a = e.execCommand(d, {
- from: "keystrokeHandler"
- }) !== false);
- a || (a = !!this.blockedKeystrokes[c])
- }
- a && b.preventDefault(true);
- return !a
- },
- b = function(b) {
- if(a) {
- a = false;
- b.data.preventDefault(true)
- }
- };
- CKEDITOR.keystrokeHandler.prototype = {
- attach: function(a) {
- a.on("keydown", e, this);
- if(CKEDITOR.env.gecko && CKEDITOR.env.mac) a.on("keypress", b, this)
- }
- }
- }(),
- function() {
- CKEDITOR.lang = {
- languages: {
- af: 1,
- ar: 1,
- bg: 1,
- bn: 1,
- bs: 1,
- ca: 1,
- cs: 1,
- cy: 1,
- da: 1,
- de: 1,
- el: 1,
- "en-au": 1,
- "en-ca": 1,
- "en-gb": 1,
- en: 1,
- eo: 1,
- es: 1,
- et: 1,
- eu: 1,
- fa: 1,
- fi: 1,
- fo: 1,
- "fr-ca": 1,
- fr: 1,
- gl: 1,
- gu: 1,
- he: 1,
- hi: 1,
- hr: 1,
- hu: 1,
- id: 1,
- is: 1,
- it: 1,
- ja: 1,
- ka: 1,
- km: 1,
- ko: 1,
- ku: 1,
- lt: 1,
- lv: 1,
- mk: 1,
- mn: 1,
- ms: 1,
- nb: 1,
- nl: 1,
- no: 1,
- pl: 1,
- "pt-br": 1,
- pt: 1,
- ro: 1,
- ru: 1,
- si: 1,
- sk: 1,
- sl: 1,
- sq: 1,
- "sr-latn": 1,
- sr: 1,
- sv: 1,
- th: 1,
- tr: 1,
- tt: 1,
- ug: 1,
- uk: 1,
- vi: 1,
- "zh-cn": 1,
- zh: 1
- },
- rtl: {
- ar: 1,
- fa: 1,
- he: 1,
- ku: 1,
- ug: 1
- },
- load: function(a, e, b) {
- if(!a || !CKEDITOR.lang.languages[a]) a = this.detect(e, a);
- var g = this,
- e = function() {
- g[a].dir =
- g.rtl[a] ? "rtl" : "ltr";
- b(a, g[a])
- };
- this[a] ? e() : CKEDITOR.scriptLoader.load(CKEDITOR.getUrl("lang/" + a + ".js"), e, this)
- },
- detect: function(a, e) {
- var b = this.languages,
- e = e || navigator.userLanguage || navigator.language || a,
- g = e.toLowerCase().match(/([a-z]+)(?:-([a-z]+))?/),
- c = g[1],
- g = g[2];
- b[c + "-" + g] ? c = c + "-" + g : b[c] || (c = null);
- CKEDITOR.lang.detect = c ? function() {
- return c
- } : function(a) {
- return a
- };
- return c || a
- }
- }
- }(), CKEDITOR.scriptLoader = function() {
- var a = {},
- e = {};
- return {
- load: function(b, g, c, d) {
- var j = typeof b == "string";
- j && (b = [b]);
- c || (c = CKEDITOR);
- var f = b.length,
- h = [],
- i = [],
- k = function(a) {
- g && (j ? g.call(c, a) : g.call(c, h, i))
- };
- if(f === 0) k(true);
- else {
- var n = function(a, b) {
- (b ? h : i).push(a);
- if(--f <= 0) {
- d && CKEDITOR.document.getDocumentElement().removeStyle("cursor");
- k(b)
- }
- },
- o = function(b, c) {
- a[b] = 1;
- var d = e[b];
- delete e[b];
- for(var f = 0; f < d.length; f++) d[f](b, c)
- },
- q = function(b) {
- if(a[b]) n(b, true);
- else {
- var c = e[b] || (e[b] = []);
- c.push(n);
- if(!(c.length > 1)) {
- var d = new CKEDITOR.dom.element("script");
- d.setAttributes({
- type: "text/javascript",
- src: b
- });
- if(g)
- if(CKEDITOR.env.ie &&
- CKEDITOR.env.version < 11) d.$.onreadystatechange = function() {
- if(d.$.readyState == "loaded" || d.$.readyState == "complete") {
- d.$.onreadystatechange = null;
- o(b, true)
- }
- };
- else {
- d.$.onload = function() {
- setTimeout(function() {
- o(b, true)
- }, 0)
- };
- d.$.onerror = function() {
- o(b, false)
- }
- }
- d.appendTo(CKEDITOR.document.getHead())
- }
- }
- };
- d && CKEDITOR.document.getDocumentElement().setStyle("cursor", "wait");
- for(var m = 0; m < f; m++) q(b[m])
- }
- },
- queue: function() {
- function a() {
- var b;
- (b = g[0]) && this.load(b.scriptUrl, b.callback, CKEDITOR, 0)
- }
- var g = [];
- return function(c,
- d) {
- var e = this;
- g.push({
- scriptUrl: c,
- callback: function() {
- d && d.apply(this, arguments);
- g.shift();
- a.call(e)
- }
- });
- g.length == 1 && a.call(this)
- }
- }()
- }
- }(), CKEDITOR.resourceManager = function(a, e) {
- this.basePath = a;
- this.fileName = e;
- this.registered = {};
- this.loaded = {};
- this.externals = {};
- this._ = {
- waitingList: {}
- }
- }, CKEDITOR.resourceManager.prototype = {
- add: function(a, e) {
- if(this.registered[a]) throw '[CKEDITOR.resourceManager.add] The resource name "' + a + '" is already registered.';
- var b = this.registered[a] = e || {};
- b.name = a;
- b.path = this.getPath(a);
- CKEDITOR.fire(a + CKEDITOR.tools.capitalize(this.fileName) + "Ready", b);
- return this.get(a)
- },
- get: function(a) {
- return this.registered[a] || null
- },
- getPath: function(a) {
- var e = this.externals[a];
- return CKEDITOR.getUrl(e && e.dir || this.basePath + a + "/")
- },
- getFilePath: function(a) {
- var e = this.externals[a];
- return CKEDITOR.getUrl(this.getPath(a) + (e ? e.file : this.fileName + ".js"))
- },
- addExternal: function(a, e, b) {
- for(var a = a.split(","), g = 0; g < a.length; g++) {
- var c = a[g];
- b || (e = e.replace(/[^\/]+$/, function(a) {
- b = a;
- return ""
- }));
- this.externals[c] = {
- dir: e,
- file: b || this.fileName + ".js"
- }
- }
- },
- load: function(a, e, b) {
- CKEDITOR.tools.isArray(a) || (a = a ? [a] : []);
- for(var g = this.loaded, c = this.registered, d = [], j = {}, f = {}, h = 0; h < a.length; h++) {
- var i = a[h];
- if(i)
- if(!g[i] && !c[i]) {
- var k = this.getFilePath(i);
- d.push(k);
- k in j || (j[k] = []);
- j[k].push(i)
- } else f[i] = this.get(i)
- }
- CKEDITOR.scriptLoader.load(d, function(a, c) {
- if(c.length) throw '[CKEDITOR.resourceManager.load] Resource name "' + j[c[0]].join(",") + '" was not found at "' + c[0] + '".';
- for(var d = 0; d < a.length; d++)
- for(var h = j[a[d]],
- i = 0; i < h.length; i++) {
- var p = h[i];
- f[p] = this.get(p);
- g[p] = 1
- }
- e.call(b, f)
- }, this)
- }
- }, CKEDITOR.plugins = new CKEDITOR.resourceManager("plugins/", "plugin"), CKEDITOR.plugins.load = CKEDITOR.tools.override(CKEDITOR.plugins.load, function(a) {
- var e = {};
- return function(b, g, c) {
- var d = {},
- j = function(b) {
- a.call(this, b, function(a) {
- CKEDITOR.tools.extend(d, a);
- var b = [],
- f;
- for(f in a) {
- var n = a[f],
- o = n && n.requires;
- if(!e[f]) {
- if(n.icons)
- for(var q = n.icons.split(","), m = q.length; m--;) CKEDITOR.skin.addIcon(q[m], n.path + "icons/" + (CKEDITOR.env.hidpi &&
- n.hidpi ? "hidpi/" : "") + q[m] + ".png");
- e[f] = 1
- }
- if(o) {
- o.split && (o = o.split(","));
- for(n = 0; n < o.length; n++) d[o[n]] || b.push(o[n])
- }
- }
- if(b.length) j.call(this, b);
- else {
- for(f in d) {
- n = d[f];
- if(n.onLoad && !n.onLoad._called) {
- n.onLoad() === false && delete d[f];
- n.onLoad._called = 1
- }
- }
- g && g.call(c || window, d)
- }
- }, this)
- };
- j.call(this, b)
- }
- }), CKEDITOR.plugins.setLang = function(a, e, b) {
- var g = this.get(a),
- a = g.langEntries || (g.langEntries = {}),
- g = g.lang || (g.lang = []);
- g.split && (g = g.split(","));
- CKEDITOR.tools.indexOf(g, e) == -1 && g.push(e);
- a[e] = b
- }, CKEDITOR.ui =
- function(a) {
- if(a.ui) return a.ui;
- this.items = {};
- this.instances = {};
- this.editor = a;
- this._ = {
- handlers: {}
- };
- return this
- }, CKEDITOR.ui.prototype = {
- add: function(a, e, b) {
- b.name = a.toLowerCase();
- var g = this.items[a] = {
- type: e,
- command: b.command || null,
- args: Array.prototype.slice.call(arguments, 2)
- };
- CKEDITOR.tools.extend(g, b)
- },
- get: function(a) {
- return this.instances[a]
- },
- create: function(a) {
- var e = this.items[a],
- b = e && this._.handlers[e.type],
- g = e && e.command && this.editor.getCommand(e.command),
- b = b && b.create.apply(this, e.args);
- this.instances[a] =
- b;
- g && g.uiItems.push(b);
- if(b && !b.type) b.type = e.type;
- return b
- },
- addHandler: function(a, e) {
- this._.handlers[a] = e
- },
- space: function(a) {
- return CKEDITOR.document.getById(this.spaceId(a))
- },
- spaceId: function(a) {
- return this.editor.id + "_" + a
- }
- }, CKEDITOR.event.implementOn(CKEDITOR.ui),
- function() {
- function a(a, d, f) {
- CKEDITOR.event.call(this);
- a = a && CKEDITOR.tools.clone(a);
- if(d !== void 0) {
- if(d instanceof CKEDITOR.dom.element) {
- if(!f) throw Error("One of the element modes must be specified.");
- } else throw Error("Expect element of type CKEDITOR.dom.element.");
- if(CKEDITOR.env.ie && CKEDITOR.env.quirks && f == CKEDITOR.ELEMENT_MODE_INLINE) throw Error("Inline element mode is not supported on IE quirks.");
- if(!(f == CKEDITOR.ELEMENT_MODE_INLINE ? d.is(CKEDITOR.dtd.$editable) || d.is("textarea") : f == CKEDITOR.ELEMENT_MODE_REPLACE ? !d.is(CKEDITOR.dtd.$nonBodyContent) : 1)) throw Error('The specified element mode is not supported on element: "' + d.getName() + '".');
- this.element = d;
- this.elementMode = f;
- this.name = this.elementMode != CKEDITOR.ELEMENT_MODE_APPENDTO && (d.getId() || d.getNameAtt())
- } else this.elementMode =
- CKEDITOR.ELEMENT_MODE_NONE;
- this._ = {};
- this.commands = {};
- this.templates = {};
- this.name = this.name || e();
- this.id = CKEDITOR.tools.getNextId();
- this.status = "unloaded";
- this.config = CKEDITOR.tools.prototypedCopy(CKEDITOR.config);
- this.ui = new CKEDITOR.ui(this);
- this.focusManager = new CKEDITOR.focusManager(this);
- this.keystrokeHandler = new CKEDITOR.keystrokeHandler(this);
- this.on("readOnly", b);
- this.on("selectionChange", function(a) {
- c(this, a.data.path)
- });
- this.on("activeFilterChange", function() {
- c(this, this.elementPath(), true)
- });
- this.on("mode", b);
- this.on("instanceReady", function() {
- this.config.startupFocus && this.focus()
- });
- CKEDITOR.fire("instanceCreated", null, this);
- CKEDITOR.add(this);
- CKEDITOR.tools.setTimeout(function() {
- j(this, a)
- }, 0, this)
- }
- function e() {
- do var a = "editor" + ++o; while (CKEDITOR.instances[a]);
- return a
- }
- function b() {
- var a = this.commands,
- b;
- for(b in a) g(this, a[b])
- }
- function g(a, b) {
- b[b.startDisabled ? "disable" : a.readOnly && !b.readOnly ? "disable" : b.modes[a.mode] ? "enable" : "disable"]()
- }
- function c(a, b, c) {
- if(b) {
- var d, f, g = a.commands;
- for(f in g) {
- d = g[f];
- (c || d.contextSensitive) && d.refresh(a, b)
- }
- }
- }
- function d(a) {
- var b = a.config.customConfig;
- if(!b) return false;
- var b = CKEDITOR.getUrl(b),
- c = q[b] || (q[b] = {});
- if(c.fn) {
- c.fn.call(a, a.config);
- (CKEDITOR.getUrl(a.config.customConfig) == b || !d(a)) && a.fireOnce("customConfigLoaded")
- } else CKEDITOR.scriptLoader.queue(b, function() {
- c.fn = CKEDITOR.editorConfig ? CKEDITOR.editorConfig : function() {};
- d(a)
- });
- return true
- }
- function j(a, b) {
- a.on("customConfigLoaded", function() {
- if(b) {
- if(b.on)
- for(var c in b.on) a.on(c, b.on[c]);
- CKEDITOR.tools.extend(a.config, b, true);
- delete a.config.on
- }
- c = a.config;
- a.readOnly = !(!c.readOnly && !(a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ? a.element.is("textarea") ? a.element.hasAttribute("disabled") : a.element.isReadOnly() : a.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && a.element.hasAttribute("disabled")));
- a.blockless = a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ? !(a.element.is("textarea") || CKEDITOR.dtd[a.element.getName()].p) : false;
- a.tabIndex = c.tabIndex || a.element && a.element.getAttribute("tabindex") ||
- 0;
- a.activeEnterMode = a.enterMode = a.blockless ? CKEDITOR.ENTER_BR : c.enterMode;
- a.activeShiftEnterMode = a.shiftEnterMode = a.blockless ? CKEDITOR.ENTER_BR : c.shiftEnterMode;
- if(c.skin) CKEDITOR.skinName = c.skin;
- a.fireOnce("configLoaded");
- a.dataProcessor = new CKEDITOR.htmlDataProcessor(a);
- a.filter = a.activeFilter = new CKEDITOR.filter(a);
- f(a)
- });
- if(b && b.customConfig != null) a.config.customConfig = b.customConfig;
- d(a) || a.fireOnce("customConfigLoaded")
- }
- function f(a) {
- CKEDITOR.skin.loadPart("editor", function() {
- h(a)
- })
- }
- function h(a) {
- CKEDITOR.lang.load(a.config.language,
- a.config.defaultLanguage,
- function(b, c) {
- var d = a.config.title;
- a.langCode = b;
- a.lang = CKEDITOR.tools.prototypedCopy(c);
- a.title = typeof d == "string" || d === false ? d : [a.lang.editor, a.name].join(", ");
- if(!a.config.contentsLangDirection) a.config.contentsLangDirection = a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ? a.element.getDirection(1) : a.lang.dir;
- a.fire("langLoaded");
- i(a)
- })
- }
- function i(a) {
- a.getStylesSet(function(b) {
- a.once("loaded", function() {
- a.fire("stylesSet", {
- styles: b
- })
- }, null, null, 1);
- k(a)
- })
- }
- function k(a) {
- var b =
- a.config,
- c = b.plugins,
- d = b.extraPlugins,
- f = b.removePlugins;
- if(d) var g = RegExp("(?:^|,)(?:" + d.replace(/\s*,\s*/g, "|") + ")(?=,|$)", "g"),
- c = c.replace(g, ""),
- c = c + ("," + d);
- if(f) var h = RegExp("(?:^|,)(?:" + f.replace(/\s*,\s*/g, "|") + ")(?=,|$)", "g"),
- c = c.replace(h, "");
- CKEDITOR.env.air && (c = c + ",adobeair");
- CKEDITOR.plugins.load(c.split(","), function(c) {
- var d = [],
- f = [],
- g = [];
- a.plugins = c;
- for(var e in c) {
- var j = c[e],
- i = j.lang,
- p = null,
- t = j.requires,
- k;
- CKEDITOR.tools.isArray(t) && (t = t.join(","));
- if(t && (k = t.match(h)))
- for(; t = k.pop();) CKEDITOR.tools.setTimeout(function(a,
- b) {
- throw Error('Plugin "' + a.replace(",", "") + '" cannot be removed from the plugins list, because it\'s required by "' + b + '" plugin.');
- }, 0, null, [t, e]);
- if(i && !a.lang[e]) {
- i.split && (i = i.split(","));
- if(CKEDITOR.tools.indexOf(i, a.langCode) >= 0) p = a.langCode;
- else {
- p = a.langCode.replace(/-.*/, "");
- p = p != a.langCode && CKEDITOR.tools.indexOf(i, p) >= 0 ? p : CKEDITOR.tools.indexOf(i, "en") >= 0 ? "en" : i[0]
- }
- if(!j.langEntries || !j.langEntries[p]) g.push(CKEDITOR.getUrl(j.path + "lang/" + p + ".js"));
- else {
- a.lang[e] = j.langEntries[p];
- p = null
- }
- }
- f.push(p);
- d.push(j)
- }
- CKEDITOR.scriptLoader.load(g, function() {
- for(var c = ["beforeInit", "init", "afterInit"], g = 0; g < c.length; g++)
- for(var h = 0; h < d.length; h++) {
- var e = d[h];
- g === 0 && (f[h] && e.lang && e.langEntries) && (a.lang[e.name] = e.langEntries[f[h]]);
- if(e[c[g]]) e[c[g]](a)
- }
- a.fireOnce("pluginsLoaded");
- b.keystrokes && a.setKeystroke(a.config.keystrokes);
- for(h = 0; h < a.config.blockedKeystrokes.length; h++) a.keystrokeHandler.blockedKeystrokes[a.config.blockedKeystrokes[h]] = 1;
- a.status = "loaded";
- a.fireOnce("loaded");
- CKEDITOR.fire("instanceLoaded",
- null, a)
- })
- })
- }
- function n() {
- var a = this.element;
- if(a && this.elementMode != CKEDITOR.ELEMENT_MODE_APPENDTO) {
- var b = this.getData();
- this.config.htmlEncodeOutput && (b = CKEDITOR.tools.htmlEncode(b));
- a.is("textarea") ? a.setValue(b) : a.setHtml(b);
- return true
- }
- return false
- }
- a.prototype = CKEDITOR.editor.prototype;
- CKEDITOR.editor = a;
- var o = 0,
- q = {};
- CKEDITOR.tools.extend(CKEDITOR.editor.prototype, {
- addCommand: function(a, b) {
- b.name = a.toLowerCase();
- var c = new CKEDITOR.command(this, b);
- this.mode && g(this, c);
- return this.commands[a] = c
- },
- _attachToForm: function() {
- function a(d) {
- b.updateElement();
- b._.required && (!c.getValue() && b.fire("required") === false) && d.data.preventDefault()
- }
- var b = this,
- c = b.element,
- d = new CKEDITOR.dom.element(c.$.form);
- if(c.is("textarea") && d) {
- d.on("submit", a);
- if(d.$.submit && d.$.submit.call && d.$.submit.apply) d.$.submit = CKEDITOR.tools.override(d.$.submit, function(b) {
- return function() {
- a();
- b.apply ? b.apply(this) : b()
- }
- });
- b.on("destroy", function() {
- d.removeListener("submit", a)
- })
- }
- },
- destroy: function(a) {
- this.fire("beforeDestroy");
- !a && n.call(this);
- this.editable(null);
- this.filter.destroy();
- delete this.filter;
- delete this.activeFilter;
- this.status = "destroyed";
- this.fire("destroy");
- this.removeAllListeners();
- CKEDITOR.remove(this);
- CKEDITOR.fire("instanceDestroyed", null, this)
- },
- elementPath: function(a) {
- if(!a) {
- a = this.getSelection();
- if(!a) return null;
- a = a.getStartElement()
- }
- return a ? new CKEDITOR.dom.elementPath(a, this.editable()) : null
- },
- createRange: function() {
- var a = this.editable();
- return a ? new CKEDITOR.dom.range(a) : null
- },
- execCommand: function(a,
- b) {
- var c = this.getCommand(a),
- d = {
- name: a,
- commandData: b,
- command: c
- };
- if(c && c.state != CKEDITOR.TRISTATE_DISABLED && this.fire("beforeCommandExec", d) !== false) {
- d.returnValue = c.exec(d.commandData);
- if(!c.async && this.fire("afterCommandExec", d) !== false) return d.returnValue
- }
- return false
- },
- getCommand: function(a) {
- return this.commands[a]
- },
- getData: function(a) {
- !a && this.fire("beforeGetData");
- var b = this._.data;
- if(typeof b != "string") b = (b = this.element) && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ? b.is("textarea") ? b.getValue() :
- b.getHtml() : "";
- b = {
- dataValue: b
- };
- !a && this.fire("getData", b);
- return b.dataValue
- },
- getSnapshot: function() {
- var a = this.fire("getSnapshot");
- if(typeof a != "string") {
- var b = this.element;
- b && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && (a = b.is("textarea") ? b.getValue() : b.getHtml())
- }
- return a
- },
- loadSnapshot: function(a) {
- this.fire("loadSnapshot", a)
- },
- setData: function(a, b, c) {
- var d = true,
- f = b;
- if(b && typeof b == "object") {
- c = b.internal;
- f = b.callback;
- d = !b.noSnapshot
- }!c && d && this.fire("saveSnapshot");
- if(f || !c) this.once("dataReady",
- function(a) {
- !c && d && this.fire("saveSnapshot");
- f && f.call(a.editor)
- });
- a = {
- dataValue: a
- };
- !c && this.fire("setData", a);
- this._.data = a.dataValue;
- !c && this.fire("afterSetData", a)
- },
- setReadOnly: function(a) {
- a = a == null || a;
- if(this.readOnly != a) {
- this.readOnly = a;
- this.keystrokeHandler.blockedKeystrokes[8] = +a;
- this.editable().setReadOnly(a);
- this.fire("readOnly")
- }
- },
- insertHtml: function(a, b) {
- this.fire("insertHtml", {
- dataValue: a,
- mode: b
- })
- },
- insertText: function(a) {
- this.fire("insertText", a)
- },
- insertElement: function(a) {
- this.fire("insertElement",
- a)
- },
- focus: function() {
- this.fire("beforeFocus")
- },
- checkDirty: function() {
- return this.status == "ready" && this._.previousValue !== this.getSnapshot()
- },
- resetDirty: function() {
- this._.previousValue = this.getSnapshot()
- },
- updateElement: function() {
- return n.call(this)
- },
- setKeystroke: function() {
- for(var a = this.keystrokeHandler.keystrokes, b = CKEDITOR.tools.isArray(arguments[0]) ? arguments[0] : [
- [].slice.call(arguments, 0)
- ], c, d, f = b.length; f--;) {
- c = b[f];
- d = 0;
- if(CKEDITOR.tools.isArray(c)) {
- d = c[1];
- c = c[0]
- }
- d ? a[c] = d : delete a[c]
- }
- },
- addFeature: function(a) {
- return this.filter.addFeature(a)
- },
- setActiveFilter: function(a) {
- if(!a) a = this.filter;
- if(this.activeFilter !== a) {
- this.activeFilter = a;
- this.fire("activeFilterChange");
- a === this.filter ? this.setActiveEnterMode(null, null) : this.setActiveEnterMode(a.getAllowedEnterMode(this.enterMode), a.getAllowedEnterMode(this.shiftEnterMode, true))
- }
- },
- setActiveEnterMode: function(a, b) {
- a = a ? this.blockless ? CKEDITOR.ENTER_BR : a : this.enterMode;
- b = b ? this.blockless ? CKEDITOR.ENTER_BR : b : this.shiftEnterMode;
- if(this.activeEnterMode != a || this.activeShiftEnterMode != b) {
- this.activeEnterMode =
- a;
- this.activeShiftEnterMode = b;
- this.fire("activeEnterModeChange")
- }
- }
- })
- }(), CKEDITOR.ELEMENT_MODE_NONE = 0, CKEDITOR.ELEMENT_MODE_REPLACE = 1, CKEDITOR.ELEMENT_MODE_APPENDTO = 2, CKEDITOR.ELEMENT_MODE_INLINE = 3, CKEDITOR.htmlParser = function() {
- this._ = {
- htmlPartsRegex: /<(?:(?:\/([^>]+)>)|(?:!--([\S|\s]*?)--\>)|(?:([^\/\s>]+)((?:\s+[\w\-:.]+(?:\s*=\s*?(?:(?:"[^"]*")|(?:'[^']*')|[^\s"'\/>]+))?)*)[\S\s]*?(\/?)>))/g
- }
- },
- function() {
- var a = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
- e = {
- checked: 1,
- compact: 1,
- declare: 1,
- defer: 1,
- disabled: 1,
- ismap: 1,
- multiple: 1,
- nohref: 1,
- noresize: 1,
- noshade: 1,
- nowrap: 1,
- readonly: 1,
- selected: 1
- };
- CKEDITOR.htmlParser.prototype = {
- onTagOpen: function() {},
- onTagClose: function() {},
- onText: function() {},
- onCDATA: function() {},
- onComment: function() {},
- parse: function(b) {
- for(var g, c, d = 0, j; g = this._.htmlPartsRegex.exec(b);) {
- c = g.index;
- if(c > d) {
- d = b.substring(d, c);
- if(j) j.push(d);
- else this.onText(d)
- }
- d = this._.htmlPartsRegex.lastIndex;
- if(c = g[1]) {
- c = c.toLowerCase();
- if(j && CKEDITOR.dtd.$cdata[c]) {
- this.onCDATA(j.join(""));
- j = null
- }
- if(!j) {
- this.onTagClose(c);
- continue
- }
- }
- if(j) j.push(g[0]);
- else if(c = g[3]) {
- c = c.toLowerCase();
- if(!/="/.test(c)) {
- var f = {},
- h, i = g[4];
- g = !!g[5];
- if(i)
- for(; h = a.exec(i);) {
- var k = h[1].toLowerCase();
- h = h[2] || h[3] || h[4] || "";
- f[k] = !h && e[k] ? k : CKEDITOR.tools.htmlDecodeAttr(h)
- }
- this.onTagOpen(c, f, g);
- !j && CKEDITOR.dtd.$cdata[c] && (j = [])
- }
- } else if(c = g[2]) this.onComment(c)
- }
- if(b.length > d) this.onText(b.substring(d, b.length))
- }
- }
- }(), CKEDITOR.htmlParser.basicWriter = CKEDITOR.tools.createClass({
- $: function() {
- this._ = {
- output: []
- }
- },
- proto: {
- openTag: function(a) {
- this._.output.push("<", a)
- },
- openTagClose: function(a, e) {
- e ? this._.output.push(" />") : this._.output.push(">")
- },
- attribute: function(a, e) {
- typeof e == "string" && (e = CKEDITOR.tools.htmlEncodeAttr(e));
- this._.output.push(" ", a, '="', e, '"')
- },
- closeTag: function(a) {
- this._.output.push("</", a, ">")
- },
- text: function(a) {
- this._.output.push(a)
- },
- comment: function(a) {
- this._.output.push("<\!--", a, "--\>")
- },
- write: function(a) {
- this._.output.push(a)
- },
- reset: function() {
- this._.output = [];
- this._.indent = false
- },
- getHtml: function(a) {
- var e =
- this._.output.join("");
- a && this.reset();
- return e
- }
- }
- }), "use strict",
- function() {
- CKEDITOR.htmlParser.node = function() {};
- CKEDITOR.htmlParser.node.prototype = {
- remove: function() {
- var a = this.parent.children,
- e = CKEDITOR.tools.indexOf(a, this),
- b = this.previous,
- g = this.next;
- b && (b.next = g);
- g && (g.previous = b);
- a.splice(e, 1);
- this.parent = null
- },
- replaceWith: function(a) {
- var e = this.parent.children,
- b = CKEDITOR.tools.indexOf(e, this),
- g = a.previous = this.previous,
- c = a.next = this.next;
- g && (g.next = a);
- c && (c.previous = a);
- e[b] = a;
- a.parent = this.parent;
- this.parent = null
- },
- insertAfter: function(a) {
- var e = a.parent.children,
- b = CKEDITOR.tools.indexOf(e, a),
- g = a.next;
- e.splice(b + 1, 0, this);
- this.next = a.next;
- this.previous = a;
- a.next = this;
- g && (g.previous = this);
- this.parent = a.parent
- },
- insertBefore: function(a) {
- var e = a.parent.children,
- b = CKEDITOR.tools.indexOf(e, a);
- e.splice(b, 0, this);
- this.next = a;
- (this.previous = a.previous) && (a.previous.next = this);
- a.previous = this;
- this.parent = a.parent
- },
- getAscendant: function(a) {
- var e = typeof a == "function" ? a : typeof a == "string" ? function(b) {
- return b.name ==
- a
- } : function(b) {
- return b.name in a
- },
- b = this.parent;
- for(; b && b.type == CKEDITOR.NODE_ELEMENT;) {
- if(e(b)) return b;
- b = b.parent
- }
- return null
- },
- wrapWith: function(a) {
- this.replaceWith(a);
- a.add(this);
- return a
- },
- getIndex: function() {
- return CKEDITOR.tools.indexOf(this.parent.children, this)
- },
- getFilterContext: function(a) {
- return a || {}
- }
- }
- }(), "use strict", CKEDITOR.htmlParser.comment = function(a) {
- this.value = a;
- this._ = {
- isBlockLike: false
- }
- }, CKEDITOR.htmlParser.comment.prototype = CKEDITOR.tools.extend(new CKEDITOR.htmlParser.node, {
- type: CKEDITOR.NODE_COMMENT,
- filter: function(a, e) {
- var b = this.value;
- if(!(b = a.onComment(e, b, this))) {
- this.remove();
- return false
- }
- if(typeof b != "string") {
- this.replaceWith(b);
- return false
- }
- this.value = b;
- return true
- },
- writeHtml: function(a, e) {
- e && this.filter(e);
- a.comment(this.value)
- }
- }), "use strict",
- function() {
- CKEDITOR.htmlParser.text = function(a) {
- this.value = a;
- this._ = {
- isBlockLike: false
- }
- };
- CKEDITOR.htmlParser.text.prototype = CKEDITOR.tools.extend(new CKEDITOR.htmlParser.node, {
- type: CKEDITOR.NODE_TEXT,
- filter: function(a,
- e) {
- if(!(this.value = a.onText(e, this.value, this))) {
- this.remove();
- return false
- }
- },
- writeHtml: function(a, e) {
- e && this.filter(e);
- a.text(this.value)
- }
- })
- }(), "use strict",
- function() {
- CKEDITOR.htmlParser.cdata = function(a) {
- this.value = a
- };
- CKEDITOR.htmlParser.cdata.prototype = CKEDITOR.tools.extend(new CKEDITOR.htmlParser.node, {
- type: CKEDITOR.NODE_TEXT,
- filter: function() {},
- writeHtml: function(a) {
- a.write(this.value)
- }
- })
- }(), "use strict", CKEDITOR.htmlParser.fragment = function() {
- this.children = [];
- this.parent = null;
- this._ = {
- isBlockLike: true,
- hasInlineStarted: false
- }
- },
- function() {
- function a(a) {
- return a.attributes["data-cke-survive"] ? false : a.name == "a" && a.attributes.href || CKEDITOR.dtd.$removeEmpty[a.name]
- }
- var e = CKEDITOR.tools.extend({
- table: 1,
- ul: 1,
- ol: 1,
- dl: 1
- }, CKEDITOR.dtd.table, CKEDITOR.dtd.ul, CKEDITOR.dtd.ol, CKEDITOR.dtd.dl),
- b = {
- ol: 1,
- ul: 1
- },
- g = CKEDITOR.tools.extend({}, {
- html: 1
- }, CKEDITOR.dtd.html, CKEDITOR.dtd.body, CKEDITOR.dtd.head, {
- style: 1,
- script: 1
- }),
- c = {
- ul: "li",
- ol: "li",
- dl: "dd",
- table: "tbody",
- tbody: "tr",
- thead: "tr",
- tfoot: "tr",
- tr: "td"
- };
- CKEDITOR.htmlParser.fragment.fromHtml =
- function(d, j, f) {
- function h(a) {
- var b;
- if(p.length > 0)
- for(var c = 0; c < p.length; c++) {
- var d = p[c],
- f = d.name,
- g = CKEDITOR.dtd[f],
- h = s.name && CKEDITOR.dtd[s.name];
- if((!h || h[f]) && (!a || !g || g[a] || !CKEDITOR.dtd[a])) {
- if(!b) {
- i();
- b = 1
- }
- d = d.clone();
- d.parent = s;
- s = d;
- p.splice(c, 1);
- c--
- } else if(f == s.name) {
- n(s, s.parent, 1);
- c--
- }
- }
- }
- function i() {
- for(; t.length;) n(t.shift(), s)
- }
- function k(a) {
- if(a._.isBlockLike && a.name != "pre" && a.name != "textarea") {
- var b = a.children.length,
- c = a.children[b - 1],
- d;
- if(c && c.type == CKEDITOR.NODE_TEXT)(d = CKEDITOR.tools.rtrim(c.value)) ?
- c.value = d : a.children.length = b - 1
- }
- }
- function n(b, c, d) {
- var c = c || s || l,
- g = s;
- if(b.previous === void 0) {
- if(o(c, b)) {
- s = c;
- m.onTagOpen(f, {});
- b.returnPoint = c = s
- }
- k(b);
- (!a(b) || b.children.length) && c.add(b);
- b.name == "pre" && (w = false);
- b.name == "textarea" && (u = false)
- }
- if(b.returnPoint) {
- s = b.returnPoint;
- delete b.returnPoint
- } else s = d ? c : g
- }
- function o(a, b) {
- if((a == l || a.name == "body") && f && (!a.name || CKEDITOR.dtd[a.name][f])) {
- var c, d;
- return(c = b.attributes && (d = b.attributes["data-cke-real-element-type"]) ? d : b.name) && c in CKEDITOR.dtd.$inline &&
- !(c in CKEDITOR.dtd.head) && !b.isOrphan || b.type == CKEDITOR.NODE_TEXT
- }
- }
- function q(a, b) {
- return a in CKEDITOR.dtd.$listItem || a in CKEDITOR.dtd.$tableContent ? a == b || a == "dt" && b == "dd" || a == "dd" && b == "dt" : false
- }
- var m = new CKEDITOR.htmlParser,
- l = j instanceof CKEDITOR.htmlParser.element ? j : typeof j == "string" ? new CKEDITOR.htmlParser.element(j) : new CKEDITOR.htmlParser.fragment,
- p = [],
- t = [],
- s = l,
- u = l.name == "textarea",
- w = l.name == "pre";
- m.onTagOpen = function(c, d, f, j) {
- d = new CKEDITOR.htmlParser.element(c, d);
- if(d.isUnknown && f) d.isEmpty =
- true;
- d.isOptionalClose = j;
- if(a(d)) p.push(d);
- else {
- if(c == "pre") w = true;
- else {
- if(c == "br" && w) {
- s.add(new CKEDITOR.htmlParser.text("\n"));
- return
- }
- c == "textarea" && (u = true)
- }
- if(c == "br") t.push(d);
- else {
- for(;;) {
- j = (f = s.name) ? CKEDITOR.dtd[f] || (s._.isBlockLike ? CKEDITOR.dtd.div : CKEDITOR.dtd.span) : g;
- if(!d.isUnknown && !s.isUnknown && !j[c])
- if(s.isOptionalClose) m.onTagClose(f);
- else if(c in b && f in b) {
- f = s.children;
- (f = f[f.length - 1]) && f.name == "li" || n(f = new CKEDITOR.htmlParser.element("li"), s);
- !d.returnPoint && (d.returnPoint = s);
- s = f
- } else if(c in CKEDITOR.dtd.$listItem && !q(c, f)) m.onTagOpen(c == "li" ? "ul" : "dl", {}, 0, 1);
- else if(f in e && !q(c, f)) {
- !d.returnPoint && (d.returnPoint = s);
- s = s.parent
- } else {
- f in CKEDITOR.dtd.$inline && p.unshift(s);
- if(s.parent) n(s, s.parent, 1);
- else {
- d.isOrphan = 1;
- break
- }
- } else break
- }
- h(c);
- i();
- d.parent = s;
- d.isEmpty ? n(d) : s = d
- }
- }
- };
- m.onTagClose = function(a) {
- for(var b = p.length - 1; b >= 0; b--)
- if(a == p[b].name) {
- p.splice(b, 1);
- return
- }
- for(var c = [], d = [], g = s; g != l && g.name != a;) {
- g._.isBlockLike || d.unshift(g);
- c.push(g);
- g = g.returnPoint || g.parent
- }
- if(g !=
- l) {
- for(b = 0; b < c.length; b++) {
- var h = c[b];
- n(h, h.parent)
- }
- s = g;
- g._.isBlockLike && i();
- n(g, g.parent);
- if(g == s) s = s.parent;
- p = p.concat(d)
- }
- a == "body" && (f = false)
- };
- m.onText = function(a) {
- if((!s._.hasInlineStarted || t.length) && !w && !u) {
- a = CKEDITOR.tools.ltrim(a);
- if(a.length === 0) return
- }
- var b = s.name,
- d = b ? CKEDITOR.dtd[b] || (s._.isBlockLike ? CKEDITOR.dtd.div : CKEDITOR.dtd.span) : g;
- if(!u && !d["#"] && b in e) {
- m.onTagOpen(c[b] || "");
- m.onText(a)
- } else {
- i();
- h();
- !w && !u && (a = a.replace(/[\t\r\n ]{2,}|[\t\r\n]/g, " "));
- a = new CKEDITOR.htmlParser.text(a);
- if(o(s, a)) this.onTagOpen(f, {}, 0, 1);
- s.add(a)
- }
- };
- m.onCDATA = function(a) {
- s.add(new CKEDITOR.htmlParser.cdata(a))
- };
- m.onComment = function(a) {
- i();
- h();
- s.add(new CKEDITOR.htmlParser.comment(a))
- };
- m.parse(d);
- for(i(); s != l;) n(s, s.parent, 1);
- k(l);
- return l
- };
- CKEDITOR.htmlParser.fragment.prototype = {
- type: CKEDITOR.NODE_DOCUMENT_FRAGMENT,
- add: function(a, b) {
- isNaN(b) && (b = this.children.length);
- var c = b > 0 ? this.children[b - 1] : null;
- if(c) {
- if(a._.isBlockLike && c.type == CKEDITOR.NODE_TEXT) {
- c.value = CKEDITOR.tools.rtrim(c.value);
- if(c.value.length ===
- 0) {
- this.children.pop();
- this.add(a);
- return
- }
- }
- c.next = a
- }
- a.previous = c;
- a.parent = this;
- this.children.splice(b, 0, a);
- if(!this._.hasInlineStarted) this._.hasInlineStarted = a.type == CKEDITOR.NODE_TEXT || a.type == CKEDITOR.NODE_ELEMENT && !a._.isBlockLike
- },
- filter: function(a, b) {
- b = this.getFilterContext(b);
- a.onRoot(b, this);
- this.filterChildren(a, false, b)
- },
- filterChildren: function(a, b, c) {
- if(this.childrenFilteredBy != a.id) {
- c = this.getFilterContext(c);
- if(b && !this.parent) a.onRoot(c, this);
- this.childrenFilteredBy = a.id;
- for(b = 0; b < this.children.length; b++) this.children[b].filter(a,
- c) === false && b--
- }
- },
- writeHtml: function(a, b) {
- b && this.filter(b);
- this.writeChildrenHtml(a)
- },
- writeChildrenHtml: function(a, b, c) {
- var g = this.getFilterContext();
- if(c && !this.parent && b) b.onRoot(g, this);
- b && this.filterChildren(b, false, g);
- b = 0;
- c = this.children;
- for(g = c.length; b < g; b++) c[b].writeHtml(a)
- },
- forEach: function(a, b, c) {
- if(!c && (!b || this.type == b)) var g = a(this);
- if(g !== false)
- for(var c = this.children, e = 0; e < c.length; e++) {
- g = c[e];
- g.type == CKEDITOR.NODE_ELEMENT ? g.forEach(a, b) : (!b || g.type == b) && a(g)
- }
- },
- getFilterContext: function(a) {
- return a || {}
- }
- }
- }(), "use strict",
- function() {
- function a() {
- this.rules = []
- }
- function e(b, g, c, d) {
- var e, f;
- for(e in g) {
- (f = b[e]) || (f = b[e] = new a);
- f.add(g[e], c, d)
- }
- }
- CKEDITOR.htmlParser.filter = CKEDITOR.tools.createClass({
- $: function(b) {
- this.id = CKEDITOR.tools.getNextNumber();
- this.elementNameRules = new a;
- this.attributeNameRules = new a;
- this.elementsRules = {};
- this.attributesRules = {};
- this.textRules = new a;
- this.commentRules = new a;
- this.rootRules = new a;
- b && this.addRules(b, 10)
- },
- proto: {
- addRules: function(a, g) {
- var c;
- if(typeof g == "number") c =
- g;
- else if(g && "priority" in g) c = g.priority;
- typeof c != "number" && (c = 10);
- typeof g != "object" && (g = {});
- a.elementNames && this.elementNameRules.addMany(a.elementNames, c, g);
- a.attributeNames && this.attributeNameRules.addMany(a.attributeNames, c, g);
- a.elements && e(this.elementsRules, a.elements, c, g);
- a.attributes && e(this.attributesRules, a.attributes, c, g);
- a.text && this.textRules.add(a.text, c, g);
- a.comment && this.commentRules.add(a.comment, c, g);
- a.root && this.rootRules.add(a.root, c, g)
- },
- applyTo: function(a) {
- a.filter(this)
- },
- onElementName: function(a,
- g) {
- return this.elementNameRules.execOnName(a, g)
- },
- onAttributeName: function(a, g) {
- return this.attributeNameRules.execOnName(a, g)
- },
- onText: function(a, g, c) {
- return this.textRules.exec(a, g, c)
- },
- onComment: function(a, g, c) {
- return this.commentRules.exec(a, g, c)
- },
- onRoot: function(a, g) {
- return this.rootRules.exec(a, g)
- },
- onElement: function(a, g) {
- for(var c = [this.elementsRules["^"], this.elementsRules[g.name], this.elementsRules.$], d, e = 0; e < 3; e++)
- if(d = c[e]) {
- d = d.exec(a, g, this);
- if(d === false) return null;
- if(d && d != g) return this.onNode(a,
- d);
- if(g.parent && !g.name) break
- }
- return g
- },
- onNode: function(a, g) {
- var c = g.type;
- return c == CKEDITOR.NODE_ELEMENT ? this.onElement(a, g) : c == CKEDITOR.NODE_TEXT ? new CKEDITOR.htmlParser.text(this.onText(a, g.value)) : c == CKEDITOR.NODE_COMMENT ? new CKEDITOR.htmlParser.comment(this.onComment(a, g.value)) : null
- },
- onAttribute: function(a, g, c, d) {
- return(c = this.attributesRules[c]) ? c.exec(a, d, g, this) : d
- }
- }
- });
- CKEDITOR.htmlParser.filterRulesGroup = a;
- a.prototype = {
- add: function(a, g, c) {
- this.rules.splice(this.findIndex(g), 0, {
- value: a,
- priority: g,
- options: c
- })
- },
- addMany: function(a, g, c) {
- for(var d = [this.findIndex(g), 0], e = 0, f = a.length; e < f; e++) d.push({
- value: a[e],
- priority: g,
- options: c
- });
- this.rules.splice.apply(this.rules, d)
- },
- findIndex: function(a) {
- for(var g = this.rules, c = g.length - 1; c >= 0 && a < g[c].priority;) c--;
- return c + 1
- },
- exec: function(a, g) {
- var c = g instanceof CKEDITOR.htmlParser.node || g instanceof CKEDITOR.htmlParser.fragment,
- d = Array.prototype.slice.call(arguments, 1),
- e = this.rules,
- f = e.length,
- h, i, k, n;
- for(n = 0; n < f; n++) {
- if(c) {
- h = g.type;
- i = g.name
- }
- k = e[n];
- if(!(a.nonEditable &&
- !k.options.applyToAll || a.nestedEditable && k.options.excludeNestedEditable)) {
- k = k.value.apply(null, d);
- if(k === false || c && k && (k.name != i || k.type != h)) return k;
- k != null && (d[0] = g = k)
- }
- }
- return g
- },
- execOnName: function(a, g) {
- for(var c = 0, d = this.rules, e = d.length, f; g && c < e; c++) {
- f = d[c];
- !(a.nonEditable && !f.options.applyToAll || a.nestedEditable && f.options.excludeNestedEditable) && (g = g.replace(f.value[0], f.value[1]))
- }
- return g
- }
- }
- }(),
- function() {
- function a(a, f) {
- function h(a) {
- return a || CKEDITOR.env.needsNbspFiller ? new CKEDITOR.htmlParser.text(" ") :
- new CKEDITOR.htmlParser.element("br", {
- "data-cke-bogus": 1
- })
- }
- function e(a, c) {
- return function(f) {
- if(f.type != CKEDITOR.NODE_DOCUMENT_FRAGMENT) {
- var e = [],
- j = b(f),
- p, k;
- if(j)
- for(i(j, 1) && e.push(j); j;) {
- if(d(j) && (p = g(j)) && i(p))
- if((k = g(p)) && !d(k)) e.push(p);
- else {
- h(t).insertAfter(p);
- p.remove()
- }
- j = j.previous
- }
- for(j = 0; j < e.length; j++) e[j].remove();
- if(e = !a || (typeof c == "function" ? c(f) : c) !== false)
- if(!t && !CKEDITOR.env.needsBrFiller && f.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT) e = false;
- else if(!t && !CKEDITOR.env.needsBrFiller && (document.documentMode >
- 7 || f.name in CKEDITOR.dtd.tr || f.name in CKEDITOR.dtd.$listItem)) e = false;
- else {
- e = b(f);
- e = !e || f.name == "form" && e.name == "input"
- }
- e && f.add(h(a))
- }
- }
- }
- function i(a, b) {
- if((!t || CKEDITOR.env.needsBrFiller) && a.type == CKEDITOR.NODE_ELEMENT && a.name == "br" && !a.attributes["data-cke-eol"]) return true;
- var c;
- if(a.type == CKEDITOR.NODE_TEXT && (c = a.value.match(p))) {
- if(c.index) {
- (new CKEDITOR.htmlParser.text(a.value.substring(0, c.index))).insertBefore(a);
- a.value = c[0]
- }
- if(!CKEDITOR.env.needsBrFiller && t && (!b || a.parent.name in x)) return true;
- if(!t)
- if((c = a.previous) && c.name == "br" || !c || d(c)) return true
- }
- return false
- }
- var k = {
- elements: {}
- },
- t = f == "html",
- x = CKEDITOR.tools.extend({}, w),
- C;
- for(C in x) "#" in s[C] || delete x[C];
- for(C in x) k.elements[C] = e(t, a.config.fillEmptyBlocks);
- k.root = e(t, false);
- k.elements.br = function(a) {
- return function(b) {
- if(b.parent.type != CKEDITOR.NODE_DOCUMENT_FRAGMENT) {
- var f = b.attributes;
- if("data-cke-bogus" in f || "data-cke-eol" in f) delete f["data-cke-bogus"];
- else {
- for(f = b.next; f && c(f);) f = f.next;
- var e = g(b);
- !f && d(b.parent) ? j(b.parent,
- h(a)) : d(f) && (e && !d(e)) && h(a).insertBefore(f)
- }
- }
- }
- }(t);
- return k
- }
- function e(a, b) {
- return a != CKEDITOR.ENTER_BR && b !== false ? a == CKEDITOR.ENTER_DIV ? "div" : "p" : false
- }
- function b(a) {
- for(a = a.children[a.children.length - 1]; a && c(a);) a = a.previous;
- return a
- }
- function g(a) {
- for(a = a.previous; a && c(a);) a = a.previous;
- return a
- }
- function c(a) {
- return a.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.trim(a.value) || a.type == CKEDITOR.NODE_ELEMENT && a.attributes["data-cke-bookmark"]
- }
- function d(a) {
- return a && (a.type == CKEDITOR.NODE_ELEMENT && a.name in
- w || a.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT)
- }
- function j(a, b) {
- var c = a.children[a.children.length - 1];
- a.children.push(b);
- b.parent = a;
- if(c) {
- c.next = b;
- b.previous = c
- }
- }
- function f(a) {
- a = a.attributes;
- a.contenteditable != "false" && (a["data-cke-editable"] = a.contenteditable ? "true" : 1);
- a.contenteditable = "false"
- }
- function h(a) {
- a = a.attributes;
- switch(a["data-cke-editable"]) {
- case "true":
- a.contenteditable = "true";
- break;
- case "1":
- delete a.contenteditable
- }
- }
- function i(a) {
- return a.replace(z, function(a, b, c) {
- return "<" + b + c.replace(B,
- function(a, b) {
- return A.test(b) && c.indexOf("data-cke-saved-" + b) == -1 ? " data-cke-saved-" + a + " data-cke-" + CKEDITOR.rnd + "-" + a : a
- }) + ">"
- })
- }
- function k(a, b) {
- return a.replace(b, function(a, b, c) {
- a.indexOf("<textarea") === 0 && (a = b + q(c).replace(/</g, "<").replace(/>/g, ">") + "</textarea>");
- return "<cke:encoded>" + encodeURIComponent(a) + "</cke:encoded>"
- })
- }
- function n(a) {
- return a.replace(J, function(a, b) {
- return decodeURIComponent(b)
- })
- }
- function o(a) {
- return a.replace(/<\!--(?!{cke_protected})[\s\S]+?--\>/g, function(a) {
- return "<\!--" +
- t + "{C}" + encodeURIComponent(a).replace(/--/g, "%2D%2D") + "--\>"
- })
- }
- function q(a) {
- return a.replace(/<\!--\{cke_protected\}\{C\}([\s\S]+?)--\>/g, function(a, b) {
- return decodeURIComponent(b)
- })
- }
- function m(a, b) {
- var c = b._.dataStore;
- return a.replace(/<\!--\{cke_protected\}([\s\S]+?)--\>/g, function(a, b) {
- return decodeURIComponent(b)
- }).replace(/\{cke_protected_(\d+)\}/g, function(a, b) {
- return c && c[b] || ""
- })
- }
- function l(a, b) {
- for(var c = [], d = b.config.protectedSource, f = b._.dataStore || (b._.dataStore = {
- id: 1
- }), g = /<\!--\{cke_temp(comment)?\}(\d*?)--\>/g,
- d = [/<script[\s\S]*?<\/script>/gi, /<noscript[\s\S]*?<\/noscript>/gi, /<meta[\s\S]*?\/?>/gi].concat(d), a = a.replace(/<\!--[\s\S]*?--\>/g, function(a) {
- return "<\!--{cke_tempcomment}" + (c.push(a) - 1) + "--\>"
- }), h = 0; h < d.length; h++) a = a.replace(d[h], function(a) {
- a = a.replace(g, function(a, b, d) {
- return c[d]
- });
- return /cke_temp(comment)?/.test(a) ? a : "<\!--{cke_temp}" + (c.push(a) - 1) + "--\>"
- });
- a = a.replace(g, function(a, b, d) {
- return "<\!--" + t + (b ? "{C}" : "") + encodeURIComponent(c[d]).replace(/--/g, "%2D%2D") + "--\>"
- });
- a = a.replace(/<\w+(?:\s+(?:(?:[^\s=>]+\s*=\s*(?:[^'"\s>]+|'[^']*'|"[^"]*"))|[^\s=>]+))+\s*>/g,
- function(a) {
- return a.replace(/<\!--\{cke_protected\}([^>]*)--\>/g, function(a, b) {
- f[f.id] = decodeURIComponent(b);
- return "{cke_protected_" + f.id++ + "}"
- })
- });
- return a = a.replace(/<(title|iframe|textarea)([^>]*)>([\s\S]*?)<\/\1>/g, function(a, c, d, f) {
- return "<" + c + d + ">" + m(q(f), b) + "</" + c + ">"
- })
- }
- CKEDITOR.htmlDataProcessor = function(b) {
- var c, d, f = this;
- this.editor = b;
- this.dataFilter = c = new CKEDITOR.htmlParser.filter;
- this.htmlFilter = d = new CKEDITOR.htmlParser.filter;
- this.writer = new CKEDITOR.htmlParser.basicWriter;
- c.addRules(x);
- c.addRules(v, {
- applyToAll: true
- });
- c.addRules(a(b, "data"), {
- applyToAll: true
- });
- d.addRules(r);
- d.addRules(y, {
- applyToAll: true
- });
- d.addRules(a(b, "html"), {
- applyToAll: true
- });
- b.on("toHtml", function(a) {
- var a = a.data,
- c = a.dataValue,
- d, c = l(c, b),
- c = k(c, D),
- c = i(c),
- c = k(c, G),
- c = c.replace(C, "$1cke:$2"),
- c = c.replace(E, "<cke:$1$2></cke:$1>"),
- c = c.replace(/(<pre\b[^>]*>)(\r\n|\n)/g, "$1$2$2"),
- c = c.replace(/([^a-z0-9<\-])(on\w{3,})(?!>)/gi, "$1data-cke-" + CKEDITOR.rnd + "-$2");
- d = a.context || b.editable().getName();
- var f;
- if(CKEDITOR.env.ie &&
- CKEDITOR.env.version < 9 && d == "pre") {
- d = "div";
- c = "<pre>" + c + "</pre>";
- f = 1
- }
- d = b.document.createElement(d);
- d.setHtml("a" + c);
- c = d.getHtml().substr(1);
- c = c.replace(RegExp("data-cke-" + CKEDITOR.rnd + "-", "ig"), "");
- f && (c = c.replace(/^<pre>|<\/pre>$/gi, ""));
- c = c.replace(F, "$1$2");
- c = n(c);
- c = q(c);
- d = a.fixForBody === false ? false : e(a.enterMode, b.config.autoParagraph);
- c = CKEDITOR.htmlParser.fragment.fromHtml(c, a.context, d);
- if(d) {
- f = c;
- if(!f.children.length && CKEDITOR.dtd[f.name][d]) {
- d = new CKEDITOR.htmlParser.element(d);
- f.add(d)
- }
- }
- a.dataValue =
- c
- }, null, null, 5);
- b.on("toHtml", function(a) {
- a.data.filter.applyTo(a.data.dataValue, true, a.data.dontFilter, a.data.enterMode) && b.fire("dataFiltered")
- }, null, null, 6);
- b.on("toHtml", function(a) {
- a.data.dataValue.filterChildren(f.dataFilter, true)
- }, null, null, 10);
- b.on("toHtml", function(a) {
- var a = a.data,
- b = a.dataValue,
- c = new CKEDITOR.htmlParser.basicWriter;
- b.writeChildrenHtml(c);
- b = c.getHtml(true);
- a.dataValue = o(b)
- }, null, null, 15);
- b.on("toDataFormat", function(a) {
- var c = a.data.dataValue;
- a.data.enterMode != CKEDITOR.ENTER_BR &&
- (c = c.replace(/^<br *\/?>/i, ""));
- a.data.dataValue = CKEDITOR.htmlParser.fragment.fromHtml(c, a.data.context, e(a.data.enterMode, b.config.autoParagraph))
- }, null, null, 5);
- b.on("toDataFormat", function(a) {
- a.data.dataValue.filterChildren(f.htmlFilter, true)
- }, null, null, 10);
- b.on("toDataFormat", function(a) {
- a.data.filter.applyTo(a.data.dataValue, false, true)
- }, null, null, 11);
- b.on("toDataFormat", function(a) {
- var c = a.data.dataValue,
- d = f.writer;
- d.reset();
- c.writeChildrenHtml(d);
- c = d.getHtml(true);
- c = q(c);
- c = m(c, b);
- a.data.dataValue =
- c
- }, null, null, 15)
- };
- CKEDITOR.htmlDataProcessor.prototype = {
- toHtml: function(a, b, c, d) {
- var f = this.editor,
- g, h, e;
- if(b && typeof b == "object") {
- g = b.context;
- c = b.fixForBody;
- d = b.dontFilter;
- h = b.filter;
- e = b.enterMode
- } else g = b;
- !g && g !== null && (g = f.editable().getName());
- return f.fire("toHtml", {
- dataValue: a,
- context: g,
- fixForBody: c,
- dontFilter: d,
- filter: h || f.filter,
- enterMode: e || f.enterMode
- }).dataValue
- },
- toDataFormat: function(a, b) {
- var c, d, f;
- if(b) {
- c = b.context;
- d = b.filter;
- f = b.enterMode
- }!c && c !== null && (c = this.editor.editable().getName());
- return this.editor.fire("toDataFormat", {
- dataValue: a,
- filter: d || this.editor.filter,
- context: c,
- enterMode: f || this.editor.enterMode
- }).dataValue
- }
- };
- var p = /(?: |\xa0)$/,
- t = "{cke_protected}",
- s = CKEDITOR.dtd,
- u = ["caption", "colgroup", "col", "thead", "tfoot", "tbody"],
- w = CKEDITOR.tools.extend({}, s.$blockLimit, s.$block),
- x = {
- elements: {
- input: f,
- textarea: f
- }
- },
- v = {
- attributeNames: [
- [/^on/, "data-cke-pa-on"],
- [/^data-cke-expando$/, ""]
- ]
- },
- r = {
- elements: {
- embed: function(a) {
- var b = a.parent;
- if(b && b.name == "object") {
- var c = b.attributes.width,
- b = b.attributes.height;
- if(c) a.attributes.width = c;
- if(b) a.attributes.height = b
- }
- },
- a: function(a) {
- if(!a.children.length && !a.attributes.name && !a.attributes["data-cke-saved-name"]) return false
- }
- }
- },
- y = {
- elementNames: [
- [/^cke:/, ""],
- [/^\?xml:namespace$/, ""]
- ],
- attributeNames: [
- [/^data-cke-(saved|pa)-/, ""],
- [/^data-cke-.*/, ""],
- ["hidefocus", ""]
- ],
- elements: {
- $: function(a) {
- var b = a.attributes;
- if(b) {
- if(b["data-cke-temp"]) return false;
- for(var c = ["name", "href", "src"], d, f = 0; f < c.length; f++) {
- d = "data-cke-saved-" + c[f];
- d in b && delete b[c[f]]
- }
- }
- return a
- },
- table: function(a) {
- a.children.slice(0).sort(function(a, b) {
- var c, d;
- if(a.type == CKEDITOR.NODE_ELEMENT && b.type == a.type) {
- c = CKEDITOR.tools.indexOf(u, a.name);
- d = CKEDITOR.tools.indexOf(u, b.name)
- }
- if(!(c > -1 && d > -1 && c != d)) {
- c = a.parent ? a.getIndex() : -1;
- d = b.parent ? b.getIndex() : -1
- }
- return c > d ? 1 : -1
- })
- },
- param: function(a) {
- a.children = [];
- a.isEmpty = true;
- return a
- },
- span: function(a) {
- a.attributes["class"] == "Apple-style-span" && delete a.name
- },
- html: function(a) {
- delete a.attributes.contenteditable;
- delete a.attributes["class"]
- },
- body: function(a) {
- delete a.attributes.spellcheck;
- delete a.attributes.contenteditable
- },
- style: function(a) {
- var b = a.children[0];
- if(b && b.value) b.value = CKEDITOR.tools.trim(b.value);
- if(!a.attributes.type) a.attributes.type = "text/css"
- },
- title: function(a) {
- var b = a.children[0];
- !b && j(a, b = new CKEDITOR.htmlParser.text);
- b.value = a.attributes["data-cke-title"] || ""
- },
- input: h,
- textarea: h
- },
- attributes: {
- "class": function(a) {
- return CKEDITOR.tools.ltrim(a.replace(/(?:^|\s+)cke_[^\s]*/g, "")) || false
- }
- }
- };
- if(CKEDITOR.env.ie) y.attributes.style = function(a) {
- return a.replace(/(^|;)([^\:]+)/g,
- function(a) {
- return a.toLowerCase()
- })
- };
- var z = /<(a|area|img|input|source)\b([^>]*)>/gi,
- B = /([\w-]+)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi,
- A = /^(href|src|name)$/i,
- G = /(?:<style(?=[ >])[^>]*>[\s\S]*?<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,
- D = /(<textarea(?=[ >])[^>]*>)([\s\S]*?)(?:<\/textarea>)/gi,
- J = /<cke:encoded>([^<]*)<\/cke:encoded>/gi,
- C = /(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,
- F = /(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,
- E = /<cke:(param|embed)([^>]*?)\/?>(?!\s*<\/cke:\1)/gi
- }(),
- "use strict", CKEDITOR.htmlParser.element = function(a, e) {
- this.name = a;
- this.attributes = e || {};
- this.children = [];
- var b = a || "",
- g = b.match(/^cke:(.*)/);
- g && (b = g[1]);
- b = !(!CKEDITOR.dtd.$nonBodyContent[b] && !CKEDITOR.dtd.$block[b] && !CKEDITOR.dtd.$listItem[b] && !CKEDITOR.dtd.$tableContent[b] && !(CKEDITOR.dtd.$nonEditable[b] || b == "br"));
- this.isEmpty = !!CKEDITOR.dtd.$empty[a];
- this.isUnknown = !CKEDITOR.dtd[a];
- this._ = {
- isBlockLike: b,
- hasInlineStarted: this.isEmpty || !b
- }
- }, CKEDITOR.htmlParser.cssStyle = function(a) {
- var e = {};
- ((a instanceof CKEDITOR.htmlParser.element ? a.attributes.style : a) || "").replace(/"/g, '"').replace(/\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function(a, g, c) {
- g == "font-family" && (c = c.replace(/["']/g, ""));
- e[g.toLowerCase()] = c
- });
- return {
- rules: e,
- populate: function(a) {
- var g = this.toString();
- if(g) a instanceof CKEDITOR.dom.element ? a.setAttribute("style", g) : a instanceof CKEDITOR.htmlParser.element ? a.attributes.style = g : a.style = g
- },
- toString: function() {
- var a = [],
- g;
- for(g in e) e[g] && a.push(g, ":", e[g], ";");
- return a.join("")
- }
- }
- },
- function() {
- function a(a) {
- return function(b) {
- return b.type ==
- CKEDITOR.NODE_ELEMENT && (typeof a == "string" ? b.name == a : b.name in a)
- }
- }
- var e = function(a, b) {
- a = a[0];
- b = b[0];
- return a < b ? -1 : a > b ? 1 : 0
- },
- b = CKEDITOR.htmlParser.fragment.prototype;
- CKEDITOR.htmlParser.element.prototype = CKEDITOR.tools.extend(new CKEDITOR.htmlParser.node, {
- type: CKEDITOR.NODE_ELEMENT,
- add: b.add,
- clone: function() {
- return new CKEDITOR.htmlParser.element(this.name, this.attributes)
- },
- filter: function(a, b) {
- var d = this,
- e, f, b = d.getFilterContext(b);
- if(b.off) return true;
- if(!d.parent) a.onRoot(b, d);
- for(;;) {
- e = d.name;
- if(!(f = a.onElementName(b, e))) {
- this.remove();
- return false
- }
- d.name = f;
- if(!(d = a.onElement(b, d))) {
- this.remove();
- return false
- }
- if(d !== this) {
- this.replaceWith(d);
- return false
- }
- if(d.name == e) break;
- if(d.type != CKEDITOR.NODE_ELEMENT) {
- this.replaceWith(d);
- return false
- }
- if(!d.name) {
- this.replaceWithChildren();
- return false
- }
- }
- e = d.attributes;
- var h, i;
- for(h in e) {
- i = h;
- for(f = e[h];;)
- if(i = a.onAttributeName(b, h))
- if(i != h) {
- delete e[h];
- h = i
- } else break;
- else {
- delete e[h];
- break
- }
- i && ((f = a.onAttribute(b, d, i, f)) === false ? delete e[i] : e[i] = f)
- }
- d.isEmpty ||
- this.filterChildren(a, false, b);
- return true
- },
- filterChildren: b.filterChildren,
- writeHtml: function(a, b) {
- b && this.filter(b);
- var d = this.name,
- j = [],
- f = this.attributes,
- h, i;
- a.openTag(d, f);
- for(h in f) j.push([h, f[h]]);
- a.sortAttributes && j.sort(e);
- h = 0;
- for(i = j.length; h < i; h++) {
- f = j[h];
- a.attribute(f[0], f[1])
- }
- a.openTagClose(d, this.isEmpty);
- this.writeChildrenHtml(a);
- this.isEmpty || a.closeTag(d)
- },
- writeChildrenHtml: b.writeChildrenHtml,
- replaceWithChildren: function() {
- for(var a = this.children, b = a.length; b;) a[--b].insertAfter(this);
- this.remove()
- },
- forEach: b.forEach,
- getFirst: function(b) {
- if(!b) return this.children.length ? this.children[0] : null;
- typeof b != "function" && (b = a(b));
- for(var c = 0, d = this.children.length; c < d; ++c)
- if(b(this.children[c])) return this.children[c];
- return null
- },
- getHtml: function() {
- var a = new CKEDITOR.htmlParser.basicWriter;
- this.writeChildrenHtml(a);
- return a.getHtml()
- },
- setHtml: function(a) {
- for(var a = this.children = CKEDITOR.htmlParser.fragment.fromHtml(a).children, b = 0, d = a.length; b < d; ++b) a[b].parent = this
- },
- getOuterHtml: function() {
- var a =
- new CKEDITOR.htmlParser.basicWriter;
- this.writeHtml(a);
- return a.getHtml()
- },
- split: function(a) {
- for(var b = this.children.splice(a, this.children.length - a), d = this.clone(), e = 0; e < b.length; ++e) b[e].parent = d;
- d.children = b;
- if(b[0]) b[0].previous = null;
- if(a > 0) this.children[a - 1].next = null;
- this.parent.add(d, this.getIndex() + 1);
- return d
- },
- addClass: function(a) {
- if(!this.hasClass(a)) {
- var b = this.attributes["class"] || "";
- this.attributes["class"] = b + (b ? " " : "") + a
- }
- },
- removeClass: function(a) {
- var b = this.attributes["class"];
- if(b)(b =
- CKEDITOR.tools.trim(b.replace(RegExp("(?:\\s+|^)" + a + "(?:\\s+|$)"), " "))) ? this.attributes["class"] = b : delete this.attributes["class"]
- },
- hasClass: function(a) {
- var b = this.attributes["class"];
- return !b ? false : RegExp("(?:^|\\s)" + a + "(?=\\s|$)").test(b)
- },
- getFilterContext: function(a) {
- var b = [];
- a || (a = {
- off: false,
- nonEditable: false,
- nestedEditable: false
- });
- !a.off && this.attributes["data-cke-processor"] == "off" && b.push("off", true);
- !a.nonEditable && this.attributes.contenteditable == "false" ? b.push("nonEditable", true) : a.nonEditable &&
- (!a.nestedEditable && this.attributes.contenteditable == "true") && b.push("nestedEditable", true);
- if(b.length)
- for(var a = CKEDITOR.tools.copy(a), d = 0; d < b.length; d = d + 2) a[b[d]] = b[d + 1];
- return a
- }
- }, true)
- }(),
- function() {
- var a = {},
- e = /{([^}]+)}/g,
- b = /([\\'])/g,
- g = /\n/g,
- c = /\r/g;
- CKEDITOR.template = function(d) {
- if(a[d]) this.output = a[d];
- else {
- var j = d.replace(b, "\\$1").replace(g, "\\n").replace(c, "\\r").replace(e, function(a, b) {
- return "',data['" + b + "']==undefined?'{" + b + "}':data['" + b + "'],'"
- });
- this.output = a[d] = Function("data", "buffer",
- "return buffer?buffer.push('" + j + "'):['" + j + "'].join('');")
- }
- }
- }(), delete CKEDITOR.loadFullCore, CKEDITOR.instances = {}, CKEDITOR.document = new CKEDITOR.dom.document(document), CKEDITOR.add = function(a) {
- CKEDITOR.instances[a.name] = a;
- a.on("focus", function() {
- if(CKEDITOR.currentInstance != a) {
- CKEDITOR.currentInstance = a;
- CKEDITOR.fire("currentInstance")
- }
- });
- a.on("blur", function() {
- if(CKEDITOR.currentInstance == a) {
- CKEDITOR.currentInstance = null;
- CKEDITOR.fire("currentInstance")
- }
- });
- CKEDITOR.fire("instance", null, a)
- }, CKEDITOR.remove =
- function(a) {
- delete CKEDITOR.instances[a.name]
- },
- function() {
- var a = {};
- CKEDITOR.addTemplate = function(e, b) {
- var g = a[e];
- if(g) return g;
- g = {
- name: e,
- source: b
- };
- CKEDITOR.fire("template", g);
- return a[e] = new CKEDITOR.template(g.source)
- };
- CKEDITOR.getTemplate = function(e) {
- return a[e]
- }
- }(),
- function() {
- var a = [];
- CKEDITOR.addCss = function(e) {
- a.push(e)
- };
- CKEDITOR.getCss = function() {
- return a.join("\n")
- }
- }(), CKEDITOR.on("instanceDestroyed", function() {
- CKEDITOR.tools.isEmpty(this.instances) && CKEDITOR.fire("reset")
- }), CKEDITOR.TRISTATE_ON =
- 1, CKEDITOR.TRISTATE_OFF = 2, CKEDITOR.TRISTATE_DISABLED = 0,
- function() {
- CKEDITOR.inline = function(a, e) {
- if(!CKEDITOR.env.isCompatible) return null;
- a = CKEDITOR.dom.element.get(a);
- if(a.getEditor()) throw 'The editor instance "' + a.getEditor().name + '" is already attached to the provided element.';
- var b = new CKEDITOR.editor(e, a, CKEDITOR.ELEMENT_MODE_INLINE),
- g = a.is("textarea") ? a : null;
- if(g) {
- b.setData(g.getValue(), null, true);
- a = CKEDITOR.dom.element.createFromHtml('<div contenteditable="' + !!b.readOnly + '" class="cke_textarea_inline">' +
- g.getValue() + "</div>", CKEDITOR.document);
- a.insertAfter(g);
- g.hide();
- g.$.form && b._attachToForm()
- } else b.setData(a.getHtml(), null, true);
- b.on("loaded", function() {
- b.fire("uiReady");
- b.editable(a);
- b.container = a;
- b.setData(b.getData(1));
- b.resetDirty();
- b.fire("contentDom");
- b.mode = "wysiwyg";
- b.fire("mode");
- b.status = "ready";
- b.fireOnce("instanceReady");
- CKEDITOR.fire("instanceReady", null, b)
- }, null, null, 1E4);
- b.on("destroy", function() {
- if(g) {
- b.container.clearCustomData();
- b.container.remove();
- g.show()
- }
- b.element.clearCustomData();
- delete b.element
- });
- return b
- };
- CKEDITOR.inlineAll = function() {
- var a, e, b;
- for(b in CKEDITOR.dtd.$editable)
- for(var g = CKEDITOR.document.getElementsByTag(b), c = 0, d = g.count(); c < d; c++) {
- a = g.getItem(c);
- if(a.getAttribute("contenteditable") == "true") {
- e = {
- element: a,
- config: {}
- };
- CKEDITOR.fire("inline", e) !== false && CKEDITOR.inline(a, e.config)
- }
- }
- };
- CKEDITOR.domReady(function() {
- !CKEDITOR.disableAutoInline && CKEDITOR.inlineAll()
- })
- }(), CKEDITOR.replaceClass = "ckeditor",
- function() {
- function a(a, c, d, j) {
- if(!CKEDITOR.env.isCompatible) return null;
- a = CKEDITOR.dom.element.get(a);
- if(a.getEditor()) throw 'The editor instance "' + a.getEditor().name + '" is already attached to the provided element.';
- var f = new CKEDITOR.editor(c, a, j);
- if(j == CKEDITOR.ELEMENT_MODE_REPLACE) {
- a.setStyle("visibility", "hidden");
- f._.required = a.hasAttribute("required");
- a.removeAttribute("required")
- }
- d && f.setData(d, null, true);
- f.on("loaded", function() {
- b(f);
- j == CKEDITOR.ELEMENT_MODE_REPLACE && (f.config.autoUpdateElement && a.$.form) && f._attachToForm();
- f.setMode(f.config.startupMode, function() {
- f.resetDirty();
- f.status = "ready";
- f.fireOnce("instanceReady");
- CKEDITOR.fire("instanceReady", null, f)
- })
- });
- f.on("destroy", e);
- return f
- }
- function e() {
- var a = this.container,
- b = this.element;
- if(a) {
- a.clearCustomData();
- a.remove()
- }
- if(b) {
- b.clearCustomData();
- if(this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE) {
- b.show();
- this._.required && b.setAttribute("required", "required")
- }
- delete this.element
- }
- }
- function b(a) {
- var b = a.name,
- d = a.element,
- e = a.elementMode,
- f = a.fire("uiSpace", {
- space: "top",
- html: ""
- }).html,
- h = a.fire("uiSpace", {
- space: "bottom",
- html: ""
- }).html,
- i = new CKEDITOR.template('<{outerEl} id="cke_{name}" class="{id} cke cke_reset cke_chrome cke_editor_{name} cke_{langDir} ' + CKEDITOR.env.cssClass + '" dir="{langDir}" lang="{langCode}" role="application"' + (a.title ? ' aria-labelledby="cke_{name}_arialbl"' : "") + ">" + (a.title ? '<span id="cke_{name}_arialbl" class="cke_voice_label">{voiceLabel}</span>' : "") + '<{outerEl} class="cke_inner cke_reset" role="presentation">{topHtml}<{outerEl} id="{contentId}" class="cke_contents cke_reset" role="presentation"></{outerEl}>{bottomHtml}</{outerEl}></{outerEl}>'),
- b = CKEDITOR.dom.element.createFromHtml(i.output({
- id: a.id,
- name: b,
- langDir: a.lang.dir,
- langCode: a.langCode,
- voiceLabel: a.title,
- topHtml: f ? '<span id="' + a.ui.spaceId("top") + '" class="cke_top cke_reset_all" role="presentation" style="height:auto">' + f + "</span>" : "",
- contentId: a.ui.spaceId("contents"),
- bottomHtml: h ? '<span id="' + a.ui.spaceId("bottom") + '" class="cke_bottom cke_reset_all" role="presentation">' + h + "</span>" : "",
- outerEl: CKEDITOR.env.ie ? "span" : "div"
- }));
- if(e == CKEDITOR.ELEMENT_MODE_REPLACE) {
- d.hide();
- b.insertAfter(d)
- } else d.append(b);
- a.container = b;
- f && a.ui.space("top").unselectable();
- h && a.ui.space("bottom").unselectable();
- d = a.config.width;
- e = a.config.height;
- d && b.setStyle("width", CKEDITOR.tools.cssLength(d));
- e && a.ui.space("contents").setStyle("height", CKEDITOR.tools.cssLength(e));
- b.disableContextMenu();
- CKEDITOR.env.webkit && b.on("focus", function() {
- a.focus()
- });
- a.fireOnce("uiReady")
- }
- CKEDITOR.replace = function(b, c) {
- return a(b, c, null, CKEDITOR.ELEMENT_MODE_REPLACE)
- };
- CKEDITOR.appendTo = function(b, c, d) {
- return a(b, c, d, CKEDITOR.ELEMENT_MODE_APPENDTO)
- };
- CKEDITOR.replaceAll = function() {
- for(var a = document.getElementsByTagName("textarea"), b = 0; b < a.length; b++) {
- var d = null,
- e = a[b];
- if(e.name || e.id) {
- if(typeof arguments[0] == "string") {
- if(!RegExp("(?:^|\\s)" + arguments[0] + "(?:$|\\s)").test(e.className)) continue
- } else if(typeof arguments[0] == "function") {
- d = {};
- if(arguments[0](e, d) === false) continue
- }
- this.replace(e, d)
- }
- }
- };
- CKEDITOR.editor.prototype.addMode = function(a, b) {
- (this._.modes || (this._.modes = {}))[a] = b
- };
- CKEDITOR.editor.prototype.setMode = function(a, b) {
- var d = this,
- e =
- this._.modes;
- if(!(a == d.mode || !e || !e[a])) {
- d.fire("beforeSetMode", a);
- if(d.mode) {
- var f = d.checkDirty(),
- e = d._.previousModeData,
- h, i = 0;
- d.fire("beforeModeUnload");
- d.editable(0);
- d._.previousMode = d.mode;
- d._.previousModeData = h = d.getData(1);
- if(d.mode == "source" && e == h) {
- d.fire("lockSnapshot", {
- forceUpdate: true
- });
- i = 1
- }
- d.ui.space("contents").setHtml("");
- d.mode = ""
- } else d._.previousModeData = d.getData(1);
- this._.modes[a](function() {
- d.mode = a;
- f !== void 0 && !f && d.resetDirty();
- i ? d.fire("unlockSnapshot") : a == "wysiwyg" && d.fire("saveSnapshot");
- setTimeout(function() {
- d.fire("mode");
- b && b.call(d)
- }, 0)
- })
- }
- };
- CKEDITOR.editor.prototype.resize = function(a, b, d, e) {
- var f = this.container,
- h = this.ui.space("contents"),
- i = CKEDITOR.env.webkit && this.document && this.document.getWindow().$.frameElement,
- e = e ? this.container.getFirst(function(a) {
- return a.type == CKEDITOR.NODE_ELEMENT && a.hasClass("cke_inner")
- }) : f;
- e.setSize("width", a, true);
- i && (i.style.width = "1%");
- h.setStyle("height", Math.max(b - (d ? 0 : (e.$.offsetHeight || 0) - (h.$.clientHeight || 0)), 0) + "px");
- i && (i.style.width =
- "100%");
- this.fire("resize")
- };
- CKEDITOR.editor.prototype.getResizable = function(a) {
- return a ? this.ui.space("contents") : this.container
- };
- CKEDITOR.domReady(function() {
- CKEDITOR.replaceClass && CKEDITOR.replaceAll(CKEDITOR.replaceClass)
- })
- }(), CKEDITOR.config.startupMode = "wysiwyg",
- function() {
- function a(a) {
- var b = a.editor,
- c = a.data.path,
- d = c.blockLimit,
- f = a.data.selection,
- h = f.getRanges()[0],
- i;
- if(CKEDITOR.env.gecko || CKEDITOR.env.ie && CKEDITOR.env.needsBrFiller)
- if(f = e(f, c)) {
- f.appendBogus();
- i = CKEDITOR.env.ie
- }
- if(j(b, c.block,
- d) && h.collapsed && !h.getCommonAncestor().isReadOnly()) {
- c = h.clone();
- c.enlarge(CKEDITOR.ENLARGE_BLOCK_CONTENTS);
- d = new CKEDITOR.dom.walker(c);
- d.guard = function(a) {
- return !g(a) || a.type == CKEDITOR.NODE_COMMENT || a.isReadOnly()
- };
- if(!d.checkForward() || c.checkStartOfBlock() && c.checkEndOfBlock()) {
- b = h.fixBlock(true, b.activeEnterMode == CKEDITOR.ENTER_DIV ? "div" : "p");
- if(!CKEDITOR.env.needsBrFiller)(b = b.getFirst(g)) && (b.type == CKEDITOR.NODE_TEXT && CKEDITOR.tools.trim(b.getText()).match(/^(?: |\xa0)$/)) && b.remove();
- i = 1;
- a.cancel()
- }
- }
- i && h.select()
- }
- function e(a, b) {
- if(a.isFake) return 0;
- var c = b.block || b.blockLimit,
- d = c && c.getLast(g);
- if(c && c.isBlockBoundary() && (!d || !(d.type == CKEDITOR.NODE_ELEMENT && d.isBlockBoundary())) && !c.is("pre") && !c.getBogus()) return c
- }
- function b(a) {
- var b = a.data.getTarget();
- if(b.is("input")) {
- b = b.getAttribute("type");
- (b == "submit" || b == "reset") && a.data.preventDefault()
- }
- }
- function g(a) {
- return o(a) && q(a)
- }
- function c(a, b) {
- return function(c) {
- var d = CKEDITOR.dom.element.get(c.data.$.toElement || c.data.$.fromElement ||
- c.data.$.relatedTarget);
- (!d || !b.equals(d) && !b.contains(d)) && a.call(this, c)
- }
- }
- function d(a) {
- function b(a) {
- return function(b, d) {
- d && (b.type == CKEDITOR.NODE_ELEMENT && b.is(f)) && (c = b);
- if(!d && g(b) && (!a || !k(b))) return false
- }
- }
- var c, d = a.getRanges()[0],
- a = a.root,
- f = {
- table: 1,
- ul: 1,
- ol: 1,
- dl: 1
- };
- if(d.startPath().contains(f)) {
- var e = d.clone();
- e.collapse(1);
- e.setStartAt(a, CKEDITOR.POSITION_AFTER_START);
- a = new CKEDITOR.dom.walker(e);
- a.guard = b();
- a.checkBackward();
- if(c) {
- e = d.clone();
- e.collapse();
- e.setEndAt(c, CKEDITOR.POSITION_AFTER_END);
- a = new CKEDITOR.dom.walker(e);
- a.guard = b(true);
- c = false;
- a.checkForward();
- return c
- }
- }
- return null
- }
- function j(a, b, c) {
- return a.config.autoParagraph !== false && a.activeEnterMode != CKEDITOR.ENTER_BR && a.editable().equals(c) && !b || b && b.getAttribute("contenteditable") == "true"
- }
- function f(a) {
- a.editor.focus();
- a.editor.fire("saveSnapshot")
- }
- function h(a) {
- var b = a.editor;
- b.getSelection().scrollIntoView();
- setTimeout(function() {
- b.fire("saveSnapshot")
- }, 0)
- }
- function i(a, b, c) {
- for(var d = a.getCommonAncestor(b), b = a = c ? b : a;
- (a = a.getParent()) &&
- !d.equals(a) && a.getChildCount() == 1;) b = a;
- b.remove()
- }
- CKEDITOR.editable = CKEDITOR.tools.createClass({
- base: CKEDITOR.dom.element,
- $: function(a, b) {
- this.base(b.$ || b);
- this.editor = a;
- this.status = "unloaded";
- this.hasFocus = false;
- this.setup()
- },
- proto: {
- focus: function() {
- var a;
- if(CKEDITOR.env.webkit && !this.hasFocus) {
- a = this.editor._.previousActive || this.getDocument().getActive();
- if(this.contains(a)) {
- a.focus();
- return
- }
- }
- try {
- this.$[CKEDITOR.env.ie && this.getDocument().equals(CKEDITOR.document) ? "setActive" : "focus"]()
- } catch(b) {
- if(!CKEDITOR.env.ie) throw b;
- }
- if(CKEDITOR.env.safari && !this.isInline()) {
- a = CKEDITOR.document.getActive();
- a.equals(this.getWindow().getFrame()) || this.getWindow().focus()
- }
- },
- on: function(a, b) {
- var d = Array.prototype.slice.call(arguments, 0);
- if(CKEDITOR.env.ie && /^focus|blur$/.exec(a)) {
- a = a == "focus" ? "focusin" : "focusout";
- b = c(b, this);
- d[0] = a;
- d[1] = b
- }
- return CKEDITOR.dom.element.prototype.on.apply(this, d)
- },
- attachListener: function(a) {
- !this._.listeners && (this._.listeners = []);
- var b = Array.prototype.slice.call(arguments, 1),
- b = a.on.apply(a, b);
- this._.listeners.push(b);
- return b
- },
- clearListeners: function() {
- var a = this._.listeners;
- try {
- for(; a.length;) a.pop().removeListener()
- } catch(b) {}
- },
- restoreAttrs: function() {
- var a = this._.attrChanges,
- b, c;
- for(c in a)
- if(a.hasOwnProperty(c)) {
- b = a[c];
- b !== null ? this.setAttribute(c, b) : this.removeAttribute(c)
- }
- },
- attachClass: function(a) {
- var b = this.getCustomData("classes");
- if(!this.hasClass(a)) {
- !b && (b = []);
- b.push(a);
- this.setCustomData("classes", b);
- this.addClass(a)
- }
- },
- changeAttr: function(a, b) {
- var c = this.getAttribute(a);
- if(b !== c) {
- !this._.attrChanges &&
- (this._.attrChanges = {});
- a in this._.attrChanges || (this._.attrChanges[a] = c);
- this.setAttribute(a, b)
- }
- },
- insertHtml: function(a, b) {
- f(this);
- m(this, b || "html", a)
- },
- insertText: function(a) {
- f(this);
- var b = this.editor,
- c = b.getSelection().getStartElement().hasAscendant("pre", true) ? CKEDITOR.ENTER_BR : b.activeEnterMode,
- b = c == CKEDITOR.ENTER_BR,
- d = CKEDITOR.tools,
- a = d.htmlEncode(a.replace(/\r\n/g, "\n")),
- a = a.replace(/\t/g, " "),
- c = c == CKEDITOR.ENTER_P ? "p" : "div";
- if(!b) {
- var g = /\n{2}/g;
- if(g.test(a)) var e = "<" + c +
- ">",
- h = "</" + c + ">",
- a = e + a.replace(g, function() {
- return h + e
- }) + h
- }
- a = a.replace(/\n/g, "<br>");
- b || (a = a.replace(RegExp("<br>(?=</" + c + ">)"), function(a) {
- return d.repeat(a, 2)
- }));
- a = a.replace(/^ | $/g, " ");
- a = a.replace(/(>|\s) /g, function(a, b) {
- return b + " "
- }).replace(/ (?=<)/g, " ");
- m(this, "text", a)
- },
- insertElement: function(a, b) {
- b ? this.insertElementIntoRange(a, b) : this.insertElementIntoSelection(a)
- },
- insertElementIntoRange: function(a, b) {
- var c = this.editor,
- d = c.config.enterMode,
- f = a.getName(),
- g = CKEDITOR.dtd.$block[f];
- if(b.checkReadOnly()) return false;
- b.deleteContents(1);
- b.startContainer.type == CKEDITOR.NODE_ELEMENT && b.startContainer.is({
- tr: 1,
- table: 1,
- tbody: 1,
- thead: 1,
- tfoot: 1
- }) && l(b);
- var e, h;
- if(g)
- for(;
- (e = b.getCommonAncestor(0, 1)) && (h = CKEDITOR.dtd[e.getName()]) && (!h || !h[f]);)
- if(e.getName() in CKEDITOR.dtd.span) b.splitElement(e);
- else if(b.checkStartOfBlock() && b.checkEndOfBlock()) {
- b.setStartBefore(e);
- b.collapse(true);
- e.remove()
- } else b.splitBlock(d == CKEDITOR.ENTER_DIV ? "div" : "p", c.editable());
- b.insertNode(a);
- return true
- },
- insertElementIntoSelection: function(a) {
- f(this);
- var b = this.editor,
- c = b.activeEnterMode,
- b = b.getSelection(),
- d = b.getRanges()[0],
- e = a.getName(),
- e = CKEDITOR.dtd.$block[e];
- if(this.insertElementIntoRange(a, d)) {
- d.moveToPosition(a, CKEDITOR.POSITION_AFTER_END);
- if(e)
- if((e = a.getNext(function(a) {
- return g(a) && !k(a)
- })) && e.type == CKEDITOR.NODE_ELEMENT && e.is(CKEDITOR.dtd.$block)) e.getDtd()["#"] ? d.moveToElementEditStart(e) : d.moveToElementEditEnd(a);
- else if(!e && c != CKEDITOR.ENTER_BR) {
- e = d.fixBlock(true, c == CKEDITOR.ENTER_DIV ?
- "div" : "p");
- d.moveToElementEditStart(e)
- }
- }
- b.selectRanges([d]);
- h(this)
- },
- setData: function(a, b) {
- b || (a = this.editor.dataProcessor.toHtml(a));
- this.setHtml(a);
- this.fixInitialSelection();
- if(this.status == "unloaded") this.status = "ready";
- this.editor.fire("dataReady")
- },
- getData: function(a) {
- var b = this.getHtml();
- a || (b = this.editor.dataProcessor.toDataFormat(b));
- return b
- },
- setReadOnly: function(a) {
- this.setAttribute("contenteditable", !a)
- },
- detach: function() {
- this.removeClass("cke_editable");
- this.status = "detached";
- var a = this.editor;
- this._.detach();
- delete a.document;
- delete a.window
- },
- isInline: function() {
- return this.getDocument().equals(CKEDITOR.document)
- },
- fixInitialSelection: function() {
- function a() {
- var b = c.getDocument().$,
- d = b.getSelection(),
- f;
- if(d.anchorNode && d.anchorNode == c.$) f = true;
- else if(CKEDITOR.env.webkit) {
- var g = c.getDocument().getActive();
- g && (g.equals(c) && !d.anchorNode) && (f = true)
- }
- if(f) {
- f = new CKEDITOR.dom.range(c);
- f.moveToElementEditStart(c);
- b = b.createRange();
- b.setStart(f.startContainer.$, f.startOffset);
- b.collapse(true);
- d.removeAllRanges();
- d.addRange(b)
- }
- }
- function b() {
- var a = c.getDocument().$,
- d = a.selection,
- f = c.getDocument().getActive();
- if(d.type == "None" && f.equals(c)) {
- d = new CKEDITOR.dom.range(c);
- a = a.body.createTextRange();
- d.moveToElementEditStart(c);
- d = d.startContainer;
- d.type != CKEDITOR.NODE_ELEMENT && (d = d.getParent());
- a.moveToElementText(d.$);
- a.collapse(true);
- a.select()
- }
- }
- var c = this;
- if(CKEDITOR.env.ie && (CKEDITOR.env.version < 9 || CKEDITOR.env.quirks)) {
- if(this.hasFocus) {
- this.focus();
- b()
- }
- } else if(this.hasFocus) {
- this.focus();
- a()
- } else this.once("focus", function() {
- a()
- }, null, null, -999)
- },
- setup: function() {
- var a = this.editor;
- this.attachListener(a, "beforeGetData", function() {
- var b = this.getData();
- this.is("textarea") || a.config.ignoreEmptyParagraph !== false && (b = b.replace(n, function(a, b) {
- return b
- }));
- a.setData(b, null, 1)
- }, this);
- this.attachListener(a, "getSnapshot", function(a) {
- a.data = this.getData(1)
- }, this);
- this.attachListener(a, "afterSetData", function() {
- this.setData(a.getData(1))
- }, this);
- this.attachListener(a, "loadSnapshot", function(a) {
- this.setData(a.data,
- 1)
- }, this);
- this.attachListener(a, "beforeFocus", function() {
- var b = a.getSelection();
- (b = b && b.getNative()) && b.type == "Control" || this.focus()
- }, this);
- this.attachListener(a, "insertHtml", function(a) {
- this.insertHtml(a.data.dataValue, a.data.mode)
- }, this);
- this.attachListener(a, "insertElement", function(a) {
- this.insertElement(a.data)
- }, this);
- this.attachListener(a, "insertText", function(a) {
- this.insertText(a.data)
- }, this);
- this.setReadOnly(a.readOnly);
- this.attachClass("cke_editable");
- this.attachClass(a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ?
- "cke_editable_inline" : a.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE || a.elementMode == CKEDITOR.ELEMENT_MODE_APPENDTO ? "cke_editable_themed" : "");
- this.attachClass("cke_contents_" + a.config.contentsLangDirection);
- a.keystrokeHandler.blockedKeystrokes[8] = +a.readOnly;
- a.keystrokeHandler.attach(this);
- this.on("blur", function() {
- this.hasFocus = false
- }, null, null, -1);
- this.on("focus", function() {
- this.hasFocus = true
- }, null, null, -1);
- a.focusManager.add(this);
- if(this.equals(CKEDITOR.document.getActive())) {
- this.hasFocus = true;
- a.once("contentDom", function() {
- a.focusManager.focus(this)
- }, this)
- }
- this.isInline() && this.changeAttr("tabindex", a.tabIndex);
- if(!this.is("textarea")) {
- a.document = this.getDocument();
- a.window = this.getWindow();
- var c = a.document;
- this.changeAttr("spellcheck", !a.config.disableNativeSpellChecker);
- var f = a.config.contentsLangDirection;
- this.getDirection(1) != f && this.changeAttr("dir", f);
- var e = CKEDITOR.getCss();
- if(e) {
- f = c.getHead();
- if(!f.getCustomData("stylesheet")) {
- e = c.appendStyleText(e);
- e = new CKEDITOR.dom.element(e.ownerNode ||
- e.owningElement);
- f.setCustomData("stylesheet", e);
- e.data("cke-temp", 1)
- }
- }
- f = c.getCustomData("stylesheet_ref") || 0;
- c.setCustomData("stylesheet_ref", f + 1);
- this.setCustomData("cke_includeReadonly", !a.config.disableReadonlyStyling);
- this.attachListener(this, "click", function(a) {
- var a = a.data,
- b = (new CKEDITOR.dom.elementPath(a.getTarget(), this)).contains("a");
- b && (a.$.button != 2 && b.isReadOnly()) && a.preventDefault()
- });
- var h = {
- 8: 1,
- 46: 1
- };
- this.attachListener(a, "key", function(b) {
- if(a.readOnly) return true;
- var c = b.data.domEvent.getKey(),
- f;
- if(c in h) {
- var b = a.getSelection(),
- e, g = b.getRanges()[0],
- i = g.startPath(),
- j, k, t, c = c == 8;
- if(CKEDITOR.env.ie && CKEDITOR.env.version < 11 && (e = b.getSelectedElement()) || (e = d(b))) {
- a.fire("saveSnapshot");
- g.moveToPosition(e, CKEDITOR.POSITION_BEFORE_START);
- e.remove();
- g.select();
- a.fire("saveSnapshot");
- f = 1
- } else if(g.collapsed)
- if((j = i.block) && (t = j[c ? "getPrevious" : "getNext"](o)) && t.type == CKEDITOR.NODE_ELEMENT && t.is("table") && g[c ? "checkStartOfBlock" : "checkEndOfBlock"]()) {
- a.fire("saveSnapshot");
- g[c ? "checkEndOfBlock" :
- "checkStartOfBlock"]() && j.remove();
- g["moveToElementEdit" + (c ? "End" : "Start")](t);
- g.select();
- a.fire("saveSnapshot");
- f = 1
- } else if(i.blockLimit && i.blockLimit.is("td") && (k = i.blockLimit.getAscendant("table")) && g.checkBoundaryOfElement(k, c ? CKEDITOR.START : CKEDITOR.END) && (t = k[c ? "getPrevious" : "getNext"](o))) {
- a.fire("saveSnapshot");
- g["moveToElementEdit" + (c ? "End" : "Start")](t);
- g.checkStartOfBlock() && g.checkEndOfBlock() ? t.remove() : g.select();
- a.fire("saveSnapshot");
- f = 1
- } else if((k = i.contains(["td", "th", "caption"])) &&
- g.checkBoundaryOfElement(k, c ? CKEDITOR.START : CKEDITOR.END)) f = 1
- }
- return !f
- });
- a.blockless && (CKEDITOR.env.ie && CKEDITOR.env.needsBrFiller) && this.attachListener(this, "keyup", function(b) {
- if(b.data.getKeystroke() in h && !this.getFirst(g)) {
- this.appendBogus();
- b = a.createRange();
- b.moveToPosition(this, CKEDITOR.POSITION_AFTER_START);
- b.select()
- }
- });
- this.attachListener(this, "dblclick", function(b) {
- if(a.readOnly) return false;
- b = {
- element: b.data.getTarget()
- };
- a.fire("doubleclick", b)
- });
- CKEDITOR.env.ie && this.attachListener(this,
- "click", b);
- CKEDITOR.env.ie || this.attachListener(this, "mousedown", function(b) {
- var c = b.data.getTarget();
- if(c.is("img", "hr", "input", "textarea", "select") && !c.isReadOnly()) {
- a.getSelection().selectElement(c);
- c.is("input", "textarea", "select") && b.data.preventDefault()
- }
- });
- CKEDITOR.env.gecko && this.attachListener(this, "mouseup", function(b) {
- if(b.data.$.button == 2) {
- b = b.data.getTarget();
- if(!b.getOuterHtml().replace(n, "")) {
- var c = a.createRange();
- c.moveToElementEditStart(b);
- c.select(true)
- }
- }
- });
- if(CKEDITOR.env.webkit) {
- this.attachListener(this,
- "click",
- function(a) {
- a.data.getTarget().is("input", "select") && a.data.preventDefault()
- });
- this.attachListener(this, "mouseup", function(a) {
- a.data.getTarget().is("input", "textarea") && a.data.preventDefault()
- })
- }
- CKEDITOR.env.webkit && this.attachListener(a, "key", function(b) {
- b = b.data.domEvent.getKey();
- if(b in h) {
- var c = b == 8,
- d = a.getSelection().getRanges()[0],
- b = d.startPath();
- if(d.collapsed) {
- var f;
- a: {
- var g = b.block;
- if(g)
- if(d[c ? "checkStartOfBlock" : "checkEndOfBlock"]())
- if(!d.moveToClosestEditablePosition(g, !c) || !d.collapsed) f =
- false;
- else {
- if(d.startContainer.type == CKEDITOR.NODE_ELEMENT) {
- var e = d.startContainer.getChild(d.startOffset - (c ? 1 : 0));
- if(e && e.type == CKEDITOR.NODE_ELEMENT && e.is("hr")) {
- a.fire("saveSnapshot");
- e.remove();
- f = true;
- break a
- }
- }
- if((d = d.startPath().block) && (!d || !d.contains(g))) {
- a.fire("saveSnapshot");
- var j;
- (j = (c ? d : g).getBogus()) && j.remove();
- f = a.getSelection();
- j = f.createBookmarks();
- (c ? g : d).moveChildren(c ? d : g, false);
- b.lastElement.mergeSiblings();
- i(g, d, !c);
- f.selectBookmarks(j);
- f = true
- }
- }
- else f = false;
- else f = false
- }
- if(!f) return
- } else {
- c =
- d;
- f = b.block;
- j = c.endPath().block;
- if(!f || !j || f.equals(j)) b = false;
- else {
- a.fire("saveSnapshot");
- (g = f.getBogus()) && g.remove();
- c.deleteContents();
- if(j.getParent()) {
- j.moveChildren(f, false);
- b.lastElement.mergeSiblings();
- i(f, j, true)
- }
- c = a.getSelection().getRanges()[0];
- c.collapse(1);
- c.select();
- b = true
- }
- if(!b) return
- }
- a.getSelection().scrollIntoView();
- a.fire("saveSnapshot");
- return false
- }
- }, this, null, 100)
- }
- }
- },
- _: {
- detach: function() {
- this.editor.setData(this.editor.getData(), 0, 1);
- this.clearListeners();
- this.restoreAttrs();
- var a;
- if(a = this.removeCustomData("classes"))
- for(; a.length;) this.removeClass(a.pop());
- if(!this.is("textarea")) {
- a = this.getDocument();
- var b = a.getHead();
- if(b.getCustomData("stylesheet")) {
- var c = a.getCustomData("stylesheet_ref");
- if(--c) a.setCustomData("stylesheet_ref", c);
- else {
- a.removeCustomData("stylesheet_ref");
- b.removeCustomData("stylesheet").remove()
- }
- }
- }
- this.editor.fire("contentDomUnload");
- delete this.editor
- }
- }
- });
- CKEDITOR.editor.prototype.editable = function(a) {
- var b = this._.editable;
- if(b && a) return 0;
- if(arguments.length) b =
- this._.editable = a ? a instanceof CKEDITOR.editable ? a : new CKEDITOR.editable(this, a) : (b && b.detach(), null);
- return b
- };
- var k = CKEDITOR.dom.walker.bogus(),
- n = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:<br[^>]*>| |\u00A0| )?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi,
- o = CKEDITOR.dom.walker.whitespaces(true),
- q = CKEDITOR.dom.walker.bookmark(false, true);
- CKEDITOR.on("instanceLoaded", function(b) {
- var c = b.editor;
- c.on("insertElement", function(a) {
- a = a.data;
- if(a.type == CKEDITOR.NODE_ELEMENT && (a.is("input") ||
- a.is("textarea"))) {
- a.getAttribute("contentEditable") != "false" && a.data("cke-editable", a.hasAttribute("contenteditable") ? "true" : "1");
- a.setAttribute("contentEditable", false)
- }
- });
- c.on("selectionChange", function(b) {
- if(!c.readOnly) {
- var d = c.getSelection();
- if(d && !d.isLocked) {
- d = c.checkDirty();
- c.fire("lockSnapshot");
- a(b);
- c.fire("unlockSnapshot");
- !d && c.resetDirty()
- }
- }
- })
- });
- CKEDITOR.on("instanceCreated", function(a) {
- var b = a.editor;
- b.on("mode", function() {
- var a = b.editable();
- if(a && a.isInline()) {
- var c = b.title;
- a.changeAttr("role",
- "textbox");
- a.changeAttr("aria-label", c);
- c && a.changeAttr("title", c);
- var d = b.fire("ariaEditorHelpLabel", {}).label;
- if(d)
- if(c = this.ui.space(this.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ? "top" : "contents")) {
- var f = CKEDITOR.tools.getNextId(),
- d = CKEDITOR.dom.element.createFromHtml('<span id="' + f + '" class="cke_voice_label">' + d + "</span>");
- c.append(d);
- a.changeAttr("aria-describedby", f)
- }
- }
- })
- });
- CKEDITOR.addCss(".cke_editable{cursor:text}.cke_editable img,.cke_editable input,.cke_editable textarea{cursor:default}");
- var m = function() {
- function a(b) {
- return b.type == CKEDITOR.NODE_ELEMENT
- }
- function b(c, d) {
- var f, g, e, h, j = [],
- k = d.range.startContainer;
- f = d.range.startPath();
- for(var k = i[k.getName()], m = 0, n = c.getChildren(), w = n.count(), s = -1, x = -1, l = 0, r = f.contains(i.$list); m < w; ++m) {
- f = n.getItem(m);
- if(a(f)) {
- e = f.getName();
- if(r && e in CKEDITOR.dtd.$list) j = j.concat(b(f, d));
- else {
- h = !!k[e];
- if(e == "br" && f.data("cke-eol") && (!m || m == w - 1)) {
- l = (g = m ? j[m - 1].node : n.getItem(m + 1)) && (!a(g) || !g.is("br"));
- g = g && a(g) && i.$block[g.getName()]
- }
- s == -1 && !h && (s =
- m);
- h || (x = m);
- j.push({
- isElement: 1,
- isLineBreak: l,
- isBlock: f.isBlockBoundary(),
- hasBlockSibling: g,
- node: f,
- name: e,
- allowed: h
- });
- g = l = 0
- }
- } else j.push({
- isElement: 0,
- node: f,
- allowed: 1
- })
- }
- if(s > -1) j[s].firstNotAllowed = 1;
- if(x > -1) j[x].lastNotAllowed = 1;
- return j
- }
- function c(b, d) {
- var f = [],
- g = b.getChildren(),
- e = g.count(),
- h, j = 0,
- k = i[d],
- m = !b.is(i.$inline) || b.is("br");
- for(m && f.push(" "); j < e; j++) {
- h = g.getItem(j);
- a(h) && !h.is(k) ? f = f.concat(c(h, d)) : f.push(h)
- }
- m && f.push(" ");
- return f
- }
- function d(b) {
- return b && a(b) && (b.is(i.$removeEmpty) ||
- b.is("a") && !b.isBlockBoundary())
- }
- function f(b, c, d, g) {
- var e = b.clone(),
- h, j;
- e.setEndAt(c, CKEDITOR.POSITION_BEFORE_END);
- if((h = (new CKEDITOR.dom.walker(e)).next()) && a(h) && k[h.getName()] && (j = h.getPrevious()) && a(j) && !j.getParent().equals(b.startContainer) && d.contains(j) && g.contains(h) && h.isIdentical(j)) {
- h.moveChildren(j);
- h.remove();
- f(b, c, d, g)
- }
- }
- function e(b, c) {
- function d(b, c) {
- if(c.isBlock && c.isElement && !c.node.is("br") && a(b) && b.is("br")) {
- b.remove();
- return 1
- }
- }
- var f = c.endContainer.getChild(c.endOffset),
- g = c.endContainer.getChild(c.endOffset -
- 1);
- f && d(f, b[b.length - 1]);
- if(g && d(g, b[0])) {
- c.setEnd(c.endContainer, c.endOffset - 1);
- c.collapse()
- }
- }
- var i = CKEDITOR.dtd,
- k = {
- p: 1,
- div: 1,
- h1: 1,
- h2: 1,
- h3: 1,
- h4: 1,
- h5: 1,
- h6: 1,
- ul: 1,
- ol: 1,
- li: 1,
- pre: 1,
- dl: 1,
- blockquote: 1
- },
- m = {
- p: 1,
- div: 1,
- h1: 1,
- h2: 1,
- h3: 1,
- h4: 1,
- h5: 1,
- h6: 1
- },
- n = CKEDITOR.tools.extend({}, i.$inline);
- delete n.br;
- return function(k, l, r) {
- var q = k.editor,
- o = q.getSelection().getRanges()[0],
- C = false;
- if(l == "unfiltered_html") {
- l = "html";
- C = true
- }
- if(!o.checkReadOnly()) {
- var F = (new CKEDITOR.dom.elementPath(o.startContainer, o.root)).blockLimit ||
- o.root,
- l = {
- type: l,
- dontFilter: C,
- editable: k,
- editor: q,
- range: o,
- blockLimit: F,
- mergeCandidates: [],
- zombies: []
- },
- q = l.range,
- C = l.mergeCandidates,
- E, I, L, H;
- if(l.type == "text" && q.shrink(CKEDITOR.SHRINK_ELEMENT, true, false)) {
- E = CKEDITOR.dom.element.createFromHtml("<span> </span>", q.document);
- q.insertNode(E);
- q.setStartAfter(E)
- }
- I = new CKEDITOR.dom.elementPath(q.startContainer);
- l.endPath = L = new CKEDITOR.dom.elementPath(q.endContainer);
- if(!q.collapsed) {
- var F = L.block || L.blockLimit,
- Q = q.getCommonAncestor();
- F && (!F.equals(Q) &&
- !F.contains(Q) && q.checkEndOfBlock()) && l.zombies.push(F);
- q.deleteContents()
- }
- for(;
- (H = a(q.startContainer) && q.startContainer.getChild(q.startOffset - 1)) && a(H) && H.isBlockBoundary() && I.contains(H);) q.moveToPosition(H, CKEDITOR.POSITION_BEFORE_END);
- f(q, l.blockLimit, I, L);
- if(E) {
- q.setEndBefore(E);
- q.collapse();
- E.remove()
- }
- E = q.startPath();
- if(F = E.contains(d, false, 1)) {
- q.splitElement(F);
- l.inlineStylesRoot = F;
- l.inlineStylesPeak = E.lastElement
- }
- E = q.createBookmark();
- (F = E.startNode.getPrevious(g)) && a(F) && d(F) && C.push(F);
- (F = E.startNode.getNext(g)) && a(F) && d(F) && C.push(F);
- for(F = E.startNode;
- (F = F.getParent()) && d(F);) C.push(F);
- q.moveToBookmark(E);
- if(E = r) {
- E = l.range;
- if(l.type == "text" && l.inlineStylesRoot) {
- H = l.inlineStylesPeak;
- q = H.getDocument().createText("{cke-peak}");
- for(C = l.inlineStylesRoot.getParent(); !H.equals(C);) {
- q = q.appendTo(H.clone());
- H = H.getParent()
- }
- r = q.getOuterHtml().split("{cke-peak}").join(r)
- }
- H = l.blockLimit.getName();
- if(/^\s+|\s+$/.test(r) && "span" in CKEDITOR.dtd[H]) var O = '<span data-cke-marker="1"> </span>',
- r = O + r + O;
- r = l.editor.dataProcessor.toHtml(r, {
- context: null,
- fixForBody: false,
- dontFilter: l.dontFilter,
- filter: l.editor.activeFilter,
- enterMode: l.editor.activeEnterMode
- });
- H = E.document.createElement("body");
- H.setHtml(r);
- if(O) {
- H.getFirst().remove();
- H.getLast().remove()
- }
- if((O = E.startPath().block) && !(O.getChildCount() == 1 && O.getBogus())) a: {
- var M;
- if(H.getChildCount() == 1 && a(M = H.getFirst()) && M.is(m)) {
- O = M.getElementsByTag("*");
- E = 0;
- for(C = O.count(); E < C; E++) {
- q = O.getItem(E);
- if(!q.is(n)) break a
- }
- M.moveChildren(M.getParent(1));
- M.remove()
- }
- }
- l.dataWrapper = H;
- E = r
- }
- if(E) {
- M = l.range;
- var O = M.document,
- K, r = l.blockLimit;
- E = 0;
- var R;
- H = [];
- var N, T, C = q = 0,
- P, V;
- I = M.startContainer;
- var F = l.endPath.elements[0],
- W;
- L = F.getPosition(I);
- Q = !!F.getCommonAncestor(I) && L != CKEDITOR.POSITION_IDENTICAL && !(L & CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_IS_CONTAINED);
- I = b(l.dataWrapper, l);
- for(e(I, M); E < I.length; E++) {
- L = I[E];
- if(K = L.isLineBreak) {
- K = M;
- P = r;
- var S = void 0,
- Y = void 0;
- if(L.hasBlockSibling) K = 1;
- else {
- S = K.startContainer.getAscendant(i.$block, 1);
- if(!S || !S.is({
- div: 1,
- p: 1
- })) K = 0;
- else {
- Y = S.getPosition(P);
- if(Y == CKEDITOR.POSITION_IDENTICAL || Y == CKEDITOR.POSITION_CONTAINS) K = 0;
- else {
- P = K.splitElement(S);
- K.moveToPosition(P, CKEDITOR.POSITION_AFTER_START);
- K = 1
- }
- }
- }
- }
- if(K) C = E > 0;
- else {
- K = M.startPath();
- if(!L.isBlock && j(l.editor, K.block, K.blockLimit) && (T = l.editor.activeEnterMode != CKEDITOR.ENTER_BR && l.editor.config.autoParagraph !== false ? l.editor.activeEnterMode == CKEDITOR.ENTER_DIV ? "div" : "p" : false)) {
- T = O.createElement(T);
- T.appendBogus();
- M.insertNode(T);
- CKEDITOR.env.needsBrFiller && (R = T.getBogus()) &&
- R.remove();
- M.moveToPosition(T, CKEDITOR.POSITION_BEFORE_END)
- }
- if((K = M.startPath().block) && !K.equals(N)) {
- if(R = K.getBogus()) {
- R.remove();
- H.push(K)
- }
- N = K
- }
- L.firstNotAllowed && (q = 1);
- if(q && L.isElement) {
- K = M.startContainer;
- for(P = null; K && !i[K.getName()][L.name];) {
- if(K.equals(r)) {
- K = null;
- break
- }
- P = K;
- K = K.getParent()
- }
- if(K) {
- if(P) {
- V = M.splitElement(P);
- l.zombies.push(V);
- l.zombies.push(P)
- }
- } else {
- P = r.getName();
- W = !E;
- K = E == I.length - 1;
- P = c(L.node, P);
- for(var S = [], Y = P.length, Z = 0, ba = void 0, X = 0, aa = -1; Z < Y; Z++) {
- ba = P[Z];
- if(ba == " ") {
- if(!X &&
- (!W || Z)) {
- S.push(new CKEDITOR.dom.text(" "));
- aa = S.length
- }
- X = 1
- } else {
- S.push(ba);
- X = 0
- }
- }
- K && aa == S.length && S.pop();
- W = S
- }
- }
- if(W) {
- for(; K = W.pop();) M.insertNode(K);
- W = 0
- } else M.insertNode(L.node);
- if(L.lastNotAllowed && E < I.length - 1) {
- (V = Q ? F : V) && M.setEndAt(V, CKEDITOR.POSITION_AFTER_START);
- q = 0
- }
- M.collapse()
- }
- }
- l.dontMoveCaret = C;
- l.bogusNeededBlocks = H
- }
- R = l.range;
- var U;
- V = l.bogusNeededBlocks;
- for(W = R.createBookmark(); N = l.zombies.pop();)
- if(N.getParent()) {
- T = R.clone();
- T.moveToElementEditStart(N);
- T.removeEmptyBlocksAtEnd()
- }
- if(V)
- for(; N =
- V.pop();) CKEDITOR.env.needsBrFiller ? N.appendBogus() : N.append(R.document.createText(" "));
- for(; N = l.mergeCandidates.pop();) N.mergeSiblings();
- R.moveToBookmark(W);
- if(!l.dontMoveCaret) {
- for(N = a(R.startContainer) && R.startContainer.getChild(R.startOffset - 1); N && a(N) && !N.is(i.$empty);) {
- if(N.isBlockBoundary()) R.moveToPosition(N, CKEDITOR.POSITION_BEFORE_END);
- else {
- if(d(N) && N.getHtml().match(/(\s| )$/g)) {
- U = null;
- break
- }
- U = R.clone();
- U.moveToPosition(N, CKEDITOR.POSITION_BEFORE_END)
- }
- N = N.getLast(g)
- }
- U && R.moveToRange(U)
- }
- o.select();
- h(k)
- }
- }
- }(),
- l = function() {
- function a(b) {
- b = new CKEDITOR.dom.walker(b);
- b.guard = function(a, b) {
- if(b) return false;
- if(a.type == CKEDITOR.NODE_ELEMENT) return a.is(CKEDITOR.dtd.$tableContent)
- };
- b.evaluator = function(a) {
- return a.type == CKEDITOR.NODE_ELEMENT
- };
- return b
- }
- function b(a, c, d) {
- c = a.getDocument().createElement(c);
- a.append(c, d);
- return c
- }
- function c(a) {
- var b = a.count(),
- d;
- for(b; b-- > 0;) {
- d = a.getItem(b);
- if(!CKEDITOR.tools.trim(d.getHtml())) {
- d.appendBogus();
- CKEDITOR.env.ie && (CKEDITOR.env.version < 9 && d.getChildCount()) &&
- d.getFirst().remove()
- }
- }
- }
- return function(d) {
- var f = d.startContainer,
- g = f.getAscendant("table", 1),
- e = false;
- c(g.getElementsByTag("td"));
- c(g.getElementsByTag("th"));
- g = d.clone();
- g.setStart(f, 0);
- g = a(g).lastBackward();
- if(!g) {
- g = d.clone();
- g.setEndAt(f, CKEDITOR.POSITION_BEFORE_END);
- g = a(g).lastForward();
- e = true
- }
- g || (g = f);
- if(g.is("table")) {
- d.setStartAt(g, CKEDITOR.POSITION_BEFORE_START);
- d.collapse(true);
- g.remove()
- } else {
- g.is({
- tbody: 1,
- thead: 1,
- tfoot: 1
- }) && (g = b(g, "tr", e));
- g.is("tr") && (g = b(g, g.getParent().is("thead") ? "th" :
- "td", e));
- (f = g.getBogus()) && f.remove();
- d.moveToPosition(g, e ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_END)
- }
- }
- }()
- }(),
- function() {
- function a() {
- var a = this._.fakeSelection,
- b;
- if(a) {
- b = this.getSelection(1);
- if(!b || !b.isHidden()) {
- a.reset();
- a = 0
- }
- }
- if(!a) {
- a = b || this.getSelection(1);
- if(!a || a.getType() == CKEDITOR.SELECTION_NONE) return
- }
- this.fire("selectionCheck", a);
- b = this.elementPath();
- if(!b.compare(this._.selectionPreviousPath)) {
- if(CKEDITOR.env.webkit) this._.previousActive = this.document.getActive();
- this._.selectionPreviousPath =
- b;
- this.fire("selectionChange", {
- selection: a,
- path: b
- })
- }
- }
- function e() {
- m = true;
- if(!q) {
- b.call(this);
- q = CKEDITOR.tools.setTimeout(b, 200, this)
- }
- }
- function b() {
- q = null;
- if(m) {
- CKEDITOR.tools.setTimeout(a, 0, this);
- m = false
- }
- }
- function g(a) {
- return l(a) || a.type == CKEDITOR.NODE_ELEMENT && !a.is(CKEDITOR.dtd.$empty) ? true : false
- }
- function c(a) {
- function b(c, d) {
- return !c || c.type == CKEDITOR.NODE_TEXT ? false : a.clone()["moveToElementEdit" + (d ? "End" : "Start")](c)
- }
- if(!(a.root instanceof CKEDITOR.editable)) return false;
- var c = a.startContainer,
- d = a.getPreviousNode(g, null, c),
- f = a.getNextNode(g, null, c);
- return b(d) || b(f, 1) || !d && !f && !(c.type == CKEDITOR.NODE_ELEMENT && c.isBlockBoundary() && c.getBogus()) ? true : false
- }
- function d(a) {
- return a.getCustomData("cke-fillingChar")
- }
- function j(a, b) {
- var c = a && a.removeCustomData("cke-fillingChar");
- if(c) {
- if(b !== false) {
- var d, g = a.getDocument().getSelection().getNative(),
- e = g && g.type != "None" && g.getRangeAt(0);
- if(c.getLength() > 1 && e && e.intersectsNode(c.$)) {
- d = h(g);
- e = g.focusNode == c.$ && g.focusOffset > 0;
- g.anchorNode == c.$ && g.anchorOffset >
- 0 && d[0].offset--;
- e && d[1].offset--
- }
- }
- c.setText(f(c.getText()));
- d && i(a.getDocument().$, d)
- }
- }
- function f(a) {
- return a.replace(/\u200B( )?/g, function(a) {
- return a[1] ? " " : ""
- })
- }
- function h(a) {
- return [{
- node: a.anchorNode,
- offset: a.anchorOffset
- }, {
- node: a.focusNode,
- offset: a.focusOffset
- }]
- }
- function i(a, b) {
- var c = a.getSelection(),
- d = a.createRange();
- d.setStart(b[0].node, b[0].offset);
- d.collapse(true);
- c.removeAllRanges();
- c.addRange(d);
- c.extend(b[1].node, b[1].offset)
- }
- function k(a) {
- var b = CKEDITOR.dom.element.createFromHtml('<div data-cke-hidden-sel="1" data-cke-temp="1" style="' +
- (CKEDITOR.env.ie ? "display:none" : "position:fixed;top:0;left:-1000px") + '"> </div>', a.document);
- a.fire("lockSnapshot");
- a.editable().append(b);
- var c = a.getSelection(1),
- d = a.createRange(),
- f = c.root.on("selectionchange", function(a) {
- a.cancel()
- }, null, null, 0);
- d.setStartAt(b, CKEDITOR.POSITION_AFTER_START);
- d.setEndAt(b, CKEDITOR.POSITION_BEFORE_END);
- c.selectRanges([d]);
- f.removeListener();
- a.fire("unlockSnapshot");
- a._.hiddenSelectionContainer = b
- }
- function n(a) {
- var b = {
- 37: 1,
- 39: 1,
- 8: 1,
- 46: 1
- };
- return function(c) {
- var d =
- c.data.getKeystroke();
- if(b[d]) {
- var f = a.getSelection().getRanges(),
- g = f[0];
- if(f.length == 1 && g.collapsed)
- if((d = g[d < 38 ? "getPreviousEditableNode" : "getNextEditableNode"]()) && d.type == CKEDITOR.NODE_ELEMENT && d.getAttribute("contenteditable") == "false") {
- a.getSelection().fake(d);
- c.data.preventDefault();
- c.cancel()
- }
- }
- }
- }
- function o(a) {
- for(var b = 0; b < a.length; b++) {
- var c = a[b];
- c.getCommonAncestor().isReadOnly() && a.splice(b, 1);
- if(!c.collapsed) {
- if(c.startContainer.isReadOnly())
- for(var d = c.startContainer, f; d;) {
- if((f = d.type ==
- CKEDITOR.NODE_ELEMENT) && d.is("body") || !d.isReadOnly()) break;
- f && d.getAttribute("contentEditable") == "false" && c.setStartAfter(d);
- d = d.getParent()
- }
- d = c.startContainer;
- f = c.endContainer;
- var g = c.startOffset,
- e = c.endOffset,
- h = c.clone();
- d && d.type == CKEDITOR.NODE_TEXT && (g >= d.getLength() ? h.setStartAfter(d) : h.setStartBefore(d));
- f && f.type == CKEDITOR.NODE_TEXT && (e ? h.setEndAfter(f) : h.setEndBefore(f));
- d = new CKEDITOR.dom.walker(h);
- d.evaluator = function(d) {
- if(d.type == CKEDITOR.NODE_ELEMENT && d.isReadOnly()) {
- var f = c.clone();
- c.setEndBefore(d);
- c.collapsed && a.splice(b--, 1);
- if(!(d.getPosition(h.endContainer) & CKEDITOR.POSITION_CONTAINS)) {
- f.setStartAfter(d);
- f.collapsed || a.splice(b + 1, 0, f)
- }
- return true
- }
- return false
- };
- d.next()
- }
- }
- return a
- }
- var q, m, l = CKEDITOR.dom.walker.invisible(1),
- p = function() {
- function a(b) {
- return function(a) {
- var c = a.editor.createRange();
- c.moveToClosestEditablePosition(a.selected, b) && a.editor.getSelection().selectRanges([c]);
- return false
- }
- }
- function b(a) {
- return function(b) {
- var c = b.editor,
- d = c.createRange(),
- f;
- if(!(f =
- d.moveToClosestEditablePosition(b.selected, a))) f = d.moveToClosestEditablePosition(b.selected, !a);
- f && c.getSelection().selectRanges([d]);
- c.fire("saveSnapshot");
- b.selected.remove();
- if(!f) {
- d.moveToElementEditablePosition(c.editable());
- c.getSelection().selectRanges([d])
- }
- c.fire("saveSnapshot");
- return false
- }
- }
- var c = a(),
- d = a(1);
- return {
- 37: c,
- 38: c,
- 39: d,
- 40: d,
- 8: b(),
- 46: b(1)
- }
- }();
- CKEDITOR.on("instanceCreated", function(b) {
- function c() {
- var a = d.getSelection();
- a && a.removeAllRanges()
- }
- var d = b.editor;
- d.on("contentDom", function() {
- function b() {
- p =
- new CKEDITOR.dom.selection(d.getSelection());
- p.lock()
- }
- function c() {
- g.removeListener("mouseup", c);
- k.removeListener("mouseup", c);
- var a = CKEDITOR.document.$.selection,
- b = a.createRange();
- a.type != "None" && b.parentElement().ownerDocument == f.$ && b.select()
- }
- var f = d.document,
- g = CKEDITOR.document,
- h = d.editable(),
- i = f.getBody(),
- k = f.getDocumentElement(),
- m = h.isInline(),
- C, p;
- CKEDITOR.env.gecko && h.attachListener(h, "focus", function(a) {
- a.removeListener();
- if(C !== 0)
- if((a = d.getSelection().getNative()) && a.isCollapsed && a.anchorNode ==
- h.$) {
- a = d.createRange();
- a.moveToElementEditStart(h);
- a.select()
- }
- }, null, null, -2);
- h.attachListener(h, CKEDITOR.env.webkit ? "DOMFocusIn" : "focus", function() {
- C && CKEDITOR.env.webkit && (C = d._.previousActive && d._.previousActive.equals(f.getActive()));
- d.unlockSelection(C);
- C = 0
- }, null, null, -1);
- h.attachListener(h, "mousedown", function() {
- C = 0
- });
- if(CKEDITOR.env.ie || m) {
- t ? h.attachListener(h, "beforedeactivate", b, null, null, -1) : h.attachListener(d, "selectionCheck", b, null, null, -1);
- h.attachListener(h, CKEDITOR.env.webkit ? "DOMFocusOut" :
- "blur",
- function() {
- d.lockSelection(p);
- C = 1
- }, null, null, -1);
- h.attachListener(h, "mousedown", function() {
- C = 0
- })
- }
- if(CKEDITOR.env.ie && !m) {
- var s;
- h.attachListener(h, "mousedown", function(a) {
- if(a.data.$.button == 2) {
- a = d.document.getSelection();
- if(!a || a.getType() == CKEDITOR.SELECTION_NONE) s = d.window.getScrollPosition()
- }
- });
- h.attachListener(h, "mouseup", function(a) {
- if(a.data.$.button == 2 && s) {
- d.document.$.documentElement.scrollLeft = s.x;
- d.document.$.documentElement.scrollTop = s.y
- }
- s = null
- });
- if(f.$.compatMode != "BackCompat") {
- if(CKEDITOR.env.ie7Compat ||
- CKEDITOR.env.ie6Compat) k.on("mousedown", function(a) {
- function b(a) {
- a = a.data.$;
- if(d) {
- var c = i.$.createTextRange();
- try {
- c.moveToPoint(a.clientX, a.clientY)
- } catch(f) {}
- d.setEndPoint(e.compareEndPoints("StartToStart", c) < 0 ? "EndToEnd" : "StartToStart", c);
- d.select()
- }
- }
- function c() {
- k.removeListener("mousemove", b);
- g.removeListener("mouseup", c);
- k.removeListener("mouseup", c);
- d.select()
- }
- a = a.data;
- if(a.getTarget().is("html") && a.$.y < k.$.clientHeight && a.$.x < k.$.clientWidth) {
- var d = i.$.createTextRange();
- try {
- d.moveToPoint(a.$.clientX,
- a.$.clientY)
- } catch(f) {}
- var e = d.duplicate();
- k.on("mousemove", b);
- g.on("mouseup", c);
- k.on("mouseup", c)
- }
- });
- if(CKEDITOR.env.version > 7 && CKEDITOR.env.version < 11) k.on("mousedown", function(a) {
- if(a.data.getTarget().is("html")) {
- g.on("mouseup", c);
- k.on("mouseup", c)
- }
- })
- }
- }
- h.attachListener(h, "selectionchange", a, d);
- h.attachListener(h, "keyup", e, d);
- h.attachListener(h, CKEDITOR.env.webkit ? "DOMFocusIn" : "focus", function() {
- d.forceNextSelectionCheck();
- d.selectionChange(1)
- });
- if(m && (CKEDITOR.env.webkit || CKEDITOR.env.gecko)) {
- var l;
- h.attachListener(h, "mousedown", function() {
- l = 1
- });
- h.attachListener(f.getDocumentElement(), "mouseup", function() {
- l && e.call(d);
- l = 0
- })
- } else h.attachListener(CKEDITOR.env.ie ? h : f.getDocumentElement(), "mouseup", e, d);
- CKEDITOR.env.webkit && h.attachListener(f, "keydown", function(a) {
- switch(a.data.getKey()) {
- case 13:
- case 33:
- case 34:
- case 35:
- case 36:
- case 37:
- case 39:
- case 8:
- case 45:
- case 46:
- j(h)
- }
- }, null, null, -1);
- h.attachListener(h, "keydown", n(d), null, null, -1)
- });
- d.on("setData", function() {
- d.unlockSelection();
- CKEDITOR.env.webkit &&
- c()
- });
- d.on("contentDomUnload", function() {
- d.unlockSelection()
- });
- if(CKEDITOR.env.ie9Compat) d.on("beforeDestroy", c, null, null, 9);
- d.on("dataReady", function() {
- delete d._.fakeSelection;
- delete d._.hiddenSelectionContainer;
- d.selectionChange(1)
- });
- d.on("loadSnapshot", function() {
- var a = CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_ELEMENT),
- b = d.editable().getLast(a);
- if(b && b.hasAttribute("data-cke-hidden-sel")) {
- b.remove();
- if(CKEDITOR.env.gecko)(a = d.editable().getFirst(a)) && (a.is("br") && a.getAttribute("_moz_editor_bogus_node")) &&
- a.remove()
- }
- }, null, null, 100);
- d.on("key", function(a) {
- if(d.mode == "wysiwyg") {
- var b = d.getSelection();
- if(b.isFake) {
- var c = p[a.data.keyCode];
- if(c) return c({
- editor: d,
- selected: b.getSelectedElement(),
- selection: b,
- keyEvent: a
- })
- }
- }
- })
- });
- CKEDITOR.on("instanceReady", function(a) {
- function b() {
- var a = g.editable();
- if(a)
- if(a = d(a)) {
- var c = g.document.$.getSelection();
- if(c.type != "None" && (c.anchorNode == a.$ || c.focusNode == a.$)) k = h(c);
- e = a.getText();
- a.setText(f(e))
- }
- }
- function c() {
- var a = g.editable();
- if(a)
- if(a = d(a)) {
- a.setText(e);
- if(k) {
- i(g.document.$,
- k);
- k = null
- }
- }
- }
- var g = a.editor,
- e, k;
- if(CKEDITOR.env.webkit) {
- g.on("selectionChange", function() {
- var a = g.editable(),
- b = d(a);
- b && (b.getCustomData("ready") ? j(a) : b.setCustomData("ready", 1))
- }, null, null, -1);
- g.on("beforeSetMode", function() {
- j(g.editable())
- }, null, null, -1);
- g.on("beforeUndoImage", b);
- g.on("afterUndoImage", c);
- g.on("beforeGetData", b, null, null, 0);
- g.on("getData", c)
- }
- });
- CKEDITOR.editor.prototype.selectionChange = function(b) {
- (b ? a : e).call(this)
- };
- CKEDITOR.editor.prototype.getSelection = function(a) {
- if((this._.savedSelection ||
- this._.fakeSelection) && !a) return this._.savedSelection || this._.fakeSelection;
- return(a = this.editable()) && this.mode == "wysiwyg" ? new CKEDITOR.dom.selection(a) : null
- };
- CKEDITOR.editor.prototype.lockSelection = function(a) {
- a = a || this.getSelection(1);
- if(a.getType() != CKEDITOR.SELECTION_NONE) {
- !a.isLocked && a.lock();
- this._.savedSelection = a;
- return true
- }
- return false
- };
- CKEDITOR.editor.prototype.unlockSelection = function(a) {
- var b = this._.savedSelection;
- if(b) {
- b.unlock(a);
- delete this._.savedSelection;
- return true
- }
- return false
- };
- CKEDITOR.editor.prototype.forceNextSelectionCheck = function() {
- delete this._.selectionPreviousPath
- };
- CKEDITOR.dom.document.prototype.getSelection = function() {
- return new CKEDITOR.dom.selection(this)
- };
- CKEDITOR.dom.range.prototype.select = function() {
- var a = this.root instanceof CKEDITOR.editable ? this.root.editor.getSelection() : new CKEDITOR.dom.selection(this.root);
- a.selectRanges([this]);
- return a
- };
- CKEDITOR.SELECTION_NONE = 1;
- CKEDITOR.SELECTION_TEXT = 2;
- CKEDITOR.SELECTION_ELEMENT = 3;
- var t = typeof window.getSelection !=
- "function",
- s = 1;
- CKEDITOR.dom.selection = function(a) {
- if(a instanceof CKEDITOR.dom.selection) var b = a,
- a = a.root;
- var c = a instanceof CKEDITOR.dom.element;
- this.rev = b ? b.rev : s++;
- this.document = a instanceof CKEDITOR.dom.document ? a : a.getDocument();
- this.root = c ? a : this.document.getBody();
- this.isLocked = 0;
- this._ = {
- cache: {}
- };
- if(b) {
- CKEDITOR.tools.extend(this._.cache, b._.cache);
- this.isFake = b.isFake;
- this.isLocked = b.isLocked;
- return this
- }
- var a = this.getNative(),
- d, f;
- if(a)
- if(a.getRangeAt) d = (f = a.rangeCount && a.getRangeAt(0)) &&
- new CKEDITOR.dom.node(f.commonAncestorContainer);
- else {
- try {
- f = a.createRange()
- } catch(g) {}
- d = f && CKEDITOR.dom.element.get(f.item && f.item(0) || f.parentElement())
- }
- if(!d || !(d.type == CKEDITOR.NODE_ELEMENT || d.type == CKEDITOR.NODE_TEXT) || !this.root.equals(d) && !this.root.contains(d)) {
- this._.cache.type = CKEDITOR.SELECTION_NONE;
- this._.cache.startElement = null;
- this._.cache.selectedElement = null;
- this._.cache.selectedText = "";
- this._.cache.ranges = new CKEDITOR.dom.rangeList
- }
- return this
- };
- var u = {
- img: 1,
- hr: 1,
- li: 1,
- table: 1,
- tr: 1,
- td: 1,
- th: 1,
- embed: 1,
- object: 1,
- ol: 1,
- ul: 1,
- a: 1,
- input: 1,
- form: 1,
- select: 1,
- textarea: 1,
- button: 1,
- fieldset: 1,
- thead: 1,
- tfoot: 1
- };
- CKEDITOR.dom.selection.prototype = {
- getNative: function() {
- return this._.cache.nativeSel !== void 0 ? this._.cache.nativeSel : this._.cache.nativeSel = t ? this.document.$.selection : this.document.getWindow().$.getSelection()
- },
- getType: t ? function() {
- var a = this._.cache;
- if(a.type) return a.type;
- var b = CKEDITOR.SELECTION_NONE;
- try {
- var c = this.getNative(),
- d = c.type;
- if(d == "Text") b = CKEDITOR.SELECTION_TEXT;
- if(d == "Control") b =
- CKEDITOR.SELECTION_ELEMENT;
- if(c.createRange().parentElement()) b = CKEDITOR.SELECTION_TEXT
- } catch(f) {}
- return a.type = b
- } : function() {
- var a = this._.cache;
- if(a.type) return a.type;
- var b = CKEDITOR.SELECTION_TEXT,
- c = this.getNative();
- if(!c || !c.rangeCount) b = CKEDITOR.SELECTION_NONE;
- else if(c.rangeCount == 1) {
- var c = c.getRangeAt(0),
- d = c.startContainer;
- if(d == c.endContainer && d.nodeType == 1 && c.endOffset - c.startOffset == 1 && u[d.childNodes[c.startOffset].nodeName.toLowerCase()]) b = CKEDITOR.SELECTION_ELEMENT
- }
- return a.type = b
- },
- getRanges: function() {
- var a =
- t ? function() {
- function a(b) {
- return(new CKEDITOR.dom.node(b)).getIndex()
- }
- var b = function(b, c) {
- b = b.duplicate();
- b.collapse(c);
- var d = b.parentElement();
- if(!d.hasChildNodes()) return {
- container: d,
- offset: 0
- };
- for(var f = d.children, g, e, h = b.duplicate(), j = 0, i = f.length - 1, k = -1, m, p; j <= i;) {
- k = Math.floor((j + i) / 2);
- g = f[k];
- h.moveToElementText(g);
- m = h.compareEndPoints("StartToStart", b);
- if(m > 0) i = k - 1;
- else if(m < 0) j = k + 1;
- else return {
- container: d,
- offset: a(g)
- }
- }
- if(k == -1 || k == f.length - 1 && m < 0) {
- h.moveToElementText(d);
- h.setEndPoint("StartToStart",
- b);
- h = h.text.replace(/(\r\n|\r)/g, "\n").length;
- f = d.childNodes;
- if(!h) {
- g = f[f.length - 1];
- return g.nodeType != CKEDITOR.NODE_TEXT ? {
- container: d,
- offset: f.length
- } : {
- container: g,
- offset: g.nodeValue.length
- }
- }
- for(d = f.length; h > 0 && d > 0;) {
- e = f[--d];
- if(e.nodeType == CKEDITOR.NODE_TEXT) {
- p = e;
- h = h - e.nodeValue.length
- }
- }
- return {
- container: p,
- offset: -h
- }
- }
- h.collapse(m > 0 ? true : false);
- h.setEndPoint(m > 0 ? "StartToStart" : "EndToStart", b);
- h = h.text.replace(/(\r\n|\r)/g, "\n").length;
- if(!h) return {
- container: d,
- offset: a(g) + (m > 0 ? 0 : 1)
- };
- for(; h > 0;) try {
- e =
- g[m > 0 ? "previousSibling" : "nextSibling"];
- if(e.nodeType == CKEDITOR.NODE_TEXT) {
- h = h - e.nodeValue.length;
- p = e
- }
- g = e
- } catch(t) {
- return {
- container: d,
- offset: a(g)
- }
- }
- return {
- container: p,
- offset: m > 0 ? -h : p.nodeValue.length + h
- }
- };
- return function() {
- var a = this.getNative(),
- c = a && a.createRange(),
- d = this.getType();
- if(!a) return [];
- if(d == CKEDITOR.SELECTION_TEXT) {
- a = new CKEDITOR.dom.range(this.root);
- d = b(c, true);
- a.setStart(new CKEDITOR.dom.node(d.container), d.offset);
- d = b(c);
- a.setEnd(new CKEDITOR.dom.node(d.container), d.offset);
- a.endContainer.getPosition(a.startContainer) &
- CKEDITOR.POSITION_PRECEDING && a.endOffset <= a.startContainer.getIndex() && a.collapse();
- return [a]
- }
- if(d == CKEDITOR.SELECTION_ELEMENT) {
- for(var d = [], f = 0; f < c.length; f++) {
- for(var g = c.item(f), e = g.parentNode, h = 0, a = new CKEDITOR.dom.range(this.root); h < e.childNodes.length && e.childNodes[h] != g; h++);
- a.setStart(new CKEDITOR.dom.node(e), h);
- a.setEnd(new CKEDITOR.dom.node(e), h + 1);
- d.push(a)
- }
- return d
- }
- return []
- }
- }() : function() {
- var a = [],
- b, c = this.getNative();
- if(!c) return a;
- for(var d = 0; d < c.rangeCount; d++) {
- var f = c.getRangeAt(d);
- b = new CKEDITOR.dom.range(this.root);
- b.setStart(new CKEDITOR.dom.node(f.startContainer), f.startOffset);
- b.setEnd(new CKEDITOR.dom.node(f.endContainer), f.endOffset);
- a.push(b)
- }
- return a
- };
- return function(b) {
- var c = this._.cache,
- d = c.ranges;
- if(!d) c.ranges = d = new CKEDITOR.dom.rangeList(a.call(this));
- return !b ? d : o(new CKEDITOR.dom.rangeList(d.slice()))
- }
- }(),
- getStartElement: function() {
- var a = this._.cache;
- if(a.startElement !== void 0) return a.startElement;
- var b;
- switch(this.getType()) {
- case CKEDITOR.SELECTION_ELEMENT:
- return this.getSelectedElement();
- case CKEDITOR.SELECTION_TEXT:
- var c = this.getRanges()[0];
- if(c) {
- if(c.collapsed) {
- b = c.startContainer;
- b.type != CKEDITOR.NODE_ELEMENT && (b = b.getParent())
- } else {
- for(c.optimize();;) {
- b = c.startContainer;
- if(c.startOffset == (b.getChildCount ? b.getChildCount() : b.getLength()) && !b.isBlockBoundary()) c.setStartAfter(b);
- else break
- }
- b = c.startContainer;
- if(b.type != CKEDITOR.NODE_ELEMENT) return b.getParent();
- b = b.getChild(c.startOffset);
- if(!b || b.type != CKEDITOR.NODE_ELEMENT) b = c.startContainer;
- else
- for(c = b.getFirst(); c && c.type ==
- CKEDITOR.NODE_ELEMENT;) {
- b = c;
- c = c.getFirst()
- }
- }
- b = b.$
- }
- }
- return a.startElement = b ? new CKEDITOR.dom.element(b) : null
- },
- getSelectedElement: function() {
- var a = this._.cache;
- if(a.selectedElement !== void 0) return a.selectedElement;
- var b = this,
- c = CKEDITOR.tools.tryThese(function() {
- return b.getNative().createRange().item(0)
- }, function() {
- for(var a = b.getRanges()[0].clone(), c, d, f = 2; f && (!(c = a.getEnclosedNode()) || !(c.type == CKEDITOR.NODE_ELEMENT && u[c.getName()] && (d = c))); f--) a.shrink(CKEDITOR.SHRINK_ELEMENT);
- return d && d.$
- });
- return a.selectedElement =
- c ? new CKEDITOR.dom.element(c) : null
- },
- getSelectedText: function() {
- var a = this._.cache;
- if(a.selectedText !== void 0) return a.selectedText;
- var b = this.getNative(),
- b = t ? b.type == "Control" ? "" : b.createRange().text : b.toString();
- return a.selectedText = b
- },
- lock: function() {
- this.getRanges();
- this.getStartElement();
- this.getSelectedElement();
- this.getSelectedText();
- this._.cache.nativeSel = null;
- this.isLocked = 1
- },
- unlock: function(a) {
- if(this.isLocked) {
- if(a) var b = this.getSelectedElement(),
- c = !b && this.getRanges(),
- d = this.isFake;
- this.isLocked =
- 0;
- this.reset();
- if(a)(a = b || c[0] && c[0].getCommonAncestor()) && a.getAscendant("body", 1) && (d ? this.fake(b) : b ? this.selectElement(b) : this.selectRanges(c))
- }
- },
- reset: function() {
- this._.cache = {};
- this.isFake = 0;
- var a = this.root.editor;
- if(a && a._.fakeSelection && this.rev == a._.fakeSelection.rev) {
- delete a._.fakeSelection;
- var b = a._.hiddenSelectionContainer;
- if(b) {
- var c = a.checkDirty();
- a.fire("lockSnapshot");
- b.remove();
- a.fire("unlockSnapshot");
- !c && a.resetDirty()
- }
- delete a._.hiddenSelectionContainer
- }
- this.rev = s++
- },
- selectElement: function(a) {
- var b =
- new CKEDITOR.dom.range(this.root);
- b.setStartBefore(a);
- b.setEndAfter(a);
- this.selectRanges([b])
- },
- selectRanges: function(a) {
- var b = this.root.editor,
- b = b && b._.hiddenSelectionContainer;
- this.reset();
- if(b)
- for(var b = this.root, d, f = 0; f < a.length; ++f) {
- d = a[f];
- if(d.endContainer.equals(b)) d.endOffset = Math.min(d.endOffset, b.getChildCount())
- }
- if(a.length)
- if(this.isLocked) {
- var g = CKEDITOR.document.getActive();
- this.unlock();
- this.selectRanges(a);
- this.lock();
- g && !g.equals(this.root) && g.focus()
- } else {
- var e;
- a: {
- var h, i;
- if(a.length ==
- 1 && !(i = a[0]).collapsed && (e = i.getEnclosedNode()) && e.type == CKEDITOR.NODE_ELEMENT) {
- i = i.clone();
- i.shrink(CKEDITOR.SHRINK_ELEMENT, true);
- if((h = i.getEnclosedNode()) && h.type == CKEDITOR.NODE_ELEMENT) e = h;
- if(e.getAttribute("contenteditable") == "false") break a
- }
- e = void 0
- }
- if(e) this.fake(e);
- else {
- if(t) {
- i = CKEDITOR.dom.walker.whitespaces(true);
- h = /\ufeff|\u00a0/;
- b = {
- table: 1,
- tbody: 1,
- tr: 1
- };
- if(a.length > 1) {
- e = a[a.length - 1];
- a[0].setEnd(e.endContainer, e.endOffset)
- }
- e = a[0];
- var a = e.collapsed,
- k, m, p;
- if((d = e.getEnclosedNode()) && d.type ==
- CKEDITOR.NODE_ELEMENT && d.getName() in u && (!d.is("a") || !d.getText())) try {
- p = d.$.createControlRange();
- p.addElement(d.$);
- p.select();
- return
- } catch(C) {}
- if(e.startContainer.type == CKEDITOR.NODE_ELEMENT && e.startContainer.getName() in b || e.endContainer.type == CKEDITOR.NODE_ELEMENT && e.endContainer.getName() in b) {
- e.shrink(CKEDITOR.NODE_ELEMENT, true);
- a = e.collapsed
- }
- p = e.createBookmark();
- b = p.startNode;
- if(!a) g = p.endNode;
- p = e.document.$.body.createTextRange();
- p.moveToElementText(b.$);
- p.moveStart("character", 1);
- if(g) {
- h =
- e.document.$.body.createTextRange();
- h.moveToElementText(g.$);
- p.setEndPoint("EndToEnd", h);
- p.moveEnd("character", -1)
- } else {
- k = b.getNext(i);
- m = b.hasAscendant("pre");
- k = !(k && k.getText && k.getText().match(h)) && (m || !b.hasPrevious() || b.getPrevious().is && b.getPrevious().is("br"));
- m = e.document.createElement("span");
- m.setHtml("");
- m.insertBefore(b);
- k && e.document.createText("").insertBefore(b)
- }
- e.setStartBefore(b);
- b.remove();
- if(a) {
- if(k) {
- p.moveStart("character", -1);
- p.select();
- e.document.$.selection.clear()
- } else p.select();
- e.moveToPosition(m, CKEDITOR.POSITION_BEFORE_START);
- m.remove()
- } else {
- e.setEndBefore(g);
- g.remove();
- p.select()
- }
- } else {
- g = this.getNative();
- if(!g) return;
- this.removeAllRanges();
- for(p = 0; p < a.length; p++) {
- if(p < a.length - 1) {
- k = a[p];
- m = a[p + 1];
- h = k.clone();
- h.setStart(k.endContainer, k.endOffset);
- h.setEnd(m.startContainer, m.startOffset);
- if(!h.collapsed) {
- h.shrink(CKEDITOR.NODE_ELEMENT, true);
- e = h.getCommonAncestor();
- h = h.getEnclosedNode();
- if(e.isReadOnly() || h && h.isReadOnly()) {
- m.setStart(k.startContainer, k.startOffset);
- a.splice(p--,
- 1);
- continue
- }
- }
- }
- e = a[p];
- m = this.document.$.createRange();
- if(e.collapsed && CKEDITOR.env.webkit && c(e)) {
- k = this.root;
- j(k, false);
- h = k.getDocument().createText("");
- k.setCustomData("cke-fillingChar", h);
- e.insertNode(h);
- if((k = h.getNext()) && !h.getPrevious() && k.type == CKEDITOR.NODE_ELEMENT && k.getName() == "br") {
- j(this.root);
- e.moveToPosition(k, CKEDITOR.POSITION_BEFORE_START)
- } else e.moveToPosition(h, CKEDITOR.POSITION_AFTER_END)
- }
- m.setStart(e.startContainer.$, e.startOffset);
- try {
- m.setEnd(e.endContainer.$, e.endOffset)
- } catch(n) {
- if(n.toString().indexOf("NS_ERROR_ILLEGAL_VALUE") >=
- 0) {
- e.collapse(1);
- m.setEnd(e.endContainer.$, e.endOffset)
- } else throw n;
- }
- g.addRange(m)
- }
- }
- this.reset();
- this.root.fire("selectionchange")
- }
- }
- },
- fake: function(a) {
- var b = this.root.editor;
- this.reset();
- k(b);
- var c = this._.cache,
- d = new CKEDITOR.dom.range(this.root);
- d.setStartBefore(a);
- d.setEndAfter(a);
- c.ranges = new CKEDITOR.dom.rangeList(d);
- c.selectedElement = c.startElement = a;
- c.type = CKEDITOR.SELECTION_ELEMENT;
- c.selectedText = c.nativeSel = null;
- this.isFake = 1;
- this.rev = s++;
- b._.fakeSelection = this;
- this.root.fire("selectionchange")
- },
- isHidden: function() {
- var a = this.getCommonAncestor();
- a && a.type == CKEDITOR.NODE_TEXT && (a = a.getParent());
- return !(!a || !a.data("cke-hidden-sel"))
- },
- createBookmarks: function(a) {
- a = this.getRanges().createBookmarks(a);
- this.isFake && (a.isFake = 1);
- return a
- },
- createBookmarks2: function(a) {
- a = this.getRanges().createBookmarks2(a);
- this.isFake && (a.isFake = 1);
- return a
- },
- selectBookmarks: function(a) {
- for(var b = [], c = 0; c < a.length; c++) {
- var d = new CKEDITOR.dom.range(this.root);
- d.moveToBookmark(a[c]);
- b.push(d)
- }
- a.isFake ? this.fake(b[0].getEnclosedNode()) :
- this.selectRanges(b);
- return this
- },
- getCommonAncestor: function() {
- var a = this.getRanges();
- return !a.length ? null : a[0].startContainer.getCommonAncestor(a[a.length - 1].endContainer)
- },
- scrollIntoView: function() {
- this.type != CKEDITOR.SELECTION_NONE && this.getRanges()[0].scrollIntoView()
- },
- removeAllRanges: function() {
- if(this.getType() != CKEDITOR.SELECTION_NONE) {
- var a = this.getNative();
- try {
- a && a[t ? "empty" : "removeAllRanges"]()
- } catch(b) {}
- this.reset()
- }
- }
- }
- }(), "use strict", CKEDITOR.STYLE_BLOCK = 1, CKEDITOR.STYLE_INLINE = 2, CKEDITOR.STYLE_OBJECT =
- 3,
- function() {
- function a(a, b) {
- for(var c, d; a = a.getParent();) {
- if(a.equals(b)) break;
- if(a.getAttribute("data-nostyle")) c = a;
- else if(!d) {
- var f = a.getAttribute("contentEditable");
- f == "false" ? c = a : f == "true" && (d = 1)
- }
- }
- return c
- }
- function e(b) {
- var c = b.document;
- if(b.collapsed) {
- c = p(this, c);
- b.insertNode(c);
- b.moveToPosition(c, CKEDITOR.POSITION_BEFORE_END)
- } else {
- var d = this.element,
- f = this._.definition,
- h, i = f.ignoreReadonly,
- j = i || f.includeReadonly;
- j == null && (j = b.root.getCustomData("cke_includeReadonly"));
- var k = CKEDITOR.dtd[d];
- if(!k) {
- h = true;
- k = CKEDITOR.dtd.span
- }
- b.enlarge(CKEDITOR.ENLARGE_INLINE, 1);
- b.trim();
- var m = b.createBookmark(),
- t = m.startNode,
- n = m.endNode,
- s = t,
- l;
- if(!i) {
- var o = b.getCommonAncestor(),
- i = a(t, o),
- o = a(n, o);
- i && (s = i.getNextSourceNode(true));
- o && (n = o)
- }
- for(s.getPosition(n) == CKEDITOR.POSITION_FOLLOWING && (s = 0); s;) {
- i = false;
- if(s.equals(n)) {
- s = null;
- i = true
- } else {
- var u = s.type == CKEDITOR.NODE_ELEMENT ? s.getName() : null,
- o = u && s.getAttribute("contentEditable") == "false",
- w = u && s.getAttribute("data-nostyle");
- if(u && s.data("cke-bookmark")) {
- s =
- s.getNextSourceNode(true);
- continue
- }
- if(o && j && CKEDITOR.dtd.$block[u])
- for(var x = s, r = g(x), v = void 0, z = r.length, y = 0, x = z && new CKEDITOR.dom.range(x.getDocument()); y < z; ++y) {
- var v = r[y],
- A = CKEDITOR.filter.instances[v.data("cke-filter")];
- if(A ? A.check(this) : 1) {
- x.selectNodeContents(v);
- e.call(this, x)
- }
- }
- r = u ? !k[u] || w ? 0 : o && !j ? 0 : (s.getPosition(n) | G) == G && (!f.childRule || f.childRule(s)) : 1;
- if(r)
- if((r = s.getParent()) && ((r.getDtd() || CKEDITOR.dtd.span)[d] || h) && (!f.parentRule || f.parentRule(r))) {
- if(!l && (!u || !CKEDITOR.dtd.$removeEmpty[u] ||
- (s.getPosition(n) | G) == G)) {
- l = b.clone();
- l.setStartBefore(s)
- }
- u = s.type;
- if(u == CKEDITOR.NODE_TEXT || o || u == CKEDITOR.NODE_ELEMENT && !s.getChildCount()) {
- for(var u = s, aa;
- (i = !u.getNext(B)) && (aa = u.getParent(), k[aa.getName()]) && (aa.getPosition(t) | D) == D && (!f.childRule || f.childRule(aa));) u = aa;
- l.setEndAfter(u)
- }
- } else i = true;
- else i = true;
- s = s.getNextSourceNode(w || o)
- }
- if(i && l && !l.collapsed) {
- for(var i = p(this, c), o = i.hasAttributes(), w = l.getCommonAncestor(), u = {}, r = {}, v = {}, z = {}, U, $, ca; i && w;) {
- if(w.getName() == d) {
- for(U in f.attributes)
- if(!z[U] &&
- (ca = w.getAttribute($))) i.getAttribute(U) == ca ? r[U] = 1 : z[U] = 1;
- for($ in f.styles)
- if(!v[$] && (ca = w.getStyle($))) i.getStyle($) == ca ? u[$] = 1 : v[$] = 1
- }
- w = w.getParent()
- }
- for(U in r) i.removeAttribute(U);
- for($ in u) i.removeStyle($);
- o && !i.hasAttributes() && (i = null);
- if(i) {
- l.extractContents().appendTo(i);
- l.insertNode(i);
- q.call(this, i);
- i.mergeSiblings();
- CKEDITOR.env.ie || i.$.normalize()
- } else {
- i = new CKEDITOR.dom.element("span");
- l.extractContents().appendTo(i);
- l.insertNode(i);
- q.call(this, i);
- i.remove(true)
- }
- l = null
- }
- }
- b.moveToBookmark(m);
- b.shrink(CKEDITOR.SHRINK_TEXT);
- b.shrink(CKEDITOR.NODE_ELEMENT, true)
- }
- }
- function b(a) {
- function b() {
- for(var a = new CKEDITOR.dom.elementPath(d.getParent()), c = new CKEDITOR.dom.elementPath(j.getParent()), f = null, g = null, e = 0; e < a.elements.length; e++) {
- var h = a.elements[e];
- if(h == a.block || h == a.blockLimit) break;
- k.checkElementRemovable(h, true) && (f = h)
- }
- for(e = 0; e < c.elements.length; e++) {
- h = c.elements[e];
- if(h == c.block || h == c.blockLimit) break;
- k.checkElementRemovable(h, true) && (g = h)
- }
- g && j.breakParent(g);
- f && d.breakParent(f)
- }
- a.enlarge(CKEDITOR.ENLARGE_INLINE,
- 1);
- var c = a.createBookmark(),
- d = c.startNode;
- if(a.collapsed) {
- for(var f = new CKEDITOR.dom.elementPath(d.getParent(), a.root), g, e = 0, h; e < f.elements.length && (h = f.elements[e]); e++) {
- if(h == f.block || h == f.blockLimit) break;
- if(this.checkElementRemovable(h)) {
- var i;
- if(a.collapsed && (a.checkBoundaryOfElement(h, CKEDITOR.END) || (i = a.checkBoundaryOfElement(h, CKEDITOR.START)))) {
- g = h;
- g.match = i ? "start" : "end"
- } else {
- h.mergeSiblings();
- h.is(this.element) ? o.call(this, h) : m(h, u(this)[h.getName()])
- }
- }
- }
- if(g) {
- h = d;
- for(e = 0;; e++) {
- i = f.elements[e];
- if(i.equals(g)) break;
- else if(i.match) continue;
- else i = i.clone();
- i.append(h);
- h = i
- }
- h[g.match == "start" ? "insertBefore" : "insertAfter"](g)
- }
- } else {
- var j = c.endNode,
- k = this;
- b();
- for(f = d; !f.equals(j);) {
- g = f.getNextSourceNode();
- if(f.type == CKEDITOR.NODE_ELEMENT && this.checkElementRemovable(f)) {
- f.getName() == this.element ? o.call(this, f) : m(f, u(this)[f.getName()]);
- if(g.type == CKEDITOR.NODE_ELEMENT && g.contains(d)) {
- b();
- g = d.getNext()
- }
- }
- f = g
- }
- }
- a.moveToBookmark(c);
- a.shrink(CKEDITOR.NODE_ELEMENT, true)
- }
- function g(a) {
- var b = [];
- a.forEach(function(a) {
- if(a.getAttribute("contenteditable") ==
- "true") {
- b.push(a);
- return false
- }
- }, CKEDITOR.NODE_ELEMENT, true);
- return b
- }
- function c(a) {
- var b = a.getEnclosedNode() || a.getCommonAncestor(false, true);
- (a = (new CKEDITOR.dom.elementPath(b, a.root)).contains(this.element, 1)) && !a.isReadOnly() && t(a, this)
- }
- function d(a) {
- var b = a.getCommonAncestor(true, true);
- if(a = (new CKEDITOR.dom.elementPath(b, a.root)).contains(this.element, 1)) {
- var b = this._.definition,
- c = b.attributes;
- if(c)
- for(var d in c) a.removeAttribute(d, c[d]);
- if(b.styles)
- for(var f in b.styles) b.styles.hasOwnProperty(f) &&
- a.removeStyle(f)
- }
- }
- function j(a) {
- var b = a.createBookmark(true),
- c = a.createIterator();
- c.enforceRealBlocks = true;
- if(this._.enterMode) c.enlargeBr = this._.enterMode != CKEDITOR.ENTER_BR;
- for(var d, f = a.document, g; d = c.getNextParagraph();)
- if(!d.isReadOnly() && (c.activeFilter ? c.activeFilter.check(this) : 1)) {
- g = p(this, f, d);
- h(d, g)
- }
- a.moveToBookmark(b)
- }
- function f(a) {
- var b = a.createBookmark(1),
- c = a.createIterator();
- c.enforceRealBlocks = true;
- c.enlargeBr = this._.enterMode != CKEDITOR.ENTER_BR;
- for(var d, f; d = c.getNextParagraph();)
- if(this.checkElementRemovable(d))
- if(d.is("pre")) {
- (f =
- this._.enterMode == CKEDITOR.ENTER_BR ? null : a.document.createElement(this._.enterMode == CKEDITOR.ENTER_P ? "p" : "div")) && d.copyAttributes(f);
- h(d, f)
- } else o.call(this, d);
- a.moveToBookmark(b)
- }
- function h(a, b) {
- var c = !b;
- if(c) {
- b = a.getDocument().createElement("div");
- a.copyAttributes(b)
- }
- var d = b && b.is("pre"),
- f = a.is("pre"),
- g = !d && f;
- if(d && !f) {
- f = b;
- (g = a.getBogus()) && g.remove();
- g = a.getHtml();
- g = k(g, /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, "");
- g = g.replace(/[ \t\r\n]*(<br[^>]*>)[ \t\r\n]*/gi, "$1");
- g = g.replace(/([ \t\n\r]+| )/g,
- " ");
- g = g.replace(/<br\b[^>]*>/gi, "\n");
- if(CKEDITOR.env.ie) {
- var e = a.getDocument().createElement("div");
- e.append(f);
- f.$.outerHTML = "<pre>" + g + "</pre>";
- f.copyAttributes(e.getFirst());
- f = e.getFirst().remove()
- } else f.setHtml(g);
- b = f
- } else g ? b = n(c ? [a.getHtml()] : i(a), b) : a.moveChildren(b);
- b.replace(a);
- if(d) {
- var c = b,
- h;
- if((h = c.getPrevious(A)) && h.type == CKEDITOR.NODE_ELEMENT && h.is("pre")) {
- d = k(h.getHtml(), /\n$/, "") + "\n\n" + k(c.getHtml(), /^\n/, "");
- CKEDITOR.env.ie ? c.$.outerHTML = "<pre>" + d + "</pre>" : c.setHtml(d);
- h.remove()
- }
- } else c &&
- l(b)
- }
- function i(a) {
- var b = [];
- k(a.getOuterHtml(), /(\S\s*)\n(?:\s|(<span[^>]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi, function(a, b, c) {
- return b + "</pre>" + c + "<pre>"
- }).replace(/<pre\b.*?>([\s\S]*?)<\/pre>/gi, function(a, c) {
- b.push(c)
- });
- return b
- }
- function k(a, b, c) {
- var d = "",
- f = "",
- a = a.replace(/(^<span[^>]+data-cke-bookmark.*?\/span>)|(<span[^>]+data-cke-bookmark.*?\/span>$)/gi, function(a, b, c) {
- b && (d = b);
- c && (f = c);
- return ""
- });
- return d + a.replace(b, c) + f
- }
- function n(a, b) {
- var c;
- a.length > 1 && (c = new CKEDITOR.dom.documentFragment(b.getDocument()));
- for(var d = 0; d < a.length; d++) {
- var f = a[d],
- f = f.replace(/(\r\n|\r)/g, "\n"),
- f = k(f, /^[ \t]*\n/, ""),
- f = k(f, /\n$/, ""),
- f = k(f, /^[ \t]+|[ \t]+$/g, function(a, b) {
- return a.length == 1 ? " " : b ? " " + CKEDITOR.tools.repeat(" ", a.length - 1) : CKEDITOR.tools.repeat(" ", a.length - 1) + " "
- }),
- f = f.replace(/\n/g, "<br>"),
- f = f.replace(/[ \t]{2,}/g, function(a) {
- return CKEDITOR.tools.repeat(" ", a.length - 1) + " "
- });
- if(c) {
- var g = b.clone();
- g.setHtml(f);
- c.append(g)
- } else b.setHtml(f)
- }
- return c || b
- }
- function o(a, b) {
- var c = this._.definition,
- d = c.attributes,
- c = c.styles,
- f = u(this)[a.getName()],
- g = CKEDITOR.tools.isEmpty(d) && CKEDITOR.tools.isEmpty(c),
- e;
- for(e in d)
- if(!((e == "class" || this._.definition.fullMatch) && a.getAttribute(e) != w(e, d[e])) && !(b && e.slice(0, 5) == "data-")) {
- g = a.hasAttribute(e);
- a.removeAttribute(e)
- }
- for(var h in c)
- if(!(this._.definition.fullMatch && a.getStyle(h) != w(h, c[h], true))) {
- g = g || !!a.getStyle(h);
- a.removeStyle(h)
- }
- m(a, f, v[a.getName()]);
- g && (this._.definition.alwaysRemoveElement ? l(a, 1) : !CKEDITOR.dtd.$block[a.getName()] || this._.enterMode ==
- CKEDITOR.ENTER_BR && !a.hasAttributes() ? l(a) : a.renameNode(this._.enterMode == CKEDITOR.ENTER_P ? "p" : "div"))
- }
- function q(a) {
- for(var b = u(this), c = a.getElementsByTag(this.element), d, f = c.count(); --f >= 0;) {
- d = c.getItem(f);
- d.isReadOnly() || o.call(this, d, true)
- }
- for(var g in b)
- if(g != this.element) {
- c = a.getElementsByTag(g);
- for(f = c.count() - 1; f >= 0; f--) {
- d = c.getItem(f);
- d.isReadOnly() || m(d, b[g])
- }
- }
- }
- function m(a, b, c) {
- if(b = b && b.attributes)
- for(var d = 0; d < b.length; d++) {
- var f = b[d][0],
- g;
- if(g = a.getAttribute(f)) {
- var e = b[d][1];
- (e === null ||
- e.test && e.test(g) || typeof e == "string" && g == e) && a.removeAttribute(f)
- }
- }
- c || l(a)
- }
- function l(a, b) {
- if(!a.hasAttributes() || b)
- if(CKEDITOR.dtd.$block[a.getName()]) {
- var c = a.getPrevious(A),
- d = a.getNext(A);
- c && (c.type == CKEDITOR.NODE_TEXT || !c.isBlockBoundary({
- br: 1
- })) && a.append("br", 1);
- d && (d.type == CKEDITOR.NODE_TEXT || !d.isBlockBoundary({
- br: 1
- })) && a.append("br");
- a.remove(true)
- } else {
- c = a.getFirst();
- d = a.getLast();
- a.remove(true);
- if(c) {
- c.type == CKEDITOR.NODE_ELEMENT && c.mergeSiblings();
- d && (!c.equals(d) && d.type == CKEDITOR.NODE_ELEMENT) &&
- d.mergeSiblings()
- }
- }
- }
- function p(a, b, c) {
- var d;
- d = a.element;
- d == "*" && (d = "span");
- d = new CKEDITOR.dom.element(d, b);
- c && c.copyAttributes(d);
- d = t(d, a);
- b.getCustomData("doc_processing_style") && d.hasAttribute("id") ? d.removeAttribute("id") : b.setCustomData("doc_processing_style", 1);
- return d
- }
- function t(a, b) {
- var c = b._.definition,
- d = c.attributes,
- c = CKEDITOR.style.getStyleText(c);
- if(d)
- for(var f in d) a.setAttribute(f, d[f]);
- c && a.setAttribute("style", c);
- return a
- }
- function s(a, b) {
- for(var c in a) a[c] = a[c].replace(z, function(a,
- c) {
- return b[c]
- })
- }
- function u(a) {
- if(a._.overrides) return a._.overrides;
- var b = a._.overrides = {},
- c = a._.definition.overrides;
- if(c) {
- CKEDITOR.tools.isArray(c) || (c = [c]);
- for(var d = 0; d < c.length; d++) {
- var f = c[d],
- g, e;
- if(typeof f == "string") g = f.toLowerCase();
- else {
- g = f.element ? f.element.toLowerCase() : a.element;
- e = f.attributes
- }
- f = b[g] || (b[g] = {});
- if(e) {
- var f = f.attributes = f.attributes || [],
- h;
- for(h in e) f.push([h.toLowerCase(), e[h]])
- }
- }
- }
- return b
- }
- function w(a, b, c) {
- var d = new CKEDITOR.dom.element("span");
- d[c ? "setStyle" : "setAttribute"](a,
- b);
- return d[c ? "getStyle" : "getAttribute"](a)
- }
- function x(a, b, c) {
- for(var d = a.document, f = a.getRanges(), b = b ? this.removeFromRange : this.applyToRange, g, e = f.createIterator(); g = e.getNextRange();) b.call(this, g, c);
- a.selectRanges(f);
- d.removeCustomData("doc_processing_style")
- }
- var v = {
- address: 1,
- div: 1,
- h1: 1,
- h2: 1,
- h3: 1,
- h4: 1,
- h5: 1,
- h6: 1,
- p: 1,
- pre: 1,
- section: 1,
- header: 1,
- footer: 1,
- nav: 1,
- article: 1,
- aside: 1,
- figure: 1,
- dialog: 1,
- hgroup: 1,
- time: 1,
- meter: 1,
- menu: 1,
- command: 1,
- keygen: 1,
- output: 1,
- progress: 1,
- details: 1,
- datagrid: 1,
- datalist: 1
- },
- r = {
- a: 1,
- blockquote: 1,
- embed: 1,
- hr: 1,
- img: 1,
- li: 1,
- object: 1,
- ol: 1,
- table: 1,
- td: 1,
- tr: 1,
- th: 1,
- ul: 1,
- dl: 1,
- dt: 1,
- dd: 1,
- form: 1,
- audio: 1,
- video: 1
- },
- y = /\s*(?:;\s*|$)/,
- z = /#\((.+?)\)/g,
- B = CKEDITOR.dom.walker.bookmark(0, 1),
- A = CKEDITOR.dom.walker.whitespaces(1);
- CKEDITOR.style = function(a, b) {
- if(typeof a.type == "string") return new CKEDITOR.style.customHandlers[a.type](a);
- var c = a.attributes;
- if(c && c.style) {
- a.styles = CKEDITOR.tools.extend({}, a.styles, CKEDITOR.tools.parseCssText(c.style));
- delete c.style
- }
- if(b) {
- a = CKEDITOR.tools.clone(a);
- s(a.attributes,
- b);
- s(a.styles, b)
- }
- c = this.element = a.element ? typeof a.element == "string" ? a.element.toLowerCase() : a.element : "*";
- this.type = a.type || (v[c] ? CKEDITOR.STYLE_BLOCK : r[c] ? CKEDITOR.STYLE_OBJECT : CKEDITOR.STYLE_INLINE);
- if(typeof this.element == "object") this.type = CKEDITOR.STYLE_OBJECT;
- this._ = {
- definition: a
- }
- };
- CKEDITOR.style.prototype = {
- apply: function(a) {
- if(a instanceof CKEDITOR.dom.document) return x.call(this, a.getSelection());
- if(this.checkApplicable(a.elementPath(), a)) {
- var b = this._.enterMode;
- if(!b) this._.enterMode = a.activeEnterMode;
- x.call(this, a.getSelection(), 0, a);
- this._.enterMode = b
- }
- },
- remove: function(a) {
- if(a instanceof CKEDITOR.dom.document) return x.call(this, a.getSelection(), 1);
- if(this.checkApplicable(a.elementPath(), a)) {
- var b = this._.enterMode;
- if(!b) this._.enterMode = a.activeEnterMode;
- x.call(this, a.getSelection(), 1, a);
- this._.enterMode = b
- }
- },
- applyToRange: function(a) {
- this.applyToRange = this.type == CKEDITOR.STYLE_INLINE ? e : this.type == CKEDITOR.STYLE_BLOCK ? j : this.type == CKEDITOR.STYLE_OBJECT ? c : null;
- return this.applyToRange(a)
- },
- removeFromRange: function(a) {
- this.removeFromRange =
- this.type == CKEDITOR.STYLE_INLINE ? b : this.type == CKEDITOR.STYLE_BLOCK ? f : this.type == CKEDITOR.STYLE_OBJECT ? d : null;
- return this.removeFromRange(a)
- },
- applyToObject: function(a) {
- t(a, this)
- },
- checkActive: function(a, b) {
- switch(this.type) {
- case CKEDITOR.STYLE_BLOCK:
- return this.checkElementRemovable(a.block || a.blockLimit, true, b);
- case CKEDITOR.STYLE_OBJECT:
- case CKEDITOR.STYLE_INLINE:
- for(var c = a.elements, d = 0, f; d < c.length; d++) {
- f = c[d];
- if(!(this.type == CKEDITOR.STYLE_INLINE && (f == a.block || f == a.blockLimit))) {
- if(this.type ==
- CKEDITOR.STYLE_OBJECT) {
- var g = f.getName();
- if(!(typeof this.element == "string" ? g == this.element : g in this.element)) continue
- }
- if(this.checkElementRemovable(f, true, b)) return true
- }
- }
- }
- return false
- },
- checkApplicable: function(a, b, c) {
- b && b instanceof CKEDITOR.filter && (c = b);
- if(c && !c.check(this)) return false;
- switch(this.type) {
- case CKEDITOR.STYLE_OBJECT:
- return !!a.contains(this.element);
- case CKEDITOR.STYLE_BLOCK:
- return !!a.blockLimit.getDtd()[this.element]
- }
- return true
- },
- checkElementMatch: function(a, b) {
- var c = this._.definition;
- if(!a || !c.ignoreReadonly && a.isReadOnly()) return false;
- var d = a.getName();
- if(typeof this.element == "string" ? d == this.element : d in this.element) {
- if(!b && !a.hasAttributes()) return true;
- if(d = c._AC) c = d;
- else {
- var d = {},
- f = 0,
- g = c.attributes;
- if(g)
- for(var e in g) {
- f++;
- d[e] = g[e]
- }
- if(e = CKEDITOR.style.getStyleText(c)) {
- d.style || f++;
- d.style = e
- }
- d._length = f;
- c = c._AC = d
- }
- if(c._length) {
- for(var h in c)
- if(h != "_length") {
- f = a.getAttribute(h) || "";
- if(h == "style") a: {
- d = c[h];typeof d == "string" && (d = CKEDITOR.tools.parseCssText(d));typeof f ==
- "string" && (f = CKEDITOR.tools.parseCssText(f, true));e = void 0;
- for(e in d)
- if(!(e in f && (f[e] == d[e] || d[e] == "inherit" || f[e] == "inherit"))) {
- d = false;
- break a
- }
- d = true
- }
- else d = c[h] == f;
- if(d) {
- if(!b) return true
- } else if(b) return false
- }
- if(b) return true
- } else return true
- }
- return false
- },
- checkElementRemovable: function(a, b, c) {
- if(this.checkElementMatch(a, b, c)) return true;
- if(b = u(this)[a.getName()]) {
- var d;
- if(!(b = b.attributes)) return true;
- for(c = 0; c < b.length; c++) {
- d = b[c][0];
- if(d = a.getAttribute(d)) {
- var f = b[c][1];
- if(f === null) return true;
- if(typeof f == "string") {
- if(d == f) return true
- } else if(f.test(d)) return true
- }
- }
- }
- return false
- },
- buildPreview: function(a) {
- var b = this._.definition,
- c = [],
- d = b.element;
- d == "bdo" && (d = "span");
- var c = ["<", d],
- f = b.attributes;
- if(f)
- for(var g in f) c.push(" ", g, '="', f[g], '"');
- (f = CKEDITOR.style.getStyleText(b)) && c.push(' style="', f, '"');
- c.push(">", a || b.name, "</", d, ">");
- return c.join("")
- },
- getDefinition: function() {
- return this._.definition
- }
- };
- CKEDITOR.style.getStyleText = function(a) {
- var b = a._ST;
- if(b) return b;
- var b = a.styles,
- c =
- a.attributes && a.attributes.style || "",
- d = "";
- c.length && (c = c.replace(y, ";"));
- for(var f in b) {
- var g = b[f],
- e = (f + ":" + g).replace(y, ";");
- g == "inherit" ? d = d + e : c = c + e
- }
- c.length && (c = CKEDITOR.tools.normalizeCssText(c, true));
- return a._ST = c + d
- };
- CKEDITOR.style.customHandlers = {};
- CKEDITOR.style.addCustomHandler = function(a) {
- var b = function(a) {
- this._ = {
- definition: a
- };
- this.setup && this.setup(a)
- };
- b.prototype = CKEDITOR.tools.extend(CKEDITOR.tools.prototypedCopy(CKEDITOR.style.prototype), {
- assignedTo: CKEDITOR.STYLE_OBJECT
- }, a, true);
- return this.customHandlers[a.type] = b
- };
- var G = CKEDITOR.POSITION_PRECEDING | CKEDITOR.POSITION_IDENTICAL | CKEDITOR.POSITION_IS_CONTAINED,
- D = CKEDITOR.POSITION_FOLLOWING | CKEDITOR.POSITION_IDENTICAL | CKEDITOR.POSITION_IS_CONTAINED
- }(), CKEDITOR.styleCommand = function(a, e) {
- this.requiredContent = this.allowedContent = this.style = a;
- CKEDITOR.tools.extend(this, e, true)
- }, CKEDITOR.styleCommand.prototype.exec = function(a) {
- a.focus();
- this.state == CKEDITOR.TRISTATE_OFF ? a.applyStyle(this.style) : this.state == CKEDITOR.TRISTATE_ON &&
- a.removeStyle(this.style)
- }, CKEDITOR.stylesSet = new CKEDITOR.resourceManager("", "stylesSet"), CKEDITOR.addStylesSet = CKEDITOR.tools.bind(CKEDITOR.stylesSet.add, CKEDITOR.stylesSet), CKEDITOR.loadStylesSet = function(a, e, b) {
- CKEDITOR.stylesSet.addExternal(a, e, "");
- CKEDITOR.stylesSet.load(a, b)
- }, CKEDITOR.tools.extend(CKEDITOR.editor.prototype, {
- attachStyleStateChange: function(a, e) {
- var b = this._.styleStateChangeCallbacks;
- if(!b) {
- b = this._.styleStateChangeCallbacks = [];
- this.on("selectionChange", function(a) {
- for(var c =
- 0; c < b.length; c++) {
- var d = b[c],
- e = d.style.checkActive(a.data.path, this) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF;
- d.fn.call(this, e)
- }
- })
- }
- b.push({
- style: a,
- fn: e
- })
- },
- applyStyle: function(a) {
- a.apply(this)
- },
- removeStyle: function(a) {
- a.remove(this)
- },
- getStylesSet: function(a) {
- if(this._.stylesDefinitions) a(this._.stylesDefinitions);
- else {
- var e = this,
- b = e.config.stylesCombo_stylesSet || e.config.stylesSet;
- if(b === false) a(null);
- else if(b instanceof Array) {
- e._.stylesDefinitions = b;
- a(b)
- } else {
- b || (b = "default");
- var b = b.split(":"),
- g = b[0];
- CKEDITOR.stylesSet.addExternal(g, b[1] ? b.slice(1).join(":") : CKEDITOR.getUrl("styles.js"), "");
- CKEDITOR.stylesSet.load(g, function(b) {
- e._.stylesDefinitions = b[g];
- a(e._.stylesDefinitions)
- })
- }
- }
- }
- }), CKEDITOR.dom.comment = function(a, e) {
- typeof a == "string" && (a = (e ? e.$ : document).createComment(a));
- CKEDITOR.dom.domObject.call(this, a)
- }, CKEDITOR.dom.comment.prototype = new CKEDITOR.dom.node, CKEDITOR.tools.extend(CKEDITOR.dom.comment.prototype, {
- type: CKEDITOR.NODE_COMMENT,
- getOuterHtml: function() {
- return "<\!--" + this.$.nodeValue +
- "--\>"
- }
- }), "use strict",
- function() {
- var a = {},
- e = {},
- b;
- for(b in CKEDITOR.dtd.$blockLimit) b in CKEDITOR.dtd.$list || (a[b] = 1);
- for(b in CKEDITOR.dtd.$block) b in CKEDITOR.dtd.$blockLimit || b in CKEDITOR.dtd.$empty || (e[b] = 1);
- CKEDITOR.dom.elementPath = function(b, c) {
- var d = null,
- j = null,
- f = [],
- h = b,
- i, c = c || b.getDocument().getBody();
- do
- if(h.type == CKEDITOR.NODE_ELEMENT) {
- f.push(h);
- if(!this.lastElement) {
- this.lastElement = h;
- if(h.is(CKEDITOR.dtd.$object) || h.getAttribute("contenteditable") == "false") continue
- }
- if(h.equals(c)) break;
- if(!j) {
- i = h.getName();
- h.getAttribute("contenteditable") == "true" ? j = h : !d && e[i] && (d = h);
- if(a[i]) {
- var k;
- if(k = !d) {
- if(i = i == "div") {
- a: {
- i = h.getChildren();k = 0;
- for(var n = i.count(); k < n; k++) {
- var o = i.getItem(k);
- if(o.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$block[o.getName()]) {
- i = true;
- break a
- }
- }
- i = false
- }
- i = !i
- }
- k = i
- }
- k ? d = h : j = h
- }
- }
- }
- while(h = h.getParent());
- j || (j = c);
- this.block = d;
- this.blockLimit = j;
- this.root = c;
- this.elements = f
- }
- }(), CKEDITOR.dom.elementPath.prototype = {
- compare: function(a) {
- var e = this.elements,
- a = a && a.elements;
- if(!a ||
- e.length != a.length) return false;
- for(var b = 0; b < e.length; b++)
- if(!e[b].equals(a[b])) return false;
- return true
- },
- contains: function(a, e, b) {
- var g;
- typeof a == "string" && (g = function(b) {
- return b.getName() == a
- });
- a instanceof CKEDITOR.dom.element ? g = function(b) {
- return b.equals(a)
- } : CKEDITOR.tools.isArray(a) ? g = function(b) {
- return CKEDITOR.tools.indexOf(a, b.getName()) > -1
- } : typeof a == "function" ? g = a : typeof a == "object" && (g = function(b) {
- return b.getName() in a
- });
- var c = this.elements,
- d = c.length;
- e && d--;
- if(b) {
- c = Array.prototype.slice.call(c,
- 0);
- c.reverse()
- }
- for(e = 0; e < d; e++)
- if(g(c[e])) return c[e];
- return null
- },
- isContextFor: function(a) {
- var e;
- if(a in CKEDITOR.dtd.$block) {
- e = this.contains(CKEDITOR.dtd.$intermediate) || this.root.equals(this.block) && this.block || this.blockLimit;
- return !!e.getDtd()[a]
- }
- return true
- },
- direction: function() {
- return(this.block || this.blockLimit || this.root).getDirection(1)
- }
- }, CKEDITOR.dom.text = function(a, e) {
- typeof a == "string" && (a = (e ? e.$ : document).createTextNode(a));
- this.$ = a
- }, CKEDITOR.dom.text.prototype = new CKEDITOR.dom.node,
- CKEDITOR.tools.extend(CKEDITOR.dom.text.prototype, {
- type: CKEDITOR.NODE_TEXT,
- getLength: function() {
- return this.$.nodeValue.length
- },
- getText: function() {
- return this.$.nodeValue
- },
- setText: function(a) {
- this.$.nodeValue = a
- },
- split: function(a) {
- var e = this.$.parentNode,
- b = e.childNodes.length,
- g = this.getLength(),
- c = this.getDocument(),
- d = new CKEDITOR.dom.text(this.$.splitText(a), c);
- if(e.childNodes.length == b)
- if(a >= g) {
- d = c.createText("");
- d.insertAfter(this)
- } else {
- a = c.createText("");
- a.insertAfter(d);
- a.remove()
- }
- return d
- },
- substring: function(a,
- e) {
- return typeof e != "number" ? this.$.nodeValue.substr(a) : this.$.nodeValue.substring(a, e)
- }
- }),
- function() {
- function a(a, g, c) {
- var d = a.serializable,
- e = g[c ? "endContainer" : "startContainer"],
- f = c ? "endOffset" : "startOffset",
- h = d ? g.document.getById(a.startNode) : a.startNode,
- a = d ? g.document.getById(a.endNode) : a.endNode;
- if(e.equals(h.getPrevious())) {
- g.startOffset = g.startOffset - e.getLength() - a.getPrevious().getLength();
- e = a.getNext()
- } else if(e.equals(a.getPrevious())) {
- g.startOffset = g.startOffset - e.getLength();
- e = a.getNext()
- }
- e.equals(h.getParent()) &&
- g[f]++;
- e.equals(a.getParent()) && g[f]++;
- g[c ? "endContainer" : "startContainer"] = e;
- return g
- }
- CKEDITOR.dom.rangeList = function(a) {
- if(a instanceof CKEDITOR.dom.rangeList) return a;
- a ? a instanceof CKEDITOR.dom.range && (a = [a]) : a = [];
- return CKEDITOR.tools.extend(a, e)
- };
- var e = {
- createIterator: function() {
- var a = this,
- g = CKEDITOR.dom.walker.bookmark(),
- c = [],
- d;
- return {
- getNextRange: function(e) {
- d = d === void 0 ? 0 : d + 1;
- var f = a[d];
- if(f && a.length > 1) {
- if(!d)
- for(var h = a.length - 1; h >= 0; h--) c.unshift(a[h].createBookmark(true));
- if(e)
- for(var i =
- 0; a[d + i + 1];) {
- for(var k = f.document, e = 0, h = k.getById(c[i].endNode), k = k.getById(c[i + 1].startNode);;) {
- h = h.getNextSourceNode(false);
- if(k.equals(h)) e = 1;
- else if(g(h) || h.type == CKEDITOR.NODE_ELEMENT && h.isBlockBoundary()) continue;
- break
- }
- if(!e) break;
- i++
- }
- for(f.moveToBookmark(c.shift()); i--;) {
- h = a[++d];
- h.moveToBookmark(c.shift());
- f.setEnd(h.endContainer, h.endOffset)
- }
- }
- return f
- }
- }
- },
- createBookmarks: function(b) {
- for(var g = [], c, d = 0; d < this.length; d++) {
- g.push(c = this[d].createBookmark(b, true));
- for(var e = d + 1; e < this.length; e++) {
- this[e] =
- a(c, this[e]);
- this[e] = a(c, this[e], true)
- }
- }
- return g
- },
- createBookmarks2: function(a) {
- for(var g = [], c = 0; c < this.length; c++) g.push(this[c].createBookmark2(a));
- return g
- },
- moveToBookmarks: function(a) {
- for(var g = 0; g < this.length; g++) this[g].moveToBookmark(a[g])
- }
- }
- }(),
- function() {
- function a() {
- return CKEDITOR.getUrl(CKEDITOR.skinName.split(",")[1] || "skins/" + CKEDITOR.skinName.split(",")[0] + "/")
- }
- function e(b) {
- var c = CKEDITOR.skin["ua_" + b],
- d = CKEDITOR.env;
- if(c)
- for(var c = c.split(",").sort(function(a, b) {
- return a > b ? -1 : 1
- }), f =
- 0, g; f < c.length; f++) {
- g = c[f];
- if(d.ie && (g.replace(/^ie/, "") == d.version || d.quirks && g == "iequirks")) g = "ie";
- if(d[g]) {
- b = b + ("_" + c[f]);
- break
- }
- }
- return CKEDITOR.getUrl(a() + b + ".css")
- }
- function b(a, b) {
- if(!d[a]) {
- CKEDITOR.document.appendStyleSheet(e(a));
- d[a] = 1
- }
- b && b()
- }
- function g(a) {
- var b = a.getById(j);
- if(!b) {
- b = a.getHead().append("style");
- b.setAttribute("id", j);
- b.setAttribute("type", "text/css")
- }
- return b
- }
- function c(a, b, c) {
- var d, f, g;
- if(CKEDITOR.env.webkit) {
- b = b.split("}").slice(0, -1);
- for(f = 0; f < b.length; f++) b[f] = b[f].split("{")
- }
- for(var e =
- 0; e < a.length; e++)
- if(CKEDITOR.env.webkit)
- for(f = 0; f < b.length; f++) {
- g = b[f][1];
- for(d = 0; d < c.length; d++) g = g.replace(c[d][0], c[d][1]);
- a[e].$.sheet.addRule(b[f][0], g)
- } else {
- g = b;
- for(d = 0; d < c.length; d++) g = g.replace(c[d][0], c[d][1]);
- CKEDITOR.env.ie && CKEDITOR.env.version < 11 ? a[e].$.styleSheet.cssText = a[e].$.styleSheet.cssText + g : a[e].$.innerHTML = a[e].$.innerHTML + g
- }
- }
- var d = {};
- CKEDITOR.skin = {
- path: a,
- loadPart: function(c, d) {
- CKEDITOR.skin.name != CKEDITOR.skinName.split(",")[0] ? CKEDITOR.scriptLoader.load(CKEDITOR.getUrl(a() +
- "skin.js"), function() {
- b(c, d)
- }) : b(c, d)
- },
- getPath: function(a) {
- return CKEDITOR.getUrl(e(a))
- },
- icons: {},
- addIcon: function(a, b, c, d) {
- a = a.toLowerCase();
- this.icons[a] || (this.icons[a] = {
- path: b,
- offset: c || 0,
- bgsize: d || "16px"
- })
- },
- getIconStyle: function(a, b, c, d, f) {
- var g;
- if(a) {
- a = a.toLowerCase();
- b && (g = this.icons[a + "-rtl"]);
- g || (g = this.icons[a])
- }
- a = c || g && g.path || "";
- d = d || g && g.offset;
- f = f || g && g.bgsize || "16px";
- return a && "background-image:url(" + CKEDITOR.getUrl(a) + ");background-position:0 " + d + "px;background-size:" + f + ";"
- }
- };
- CKEDITOR.tools.extend(CKEDITOR.editor.prototype, {
- getUiColor: function() {
- return this.uiColor
- },
- setUiColor: function(a) {
- var b = g(CKEDITOR.document);
- return(this.setUiColor = function(a) {
- this.uiColor = a;
- var d = CKEDITOR.skin.chameleon,
- g = "",
- e = "";
- if(typeof d == "function") {
- g = d(this, "editor");
- e = d(this, "panel")
- }
- a = [
- [h, a]
- ];
- c([b], g, a);
- c(f, e, a)
- }).call(this, a)
- }
- });
- var j = "cke_ui_color",
- f = [],
- h = /\$color/g;
- CKEDITOR.on("instanceLoaded", function(a) {
- if(!CKEDITOR.env.ie || !CKEDITOR.env.quirks) {
- var b = a.editor,
- a = function(a) {
- a = (a.data[0] || a.data).element.getElementsByTag("iframe").getItem(0).getFrameDocument();
- if(!a.getById("cke_ui_color")) {
- a = g(a);
- f.push(a);
- var d = b.getUiColor();
- d && c([a], CKEDITOR.skin.chameleon(b, "panel"), [
- [h, d]
- ])
- }
- };
- b.on("panelShow", a);
- b.on("menuShow", a);
- b.config.uiColor && b.setUiColor(b.config.uiColor)
- }
- })
- }(),
- function() {
- if(CKEDITOR.env.webkit) CKEDITOR.env.hc = false;
- else {
- var a = CKEDITOR.dom.element.createFromHtml('<div style="width:0;height:0;position:absolute;left:-10000px;border:1px solid;border-color:red blue"></div>', CKEDITOR.document);
- a.appendTo(CKEDITOR.document.getHead());
- try {
- var e = a.getComputedStyle("border-top-color"),
- b = a.getComputedStyle("border-right-color");
- CKEDITOR.env.hc = !!(e && e == b)
- } catch(g) {
- CKEDITOR.env.hc = false
- }
- a.remove()
- }
- if(CKEDITOR.env.hc) CKEDITOR.env.cssClass = CKEDITOR.env.cssClass + " cke_hc";
- CKEDITOR.document.appendStyleText(".cke{visibility:hidden;}");
- CKEDITOR.status = "loaded";
- CKEDITOR.fireOnce("loaded");
- if(a = CKEDITOR._.pending) {
- delete CKEDITOR._.pending;
- for(e = 0; e < a.length; e++) {
- CKEDITOR.editor.prototype.constructor.apply(a[e][0], a[e][1]);
- CKEDITOR.add(a[e][0])
- }
- }
- }(), CKEDITOR.skin.name = "moono", CKEDITOR.skin.ua_editor =
- "ie,iequirks,ie7,ie8,gecko", CKEDITOR.skin.ua_dialog = "ie,iequirks,ie7,ie8", CKEDITOR.skin.chameleon = function() {
- var a = function() {
- return function(a, b) {
- for(var d = a.match(/[^#]./g), e = 0; e < 3; e++) {
- var f = d,
- h = e,
- i;
- i = parseInt(d[e], 16);
- i = ("0" + (b < 0 ? 0 | i * (1 + b) : 0 | i + (255 - i) * b).toString(16)).slice(-2);
- f[h] = i
- }
- return "#" + d.join("")
- }
- }(),
- e = function() {
- var a = new CKEDITOR.template("background:#{to};background-image:-webkit-gradient(linear,lefttop,leftbottom,from({from}),to({to}));background-image:-moz-linear-gradient(top,{from},{to});background-image:-webkit-linear-gradient(top,{from},{to});background-image:-o-linear-gradient(top,{from},{to});background-image:-ms-linear-gradient(top,{from},{to});background-image:linear-gradient(top,{from},{to});filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='{from}',endColorstr='{to}');");
- return function(b, d) {
- return a.output({
- from: b,
- to: d
- })
- }
- }(),
- b = {
- editor: new CKEDITOR.template("{id}.cke_chrome [border-color:{defaultBorder};] {id} .cke_top [ {defaultGradient}border-bottom-color:{defaultBorder};] {id} .cke_bottom [{defaultGradient}border-top-color:{defaultBorder};] {id} .cke_resizer [border-right-color:{ckeResizer}] {id} .cke_dialog_title [{defaultGradient}border-bottom-color:{defaultBorder};] {id} .cke_dialog_footer [{defaultGradient}outline-color:{defaultBorder};border-top-color:{defaultBorder};] {id} .cke_dialog_tab [{lightGradient}border-color:{defaultBorder};] {id} .cke_dialog_tab:hover [{mediumGradient}] {id} .cke_dialog_contents [border-top-color:{defaultBorder};] {id} .cke_dialog_tab_selected, {id} .cke_dialog_tab_selected:hover [background:{dialogTabSelected};border-bottom-color:{dialogTabSelectedBorder};] {id} .cke_dialog_body [background:{dialogBody};border-color:{defaultBorder};] {id} .cke_toolgroup [{lightGradient}border-color:{defaultBorder};] {id} a.cke_button_off:hover, {id} a.cke_button_off:focus, {id} a.cke_button_off:active [{mediumGradient}] {id} .cke_button_on [{ckeButtonOn}] {id} .cke_toolbar_separator [background-color: {ckeToolbarSeparator};] {id} .cke_combo_button [border-color:{defaultBorder};{lightGradient}] {id} a.cke_combo_button:hover, {id} a.cke_combo_button:focus, {id} .cke_combo_on a.cke_combo_button [border-color:{defaultBorder};{mediumGradient}] {id} .cke_path_item [color:{elementsPathColor};] {id} a.cke_path_item:hover, {id} a.cke_path_item:focus, {id} a.cke_path_item:active [background-color:{elementsPathBg};] {id}.cke_panel [border-color:{defaultBorder};] "),
- panel: new CKEDITOR.template(".cke_panel_grouptitle [{lightGradient}border-color:{defaultBorder};] .cke_menubutton_icon [background-color:{menubuttonIcon};] .cke_menubutton:hover .cke_menubutton_icon, .cke_menubutton:focus .cke_menubutton_icon, .cke_menubutton:active .cke_menubutton_icon [background-color:{menubuttonIconHover};] .cke_menuseparator [background-color:{menubuttonIcon};] a:hover.cke_colorbox, a:focus.cke_colorbox, a:active.cke_colorbox [border-color:{defaultBorder};] a:hover.cke_colorauto, a:hover.cke_colormore, a:focus.cke_colorauto, a:focus.cke_colormore, a:active.cke_colorauto, a:active.cke_colormore [background-color:{ckeColorauto};border-color:{defaultBorder};] ")
- };
- return function(g, c) {
- var d = g.uiColor,
- d = {
- id: "." + g.id,
- defaultBorder: a(d, -0.1),
- defaultGradient: e(a(d, 0.9), d),
- lightGradient: e(a(d, 1), a(d, 0.7)),
- mediumGradient: e(a(d, 0.8), a(d, 0.5)),
- ckeButtonOn: e(a(d, 0.6), a(d, 0.7)),
- ckeResizer: a(d, -0.4),
- ckeToolbarSeparator: a(d, 0.5),
- ckeColorauto: a(d, 0.8),
- dialogBody: a(d, 0.7),
- dialogTabSelected: e("#FFFFFF", "#FFFFFF"),
- dialogTabSelectedBorder: "#FFF",
- elementsPathColor: a(d, -0.6),
- elementsPathBg: d,
- menubuttonIcon: a(d, 0.5),
- menubuttonIconHover: a(d, 0.3)
- };
- return b[c].output(d).replace(/\[/g,
- "{").replace(/\]/g, "}")
- }
- }(), CKEDITOR.plugins.add("dialogui", {
- onLoad: function() {
- var a = function(a) {
- this._ || (this._ = {});
- this._["default"] = this._.initValue = a["default"] || "";
- this._.required = a.required || false;
- for(var b = [this._], c = 1; c < arguments.length; c++) b.push(arguments[c]);
- b.push(true);
- CKEDITOR.tools.extend.apply(CKEDITOR.tools, b);
- return this._
- },
- e = {
- build: function(a, b, c) {
- return new CKEDITOR.ui.dialog.textInput(a, b, c)
- }
- },
- b = {
- build: function(a, b, c) {
- return new CKEDITOR.ui.dialog[b.type](a, b, c)
- }
- },
- g = {
- isChanged: function() {
- return this.getValue() !=
- this.getInitValue()
- },
- reset: function(a) {
- this.setValue(this.getInitValue(), a)
- },
- setInitValue: function() {
- this._.initValue = this.getValue()
- },
- resetInitValue: function() {
- this._.initValue = this._["default"]
- },
- getInitValue: function() {
- return this._.initValue
- }
- },
- c = CKEDITOR.tools.extend({}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, {
- onChange: function(a, b) {
- if(!this._.domOnChangeRegistered) {
- a.on("load", function() {
- this.getInputElement().on("change", function() {
- a.parts.dialog.isVisible() && this.fire("change", {
- value: this.getValue()
- })
- }, this)
- }, this);
- this._.domOnChangeRegistered = true
- }
- this.on("change", b)
- }
- }, true),
- d = /^on([A-Z]\w+)/,
- j = function(a) {
- for(var b in a)(d.test(b) || b == "title" || b == "type") && delete a[b];
- return a
- };
- CKEDITOR.tools.extend(CKEDITOR.ui.dialog, {
- labeledElement: function(b, c, d, g) {
- if(!(arguments.length < 4)) {
- var e = a.call(this, c);
- e.labelId = CKEDITOR.tools.getNextId() + "_label";
- this._.children = [];
- var j = {
- role: c.role || "presentation"
- };
- if(c.includeLabel) j["aria-labelledby"] = e.labelId;
- CKEDITOR.ui.dialog.uiElement.call(this,
- b, c, d, "div", null, j,
- function() {
- var a = [],
- d = c.required ? " cke_required" : "";
- if(c.labelLayout != "horizontal") a.push('<label class="cke_dialog_ui_labeled_label' + d + '" ', ' id="' + e.labelId + '"', e.inputId ? ' for="' + e.inputId + '"' : "", (c.labelStyle ? ' style="' + c.labelStyle + '"' : "") + ">", c.label, "</label>", '<div class="cke_dialog_ui_labeled_content"', c.controlStyle ? ' style="' + c.controlStyle + '"' : "", ' role="presentation">', g.call(this, b, c), "</div>");
- else {
- d = {
- type: "hbox",
- widths: c.widths,
- padding: 0,
- children: [{
- type: "html",
- html: '<label class="cke_dialog_ui_labeled_label' +
- d + '" id="' + e.labelId + '" for="' + e.inputId + '"' + (c.labelStyle ? ' style="' + c.labelStyle + '"' : "") + ">" + CKEDITOR.tools.htmlEncode(c.label) + "</span>"
- }, {
- type: "html",
- html: '<span class="cke_dialog_ui_labeled_content"' + (c.controlStyle ? ' style="' + c.controlStyle + '"' : "") + ">" + g.call(this, b, c) + "</span>"
- }]
- };
- CKEDITOR.dialog._.uiElementBuilders.hbox.build(b, d, a)
- }
- return a.join("")
- })
- }
- },
- textInput: function(b, c, d) {
- if(!(arguments.length < 3)) {
- a.call(this, c);
- var g = this._.inputId = CKEDITOR.tools.getNextId() + "_textInput",
- e = {
- "class": "cke_dialog_ui_input_" +
- c.type,
- id: g,
- type: c.type
- };
- if(c.validate) this.validate = c.validate;
- if(c.maxLength) e.maxlength = c.maxLength;
- if(c.size) e.size = c.size;
- if(c.inputStyle) e.style = c.inputStyle;
- var j = this,
- q = false;
- b.on("load", function() {
- j.getInputElement().on("keydown", function(a) {
- a.data.getKeystroke() == 13 && (q = true)
- });
- j.getInputElement().on("keyup", function(a) {
- if(a.data.getKeystroke() == 13 && q) {
- b.getButton("ok") && setTimeout(function() {
- b.getButton("ok").click()
- }, 0);
- q = false
- }
- }, null, null, 1E3)
- });
- CKEDITOR.ui.dialog.labeledElement.call(this,
- b, c, d,
- function() {
- var a = ['<div class="cke_dialog_ui_input_', c.type, '" role="presentation"'];
- c.width && a.push('style="width:' + c.width + '" ');
- a.push("><input ");
- e["aria-labelledby"] = this._.labelId;
- this._.required && (e["aria-required"] = this._.required);
- for(var b in e) a.push(b + '="' + e[b] + '" ');
- a.push(" /></div>");
- return a.join("")
- })
- }
- },
- textarea: function(b, c, d) {
- if(!(arguments.length < 3)) {
- a.call(this, c);
- var g = this,
- e = this._.inputId = CKEDITOR.tools.getNextId() + "_textarea",
- j = {};
- if(c.validate) this.validate = c.validate;
- j.rows = c.rows || 5;
- j.cols = c.cols || 20;
- j["class"] = "cke_dialog_ui_input_textarea " + (c["class"] || "");
- if(typeof c.inputStyle != "undefined") j.style = c.inputStyle;
- if(c.dir) j.dir = c.dir;
- CKEDITOR.ui.dialog.labeledElement.call(this, b, c, d, function() {
- j["aria-labelledby"] = this._.labelId;
- this._.required && (j["aria-required"] = this._.required);
- var a = ['<div class="cke_dialog_ui_input_textarea" role="presentation"><textarea id="', e, '" '],
- b;
- for(b in j) a.push(b + '="' + CKEDITOR.tools.htmlEncode(j[b]) + '" ');
- a.push(">", CKEDITOR.tools.htmlEncode(g._["default"]),
- "</textarea></div>");
- return a.join("")
- })
- }
- },
- checkbox: function(b, c, d) {
- if(!(arguments.length < 3)) {
- var g = a.call(this, c, {
- "default": !!c["default"]
- });
- if(c.validate) this.validate = c.validate;
- CKEDITOR.ui.dialog.uiElement.call(this, b, c, d, "span", null, null, function() {
- var a = CKEDITOR.tools.extend({}, c, {
- id: c.id ? c.id + "_checkbox" : CKEDITOR.tools.getNextId() + "_checkbox"
- }, true),
- d = [],
- e = CKEDITOR.tools.getNextId() + "_label",
- i = {
- "class": "cke_dialog_ui_checkbox_input",
- type: "checkbox",
- "aria-labelledby": e
- };
- j(a);
- if(c["default"]) i.checked =
- "checked";
- if(typeof a.inputStyle != "undefined") a.style = a.inputStyle;
- g.checkbox = new CKEDITOR.ui.dialog.uiElement(b, a, d, "input", null, i);
- d.push(' <label id="', e, '" for="', i.id, '"' + (c.labelStyle ? ' style="' + c.labelStyle + '"' : "") + ">", CKEDITOR.tools.htmlEncode(c.label), "</label>");
- return d.join("")
- })
- }
- },
- radio: function(b, c, d) {
- if(!(arguments.length < 3)) {
- a.call(this, c);
- if(!this._["default"]) this._["default"] = this._.initValue = c.items[0][1];
- if(c.validate) this.validate = c.valdiate;
- var g = [],
- e = this;
- c.role = "radiogroup";
- c.includeLabel = true;
- CKEDITOR.ui.dialog.labeledElement.call(this, b, c, d, function() {
- for(var a = [], d = [], i = (c.id ? c.id : CKEDITOR.tools.getNextId()) + "_radio", l = 0; l < c.items.length; l++) {
- var p = c.items[l],
- t = p[2] !== void 0 ? p[2] : p[0],
- s = p[1] !== void 0 ? p[1] : p[0],
- u = CKEDITOR.tools.getNextId() + "_radio_input",
- w = u + "_label",
- u = CKEDITOR.tools.extend({}, c, {
- id: u,
- title: null,
- type: null
- }, true),
- t = CKEDITOR.tools.extend({}, u, {
- title: t
- }, true),
- x = {
- type: "radio",
- "class": "cke_dialog_ui_radio_input",
- name: i,
- value: s,
- "aria-labelledby": w
- },
- v = [];
- if(e._["default"] == s) x.checked = "checked";
- j(u);
- j(t);
- if(typeof u.inputStyle != "undefined") u.style = u.inputStyle;
- u.keyboardFocusable = true;
- g.push(new CKEDITOR.ui.dialog.uiElement(b, u, v, "input", null, x));
- v.push(" ");
- new CKEDITOR.ui.dialog.uiElement(b, t, v, "label", null, {
- id: w,
- "for": x.id
- }, p[0]);
- a.push(v.join(""))
- }
- new CKEDITOR.ui.dialog.hbox(b, g, a, d);
- return d.join("")
- });
- this._.children = g
- }
- },
- button: function(b, c, d) {
- if(arguments.length) {
- typeof c == "function" && (c = c(b.getParentEditor()));
- a.call(this, c, {
- disabled: c.disabled ||
- false
- });
- CKEDITOR.event.implementOn(this);
- var g = this;
- b.on("load", function() {
- var a = this.getElement();
- (function() {
- a.on("click", function(a) {
- g.click();
- a.data.preventDefault()
- });
- a.on("keydown", function(a) {
- if(a.data.getKeystroke() in {
- 32: 1
- }) {
- g.click();
- a.data.preventDefault()
- }
- })
- })();
- a.unselectable()
- }, this);
- var e = CKEDITOR.tools.extend({}, c);
- delete e.style;
- var j = CKEDITOR.tools.getNextId() + "_label";
- CKEDITOR.ui.dialog.uiElement.call(this, b, e, d, "a", null, {
- style: c.style,
- href: "javascript:void(0)",
- title: c.label,
- hidefocus: "true",
- "class": c["class"],
- role: "button",
- "aria-labelledby": j
- }, '<span id="' + j + '" class="cke_dialog_ui_button">' + CKEDITOR.tools.htmlEncode(c.label) + "</span>")
- }
- },
- select: function(b, c, d) {
- if(!(arguments.length < 3)) {
- var g = a.call(this, c);
- if(c.validate) this.validate = c.validate;
- g.inputId = CKEDITOR.tools.getNextId() + "_select";
- CKEDITOR.ui.dialog.labeledElement.call(this, b, c, d, function() {
- var a = CKEDITOR.tools.extend({}, c, {
- id: c.id ? c.id + "_select" : CKEDITOR.tools.getNextId() + "_select"
- }, true),
- d = [],
- e = [],
- i = {
- id: g.inputId,
- "class": "cke_dialog_ui_input_select",
- "aria-labelledby": this._.labelId
- };
- d.push('<div class="cke_dialog_ui_input_', c.type, '" role="presentation"');
- c.width && d.push('style="width:' + c.width + '" ');
- d.push(">");
- if(c.size !== void 0) i.size = c.size;
- if(c.multiple !== void 0) i.multiple = c.multiple;
- j(a);
- for(var l = 0, p; l < c.items.length && (p = c.items[l]); l++) e.push('<option value="', CKEDITOR.tools.htmlEncode(p[1] !== void 0 ? p[1] : p[0]).replace(/"/g, """), '" /> ', CKEDITOR.tools.htmlEncode(p[0]));
- if(typeof a.inputStyle != "undefined") a.style = a.inputStyle;
- g.select =
- new CKEDITOR.ui.dialog.uiElement(b, a, d, "select", null, i, e.join(""));
- d.push("</div>");
- return d.join("")
- })
- }
- },
- file: function(b, c, d) {
- if(!(arguments.length < 3)) {
- c["default"] === void 0 && (c["default"] = "");
- var g = CKEDITOR.tools.extend(a.call(this, c), {
- definition: c,
- buttons: []
- });
- if(c.validate) this.validate = c.validate;
- b.on("load", function() {
- CKEDITOR.document.getById(g.frameId).getParent().addClass("cke_dialog_ui_input_file")
- });
- CKEDITOR.ui.dialog.labeledElement.call(this, b, c, d, function() {
- g.frameId = CKEDITOR.tools.getNextId() +
- "_fileInput";
- var a = ['<iframe frameborder="0" allowtransparency="0" class="cke_dialog_ui_input_file" role="presentation" id="', g.frameId, '" title="', c.label, '" src="javascript:void('];
- a.push(CKEDITOR.env.ie ? "(function(){" + encodeURIComponent("document.open();(" + CKEDITOR.tools.fixDomain + ")();document.close();") + "})()" : "0");
- a.push(')"></iframe>');
- return a.join("")
- })
- }
- },
- fileButton: function(b, c, d) {
- var g = this;
- if(!(arguments.length < 3)) {
- a.call(this, c);
- if(c.validate) this.validate = c.validate;
- var e = CKEDITOR.tools.extend({},
- c),
- j = e.onClick;
- e.className = (e.className ? e.className + " " : "") + "cke_dialog_ui_button";
- e.onClick = function(a) {
- var d = c["for"];
- if(!j || j.call(this, a) !== false) {
- b.getContentElement(d[0], d[1]).submit();
- this.disable()
- }
- };
- b.on("load", function() {
- b.getContentElement(c["for"][0], c["for"][1])._.buttons.push(g)
- });
- CKEDITOR.ui.dialog.button.call(this, b, e, d)
- }
- },
- html: function() {
- var a = /^\s*<[\w:]+\s+([^>]*)?>/,
- b = /^(\s*<[\w:]+(?:\s+[^>]*)?)((?:.|\r|\n)+)$/,
- c = /\/$/;
- return function(d, g, e) {
- if(!(arguments.length < 3)) {
- var j = [],
- m = g.html;
- m.charAt(0) != "<" && (m = "<span>" + m + "</span>");
- var l = g.focus;
- if(l) {
- var p = this.focus;
- this.focus = function() {
- (typeof l == "function" ? l : p).call(this);
- this.fire("focus")
- };
- if(g.isFocusable) this.isFocusable = this.isFocusable;
- this.keyboardFocusable = true
- }
- CKEDITOR.ui.dialog.uiElement.call(this, d, g, j, "span", null, null, "");
- j = j.join("").match(a);
- m = m.match(b) || ["", "", ""];
- if(c.test(m[1])) {
- m[1] = m[1].slice(0, -1);
- m[2] = "/" + m[2]
- }
- e.push([m[1], " ", j[1] || "", m[2]].join(""))
- }
- }
- }(),
- fieldset: function(a, b, c, d, g) {
- var e = g.label;
- this._ = {
- children: b
- };
- CKEDITOR.ui.dialog.uiElement.call(this, a, g, d, "fieldset", null, null, function() {
- var a = [];
- e && a.push("<legend" + (g.labelStyle ? ' style="' + g.labelStyle + '"' : "") + ">" + e + "</legend>");
- for(var b = 0; b < c.length; b++) a.push(c[b]);
- return a.join("")
- })
- }
- }, true);
- CKEDITOR.ui.dialog.html.prototype = new CKEDITOR.ui.dialog.uiElement;
- CKEDITOR.ui.dialog.labeledElement.prototype = CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.uiElement, {
- setLabel: function(a) {
- var b = CKEDITOR.document.getById(this._.labelId);
- b.getChildCount() <
- 1 ? (new CKEDITOR.dom.text(a, CKEDITOR.document)).appendTo(b) : b.getChild(0).$.nodeValue = a;
- return this
- },
- getLabel: function() {
- var a = CKEDITOR.document.getById(this._.labelId);
- return !a || a.getChildCount() < 1 ? "" : a.getChild(0).getText()
- },
- eventProcessors: c
- }, true);
- CKEDITOR.ui.dialog.button.prototype = CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.uiElement, {
- click: function() {
- return !this._.disabled ? this.fire("click", {
- dialog: this._.dialog
- }) : false
- },
- enable: function() {
- this._.disabled = false;
- var a = this.getElement();
- a && a.removeClass("cke_disabled")
- },
- disable: function() {
- this._.disabled = true;
- this.getElement().addClass("cke_disabled")
- },
- isVisible: function() {
- return this.getElement().getFirst().isVisible()
- },
- isEnabled: function() {
- return !this._.disabled
- },
- eventProcessors: CKEDITOR.tools.extend({}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, {
- onClick: function(a, b) {
- this.on("click", function() {
- b.apply(this, arguments)
- })
- }
- }, true),
- accessKeyUp: function() {
- this.click()
- },
- accessKeyDown: function() {
- this.focus()
- },
- keyboardFocusable: true
- }, true);
- CKEDITOR.ui.dialog.textInput.prototype =
- CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.labeledElement, {
- getInputElement: function() {
- return CKEDITOR.document.getById(this._.inputId)
- },
- focus: function() {
- var a = this.selectParentTab();
- setTimeout(function() {
- var b = a.getInputElement();
- b && b.$.focus()
- }, 0)
- },
- select: function() {
- var a = this.selectParentTab();
- setTimeout(function() {
- var b = a.getInputElement();
- if(b) {
- b.$.focus();
- b.$.select()
- }
- }, 0)
- },
- accessKeyUp: function() {
- this.select()
- },
- setValue: function(a) {
- !a && (a = "");
- return CKEDITOR.ui.dialog.uiElement.prototype.setValue.apply(this,
- arguments)
- },
- keyboardFocusable: true
- }, g, true);
- CKEDITOR.ui.dialog.textarea.prototype = new CKEDITOR.ui.dialog.textInput;
- CKEDITOR.ui.dialog.select.prototype = CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.labeledElement, {
- getInputElement: function() {
- return this._.select.getElement()
- },
- add: function(a, b, c) {
- var d = new CKEDITOR.dom.element("option", this.getDialog().getParentEditor().document),
- g = this.getInputElement().$;
- d.$.text = a;
- d.$.value = b === void 0 || b === null ? a : b;
- c === void 0 || c === null ? CKEDITOR.env.ie ? g.add(d.$) : g.add(d.$,
- null) : g.add(d.$, c);
- return this
- },
- remove: function(a) {
- this.getInputElement().$.remove(a);
- return this
- },
- clear: function() {
- for(var a = this.getInputElement().$; a.length > 0;) a.remove(0);
- return this
- },
- keyboardFocusable: true
- }, g, true);
- CKEDITOR.ui.dialog.checkbox.prototype = CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.uiElement, {
- getInputElement: function() {
- return this._.checkbox.getElement()
- },
- setValue: function(a, b) {
- this.getInputElement().$.checked = a;
- !b && this.fire("change", {
- value: a
- })
- },
- getValue: function() {
- return this.getInputElement().$.checked
- },
- accessKeyUp: function() {
- this.setValue(!this.getValue())
- },
- eventProcessors: {
- onChange: function(a, b) {
- if(!CKEDITOR.env.ie || CKEDITOR.env.version > 8) return c.onChange.apply(this, arguments);
- a.on("load", function() {
- var a = this._.checkbox.getElement();
- a.on("propertychange", function(b) {
- b = b.data.$;
- b.propertyName == "checked" && this.fire("change", {
- value: a.$.checked
- })
- }, this)
- }, this);
- this.on("change", b);
- return null
- }
- },
- keyboardFocusable: true
- }, g, true);
- CKEDITOR.ui.dialog.radio.prototype = CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.uiElement, {
- setValue: function(a, b) {
- for(var c = this._.children, d, g = 0; g < c.length && (d = c[g]); g++) d.getElement().$.checked = d.getValue() == a;
- !b && this.fire("change", {
- value: a
- })
- },
- getValue: function() {
- for(var a = this._.children, b = 0; b < a.length; b++)
- if(a[b].getElement().$.checked) return a[b].getValue();
- return null
- },
- accessKeyUp: function() {
- var a = this._.children,
- b;
- for(b = 0; b < a.length; b++)
- if(a[b].getElement().$.checked) {
- a[b].getElement().focus();
- return
- }
- a[0].getElement().focus()
- },
- eventProcessors: {
- onChange: function(a, b) {
- if(CKEDITOR.env.ie) {
- a.on("load",
- function() {
- for(var a = this._.children, b = this, c = 0; c < a.length; c++) a[c].getElement().on("propertychange", function(a) {
- a = a.data.$;
- a.propertyName == "checked" && this.$.checked && b.fire("change", {
- value: this.getAttribute("value")
- })
- })
- }, this);
- this.on("change", b)
- } else return c.onChange.apply(this, arguments);
- return null
- }
- }
- }, g, true);
- CKEDITOR.ui.dialog.file.prototype = CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.labeledElement, g, {
- getInputElement: function() {
- var a = CKEDITOR.document.getById(this._.frameId).getFrameDocument();
- return a.$.forms.length > 0 ? new CKEDITOR.dom.element(a.$.forms[0].elements[0]) : this.getElement()
- },
- submit: function() {
- this.getInputElement().getParent().$.submit();
- return this
- },
- getAction: function() {
- return this.getInputElement().getParent().$.action
- },
- registerEvents: function(a) {
- var b = /^on([A-Z]\w+)/,
- c, d = function(a, b, c, d) {
- a.on("formLoaded", function() {
- a.getInputElement().on(c, d, a)
- })
- },
- g;
- for(g in a)
- if(c = g.match(b)) this.eventProcessors[g] ? this.eventProcessors[g].call(this, this._.dialog, a[g]) : d(this, this._.dialog,
- c[1].toLowerCase(), a[g]);
- return this
- },
- reset: function() {
- function a() {
- c.$.open();
- var f = "";
- d.size && (f = d.size - (CKEDITOR.env.ie ? 7 : 0));
- var t = b.frameId + "_input";
- c.$.write(['<html dir="' + m + '" lang="' + l + '"><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">', '<form enctype="multipart/form-data" method="POST" dir="' + m + '" lang="' + l + '" action="', CKEDITOR.tools.htmlEncode(d.action), '"><label id="', b.labelId, '" for="', t, '" style="display:none">', CKEDITOR.tools.htmlEncode(d.label),
- '</label><input style="width:100%" id="', t, '" aria-labelledby="', b.labelId, '" type="file" name="', CKEDITOR.tools.htmlEncode(d.id || "cke_upload"), '" size="', CKEDITOR.tools.htmlEncode(f > 0 ? f : ""), '" /></form></body></html><script>', CKEDITOR.env.ie ? "(" + CKEDITOR.tools.fixDomain + ")();" : "", "window.parent.CKEDITOR.tools.callFunction(" + e + ");", "window.onbeforeunload = function() {window.parent.CKEDITOR.tools.callFunction(" + j + ")}", "<\/script>"
- ].join(""));
- c.$.close();
- for(f = 0; f < g.length; f++) g[f].enable()
- }
- var b =
- this._,
- c = CKEDITOR.document.getById(b.frameId).getFrameDocument(),
- d = b.definition,
- g = b.buttons,
- e = this.formLoadedNumber,
- j = this.formUnloadNumber,
- m = b.dialog._.editor.lang.dir,
- l = b.dialog._.editor.langCode;
- if(!e) {
- e = this.formLoadedNumber = CKEDITOR.tools.addFunction(function() {
- this.fire("formLoaded")
- }, this);
- j = this.formUnloadNumber = CKEDITOR.tools.addFunction(function() {
- this.getInputElement().clearCustomData()
- }, this);
- this.getDialog()._.editor.on("destroy", function() {
- CKEDITOR.tools.removeFunction(e);
- CKEDITOR.tools.removeFunction(j)
- })
- }
- CKEDITOR.env.gecko ?
- setTimeout(a, 500) : a()
- },
- getValue: function() {
- return this.getInputElement().$.value || ""
- },
- setInitValue: function() {
- this._.initValue = ""
- },
- eventProcessors: {
- onChange: function(a, b) {
- if(!this._.domOnChangeRegistered) {
- this.on("formLoaded", function() {
- this.getInputElement().on("change", function() {
- this.fire("change", {
- value: this.getValue()
- })
- }, this)
- }, this);
- this._.domOnChangeRegistered = true
- }
- this.on("change", b)
- }
- },
- keyboardFocusable: true
- }, true);
- CKEDITOR.ui.dialog.fileButton.prototype = new CKEDITOR.ui.dialog.button;
- CKEDITOR.ui.dialog.fieldset.prototype =
- CKEDITOR.tools.clone(CKEDITOR.ui.dialog.hbox.prototype);
- CKEDITOR.dialog.addUIElement("text", e);
- CKEDITOR.dialog.addUIElement("password", e);
- CKEDITOR.dialog.addUIElement("textarea", b);
- CKEDITOR.dialog.addUIElement("checkbox", b);
- CKEDITOR.dialog.addUIElement("radio", b);
- CKEDITOR.dialog.addUIElement("button", b);
- CKEDITOR.dialog.addUIElement("select", b);
- CKEDITOR.dialog.addUIElement("file", b);
- CKEDITOR.dialog.addUIElement("fileButton", b);
- CKEDITOR.dialog.addUIElement("html", b);
- CKEDITOR.dialog.addUIElement("fieldset", {
- build: function(a, b, c) {
- for(var d = b.children, g, e = [], j = [], m = 0; m < d.length && (g = d[m]); m++) {
- var l = [];
- e.push(l);
- j.push(CKEDITOR.dialog._.uiElementBuilders[g.type].build(a, g, l))
- }
- return new CKEDITOR.ui.dialog[b.type](a, j, e, c, b)
- }
- })
- }
- }), CKEDITOR.DIALOG_RESIZE_NONE = 0, CKEDITOR.DIALOG_RESIZE_WIDTH = 1, CKEDITOR.DIALOG_RESIZE_HEIGHT = 2, CKEDITOR.DIALOG_RESIZE_BOTH = 3,
- function() {
- function a() {
- for(var a = this._.tabIdList.length, b = CKEDITOR.tools.indexOf(this._.tabIdList, this._.currentTabId) + a, c = b - 1; c > b - a; c--)
- if(this._.tabs[this._.tabIdList[c %
- a]][0].$.offsetHeight) return this._.tabIdList[c % a];
- return null
- }
- function e() {
- for(var a = this._.tabIdList.length, b = CKEDITOR.tools.indexOf(this._.tabIdList, this._.currentTabId), c = b + 1; c < b + a; c++)
- if(this._.tabs[this._.tabIdList[c % a]][0].$.offsetHeight) return this._.tabIdList[c % a];
- return null
- }
- function b(a, b) {
- for(var c = a.$.getElementsByTagName("input"), d = 0, f = c.length; d < f; d++) {
- var g = new CKEDITOR.dom.element(c[d]);
- if(g.getAttribute("type").toLowerCase() == "text")
- if(b) {
- g.setAttribute("value", g.getCustomData("fake_value") ||
- "");
- g.removeCustomData("fake_value")
- } else {
- g.setCustomData("fake_value", g.getAttribute("value"));
- g.setAttribute("value", "")
- }
- }
- }
- function g(a, b) {
- var c = this.getInputElement();
- c && (a ? c.removeAttribute("aria-invalid") : c.setAttribute("aria-invalid", true));
- a || (this.select ? this.select() : this.focus());
- b && alert(b);
- this.fire("validated", {
- valid: a,
- msg: b
- })
- }
- function c() {
- var a = this.getInputElement();
- a && a.removeAttribute("aria-invalid")
- }
- function d(a) {
- var a = CKEDITOR.dom.element.createFromHtml(CKEDITOR.addTemplate("dialog",
- l).output({
- id: CKEDITOR.tools.getNextNumber(),
- editorId: a.id,
- langDir: a.lang.dir,
- langCode: a.langCode,
- editorDialogClass: "cke_editor_" + a.name.replace(/\./g, "\\.") + "_dialog",
- closeTitle: a.lang.common.close,
- hidpi: CKEDITOR.env.hidpi ? "cke_hidpi" : ""
- })),
- b = a.getChild([0, 0, 0, 0, 0]),
- c = b.getChild(0),
- d = b.getChild(1);
- if(CKEDITOR.env.ie && !CKEDITOR.env.quirks) {
- var f = "javascript:void(function(){" + encodeURIComponent("document.open();(" + CKEDITOR.tools.fixDomain + ")();document.close();") + "}())";
- CKEDITOR.dom.element.createFromHtml('<iframe frameBorder="0" class="cke_iframe_shim" src="' +
- f + '" tabIndex="-1"></iframe>').appendTo(b.getParent())
- }
- c.unselectable();
- d.unselectable();
- return {
- element: a,
- parts: {
- dialog: a.getChild(0),
- title: c,
- close: d,
- tabs: b.getChild(2),
- contents: b.getChild([3, 0, 0, 0]),
- footer: b.getChild([3, 0, 1, 0])
- }
- }
- }
- function j(a, b, c) {
- this.element = b;
- this.focusIndex = c;
- this.tabIndex = 0;
- this.isFocusable = function() {
- return !b.getAttribute("disabled") && b.isVisible()
- };
- this.focus = function() {
- a._.currentFocusIndex = this.focusIndex;
- this.element.focus()
- };
- b.on("keydown", function(a) {
- a.data.getKeystroke() in {
- 32: 1,
- 13: 1
- } && this.fire("click")
- });
- b.on("focus", function() {
- this.fire("mouseover")
- });
- b.on("blur", function() {
- this.fire("mouseout")
- })
- }
- function f(a) {
- function b() {
- a.layout()
- }
- var c = CKEDITOR.document.getWindow();
- c.on("resize", b);
- a.on("hide", function() {
- c.removeListener("resize", b)
- })
- }
- function h(a, b) {
- this._ = {
- dialog: a
- };
- CKEDITOR.tools.extend(this, b)
- }
- function i(a) {
- function b(c) {
- var j = a.getSize(),
- i = CKEDITOR.document.getWindow().getViewPaneSize(),
- k = c.data.$.screenX,
- p = c.data.$.screenY,
- s = k - d.x,
- t = p - d.y;
- d = {
- x: k,
- y: p
- };
- f.x = f.x + s;
- f.y = f.y + t;
- a.move(f.x + h[3] < e ? -h[3] : f.x - h[1] > i.width - j.width - e ? i.width - j.width + (g.lang.dir == "rtl" ? 0 : h[1]) : f.x, f.y + h[0] < e ? -h[0] : f.y - h[2] > i.height - j.height - e ? i.height - j.height + h[2] : f.y, 1);
- c.data.preventDefault()
- }
- function c() {
- CKEDITOR.document.removeListener("mousemove", b);
- CKEDITOR.document.removeListener("mouseup", c);
- if(CKEDITOR.env.ie6Compat) {
- var a = r.getChild(0).getFrameDocument();
- a.removeListener("mousemove", b);
- a.removeListener("mouseup", c)
- }
- }
- var d = null,
- f = null,
- g = a.getParentEditor(),
- e = g.config.dialog_magnetDistance,
- h = CKEDITOR.skin.margins || [0, 0, 0, 0];
- typeof e == "undefined" && (e = 20);
- a.parts.title.on("mousedown", function(g) {
- d = {
- x: g.data.$.screenX,
- y: g.data.$.screenY
- };
- CKEDITOR.document.on("mousemove", b);
- CKEDITOR.document.on("mouseup", c);
- f = a.getPosition();
- if(CKEDITOR.env.ie6Compat) {
- var e = r.getChild(0).getFrameDocument();
- e.on("mousemove", b);
- e.on("mouseup", c)
- }
- g.data.preventDefault()
- }, a)
- }
- function k(a) {
- var b, c;
- function d(f) {
- var s = h.lang.dir == "rtl",
- t = p.width,
- m = p.height,
- l = t + (f.data.$.screenX - b) * (s ? -1 : 1) * (a._.moved ? 1 : 2),
- n =
- m + (f.data.$.screenY - c) * (a._.moved ? 1 : 2),
- u = a._.element.getFirst(),
- u = s && u.getComputedStyle("right"),
- q = a.getPosition();
- q.y + n > k.height && (n = k.height - q.y);
- if((s ? u : q.x) + l > k.width) l = k.width - (s ? u : q.x);
- if(e == CKEDITOR.DIALOG_RESIZE_WIDTH || e == CKEDITOR.DIALOG_RESIZE_BOTH) t = Math.max(g.minWidth || 0, l - j);
- if(e == CKEDITOR.DIALOG_RESIZE_HEIGHT || e == CKEDITOR.DIALOG_RESIZE_BOTH) m = Math.max(g.minHeight || 0, n - i);
- a.resize(t, m);
- a._.moved || a.layout();
- f.data.preventDefault()
- }
- function f() {
- CKEDITOR.document.removeListener("mouseup",
- f);
- CKEDITOR.document.removeListener("mousemove", d);
- if(s) {
- s.remove();
- s = null
- }
- if(CKEDITOR.env.ie6Compat) {
- var a = r.getChild(0).getFrameDocument();
- a.removeListener("mouseup", f);
- a.removeListener("mousemove", d)
- }
- }
- var g = a.definition,
- e = g.resizable;
- if(e != CKEDITOR.DIALOG_RESIZE_NONE) {
- var h = a.getParentEditor(),
- j, i, k, p, s, t = CKEDITOR.tools.addFunction(function(g) {
- p = a.getSize();
- var e = a.parts.contents;
- if(e.$.getElementsByTagName("iframe").length) {
- s = CKEDITOR.dom.element.createFromHtml('<div class="cke_dialog_resize_cover" style="height: 100%; position: absolute; width: 100%;"></div>');
- e.append(s)
- }
- i = p.height - a.parts.contents.getSize("height", !(CKEDITOR.env.gecko || CKEDITOR.env.ie && CKEDITOR.env.quirks));
- j = p.width - a.parts.contents.getSize("width", 1);
- b = g.screenX;
- c = g.screenY;
- k = CKEDITOR.document.getWindow().getViewPaneSize();
- CKEDITOR.document.on("mousemove", d);
- CKEDITOR.document.on("mouseup", f);
- if(CKEDITOR.env.ie6Compat) {
- e = r.getChild(0).getFrameDocument();
- e.on("mousemove", d);
- e.on("mouseup", f)
- }
- g.preventDefault && g.preventDefault()
- });
- a.on("load", function() {
- var b = "";
- e == CKEDITOR.DIALOG_RESIZE_WIDTH ?
- b = " cke_resizer_horizontal" : e == CKEDITOR.DIALOG_RESIZE_HEIGHT && (b = " cke_resizer_vertical");
- b = CKEDITOR.dom.element.createFromHtml('<div class="cke_resizer' + b + " cke_resizer_" + h.lang.dir + '" title="' + CKEDITOR.tools.htmlEncode(h.lang.common.resize) + '" onmousedown="CKEDITOR.tools.callFunction(' + t + ', event )">' + (h.lang.dir == "ltr" ? "◢" : "◣") + "</div>");
- a.parts.footer.append(b, 1)
- });
- h.on("destroy", function() {
- CKEDITOR.tools.removeFunction(t)
- })
- }
- }
- function n(a) {
- a.data.preventDefault(1)
- }
- function o(a) {
- var b = CKEDITOR.document.getWindow(),
- c = a.config,
- d = c.dialog_backgroundCoverColor || "white",
- f = c.dialog_backgroundCoverOpacity,
- g = c.baseFloatZIndex,
- c = CKEDITOR.tools.genKey(d, f, g),
- e = v[c];
- if(e) e.show();
- else {
- g = ['<div tabIndex="-1" style="position: ', CKEDITOR.env.ie6Compat ? "absolute" : "fixed", "; z-index: ", g, "; top: 0px; left: 0px; ", !CKEDITOR.env.ie6Compat ? "background-color: " + d : "", '" class="cke_dialog_background_cover">'];
- if(CKEDITOR.env.ie6Compat) {
- d = "<html><body style=\\'background-color:" + d + ";\\'></body></html>";
- g.push('<iframe hidefocus="true" frameborder="0" id="cke_dialog_background_iframe" src="javascript:');
- g.push("void((function(){" + encodeURIComponent("document.open();(" + CKEDITOR.tools.fixDomain + ")();document.write( '" + d + "' );document.close();") + "})())");
- g.push('" style="position:absolute;left:0;top:0;width:100%;height: 100%;filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0)"></iframe>')
- }
- g.push("</div>");
- e = CKEDITOR.dom.element.createFromHtml(g.join(""));
- e.setOpacity(f !== void 0 ? f : 0.5);
- e.on("keydown", n);
- e.on("keypress", n);
- e.on("keyup", n);
- e.appendTo(CKEDITOR.document.getBody());
- v[c] = e
- }
- a.focusManager.add(e);
- r = e;
- var a = function() {
- var a = b.getViewPaneSize();
- e.setStyles({
- width: a.width + "px",
- height: a.height + "px"
- })
- },
- h = function() {
- var a = b.getScrollPosition(),
- c = CKEDITOR.dialog._.currentTop;
- e.setStyles({
- left: a.x + "px",
- top: a.y + "px"
- });
- if(c) {
- do {
- a = c.getPosition();
- c.move(a.x, a.y)
- } while (c = c._.parentDialog)
- }
- };
- x = a;
- b.on("resize", a);
- a();
- (!CKEDITOR.env.mac || !CKEDITOR.env.webkit) && e.focus();
- if(CKEDITOR.env.ie6Compat) {
- var j = function() {
- h();
- arguments.callee.prevScrollHandler.apply(this, arguments)
- };
- b.$.setTimeout(function() {
- j.prevScrollHandler =
- window.onscroll || function() {};
- window.onscroll = j
- }, 0);
- h()
- }
- }
- function q(a) {
- if(r) {
- a.focusManager.remove(r);
- a = CKEDITOR.document.getWindow();
- r.hide();
- a.removeListener("resize", x);
- CKEDITOR.env.ie6Compat && a.$.setTimeout(function() {
- window.onscroll = window.onscroll && window.onscroll.prevScrollHandler || null
- }, 0);
- x = null
- }
- }
- var m = CKEDITOR.tools.cssLength,
- l = '<div class="cke_reset_all {editorId} {editorDialogClass} {hidpi}" dir="{langDir}" lang="{langCode}" role="dialog" aria-labelledby="cke_dialog_title_{id}"><table class="cke_dialog ' +
- CKEDITOR.env.cssClass + ' cke_{langDir}" style="position:absolute" role="presentation"><tr><td role="presentation"><div class="cke_dialog_body" role="presentation"><div id="cke_dialog_title_{id}" class="cke_dialog_title" role="presentation"></div><a id="cke_dialog_close_button_{id}" class="cke_dialog_close_button" href="javascript:void(0)" title="{closeTitle}" role="button"><span class="cke_label">X</span></a><div id="cke_dialog_tabs_{id}" class="cke_dialog_tabs" role="tablist"></div><table class="cke_dialog_contents" role="presentation"><tr><td id="cke_dialog_contents_{id}" class="cke_dialog_contents_body" role="presentation"></td></tr><tr><td id="cke_dialog_footer_{id}" class="cke_dialog_footer" role="presentation"></td></tr></table></div></td></tr></table></div>';
- CKEDITOR.dialog = function(b, f) {
- function h() {
- var a = v._.focusList;
- a.sort(function(a, b) {
- return a.tabIndex != b.tabIndex ? b.tabIndex - a.tabIndex : a.focusIndex - b.focusIndex
- });
- for(var b = a.length, c = 0; c < b; c++) a[c].focusIndex = c
- }
- function j(a) {
- var b = v._.focusList,
- a = a || 0;
- if(!(b.length < 1)) {
- var c = v._.currentFocusIndex;
- try {
- b[c].getInputElement().$.blur()
- } catch(d) {}
- for(var f = c = (c + a + b.length) % b.length; a && !b[f].isFocusable();) {
- f = (f + a + b.length) % b.length;
- if(f == c) break
- }
- b[f].focus();
- b[f].type == "text" && b[f].select()
- }
- }
- function s(c) {
- if(v ==
- CKEDITOR.dialog._.currentTop) {
- var d = c.data.getKeystroke(),
- f = b.lang.dir == "rtl";
- o = x = 0;
- if(d == 9 || d == CKEDITOR.SHIFT + 9) {
- d = d == CKEDITOR.SHIFT + 9;
- if(v._.tabBarMode) {
- d = d ? a.call(v) : e.call(v);
- v.selectPage(d);
- v._.tabs[d][0].focus()
- } else j(d ? -1 : 1);
- o = 1
- } else if(d == CKEDITOR.ALT + 121 && !v._.tabBarMode && v.getPageCount() > 1) {
- v._.tabBarMode = true;
- v._.tabs[v._.currentTabId][0].focus();
- o = 1
- } else if((d == 37 || d == 39) && v._.tabBarMode) {
- d = d == (f ? 39 : 37) ? a.call(v) : e.call(v);
- v.selectPage(d);
- v._.tabs[d][0].focus();
- o = 1
- } else if((d == 13 || d ==
- 32) && v._.tabBarMode) {
- this.selectPage(this._.currentTabId);
- this._.tabBarMode = false;
- this._.currentFocusIndex = -1;
- j(1);
- o = 1
- } else if(d == 13) {
- d = c.data.getTarget();
- if(!d.is("a", "button", "select", "textarea") && (!d.is("input") || d.$.type != "button")) {
- (d = this.getButton("ok")) && CKEDITOR.tools.setTimeout(d.click, 0, d);
- o = 1
- }
- x = 1
- } else if(d == 27) {
- (d = this.getButton("cancel")) ? CKEDITOR.tools.setTimeout(d.click, 0, d): this.fire("cancel", {
- hide: true
- }).hide !== false && this.hide();
- x = 1
- } else return;
- t(c)
- }
- }
- function t(a) {
- o ? a.data.preventDefault(1) :
- x && a.data.stopPropagation()
- }
- var m = CKEDITOR.dialog._.dialogDefinitions[f],
- l = CKEDITOR.tools.clone(p),
- n = b.config.dialog_buttonsOrder || "OS",
- u = b.lang.dir,
- q = {},
- o, x;
- (n == "OS" && CKEDITOR.env.mac || n == "rtl" && u == "ltr" || n == "ltr" && u == "rtl") && l.buttons.reverse();
- m = CKEDITOR.tools.extend(m(b), l);
- m = CKEDITOR.tools.clone(m);
- m = new w(this, m);
- l = d(b);
- this._ = {
- editor: b,
- element: l.element,
- name: f,
- contentSize: {
- width: 0,
- height: 0
- },
- size: {
- width: 0,
- height: 0
- },
- contents: {},
- buttons: {},
- accessKeyMap: {},
- tabs: {},
- tabIdList: [],
- currentTabId: null,
- currentTabIndex: null,
- pageCount: 0,
- lastTab: null,
- tabBarMode: false,
- focusList: [],
- currentFocusIndex: 0,
- hasFocus: false
- };
- this.parts = l.parts;
- CKEDITOR.tools.setTimeout(function() {
- b.fire("ariaWidget", this.parts.contents)
- }, 0, this);
- l = {
- position: CKEDITOR.env.ie6Compat ? "absolute" : "fixed",
- top: 0,
- visibility: "hidden"
- };
- l[u == "rtl" ? "right" : "left"] = 0;
- this.parts.dialog.setStyles(l);
- CKEDITOR.event.call(this);
- this.definition = m = CKEDITOR.fire("dialogDefinition", {
- name: f,
- definition: m
- }, b).definition;
- if(!("removeDialogTabs" in b._) &&
- b.config.removeDialogTabs) {
- l = b.config.removeDialogTabs.split(";");
- for(u = 0; u < l.length; u++) {
- n = l[u].split(":");
- if(n.length == 2) {
- var r = n[0];
- q[r] || (q[r] = []);
- q[r].push(n[1])
- }
- }
- b._.removeDialogTabs = q
- }
- if(b._.removeDialogTabs && (q = b._.removeDialogTabs[f]))
- for(u = 0; u < q.length; u++) m.removeContents(q[u]);
- if(m.onLoad) this.on("load", m.onLoad);
- if(m.onShow) this.on("show", m.onShow);
- if(m.onHide) this.on("hide", m.onHide);
- if(m.onOk) this.on("ok", function(a) {
- b.fire("saveSnapshot");
- setTimeout(function() {
- b.fire("saveSnapshot")
- },
- 0);
- if(m.onOk.call(this, a) === false) a.data.hide = false
- });
- if(m.onCancel) this.on("cancel", function(a) {
- if(m.onCancel.call(this, a) === false) a.data.hide = false
- });
- var v = this,
- z = function(a) {
- var b = v._.contents,
- c = false,
- d;
- for(d in b)
- for(var f in b[d])
- if(c = a.call(this, b[d][f])) return
- };
- this.on("ok", function(a) {
- z(function(b) {
- if(b.validate) {
- var c = b.validate(this),
- d = typeof c == "string" || c === false;
- if(d) {
- a.data.hide = false;
- a.stop()
- }
- g.call(b, !d, typeof c == "string" ? c : void 0);
- return d
- }
- })
- }, this, null, 0);
- this.on("cancel", function(a) {
- z(function(c) {
- if(c.isChanged()) {
- if(!b.config.dialog_noConfirmCancel &&
- !confirm(b.lang.common.confirmCancel)) a.data.hide = false;
- return true
- }
- })
- }, this, null, 0);
- this.parts.close.on("click", function(a) {
- this.fire("cancel", {
- hide: true
- }).hide !== false && this.hide();
- a.data.preventDefault()
- }, this);
- this.changeFocus = j;
- var y = this._.element;
- b.focusManager.add(y, 1);
- this.on("show", function() {
- y.on("keydown", s, this);
- if(CKEDITOR.env.gecko) y.on("keypress", t, this)
- });
- this.on("hide", function() {
- y.removeListener("keydown", s);
- CKEDITOR.env.gecko && y.removeListener("keypress", t);
- z(function(a) {
- c.apply(a)
- })
- });
- this.on("iframeAdded", function(a) {
- (new CKEDITOR.dom.document(a.data.iframe.$.contentWindow.document)).on("keydown", s, this, null, 0)
- });
- this.on("show", function() {
- h();
- if(b.config.dialog_startupFocusTab && v._.pageCount > 1) {
- v._.tabBarMode = true;
- v._.tabs[v._.currentTabId][0].focus()
- } else if(!this._.hasFocus) {
- this._.currentFocusIndex = -1;
- if(m.onFocus) {
- var a = m.onFocus.call(this);
- a && a.focus()
- } else j(1)
- }
- }, this, null, 4294967295);
- if(CKEDITOR.env.ie6Compat) this.on("load", function() {
- var a = this.getElement(),
- b = a.getFirst();
- b.remove();
- b.appendTo(a)
- }, this);
- i(this);
- k(this);
- (new CKEDITOR.dom.text(m.title, CKEDITOR.document)).appendTo(this.parts.title);
- for(u = 0; u < m.contents.length; u++)(q = m.contents[u]) && this.addPage(q);
- this.parts.tabs.on("click", function(a) {
- var b = a.data.getTarget();
- if(b.hasClass("cke_dialog_tab")) {
- b = b.$.id;
- this.selectPage(b.substring(4, b.lastIndexOf("_")));
- if(this._.tabBarMode) {
- this._.tabBarMode = false;
- this._.currentFocusIndex = -1;
- j(1)
- }
- a.data.preventDefault()
- }
- }, this);
- u = [];
- q = CKEDITOR.dialog._.uiElementBuilders.hbox.build(this, {
- type: "hbox",
- className: "cke_dialog_footer_buttons",
- widths: [],
- children: m.buttons
- }, u).getChild();
- this.parts.footer.setHtml(u.join(""));
- for(u = 0; u < q.length; u++) this._.buttons[q[u].id] = q[u]
- };
- CKEDITOR.dialog.prototype = {
- destroy: function() {
- this.hide();
- this._.element.remove()
- },
- resize: function() {
- return function(a, b) {
- if(!this._.contentSize || !(this._.contentSize.width == a && this._.contentSize.height == b)) {
- CKEDITOR.dialog.fire("resize", {
- dialog: this,
- width: a,
- height: b
- }, this._.editor);
- this.fire("resize", {
- width: a,
- height: b
- },
- this._.editor);
- this.parts.contents.setStyles({
- width: a + "px",
- height: b + "px"
- });
- if(this._.editor.lang.dir == "rtl" && this._.position) this._.position.x = CKEDITOR.document.getWindow().getViewPaneSize().width - this._.contentSize.width - parseInt(this._.element.getFirst().getStyle("right"), 10);
- this._.contentSize = {
- width: a,
- height: b
- }
- }
- }
- }(),
- getSize: function() {
- var a = this._.element.getFirst();
- return {
- width: a.$.offsetWidth || 0,
- height: a.$.offsetHeight || 0
- }
- },
- move: function(a, b, c) {
- var d = this._.element.getFirst(),
- f = this._.editor.lang.dir ==
- "rtl",
- g = d.getComputedStyle("position") == "fixed";
- CKEDITOR.env.ie && d.setStyle("zoom", "100%");
- if(!g || !this._.position || !(this._.position.x == a && this._.position.y == b)) {
- this._.position = {
- x: a,
- y: b
- };
- if(!g) {
- g = CKEDITOR.document.getWindow().getScrollPosition();
- a = a + g.x;
- b = b + g.y
- }
- if(f) {
- g = this.getSize();
- a = CKEDITOR.document.getWindow().getViewPaneSize().width - g.width - a
- }
- b = {
- top: (b > 0 ? b : 0) + "px"
- };
- b[f ? "right" : "left"] = (a > 0 ? a : 0) + "px";
- d.setStyles(b);
- c && (this._.moved = 1)
- }
- },
- getPosition: function() {
- return CKEDITOR.tools.extend({},
- this._.position)
- },
- show: function() {
- var a = this._.element,
- b = this.definition;
- !a.getParent() || !a.getParent().equals(CKEDITOR.document.getBody()) ? a.appendTo(CKEDITOR.document.getBody()) : a.setStyle("display", "block");
- this.resize(this._.contentSize && this._.contentSize.width || b.width || b.minWidth, this._.contentSize && this._.contentSize.height || b.height || b.minHeight);
- this.reset();
- this.selectPage(this.definition.contents[0].id);
- if(CKEDITOR.dialog._.currentZIndex === null) CKEDITOR.dialog._.currentZIndex = this._.editor.config.baseFloatZIndex;
- this._.element.getFirst().setStyle("z-index", CKEDITOR.dialog._.currentZIndex = CKEDITOR.dialog._.currentZIndex + 10);
- if(CKEDITOR.dialog._.currentTop === null) {
- CKEDITOR.dialog._.currentTop = this;
- this._.parentDialog = null;
- o(this._.editor)
- } else {
- this._.parentDialog = CKEDITOR.dialog._.currentTop;
- this._.parentDialog.getElement().getFirst().$.style.zIndex -= Math.floor(this._.editor.config.baseFloatZIndex / 2);
- CKEDITOR.dialog._.currentTop = this
- }
- a.on("keydown", z);
- a.on("keyup", B);
- this._.hasFocus = false;
- for(var c in b.contents)
- if(b.contents[c]) {
- var a =
- b.contents[c],
- d = this._.tabs[a.id],
- g = a.requiredContent,
- e = 0;
- if(d) {
- for(var h in this._.contents[a.id]) {
- var j = this._.contents[a.id][h];
- if(!(j.type == "hbox" || j.type == "vbox" || !j.getInputElement()))
- if(j.requiredContent && !this._.editor.activeFilter.check(j.requiredContent)) j.disable();
- else {
- j.enable();
- e++
- }
- }!e || g && !this._.editor.activeFilter.check(g) ? d[0].addClass("cke_dialog_tab_disabled") : d[0].removeClass("cke_dialog_tab_disabled")
- }
- }
- CKEDITOR.tools.setTimeout(function() {
- this.layout();
- f(this);
- this.parts.dialog.setStyle("visibility",
- "");
- this.fireOnce("load", {});
- CKEDITOR.ui.fire("ready", this);
- this.fire("show", {});
- this._.editor.fire("dialogShow", this);
- this._.parentDialog || this._.editor.focusManager.lock();
- this.foreach(function(a) {
- a.setInitValue && a.setInitValue()
- })
- }, 100, this)
- },
- layout: function() {
- var a = this.parts.dialog,
- b = this.getSize(),
- c = CKEDITOR.document.getWindow().getViewPaneSize(),
- d = (c.width - b.width) / 2,
- f = (c.height - b.height) / 2;
- CKEDITOR.env.ie6Compat || (b.height + (f > 0 ? f : 0) > c.height || b.width + (d > 0 ? d : 0) > c.width ? a.setStyle("position",
- "absolute") : a.setStyle("position", "fixed"));
- this.move(this._.moved ? this._.position.x : d, this._.moved ? this._.position.y : f)
- },
- foreach: function(a) {
- for(var b in this._.contents)
- for(var c in this._.contents[b]) a.call(this, this._.contents[b][c]);
- return this
- },
- reset: function() {
- var a = function(a) {
- a.reset && a.reset(1)
- };
- return function() {
- this.foreach(a);
- return this
- }
- }(),
- setupContent: function() {
- var a = arguments;
- this.foreach(function(b) {
- b.setup && b.setup.apply(b, a)
- })
- },
- commitContent: function() {
- var a = arguments;
- this.foreach(function(b) {
- CKEDITOR.env.ie &&
- this._.currentFocusIndex == b.focusIndex && b.getInputElement().$.blur();
- b.commit && b.commit.apply(b, a)
- })
- },
- hide: function() {
- if(this.parts.dialog.isVisible()) {
- this.fire("hide", {});
- this._.editor.fire("dialogHide", this);
- this.selectPage(this._.tabIdList[0]);
- var a = this._.element;
- a.setStyle("display", "none");
- this.parts.dialog.setStyle("visibility", "hidden");
- for(G(this); CKEDITOR.dialog._.currentTop != this;) CKEDITOR.dialog._.currentTop.hide();
- if(this._.parentDialog) {
- var b = this._.parentDialog.getElement().getFirst();
- b.setStyle("z-index", parseInt(b.$.style.zIndex, 10) + Math.floor(this._.editor.config.baseFloatZIndex / 2))
- } else q(this._.editor);
- if(CKEDITOR.dialog._.currentTop = this._.parentDialog) CKEDITOR.dialog._.currentZIndex = CKEDITOR.dialog._.currentZIndex - 10;
- else {
- CKEDITOR.dialog._.currentZIndex = null;
- a.removeListener("keydown", z);
- a.removeListener("keyup", B);
- var c = this._.editor;
- c.focus();
- setTimeout(function() {
- c.focusManager.unlock();
- CKEDITOR.env.iOS && c.window.focus()
- }, 0)
- }
- delete this._.parentDialog;
- this.foreach(function(a) {
- a.resetInitValue &&
- a.resetInitValue()
- })
- }
- },
- addPage: function(a) {
- if(!a.requiredContent || this._.editor.filter.check(a.requiredContent)) {
- for(var b = [], c = a.label ? ' title="' + CKEDITOR.tools.htmlEncode(a.label) + '"' : "", d = CKEDITOR.dialog._.uiElementBuilders.vbox.build(this, {
- type: "vbox",
- className: "cke_dialog_page_contents",
- children: a.elements,
- expand: !!a.expand,
- padding: a.padding,
- style: a.style || "width: 100%;"
- }, b), f = this._.contents[a.id] = {}, g = d.getChild(), e = 0; d = g.shift();) {
- !d.notAllowed && (d.type != "hbox" && d.type != "vbox") && e++;
- f[d.id] =
- d;
- typeof d.getChild == "function" && g.push.apply(g, d.getChild())
- }
- if(!e) a.hidden = true;
- b = CKEDITOR.dom.element.createFromHtml(b.join(""));
- b.setAttribute("role", "tabpanel");
- d = CKEDITOR.env;
- f = "cke_" + a.id + "_" + CKEDITOR.tools.getNextNumber();
- c = CKEDITOR.dom.element.createFromHtml(['<a class="cke_dialog_tab"', this._.pageCount > 0 ? " cke_last" : "cke_first", c, a.hidden ? ' style="display:none"' : "", ' id="', f, '"', d.gecko && !d.hc ? "" : ' href="javascript:void(0)"', ' tabIndex="-1" hidefocus="true" role="tab">', a.label, "</a>"].join(""));
- b.setAttribute("aria-labelledby", f);
- this._.tabs[a.id] = [c, b];
- this._.tabIdList.push(a.id);
- !a.hidden && this._.pageCount++;
- this._.lastTab = c;
- this.updateStyle();
- b.setAttribute("name", a.id);
- b.appendTo(this.parts.contents);
- c.unselectable();
- this.parts.tabs.append(c);
- if(a.accessKey) {
- A(this, this, "CTRL+" + a.accessKey, J, D);
- this._.accessKeyMap["CTRL+" + a.accessKey] = a.id
- }
- }
- },
- selectPage: function(a) {
- if(this._.currentTabId != a && !this._.tabs[a][0].hasClass("cke_dialog_tab_disabled") && this.fire("selectPage", {
- page: a,
- currentPage: this._.currentTabId
- }) !==
- false) {
- for(var c in this._.tabs) {
- var d = this._.tabs[c][0],
- f = this._.tabs[c][1];
- if(c != a) {
- d.removeClass("cke_dialog_tab_selected");
- f.hide()
- }
- f.setAttribute("aria-hidden", c != a)
- }
- var g = this._.tabs[a];
- g[0].addClass("cke_dialog_tab_selected");
- if(CKEDITOR.env.ie6Compat || CKEDITOR.env.ie7Compat) {
- b(g[1]);
- g[1].show();
- setTimeout(function() {
- b(g[1], 1)
- }, 0)
- } else g[1].show();
- this._.currentTabId = a;
- this._.currentTabIndex = CKEDITOR.tools.indexOf(this._.tabIdList, a)
- }
- },
- updateStyle: function() {
- this.parts.dialog[(this._.pageCount ===
- 1 ? "add" : "remove") + "Class"]("cke_single_page")
- },
- hidePage: function(b) {
- var c = this._.tabs[b] && this._.tabs[b][0];
- if(c && this._.pageCount != 1 && c.isVisible()) {
- b == this._.currentTabId && this.selectPage(a.call(this));
- c.hide();
- this._.pageCount--;
- this.updateStyle()
- }
- },
- showPage: function(a) {
- if(a = this._.tabs[a] && this._.tabs[a][0]) {
- a.show();
- this._.pageCount++;
- this.updateStyle()
- }
- },
- getElement: function() {
- return this._.element
- },
- getName: function() {
- return this._.name
- },
- getContentElement: function(a, b) {
- var c = this._.contents[a];
- return c && c[b]
- },
- getValueOf: function(a, b) {
- return this.getContentElement(a, b).getValue()
- },
- setValueOf: function(a, b, c) {
- return this.getContentElement(a, b).setValue(c)
- },
- getButton: function(a) {
- return this._.buttons[a]
- },
- click: function(a) {
- return this._.buttons[a].click()
- },
- disableButton: function(a) {
- return this._.buttons[a].disable()
- },
- enableButton: function(a) {
- return this._.buttons[a].enable()
- },
- getPageCount: function() {
- return this._.pageCount
- },
- getParentEditor: function() {
- return this._.editor
- },
- getSelectedElement: function() {
- return this.getParentEditor().getSelection().getSelectedElement()
- },
- addFocusable: function(a, b) {
- if(typeof b == "undefined") {
- b = this._.focusList.length;
- this._.focusList.push(new j(this, a, b))
- } else {
- this._.focusList.splice(b, 0, new j(this, a, b));
- for(var c = b + 1; c < this._.focusList.length; c++) this._.focusList[c].focusIndex++
- }
- }
- };
- CKEDITOR.tools.extend(CKEDITOR.dialog, {
- add: function(a, b) {
- if(!this._.dialogDefinitions[a] || typeof b == "function") this._.dialogDefinitions[a] = b
- },
- exists: function(a) {
- return !!this._.dialogDefinitions[a]
- },
- getCurrent: function() {
- return CKEDITOR.dialog._.currentTop
- },
- isTabEnabled: function(a, b, c) {
- a = a.config.removeDialogTabs;
- return !(a && a.match(RegExp("(?:^|;)" + b + ":" + c + "(?:$|;)", "i")))
- },
- okButton: function() {
- var a = function(a, b) {
- b = b || {};
- return CKEDITOR.tools.extend({
- id: "ok",
- type: "button",
- label: a.lang.common.ok,
- "class": "cke_dialog_ui_button_ok",
- onClick: function(a) {
- a = a.data.dialog;
- a.fire("ok", {
- hide: true
- }).hide !== false && a.hide()
- }
- }, b, true)
- };
- a.type = "button";
- a.override = function(b) {
- return CKEDITOR.tools.extend(function(c) {
- return a(c, b)
- }, {
- type: "button"
- }, true)
- };
- return a
- }(),
- cancelButton: function() {
- var a = function(a, b) {
- b = b || {};
- return CKEDITOR.tools.extend({
- id: "cancel",
- type: "button",
- label: a.lang.common.cancel,
- "class": "cke_dialog_ui_button_cancel",
- onClick: function(a) {
- a = a.data.dialog;
- a.fire("cancel", {
- hide: true
- }).hide !== false && a.hide()
- }
- }, b, true)
- };
- a.type = "button";
- a.override = function(b) {
- return CKEDITOR.tools.extend(function(c) {
- return a(c, b)
- }, {
- type: "button"
- }, true)
- };
- return a
- }(),
- addUIElement: function(a, b) {
- this._.uiElementBuilders[a] = b
- }
- });
- CKEDITOR.dialog._ = {
- uiElementBuilders: {},
- dialogDefinitions: {},
- currentTop: null,
- currentZIndex: null
- };
- CKEDITOR.event.implementOn(CKEDITOR.dialog);
- CKEDITOR.event.implementOn(CKEDITOR.dialog.prototype);
- var p = {
- resizable: CKEDITOR.DIALOG_RESIZE_BOTH,
- minWidth: 600,
- minHeight: 400,
- buttons: [CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton]
- },
- t = function(a, b, c) {
- for(var d = 0, f; f = a[d]; d++) {
- if(f.id == b) return f;
- if(c && f[c])
- if(f = t(f[c], b, c)) return f
- }
- return null
- },
- s = function(a, b, c, d, f) {
- if(c) {
- for(var g = 0, e; e = a[g]; g++) {
- if(e.id == c) {
- a.splice(g, 0, b);
- return b
- }
- if(d &&
- e[d])
- if(e = s(e[d], b, c, d, true)) return e
- }
- if(f) return null
- }
- a.push(b);
- return b
- },
- u = function(a, b, c) {
- for(var d = 0, f; f = a[d]; d++) {
- if(f.id == b) return a.splice(d, 1);
- if(c && f[c])
- if(f = u(f[c], b, c)) return f
- }
- return null
- },
- w = function(a, b) {
- this.dialog = a;
- for(var c = b.contents, d = 0, f; f = c[d]; d++) c[d] = f && new h(a, f);
- CKEDITOR.tools.extend(this, b)
- };
- w.prototype = {
- getContents: function(a) {
- return t(this.contents, a)
- },
- getButton: function(a) {
- return t(this.buttons, a)
- },
- addContents: function(a, b) {
- return s(this.contents, a, b)
- },
- addButton: function(a,
- b) {
- return s(this.buttons, a, b)
- },
- removeContents: function(a) {
- u(this.contents, a)
- },
- removeButton: function(a) {
- u(this.buttons, a)
- }
- };
- h.prototype = {
- get: function(a) {
- return t(this.elements, a, "children")
- },
- add: function(a, b) {
- return s(this.elements, a, b, "children")
- },
- remove: function(a) {
- u(this.elements, a, "children")
- }
- };
- var x, v = {},
- r, y = {},
- z = function(a) {
- var b = a.data.$.ctrlKey || a.data.$.metaKey,
- c = a.data.$.altKey,
- d = a.data.$.shiftKey,
- f = String.fromCharCode(a.data.$.keyCode);
- if((b = y[(b ? "CTRL+" : "") + (c ? "ALT+" : "") + (d ? "SHIFT+" : "") +
- f]) && b.length) {
- b = b[b.length - 1];
- b.keydown && b.keydown.call(b.uiElement, b.dialog, b.key);
- a.data.preventDefault()
- }
- },
- B = function(a) {
- var b = a.data.$.ctrlKey || a.data.$.metaKey,
- c = a.data.$.altKey,
- d = a.data.$.shiftKey,
- f = String.fromCharCode(a.data.$.keyCode);
- if((b = y[(b ? "CTRL+" : "") + (c ? "ALT+" : "") + (d ? "SHIFT+" : "") + f]) && b.length) {
- b = b[b.length - 1];
- if(b.keyup) {
- b.keyup.call(b.uiElement, b.dialog, b.key);
- a.data.preventDefault()
- }
- }
- },
- A = function(a, b, c, d, f) {
- (y[c] || (y[c] = [])).push({
- uiElement: a,
- dialog: b,
- key: c,
- keyup: f || a.accessKeyUp,
- keydown: d || a.accessKeyDown
- })
- },
- G = function(a) {
- for(var b in y) {
- for(var c = y[b], d = c.length - 1; d >= 0; d--)(c[d].dialog == a || c[d].uiElement == a) && c.splice(d, 1);
- c.length === 0 && delete y[b]
- }
- },
- D = function(a, b) {
- a._.accessKeyMap[b] && a.selectPage(a._.accessKeyMap[b])
- },
- J = function() {};
- (function() {
- CKEDITOR.ui.dialog = {
- uiElement: function(a, b, c, d, f, g, e) {
- if(!(arguments.length < 4)) {
- var h = (d.call ? d(b) : d) || "div",
- j = ["<", h, " "],
- i = (f && f.call ? f(b) : f) || {},
- k = (g && g.call ? g(b) : g) || {},
- p = (e && e.call ? e.call(this, a, b) : e) || "",
- s = this.domId = k.id ||
- CKEDITOR.tools.getNextId() + "_uiElement";
- if(b.requiredContent && !a.getParentEditor().filter.check(b.requiredContent)) {
- i.display = "none";
- this.notAllowed = true
- }
- k.id = s;
- var m = {};
- b.type && (m["cke_dialog_ui_" + b.type] = 1);
- b.className && (m[b.className] = 1);
- if(b.disabled) m.cke_disabled = 1;
- for(var t = k["class"] && k["class"].split ? k["class"].split(" ") : [], s = 0; s < t.length; s++) t[s] && (m[t[s]] = 1);
- t = [];
- for(s in m) t.push(s);
- k["class"] = t.join(" ");
- if(b.title) k.title = b.title;
- m = (b.style || "").split(";");
- if(b.align) {
- t = b.align;
- i["margin-left"] =
- t == "left" ? 0 : "auto";
- i["margin-right"] = t == "right" ? 0 : "auto"
- }
- for(s in i) m.push(s + ":" + i[s]);
- b.hidden && m.push("display:none");
- for(s = m.length - 1; s >= 0; s--) m[s] === "" && m.splice(s, 1);
- if(m.length > 0) k.style = (k.style ? k.style + "; " : "") + m.join("; ");
- for(s in k) j.push(s + '="' + CKEDITOR.tools.htmlEncode(k[s]) + '" ');
- j.push(">", p, "</", h, ">");
- c.push(j.join(""));
- (this._ || (this._ = {})).dialog = a;
- if(typeof b.isChanged == "boolean") this.isChanged = function() {
- return b.isChanged
- };
- if(typeof b.isChanged == "function") this.isChanged = b.isChanged;
- if(typeof b.setValue == "function") this.setValue = CKEDITOR.tools.override(this.setValue, function(a) {
- return function(c) {
- a.call(this, b.setValue.call(this, c))
- }
- });
- if(typeof b.getValue == "function") this.getValue = CKEDITOR.tools.override(this.getValue, function(a) {
- return function() {
- return b.getValue.call(this, a.call(this))
- }
- });
- CKEDITOR.event.implementOn(this);
- this.registerEvents(b);
- this.accessKeyUp && (this.accessKeyDown && b.accessKey) && A(this, a, "CTRL+" + b.accessKey);
- var l = this;
- a.on("load", function() {
- var b = l.getInputElement();
- if(b) {
- var c = l.type in {
- checkbox: 1,
- ratio: 1
- } && CKEDITOR.env.ie && CKEDITOR.env.version < 8 ? "cke_dialog_ui_focused" : "";
- b.on("focus", function() {
- a._.tabBarMode = false;
- a._.hasFocus = true;
- l.fire("focus");
- c && this.addClass(c)
- });
- b.on("blur", function() {
- l.fire("blur");
- c && this.removeClass(c)
- })
- }
- });
- CKEDITOR.tools.extend(this, b);
- if(this.keyboardFocusable) {
- this.tabIndex = b.tabIndex || 0;
- this.focusIndex = a._.focusList.push(this) - 1;
- this.on("focus", function() {
- a._.currentFocusIndex = l.focusIndex
- })
- }
- }
- },
- hbox: function(a, b, c, d, f) {
- if(!(arguments.length <
- 4)) {
- this._ || (this._ = {});
- var g = this._.children = b,
- e = f && f.widths || null,
- h = f && f.height || null,
- j, i = {
- role: "presentation"
- };
- f && f.align && (i.align = f.align);
- CKEDITOR.ui.dialog.uiElement.call(this, a, f || {
- type: "hbox"
- }, d, "table", {}, i, function() {
- var a = ['<tbody><tr class="cke_dialog_ui_hbox">'];
- for(j = 0; j < c.length; j++) {
- var b = "cke_dialog_ui_hbox_child",
- d = [];
- j === 0 && (b = "cke_dialog_ui_hbox_first");
- j == c.length - 1 && (b = "cke_dialog_ui_hbox_last");
- a.push('<td class="', b, '" role="presentation" ');
- e ? e[j] && d.push("width:" + m(e[j])) :
- d.push("width:" + Math.floor(100 / c.length) + "%");
- h && d.push("height:" + m(h));
- f && f.padding !== void 0 && d.push("padding:" + m(f.padding));
- CKEDITOR.env.ie && (CKEDITOR.env.quirks && g[j].align) && d.push("text-align:" + g[j].align);
- d.length > 0 && a.push('style="' + d.join("; ") + '" ');
- a.push(">", c[j], "</td>")
- }
- a.push("</tr></tbody>");
- return a.join("")
- })
- }
- },
- vbox: function(a, b, c, d, f) {
- if(!(arguments.length < 3)) {
- this._ || (this._ = {});
- var g = this._.children = b,
- e = f && f.width || null,
- h = f && f.heights || null;
- CKEDITOR.ui.dialog.uiElement.call(this,
- a, f || {
- type: "vbox"
- }, d, "div", null, {
- role: "presentation"
- },
- function() {
- var b = ['<table role="presentation" cellspacing="0" border="0" '];
- b.push('style="');
- f && f.expand && b.push("height:100%;");
- b.push("width:" + m(e || "100%"), ";");
- CKEDITOR.env.webkit && b.push("float:none;");
- b.push('"');
- b.push('align="', CKEDITOR.tools.htmlEncode(f && f.align || (a.getParentEditor().lang.dir == "ltr" ? "left" : "right")), '" ');
- b.push("><tbody>");
- for(var d = 0; d < c.length; d++) {
- var j = [];
- b.push('<tr><td role="presentation" ');
- e && j.push("width:" +
- m(e || "100%"));
- h ? j.push("height:" + m(h[d])) : f && f.expand && j.push("height:" + Math.floor(100 / c.length) + "%");
- f && f.padding !== void 0 && j.push("padding:" + m(f.padding));
- CKEDITOR.env.ie && (CKEDITOR.env.quirks && g[d].align) && j.push("text-align:" + g[d].align);
- j.length > 0 && b.push('style="', j.join("; "), '" ');
- b.push(' class="cke_dialog_ui_vbox_child">', c[d], "</td></tr>")
- }
- b.push("</tbody></table>");
- return b.join("")
- })
- }
- }
- }
- })();
- CKEDITOR.ui.dialog.uiElement.prototype = {
- getElement: function() {
- return CKEDITOR.document.getById(this.domId)
- },
- getInputElement: function() {
- return this.getElement()
- },
- getDialog: function() {
- return this._.dialog
- },
- setValue: function(a, b) {
- this.getInputElement().setValue(a);
- !b && this.fire("change", {
- value: a
- });
- return this
- },
- getValue: function() {
- return this.getInputElement().getValue()
- },
- isChanged: function() {
- return false
- },
- selectParentTab: function() {
- for(var a = this.getInputElement();
- (a = a.getParent()) && a.$.className.search("cke_dialog_page_contents") == -1;);
- if(!a) return this;
- a = a.getAttribute("name");
- this._.dialog._.currentTabId !=
- a && this._.dialog.selectPage(a);
- return this
- },
- focus: function() {
- this.selectParentTab().getInputElement().focus();
- return this
- },
- registerEvents: function(a) {
- var b = /^on([A-Z]\w+)/,
- c, d = function(a, b, c, d) {
- b.on("load", function() {
- a.getInputElement().on(c, d, a)
- })
- },
- f;
- for(f in a)
- if(c = f.match(b)) this.eventProcessors[f] ? this.eventProcessors[f].call(this, this._.dialog, a[f]) : d(this, this._.dialog, c[1].toLowerCase(), a[f]);
- return this
- },
- eventProcessors: {
- onLoad: function(a, b) {
- a.on("load", b, this)
- },
- onShow: function(a, b) {
- a.on("show",
- b, this)
- },
- onHide: function(a, b) {
- a.on("hide", b, this)
- }
- },
- accessKeyDown: function() {
- this.focus()
- },
- accessKeyUp: function() {},
- disable: function() {
- var a = this.getElement();
- this.getInputElement().setAttribute("disabled", "true");
- a.addClass("cke_disabled")
- },
- enable: function() {
- var a = this.getElement();
- this.getInputElement().removeAttribute("disabled");
- a.removeClass("cke_disabled")
- },
- isEnabled: function() {
- return !this.getElement().hasClass("cke_disabled")
- },
- isVisible: function() {
- return this.getInputElement().isVisible()
- },
- isFocusable: function() {
- return !this.isEnabled() || !this.isVisible() ? false : true
- }
- };
- CKEDITOR.ui.dialog.hbox.prototype = CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.uiElement, {
- getChild: function(a) {
- if(arguments.length < 1) return this._.children.concat();
- a.splice || (a = [a]);
- return a.length < 2 ? this._.children[a[0]] : this._.children[a[0]] && this._.children[a[0]].getChild ? this._.children[a[0]].getChild(a.slice(1, a.length)) : null
- }
- }, true);
- CKEDITOR.ui.dialog.vbox.prototype = new CKEDITOR.ui.dialog.hbox;
- (function() {
- var a = {
- build: function(a, b, c) {
- for(var d = b.children, f, g = [], e = [], h = 0; h < d.length && (f = d[h]); h++) {
- var j = [];
- g.push(j);
- e.push(CKEDITOR.dialog._.uiElementBuilders[f.type].build(a, f, j))
- }
- return new CKEDITOR.ui.dialog[b.type](a, e, g, c, b)
- }
- };
- CKEDITOR.dialog.addUIElement("hbox", a);
- CKEDITOR.dialog.addUIElement("vbox", a)
- })();
- CKEDITOR.dialogCommand = function(a, b) {
- this.dialogName = a;
- CKEDITOR.tools.extend(this, b, true)
- };
- CKEDITOR.dialogCommand.prototype = {
- exec: function(a) {
- a.openDialog(this.dialogName)
- },
- canUndo: false,
- editorFocus: 1
- };
- (function() {
- var a = /^([a]|[^a])+$/,
- b = /^\d*$/,
- c = /^\d*(?:\.\d+)?$/,
- d = /^(((\d*(\.\d+))|(\d*))(px|\%)?)?$/,
- f = /^(((\d*(\.\d+))|(\d*))(px|em|ex|in|cm|mm|pt|pc|\%)?)?$/i,
- g = /^(\s*[\w-]+\s*:\s*[^:;]+(?:;|$))*$/;
- CKEDITOR.VALIDATE_OR = 1;
- CKEDITOR.VALIDATE_AND = 2;
- CKEDITOR.dialog.validate = {
- functions: function() {
- var a = arguments;
- return function() {
- var b = this && this.getValue ? this.getValue() : a[0],
- c, d = CKEDITOR.VALIDATE_AND,
- f = [],
- g;
- for(g = 0; g < a.length; g++)
- if(typeof a[g] == "function") f.push(a[g]);
- else break;
- if(g < a.length && typeof a[g] ==
- "string") {
- c = a[g];
- g++
- }
- g < a.length && typeof a[g] == "number" && (d = a[g]);
- var e = d == CKEDITOR.VALIDATE_AND ? true : false;
- for(g = 0; g < f.length; g++) e = d == CKEDITOR.VALIDATE_AND ? e && f[g](b) : e || f[g](b);
- return !e ? c : true
- }
- },
- regex: function(a, b) {
- return function(c) {
- c = this && this.getValue ? this.getValue() : c;
- return !a.test(c) ? b : true
- }
- },
- notEmpty: function(b) {
- return this.regex(a, b)
- },
- integer: function(a) {
- return this.regex(b, a)
- },
- number: function(a) {
- return this.regex(c, a)
- },
- cssLength: function(a) {
- return this.functions(function(a) {
- return f.test(CKEDITOR.tools.trim(a))
- },
- a)
- },
- htmlLength: function(a) {
- return this.functions(function(a) {
- return d.test(CKEDITOR.tools.trim(a))
- }, a)
- },
- inlineStyle: function(a) {
- return this.functions(function(a) {
- return g.test(CKEDITOR.tools.trim(a))
- }, a)
- },
- equals: function(a, b) {
- return this.functions(function(b) {
- return b == a
- }, b)
- },
- notEqual: function(a, b) {
- return this.functions(function(b) {
- return b != a
- }, b)
- }
- };
- CKEDITOR.on("instanceDestroyed", function(a) {
- if(CKEDITOR.tools.isEmpty(CKEDITOR.instances)) {
- for(var b; b = CKEDITOR.dialog._.currentTop;) b.hide();
- for(var c in v) v[c].remove();
- v = {}
- }
- var a = a.editor._.storedDialogs,
- d;
- for(d in a) a[d].destroy()
- })
- })();
- CKEDITOR.tools.extend(CKEDITOR.editor.prototype, {
- openDialog: function(a, b) {
- var c = null,
- d = CKEDITOR.dialog._.dialogDefinitions[a];
- CKEDITOR.dialog._.currentTop === null && o(this);
- if(typeof d == "function") {
- c = this._.storedDialogs || (this._.storedDialogs = {});
- c = c[a] || (c[a] = new CKEDITOR.dialog(this, a));
- b && b.call(c, c);
- c.show()
- } else {
- if(d == "failed") {
- q(this);
- throw Error('[CKEDITOR.dialog.openDialog] Dialog "' + a + '" failed when loading definition.');
- }
- typeof d == "string" && CKEDITOR.scriptLoader.load(CKEDITOR.getUrl(d), function() {
- typeof CKEDITOR.dialog._.dialogDefinitions[a] != "function" && (CKEDITOR.dialog._.dialogDefinitions[a] = "failed");
- this.openDialog(a, b)
- }, this, 0, 1)
- }
- CKEDITOR.skin.loadPart("dialog");
- return c
- }
- })
- }(), CKEDITOR.plugins.add("dialog", {
- requires: "dialogui",
- init: function(a) {
- a.on("doubleclick", function(e) {
- e.data.dialog && a.openDialog(e.data.dialog)
- }, null, null, 999)
- }
- }),
- function() {
- CKEDITOR.plugins.add("a11yhelp", {
- requires: "dialog",
- availableLangs: {
- af: 1,
- ar: 1,
- bg: 1,
- ca: 1,
- cs: 1,
- cy: 1,
- da: 1,
- de: 1,
- el: 1,
- en: 1,
- "en-gb": 1,
- eo: 1,
- es: 1,
- et: 1,
- fa: 1,
- fi: 1,
- fr: 1,
- "fr-ca": 1,
- gl: 1,
- gu: 1,
- he: 1,
- hi: 1,
- hr: 1,
- hu: 1,
- id: 1,
- it: 1,
- ja: 1,
- km: 1,
- ko: 1,
- ku: 1,
- lt: 1,
- lv: 1,
- mk: 1,
- mn: 1,
- nb: 1,
- nl: 1,
- no: 1,
- pl: 1,
- pt: 1,
- "pt-br": 1,
- ro: 1,
- ru: 1,
- si: 1,
- sk: 1,
- sl: 1,
- sq: 1,
- sr: 1,
- "sr-latn": 1,
- sv: 1,
- th: 1,
- tr: 1,
- tt: 1,
- ug: 1,
- uk: 1,
- vi: 1,
- zh: 1,
- "zh-cn": 1
- },
- init: function(a) {
- var e = this;
- a.addCommand("a11yHelp", {
- exec: function() {
- var b = a.langCode,
- b = e.availableLangs[b] ? b : e.availableLangs[b.replace(/-.*/, "")] ? b.replace(/-.*/, "") : "en";
- CKEDITOR.scriptLoader.load(CKEDITOR.getUrl(e.path +
- "dialogs/lang/" + b + ".js"), function() {
- a.lang.a11yhelp = e.langEntries[b];
- a.openDialog("a11yHelp")
- })
- },
- modes: {
- wysiwyg: 1,
- source: 1
- },
- readOnly: 1,
- canUndo: false
- });
- a.setKeystroke(CKEDITOR.ALT + 48, "a11yHelp");
- CKEDITOR.dialog.add("a11yHelp", this.path + "dialogs/a11yhelp.js");
- a.on("ariaEditorHelpLabel", function(b) {
- b.data.label = a.lang.common.editorHelp
- })
- }
- })
- }(), CKEDITOR.plugins.add("about", {
- requires: "dialog",
- init: function(a) {
- var e = a.addCommand("about", new CKEDITOR.dialogCommand("about"));
- e.modes = {
- wysiwyg: 1,
- source: 1
- };
- e.canUndo = false;
- e.readOnly = 1;
- a.ui.addButton && a.ui.addButton("About", {
- label: a.lang.about.title,
- command: "about",
- toolbar: "about"
- });
- CKEDITOR.dialog.add("about", this.path + "dialogs/about.js")
- }
- }), CKEDITOR.plugins.add("basicstyles", {
- init: function(a) {
- var e = 0,
- b = function(b, c, d, i) {
- if(i) {
- var i = new CKEDITOR.style(i),
- k = g[d];
- k.unshift(i);
- a.attachStyleStateChange(i, function(b) {
- !a.readOnly && a.getCommand(d).setState(b)
- });
- a.addCommand(d, new CKEDITOR.styleCommand(i, {
- contentForms: k
- }));
- a.ui.addButton && a.ui.addButton(b, {
- label: c,
- command: d,
- toolbar: "basicstyles," + (e = e + 10)
- })
- }
- },
- g = {
- bold: ["strong", "b", ["span", function(a) {
- a = a.styles["font-weight"];
- return a == "bold" || +a >= 700
- }]],
- italic: ["em", "i", ["span", function(a) {
- return a.styles["font-style"] == "italic"
- }]],
- underline: ["u", ["span", function(a) {
- return a.styles["text-decoration"] == "underline"
- }]],
- strike: ["s", "strike", ["span", function(a) {
- return a.styles["text-decoration"] == "line-through"
- }]],
- subscript: ["sub"],
- superscript: ["sup"]
- },
- c = a.config,
- d = a.lang.basicstyles;
- b("Bold", d.bold, "bold",
- c.coreStyles_bold);
- b("Italic", d.italic, "italic", c.coreStyles_italic);
- b("Underline", d.underline, "underline", c.coreStyles_underline);
- b("Strike", d.strike, "strike", c.coreStyles_strike);
- b("Subscript", d.subscript, "subscript", c.coreStyles_subscript);
- b("Superscript", d.superscript, "superscript", c.coreStyles_superscript);
- a.setKeystroke([
- [CKEDITOR.CTRL + 66, "bold"],
- [CKEDITOR.CTRL + 73, "italic"],
- [CKEDITOR.CTRL + 85, "underline"]
- ])
- }
- }), CKEDITOR.config.coreStyles_bold = {
- element: "strong",
- overrides: "b"
- }, CKEDITOR.config.coreStyles_italic = {
- element: "em",
- overrides: "i"
- }, CKEDITOR.config.coreStyles_underline = {
- element: "u"
- }, CKEDITOR.config.coreStyles_strike = {
- element: "s",
- overrides: "strike"
- }, CKEDITOR.config.coreStyles_subscript = {
- element: "sub"
- }, CKEDITOR.config.coreStyles_superscript = {
- element: "sup"
- },
- function() {
- var a = {
- exec: function(a) {
- var b = a.getCommand("blockquote").state,
- g = a.getSelection(),
- c = g && g.getRanges()[0];
- if(c) {
- var d = g.createBookmarks();
- if(CKEDITOR.env.ie) {
- var j = d[0].startNode,
- f = d[0].endNode,
- h;
- if(j && j.getParent().getName() == "blockquote")
- for(h =
- j; h = h.getNext();)
- if(h.type == CKEDITOR.NODE_ELEMENT && h.isBlockBoundary()) {
- j.move(h, true);
- break
- }
- if(f && f.getParent().getName() == "blockquote")
- for(h = f; h = h.getPrevious();)
- if(h.type == CKEDITOR.NODE_ELEMENT && h.isBlockBoundary()) {
- f.move(h);
- break
- }
- }
- var i = c.createIterator();
- i.enlargeBr = a.config.enterMode != CKEDITOR.ENTER_BR;
- if(b == CKEDITOR.TRISTATE_OFF) {
- for(j = []; b = i.getNextParagraph();) j.push(b);
- if(j.length < 1) {
- b = a.document.createElement(a.config.enterMode == CKEDITOR.ENTER_P ? "p" : "div");
- f = d.shift();
- c.insertNode(b);
- b.append(new CKEDITOR.dom.text("", a.document));
- c.moveToBookmark(f);
- c.selectNodeContents(b);
- c.collapse(true);
- f = c.createBookmark();
- j.push(b);
- d.unshift(f)
- }
- h = j[0].getParent();
- c = [];
- for(f = 0; f < j.length; f++) {
- b = j[f];
- h = h.getCommonAncestor(b.getParent())
- }
- for(b = {
- table: 1,
- tbody: 1,
- tr: 1,
- ol: 1,
- ul: 1
- }; b[h.getName()];) h = h.getParent();
- for(f = null; j.length > 0;) {
- for(b = j.shift(); !b.getParent().equals(h);) b = b.getParent();
- b.equals(f) || c.push(b);
- f = b
- }
- for(; c.length > 0;) {
- b = c.shift();
- if(b.getName() == "blockquote") {
- for(f = new CKEDITOR.dom.documentFragment(a.document); b.getFirst();) {
- f.append(b.getFirst().remove());
- j.push(f.getLast())
- }
- f.replace(b)
- } else j.push(b)
- }
- c = a.document.createElement("blockquote");
- for(c.insertBefore(j[0]); j.length > 0;) {
- b = j.shift();
- c.append(b)
- }
- } else if(b == CKEDITOR.TRISTATE_ON) {
- f = [];
- for(h = {}; b = i.getNextParagraph();) {
- for(j = c = null; b.getParent();) {
- if(b.getParent().getName() == "blockquote") {
- c = b.getParent();
- j = b;
- break
- }
- b = b.getParent()
- }
- if(c && j && !j.getCustomData("blockquote_moveout")) {
- f.push(j);
- CKEDITOR.dom.element.setMarker(h, j, "blockquote_moveout", true)
- }
- }
- CKEDITOR.dom.element.clearAllMarkers(h);
- b = [];
- j = [];
- for(h = {}; f.length > 0;) {
- i = f.shift();
- c = i.getParent();
- if(i.getPrevious())
- if(i.getNext()) {
- i.breakParent(i.getParent());
- j.push(i.getNext())
- } else i.remove().insertAfter(c);
- else i.remove().insertBefore(c);
- if(!c.getCustomData("blockquote_processed")) {
- j.push(c);
- CKEDITOR.dom.element.setMarker(h, c, "blockquote_processed", true)
- }
- b.push(i)
- }
- CKEDITOR.dom.element.clearAllMarkers(h);
- for(f = j.length - 1; f >= 0; f--) {
- c = j[f];
- a: {
- h = c;
- for(var i = 0, k = h.getChildCount(), n = void 0; i < k && (n = h.getChild(i)); i++)
- if(n.type == CKEDITOR.NODE_ELEMENT &&
- n.isBlockBoundary()) {
- h = false;
- break a
- }
- h = true
- }
- h && c.remove()
- }
- if(a.config.enterMode == CKEDITOR.ENTER_BR)
- for(c = true; b.length;) {
- i = b.shift();
- if(i.getName() == "div") {
- f = new CKEDITOR.dom.documentFragment(a.document);
- c && (i.getPrevious() && !(i.getPrevious().type == CKEDITOR.NODE_ELEMENT && i.getPrevious().isBlockBoundary())) && f.append(a.document.createElement("br"));
- for(c = i.getNext() && !(i.getNext().type == CKEDITOR.NODE_ELEMENT && i.getNext().isBlockBoundary()); i.getFirst();) i.getFirst().remove().appendTo(f);
- c && f.append(a.document.createElement("br"));
- f.replace(i);
- c = false
- }
- }
- }
- g.selectBookmarks(d);
- a.focus()
- }
- },
- refresh: function(a, b) {
- this.setState(a.elementPath(b.block || b.blockLimit).contains("blockquote", 1) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF)
- },
- context: "blockquote",
- allowedContent: "blockquote",
- requiredContent: "blockquote"
- };
- CKEDITOR.plugins.add("blockquote", {
- init: function(e) {
- if(!e.blockless) {
- e.addCommand("blockquote", a);
- e.ui.addButton && e.ui.addButton("Blockquote", {
- label: e.lang.blockquote.toolbar,
- command: "blockquote",
- toolbar: "blocks,10"
- })
- }
- }
- })
- }(),
- "use strict",
- function() {
- function a(a) {
- function b() {
- var c = a.editable();
- c.on(y, function(a) {
- (!CKEDITOR.env.ie || !x) && s(a)
- });
- CKEDITOR.env.ie && c.on("paste", function(b) {
- if(!v) {
- g();
- b.data.preventDefault();
- s(b);
- o("paste") || a.openDialog("paste")
- }
- });
- if(CKEDITOR.env.ie) {
- c.on("contextmenu", e, null, null, 0);
- c.on("beforepaste", function(a) {
- a.data && (!a.data.$.ctrlKey && !a.data.$.shiftKey) && e()
- }, null, null, 0)
- }
- c.on("beforecut", function() {
- !x && m(a)
- });
- var d;
- c.attachListener(CKEDITOR.env.ie ? c : a.document.getDocumentElement(),
- "mouseup",
- function() {
- d = setTimeout(function() {
- u()
- }, 0)
- });
- a.on("destroy", function() {
- clearTimeout(d)
- });
- c.on("keyup", u)
- }
- function c(b) {
- return {
- type: b,
- canUndo: b == "cut",
- startDisabled: true,
- exec: function() {
- this.type == "cut" && m();
- var b;
- var c = this.type;
- if(CKEDITOR.env.ie) b = o(c);
- else try {
- b = a.document.$.execCommand(c, false, null)
- } catch(d) {
- b = false
- }
- b || alert(a.lang.clipboard[this.type + "Error"]);
- return b
- }
- }
- }
- function d() {
- return {
- canUndo: false,
- async: true,
- exec: function(a, b) {
- var c = function(b, c) {
- b && q(b.type, b.dataValue, !!c);
- a.fire("afterCommandExec", {
- name: "paste",
- command: d,
- returnValue: !!b
- })
- },
- d = this;
- typeof b == "string" ? c({
- type: "auto",
- dataValue: b
- }, 1) : a.getClipboardData(c)
- }
- }
- }
- function g() {
- v = 1;
- setTimeout(function() {
- v = 0
- }, 100)
- }
- function e() {
- x = 1;
- setTimeout(function() {
- x = 0
- }, 10)
- }
- function o(b) {
- var c = a.document,
- d = c.getBody(),
- f = false,
- g = function() {
- f = true
- };
- d.on(b, g);
- (CKEDITOR.env.version > 7 ? c.$ : c.$.selection.createRange()).execCommand(b);
- d.removeListener(b, g);
- return f
- }
- function q(b, c, d) {
- b = {
- type: b
- };
- if(d && a.fire("beforePaste", b) === false ||
- !c) return false;
- b.dataValue = c;
- return a.fire("paste", b)
- }
- function m() {
- if(CKEDITOR.env.ie && !CKEDITOR.env.quirks) {
- var b = a.getSelection(),
- c, d, f;
- if(b.getType() == CKEDITOR.SELECTION_ELEMENT && (c = b.getSelectedElement())) {
- d = b.getRanges()[0];
- f = a.document.createText("");
- f.insertBefore(c);
- d.setStartBefore(f);
- d.setEndAfter(c);
- b.selectRanges([d]);
- setTimeout(function() {
- if(c.getParent()) {
- f.remove();
- b.selectElement(c)
- }
- }, 0)
- }
- }
- }
- function l(b, c) {
- var d = a.document,
- f = a.editable(),
- g = function(a) {
- a.cancel()
- },
- e;
- if(!d.getById("cke_pastebin")) {
- var h =
- a.getSelection(),
- i = h.createBookmarks();
- CKEDITOR.env.ie && h.root.fire("selectionchange");
- var k = new CKEDITOR.dom.element((CKEDITOR.env.webkit || f.is("body")) && !CKEDITOR.env.ie ? "body" : "div", d);
- k.setAttributes({
- id: "cke_pastebin",
- "data-cke-temp": "1"
- });
- var s = 0,
- d = d.getWindow();
- if(CKEDITOR.env.webkit) {
- f.append(k);
- k.addClass("cke_editable");
- if(!f.is("body")) {
- s = f.getComputedStyle("position") != "static" ? f : CKEDITOR.dom.element.get(f.$.offsetParent);
- s = s.getDocumentPosition().y
- }
- } else f.getAscendant(CKEDITOR.env.ie ?
- "body" : "html", 1).append(k);
- k.setStyles({
- position: "absolute",
- top: d.getScrollPosition().y - s + 10 + "px",
- width: "1px",
- height: Math.max(1, d.getViewPaneSize().height - 20) + "px",
- overflow: "hidden",
- margin: 0,
- padding: 0
- });
- CKEDITOR.env.safari && k.setStyles(CKEDITOR.tools.cssVendorPrefix("user-select", "text"));
- if(s = k.getParent().isReadOnly()) {
- k.setOpacity(0);
- k.setAttribute("contenteditable", true)
- } else k.setStyle(a.config.contentsLangDirection == "ltr" ? "left" : "right", "-1000px");
- a.on("selectionChange", g, null, null, 0);
- if(CKEDITOR.env.webkit ||
- CKEDITOR.env.gecko) e = f.once("blur", g, null, null, -100);
- s && k.focus();
- s = new CKEDITOR.dom.range(k);
- s.selectNodeContents(k);
- var p = s.select();
- CKEDITOR.env.ie && (e = f.once("blur", function() {
- a.lockSelection(p)
- }));
- var m = CKEDITOR.document.getWindow().getScrollPosition().y;
- setTimeout(function() {
- if(CKEDITOR.env.webkit) CKEDITOR.document.getBody().$.scrollTop = m;
- e && e.removeListener();
- CKEDITOR.env.ie && f.focus();
- h.selectBookmarks(i);
- k.remove();
- var b;
- if(CKEDITOR.env.webkit && (b = k.getFirst()) && b.is && b.hasClass("Apple-style-span")) k =
- b;
- a.removeListener("selectionChange", g);
- c(k.getHtml())
- }, 0)
- }
- }
- function p() {
- if(CKEDITOR.env.ie) {
- a.focus();
- g();
- var b = a.focusManager;
- b.lock();
- if(a.editable().fire(y) && !o("paste")) {
- b.unlock();
- return false
- }
- b.unlock()
- } else try {
- if(a.editable().fire(y) && !a.document.$.execCommand("Paste", false, null)) throw 0;
- } catch(c) {
- return false
- }
- return true
- }
- function t(b) {
- if(a.mode == "wysiwyg") switch(b.data.keyCode) {
- case CKEDITOR.CTRL + 86:
- case CKEDITOR.SHIFT + 45:
- b = a.editable();
- g();
- !CKEDITOR.env.ie && b.fire("beforepaste");
- break;
- case CKEDITOR.CTRL + 88:
- case CKEDITOR.SHIFT + 46:
- a.fire("saveSnapshot");
- setTimeout(function() {
- a.fire("saveSnapshot")
- }, 50)
- }
- }
- function s(b) {
- var c = {
- type: "auto"
- },
- d = a.fire("beforePaste", c);
- l(b, function(a) {
- a = a.replace(/<span[^>]+data-cke-bookmark[^<]*?<\/span>/ig, "");
- d && q(c.type, a, 0, 1)
- })
- }
- function u() {
- if(a.mode == "wysiwyg") {
- var b = w("paste");
- a.getCommand("cut").setState(w("cut"));
- a.getCommand("copy").setState(w("copy"));
- a.getCommand("paste").setState(b);
- a.fire("pasteState", b)
- }
- }
- function w(b) {
- if(r && b in {
- paste: 1,
- cut: 1
- }) return CKEDITOR.TRISTATE_DISABLED;
- if(b == "paste") return CKEDITOR.TRISTATE_OFF;
- var b = a.getSelection(),
- c = b.getRanges();
- return b.getType() == CKEDITOR.SELECTION_NONE || c.length == 1 && c[0].collapsed ? CKEDITOR.TRISTATE_DISABLED : CKEDITOR.TRISTATE_OFF
- }
- var x = 0,
- v = 0,
- r = 0,
- y = CKEDITOR.env.ie ? "beforepaste" : "paste";
- (function() {
- a.on("key", t);
- a.on("contentDom", b);
- a.on("selectionChange", function(a) {
- r = a.data.selection.getRanges()[0].checkReadOnly();
- u()
- });
- a.contextMenu && a.contextMenu.addListener(function(a, b) {
- r = b.getRanges()[0].checkReadOnly();
- return {
- cut: w("cut"),
- copy: w("copy"),
- paste: w("paste")
- }
- })
- })();
- (function() {
- function b(c, d, f, g, e) {
- var h = a.lang.clipboard[d];
- a.addCommand(d, f);
- a.ui.addButton && a.ui.addButton(c, {
- label: h,
- command: d,
- toolbar: "clipboard," + g
- });
- a.addMenuItems && a.addMenuItem(d, {
- label: h,
- command: d,
- group: "clipboard",
- order: e
- })
- }
- b("Cut", "cut", c("cut"), 10, 1);
- b("Copy", "copy", c("copy"), 20, 4);
- b("Paste", "paste", d(), 30, 8)
- })();
- a.getClipboardData = function(b, c) {
- function d(a) {
- a.removeListener();
- a.cancel();
- c(a.data)
- }
- function f(a) {
- a.removeListener();
- a.cancel();
- i = true;
- c({
- type: h,
- dataValue: a.data
- })
- }
- function g() {
- this.customTitle = b && b.title
- }
- var e = false,
- h = "auto",
- i = false;
- if(!c) {
- c = b;
- b = null
- }
- a.on("paste", d, null, null, 0);
- a.on("beforePaste", function(a) {
- a.removeListener();
- e = true;
- h = a.data.type
- }, null, null, 1E3);
- if(p() === false) {
- a.removeListener("paste", d);
- if(e && a.fire("pasteDialog", g)) {
- a.on("pasteDialogCommit", f);
- a.on("dialogHide", function(a) {
- a.removeListener();
- a.data.removeListener("pasteDialogCommit", f);
- setTimeout(function() {
- i || c(null)
- }, 10)
- })
- } else c(null)
- }
- }
- }
- function e(a) {
- if(CKEDITOR.env.webkit) {
- if(!a.match(/^[^<]*$/g) && !a.match(/^(<div><br( ?\/)?><\/div>|<div>[^<]*<\/div>)*$/gi)) return "html"
- } else if(CKEDITOR.env.ie) {
- if(!a.match(/^([^<]|<br( ?\/)?>)*$/gi) && !a.match(/^(<p>([^<]|<br( ?\/)?>)*<\/p>|(\r\n))*$/gi)) return "html"
- } else if(CKEDITOR.env.gecko) {
- if(!a.match(/^([^<]|<br( ?\/)?>)*$/gi)) return "html"
- } else return "html";
- return "htmlifiedtext"
- }
- function b(a, b) {
- function c(a) {
- return CKEDITOR.tools.repeat("</p><p>", ~~(a / 2)) + (a % 2 == 1 ? "<br>" : "")
- }
- b = b.replace(/\s+/g,
- " ").replace(/> +</g, "><").replace(/<br ?\/>/gi, "<br>");
- b = b.replace(/<\/?[A-Z]+>/g, function(a) {
- return a.toLowerCase()
- });
- if(b.match(/^[^<]$/)) return b;
- if(CKEDITOR.env.webkit && b.indexOf("<div>") > -1) {
- b = b.replace(/^(<div>(<br>|)<\/div>)(?!$|(<div>(<br>|)<\/div>))/g, "<br>").replace(/^(<div>(<br>|)<\/div>){2}(?!$)/g, "<div></div>");
- b.match(/<div>(<br>|)<\/div>/) && (b = "<p>" + b.replace(/(<div>(<br>|)<\/div>)+/g, function(a) {
- return c(a.split("</div><div>").length + 1)
- }) + "</p>");
- b = b.replace(/<\/div><div>/g, "<br>");
- b = b.replace(/<\/?div>/g, "")
- }
- if(CKEDITOR.env.gecko && a.enterMode != CKEDITOR.ENTER_BR) {
- CKEDITOR.env.gecko && (b = b.replace(/^<br><br>$/, "<br>"));
- b.indexOf("<br><br>") > -1 && (b = "<p>" + b.replace(/(<br>){2,}/g, function(a) {
- return c(a.length / 4)
- }) + "</p>")
- }
- return d(a, b)
- }
- function g() {
- var a = new CKEDITOR.htmlParser.filter,
- b = {
- blockquote: 1,
- dl: 1,
- fieldset: 1,
- h1: 1,
- h2: 1,
- h3: 1,
- h4: 1,
- h5: 1,
- h6: 1,
- ol: 1,
- p: 1,
- table: 1,
- ul: 1
- },
- c = CKEDITOR.tools.extend({
- br: 0
- }, CKEDITOR.dtd.$inline),
- d = {
- p: 1,
- br: 1,
- "cke:br": 1
- },
- g = CKEDITOR.dtd,
- e = CKEDITOR.tools.extend({
- area: 1,
- basefont: 1,
- embed: 1,
- iframe: 1,
- map: 1,
- object: 1,
- param: 1
- }, CKEDITOR.dtd.$nonBodyContent, CKEDITOR.dtd.$cdata),
- o = function(a) {
- delete a.name;
- a.add(new CKEDITOR.htmlParser.text(" "))
- },
- q = function(a) {
- for(var b = a, c;
- (b = b.next) && b.name && b.name.match(/^h\d$/);) {
- c = new CKEDITOR.htmlParser.element("cke:br");
- c.isEmpty = true;
- for(a.add(c); c = b.children.shift();) a.add(c)
- }
- };
- a.addRules({
- elements: {
- h1: q,
- h2: q,
- h3: q,
- h4: q,
- h5: q,
- h6: q,
- img: function(a) {
- var a = CKEDITOR.tools.trim(a.attributes.alt || ""),
- b = " ";
- a && !a.match(/(^http|\.(jpe?g|gif|png))/i) &&
- (b = " [" + a + "] ");
- return new CKEDITOR.htmlParser.text(b)
- },
- td: o,
- th: o,
- $: function(a) {
- var j = a.name,
- p;
- if(e[j]) return false;
- a.attributes = {};
- if(j == "br") return a;
- if(b[j]) a.name = "p";
- else if(c[j]) delete a.name;
- else if(g[j]) {
- p = new CKEDITOR.htmlParser.element("cke:br");
- p.isEmpty = true;
- if(CKEDITOR.dtd.$empty[j]) return p;
- a.add(p, 0);
- p = p.clone();
- p.isEmpty = true;
- a.add(p);
- delete a.name
- }
- d[a.name] || delete a.name;
- return a
- }
- }
- }, {
- applyToAll: true
- });
- return a
- }
- function c(a, b, c) {
- var b = new CKEDITOR.htmlParser.fragment.fromHtml(b),
- g = new CKEDITOR.htmlParser.basicWriter;
- b.writeHtml(g, c);
- var b = g.getHtml(),
- b = b.replace(/\s*(<\/?[a-z:]+ ?\/?>)\s*/g, "$1").replace(/(<cke:br \/>){2,}/g, "<cke:br />").replace(/(<cke:br \/>)(<\/?p>|<br \/>)/g, "$2").replace(/(<\/?p>|<br \/>)(<cke:br \/>)/g, "$1").replace(/<(cke:)?br( \/)?>/g, "<br>").replace(/<p><\/p>/g, ""),
- e = 0,
- b = b.replace(/<\/?p>/g, function(a) {
- if(a == "<p>") {
- if(++e > 1) return "</p><p>"
- } else if(--e > 0) return "</p><p>";
- return a
- }).replace(/<p><\/p>/g, "");
- return d(a, b)
- }
- function d(a, b) {
- a.enterMode ==
- CKEDITOR.ENTER_BR ? b = b.replace(/(<\/p><p>)+/g, function(a) {
- return CKEDITOR.tools.repeat("<br>", a.length / 7 * 2)
- }).replace(/<\/?p>/g, "") : a.enterMode == CKEDITOR.ENTER_DIV && (b = b.replace(/<(\/)?p>/g, "<$1div>"));
- return b
- }
- CKEDITOR.plugins.add("clipboard", {
- requires: "dialog",
- init: function(d) {
- var f;
- a(d);
- CKEDITOR.dialog.add("paste", CKEDITOR.getUrl(this.path + "dialogs/paste.js"));
- d.on("paste", function(a) {
- var b = a.data.dataValue,
- c = CKEDITOR.dtd.$block;
- if(b.indexOf("Apple-") > -1) {
- b = b.replace(/<span class="Apple-converted-space"> <\/span>/gi,
- " ");
- a.data.type != "html" && (b = b.replace(/<span class="Apple-tab-span"[^>]*>([^<]*)<\/span>/gi, function(a, b) {
- return b.replace(/\t/g, " ")
- }));
- if(b.indexOf('<br class="Apple-interchange-newline">') > -1) {
- a.data.startsWithEOL = 1;
- a.data.preSniffing = "html";
- b = b.replace(/<br class="Apple-interchange-newline">/, "")
- }
- b = b.replace(/(<[^>]+) class="Apple-[^"]*"/gi, "$1")
- }
- if(b.match(/^<[^<]+cke_(editable|contents)/i)) {
- var d, f, g = new CKEDITOR.dom.element("div");
- for(g.setHtml(b); g.getChildCount() == 1 && (d =
- g.getFirst()) && d.type == CKEDITOR.NODE_ELEMENT && (d.hasClass("cke_editable") || d.hasClass("cke_contents"));) g = f = d;
- f && (b = f.getHtml().replace(/<br>$/i, ""))
- }
- CKEDITOR.env.ie ? b = b.replace(/^ (?: |\r\n)?<(\w+)/g, function(b, d) {
- if(d.toLowerCase() in c) {
- a.data.preSniffing = "html";
- return "<" + d
- }
- return b
- }) : CKEDITOR.env.webkit ? b = b.replace(/<\/(\w+)><div><br><\/div>$/, function(b, d) {
- if(d in c) {
- a.data.endsWithEOL = 1;
- return "</" + d + ">"
- }
- return b
- }) : CKEDITOR.env.gecko && (b = b.replace(/(\s)<br>$/, "$1"));
- a.data.dataValue = b
- }, null,
- null, 3);
- d.on("paste", function(a) {
- var a = a.data,
- i = a.type,
- k = a.dataValue,
- n, o = d.config.clipboard_defaultContentType || "html";
- n = i == "html" || a.preSniffing == "html" ? "html" : e(k);
- n == "htmlifiedtext" ? k = b(d.config, k) : i == "text" && n == "html" && (k = c(d.config, k, f || (f = g(d))));
- a.startsWithEOL && (k = '<br data-cke-eol="1">' + k);
- a.endsWithEOL && (k = k + '<br data-cke-eol="1">');
- i == "auto" && (i = n == "html" || o == "html" ? "html" : "text");
- a.type = i;
- a.dataValue = k;
- delete a.preSniffing;
- delete a.startsWithEOL;
- delete a.endsWithEOL
- }, null, null, 6);
- d.on("paste",
- function(a) {
- a = a.data;
- d.insertHtml(a.dataValue, a.type);
- setTimeout(function() {
- d.fire("afterPaste")
- }, 0)
- }, null, null, 1E3);
- d.on("pasteDialog", function(a) {
- setTimeout(function() {
- d.openDialog("paste", a.data)
- }, 0)
- })
- }
- })
- }(),
- function() {
- CKEDITOR.plugins.add("panel", {
- beforeInit: function(a) {
- a.ui.addHandler(CKEDITOR.UI_PANEL, CKEDITOR.ui.panel.handler)
- }
- });
- CKEDITOR.UI_PANEL = "panel";
- CKEDITOR.ui.panel = function(a, b) {
- b && CKEDITOR.tools.extend(this, b);
- CKEDITOR.tools.extend(this, {
- className: "",
- css: []
- });
- this.id = CKEDITOR.tools.getNextId();
- this.document = a;
- this.isFramed = this.forceIFrame || this.css.length;
- this._ = {
- blocks: {}
- }
- };
- CKEDITOR.ui.panel.handler = {
- create: function(a) {
- return new CKEDITOR.ui.panel(a)
- }
- };
- var a = CKEDITOR.addTemplate("panel", '<div lang="{langCode}" id="{id}" dir={dir} class="cke cke_reset_all {editorId} cke_panel cke_panel {cls} cke_{dir}" style="z-index:{z-index}" role="presentation">{frame}</div>'),
- e = CKEDITOR.addTemplate("panel-frame", '<iframe id="{id}" class="cke_panel_frame" role="presentation" frameborder="0" src="{src}"></iframe>'),
- b = CKEDITOR.addTemplate("panel-frame-inner", '<!DOCTYPE html><html class="cke_panel_container {env}" dir="{dir}" lang="{langCode}"><head>{css}</head><body class="cke_{dir}" style="margin:0;padding:0" onload="{onload}"></body></html>');
- CKEDITOR.ui.panel.prototype = {
- render: function(g, c) {
- this.getHolderElement = function() {
- var a = this._.holder;
- if(!a) {
- if(this.isFramed) {
- var a = this.document.getById(this.id + "_frame"),
- c = a.getParent(),
- a = a.getFrameDocument();
- CKEDITOR.env.iOS && c.setStyles({
- overflow: "scroll",
- "-webkit-overflow-scrolling": "touch"
- });
- c = CKEDITOR.tools.addFunction(CKEDITOR.tools.bind(function() {
- this.isLoaded = true;
- if(this.onLoad) this.onLoad()
- }, this));
- a.write(b.output(CKEDITOR.tools.extend({
- css: CKEDITOR.tools.buildStyleHtml(this.css),
- onload: "window.parent.CKEDITOR.tools.callFunction(" + c + ");"
- }, d)));
- a.getWindow().$.CKEDITOR = CKEDITOR;
- a.on("keydown", function(a) {
- var b = a.data.getKeystroke(),
- c = this.document.getById(this.id).getAttribute("dir");
- this._.onKeyDown && this._.onKeyDown(b) === false ? a.data.preventDefault() : (b == 27 || b == (c == "rtl" ? 39 :
- 37)) && this.onEscape && this.onEscape(b) === false && a.data.preventDefault()
- }, this);
- a = a.getBody();
- a.unselectable();
- CKEDITOR.env.air && CKEDITOR.tools.callFunction(c)
- } else a = this.document.getById(this.id);
- this._.holder = a
- }
- return a
- };
- var d = {
- editorId: g.id,
- id: this.id,
- langCode: g.langCode,
- dir: g.lang.dir,
- cls: this.className,
- frame: "",
- env: CKEDITOR.env.cssClass,
- "z-index": g.config.baseFloatZIndex + 1
- };
- if(this.isFramed) {
- var j = CKEDITOR.env.air ? "javascript:void(0)" : CKEDITOR.env.ie ? "javascript:void(function(){" + encodeURIComponent("document.open();(" +
- CKEDITOR.tools.fixDomain + ")();document.close();") + "}())" : "";
- d.frame = e.output({
- id: this.id + "_frame",
- src: j
- })
- }
- j = a.output(d);
- c && c.push(j);
- return j
- },
- addBlock: function(a, b) {
- b = this._.blocks[a] = b instanceof CKEDITOR.ui.panel.block ? b : new CKEDITOR.ui.panel.block(this.getHolderElement(), b);
- this._.currentBlock || this.showBlock(a);
- return b
- },
- getBlock: function(a) {
- return this._.blocks[a]
- },
- showBlock: function(a) {
- var a = this._.blocks[a],
- b = this._.currentBlock,
- d = !this.forceIFrame || CKEDITOR.env.ie ? this._.holder : this.document.getById(this.id +
- "_frame");
- b && b.hide();
- this._.currentBlock = a;
- CKEDITOR.fire("ariaWidget", d);
- a._.focusIndex = -1;
- this._.onKeyDown = a.onKeyDown && CKEDITOR.tools.bind(a.onKeyDown, a);
- a.show();
- return a
- },
- destroy: function() {
- this.element && this.element.remove()
- }
- };
- CKEDITOR.ui.panel.block = CKEDITOR.tools.createClass({
- $: function(a, b) {
- this.element = a.append(a.getDocument().createElement("div", {
- attributes: {
- tabindex: -1,
- "class": "cke_panel_block"
- },
- styles: {
- display: "none"
- }
- }));
- b && CKEDITOR.tools.extend(this, b);
- this.element.setAttributes({
- role: this.attributes.role ||
- "presentation",
- "aria-label": this.attributes["aria-label"],
- title: this.attributes.title || this.attributes["aria-label"]
- });
- this.keys = {};
- this._.focusIndex = -1;
- this.element.disableContextMenu()
- },
- _: {
- markItem: function(a) {
- if(a != -1) {
- a = this.element.getElementsByTag("a").getItem(this._.focusIndex = a);
- CKEDITOR.env.webkit && a.getDocument().getWindow().focus();
- a.focus();
- this.onMark && this.onMark(a)
- }
- }
- },
- proto: {
- show: function() {
- this.element.setStyle("display", "")
- },
- hide: function() {
- (!this.onHide || this.onHide.call(this) !==
- true) && this.element.setStyle("display", "none")
- },
- onKeyDown: function(a, b) {
- var d = this.keys[a];
- switch(d) {
- case "next":
- for(var e = this._.focusIndex, d = this.element.getElementsByTag("a"), f; f = d.getItem(++e);)
- if(f.getAttribute("_cke_focus") && f.$.offsetWidth) {
- this._.focusIndex = e;
- f.focus();
- break
- }
- if(!f && !b) {
- this._.focusIndex = -1;
- return this.onKeyDown(a, 1)
- }
- return false;
- case "prev":
- e = this._.focusIndex;
- for(d = this.element.getElementsByTag("a"); e > 0 && (f = d.getItem(--e));) {
- if(f.getAttribute("_cke_focus") && f.$.offsetWidth) {
- this._.focusIndex =
- e;
- f.focus();
- break
- }
- f = null
- }
- if(!f && !b) {
- this._.focusIndex = d.count();
- return this.onKeyDown(a, 1)
- }
- return false;
- case "click":
- case "mouseup":
- e = this._.focusIndex;
- (f = e >= 0 && this.element.getElementsByTag("a").getItem(e)) && (f.$[d] ? f.$[d]() : f.$["on" + d]());
- return false
- }
- return true
- }
- }
- })
- }(), CKEDITOR.plugins.add("floatpanel", {
- requires: "panel"
- }),
- function() {
- function a(a, g, c, d, j) {
- var j = CKEDITOR.tools.genKey(g.getUniqueId(), c.getUniqueId(), a.lang.dir, a.uiColor || "", d.css || "", j || ""),
- f = e[j];
- if(!f) {
- f = e[j] = new CKEDITOR.ui.panel(g,
- d);
- f.element = c.append(CKEDITOR.dom.element.createFromHtml(f.render(a), g));
- f.element.setStyles({
- display: "none",
- position: "absolute"
- })
- }
- return f
- }
- var e = {};
- CKEDITOR.ui.floatPanel = CKEDITOR.tools.createClass({
- $: function(b, g, c, d) {
- function e() {
- k.hide()
- }
- c.forceIFrame = 1;
- c.toolbarRelated && b.elementMode == CKEDITOR.ELEMENT_MODE_INLINE && (g = CKEDITOR.document.getById("cke_" + b.name));
- var f = g.getDocument(),
- d = a(b, f, g, c, d || 0),
- h = d.element,
- i = h.getFirst(),
- k = this;
- h.disableContextMenu();
- this.element = h;
- this._ = {
- editor: b,
- panel: d,
- parentElement: g,
- definition: c,
- document: f,
- iframe: i,
- children: [],
- dir: b.lang.dir
- };
- b.on("mode", e);
- b.on("resize", e);
- if(!CKEDITOR.env.iOS) f.getWindow().on("resize", e)
- },
- proto: {
- addBlock: function(a, g) {
- return this._.panel.addBlock(a, g)
- },
- addListBlock: function(a, g) {
- return this._.panel.addListBlock(a, g)
- },
- getBlock: function(a) {
- return this._.panel.getBlock(a)
- },
- showBlock: function(a, g, c, d, e, f) {
- var h = this._.panel,
- i = h.showBlock(a);
- this.allowBlur(false);
- a = this._.editor.editable();
- this._.returnFocus = a.hasFocus ? a : new CKEDITOR.dom.element(CKEDITOR.document.$.activeElement);
- this._.hideTimeout = 0;
- var k = this.element,
- a = this._.iframe,
- a = CKEDITOR.env.ie ? a : new CKEDITOR.dom.window(a.$.contentWindow),
- n = k.getDocument(),
- o = this._.parentElement.getPositionedAncestor(),
- q = g.getDocumentPosition(n),
- n = o ? o.getDocumentPosition(n) : {
- x: 0,
- y: 0
- },
- m = this._.dir == "rtl",
- l = q.x + (d || 0) - n.x,
- p = q.y + (e || 0) - n.y;
- if(m && (c == 1 || c == 4)) l = l + g.$.offsetWidth;
- else if(!m && (c == 2 || c == 3)) l = l + (g.$.offsetWidth - 1);
- if(c == 3 || c == 4) p = p + (g.$.offsetHeight - 1);
- this._.panel._.offsetParentId = g.getId();
- k.setStyles({
- top: p + "px",
- left: 0,
- display: ""
- });
- k.setOpacity(0);
- k.getFirst().removeStyle("width");
- this._.editor.focusManager.add(a);
- if(!this._.blurSet) {
- CKEDITOR.event.useCapture = true;
- a.on("blur", function(a) {
- function b() {
- delete this._.returnFocus;
- this.hide()
- }
- if(this.allowBlur() && a.data.getPhase() == CKEDITOR.EVENT_PHASE_AT_TARGET && this.visible && !this._.activeChild)
- if(CKEDITOR.env.iOS) {
- if(!this._.hideTimeout) this._.hideTimeout = CKEDITOR.tools.setTimeout(b, 0, this)
- } else b.call(this)
- }, this);
- a.on("focus", function() {
- this._.focused = true;
- this.hideChild();
- this.allowBlur(true)
- }, this);
- if(CKEDITOR.env.iOS) {
- a.on("touchstart", function() {
- clearTimeout(this._.hideTimeout)
- }, this);
- a.on("touchend", function() {
- this._.hideTimeout = 0;
- this.focus()
- }, this)
- }
- CKEDITOR.event.useCapture = false;
- this._.blurSet = 1
- }
- h.onEscape = CKEDITOR.tools.bind(function(a) {
- if(this.onEscape && this.onEscape(a) === false) return false
- }, this);
- CKEDITOR.tools.setTimeout(function() {
- var a = CKEDITOR.tools.bind(function() {
- k.removeStyle("width");
- if(i.autoSize) {
- var a = i.element.getDocument(),
- a = (CKEDITOR.env.webkit ?
- i.element : a.getBody()).$.scrollWidth;
- CKEDITOR.env.ie && (CKEDITOR.env.quirks && a > 0) && (a = a + ((k.$.offsetWidth || 0) - (k.$.clientWidth || 0) + 3));
- k.setStyle("width", a + 10 + "px");
- a = i.element.$.scrollHeight;
- CKEDITOR.env.ie && (CKEDITOR.env.quirks && a > 0) && (a = a + ((k.$.offsetHeight || 0) - (k.$.clientHeight || 0) + 3));
- k.setStyle("height", a + "px");
- h._.currentBlock.element.setStyle("display", "none").removeStyle("display")
- } else k.removeStyle("height");
- m && (l = l - k.$.offsetWidth);
- k.setStyle("left", l + "px");
- var b = h.element.getWindow(),
- a = k.$.getBoundingClientRect(),
- b = b.getViewPaneSize(),
- c = a.width || a.right - a.left,
- d = a.height || a.bottom - a.top,
- g = m ? a.right : b.width - a.left,
- e = m ? b.width - a.right : a.left;
- m ? g < c && (l = e > c ? l + c : b.width > c ? l - a.left : l - a.right + b.width) : g < c && (l = e > c ? l - c : b.width > c ? l - a.right + b.width : l - a.left);
- c = a.top;
- b.height - a.top < d && (p = c > d ? p - d : b.height > d ? p - a.bottom + b.height : p - a.top);
- if(CKEDITOR.env.ie) {
- b = a = new CKEDITOR.dom.element(k.$.offsetParent);
- b.getName() == "html" && (b = b.getDocument().getBody());
- b.getComputedStyle("direction") == "rtl" &&
- (l = CKEDITOR.env.ie8Compat ? l - k.getDocument().getDocumentElement().$.scrollLeft * 2 : l - (a.$.scrollWidth - a.$.clientWidth))
- }
- var a = k.getFirst(),
- j;
- (j = a.getCustomData("activePanel")) && j.onHide && j.onHide.call(this, 1);
- a.setCustomData("activePanel", this);
- k.setStyles({
- top: p + "px",
- left: l + "px"
- });
- k.setOpacity(1);
- f && f()
- }, this);
- h.isLoaded ? a() : h.onLoad = a;
- CKEDITOR.tools.setTimeout(function() {
- var a = CKEDITOR.env.webkit && CKEDITOR.document.getWindow().getScrollPosition().y;
- this.focus();
- i.element.focus();
- if(CKEDITOR.env.webkit) CKEDITOR.document.getBody().$.scrollTop =
- a;
- this.allowBlur(true);
- this._.editor.fire("panelShow", this)
- }, 0, this)
- }, CKEDITOR.env.air ? 200 : 0, this);
- this.visible = 1;
- this.onShow && this.onShow.call(this)
- },
- focus: function() {
- if(CKEDITOR.env.webkit) {
- var a = CKEDITOR.document.getActive();
- a && !a.equals(this._.iframe) && a.$.blur()
- }(this._.lastFocused || this._.iframe.getFrameDocument().getWindow()).focus()
- },
- blur: function() {
- var a = this._.iframe.getFrameDocument().getActive();
- a && a.is("a") && (this._.lastFocused = a)
- },
- hide: function(a) {
- if(this.visible && (!this.onHide || this.onHide.call(this) !==
- true)) {
- this.hideChild();
- CKEDITOR.env.gecko && this._.iframe.getFrameDocument().$.activeElement.blur();
- this.element.setStyle("display", "none");
- this.visible = 0;
- this.element.getFirst().removeCustomData("activePanel");
- if(a = a && this._.returnFocus) {
- CKEDITOR.env.webkit && a.type && a.getWindow().$.focus();
- a.focus()
- }
- delete this._.lastFocused;
- this._.editor.fire("panelHide", this)
- }
- },
- allowBlur: function(a) {
- var g = this._.panel;
- if(a !== void 0) g.allowBlur = a;
- return g.allowBlur
- },
- showAsChild: function(a, g, c, d, e, f) {
- if(!(this._.activeChild ==
- a && a._.panel._.offsetParentId == c.getId())) {
- this.hideChild();
- a.onHide = CKEDITOR.tools.bind(function() {
- CKEDITOR.tools.setTimeout(function() {
- this._.focused || this.hide()
- }, 0, this)
- }, this);
- this._.activeChild = a;
- this._.focused = false;
- a.showBlock(g, c, d, e, f);
- this.blur();
- (CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat) && setTimeout(function() {
- a.element.getChild(0).$.style.cssText += ""
- }, 100)
- }
- },
- hideChild: function(a) {
- var g = this._.activeChild;
- if(g) {
- delete g.onHide;
- delete this._.activeChild;
- g.hide();
- a && this.focus()
- }
- }
- }
- });
- CKEDITOR.on("instanceDestroyed", function() {
- var a = CKEDITOR.tools.isEmpty(CKEDITOR.instances),
- g;
- for(g in e) {
- var c = e[g];
- a ? c.destroy() : c.element.hide()
- }
- a && (e = {})
- })
- }(), CKEDITOR.plugins.add("menu", {
- requires: "floatpanel",
- beforeInit: function(a) {
- for(var e = a.config.menu_groups.split(","), b = a._.menuGroups = {}, g = a._.menuItems = {}, c = 0; c < e.length; c++) b[e[c]] = c + 1;
- a.addMenuGroup = function(a, c) {
- b[a] = c || 100
- };
- a.addMenuItem = function(a, c) {
- b[c.group] && (g[a] = new CKEDITOR.menuItem(this, a, c))
- };
- a.addMenuItems = function(a) {
- for(var b in a) this.addMenuItem(b,
- a[b])
- };
- a.getMenuItem = function(a) {
- return g[a]
- };
- a.removeMenuItem = function(a) {
- delete g[a]
- }
- }
- }),
- function() {
- function a(a) {
- a.sort(function(a, b) {
- return a.group < b.group ? -1 : a.group > b.group ? 1 : a.order < b.order ? -1 : a.order > b.order ? 1 : 0
- })
- }
- var e = '<span class="cke_menuitem"><a id="{id}" class="cke_menubutton cke_menubutton__{name} cke_menubutton_{state} {cls}" href="{href}" title="{title}" tabindex="-1"_cke_focus=1 hidefocus="true" role="{role}" aria-haspopup="{hasPopup}" aria-disabled="{disabled}" {ariaChecked}';
- CKEDITOR.env.gecko &&
- CKEDITOR.env.mac && (e = e + ' onkeypress="return false;"');
- CKEDITOR.env.gecko && (e = e + ' onblur="this.style.cssText = this.style.cssText;"');
- var e = e + (' onmouseover="CKEDITOR.tools.callFunction({hoverFn},{index});" onmouseout="CKEDITOR.tools.callFunction({moveOutFn},{index});" ' + (CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : "onclick") + '="CKEDITOR.tools.callFunction({clickFn},{index}); return false;">'),
- b = CKEDITOR.addTemplate("menuItem", e + '<span class="cke_menubutton_inner"><span class="cke_menubutton_icon"><span class="cke_button_icon cke_button__{iconName}_icon" style="{iconStyle}"></span></span><span class="cke_menubutton_label">{label}</span>{arrowHtml}</span></a></span>'),
- g = CKEDITOR.addTemplate("menuArrow", '<span class="cke_menuarrow"><span>{label}</span></span>');
- CKEDITOR.menu = CKEDITOR.tools.createClass({
- $: function(a, b) {
- b = this._.definition = b || {};
- this.id = CKEDITOR.tools.getNextId();
- this.editor = a;
- this.items = [];
- this._.listeners = [];
- this._.level = b.level || 1;
- var g = CKEDITOR.tools.extend({}, b.panel, {
- css: [CKEDITOR.skin.getPath("editor")],
- level: this._.level - 1,
- block: {}
- }),
- f = g.block.attributes = g.attributes || {};
- !f.role && (f.role = "menu");
- this._.panelDefinition = g
- },
- _: {
- onShow: function() {
- var a =
- this.editor.getSelection(),
- b = a && a.getStartElement(),
- g = this.editor.elementPath(),
- f = this._.listeners;
- this.removeAll();
- for(var e = 0; e < f.length; e++) {
- var i = f[e](b, a, g);
- if(i)
- for(var k in i) {
- var n = this.editor.getMenuItem(k);
- if(n && (!n.command || this.editor.getCommand(n.command).state)) {
- n.state = i[k];
- this.add(n)
- }
- }
- }
- },
- onClick: function(a) {
- this.hide();
- if(a.onClick) a.onClick();
- else a.command && this.editor.execCommand(a.command)
- },
- onEscape: function(a) {
- var b = this.parent;
- b ? b._.panel.hideChild(1) : a == 27 && this.hide(1);
- return false
- },
- onHide: function() {
- this.onHide && this.onHide()
- },
- showSubMenu: function(a) {
- var b = this._.subMenu,
- g = this.items[a];
- if(g = g.getItems && g.getItems()) {
- if(b) b.removeAll();
- else {
- b = this._.subMenu = new CKEDITOR.menu(this.editor, CKEDITOR.tools.extend({}, this._.definition, {
- level: this._.level + 1
- }, true));
- b.parent = this;
- b._.onClick = CKEDITOR.tools.bind(this._.onClick, this)
- }
- for(var f in g) {
- var e = this.editor.getMenuItem(f);
- if(e) {
- e.state = g[f];
- b.add(e)
- }
- }
- var i = this._.panel.getBlock(this.id).element.getDocument().getById(this.id +
- ("" + a));
- setTimeout(function() {
- b.show(i, 2)
- }, 0)
- } else this._.panel.hideChild(1)
- }
- },
- proto: {
- add: function(a) {
- if(!a.order) a.order = this.items.length;
- this.items.push(a)
- },
- removeAll: function() {
- this.items = []
- },
- show: function(b, d, g, f) {
- if(!this.parent) {
- this._.onShow();
- if(!this.items.length) return
- }
- var d = d || (this.editor.lang.dir == "rtl" ? 2 : 1),
- e = this.items,
- i = this.editor,
- k = this._.panel,
- n = this._.element;
- if(!k) {
- k = this._.panel = new CKEDITOR.ui.floatPanel(this.editor, CKEDITOR.document.getBody(), this._.panelDefinition, this._.level);
- k.onEscape = CKEDITOR.tools.bind(function(a) {
- if(this._.onEscape(a) === false) return false
- }, this);
- k.onShow = function() {
- k._.panel.getHolderElement().getParent().addClass("cke cke_reset_all")
- };
- k.onHide = CKEDITOR.tools.bind(function() {
- this._.onHide && this._.onHide()
- }, this);
- n = k.addBlock(this.id, this._.panelDefinition.block);
- n.autoSize = true;
- var o = n.keys;
- o[40] = "next";
- o[9] = "next";
- o[38] = "prev";
- o[CKEDITOR.SHIFT + 9] = "prev";
- o[i.lang.dir == "rtl" ? 37 : 39] = CKEDITOR.env.ie ? "mouseup" : "click";
- o[32] = CKEDITOR.env.ie ? "mouseup" :
- "click";
- CKEDITOR.env.ie && (o[13] = "mouseup");
- n = this._.element = n.element;
- o = n.getDocument();
- o.getBody().setStyle("overflow", "hidden");
- o.getElementsByTag("html").getItem(0).setStyle("overflow", "hidden");
- this._.itemOverFn = CKEDITOR.tools.addFunction(function(a) {
- clearTimeout(this._.showSubTimeout);
- this._.showSubTimeout = CKEDITOR.tools.setTimeout(this._.showSubMenu, i.config.menu_subMenuDelay || 400, this, [a])
- }, this);
- this._.itemOutFn = CKEDITOR.tools.addFunction(function() {
- clearTimeout(this._.showSubTimeout)
- }, this);
- this._.itemClickFn = CKEDITOR.tools.addFunction(function(a) {
- var b = this.items[a];
- if(b.state == CKEDITOR.TRISTATE_DISABLED) this.hide(1);
- else if(b.getItems) this._.showSubMenu(a);
- else this._.onClick(b)
- }, this)
- }
- a(e);
- for(var o = i.elementPath(), o = ['<div class="cke_menu' + (o && o.direction() != i.lang.dir ? " cke_mixed_dir_content" : "") + '" role="presentation">'], q = e.length, m = q && e[0].group, l = 0; l < q; l++) {
- var p = e[l];
- if(m != p.group) {
- o.push('<div class="cke_menuseparator" role="separator"></div>');
- m = p.group
- }
- p.render(this, l, o)
- }
- o.push("</div>");
- n.setHtml(o.join(""));
- CKEDITOR.ui.fire("ready", this);
- this.parent ? this.parent._.panel.showAsChild(k, this.id, b, d, g, f) : k.showBlock(this.id, b, d, g, f);
- i.fire("menuShow", [k])
- },
- addListener: function(a) {
- this._.listeners.push(a)
- },
- hide: function(a) {
- this._.onHide && this._.onHide();
- this._.panel && this._.panel.hide(a)
- }
- }
- });
- CKEDITOR.menuItem = CKEDITOR.tools.createClass({
- $: function(a, b, g) {
- CKEDITOR.tools.extend(this, g, {
- order: 0,
- className: "cke_menubutton__" + b
- });
- this.group = a._.menuGroups[this.group];
- this.editor = a;
- this.name =
- b
- },
- proto: {
- render: function(a, d, e) {
- var f = a.id + ("" + d),
- h = typeof this.state == "undefined" ? CKEDITOR.TRISTATE_OFF : this.state,
- i = "",
- k = h == CKEDITOR.TRISTATE_ON ? "on" : h == CKEDITOR.TRISTATE_DISABLED ? "disabled" : "off";
- this.role in {
- menuitemcheckbox: 1,
- menuitemradio: 1
- } && (i = ' aria-checked="' + (h == CKEDITOR.TRISTATE_ON ? "true" : "false") + '"');
- var n = this.getItems,
- o = "&#" + (this.editor.lang.dir == "rtl" ? "9668" : "9658") + ";",
- q = this.name;
- if(this.icon && !/\./.test(this.icon)) q = this.icon;
- a = {
- id: f,
- name: this.name,
- iconName: q,
- label: this.label,
- cls: this.className || "",
- state: k,
- hasPopup: n ? "true" : "false",
- disabled: h == CKEDITOR.TRISTATE_DISABLED,
- title: this.label,
- href: "javascript:void('" + (this.label || "").replace("'") + "')",
- hoverFn: a._.itemOverFn,
- moveOutFn: a._.itemOutFn,
- clickFn: a._.itemClickFn,
- index: d,
- iconStyle: CKEDITOR.skin.getIconStyle(q, this.editor.lang.dir == "rtl", q == this.icon ? null : this.icon, this.iconOffset),
- arrowHtml: n ? g.output({
- label: o
- }) : "",
- role: this.role ? this.role : "menuitem",
- ariaChecked: i
- };
- b.output(a, e)
- }
- }
- })
- }(), CKEDITOR.config.menu_groups = "clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div",
- CKEDITOR.plugins.add("contextmenu", {
- requires: "menu",
- onLoad: function() {
- CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass({
- base: CKEDITOR.menu,
- $: function(a) {
- this.base.call(this, a, {
- panel: {
- className: "cke_menu_panel",
- attributes: {
- "aria-label": a.lang.contextmenu.options
- }
- }
- })
- },
- proto: {
- addTarget: function(a, e) {
- a.on("contextmenu", function(a) {
- var a = a.data,
- d = CKEDITOR.env.webkit ? b : CKEDITOR.env.mac ? a.$.metaKey : a.$.ctrlKey;
- if(!e || !d) {
- a.preventDefault();
- if(CKEDITOR.env.mac && CKEDITOR.env.webkit) {
- var d = this.editor,
- g = (new CKEDITOR.dom.elementPath(a.getTarget(), d.editable())).contains(function(a) {
- return a.hasAttribute("contenteditable")
- }, true);
- g && g.getAttribute("contenteditable") == "false" && d.getSelection().fake(g)
- }
- var g = a.getTarget().getDocument(),
- f = a.getTarget().getDocument().getDocumentElement(),
- d = !g.equals(CKEDITOR.document),
- g = g.getWindow().getScrollPosition(),
- h = d ? a.$.clientX : a.$.pageX || g.x + a.$.clientX,
- i = d ? a.$.clientY : a.$.pageY || g.y + a.$.clientY;
- CKEDITOR.tools.setTimeout(function() {
- this.open(f, null, h, i)
- }, CKEDITOR.env.ie ?
- 200 : 0, this)
- }
- }, this);
- if(CKEDITOR.env.webkit) {
- var b, g = function() {
- b = 0
- };
- a.on("keydown", function(a) {
- b = CKEDITOR.env.mac ? a.data.$.metaKey : a.data.$.ctrlKey
- });
- a.on("keyup", g);
- a.on("contextmenu", g)
- }
- },
- open: function(a, e, b, g) {
- this.editor.focus();
- a = a || CKEDITOR.document.getDocumentElement();
- this.editor.selectionChange(1);
- this.show(a, e, b, g)
- }
- }
- })
- },
- beforeInit: function(a) {
- var e = a.contextMenu = new CKEDITOR.plugins.contextMenu(a);
- a.on("contentDom", function() {
- e.addTarget(a.editable(), a.config.browserContextMenuOnCtrl !==
- false)
- });
- a.addCommand("contextMenu", {
- exec: function() {
- a.contextMenu.open(a.document.getBody())
- }
- });
- a.setKeystroke(CKEDITOR.SHIFT + 121, "contextMenu");
- a.setKeystroke(CKEDITOR.CTRL + CKEDITOR.SHIFT + 121, "contextMenu")
- }
- }),
- function() {
- var a;
- function e(d, g) {
- function f(a) {
- a = n.list[a];
- if(a.equals(d.editable()) || a.getAttribute("contenteditable") == "true") {
- var b = d.createRange();
- b.selectNodeContents(a);
- b.select()
- } else d.getSelection().selectElement(a);
- d.focus()
- }
- function e() {
- k && k.setHtml(b);
- delete n.list
- }
- var i = d.ui.spaceId("path"),
- k, n = d._.elementsPath,
- o = n.idBase;
- g.html = g.html + ('<span id="' + i + '_label" class="cke_voice_label">' + d.lang.elementspath.eleLabel + '</span><span id="' + i + '" class="cke_path" role="group" aria-labelledby="' + i + '_label">' + b + "</span>");
- d.on("uiReady", function() {
- var a = d.ui.space("path");
- a && d.focusManager.add(a, 1)
- });
- n.onClick = f;
- var q = CKEDITOR.tools.addFunction(f),
- m = CKEDITOR.tools.addFunction(function(a, b) {
- var c = n.idBase,
- g, b = new CKEDITOR.dom.event(b);
- g = d.lang.dir == "rtl";
- switch(b.getKeystroke()) {
- case g ? 39:
- 37:
- case 9:
- (g =
- CKEDITOR.document.getById(c + (a + 1))) || (g = CKEDITOR.document.getById(c + "0"));
- g.focus();
- return false;
- case g ? 37:
- 39:
- case CKEDITOR.SHIFT + 9:
- (g = CKEDITOR.document.getById(c + (a - 1))) || (g = CKEDITOR.document.getById(c + (n.list.length - 1)));
- g.focus();
- return false;
- case 27:
- d.focus();
- return false;
- case 13:
- case 32:
- f(a);
- return false
- }
- return true
- });
- d.on("selectionChange", function() {
- for(var a = [], f = n.list = [], g = [], e = n.filters, h = true, j = d.elementPath().elements, x, v = j.length; v--;) {
- var r = j[v],
- y = 0;
- x = r.data("cke-display-name") ? r.data("cke-display-name") :
- r.data("cke-real-element-type") ? r.data("cke-real-element-type") : r.getName();
- h = r.hasAttribute("contenteditable") ? r.getAttribute("contenteditable") == "true" : h;
- !h && !r.hasAttribute("contenteditable") && (y = 1);
- for(var z = 0; z < e.length; z++) {
- var B = e[z](r, x);
- if(B === false) {
- y = 1;
- break
- }
- x = B || x
- }
- if(!y) {
- f.unshift(r);
- g.unshift(x)
- }
- }
- f = f.length;
- for(e = 0; e < f; e++) {
- x = g[e];
- h = d.lang.elementspath.eleTitle.replace(/%1/, x);
- x = c.output({
- id: o + e,
- label: h,
- text: x,
- jsTitle: "javascript:void('" + x + "')",
- index: e,
- keyDownFn: m,
- clickFn: q
- });
- a.unshift(x)
- }
- k ||
- (k = CKEDITOR.document.getById(i));
- g = k;
- g.setHtml(a.join("") + b);
- d.fire("elementsPathUpdate", {
- space: g
- })
- });
- d.on("readOnly", e);
- d.on("contentDomUnload", e);
- d.addCommand("elementsPathFocus", a);
- d.setKeystroke(CKEDITOR.ALT + 122, "elementsPathFocus")
- }
- a = {
- editorFocus: false,
- readOnly: 1,
- exec: function(a) {
- (a = CKEDITOR.document.getById(a._.elementsPath.idBase + "0")) && a.focus(CKEDITOR.env.ie || CKEDITOR.env.air)
- }
- };
- var b = '<span class="cke_path_empty"> </span>',
- g = "";
- CKEDITOR.env.gecko && CKEDITOR.env.mac && (g = g + ' onkeypress="return false;"');
- CKEDITOR.env.gecko && (g = g + ' onblur="this.style.cssText = this.style.cssText;"');
- var c = CKEDITOR.addTemplate("pathItem", '<a id="{id}" href="{jsTitle}" tabindex="-1" class="cke_path_item" title="{label}"' + g + ' hidefocus="true" onkeydown="return CKEDITOR.tools.callFunction({keyDownFn},{index}, event );" onclick="CKEDITOR.tools.callFunction({clickFn},{index}); return false;" role="button" aria-label="{label}">{text}</a>');
- CKEDITOR.plugins.add("elementspath", {
- init: function(a) {
- a._.elementsPath = {
- idBase: "cke_elementspath_" +
- CKEDITOR.tools.getNextNumber() + "_",
- filters: []
- };
- a.on("uiSpace", function(b) {
- b.data.space == "bottom" && e(a, b.data)
- })
- }
- })
- }(),
- function() {
- function a(a, c) {
- var d, j;
- c.on("refresh", function(a) {
- var c = [e],
- d;
- for(d in a.data.states) c.push(a.data.states[d]);
- this.setState(CKEDITOR.tools.search(c, b) ? b : e)
- }, c, null, 100);
- c.on("exec", function(b) {
- d = a.getSelection();
- j = d.createBookmarks(1);
- if(!b.data) b.data = {};
- b.data.done = false
- }, c, null, 0);
- c.on("exec", function() {
- a.forceNextSelectionCheck();
- d.selectBookmarks(j)
- }, c, null, 100)
- }
- var e =
- CKEDITOR.TRISTATE_DISABLED,
- b = CKEDITOR.TRISTATE_OFF;
- CKEDITOR.plugins.add("indent", {
- init: function(b) {
- var c = CKEDITOR.plugins.indent.genericDefinition;
- a(b, b.addCommand("indent", new c(true)));
- a(b, b.addCommand("outdent", new c));
- if(b.ui.addButton) {
- b.ui.addButton("Indent", {
- label: b.lang.indent.indent,
- command: "indent",
- directional: true,
- toolbar: "indent,20"
- });
- b.ui.addButton("Outdent", {
- label: b.lang.indent.outdent,
- command: "outdent",
- directional: true,
- toolbar: "indent,10"
- })
- }
- b.on("dirChanged", function(a) {
- var c = b.createRange(),
- f = a.data.node;
- c.setStartBefore(f);
- c.setEndAfter(f);
- for(var e = new CKEDITOR.dom.walker(c), i; i = e.next();)
- if(i.type == CKEDITOR.NODE_ELEMENT)
- if(!i.equals(f) && i.getDirection()) {
- c.setStartAfter(i);
- e = new CKEDITOR.dom.walker(c)
- } else {
- var k = b.config.indentClasses;
- if(k)
- for(var n = a.data.dir == "ltr" ? ["_rtl", ""] : ["", "_rtl"], o = 0; o < k.length; o++)
- if(i.hasClass(k[o] + n[0])) {
- i.removeClass(k[o] + n[0]);
- i.addClass(k[o] + n[1])
- }
- k = i.getStyle("margin-right");
- n = i.getStyle("margin-left");
- k ? i.setStyle("margin-left", k) : i.removeStyle("margin-left");
- n ? i.setStyle("margin-right", n) : i.removeStyle("margin-right")
- }
- })
- }
- });
- CKEDITOR.plugins.indent = {
- genericDefinition: function(a) {
- this.isIndent = !!a;
- this.startDisabled = !this.isIndent
- },
- specificDefinition: function(a, b, d) {
- this.name = b;
- this.editor = a;
- this.jobs = {};
- this.enterBr = a.config.enterMode == CKEDITOR.ENTER_BR;
- this.isIndent = !!d;
- this.relatedGlobal = d ? "indent" : "outdent";
- this.indentKey = d ? 9 : CKEDITOR.SHIFT + 9;
- this.database = {}
- },
- registerCommands: function(a, b) {
- a.on("pluginsLoaded", function() {
- for(var a in b)(function(a,
- b) {
- var c = a.getCommand(b.relatedGlobal),
- d;
- for(d in b.jobs) {
- c.on("exec", function(c) {
- if(!c.data.done) {
- a.fire("lockSnapshot");
- if(b.execJob(a, d)) c.data.done = true;
- a.fire("unlockSnapshot");
- CKEDITOR.dom.element.clearAllMarkers(b.database)
- }
- }, this, null, d);
- c.on("refresh", function(c) {
- if(!c.data.states) c.data.states = {};
- c.data.states[b.name + "@" + d] = b.refreshJob(a, d, c.data.path)
- }, this, null, d)
- }
- a.addFeature(b)
- })(this, b[a])
- })
- }
- };
- CKEDITOR.plugins.indent.genericDefinition.prototype = {
- context: "p",
- exec: function() {}
- };
- CKEDITOR.plugins.indent.specificDefinition.prototype = {
- execJob: function(a, b) {
- var d = this.jobs[b];
- if(d.state != e) return d.exec.call(this, a)
- },
- refreshJob: function(a, b, d) {
- b = this.jobs[b];
- b.state = a.activeFilter.checkFeature(this) ? b.refresh.call(this, a, d) : e;
- return b.state
- },
- getContext: function(a) {
- return a.contains(this.context)
- }
- }
- }(),
- function() {
- function a(a) {
- function c(e) {
- for(var h = q.startContainer, m = q.endContainer; h && !h.getParent().equals(e);) h = h.getParent();
- for(; m && !m.getParent().equals(e);) m = m.getParent();
- if(!h || !m) return false;
- for(var l = h, h = [], o = false; !o;) {
- l.equals(m) &&
- (o = true);
- h.push(l);
- l = l.getNext()
- }
- if(h.length < 1) return false;
- l = e.getParents(true);
- for(m = 0; m < l.length; m++)
- if(l[m].getName && j[l[m].getName()]) {
- e = l[m];
- break
- }
- for(var l = d.isIndent ? 1 : -1, m = h[0], h = h[h.length - 1], o = CKEDITOR.plugins.list.listToArray(e, g), x = o[h.getCustomData("listarray_index")].indent, m = m.getCustomData("listarray_index"); m <= h.getCustomData("listarray_index"); m++) {
- o[m].indent = o[m].indent + l;
- if(l > 0) {
- var v = o[m].parent;
- o[m].parent = new CKEDITOR.dom.element(v.getName(), v.getDocument())
- }
- }
- for(m = h.getCustomData("listarray_index") +
- 1; m < o.length && o[m].indent > x; m++) o[m].indent = o[m].indent + l;
- h = CKEDITOR.plugins.list.arrayToList(o, g, null, a.config.enterMode, e.getDirection());
- if(!d.isIndent) {
- var r;
- if((r = e.getParent()) && r.is("li"))
- for(var l = h.listNode.getChildren(), y = [], z, m = l.count() - 1; m >= 0; m--)(z = l.getItem(m)) && (z.is && z.is("li")) && y.push(z)
- }
- h && h.listNode.replace(e);
- if(y && y.length)
- for(m = 0; m < y.length; m++) {
- for(z = e = y[m];
- (z = z.getNext()) && z.is && z.getName() in j;) {
- CKEDITOR.env.needsNbspFiller && !e.getFirst(b) && e.append(q.document.createText(" "));
- e.append(z)
- }
- e.insertAfter(r)
- }
- h && a.fire("contentDomInvalidated");
- return true
- }
- for(var d = this, g = this.database, j = this.context, o = a.getSelection(), o = (o && o.getRanges()).createIterator(), q; q = o.getNextRange();) {
- for(var m = q.getCommonAncestor(); m && !(m.type == CKEDITOR.NODE_ELEMENT && j[m.getName()]);) m = m.getParent();
- m || (m = q.startPath().contains(j)) && q.setEndAt(m, CKEDITOR.POSITION_BEFORE_END);
- if(!m) {
- var l = q.getEnclosedNode();
- if(l && l.type == CKEDITOR.NODE_ELEMENT && l.getName() in j) {
- q.setStartAt(l, CKEDITOR.POSITION_AFTER_START);
- q.setEndAt(l, CKEDITOR.POSITION_BEFORE_END);
- m = l
- }
- }
- if(m && q.startContainer.type == CKEDITOR.NODE_ELEMENT && q.startContainer.getName() in j) {
- l = new CKEDITOR.dom.walker(q);
- l.evaluator = e;
- q.startContainer = l.next()
- }
- if(m && q.endContainer.type == CKEDITOR.NODE_ELEMENT && q.endContainer.getName() in j) {
- l = new CKEDITOR.dom.walker(q);
- l.evaluator = e;
- q.endContainer = l.previous()
- }
- if(m) return c(m)
- }
- return 0
- }
- function e(a) {
- return a.type == CKEDITOR.NODE_ELEMENT && a.is("li")
- }
- function b(a) {
- return g(a) && c(a)
- }
- var g = CKEDITOR.dom.walker.whitespaces(true),
- c = CKEDITOR.dom.walker.bookmark(false, true),
- d = CKEDITOR.TRISTATE_DISABLED,
- j = CKEDITOR.TRISTATE_OFF;
- CKEDITOR.plugins.add("indentlist", {
- requires: "indent",
- init: function(b) {
- function c(b) {
- e.specificDefinition.apply(this, arguments);
- this.requiredContent = ["ul", "ol"];
- b.on("key", function(a) {
- if(b.mode == "wysiwyg" && a.data.keyCode == this.indentKey) {
- var c = this.getContext(b.elementPath());
- if(c && (!this.isIndent || !CKEDITOR.plugins.indentList.firstItemInPath(this.context, b.elementPath(), c))) {
- b.execCommand(this.relatedGlobal);
- a.cancel()
- }
- }
- }, this);
- this.jobs[this.isIndent ? 10 : 30] = {
- refresh: this.isIndent ? function(a, b) {
- var c = this.getContext(b),
- f = CKEDITOR.plugins.indentList.firstItemInPath(this.context, b, c);
- return !c || !this.isIndent || f ? d : j
- } : function(a, b) {
- return !this.getContext(b) || this.isIndent ? d : j
- },
- exec: CKEDITOR.tools.bind(a, this)
- }
- }
- var e = CKEDITOR.plugins.indent;
- e.registerCommands(b, {
- indentlist: new c(b, "indentlist", true),
- outdentlist: new c(b, "outdentlist")
- });
- CKEDITOR.tools.extend(c.prototype, e.specificDefinition.prototype, {
- context: {
- ol: 1,
- ul: 1
- }
- })
- }
- });
- CKEDITOR.plugins.indentList = {};
- CKEDITOR.plugins.indentList.firstItemInPath = function(a, b, c) {
- var d = b.contains(e);
- c || (c = b.contains(a));
- return c && d && d.equals(c.getFirst(e))
- }
- }(),
- function() {
- function a(a, b, c) {
- function d(c) {
- if((j = i[c ? "getFirst" : "getLast"]()) && (!j.is || !j.isBlockBoundary()) && (k = b.root[c ? "getPrevious" : "getNext"](CKEDITOR.dom.walker.invisible(true))) && (!k.is || !k.isBlockBoundary({
- br: 1
- }))) a.document.createElement("br")[c ? "insertBefore" : "insertAfter"](j)
- }
- for(var f = CKEDITOR.plugins.list.listToArray(b.root,
- c), e = [], g = 0; g < b.contents.length; g++) {
- var h = b.contents[g];
- if((h = h.getAscendant("li", true)) && !h.getCustomData("list_item_processed")) {
- e.push(h);
- CKEDITOR.dom.element.setMarker(c, h, "list_item_processed", true)
- }
- }
- h = null;
- for(g = 0; g < e.length; g++) {
- h = e[g].getCustomData("listarray_index");
- f[h].indent = -1
- }
- for(g = h + 1; g < f.length; g++)
- if(f[g].indent > f[g - 1].indent + 1) {
- e = f[g - 1].indent + 1 - f[g].indent;
- for(h = f[g].indent; f[g] && f[g].indent >= h;) {
- f[g].indent = f[g].indent + e;
- g++
- }
- g--
- }
- var i = CKEDITOR.plugins.list.arrayToList(f, c, null,
- a.config.enterMode, b.root.getAttribute("dir")).listNode,
- j, k;
- d(true);
- d();
- i.replace(b.root);
- a.fire("contentDomInvalidated")
- }
- function e(a, b) {
- this.name = a;
- this.context = this.type = b;
- this.allowedContent = b + " li";
- this.requiredContent = b
- }
- function b(a, b, c, d) {
- for(var f, g; f = a[d ? "getLast" : "getFirst"](q);) {
- (g = f.getDirection(1)) !== b.getDirection(1) && f.setAttribute("dir", g);
- f.remove();
- c ? f[d ? "insertBefore" : "insertAfter"](c) : b.append(f, d)
- }
- }
- function g(a) {
- function c(d) {
- var f = a[d ? "getPrevious" : "getNext"](k);
- if(f && f.type ==
- CKEDITOR.NODE_ELEMENT && f.is(a.getName())) {
- b(a, f, null, !d);
- a.remove();
- a = f
- }
- }
- c();
- c(1)
- }
- function c(a) {
- return a.type == CKEDITOR.NODE_ELEMENT && (a.getName() in CKEDITOR.dtd.$block || a.getName() in CKEDITOR.dtd.$listItem) && CKEDITOR.dtd[a.getName()]["#"]
- }
- function d(a, c, d) {
- a.fire("saveSnapshot");
- d.enlarge(CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS);
- var f = d.extractContents();
- c.trim(false, true);
- var e = c.createBookmark(),
- h = new CKEDITOR.dom.elementPath(c.startContainer),
- i = h.block,
- h = h.lastElement.getAscendant("li", 1) || i,
- q = new CKEDITOR.dom.elementPath(d.startContainer),
- o = q.contains(CKEDITOR.dtd.$listItem),
- q = q.contains(CKEDITOR.dtd.$list);
- if(i)(i = i.getBogus()) && i.remove();
- else if(q)(i = q.getPrevious(k)) && n(i) && i.remove();
- (i = f.getLast()) && (i.type == CKEDITOR.NODE_ELEMENT && i.is("br")) && i.remove();
- (i = c.startContainer.getChild(c.startOffset)) ? f.insertBefore(i): c.startContainer.append(f);
- if(o)
- if(f = j(o))
- if(h.contains(o)) {
- b(f, o.getParent(), o);
- f.remove()
- } else h.append(f);
- for(; d.checkStartOfBlock() && d.checkEndOfBlock();) {
- q = d.startPath();
- f = q.block;
- if(!f) break;
- if(f.is("li")) {
- h =
- f.getParent();
- f.equals(h.getLast(k)) && f.equals(h.getFirst(k)) && (f = h)
- }
- d.moveToPosition(f, CKEDITOR.POSITION_BEFORE_START);
- f.remove()
- }
- d = d.clone();
- f = a.editable();
- d.setEndAt(f, CKEDITOR.POSITION_BEFORE_END);
- d = new CKEDITOR.dom.walker(d);
- d.evaluator = function(a) {
- return k(a) && !n(a)
- };
- (d = d.next()) && (d.type == CKEDITOR.NODE_ELEMENT && d.getName() in CKEDITOR.dtd.$list) && g(d);
- c.moveToBookmark(e);
- c.select();
- a.fire("saveSnapshot")
- }
- function j(a) {
- return(a = a.getLast(k)) && a.type == CKEDITOR.NODE_ELEMENT && a.getName() in f ? a :
- null
- }
- var f = {
- ol: 1,
- ul: 1
- },
- h = CKEDITOR.dom.walker.whitespaces(),
- i = CKEDITOR.dom.walker.bookmark(),
- k = function(a) {
- return !(h(a) || i(a))
- },
- n = CKEDITOR.dom.walker.bogus();
- CKEDITOR.plugins.list = {
- listToArray: function(a, b, c, d, g) {
- if(!f[a.getName()]) return [];
- d || (d = 0);
- c || (c = []);
- for(var e = 0, h = a.getChildCount(); e < h; e++) {
- var i = a.getChild(e);
- i.type == CKEDITOR.NODE_ELEMENT && i.getName() in CKEDITOR.dtd.$list && CKEDITOR.plugins.list.listToArray(i, b, c, d + 1);
- if(i.$.nodeName.toLowerCase() == "li") {
- var j = {
- parent: a,
- indent: d,
- element: i,
- contents: []
- };
- if(g) j.grandparent = g;
- else {
- j.grandparent = a.getParent();
- if(j.grandparent && j.grandparent.$.nodeName.toLowerCase() == "li") j.grandparent = j.grandparent.getParent()
- }
- b && CKEDITOR.dom.element.setMarker(b, i, "listarray_index", c.length);
- c.push(j);
- for(var k = 0, n = i.getChildCount(), q; k < n; k++) {
- q = i.getChild(k);
- q.type == CKEDITOR.NODE_ELEMENT && f[q.getName()] ? CKEDITOR.plugins.list.listToArray(q, b, c, d + 1, j.grandparent) : j.contents.push(q)
- }
- }
- }
- return c
- },
- arrayToList: function(a, b, c, d, g) {
- c || (c = 0);
- if(!a || a.length < c + 1) return null;
- for(var e, h = a[c].parent.getDocument(), j = new CKEDITOR.dom.documentFragment(h), n = null, q = c, o = Math.max(a[c].indent, 0), z = null, B, A, G = d == CKEDITOR.ENTER_P ? "p" : "div";;) {
- var D = a[q];
- e = D.grandparent;
- B = D.element.getDirection(1);
- if(D.indent == o) {
- if(!n || a[q].parent.getName() != n.getName()) {
- n = a[q].parent.clone(false, 1);
- g && n.setAttribute("dir", g);
- j.append(n)
- }
- z = n.append(D.element.clone(0, 1));
- B != n.getDirection(1) && z.setAttribute("dir", B);
- for(e = 0; e < D.contents.length; e++) z.append(D.contents[e].clone(1, 1));
- q++
- } else if(D.indent ==
- Math.max(o, 0) + 1) {
- D = a[q - 1].element.getDirection(1);
- q = CKEDITOR.plugins.list.arrayToList(a, null, q, d, D != B ? B : null);
- !z.getChildCount() && (CKEDITOR.env.needsNbspFiller && h.$.documentMode <= 7) && z.append(h.createText(" "));
- z.append(q.listNode);
- q = q.nextIndex
- } else if(D.indent == -1 && !c && e) {
- if(f[e.getName()]) {
- z = D.element.clone(false, true);
- B != e.getDirection(1) && z.setAttribute("dir", B)
- } else z = new CKEDITOR.dom.documentFragment(h);
- var n = e.getDirection(1) != B,
- J = D.element,
- C = J.getAttribute("class"),
- F = J.getAttribute("style"),
- E = z.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT && (d != CKEDITOR.ENTER_BR || n || F || C),
- I, L = D.contents.length,
- H;
- for(e = 0; e < L; e++) {
- I = D.contents[e];
- if(i(I) && L > 1) E ? H = I.clone(1, 1) : z.append(I.clone(1, 1));
- else if(I.type == CKEDITOR.NODE_ELEMENT && I.isBlockBoundary()) {
- n && !I.getDirection() && I.setAttribute("dir", B);
- A = I;
- var Q = J.getAttribute("style");
- Q && A.setAttribute("style", Q.replace(/([^;])$/, "$1;") + (A.getAttribute("style") || ""));
- C && I.addClass(C);
- A = null;
- if(H) {
- z.append(H);
- H = null
- }
- z.append(I.clone(1, 1))
- } else if(E) {
- if(!A) {
- A =
- h.createElement(G);
- z.append(A);
- n && A.setAttribute("dir", B)
- }
- F && A.setAttribute("style", F);
- C && A.setAttribute("class", C);
- if(H) {
- A.append(H);
- H = null
- }
- A.append(I.clone(1, 1))
- } else z.append(I.clone(1, 1))
- }
- if(H) {
- (A || z).append(H);
- H = null
- }
- if(z.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT && q != a.length - 1) {
- if(CKEDITOR.env.needsBrFiller)(B = z.getLast()) && (B.type == CKEDITOR.NODE_ELEMENT && B.is("br")) && B.remove();
- B = z.getLast(k);
- (!B || !(B.type == CKEDITOR.NODE_ELEMENT && B.is(CKEDITOR.dtd.$block))) && z.append(h.createElement("br"))
- }
- B = z.$.nodeName.toLowerCase();
- (B == "div" || B == "p") && z.appendBogus();
- j.append(z);
- n = null;
- q++
- } else return null;
- A = null;
- if(a.length <= q || Math.max(a[q].indent, 0) < o) break
- }
- if(b)
- for(a = j.getFirst(); a;) {
- if(a.type == CKEDITOR.NODE_ELEMENT) {
- CKEDITOR.dom.element.clearMarkers(b, a);
- if(a.getName() in CKEDITOR.dtd.$listItem) {
- c = a;
- h = g = d = void 0;
- if(d = c.getDirection()) {
- for(g = c.getParent(); g && !(h = g.getDirection());) g = g.getParent();
- d == h && c.removeAttribute("dir")
- }
- }
- }
- a = a.getNextSourceNode()
- }
- return {
- listNode: j,
- nextIndex: q
- }
- }
- };
- var o = /^h[1-6]$/,
- q = CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_ELEMENT);
- e.prototype = {
- exec: function(b) {
- this.refresh(b, b.elementPath());
- var c = b.config,
- d = b.getSelection(),
- e = d && d.getRanges();
- if(this.state == CKEDITOR.TRISTATE_OFF) {
- var h = b.editable();
- if(h.getFirst(k)) {
- var i = e.length == 1 && e[0];
- (c = i && i.getEnclosedNode()) && (c.is && this.type == c.getName()) && this.setState(CKEDITOR.TRISTATE_ON)
- } else {
- c.enterMode == CKEDITOR.ENTER_BR ? h.appendBogus() : e[0].fixBlock(1, c.enterMode == CKEDITOR.ENTER_P ? "p" : "div");
- d.selectRanges(e)
- }
- }
- for(var c = d.createBookmarks(true), h = [], j = {}, e = e.createIterator(),
- n = 0;
- (i = e.getNextRange()) && ++n;) {
- var q = i.getBoundaryNodes(),
- r = q.startNode,
- y = q.endNode;
- r.type == CKEDITOR.NODE_ELEMENT && r.getName() == "td" && i.setStartAt(q.startNode, CKEDITOR.POSITION_AFTER_START);
- y.type == CKEDITOR.NODE_ELEMENT && y.getName() == "td" && i.setEndAt(q.endNode, CKEDITOR.POSITION_BEFORE_END);
- i = i.createIterator();
- for(i.forceBrBreak = this.state == CKEDITOR.TRISTATE_OFF; q = i.getNextParagraph();)
- if(!q.getCustomData("list_block")) {
- CKEDITOR.dom.element.setMarker(j, q, "list_block", 1);
- for(var z = b.elementPath(q),
- r = z.elements, y = 0, z = z.blockLimit, B, A = r.length - 1; A >= 0 && (B = r[A]); A--)
- if(f[B.getName()] && z.contains(B)) {
- z.removeCustomData("list_group_object_" + n);
- if(r = B.getCustomData("list_group_object")) r.contents.push(q);
- else {
- r = {
- root: B,
- contents: [q]
- };
- h.push(r);
- CKEDITOR.dom.element.setMarker(j, B, "list_group_object", r)
- }
- y = 1;
- break
- }
- if(!y) {
- y = z;
- if(y.getCustomData("list_group_object_" + n)) y.getCustomData("list_group_object_" + n).contents.push(q);
- else {
- r = {
- root: y,
- contents: [q]
- };
- CKEDITOR.dom.element.setMarker(j, y, "list_group_object_" +
- n, r);
- h.push(r)
- }
- }
- }
- }
- for(B = []; h.length > 0;) {
- r = h.shift();
- if(this.state == CKEDITOR.TRISTATE_OFF)
- if(f[r.root.getName()]) {
- e = b;
- n = r;
- r = j;
- i = B;
- y = CKEDITOR.plugins.list.listToArray(n.root, r);
- z = [];
- for(q = 0; q < n.contents.length; q++) {
- A = n.contents[q];
- if((A = A.getAscendant("li", true)) && !A.getCustomData("list_item_processed")) {
- z.push(A);
- CKEDITOR.dom.element.setMarker(r, A, "list_item_processed", true)
- }
- }
- for(var A = n.root.getDocument(), G = void 0, D = void 0, q = 0; q < z.length; q++) {
- var J = z[q].getCustomData("listarray_index"),
- G = y[J].parent;
- if(!G.is(this.type)) {
- D = A.createElement(this.type);
- G.copyAttributes(D, {
- start: 1,
- type: 1
- });
- D.removeStyle("list-style-type");
- y[J].parent = D
- }
- }
- r = CKEDITOR.plugins.list.arrayToList(y, r, null, e.config.enterMode);
- y = void 0;
- z = r.listNode.getChildCount();
- for(q = 0; q < z && (y = r.listNode.getChild(q)); q++) y.getName() == this.type && i.push(y);
- r.listNode.replace(n.root);
- e.fire("contentDomInvalidated")
- } else {
- y = b;
- q = r;
- i = B;
- z = q.contents;
- e = q.root.getDocument();
- n = [];
- if(z.length == 1 && z[0].equals(q.root)) {
- r = e.createElement("div");
- z[0].moveChildren &&
- z[0].moveChildren(r);
- z[0].append(r);
- z[0] = r
- }
- q = q.contents[0].getParent();
- for(A = 0; A < z.length; A++) q = q.getCommonAncestor(z[A].getParent());
- G = y.config.useComputedState;
- y = r = void 0;
- G = G === void 0 || G;
- for(A = 0; A < z.length; A++)
- for(D = z[A]; J = D.getParent();) {
- if(J.equals(q)) {
- n.push(D);
- !y && D.getDirection() && (y = 1);
- D = D.getDirection(G);
- r !== null && (r = r && r != D ? null : D);
- break
- }
- D = J
- }
- if(!(n.length < 1)) {
- z = n[n.length - 1].getNext();
- A = e.createElement(this.type);
- i.push(A);
- for(G = i = void 0; n.length;) {
- i = n.shift();
- G = e.createElement("li");
- if(i.is("pre") ||
- o.test(i.getName()) || i.getAttribute("contenteditable") == "false") i.appendTo(G);
- else {
- i.copyAttributes(G);
- if(r && i.getDirection()) {
- G.removeStyle("direction");
- G.removeAttribute("dir")
- }
- i.moveChildren(G);
- i.remove()
- }
- G.appendTo(A)
- }
- r && y && A.setAttribute("dir", r);
- z ? A.insertBefore(z) : A.appendTo(q)
- }
- }
- else this.state == CKEDITOR.TRISTATE_ON && f[r.root.getName()] && a.call(this, b, r, j)
- }
- for(A = 0; A < B.length; A++) g(B[A]);
- CKEDITOR.dom.element.clearAllMarkers(j);
- d.selectBookmarks(c);
- b.focus()
- },
- refresh: function(a, b) {
- var c = b.contains(f,
- 1),
- d = b.blockLimit || b.root;
- c && d.contains(c) ? this.setState(c.is(this.type) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF) : this.setState(CKEDITOR.TRISTATE_OFF)
- }
- };
- CKEDITOR.plugins.add("list", {
- requires: "indentlist",
- init: function(a) {
- if(!a.blockless) {
- a.addCommand("numberedlist", new e("numberedlist", "ol"));
- a.addCommand("bulletedlist", new e("bulletedlist", "ul"));
- if(a.ui.addButton) {
- a.ui.addButton("NumberedList", {
- label: a.lang.list.numberedlist,
- command: "numberedlist",
- directional: true,
- toolbar: "list,10"
- });
- a.ui.addButton("BulletedList", {
- label: a.lang.list.bulletedlist,
- command: "bulletedlist",
- directional: true,
- toolbar: "list,20"
- })
- }
- a.on("key", function(b) {
- var e = b.data.domEvent.getKey(),
- g;
- if(a.mode == "wysiwyg" && e in {
- 8: 1,
- 46: 1
- }) {
- var h = a.getSelection().getRanges()[0],
- i = h && h.startPath();
- if(h && h.collapsed) {
- var q = e == 8,
- o = a.editable(),
- v = new CKEDITOR.dom.walker(h.clone());
- v.evaluator = function(a) {
- return k(a) && !n(a)
- };
- v.guard = function(a, b) {
- return !(b && a.type == CKEDITOR.NODE_ELEMENT && a.is("table"))
- };
- e = h.clone();
- if(q) {
- var r;
- if((r = i.contains(f)) && h.checkBoundaryOfElement(r,
- CKEDITOR.START) && (r = r.getParent()) && r.is("li") && (r = j(r))) {
- g = r;
- r = r.getPrevious(k);
- e.moveToPosition(r && n(r) ? r : g, CKEDITOR.POSITION_BEFORE_START)
- } else {
- v.range.setStartAt(o, CKEDITOR.POSITION_AFTER_START);
- v.range.setEnd(h.startContainer, h.startOffset);
- if((r = v.previous()) && r.type == CKEDITOR.NODE_ELEMENT && (r.getName() in f || r.is("li"))) {
- if(!r.is("li")) {
- v.range.selectNodeContents(r);
- v.reset();
- v.evaluator = c;
- r = v.previous()
- }
- g = r;
- e.moveToElementEditEnd(g)
- }
- }
- if(g) {
- d(a, e, h);
- b.cancel()
- } else if((e = i.contains(f)) && h.checkBoundaryOfElement(e,
- CKEDITOR.START)) {
- g = e.getFirst(k);
- if(h.checkBoundaryOfElement(g, CKEDITOR.START)) {
- r = e.getPrevious(k);
- if(j(g)) {
- if(r) {
- h.moveToElementEditEnd(r);
- h.select()
- }
- } else a.execCommand("outdent");
- b.cancel()
- }
- }
- } else if(g = i.contains("li")) {
- v.range.setEndAt(o, CKEDITOR.POSITION_BEFORE_END);
- g = (i = g.getLast(k)) && c(i) ? i : g;
- o = 0;
- if((r = v.next()) && r.type == CKEDITOR.NODE_ELEMENT && r.getName() in f && r.equals(i)) {
- o = 1;
- r = v.next()
- } else h.checkBoundaryOfElement(g, CKEDITOR.END) && (o = 1);
- if(o && r) {
- h = h.clone();
- h.moveToElementEditStart(r);
- d(a,
- e, h);
- b.cancel()
- }
- } else {
- v.range.setEndAt(o, CKEDITOR.POSITION_BEFORE_END);
- if((r = v.next()) && r.type == CKEDITOR.NODE_ELEMENT && r.is(f)) {
- r = r.getFirst(k);
- if(i.block && h.checkStartOfBlock() && h.checkEndOfBlock()) {
- i.block.remove();
- h.moveToElementEditStart(r);
- h.select()
- } else if(j(r)) {
- h.moveToElementEditStart(r);
- h.select()
- } else {
- h = h.clone();
- h.moveToElementEditStart(r);
- d(a, e, h)
- }
- b.cancel()
- }
- }
- setTimeout(function() {
- a.selectionChange(1)
- })
- }
- }
- })
- }
- }
- })
- }(),
- function() {
- function a(a, b, c) {
- c = a.config.forceEnterMode || c;
- if(a.mode == "wysiwyg") {
- if(!b) b =
- a.activeEnterMode;
- if(!a.elementPath().isContextFor("p")) {
- b = CKEDITOR.ENTER_BR;
- c = 1
- }
- a.fire("saveSnapshot");
- b == CKEDITOR.ENTER_BR ? j(a, b, null, c) : f(a, b, null, c);
- a.fire("saveSnapshot")
- }
- }
- function e(a) {
- for(var a = a.getSelection().getRanges(true), b = a.length - 1; b > 0; b--) a[b].deleteContents();
- return a[0]
- }
- function b(a) {
- var b = a.startContainer.getAscendant(function(a) {
- return a.type == CKEDITOR.NODE_ELEMENT && a.getAttribute("contenteditable") == "true"
- }, true);
- if(a.root.equals(b)) return a;
- b = new CKEDITOR.dom.range(b);
- b.moveToRange(a);
- return b
- }
- CKEDITOR.plugins.add("enterkey", {
- init: function(b) {
- b.addCommand("enter", {
- modes: {
- wysiwyg: 1
- },
- editorFocus: false,
- exec: function(b) {
- a(b)
- }
- });
- b.addCommand("shiftEnter", {
- modes: {
- wysiwyg: 1
- },
- editorFocus: false,
- exec: function(b) {
- a(b, b.activeShiftEnterMode, 1)
- }
- });
- b.setKeystroke([
- [13, "enter"],
- [CKEDITOR.SHIFT + 13, "shiftEnter"]
- ])
- }
- });
- var g = CKEDITOR.dom.walker.whitespaces(),
- c = CKEDITOR.dom.walker.bookmark();
- CKEDITOR.plugins.enterkey = {
- enterBlock: function(a, d, f, o) {
- if(f = f || e(a)) {
- var f = b(f),
- q = f.document,
- m = f.checkStartOfBlock(),
- l = f.checkEndOfBlock(),
- p = a.elementPath(f.startContainer),
- t = p.block,
- s = d == CKEDITOR.ENTER_DIV ? "div" : "p",
- u;
- if(m && l) {
- if(t && (t.is("li") || t.getParent().is("li"))) {
- t.is("li") || (t = t.getParent());
- f = t.getParent();
- u = f.getParent();
- var o = !t.hasPrevious(),
- w = !t.hasNext(),
- s = a.getSelection(),
- x = s.createBookmarks(),
- m = t.getDirection(1),
- l = t.getAttribute("class"),
- v = t.getAttribute("style"),
- r = u.getDirection(1) != m,
- a = a.enterMode != CKEDITOR.ENTER_BR || r || v || l;
- if(u.is("li"))
- if(o || w) t[o ? "insertBefore" : "insertAfter"](u);
- else t.breakParent(u);
- else {
- if(a) {
- if(p.block.is("li")) {
- u = q.createElement(d == CKEDITOR.ENTER_P ? "p" : "div");
- r && u.setAttribute("dir", m);
- v && u.setAttribute("style", v);
- l && u.setAttribute("class", l);
- t.moveChildren(u)
- } else u = p.block;
- if(o || w) u[o ? "insertBefore" : "insertAfter"](f);
- else {
- t.breakParent(f);
- u.insertAfter(f)
- }
- } else {
- t.appendBogus(true);
- if(o || w)
- for(; q = t[o ? "getFirst" : "getLast"]();) q[o ? "insertBefore" : "insertAfter"](f);
- else
- for(t.breakParent(f); q = t.getLast();) q.insertAfter(f)
- }
- t.remove()
- }
- s.selectBookmarks(x);
- return
- }
- if(t && t.getParent().is("blockquote")) {
- t.breakParent(t.getParent());
- t.getPrevious().getFirst(CKEDITOR.dom.walker.invisible(1)) || t.getPrevious().remove();
- t.getNext().getFirst(CKEDITOR.dom.walker.invisible(1)) || t.getNext().remove();
- f.moveToElementEditStart(t);
- f.select();
- return
- }
- } else if(t && t.is("pre") && !l) {
- j(a, d, f, o);
- return
- }
- if(m = f.splitBlock(s)) {
- d = m.previousBlock;
- t = m.nextBlock;
- p = m.wasStartOfBlock;
- a = m.wasEndOfBlock;
- if(t) {
- x = t.getParent();
- if(x.is("li")) {
- t.breakParent(x);
- t.move(t.getNext(), 1)
- }
- } else if(d && (x = d.getParent()) && x.is("li")) {
- d.breakParent(x);
- x = d.getNext();
- f.moveToElementEditStart(x);
- d.move(d.getPrevious())
- }
- if(!p && !a) {
- if(t.is("li")) {
- u = f.clone();
- u.selectNodeContents(t);
- u = new CKEDITOR.dom.walker(u);
- u.evaluator = function(a) {
- return !(c(a) || g(a) || a.type == CKEDITOR.NODE_ELEMENT && a.getName() in CKEDITOR.dtd.$inline && !(a.getName() in CKEDITOR.dtd.$empty))
- };
- (x = u.next()) && (x.type == CKEDITOR.NODE_ELEMENT && x.is("ul", "ol")) && (CKEDITOR.env.needsBrFiller ? q.createElement("br") : q.createText(" ")).insertBefore(x)
- }
- t && f.moveToElementEditStart(t)
- } else {
- if(d) {
- if(d.is("li") || !h.test(d.getName()) && !d.is("pre")) u =
- d.clone()
- } else t && (u = t.clone());
- if(u) o && !u.is("li") && u.renameNode(s);
- else if(x && x.is("li")) u = x;
- else {
- u = q.createElement(s);
- d && (w = d.getDirection()) && u.setAttribute("dir", w)
- }
- if(q = m.elementPath) {
- o = 0;
- for(s = q.elements.length; o < s; o++) {
- x = q.elements[o];
- if(x.equals(q.block) || x.equals(q.blockLimit)) break;
- if(CKEDITOR.dtd.$removeEmpty[x.getName()]) {
- x = x.clone();
- u.moveChildren(x);
- u.append(x)
- }
- }
- }
- u.appendBogus();
- u.getParent() || f.insertNode(u);
- u.is("li") && u.removeAttribute("value");
- if(CKEDITOR.env.ie && p && (!a || !d.getChildCount())) {
- f.moveToElementEditStart(a ?
- d : u);
- f.select()
- }
- f.moveToElementEditStart(p && !a ? t : u)
- }
- f.select();
- f.scrollIntoView()
- }
- }
- },
- enterBr: function(a, b, c, d) {
- if(c = c || e(a)) {
- var g = c.document,
- j = c.checkEndOfBlock(),
- l = new CKEDITOR.dom.elementPath(a.getSelection().getStartElement()),
- p = l.block,
- t = p && l.block.getName();
- if(!d && t == "li") f(a, b, c, d);
- else {
- if(!d && j && h.test(t))
- if(j = p.getDirection()) {
- g = g.createElement("div");
- g.setAttribute("dir", j);
- g.insertAfter(p);
- c.setStart(g, 0)
- } else {
- g.createElement("br").insertAfter(p);
- CKEDITOR.env.gecko && g.createText("").insertAfter(p);
- c.setStartAt(p.getNext(), CKEDITOR.env.ie ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_START)
- }
- else {
- a = t == "pre" && CKEDITOR.env.ie && CKEDITOR.env.version < 8 ? g.createText("\r") : g.createElement("br");
- c.deleteContents();
- c.insertNode(a);
- if(CKEDITOR.env.needsBrFiller) {
- g.createText("").insertAfter(a);
- j && (p || l.blockLimit).appendBogus();
- a.getNext().$.nodeValue = "";
- c.setStartAt(a.getNext(), CKEDITOR.POSITION_AFTER_START)
- } else c.setStartAt(a, CKEDITOR.POSITION_AFTER_END)
- }
- c.collapse(true);
- c.select();
- c.scrollIntoView()
- }
- }
- }
- };
- var d = CKEDITOR.plugins.enterkey,
- j = d.enterBr,
- f = d.enterBlock,
- h = /^h[1-6]$/
- }(),
- function() {
- function a(a, b) {
- var g = {},
- c = [],
- d = {
- nbsp: " ",
- shy: "",
- gt: ">",
- lt: "<",
- amp: "&",
- apos: "'",
- quot: '"'
- },
- a = a.replace(/\b(nbsp|shy|gt|lt|amp|apos|quot)(?:,|$)/g, function(a, f) {
- var e = b ? "&" + f + ";" : d[f];
- g[e] = b ? d[f] : "&" + f + ";";
- c.push(e);
- return ""
- });
- if(!b && a) {
- var a = a.split(","),
- j = document.createElement("div"),
- f;
- j.innerHTML = "&" + a.join(";&") + ";";
- f = j.innerHTML;
- j = null;
- for(j = 0; j < f.length; j++) {
- var h = f.charAt(j);
- g[h] = "&" + a[j] + ";";
- c.push(h)
- }
- }
- g.regex =
- c.join(b ? "|" : "");
- return g
- }
- CKEDITOR.plugins.add("entities", {
- afterInit: function(e) {
- function b(a) {
- return h[a]
- }
- function g(a) {
- return c.entities_processNumerical == "force" || !j[a] ? "&#" + a.charCodeAt(0) + ";" : j[a]
- }
- var c = e.config;
- if(e = (e = e.dataProcessor) && e.htmlFilter) {
- var d = [];
- c.basicEntities !== false && d.push("nbsp,gt,lt,amp");
- if(c.entities) {
- d.length && d.push("quot,iexcl,cent,pound,curren,yen,brvbar,sect,uml,copy,ordf,laquo,not,shy,reg,macr,deg,plusmn,sup2,sup3,acute,micro,para,middot,cedil,sup1,ordm,raquo,frac14,frac12,frac34,iquest,times,divide,fnof,bull,hellip,prime,Prime,oline,frasl,weierp,image,real,trade,alefsym,larr,uarr,rarr,darr,harr,crarr,lArr,uArr,rArr,dArr,hArr,forall,part,exist,empty,nabla,isin,notin,ni,prod,sum,minus,lowast,radic,prop,infin,ang,and,or,cap,cup,int,there4,sim,cong,asymp,ne,equiv,le,ge,sub,sup,nsub,sube,supe,oplus,otimes,perp,sdot,lceil,rceil,lfloor,rfloor,lang,rang,loz,spades,clubs,hearts,diams,circ,tilde,ensp,emsp,thinsp,zwnj,zwj,lrm,rlm,ndash,mdash,lsquo,rsquo,sbquo,ldquo,rdquo,bdquo,dagger,Dagger,permil,lsaquo,rsaquo,euro");
- c.entities_latin && d.push("Agrave,Aacute,Acirc,Atilde,Auml,Aring,AElig,Ccedil,Egrave,Eacute,Ecirc,Euml,Igrave,Iacute,Icirc,Iuml,ETH,Ntilde,Ograve,Oacute,Ocirc,Otilde,Ouml,Oslash,Ugrave,Uacute,Ucirc,Uuml,Yacute,THORN,szlig,agrave,aacute,acirc,atilde,auml,aring,aelig,ccedil,egrave,eacute,ecirc,euml,igrave,iacute,icirc,iuml,eth,ntilde,ograve,oacute,ocirc,otilde,ouml,oslash,ugrave,uacute,ucirc,uuml,yacute,thorn,yuml,OElig,oelig,Scaron,scaron,Yuml");
- c.entities_greek && d.push("Alpha,Beta,Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda,Mu,Nu,Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,Omega,alpha,beta,gamma,delta,epsilon,zeta,eta,theta,iota,kappa,lambda,mu,nu,xi,omicron,pi,rho,sigmaf,sigma,tau,upsilon,phi,chi,psi,omega,thetasym,upsih,piv");
- c.entities_additional && d.push(c.entities_additional)
- }
- var j = a(d.join(",")),
- f = j.regex ? "[" + j.regex + "]" : "a^";
- delete j.regex;
- c.entities && c.entities_processNumerical && (f = "[^ -~]|" + f);
- var f = RegExp(f, "g"),
- h = a("nbsp,gt,lt,amp,shy", true),
- i = RegExp(h.regex, "g");
- e.addRules({
- text: function(a) {
- return a.replace(i, b).replace(f, g)
- }
- }, {
- applyToAll: true,
- excludeNestedEditable: true
- })
- }
- }
- })
- }(), CKEDITOR.config.basicEntities = !0, CKEDITOR.config.entities = !0, CKEDITOR.config.entities_latin = !0, CKEDITOR.config.entities_greek = !0, CKEDITOR.config.entities_additional =
- "#39", CKEDITOR.plugins.add("popup"), CKEDITOR.tools.extend(CKEDITOR.editor.prototype, {
- popup: function(a, e, b, g) {
- e = e || "80%";
- b = b || "70%";
- typeof e == "string" && (e.length > 1 && e.substr(e.length - 1, 1) == "%") && (e = parseInt(window.screen.width * parseInt(e, 10) / 100, 10));
- typeof b == "string" && (b.length > 1 && b.substr(b.length - 1, 1) == "%") && (b = parseInt(window.screen.height * parseInt(b, 10) / 100, 10));
- e < 640 && (e = 640);
- b < 420 && (b = 420);
- var c = parseInt((window.screen.height - b) / 2, 10),
- d = parseInt((window.screen.width - e) / 2, 10),
- g = (g || "location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes") +
- ",width=" + e + ",height=" + b + ",top=" + c + ",left=" + d,
- j = window.open("", null, g, true);
- if(!j) return false;
- try {
- if(navigator.userAgent.toLowerCase().indexOf(" chrome/") == -1) {
- j.moveTo(d, c);
- j.resizeTo(e, b)
- }
- j.focus();
- j.location.href = a
- } catch(f) {
- window.open(a, null, g, true)
- }
- return true
- }
- }),
- function() {
- function a(a, b) {
- var c = [];
- if(b)
- for(var d in b) c.push(d + "=" + encodeURIComponent(b[d]));
- else return a;
- return a + (a.indexOf("?") != -1 ? "&" : "?") + c.join("&")
- }
- function e(a) {
- a = a + "";
- return a.charAt(0).toUpperCase() + a.substr(1)
- }
- function b() {
- var b =
- this.getDialog(),
- c = b.getParentEditor();
- c._.filebrowserSe = this;
- var d = c.config["filebrowser" + e(b.getName()) + "WindowWidth"] || c.config.filebrowserWindowWidth || "80%",
- b = c.config["filebrowser" + e(b.getName()) + "WindowHeight"] || c.config.filebrowserWindowHeight || "70%",
- f = this.filebrowser.params || {};
- f.CKEditor = c.name;
- f.CKEditorFuncNum = c._.filebrowserFn;
- if(!f.langCode) f.langCode = c.langCode;
- f = a(this.filebrowser.url, f);
- c.popup(f, d, b, c.config.filebrowserWindowFeatures || c.config.fileBrowserWindowFeatures)
- }
- function g() {
- var a =
- this.getDialog();
- a.getParentEditor()._.filebrowserSe = this;
- return !a.getContentElement(this["for"][0], this["for"][1]).getInputElement().$.value || !a.getContentElement(this["for"][0], this["for"][1]).getAction() ? false : true
- }
- function c(b, c, d) {
- var f = d.params || {};
- f.CKEditor = b.name;
- f.CKEditorFuncNum = b._.filebrowserFn;
- if(!f.langCode) f.langCode = b.langCode;
- c.action = a(d.url, f);
- c.filebrowser = d
- }
- function d(a, f, j, n) {
- if(n && n.length)
- for(var o, q = n.length; q--;) {
- o = n[q];
- (o.type == "hbox" || o.type == "vbox" || o.type == "fieldset") &&
- d(a, f, j, o.children);
- if(o.filebrowser) {
- if(typeof o.filebrowser == "string") o.filebrowser = {
- action: o.type == "fileButton" ? "QuickUpload" : "Browse",
- target: o.filebrowser
- };
- if(o.filebrowser.action == "Browse") {
- var m = o.filebrowser.url;
- if(m === void 0) {
- m = a.config["filebrowser" + e(f) + "BrowseUrl"];
- if(m === void 0) m = a.config.filebrowserBrowseUrl
- }
- if(m) {
- o.onClick = b;
- o.filebrowser.url = m;
- o.hidden = false
- }
- } else if(o.filebrowser.action == "QuickUpload" && o["for"]) {
- m = o.filebrowser.url;
- if(m === void 0) {
- m = a.config["filebrowser" + e(f) + "UploadUrl"];
- if(m === void 0) m = a.config.filebrowserUploadUrl
- }
- if(m) {
- var l = o.onClick;
- o.onClick = function(a) {
- var b = a.sender;
- return l && l.call(b, a) === false ? false : g.call(b, a)
- };
- o.filebrowser.url = m;
- o.hidden = false;
- c(a, j.getContents(o["for"][0]).get(o["for"][1]), o.filebrowser)
- }
- }
- }
- }
- }
- function j(a, b, c) {
- if(c.indexOf(";") !== -1) {
- for(var c = c.split(";"), d = 0; d < c.length; d++)
- if(j(a, b, c[d])) return true;
- return false
- }
- return(a = a.getContents(b).get(c).filebrowser) && a.url
- }
- function f(a, b) {
- var c = this._.filebrowserSe.getDialog(),
- d = this._.filebrowserSe["for"],
- f = this._.filebrowserSe.filebrowser.onSelect;
- d && c.getContentElement(d[0], d[1]).reset();
- if(!(typeof b == "function" && b.call(this._.filebrowserSe) === false) && !(f && f.call(this._.filebrowserSe, a, b) === false)) {
- typeof b == "string" && b && alert(b);
- if(a) {
- d = this._.filebrowserSe;
- c = d.getDialog();
- if(d = d.filebrowser.target || null) {
- d = d.split(":");
- if(f = c.getContentElement(d[0], d[1])) {
- f.setValue(a);
- c.selectPage(d[0])
- }
- }
- }
- }
- }
- CKEDITOR.plugins.add("filebrowser", {
- requires: "popup",
- init: function(a) {
- a._.filebrowserFn = CKEDITOR.tools.addFunction(f,
- a);
- a.on("destroy", function() {
- CKEDITOR.tools.removeFunction(this._.filebrowserFn)
- })
- }
- });
- CKEDITOR.on("dialogDefinition", function(a) {
- if(a.editor.plugins.filebrowser)
- for(var b = a.data.definition, c, f = 0; f < b.contents.length; ++f)
- if(c = b.contents[f]) {
- d(a.editor, a.data.name, b, c.elements);
- if(c.hidden && c.filebrowser) c.hidden = !j(b, c.id, c.filebrowser)
- }
- })
- }(),
- function() {
- function a(a) {
- var c = a.config,
- d = a.fire("uiSpace", {
- space: "top",
- html: ""
- }).html,
- j = function() {
- function d(a, c, f) {
- h.setStyle(c, b(f));
- h.setStyle("position",
- a)
- }
- function f(a) {
- var b = k.getDocumentPosition();
- switch(a) {
- case "top":
- d("absolute", "top", b.y - s - x);
- break;
- case "pin":
- d("fixed", "top", r);
- break;
- case "bottom":
- d("absolute", "top", b.y + (p.height || p.bottom - p.top) + x)
- }
- i = a
- }
- var i, k, l, p, t, s, u, w = c.floatSpaceDockedOffsetX || 0,
- x = c.floatSpaceDockedOffsetY || 0,
- v = c.floatSpacePinnedOffsetX || 0,
- r = c.floatSpacePinnedOffsetY || 0;
- return function(c) {
- if(k = a.editable()) {
- c && c.name == "focus" && h.show();
- h.removeStyle("left");
- h.removeStyle("right");
- l = h.getClientRect();
- p = k.getClientRect();
- t = e.getViewPaneSize();
- s = l.height;
- u = "pageXOffset" in e.$ ? e.$.pageXOffset : CKEDITOR.document.$.documentElement.scrollLeft;
- if(i) {
- s + x <= p.top ? f("top") : s + x > t.height - p.bottom ? f("pin") : f("bottom");
- var c = t.width / 2,
- c = p.left > 0 && p.right < t.width && p.width > l.width ? a.config.contentsLangDirection == "rtl" ? "right" : "left" : c - p.left > p.right - c ? "left" : "right",
- d;
- if(l.width > t.width) {
- c = "left";
- d = 0
- } else {
- d = c == "left" ? p.left > 0 ? p.left : 0 : p.right < t.width ? t.width - p.right : 0;
- if(d + l.width > t.width) {
- c = c == "left" ? "right" : "left";
- d = 0
- }
- }
- h.setStyle(c,
- b((i == "pin" ? v : w) + d + (i == "pin" ? 0 : c == "left" ? u : -u)))
- } else {
- i = "pin";
- f("pin");
- j(c)
- }
- }
- }
- }();
- if(d) {
- var f = new CKEDITOR.template('<div id="cke_{name}" class="cke {id} cke_reset_all cke_chrome cke_editor_{name} cke_float cke_{langDir} ' + CKEDITOR.env.cssClass + '" dir="{langDir}" title="' + (CKEDITOR.env.gecko ? " " : "") + '" lang="{langCode}" role="application" style="{style}"' + (a.title ? ' aria-labelledby="cke_{name}_arialbl"' : " ") + ">" + (a.title ? '<span id="cke_{name}_arialbl" class="cke_voice_label">{voiceLabel}</span>' :
- " ") + '<div class="cke_inner"><div id="{topId}" class="cke_top" role="presentation">{content}</div></div></div>'),
- h = CKEDITOR.document.getBody().append(CKEDITOR.dom.element.createFromHtml(f.output({
- content: d,
- id: a.id,
- langDir: a.lang.dir,
- langCode: a.langCode,
- name: a.name,
- style: "display:none;z-index:" + (c.baseFloatZIndex - 1),
- topId: a.ui.spaceId("top"),
- voiceLabel: a.title
- }))),
- i = CKEDITOR.tools.eventsBuffer(500, j),
- k = CKEDITOR.tools.eventsBuffer(100, j);
- h.unselectable();
- h.on("mousedown", function(a) {
- a = a.data;
- a.getTarget().hasAscendant("a",
- 1) || a.preventDefault()
- });
- a.on("focus", function(b) {
- j(b);
- a.on("change", i.input);
- e.on("scroll", k.input);
- e.on("resize", k.input)
- });
- a.on("blur", function() {
- h.hide();
- a.removeListener("change", i.input);
- e.removeListener("scroll", k.input);
- e.removeListener("resize", k.input)
- });
- a.on("destroy", function() {
- e.removeListener("scroll", k.input);
- e.removeListener("resize", k.input);
- h.clearCustomData();
- h.remove()
- });
- a.focusManager.hasFocus && h.show();
- a.focusManager.add(h, 1)
- }
- }
- var e = CKEDITOR.document.getWindow(),
- b = CKEDITOR.tools.cssLength;
- CKEDITOR.plugins.add("floatingspace", {
- init: function(b) {
- b.on("loaded", function() {
- a(this)
- }, null, null, 20)
- }
- })
- }(), CKEDITOR.plugins.add("listblock", {
- requires: "panel",
- onLoad: function() {
- var a = CKEDITOR.addTemplate("panel-list", '<ul role="presentation" class="cke_panel_list">{items}</ul>'),
- e = CKEDITOR.addTemplate("panel-list-item", '<li id="{id}" class="cke_panel_listItem" role=presentation><a id="{id}_option" _cke_focus=1 hidefocus=true title="{title}" href="javascript:void(\'{val}\')" {onclick}="CKEDITOR.tools.callFunction({clickFn},\'{val}\'); return false;" role="option">{text}</a></li>'),
- b = CKEDITOR.addTemplate("panel-list-group", '<h1 id="{id}" class="cke_panel_grouptitle" role="presentation" >{label}</h1>'),
- g = /\'/g;
- CKEDITOR.ui.panel.prototype.addListBlock = function(a, b) {
- return this.addBlock(a, new CKEDITOR.ui.listBlock(this.getHolderElement(), b))
- };
- CKEDITOR.ui.listBlock = CKEDITOR.tools.createClass({
- base: CKEDITOR.ui.panel.block,
- $: function(a, b) {
- var b = b || {},
- e = b.attributes || (b.attributes = {});
- (this.multiSelect = !!b.multiSelect) && (e["aria-multiselectable"] = true);
- !e.role && (e.role = "listbox");
- this.base.apply(this, arguments);
- this.element.setAttribute("role", e.role);
- e = this.keys;
- e[40] = "next";
- e[9] = "next";
- e[38] = "prev";
- e[CKEDITOR.SHIFT + 9] = "prev";
- e[32] = CKEDITOR.env.ie ? "mouseup" : "click";
- CKEDITOR.env.ie && (e[13] = "mouseup");
- this._.pendingHtml = [];
- this._.pendingList = [];
- this._.items = {};
- this._.groups = {}
- },
- _: {
- close: function() {
- if(this._.started) {
- var b = a.output({
- items: this._.pendingList.join("")
- });
- this._.pendingList = [];
- this._.pendingHtml.push(b);
- delete this._.started
- }
- },
- getClick: function() {
- if(!this._.click) this._.click =
- CKEDITOR.tools.addFunction(function(a) {
- var b = this.toggle(a);
- if(this.onClick) this.onClick(a, b)
- }, this);
- return this._.click
- }
- },
- proto: {
- add: function(a, b, j) {
- var f = CKEDITOR.tools.getNextId();
- if(!this._.started) {
- this._.started = 1;
- this._.size = this._.size || 0
- }
- this._.items[a] = f;
- var h;
- h = CKEDITOR.tools.htmlEncodeAttr(a).replace(g, "\\'");
- a = {
- id: f,
- val: h,
- onclick: CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : "onclick",
- clickFn: this._.getClick(),
- title: CKEDITOR.tools.htmlEncodeAttr(j || a),
- text: b || a
- };
- this._.pendingList.push(e.output(a))
- },
- startGroup: function(a) {
- this._.close();
- var d = CKEDITOR.tools.getNextId();
- this._.groups[a] = d;
- this._.pendingHtml.push(b.output({
- id: d,
- label: a
- }))
- },
- commit: function() {
- this._.close();
- this.element.appendHtml(this._.pendingHtml.join(""));
- delete this._.size;
- this._.pendingHtml = []
- },
- toggle: function(a) {
- var b = this.isMarked(a);
- b ? this.unmark(a) : this.mark(a);
- return !b
- },
- hideGroup: function(a) {
- var b = (a = this.element.getDocument().getById(this._.groups[a])) && a.getNext();
- if(a) {
- a.setStyle("display", "none");
- b && b.getName() == "ul" &&
- b.setStyle("display", "none")
- }
- },
- hideItem: function(a) {
- this.element.getDocument().getById(this._.items[a]).setStyle("display", "none")
- },
- showAll: function() {
- var a = this._.items,
- b = this._.groups,
- e = this.element.getDocument(),
- f;
- for(f in a) e.getById(a[f]).setStyle("display", "");
- for(var g in b) {
- a = e.getById(b[g]);
- f = a.getNext();
- a.setStyle("display", "");
- f && f.getName() == "ul" && f.setStyle("display", "")
- }
- },
- mark: function(a) {
- this.multiSelect || this.unmarkAll();
- var a = this._.items[a],
- b = this.element.getDocument().getById(a);
- b.addClass("cke_selected");
- this.element.getDocument().getById(a + "_option").setAttribute("aria-selected", true);
- this.onMark && this.onMark(b)
- },
- unmark: function(a) {
- var b = this.element.getDocument(),
- a = this._.items[a],
- e = b.getById(a);
- e.removeClass("cke_selected");
- b.getById(a + "_option").removeAttribute("aria-selected");
- this.onUnmark && this.onUnmark(e)
- },
- unmarkAll: function() {
- var a = this._.items,
- b = this.element.getDocument(),
- e;
- for(e in a) {
- var f = a[e];
- b.getById(f).removeClass("cke_selected");
- b.getById(f + "_option").removeAttribute("aria-selected")
- }
- this.onUnmark &&
- this.onUnmark()
- },
- isMarked: function(a) {
- return this.element.getDocument().getById(this._.items[a]).hasClass("cke_selected")
- },
- focus: function(a) {
- this._.focusIndex = -1;
- var b = this.element.getElementsByTag("a"),
- e, f = -1;
- if(a)
- for(e = this.element.getDocument().getById(this._.items[a]).getFirst(); a = b.getItem(++f);) {
- if(a.equals(e)) {
- this._.focusIndex = f;
- break
- }
- } else this.element.focus();
- e && setTimeout(function() {
- e.focus()
- }, 0)
- }
- }
- })
- }
- }),
- function() {
- var a = '<a id="{id}" class="cke_button cke_button__{name} cke_button_{state} {cls}"' +
- (CKEDITOR.env.gecko && !CKEDITOR.env.hc ? "" : " href=\"javascript:void('{titleJs}')\"") + ' title="{title}" tabindex="-1" hidefocus="true" role="button" aria-labelledby="{id}_label" aria-haspopup="{hasArrow}" aria-disabled="{ariaDisabled}"';
- CKEDITOR.env.gecko && CKEDITOR.env.mac && (a = a + ' onkeypress="return false;"');
- CKEDITOR.env.gecko && (a = a + ' onblur="this.style.cssText = this.style.cssText;"');
- var a = a + (' onkeydown="return CKEDITOR.tools.callFunction({keydownFn},event);" onfocus="return CKEDITOR.tools.callFunction({focusFn},event);" ' +
- (CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : "onclick") + '="CKEDITOR.tools.callFunction({clickFn},this);return false;"><span class="cke_button_icon cke_button__{iconName}_icon" style="{style}"'),
- a = a + '> </span><span id="{id}_label" class="cke_button_label cke_button__{name}_label" aria-hidden="false">{label}</span>{arrowHtml}</a>',
- e = CKEDITOR.addTemplate("buttonArrow", '<span class="cke_button_arrow">' + (CKEDITOR.env.hc ? "▼" : "") + "</span>"),
- b = CKEDITOR.addTemplate("button", a);
- CKEDITOR.plugins.add("button", {
- beforeInit: function(a) {
- a.ui.addHandler(CKEDITOR.UI_BUTTON, CKEDITOR.ui.button.handler)
- }
- });
- CKEDITOR.UI_BUTTON = "button";
- CKEDITOR.ui.button = function(a) {
- CKEDITOR.tools.extend(this, a, {
- title: a.label,
- click: a.click || function(b) {
- b.execCommand(a.command)
- }
- });
- this._ = {}
- };
- CKEDITOR.ui.button.handler = {
- create: function(a) {
- return new CKEDITOR.ui.button(a)
- }
- };
- CKEDITOR.ui.button.prototype = {
- render: function(a, c) {
- function d() {
- var b = a.mode;
- if(b) {
- b = this.modes[b] ? l[b] !== void 0 ? l[b] : CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED;
- b = a.readOnly && !this.readOnly ? CKEDITOR.TRISTATE_DISABLED : b;
- this.setState(b);
- this.refresh && this.refresh()
- }
- }
- var j = CKEDITOR.env,
- f = this._.id = CKEDITOR.tools.getNextId(),
- h = "",
- i = this.command,
- k;
- this._.editor = a;
- var n = {
- id: f,
- button: this,
- editor: a,
- focus: function() {
- CKEDITOR.document.getById(f).focus()
- },
- execute: function() {
- this.button.click(a)
- },
- attach: function(a) {
- this.button.attach(a)
- }
- },
- o = CKEDITOR.tools.addFunction(function(a) {
- if(n.onkey) {
- a = new CKEDITOR.dom.event(a);
- return n.onkey(n, a.getKeystroke()) !== false
- }
- }),
- q =
- CKEDITOR.tools.addFunction(function(a) {
- var b;
- n.onfocus && (b = n.onfocus(n, new CKEDITOR.dom.event(a)) !== false);
- return b
- }),
- m = 0;
- n.clickFn = k = CKEDITOR.tools.addFunction(function() {
- if(m) {
- a.unlockSelection(1);
- m = 0
- }
- n.execute();
- j.iOS && a.focus()
- });
- if(this.modes) {
- var l = {};
- a.on("beforeModeUnload", function() {
- if(a.mode && this._.state != CKEDITOR.TRISTATE_DISABLED) l[a.mode] = this._.state
- }, this);
- a.on("activeFilterChange", d, this);
- a.on("mode", d, this);
- !this.readOnly && a.on("readOnly", d, this)
- } else if(i)
- if(i = a.getCommand(i)) {
- i.on("state",
- function() {
- this.setState(i.state)
- }, this);
- h = h + (i.state == CKEDITOR.TRISTATE_ON ? "on" : i.state == CKEDITOR.TRISTATE_DISABLED ? "disabled" : "off")
- }
- if(this.directional) a.on("contentDirChanged", function(b) {
- var c = CKEDITOR.document.getById(this._.id),
- d = c.getFirst(),
- b = b.data;
- b != a.lang.dir ? c.addClass("cke_" + b) : c.removeClass("cke_ltr").removeClass("cke_rtl");
- d.setAttribute("style", CKEDITOR.skin.getIconStyle(t, b == "rtl", this.icon, this.iconOffset))
- }, this);
- i || (h = h + "off");
- var p = this.name || this.command,
- t = p;
- if(this.icon &&
- !/\./.test(this.icon)) {
- t = this.icon;
- this.icon = null
- }
- h = {
- id: f,
- name: p,
- iconName: t,
- label: this.label,
- cls: this.className || "",
- state: h,
- ariaDisabled: h == "disabled" ? "true" : "false",
- title: this.title,
- titleJs: j.gecko && !j.hc ? "" : (this.title || "").replace("'", ""),
- hasArrow: this.hasArrow ? "true" : "false",
- keydownFn: o,
- focusFn: q,
- clickFn: k,
- style: CKEDITOR.skin.getIconStyle(t, a.lang.dir == "rtl", this.icon, this.iconOffset),
- arrowHtml: this.hasArrow ? e.output() : ""
- };
- b.output(h, c);
- if(this.onRender) this.onRender();
- return n
- },
- setState: function(a) {
- if(this._.state ==
- a) return false;
- this._.state = a;
- var b = CKEDITOR.document.getById(this._.id);
- if(b) {
- b.setState(a, "cke_button");
- a == CKEDITOR.TRISTATE_DISABLED ? b.setAttribute("aria-disabled", true) : b.removeAttribute("aria-disabled");
- if(this.hasArrow) {
- a = a == CKEDITOR.TRISTATE_ON ? this._.editor.lang.button.selectedLabel.replace(/%1/g, this.label) : this.label;
- CKEDITOR.document.getById(this._.id + "_label").setText(a)
- } else a == CKEDITOR.TRISTATE_ON ? b.setAttribute("aria-pressed", true) : b.removeAttribute("aria-pressed");
- return true
- }
- return false
- },
- getState: function() {
- return this._.state
- },
- toFeature: function(a) {
- if(this._.feature) return this._.feature;
- var b = this;
- !this.allowedContent && (!this.requiredContent && this.command) && (b = a.getCommand(this.command) || b);
- return this._.feature = b
- }
- };
- CKEDITOR.ui.prototype.addButton = function(a, b) {
- this.add(a, CKEDITOR.UI_BUTTON, b)
- }
- }(), CKEDITOR.plugins.add("richcombo", {
- requires: "floatpanel,listblock,button",
- beforeInit: function(a) {
- a.ui.addHandler(CKEDITOR.UI_RICHCOMBO, CKEDITOR.ui.richCombo.handler)
- }
- }),
- function() {
- var a =
- '<span id="{id}" class="cke_combo cke_combo__{name} {cls}" role="presentation"><span id="{id}_label" class="cke_combo_label">{label}</span><a class="cke_combo_button" title="{title}" tabindex="-1"' + (CKEDITOR.env.gecko && !CKEDITOR.env.hc ? "" : " href=\"javascript:void('{titleJs}')\"") + ' hidefocus="true" role="button" aria-labelledby="{id}_label" aria-haspopup="true"';
- CKEDITOR.env.gecko && CKEDITOR.env.mac && (a = a + ' onkeypress="return false;"');
- CKEDITOR.env.gecko && (a = a + ' onblur="this.style.cssText = this.style.cssText;"');
- var a = a + (' onkeydown="return CKEDITOR.tools.callFunction({keydownFn},event,this);" onfocus="return CKEDITOR.tools.callFunction({focusFn},event);" ' + (CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : "onclick") + '="CKEDITOR.tools.callFunction({clickFn},this);return false;"><span id="{id}_text" class="cke_combo_text cke_combo_inlinelabel">{label}</span><span class="cke_combo_open"><span class="cke_combo_arrow">' + (CKEDITOR.env.hc ? "▼" : CKEDITOR.env.air ? " " : "") + "</span></span></a></span>"),
- e = CKEDITOR.addTemplate("combo", a);
- CKEDITOR.UI_RICHCOMBO = "richcombo";
- CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass({
- $: function(a) {
- CKEDITOR.tools.extend(this, a, {
- canGroup: false,
- title: a.label,
- modes: {
- wysiwyg: 1
- },
- editorFocus: 1
- });
- a = this.panel || {};
- delete this.panel;
- this.id = CKEDITOR.tools.getNextNumber();
- this.document = a.parent && a.parent.getDocument() || CKEDITOR.document;
- a.className = "cke_combopanel";
- a.block = {
- multiSelect: a.multiSelect,
- attributes: a.attributes
- };
- a.toolbarRelated = true;
- this._ = {
- panelDefinition: a,
- items: {}
- }
- },
- proto: {
- renderHtml: function(a) {
- var e = [];
- this.render(a, e);
- return e.join("")
- },
- render: function(a, g) {
- function c() {
- if(this.getState() != CKEDITOR.TRISTATE_ON) {
- var c = this.modes[a.mode] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED;
- if(a.readOnly && !this.readOnly) c = CKEDITOR.TRISTATE_DISABLED;
- this.setState(c);
- this.setValue("");
- c != CKEDITOR.TRISTATE_DISABLED && this.refresh && this.refresh()
- }
- }
- var d = CKEDITOR.env,
- j = "cke_" + this.id,
- f = CKEDITOR.tools.addFunction(function(c) {
- if(o) {
- a.unlockSelection(1);
- o = 0
- }
- i.execute(c)
- },
- this),
- h = this,
- i = {
- id: j,
- combo: this,
- focus: function() {
- CKEDITOR.document.getById(j).getChild(1).focus()
- },
- execute: function(c) {
- var d = h._;
- if(d.state != CKEDITOR.TRISTATE_DISABLED) {
- h.createPanel(a);
- if(d.on) d.panel.hide();
- else {
- h.commit();
- var f = h.getValue();
- f ? d.list.mark(f) : d.list.unmarkAll();
- d.panel.showBlock(h.id, new CKEDITOR.dom.element(c), 4)
- }
- }
- },
- clickFn: f
- };
- a.on("activeFilterChange", c, this);
- a.on("mode", c, this);
- a.on("selectionChange", c, this);
- !this.readOnly && a.on("readOnly", c, this);
- var k = CKEDITOR.tools.addFunction(function(c,
- d) {
- var c = new CKEDITOR.dom.event(c),
- e = c.getKeystroke();
- if(e == 40) a.once("panelShow", function(a) {
- a.data._.panel._.currentBlock.onKeyDown(40)
- });
- switch(e) {
- case 13:
- case 32:
- case 40:
- CKEDITOR.tools.callFunction(f, d);
- break;
- default:
- i.onkey(i, e)
- }
- c.preventDefault()
- }),
- n = CKEDITOR.tools.addFunction(function() {
- i.onfocus && i.onfocus()
- }),
- o = 0;
- i.keyDownFn = k;
- d = {
- id: j,
- name: this.name || this.command,
- label: this.label,
- title: this.title,
- cls: this.className || "",
- titleJs: d.gecko && !d.hc ? "" : (this.title || "").replace("'", ""),
- keydownFn: k,
- focusFn: n,
- clickFn: f
- };
- e.output(d, g);
- if(this.onRender) this.onRender();
- return i
- },
- createPanel: function(a) {
- if(!this._.panel) {
- var e = this._.panelDefinition,
- c = this._.panelDefinition.block,
- d = e.parent || CKEDITOR.document.getBody(),
- j = "cke_combopanel__" + this.name,
- f = new CKEDITOR.ui.floatPanel(a, d, e),
- h = f.addListBlock(this.id, c),
- i = this;
- f.onShow = function() {
- this.element.addClass(j);
- i.setState(CKEDITOR.TRISTATE_ON);
- i._.on = 1;
- i.editorFocus && !a.focusManager.hasFocus && a.focus();
- if(i.onOpen) i.onOpen();
- a.once("panelShow",
- function() {
- h.focus(!h.multiSelect && i.getValue())
- })
- };
- f.onHide = function(c) {
- this.element.removeClass(j);
- i.setState(i.modes && i.modes[a.mode] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED);
- i._.on = 0;
- if(!c && i.onClose) i.onClose()
- };
- f.onEscape = function() {
- f.hide(1)
- };
- h.onClick = function(a, b) {
- i.onClick && i.onClick.call(i, a, b);
- f.hide()
- };
- this._.panel = f;
- this._.list = h;
- f.getBlock(this.id).onHide = function() {
- i._.on = 0;
- i.setState(CKEDITOR.TRISTATE_OFF)
- };
- this.init && this.init()
- }
- },
- setValue: function(a, e) {
- this._.value = a;
- var c =
- this.document.getById("cke_" + this.id + "_text");
- if(c) {
- if(!a && !e) {
- e = this.label;
- c.addClass("cke_combo_inlinelabel")
- } else c.removeClass("cke_combo_inlinelabel");
- c.setText(typeof e != "undefined" ? e : a)
- }
- },
- getValue: function() {
- return this._.value || ""
- },
- unmarkAll: function() {
- this._.list.unmarkAll()
- },
- mark: function(a) {
- this._.list.mark(a)
- },
- hideItem: function(a) {
- this._.list.hideItem(a)
- },
- hideGroup: function(a) {
- this._.list.hideGroup(a)
- },
- showAll: function() {
- this._.list.showAll()
- },
- add: function(a, e, c) {
- this._.items[a] = c || a;
- this._.list.add(a, e, c)
- },
- startGroup: function(a) {
- this._.list.startGroup(a)
- },
- commit: function() {
- if(!this._.committed) {
- this._.list.commit();
- this._.committed = 1;
- CKEDITOR.ui.fire("ready", this)
- }
- this._.committed = 1
- },
- setState: function(a) {
- if(this._.state != a) {
- var e = this.document.getById("cke_" + this.id);
- e.setState(a, "cke_combo");
- a == CKEDITOR.TRISTATE_DISABLED ? e.setAttribute("aria-disabled", true) : e.removeAttribute("aria-disabled");
- this._.state = a
- }
- },
- getState: function() {
- return this._.state
- },
- enable: function() {
- this._.state ==
- CKEDITOR.TRISTATE_DISABLED && this.setState(this._.lastState)
- },
- disable: function() {
- if(this._.state != CKEDITOR.TRISTATE_DISABLED) {
- this._.lastState = this._.state;
- this.setState(CKEDITOR.TRISTATE_DISABLED)
- }
- }
- },
- statics: {
- handler: {
- create: function(a) {
- return new CKEDITOR.ui.richCombo(a)
- }
- }
- }
- });
- CKEDITOR.ui.prototype.addRichCombo = function(a, e) {
- this.add(a, CKEDITOR.UI_RICHCOMBO, e)
- }
- }(), CKEDITOR.plugins.add("format", {
- requires: "richcombo",
- init: function(a) {
- if(!a.blockless) {
- for(var e = a.config, b = a.lang.format, g = e.format_tags.split(";"),
- c = {}, d = 0, j = [], f = 0; f < g.length; f++) {
- var h = g[f],
- i = new CKEDITOR.style(e["format_" + h]);
- if(!a.filter.customConfig || a.filter.check(i)) {
- d++;
- c[h] = i;
- c[h]._.enterMode = a.config.enterMode;
- j.push(i)
- }
- }
- d !== 0 && a.ui.addRichCombo("Format", {
- label: b.label,
- title: b.panelTitle,
- toolbar: "styles,20",
- allowedContent: j,
- panel: {
- css: [CKEDITOR.skin.getPath("editor")].concat(e.contentsCss),
- multiSelect: false,
- attributes: {
- "aria-label": b.panelTitle
- }
- },
- init: function() {
- this.startGroup(b.panelTitle);
- for(var a in c) {
- var d = b["tag_" + a];
- this.add(a,
- c[a].buildPreview(d), d)
- }
- },
- onClick: function(b) {
- a.focus();
- a.fire("saveSnapshot");
- var b = c[b],
- d = a.elementPath();
- a[b.checkActive(d, a) ? "removeStyle" : "applyStyle"](b);
- setTimeout(function() {
- a.fire("saveSnapshot")
- }, 0)
- },
- onRender: function() {
- a.on("selectionChange", function(b) {
- var d = this.getValue(),
- b = b.data.path;
- this.refresh();
- for(var f in c)
- if(c[f].checkActive(b, a)) {
- f != d && this.setValue(f, a.lang.format["tag_" + f]);
- return
- }
- this.setValue("")
- }, this)
- },
- onOpen: function() {
- this.showAll();
- for(var b in c) a.activeFilter.check(c[b]) ||
- this.hideItem(b)
- },
- refresh: function() {
- var b = a.elementPath();
- if(b) {
- if(b.isContextFor("p"))
- for(var d in c)
- if(a.activeFilter.check(c[d])) return;
- this.setState(CKEDITOR.TRISTATE_DISABLED)
- }
- }
- })
- }
- }
- }), CKEDITOR.config.format_tags = "p;h1;h2;h3;h4;h5;h6;pre;address;div;img", CKEDITOR.config.format_p = {
- element: "p"
- }, CKEDITOR.config.format_div = {
- element: "div"
- }, CKEDITOR.config.format_pre = {
- element: "pre"
- }, CKEDITOR.config.format_address = {
- element: "address"
- }, CKEDITOR.config.format_h1 = {
- element: "h1"
- }, CKEDITOR.config.format_h2 = {
- element: "h2"
- },
- CKEDITOR.config.format_h3 = {
- element: "h3"
- }, CKEDITOR.config.format_h4 = {
- element: "h4"
- }, CKEDITOR.config.format_h5 = {
- element: "h5"
- }, CKEDITOR.config.format_h6 = {
- element: "h6"
- },CKEDITOR.config.format_img = {
- element: "img"
- },
- function() {
- var a = {
- canUndo: false,
- exec: function(a) {
- var b = a.document.createElement("hr");
- a.insertElement(b)
- },
- allowedContent: "hr",
- requiredContent: "hr"
- };
- CKEDITOR.plugins.add("horizontalrule", {
- init: function(e) {
- if(!e.blockless) {
- e.addCommand("horizontalrule", a);
- e.ui.addButton && e.ui.addButton("HorizontalRule", {
- label: e.lang.horizontalrule.toolbar,
- command: "horizontalrule",
- toolbar: "insert,40"
- })
- }
- }
- })
- }(), CKEDITOR.plugins.add("htmlwriter", {
- init: function(a) {
- var e = new CKEDITOR.htmlWriter;
- e.forceSimpleAmpersand = a.config.forceSimpleAmpersand;
- e.indentationChars = a.config.dataIndentationChars || "\t";
- a.dataProcessor.writer = e
- }
- }), CKEDITOR.htmlWriter = CKEDITOR.tools.createClass({
- base: CKEDITOR.htmlParser.basicWriter,
- $: function() {
- this.base();
- this.indentationChars = "\t";
- this.selfClosingEnd = " />";
- this.lineBreakChars = "\n";
- this.sortAttributes = 1;
- this._.indent = 0;
- this._.indentation =
- "";
- this._.inPre = 0;
- this._.rules = {};
- var a = CKEDITOR.dtd,
- e;
- for(e in CKEDITOR.tools.extend({}, a.$nonBodyContent, a.$block, a.$listItem, a.$tableContent)) this.setRules(e, {
- indent: !a[e]["#"],
- breakBeforeOpen: 1,
- breakBeforeClose: !a[e]["#"],
- breakAfterClose: 1,
- needsSpace: e in a.$block && !(e in {
- li: 1,
- dt: 1,
- dd: 1
- })
- });
- this.setRules("br", {
- breakAfterOpen: 1
- });
- this.setRules("title", {
- indent: 0,
- breakAfterOpen: 0
- });
- this.setRules("style", {
- indent: 0,
- breakBeforeClose: 1
- });
- this.setRules("pre", {
- breakAfterOpen: 1,
- indent: 0
- })
- },
- proto: {
- openTag: function(a) {
- var e =
- this._.rules[a];
- this._.afterCloser && (e && e.needsSpace && this._.needsSpace) && this._.output.push("\n");
- if(this._.indent) this.indentation();
- else if(e && e.breakBeforeOpen) {
- this.lineBreak();
- this.indentation()
- }
- this._.output.push("<", a);
- this._.afterCloser = 0
- },
- openTagClose: function(a, e) {
- var b = this._.rules[a];
- if(e) {
- this._.output.push(this.selfClosingEnd);
- if(b && b.breakAfterClose) this._.needsSpace = b.needsSpace
- } else {
- this._.output.push(">");
- if(b && b.indent) this._.indentation = this._.indentation + this.indentationChars
- }
- b &&
- b.breakAfterOpen && this.lineBreak();
- a == "pre" && (this._.inPre = 1)
- },
- attribute: function(a, e) {
- if(typeof e == "string") {
- this.forceSimpleAmpersand && (e = e.replace(/&/g, "&"));
- e = CKEDITOR.tools.htmlEncodeAttr(e)
- }
- this._.output.push(" ", a, '="', e, '"')
- },
- closeTag: function(a) {
- var e = this._.rules[a];
- if(e && e.indent) this._.indentation = this._.indentation.substr(this.indentationChars.length);
- if(this._.indent) this.indentation();
- else if(e && e.breakBeforeClose) {
- this.lineBreak();
- this.indentation()
- }
- this._.output.push("</", a, ">");
- a == "pre" && (this._.inPre = 0);
- if(e && e.breakAfterClose) {
- this.lineBreak();
- this._.needsSpace = e.needsSpace
- }
- this._.afterCloser = 1
- },
- text: function(a) {
- if(this._.indent) {
- this.indentation();
- !this._.inPre && (a = CKEDITOR.tools.ltrim(a))
- }
- this._.output.push(a)
- },
- comment: function(a) {
- this._.indent && this.indentation();
- this._.output.push("<\!--", a, "--\>")
- },
- lineBreak: function() {
- !this._.inPre && this._.output.length > 0 && this._.output.push(this.lineBreakChars);
- this._.indent = 1
- },
- indentation: function() {
- !this._.inPre && this._.indentation &&
- this._.output.push(this._.indentation);
- this._.indent = 0
- },
- reset: function() {
- this._.output = [];
- this._.indent = 0;
- this._.indentation = "";
- this._.afterCloser = 0;
- this._.inPre = 0
- },
- setRules: function(a, e) {
- var b = this._.rules[a];
- b ? CKEDITOR.tools.extend(b, e, true) : this._.rules[a] = e
- }
- }
- }),
- function() {
- function a(a, e) {
- e || (e = a.getSelection().getSelectedElement());
- if(e && e.is("img") && !e.data("cke-realelement") && !e.isReadOnly()) return e
- }
- function e(a) {
- var e = a.getStyle("float");
- if(e == "inherit" || e == "none") e = 0;
- e || (e = a.getAttribute("align"));
- return e
- }
- CKEDITOR.plugins.add("image", {
- requires: "dialog",
- init: function(b) {
- if(!b.plugins.image2) {
- CKEDITOR.dialog.add("image", this.path + "dialogs/image.js");
- var e = "img[alt,!src]{border-style,border-width,float,height,margin,margin-bottom,margin-left,margin-right,margin-top,width}";
- CKEDITOR.dialog.isTabEnabled(b, "image", "advanced") && (e = "img[alt,dir,id,lang,longdesc,!src,title]{*}(*)");
- b.addCommand("image", new CKEDITOR.dialogCommand("image", {
- allowedContent: e,
- requiredContent: "img[alt,src]",
- contentTransformations: [
- ["img{width}: sizeToStyle",
- "img[width]: sizeToAttribute"
- ],
- ["img{float}: alignmentToStyle", "img[align]: alignmentToAttribute"]
- ]
- }));
- b.ui.addButton && b.ui.addButton("Image", {
- label: b.lang.common.image,
- command: "image",
- toolbar: "insert,10"
- });
- b.on("doubleclick", function(a) {
- var b = a.data.element;
- if(b.is("img") && !b.data("cke-realelement") && !b.isReadOnly()) a.data.dialog = "image"
- });
- b.addMenuItems && b.addMenuItems({
- image: {
- label: b.lang.image.menu,
- command: "image",
- group: "image"
- }
- });
- b.contextMenu && b.contextMenu.addListener(function(c) {
- if(a(b, c)) return {
- image: CKEDITOR.TRISTATE_OFF
- }
- })
- }
- },
- afterInit: function(b) {
- function g(c) {
- var d = b.getCommand("justify" + c);
- if(d) {
- if(c == "left" || c == "right") d.on("exec", function(d) {
- var f = a(b),
- g;
- if(f) {
- g = e(f);
- if(g == c) {
- f.removeStyle("float");
- c == e(f) && f.removeAttribute("align")
- } else f.setStyle("float", c);
- d.cancel()
- }
- });
- d.on("refresh", function(d) {
- var f = a(b);
- if(f) {
- f = e(f);
- this.setState(f == c ? CKEDITOR.TRISTATE_ON : c == "right" || c == "left" ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED);
- d.cancel()
- }
- })
- }
- }
- if(!b.plugins.image2) {
- g("left");
- g("right");
- g("center");
- g("block")
- }
- }
- })
- }(),
- CKEDITOR.config.image_removeLinkByEmptyURL = !0,
- function() {
- function a(a, b) {
- var c = g.exec(a),
- e = g.exec(b);
- if(c) {
- if(!c[2] && e[2] == "px") return e[1];
- if(c[2] == "px" && !e[2]) return e[1] + "px"
- }
- return b
- }
- var e = CKEDITOR.htmlParser.cssStyle,
- b = CKEDITOR.tools.cssLength,
- g = /^((?:\d*(?:\.\d+))|(?:\d+))(.*)?$/i,
- c = {
- elements: {
- $: function(b) {
- var c = b.attributes;
- if((c = (c = (c = c && c["data-cke-realelement"]) && new CKEDITOR.htmlParser.fragment.fromHtml(decodeURIComponent(c))) && c.children[0]) && b.attributes["data-cke-resizable"]) {
- var f =
- (new e(b)).rules,
- b = c.attributes,
- g = f.width,
- f = f.height;
- g && (b.width = a(b.width, g));
- f && (b.height = a(b.height, f))
- }
- return c
- }
- }
- };
- CKEDITOR.plugins.add("fakeobjects", {
- init: function(a) {
- a.filter.allow("img[!data-cke-realelement,src,alt,title](*){*}", "fakeobjects")
- },
- afterInit: function(a) {
- (a = (a = a.dataProcessor) && a.htmlFilter) && a.addRules(c, {
- applyToAll: true
- })
- }
- });
- CKEDITOR.editor.prototype.createFakeElement = function(a, c, f, g) {
- var i = this.lang.fakeobjects,
- i = i[f] || i.unknown,
- c = {
- "class": c,
- "data-cke-realelement": encodeURIComponent(a.getOuterHtml()),
- "data-cke-real-node-type": a.type,
- alt: i,
- title: i,
- align: a.getAttribute("align") || ""
- };
- if(!CKEDITOR.env.hc) c.src = CKEDITOR.tools.transparentImageData;
- f && (c["data-cke-real-element-type"] = f);
- if(g) {
- c["data-cke-resizable"] = g;
- f = new e;
- g = a.getAttribute("width");
- a = a.getAttribute("height");
- g && (f.rules.width = b(g));
- a && (f.rules.height = b(a));
- f.populate(c)
- }
- return this.document.createElement("img", {
- attributes: c
- })
- };
- CKEDITOR.editor.prototype.createFakeParserElement = function(a, c, f, g) {
- var i = this.lang.fakeobjects,
- i = i[f] ||
- i.unknown,
- k;
- k = new CKEDITOR.htmlParser.basicWriter;
- a.writeHtml(k);
- k = k.getHtml();
- c = {
- "class": c,
- "data-cke-realelement": encodeURIComponent(k),
- "data-cke-real-node-type": a.type,
- alt: i,
- title: i,
- align: a.attributes.align || ""
- };
- if(!CKEDITOR.env.hc) c.src = CKEDITOR.tools.transparentImageData;
- f && (c["data-cke-real-element-type"] = f);
- if(g) {
- c["data-cke-resizable"] = g;
- g = a.attributes;
- a = new e;
- f = g.width;
- g = g.height;
- f !== void 0 && (a.rules.width = b(f));
- g !== void 0 && (a.rules.height = b(g));
- a.populate(c)
- }
- return new CKEDITOR.htmlParser.element("img",
- c)
- };
- CKEDITOR.editor.prototype.restoreRealElement = function(b) {
- if(b.data("cke-real-node-type") != CKEDITOR.NODE_ELEMENT) return null;
- var c = CKEDITOR.dom.element.createFromHtml(decodeURIComponent(b.data("cke-realelement")), this.document);
- if(b.data("cke-resizable")) {
- var f = b.getStyle("width"),
- b = b.getStyle("height");
- f && c.setAttribute("width", a(c.getAttribute("width"), f));
- b && c.setAttribute("height", a(c.getAttribute("height"), b))
- }
- return c
- }
- }(), "use strict",
- function() {
- function a(a) {
- return a.replace(/'/g, "\\$&")
- }
- function e(a) {
- for(var b, c = a.length, d = [], f = 0; f < c; f++) {
- b = a.charCodeAt(f);
- d.push(b)
- }
- return "String.fromCharCode(" + d.join(",") + ")"
- }
- function b(b, c) {
- var d = b.plugins.link,
- f = d.compiledProtectionFunction.params,
- e, g;
- g = [d.compiledProtectionFunction.name, "("];
- for(var h = 0; h < f.length; h++) {
- d = f[h].toLowerCase();
- e = c[d];
- h > 0 && g.push(",");
- g.push("'", e ? a(encodeURIComponent(c[d])) : "", "'")
- }
- g.push(")");
- return g.join("")
- }
- function g(a) {
- var a = a.config.emailProtection || "",
- b;
- if(a && a != "encode") {
- b = {};
- a.replace(/^([^(]+)\(([^)]+)\)$/,
- function(a, c, d) {
- b.name = c;
- b.params = [];
- d.replace(/[^,\s]+/g, function(a) {
- b.params.push(a)
- })
- })
- }
- return b
- }
- CKEDITOR.plugins.add("link", {
- requires: "dialog,fakeobjects",
- onLoad: function() {
- function a(b) {
- return c.replace(/%1/g, b == "rtl" ? "right" : "left").replace(/%2/g, "cke_contents_" + b)
- }
- var b = "background:url(" + CKEDITOR.getUrl(this.path + "images" + (CKEDITOR.env.hidpi ? "/hidpi" : "") + "/anchor.png") + ") no-repeat %1 center;border:1px dotted #00f;background-size:16px;",
- c = ".%2 a.cke_anchor,.%2 a.cke_anchor_empty,.cke_editable.%2 a[name],.cke_editable.%2 a[data-cke-saved-name]{" +
- b + "padding-%1:18px;cursor:auto;}.%2 img.cke_anchor{" + b + "width:16px;min-height:15px;height:1.15em;vertical-align:text-bottom;}";
- CKEDITOR.addCss(a("ltr") + a("rtl"))
- },
- init: function(a) {
- var b = "a[!href]";
- CKEDITOR.dialog.isTabEnabled(a, "link", "advanced") && (b = b.replace("]", ",accesskey,charset,dir,id,lang,name,rel,tabindex,title,type]{*}(*)"));
- CKEDITOR.dialog.isTabEnabled(a, "link", "target") && (b = b.replace("]", ",target,onclick]"));
- a.addCommand("link", new CKEDITOR.dialogCommand("link", {
- allowedContent: b,
- requiredContent: "a[href]"
- }));
- a.addCommand("anchor", new CKEDITOR.dialogCommand("anchor", {
- allowedContent: "a[!name,id]",
- requiredContent: "a[name]"
- }));
- a.addCommand("unlink", new CKEDITOR.unlinkCommand);
- a.addCommand("removeAnchor", new CKEDITOR.removeAnchorCommand);
- a.setKeystroke(CKEDITOR.CTRL + 76, "link");
- if(a.ui.addButton) {
- a.ui.addButton("Link", {
- label: a.lang.link.toolbar,
- command: "link",
- toolbar: "links,10"
- });
- a.ui.addButton("Unlink", {
- label: a.lang.link.unlink,
- command: "unlink",
- toolbar: "links,20"
- });
- a.ui.addButton("Anchor", {
- label: a.lang.link.anchor.toolbar,
- command: "anchor",
- toolbar: "links,30"
- })
- }
- CKEDITOR.dialog.add("link", this.path + "dialogs/link.js");
- CKEDITOR.dialog.add("anchor", this.path + "dialogs/anchor.js");
- a.on("doubleclick", function(b) {
- var c = CKEDITOR.plugins.link.getSelectedLink(a) || b.data.element;
- if(!c.isReadOnly())
- if(c.is("a")) {
- b.data.dialog = c.getAttribute("name") && (!c.getAttribute("href") || !c.getChildCount()) ? "anchor" : "link";
- b.data.link = c
- } else if(CKEDITOR.plugins.link.tryRestoreFakeAnchor(a, c)) b.data.dialog = "anchor"
- }, null, null, 0);
- a.on("doubleclick",
- function(b) {
- b.data.dialog in {
- link: 1,
- anchor: 1
- } && b.data.link && a.getSelection().selectElement(b.data.link)
- }, null, null, 20);
- a.addMenuItems && a.addMenuItems({
- anchor: {
- label: a.lang.link.anchor.menu,
- command: "anchor",
- group: "anchor",
- order: 1
- },
- removeAnchor: {
- label: a.lang.link.anchor.remove,
- command: "removeAnchor",
- group: "anchor",
- order: 5
- },
- link: {
- label: a.lang.link.menu,
- command: "link",
- group: "link",
- order: 1
- },
- unlink: {
- label: a.lang.link.unlink,
- command: "unlink",
- group: "link",
- order: 5
- }
- });
- a.contextMenu && a.contextMenu.addListener(function(b) {
- if(!b ||
- b.isReadOnly()) return null;
- b = CKEDITOR.plugins.link.tryRestoreFakeAnchor(a, b);
- if(!b && !(b = CKEDITOR.plugins.link.getSelectedLink(a))) return null;
- var c = {};
- b.getAttribute("href") && b.getChildCount() && (c = {
- link: CKEDITOR.TRISTATE_OFF,
- unlink: CKEDITOR.TRISTATE_OFF
- });
- if(b && b.hasAttribute("name")) c.anchor = c.removeAnchor = CKEDITOR.TRISTATE_OFF;
- return c
- });
- this.compiledProtectionFunction = g(a)
- },
- afterInit: function(a) {
- a.dataProcessor.dataFilter.addRules({
- elements: {
- a: function(b) {
- return !b.attributes.name ? null : !b.children.length ?
- a.createFakeParserElement(b, "cke_anchor", "anchor") : null
- }
- }
- });
- var b = a._.elementsPath && a._.elementsPath.filters;
- b && b.push(function(b, c) {
- if(c == "a" && (CKEDITOR.plugins.link.tryRestoreFakeAnchor(a, b) || b.getAttribute("name") && (!b.getAttribute("href") || !b.getChildCount()))) return "anchor"
- })
- }
- });
- var c = /^javascript:/,
- d = /^mailto:([^?]+)(?:\?(.+))?$/,
- j = /subject=([^;?:@&=$,\/]*)/,
- f = /body=([^;?:@&=$,\/]*)/,
- h = /^#(.*)$/,
- i = /^((?:http|https|ftp|news):\/\/)?(.*)$/,
- k = /^(_(?:self|top|parent|blank))$/,
- n = /^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,
- o = /^javascript:([^(]+)\(([^)]+)\)$/,
- q = /\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/,
- m = /(?:^|,)([^=]+)=(\d+|yes|no)/gi,
- l = {
- id: "advId",
- dir: "advLangDir",
- accessKey: "advAccessKey",
- name: "advName",
- lang: "advLangCode",
- tabindex: "advTabIndex",
- title: "advTitle",
- type: "advContentType",
- "class": "advCSSClasses",
- charset: "advCharset",
- style: "advStyles",
- rel: "advRel"
- };
- CKEDITOR.plugins.link = {
- getSelectedLink: function(a) {
- var b = a.getSelection(),
- c = b.getSelectedElement();
- if(c && c.is("a")) return c;
- if(b = b.getRanges()[0]) {
- b.shrink(CKEDITOR.SHRINK_TEXT);
- return a.elementPath(b.getCommonAncestor()).contains("a", 1)
- }
- return null
- },
- getEditorAnchors: function(a) {
- for(var b = a.editable(), c = b.isInline() && !a.plugins.divarea ? a.document : b, b = c.getElementsByTag("a"), c = c.getElementsByTag("img"), d = [], f = 0, e; e = b.getItem(f++);)
- if(e.data("cke-saved-name") || e.hasAttribute("name")) d.push({
- name: e.data("cke-saved-name") || e.getAttribute("name"),
- id: e.getAttribute("id")
- });
- for(f = 0; e = c.getItem(f++);)(e =
- this.tryRestoreFakeAnchor(a, e)) && d.push({
- name: e.getAttribute("name"),
- id: e.getAttribute("id")
- });
- return d
- },
- fakeAnchor: true,
- tryRestoreFakeAnchor: function(a, b) {
- if(b && b.data("cke-real-element-type") && b.data("cke-real-element-type") == "anchor") {
- var c = a.restoreRealElement(b);
- if(c.data("cke-saved-name")) return c
- }
- },
- parseLinkAttributes: function(a, b) {
- var e = b && (b.data("cke-saved-href") || b.getAttribute("href")) || "",
- g = a.plugins.link.compiledProtectionFunction,
- w = a.config.emailProtection,
- x, v = {};
- e.match(c) && (w == "encode" ?
- e = e.replace(n, function(a, b, c) {
- return "mailto:" + String.fromCharCode.apply(String, b.split(",")) + (c && c.replace(/\\'/g, "'"))
- }) : w && e.replace(o, function(a, b, c) {
- if(b == g.name) {
- v.type = "email";
- for(var a = v.email = {}, b = /(^')|('$)/g, c = c.match(/[^,\s]+/g), d = c.length, f, e, h = 0; h < d; h++) {
- f = decodeURIComponent;
- e = c[h].replace(b, "").replace(/\\'/g, "'");
- e = f(e);
- f = g.params[h].toLowerCase();
- a[f] = e
- }
- a.address = [a.name, a.domain].join("@")
- }
- }));
- if(!v.type)
- if(w = e.match(h)) {
- v.type = "anchor";
- v.anchor = {};
- v.anchor.name = v.anchor.id = w[1]
- } else if(w =
- e.match(d)) {
- x = e.match(j);
- e = e.match(f);
- v.type = "email";
- var r = v.email = {};
- r.address = w[1];
- x && (r.subject = decodeURIComponent(x[1]));
- e && (r.body = decodeURIComponent(e[1]))
- } else if(e && (x = e.match(i))) {
- v.type = "url";
- v.url = {};
- v.url.protocol = x[1];
- v.url.url = x[2]
- }
- if(b) {
- if(e = b.getAttribute("target")) v.target = {
- type: e.match(k) ? e : "frame",
- name: e
- };
- else if(e = (e = b.data("cke-pa-onclick") || b.getAttribute("onclick")) && e.match(q))
- for(v.target = {
- type: "popup",
- name: e[1]
- }; w = m.exec(e[2]);)(w[2] == "yes" || w[2] == "1") && !(w[1] in {
- height: 1,
- width: 1,
- top: 1,
- left: 1
- }) ? v.target[w[1]] = true : isFinite(w[2]) && (v.target[w[1]] = w[2]);
- var e = {},
- y;
- for(y in l)(w = b.getAttribute(y)) && (e[l[y]] = w);
- if(y = b.data("cke-saved-name") || e.advName) e.advName = y;
- if(!CKEDITOR.tools.isEmpty(e)) v.advanced = e
- }
- return v
- },
- getLinkAttributes: function(c, d) {
- var f = c.config.emailProtection || "",
- g = {};
- switch(d.type) {
- case "url":
- var f = d.url && d.url.protocol !== void 0 ? d.url.protocol : "http://",
- h = d.url && CKEDITOR.tools.trim(d.url.url) || "";
- g["data-cke-saved-href"] = h.indexOf("/") === 0 ? h : f + h;
- break;
- case "anchor":
- f = d.anchor && d.anchor.id;
- g["data-cke-saved-href"] = "#" + (d.anchor && d.anchor.name || f || "");
- break;
- case "email":
- var i = d.email,
- h = i.address;
- switch(f) {
- case "":
- case "encode":
- var j = encodeURIComponent(i.subject || ""),
- k = encodeURIComponent(i.body || ""),
- i = [];
- j && i.push("subject=" + j);
- k && i.push("body=" + k);
- i = i.length ? "?" + i.join("&") : "";
- if(f == "encode") {
- f = ["javascript:void(location.href='mailto:'+", e(h)];
- i && f.push("+'", a(i), "'");
- f.push(")")
- } else f = ["mailto:", h, i];
- break;
- default:
- f = h.split("@", 2);
- i.name = f[0];
- i.domain = f[1];
- f = ["javascript:", b(c, i)]
- }
- g["data-cke-saved-href"] = f.join("")
- }
- if(d.target)
- if(d.target.type == "popup") {
- for(var f = ["window.open(this.href, '", d.target.name || "", "', '"], m = ["resizable", "status", "location", "toolbar", "menubar", "fullscreen", "scrollbars", "dependent"], h = m.length, j = function(a) {
- d.target[a] && m.push(a + "=" + d.target[a])
- }, i = 0; i < h; i++) m[i] = m[i] + (d.target[m[i]] ? "=yes" : "=no");
- j("width");
- j("left");
- j("height");
- j("top");
- f.push(m.join(","), "'); return false;");
- g["data-cke-pa-onclick"] = f.join("")
- } else if(d.target.type !=
- "notSet" && d.target.name) g.target = d.target.name;
- if(d.advanced) {
- for(var q in l)(f = d.advanced[l[q]]) && (g[q] = f);
- if(g.name) g["data-cke-saved-name"] = g.name
- }
- if(g["data-cke-saved-href"]) g.href = g["data-cke-saved-href"];
- q = CKEDITOR.tools.extend({
- target: 1,
- onclick: 1,
- "data-cke-pa-onclick": 1,
- "data-cke-saved-name": 1
- }, l);
- for(var n in g) delete q[n];
- return {
- set: g,
- removed: CKEDITOR.tools.objectKeys(q)
- }
- }
- };
- CKEDITOR.unlinkCommand = function() {};
- CKEDITOR.unlinkCommand.prototype = {
- exec: function(a) {
- var b = new CKEDITOR.style({
- element: "a",
- type: CKEDITOR.STYLE_INLINE,
- alwaysRemoveElement: 1
- });
- a.removeStyle(b)
- },
- refresh: function(a, b) {
- var c = b.lastElement && b.lastElement.getAscendant("a", true);
- c && c.getName() == "a" && c.getAttribute("href") && c.getChildCount() ? this.setState(CKEDITOR.TRISTATE_OFF) : this.setState(CKEDITOR.TRISTATE_DISABLED)
- },
- contextSensitive: 1,
- startDisabled: 1,
- requiredContent: "a[href]"
- };
- CKEDITOR.removeAnchorCommand = function() {};
- CKEDITOR.removeAnchorCommand.prototype = {
- exec: function(a) {
- var b = a.getSelection(),
- c = b.createBookmarks(),
- d;
- if(b &&
- (d = b.getSelectedElement()) && (!d.getChildCount() ? CKEDITOR.plugins.link.tryRestoreFakeAnchor(a, d) : d.is("a"))) d.remove(1);
- else if(d = CKEDITOR.plugins.link.getSelectedLink(a))
- if(d.hasAttribute("href")) {
- d.removeAttributes({
- name: 1,
- "data-cke-saved-name": 1
- });
- d.removeClass("cke_anchor")
- } else d.remove(1);
- b.selectBookmarks(c)
- },
- requiredContent: "a[name]"
- };
- CKEDITOR.tools.extend(CKEDITOR.config, {
- linkShowAdvancedTab: true,
- linkShowTargetTab: true
- })
- }(), "use strict",
- function() {
- function a(a, b, c) {
- return k(b) && k(c) && c.equals(b.getNext(function(a) {
- return !(Y(a) ||
- Z(a) || n(a))
- }))
- }
- function e(a) {
- this.upper = a[0];
- this.lower = a[1];
- this.set.apply(this, a.slice(2))
- }
- function b(a) {
- var b = a.element;
- if(b && k(b))
- if((b = b.getAscendant(a.triggers, true)) && a.editable.contains(b)) {
- var c = d(b);
- if(c.getAttribute("contenteditable") == "true") return b;
- if(c.is(a.triggers)) return c
- }
- return null
- }
- function g(a, b, c) {
- u(a, b);
- u(a, c);
- a = b.size.bottom;
- c = c.size.top;
- return a && c ? 0 | (a + c) / 2 : a || c
- }
- function c(a, b, c) {
- return b = b[c ? "getPrevious" : "getNext"](function(b) {
- return b && b.type == CKEDITOR.NODE_TEXT && !Y(b) ||
- k(b) && !n(b) && !i(a, b)
- })
- }
- function d(a, b) {
- if(a.data("cke-editable")) return null;
- for(b || (a = a.getParent()); a;) {
- if(a.data("cke-editable")) break;
- if(a.hasAttribute("contenteditable")) return a;
- a = a.getParent()
- }
- return null
- }
- function j(a) {
- var b = a.doc,
- c = z('<span contenteditable="false" style="' + P + "position:absolute;border-top:1px dashed " + a.boxColor + '"></span>', b),
- d = CKEDITOR.getUrl(this.path + "images/" + (B.hidpi ? "hidpi/" : "") + "icon" + (a.rtl ? "-rtl" : "") + ".png");
- r(c, {
- attach: function() {
- this.wrap.getParent() || this.wrap.appendTo(a.editable,
- true);
- return this
- },
- lineChildren: [r(z('<span title="' + a.editor.lang.magicline.title + '" contenteditable="false">↵</span>', b), {
- base: P + "height:17px;width:17px;" + (a.rtl ? "left" : "right") + ":17px;background:url(" + d + ") center no-repeat " + a.boxColor + ";cursor:pointer;" + (B.hc ? "font-size: 15px;line-height:14px;border:1px solid #fff;text-align:center;" : "") + (B.hidpi ? "background-size: 9px 10px;" : ""),
- looks: ["top:-8px;" + CKEDITOR.tools.cssVendorPrefix("border-radius", "2px", 1), "top:-17px;" + CKEDITOR.tools.cssVendorPrefix("border-radius",
- "2px 2px 0px 0px", 1), "top:-1px;" + CKEDITOR.tools.cssVendorPrefix("border-radius", "0px 0px 2px 2px", 1)]
- }), r(z(W, b), {
- base: V + "left:0px;border-left-color:" + a.boxColor + ";",
- looks: ["border-width:8px 0 8px 8px;top:-8px", "border-width:8px 0 0 8px;top:-8px", "border-width:0 0 8px 8px;top:0px"]
- }), r(z(W, b), {
- base: V + "right:0px;border-right-color:" + a.boxColor + ";",
- looks: ["border-width:8px 8px 8px 0;top:-8px", "border-width:8px 8px 0 0;top:-8px", "border-width:0 8px 8px 0;top:0px"]
- })],
- detach: function() {
- this.wrap.getParent() &&
- this.wrap.remove();
- return this
- },
- mouseNear: function() {
- u(a, this);
- var b = a.holdDistance,
- c = this.size;
- return c && a.mouse.y > c.top - b && a.mouse.y < c.bottom + b && a.mouse.x > c.left - b && a.mouse.x < c.right + b ? true : false
- },
- place: function() {
- var b = a.view,
- c = a.editable,
- d = a.trigger,
- f = d.upper,
- e = d.lower,
- g = f || e,
- h = g.getParent(),
- i = {};
- this.trigger = d;
- f && u(a, f, true);
- e && u(a, e, true);
- u(a, h, true);
- a.inInlineMode && w(a, true);
- if(h.equals(c)) {
- i.left = b.scroll.x;
- i.right = -b.scroll.x;
- i.width = ""
- } else {
- i.left = g.size.left - g.size.margin.left + b.scroll.x -
- (a.inInlineMode ? b.editable.left + b.editable.border.left : 0);
- i.width = g.size.outerWidth + g.size.margin.left + g.size.margin.right + b.scroll.x;
- i.right = ""
- }
- if(f && e) i.top = f.size.margin.bottom === e.size.margin.top ? 0 | f.size.bottom + f.size.margin.bottom / 2 : f.size.margin.bottom < e.size.margin.top ? f.size.bottom + f.size.margin.bottom : f.size.bottom + f.size.margin.bottom - e.size.margin.top;
- else if(f) {
- if(!e) i.top = f.size.bottom + f.size.margin.bottom
- } else i.top = e.size.top - e.size.margin.top;
- if(d.is(L) || i.top > b.scroll.y - 15 && i.top <
- b.scroll.y + 5) {
- i.top = a.inInlineMode ? 0 : b.scroll.y;
- this.look(L)
- } else if(d.is(H) || i.top > b.pane.bottom - 5 && i.top < b.pane.bottom + 15) {
- i.top = a.inInlineMode ? b.editable.height + b.editable.padding.top + b.editable.padding.bottom : b.pane.bottom - 1;
- this.look(H)
- } else {
- if(a.inInlineMode) i.top = i.top - (b.editable.top + b.editable.border.top);
- this.look(Q)
- }
- if(a.inInlineMode) {
- i.top--;
- i.top = i.top + b.editable.scroll.top;
- i.left = i.left + b.editable.scroll.left
- }
- for(var j in i) i[j] = CKEDITOR.tools.cssLength(i[j]);
- this.setStyles(i)
- },
- look: function(a) {
- if(this.oldLook !=
- a) {
- for(var b = this.lineChildren.length, c; b--;)(c = this.lineChildren[b]).setAttribute("style", c.base + c.looks[0 | a / 2]);
- this.oldLook = a
- }
- },
- wrap: new y("span", a.doc)
- });
- for(b = c.lineChildren.length; b--;) c.lineChildren[b].appendTo(c);
- c.look(Q);
- c.appendTo(c.wrap);
- c.unselectable();
- c.lineChildren[0].on("mouseup", function(b) {
- c.detach();
- f(a, function(b) {
- var c = a.line.trigger;
- b[c.is(J) ? "insertBefore" : "insertAfter"](c.is(J) ? c.lower : c.upper)
- }, true);
- a.editor.focus();
- !B.ie && a.enterMode != CKEDITOR.ENTER_BR && a.hotNode.scrollIntoView();
- b.data.preventDefault(true)
- });
- c.on("mousedown", function(a) {
- a.data.preventDefault(true)
- });
- a.line = c
- }
- function f(a, b, c) {
- var f = new CKEDITOR.dom.range(a.doc),
- e = a.editor,
- g;
- if(B.ie && a.enterMode == CKEDITOR.ENTER_BR) g = a.doc.createText(O);
- else {
- g = (g = d(a.element, true)) && g.data("cke-enter-mode") || a.enterMode;
- g = new y(D[g], a.doc);
- g.is("br") || a.doc.createText(O).appendTo(g)
- }
- c && e.fire("saveSnapshot");
- b(g);
- f.moveToPosition(g, CKEDITOR.POSITION_AFTER_START);
- e.getSelection().selectRanges([f]);
- a.hotNode = g;
- c && e.fire("saveSnapshot")
- }
- function h(a, e) {
- return {
- canUndo: true,
- modes: {
- wysiwyg: 1
- },
- exec: function() {
- function g(b) {
- var c = B.ie && B.version < 9 ? " " : O,
- d = a.hotNode && a.hotNode.getText() == c && a.element.equals(a.hotNode) && a.lastCmdDirection === !!e;
- f(a, function(c) {
- d && a.hotNode && a.hotNode.remove();
- c[e ? "insertAfter" : "insertBefore"](b);
- c.setAttributes({
- "data-cke-magicline-hot": 1,
- "data-cke-magicline-dir": !!e
- });
- a.lastCmdDirection = !!e
- });
- !B.ie && a.enterMode != CKEDITOR.ENTER_BR && a.hotNode.scrollIntoView();
- a.line.detach()
- }
- return function(f) {
- var f = f.getSelection().getStartElement(),
- h, f = f.getAscendant(N, 1);
- if(!m(a, f) && f && !f.equals(a.editable) && !f.contains(a.editable)) {
- if((h = d(f)) && h.getAttribute("contenteditable") == "false") f = h;
- a.element = f;
- h = c(a, f, !e);
- var i;
- if(k(h) && h.is(a.triggers) && h.is(R) && (!c(a, h, !e) || (i = c(a, h, !e)) && k(i) && i.is(a.triggers))) g(h);
- else {
- i = b(a, f);
- if(k(i))
- if(c(a, i, !e))(f = c(a, i, !e)) && (k(f) && f.is(a.triggers)) && g(i);
- else g(i)
- }
- }
- }
- }()
- }
- }
- function i(a, b) {
- if(!b || !(b.type == CKEDITOR.NODE_ELEMENT && b.$)) return false;
- var c = a.line;
- return c.wrap.equals(b) || c.wrap.contains(b)
- }
- function k(a) {
- return a &&
- a.type == CKEDITOR.NODE_ELEMENT && a.$
- }
- function n(a) {
- if(!k(a)) return false;
- var b;
- if(!(b = o(a)))
- if(k(a)) {
- b = {
- left: 1,
- right: 1,
- center: 1
- };
- b = !(!b[a.getComputedStyle("float")] && !b[a.getAttribute("align")])
- } else b = false;
- return b
- }
- function o(a) {
- return !!{
- absolute: 1,
- fixed: 1
- }[a.getComputedStyle("position")]
- }
- function q(a, b) {
- return k(b) ? b.is(a.triggers) : null
- }
- function m(a, b) {
- if(!b) return false;
- for(var c = b.getParents(1), d = c.length; d--;)
- for(var f = a.tabuList.length; f--;)
- if(c[d].hasAttribute(a.tabuList[f])) return true;
- return false
- }
- function l(a, b, c) {
- b = b[c ? "getLast" : "getFirst"](function(b) {
- return a.isRelevant(b) && !b.is(K)
- });
- if(!b) return false;
- u(a, b);
- return c ? b.size.top > a.mouse.y : b.size.bottom < a.mouse.y
- }
- function p(a) {
- var b = a.editable,
- c = a.mouse,
- d = a.view,
- f = a.triggerOffset;
- w(a);
- var g = c.y > (a.inInlineMode ? d.editable.top + d.editable.height / 2 : Math.min(d.editable.height, d.pane.height) / 2),
- b = b[g ? "getLast" : "getFirst"](function(a) {
- return !(Y(a) || Z(a))
- });
- if(!b) return null;
- i(a, b) && (b = a.line.wrap[g ? "getPrevious" : "getNext"](function(a) {
- return !(Y(a) ||
- Z(a))
- }));
- if(!k(b) || n(b) || !q(a, b)) return null;
- u(a, b);
- if(!g && b.size.top >= 0 && c.y > 0 && c.y < b.size.top + f) {
- a = a.inInlineMode || d.scroll.y === 0 ? L : Q;
- return new e([null, b, J, E, a])
- }
- if(g && b.size.bottom <= d.pane.height && c.y > b.size.bottom - f && c.y < d.pane.height) {
- a = a.inInlineMode || b.size.bottom > d.pane.height - f && b.size.bottom < d.pane.height ? H : Q;
- return new e([b, null, C, E, a])
- }
- return null
- }
- function t(a) {
- var d = a.mouse,
- f = a.view,
- g = a.triggerOffset,
- h = b(a);
- if(!h) return null;
- u(a, h);
- var g = Math.min(g, 0 | h.size.outerHeight / 2),
- i = [],
- j, m;
- if(d.y >
- h.size.top - 1 && d.y < h.size.top + g) m = false;
- else if(d.y > h.size.bottom - g && d.y < h.size.bottom + 1) m = true;
- else return null;
- if(n(h) || l(a, h, m) || h.getParent().is(M)) return null;
- var p = c(a, h, !m);
- if(p) {
- if(p && p.type == CKEDITOR.NODE_TEXT) return null;
- if(k(p)) {
- if(n(p) || !q(a, p) || p.getParent().is(M)) return null;
- i = [p, h][m ? "reverse" : "concat"]().concat([F, E])
- }
- } else {
- if(h.equals(a.editable[m ? "getLast" : "getFirst"](a.isRelevant))) {
- w(a);
- m && d.y > h.size.bottom - g && d.y < f.pane.height && h.size.bottom > f.pane.height - g && h.size.bottom < f.pane.height ?
- j = H : d.y > 0 && d.y < h.size.top + g && (j = L)
- } else j = Q;
- i = [null, h][m ? "reverse" : "concat"]().concat([m ? C : J, E, j, h.equals(a.editable[m ? "getLast" : "getFirst"](a.isRelevant)) ? m ? H : L : Q])
- }
- return 0 in i ? new e(i) : null
- }
- function s(a, b, c, d) {
- for(var f = function() {
- var c = B.ie ? b.$.currentStyle : a.win.$.getComputedStyle(b.$, "");
- return B.ie ? function(a) {
- return c[CKEDITOR.tools.cssStyleToDomStyle(a)]
- } : function(a) {
- return c.getPropertyValue(a)
- }
- }(), e = b.getDocumentPosition(), g = {}, h = {}, i = {}, j = {}, k = X.length; k--;) {
- g[X[k]] = parseInt(f("border-" +
- X[k] + "-width"), 10) || 0;
- i[X[k]] = parseInt(f("padding-" + X[k]), 10) || 0;
- h[X[k]] = parseInt(f("margin-" + X[k]), 10) || 0
- }(!c || d) && x(a, d);
- j.top = e.y - (c ? 0 : a.view.scroll.y);
- j.left = e.x - (c ? 0 : a.view.scroll.x);
- j.outerWidth = b.$.offsetWidth;
- j.outerHeight = b.$.offsetHeight;
- j.height = j.outerHeight - (i.top + i.bottom + g.top + g.bottom);
- j.width = j.outerWidth - (i.left + i.right + g.left + g.right);
- j.bottom = j.top + j.outerHeight;
- j.right = j.left + j.outerWidth;
- if(a.inInlineMode) j.scroll = {
- top: b.$.scrollTop,
- left: b.$.scrollLeft
- };
- return r({
- border: g,
- padding: i,
- margin: h,
- ignoreScroll: c
- }, j, true)
- }
- function u(a, b, c) {
- if(!k(b)) return b.size = null;
- if(b.size) {
- if(b.size.ignoreScroll == c && b.size.date > new Date - T) return null
- } else b.size = {};
- return r(b.size, s(a, b, c), {
- date: +new Date
- }, true)
- }
- function w(a, b) {
- a.view.editable = s(a, a.editable, b, true)
- }
- function x(a, b) {
- if(!a.view) a.view = {};
- var c = a.view;
- if(b || !(c && c.date > new Date - T)) {
- var d = a.win,
- c = d.getScrollPosition(),
- d = d.getViewPaneSize();
- r(a.view, {
- scroll: {
- x: c.x,
- y: c.y,
- width: a.doc.$.documentElement.scrollWidth - d.width,
- height: a.doc.$.documentElement.scrollHeight -
- d.height
- },
- pane: {
- width: d.width,
- height: d.height,
- bottom: d.height + c.y
- },
- date: +new Date
- }, true)
- }
- }
- function v(a, b, c, d) {
- for(var f = d, g = d, h = 0, i = false, j = false, k = a.view.pane.height, m = a.mouse; m.y + h < k && m.y - h > 0;) {
- i || (i = b(f, d));
- j || (j = b(g, d));
- !i && m.y - h > 0 && (f = c(a, {
- x: m.x,
- y: m.y - h
- }));
- !j && m.y + h < k && (g = c(a, {
- x: m.x,
- y: m.y + h
- }));
- if(i && j) break;
- h = h + 2
- }
- return new e([f, g, null, null])
- }
- CKEDITOR.plugins.add("magicline", {
- init: function(a) {
- var d = a.config,
- g = d.magicline_triggerOffset || 30,
- l = {
- editor: a,
- enterMode: d.enterMode,
- triggerOffset: g,
- holdDistance: 0 |
- g * (d.magicline_holdDistance || 0.5),
- boxColor: d.magicline_color || "#ff0000",
- rtl: d.contentsLangDirection == "rtl",
- tabuList: ["data-cke-hidden-sel"].concat(d.magicline_tabuList || []),
- triggers: d.magicline_everywhere ? N : {
- table: 1,
- hr: 1,
- div: 1,
- ul: 1,
- ol: 1,
- dl: 1,
- form: 1,
- blockquote: 1
- }
- },
- q, u, v;
- l.isRelevant = function(a) {
- return k(a) && !i(l, a) && !n(a)
- };
- a.on("contentDom", function() {
- var g = a.editable(),
- k = a.document,
- n = a.window;
- r(l, {
- editable: g,
- inInlineMode: g.isInline(),
- doc: k,
- win: n,
- hotNode: null
- }, true);
- l.boundary = l.inInlineMode ? l.editable :
- l.doc.getDocumentElement();
- if(!g.is(G.$inline)) {
- l.inInlineMode && !o(g) && g.setStyles({
- position: "relative",
- top: null,
- left: null
- });
- j.call(this, l);
- x(l);
- g.attachListener(a, "beforeUndoImage", function() {
- l.line.detach()
- });
- g.attachListener(a, "beforeGetData", function() {
- if(l.line.wrap.getParent()) {
- l.line.detach();
- a.once("getData", function() {
- l.line.attach()
- }, null, null, 1E3)
- }
- }, null, null, 0);
- g.attachListener(l.inInlineMode ? k : k.getWindow().getFrame(), "mouseout", function(b) {
- if(a.mode == "wysiwyg")
- if(l.inInlineMode) {
- var c =
- b.data.$.clientX,
- b = b.data.$.clientY;
- x(l);
- w(l, true);
- var d = l.view.editable,
- f = l.view.scroll;
- if(!(c > d.left - f.x && c < d.right - f.x) || !(b > d.top - f.y && b < d.bottom - f.y)) {
- clearTimeout(v);
- v = null;
- l.line.detach()
- }
- } else {
- clearTimeout(v);
- v = null;
- l.line.detach()
- }
- });
- g.attachListener(g, "keyup", function() {
- l.hiddenMode = 0
- });
- g.attachListener(g, "keydown", function(b) {
- if(a.mode == "wysiwyg") switch(b.data.getKeystroke()) {
- case 2228240:
- case 16:
- l.hiddenMode = 1;
- l.line.detach()
- }
- });
- g.attachListener(l.inInlineMode ? g : k, "mousemove", function(b) {
- u =
- true;
- if(!(a.mode != "wysiwyg" || a.readOnly || v)) {
- var c = {
- x: b.data.$.clientX,
- y: b.data.$.clientY
- };
- v = setTimeout(function() {
- l.mouse = c;
- v = l.trigger = null;
- x(l);
- if(u && !l.hiddenMode && a.focusManager.hasFocus && !l.line.mouseNear() && (l.element = S(l, true))) {
- if((l.trigger = p(l) || t(l) || ba(l)) && !m(l, l.trigger.upper || l.trigger.lower)) l.line.attach().place();
- else {
- l.trigger = null;
- l.line.detach()
- }
- u = false
- }
- }, 30)
- }
- });
- g.attachListener(n, "scroll", function() {
- if(a.mode == "wysiwyg") {
- l.line.detach();
- if(B.webkit) {
- l.hiddenMode = 1;
- clearTimeout(q);
- q = setTimeout(function() {
- if(!l.mouseDown) l.hiddenMode = 0
- }, 50)
- }
- }
- });
- g.attachListener(A ? k : n, "mousedown", function() {
- if(a.mode == "wysiwyg") {
- l.line.detach();
- l.hiddenMode = 1;
- l.mouseDown = 1
- }
- });
- g.attachListener(A ? k : n, "mouseup", function() {
- l.hiddenMode = 0;
- l.mouseDown = 0
- });
- a.addCommand("accessPreviousSpace", h(l));
- a.addCommand("accessNextSpace", h(l, true));
- a.setKeystroke([
- [d.magicline_keystrokePrevious, "accessPreviousSpace"],
- [d.magicline_keystrokeNext, "accessNextSpace"]
- ]);
- a.on("loadSnapshot", function() {
- var b, c, d, f;
- for(f in {
- p: 1,
- br: 1,
- div: 1
- }) {
- b = a.document.getElementsByTag(f);
- for(d = b.count(); d--;)
- if((c = b.getItem(d)).data("cke-magicline-hot")) {
- l.hotNode = c;
- l.lastCmdDirection = c.data("cke-magicline-dir") === "true" ? true : false;
- return
- }
- }
- });
- this.backdoor = {
- accessFocusSpace: f,
- boxTrigger: e,
- isLine: i,
- getAscendantTrigger: b,
- getNonEmptyNeighbour: c,
- getSize: s,
- that: l,
- triggerEdge: t,
- triggerEditable: p,
- triggerExpand: ba
- }
- }
- }, this)
- }
- });
- var r = CKEDITOR.tools.extend,
- y = CKEDITOR.dom.element,
- z = y.createFromHtml,
- B = CKEDITOR.env,
- A = CKEDITOR.env.ie && CKEDITOR.env.version <
- 9,
- G = CKEDITOR.dtd,
- D = {},
- J = 128,
- C = 64,
- F = 32,
- E = 16,
- I = 8,
- L = 4,
- H = 2,
- Q = 1,
- O = " ",
- M = G.$listItem,
- K = G.$tableContent,
- R = r({}, G.$nonEditable, G.$empty),
- N = G.$block,
- T = 100,
- P = "width:0px;height:0px;padding:0px;margin:0px;display:block;z-index:9999;color:#fff;position:absolute;font-size: 0px;line-height:0px;",
- V = P + "border-color:transparent;display:block;border-style:solid;",
- W = "<span>" + O + "</span>";
- D[CKEDITOR.ENTER_BR] = "br";
- D[CKEDITOR.ENTER_P] = "p";
- D[CKEDITOR.ENTER_DIV] = "div";
- e.prototype = {
- set: function(a, b, c) {
- this.properties = a + b +
- (c || Q);
- return this
- },
- is: function(a) {
- return(this.properties & a) == a
- }
- };
- var S = function() {
- function a(b, c) {
- var d = b.$.elementFromPoint(c.x, c.y);
- return d && d.nodeType ? new CKEDITOR.dom.element(d) : null
- }
- return function(b, c, d) {
- if(!b.mouse) return null;
- var f = b.doc,
- e = b.line.wrap,
- d = d || b.mouse,
- g = a(f, d);
- if(c && i(b, g)) {
- e.hide();
- g = a(f, d);
- e.show()
- }
- return !g || !(g.type == CKEDITOR.NODE_ELEMENT && g.$) || B.ie && B.version < 9 && !b.boundary.equals(g) && !b.boundary.contains(g) ? null : g
- }
- }(),
- Y = CKEDITOR.dom.walker.whitespaces(),
- Z = CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_COMMENT),
- ba = function() {
- function b(d) {
- var f = d.element,
- e, h, i;
- if(!k(f) || f.contains(d.editable) || f.isReadOnly()) return null;
- i = v(d, function(a, b) {
- return !b.equals(a)
- }, function(a, b) {
- return S(a, true, b)
- }, f);
- e = i.upper;
- h = i.lower;
- if(a(d, e, h)) return i.set(F, I);
- if(e && f.contains(e))
- for(; !e.getParent().equals(f);) e = e.getParent();
- else e = f.getFirst(function(a) {
- return c(d, a)
- });
- if(h && f.contains(h))
- for(; !h.getParent().equals(f);) h = h.getParent();
- else h = f.getLast(function(a) {
- return c(d, a)
- });
- if(!e || !h) return null;
- u(d, e);
- u(d, h);
- if(!(d.mouse.y >
- e.size.top && d.mouse.y < h.size.bottom)) return null;
- for(var f = Number.MAX_VALUE, j, m, l, q; h && !h.equals(e);) {
- if(!(m = e.getNext(d.isRelevant))) break;
- j = Math.abs(g(d, e, m) - d.mouse.y);
- if(j < f) {
- f = j;
- l = e;
- q = m
- }
- e = m;
- u(d, e)
- }
- if(!l || !q || !(d.mouse.y > l.size.top && d.mouse.y < q.size.bottom)) return null;
- i.upper = l;
- i.lower = q;
- return i.set(F, I)
- }
- function c(a, b) {
- return !(b && b.type == CKEDITOR.NODE_TEXT || Z(b) || n(b) || i(a, b) || b.type == CKEDITOR.NODE_ELEMENT && b.$ && b.is("br"))
- }
- return function(c) {
- var d = b(c),
- f;
- if(f = d) {
- f = d.upper;
- var e = d.lower;
- f = !f || !e || n(e) || n(f) || e.equals(f) || f.equals(e) || e.contains(f) || f.contains(e) ? false : q(c, f) && q(c, e) && a(c, f, e) ? true : false
- }
- return f ? d : null
- }
- }(),
- X = ["top", "left", "right", "bottom"]
- }(), CKEDITOR.config.magicline_keystrokePrevious = CKEDITOR.CTRL + CKEDITOR.SHIFT + 51, CKEDITOR.config.magicline_keystrokeNext = CKEDITOR.CTRL + CKEDITOR.SHIFT + 52,
- function() {
- function a(a) {
- if(!a || a.type != CKEDITOR.NODE_ELEMENT || a.getName() != "form") return [];
- for(var b = [], c = ["style", "className"], e = 0; e < c.length; e++) {
- var g = a.$.elements.namedItem(c[e]);
- if(g) {
- g = new CKEDITOR.dom.element(g);
- b.push([g, g.nextSibling]);
- g.remove()
- }
- }
- return b
- }
- function e(a, b) {
- if(a && !(a.type != CKEDITOR.NODE_ELEMENT || a.getName() != "form") && b.length > 0)
- for(var c = b.length - 1; c >= 0; c--) {
- var e = b[c][0],
- g = b[c][1];
- g ? e.insertBefore(g) : e.appendTo(a)
- }
- }
- function b(b, c) {
- var f = a(b),
- g = {},
- i = b.$;
- if(!c) {
- g["class"] = i.className || "";
- i.className = ""
- }
- g.inline = i.style.cssText || "";
- if(!c) i.style.cssText = "position: static; overflow: visible";
- e(f);
- return g
- }
- function g(b, c) {
- var f = a(b),
- g = b.$;
- if("class" in c) g.className =
- c["class"];
- if("inline" in c) g.style.cssText = c.inline;
- e(f)
- }
- function c(a) {
- if(!a.editable().isInline()) {
- var b = CKEDITOR.instances,
- c;
- for(c in b) {
- var e = b[c];
- if(e.mode == "wysiwyg" && !e.readOnly) {
- e = e.document.getBody();
- e.setAttribute("contentEditable", false);
- e.setAttribute("contentEditable", true)
- }
- }
- if(a.editable().hasFocus) {
- a.toolbox.focus();
- a.focus()
- }
- }
- }
- CKEDITOR.plugins.add("maximize", {
- init: function(a) {
- function e() {
- var b = i.getViewPaneSize();
- a.resize(b.width, b.height, null, true)
- }
- if(a.elementMode != CKEDITOR.ELEMENT_MODE_INLINE) {
- var f =
- a.lang,
- h = CKEDITOR.document,
- i = h.getWindow(),
- k, n, o, q = CKEDITOR.TRISTATE_OFF;
- a.addCommand("maximize", {
- modes: {
- wysiwyg: !CKEDITOR.env.iOS,
- source: !CKEDITOR.env.iOS
- },
- readOnly: 1,
- editorFocus: false,
- exec: function() {
- var m = a.container.getFirst(function(a) {
- return a.type == CKEDITOR.NODE_ELEMENT && a.hasClass("cke_inner")
- }),
- l = a.ui.space("contents");
- if(a.mode == "wysiwyg") {
- var p = a.getSelection();
- k = p && p.getRanges();
- n = i.getScrollPosition()
- } else {
- var t = a.editable().$;
- k = !CKEDITOR.env.ie && [t.selectionStart, t.selectionEnd];
- n = [t.scrollLeft,
- t.scrollTop
- ]
- }
- if(this.state == CKEDITOR.TRISTATE_OFF) {
- i.on("resize", e);
- o = i.getScrollPosition();
- for(p = a.container; p = p.getParent();) {
- p.setCustomData("maximize_saved_styles", b(p));
- p.setStyle("z-index", a.config.baseFloatZIndex - 5)
- }
- l.setCustomData("maximize_saved_styles", b(l, true));
- m.setCustomData("maximize_saved_styles", b(m, true));
- l = {
- overflow: CKEDITOR.env.webkit ? "" : "hidden",
- width: 0,
- height: 0
- };
- h.getDocumentElement().setStyles(l);
- !CKEDITOR.env.gecko && h.getDocumentElement().setStyle("position", "fixed");
- (!CKEDITOR.env.gecko ||
- !CKEDITOR.env.quirks) && h.getBody().setStyles(l);
- CKEDITOR.env.ie ? setTimeout(function() {
- i.$.scrollTo(0, 0)
- }, 0) : i.$.scrollTo(0, 0);
- m.setStyle("position", CKEDITOR.env.gecko && CKEDITOR.env.quirks ? "fixed" : "absolute");
- m.$.offsetLeft;
- m.setStyles({
- "z-index": a.config.baseFloatZIndex - 5,
- left: "0px",
- top: "0px"
- });
- m.addClass("cke_maximized");
- e();
- l = m.getDocumentPosition();
- m.setStyles({
- left: -1 * l.x + "px",
- top: -1 * l.y + "px"
- });
- CKEDITOR.env.gecko && c(a)
- } else if(this.state == CKEDITOR.TRISTATE_ON) {
- i.removeListener("resize", e);
- l = [l,
- m
- ];
- for(p = 0; p < l.length; p++) {
- g(l[p], l[p].getCustomData("maximize_saved_styles"));
- l[p].removeCustomData("maximize_saved_styles")
- }
- for(p = a.container; p = p.getParent();) {
- g(p, p.getCustomData("maximize_saved_styles"));
- p.removeCustomData("maximize_saved_styles")
- }
- CKEDITOR.env.ie ? setTimeout(function() {
- i.$.scrollTo(o.x, o.y)
- }, 0) : i.$.scrollTo(o.x, o.y);
- m.removeClass("cke_maximized");
- if(CKEDITOR.env.webkit) {
- m.setStyle("display", "inline");
- setTimeout(function() {
- m.setStyle("display", "block")
- }, 0)
- }
- a.fire("resize")
- }
- this.toggleState();
- if(p = this.uiItems[0]) {
- l = this.state == CKEDITOR.TRISTATE_OFF ? f.maximize.maximize : f.maximize.minimize;
- p = CKEDITOR.document.getById(p._.id);
- p.getChild(1).setHtml(l);
- p.setAttribute("title", l);
- p.setAttribute("href", 'javascript:void("' + l + '");')
- }
- if(a.mode == "wysiwyg")
- if(k) {
- CKEDITOR.env.gecko && c(a);
- a.getSelection().selectRanges(k);
- (t = a.getSelection().getStartElement()) && t.scrollIntoView(true)
- } else i.$.scrollTo(n.x, n.y);
- else {
- if(k) {
- t.selectionStart = k[0];
- t.selectionEnd = k[1]
- }
- t.scrollLeft = n[0];
- t.scrollTop = n[1]
- }
- k =
- n = null;
- q = this.state;
- a.fire("maximize", this.state)
- },
- canUndo: false
- });
- a.ui.addButton && a.ui.addButton("Maximize", {
- label: f.maximize.maximize,
- command: "maximize",
- toolbar: "tools,10"
- });
- a.on("mode", function() {
- var b = a.getCommand("maximize");
- b.setState(b.state == CKEDITOR.TRISTATE_DISABLED ? CKEDITOR.TRISTATE_DISABLED : q)
- }, null, null, 100)
- }
- }
- })
- }(),
- function() {
- function a(a, e, c) {
- var d = CKEDITOR.cleanWord;
- if(d) c();
- else {
- a = CKEDITOR.getUrl(a.config.pasteFromWordCleanupFile || e + "filter/default.js");
- CKEDITOR.scriptLoader.load(a,
- c, null, true)
- }
- return !d
- }
- function e(a) {
- a.data.type = "html"
- }
- CKEDITOR.plugins.add("pastefromword", {
- requires: "clipboard",
- init: function(b) {
- var g = 0,
- c = this.path;
- b.addCommand("pastefromword", {
- canUndo: false,
- async: true,
- exec: function(a) {
- var b = this;
- g = 1;
- a.once("beforePaste", e);
- a.getClipboardData({
- title: a.lang.pastefromword.title
- }, function(c) {
- c && a.fire("paste", {
- type: "html",
- dataValue: c.dataValue
- });
- a.fire("afterCommandExec", {
- name: "pastefromword",
- command: b,
- returnValue: !!c
- })
- })
- }
- });
- b.ui.addButton && b.ui.addButton("PasteFromWord", {
- label: b.lang.pastefromword.toolbar,
- command: "pastefromword",
- toolbar: "clipboard,50"
- });
- b.on("pasteState", function(a) {
- b.getCommand("pastefromword").setState(a.data)
- });
- b.on("paste", function(d) {
- var e = d.data,
- f = e.dataValue;
- if(f && (g || /(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(f))) {
- var h = a(b, c, function() {
- if(h) b.fire("paste", e);
- else if(!b.config.pasteFromWordPromptCleanup || g || confirm(b.lang.pastefromword.confirmCleanup)) e.dataValue = CKEDITOR.cleanWord(f, b);
- g = 0
- });
- h && d.cancel()
- }
- }, null, null, 3)
- }
- })
- }(),
- function() {
- var a = {
- canUndo: false,
- async: true,
- exec: function(e) {
- e.getClipboardData({
- title: e.lang.pastetext.title
- }, function(b) {
- b && e.fire("paste", {
- type: "text",
- dataValue: b.dataValue
- });
- e.fire("afterCommandExec", {
- name: "pastetext",
- command: a,
- returnValue: !!b
- })
- })
- }
- };
- CKEDITOR.plugins.add("pastetext", {
- requires: "clipboard",
- init: function(e) {
- e.addCommand("pastetext", a);
- e.ui.addButton && e.ui.addButton("PasteText", {
- label: e.lang.pastetext.button,
- command: "pastetext",
- toolbar: "clipboard,40"
- });
- if(e.config.forcePasteAsPlainText) e.on("beforePaste",
- function(a) {
- if(a.data.type != "html") a.data.type = "text"
- });
- e.on("pasteState", function(a) {
- e.getCommand("pastetext").setState(a.data)
- })
- }
- })
- }(), CKEDITOR.plugins.add("removeformat", {
- init: function(a) {
- a.addCommand("removeFormat", CKEDITOR.plugins.removeformat.commands.removeformat);
- a.ui.addButton && a.ui.addButton("RemoveFormat", {
- label: a.lang.removeformat.toolbar,
- command: "removeFormat",
- toolbar: "cleanup,10"
- })
- }
- }), CKEDITOR.plugins.removeformat = {
- commands: {
- removeformat: {
- exec: function(a) {
- for(var e = a._.removeFormatRegex ||
- (a._.removeFormatRegex = RegExp("^(?:" + a.config.removeFormatTags.replace(/,/g, "|") + ")$", "i")), b = a._.removeAttributes || (a._.removeAttributes = a.config.removeFormatAttributes.split(",")), g = CKEDITOR.plugins.removeformat.filter, c = a.getSelection().getRanges(), d = c.createIterator(), j = function(a) {
- return a.type == CKEDITOR.NODE_ELEMENT
- }, f; f = d.getNextRange();) {
- f.collapsed || f.enlarge(CKEDITOR.ENLARGE_ELEMENT);
- var h = f.createBookmark(),
- i = h.startNode,
- k = h.endNode,
- n = function(b) {
- for(var c = a.elementPath(b), d = c.elements,
- f = 1, h; h = d[f]; f++) {
- if(h.equals(c.block) || h.equals(c.blockLimit)) break;
- e.test(h.getName()) && g(a, h) && b.breakParent(h)
- }
- };
- n(i);
- if(k) {
- n(k);
- for(i = i.getNextSourceNode(true, CKEDITOR.NODE_ELEMENT); i;) {
- if(i.equals(k)) break;
- if(i.isReadOnly()) {
- if(i.getPosition(k) & CKEDITOR.POSITION_CONTAINS) break;
- i = i.getNext(j)
- } else {
- n = i.getNextSourceNode(false, CKEDITOR.NODE_ELEMENT);
- if(!(i.getName() == "img" && i.data("cke-realelement")) && g(a, i))
- if(e.test(i.getName())) i.remove(1);
- else {
- i.removeAttributes(b);
- a.fire("removeFormatCleanup",
- i)
- }
- i = n
- }
- }
- }
- f.moveToBookmark(h)
- }
- a.forceNextSelectionCheck();
- a.getSelection().selectRanges(c)
- }
- }
- },
- filter: function(a, e) {
- for(var b = a._.removeFormatFilters || [], g = 0; g < b.length; g++)
- if(b[g](e) === false) return false;
- return true
- }
- }, CKEDITOR.editor.prototype.addRemoveFormatFilter = function(a) {
- if(!this._.removeFormatFilters) this._.removeFormatFilters = [];
- this._.removeFormatFilters.push(a)
- }, CKEDITOR.config.removeFormatTags = "b,big,cite,code,del,dfn,em,font,i,ins,kbd,q,s,samp,small,span,strike,strong,sub,sup,tt,u,var",
- CKEDITOR.config.removeFormatAttributes = "class,style,lang,width,height,align,hspace,valign", CKEDITOR.plugins.add("resize", {
- init: function(a) {
- var e, b, g, c;
- function d(d) {
- var h = e,
- j = b,
- k = h + (d.data.$.screenX - g) * (i == "rtl" ? -1 : 1),
- d = j + (d.data.$.screenY - c);
- n && (h = Math.max(f.resize_minWidth, Math.min(k, f.resize_maxWidth)));
- o && (j = Math.max(f.resize_minHeight, Math.min(d, f.resize_maxHeight)));
- a.resize(n ? h : null, j)
- }
- function j() {
- CKEDITOR.document.removeListener("mousemove", d);
- CKEDITOR.document.removeListener("mouseup", j);
- if(a.document) {
- a.document.removeListener("mousemove", d);
- a.document.removeListener("mouseup", j)
- }
- }
- var f = a.config,
- h = a.ui.spaceId("resizer"),
- i = a.element ? a.element.getDirection(1) : "ltr";
- !f.resize_dir && (f.resize_dir = "vertical");
- f.resize_maxWidth === void 0 && (f.resize_maxWidth = 3E3);
- f.resize_maxHeight === void 0 && (f.resize_maxHeight = 3E3);
- f.resize_minWidth === void 0 && (f.resize_minWidth = 750);
- f.resize_minHeight === void 0 && (f.resize_minHeight = 250);
- if(f.resize_enabled !== false) {
- var k = null,
- n = (f.resize_dir == "both" || f.resize_dir ==
- "horizontal") && f.resize_minWidth != f.resize_maxWidth,
- o = (f.resize_dir == "both" || f.resize_dir == "vertical") && f.resize_minHeight != f.resize_maxHeight,
- q = CKEDITOR.tools.addFunction(function(h) {
- k || (k = a.getResizable());
- e = k.$.offsetWidth || 0;
- b = k.$.offsetHeight || 0;
- g = h.screenX;
- c = h.screenY;
- f.resize_minWidth > e && (f.resize_minWidth = e);
- f.resize_minHeight > b && (f.resize_minHeight = b);
- CKEDITOR.document.on("mousemove", d);
- CKEDITOR.document.on("mouseup", j);
- if(a.document) {
- a.document.on("mousemove", d);
- a.document.on("mouseup",
- j)
- }
- h.preventDefault && h.preventDefault()
- });
- a.on("destroy", function() {
- CKEDITOR.tools.removeFunction(q)
- });
- a.on("uiSpace", function(b) {
- if(b.data.space == "bottom") {
- var c = "";
- n && !o && (c = " cke_resizer_horizontal");
- !n && o && (c = " cke_resizer_vertical");
- var d = '<span id="' + h + '" class="cke_resizer' + c + " cke_resizer_" + i + '" title="' + CKEDITOR.tools.htmlEncode(a.lang.common.resize) + '" onmousedown="CKEDITOR.tools.callFunction(' + q + ', event)">' + (i == "ltr" ? "◢" : "◣") + "</span>";
- i == "ltr" && c == "ltr" ? b.data.html = b.data.html + d : b.data.html =
- d + b.data.html
- }
- }, a, null, 100);
- a.on("maximize", function(b) {
- a.ui.space("resizer")[b.data == CKEDITOR.TRISTATE_ON ? "hide" : "show"]()
- })
- }
- }
- }), CKEDITOR.plugins.add("menubutton", {
- requires: "button,menu",
- onLoad: function() {
- var a = function(a) {
- var b = this._,
- g = b.menu;
- if(b.state !== CKEDITOR.TRISTATE_DISABLED)
- if(b.on && g) g.hide();
- else {
- b.previousState = b.state;
- if(!g) {
- g = b.menu = new CKEDITOR.menu(a, {
- panel: {
- className: "cke_menu_panel",
- attributes: {
- "aria-label": a.lang.common.options
- }
- }
- });
- g.onHide = CKEDITOR.tools.bind(function() {
- var c =
- this.command ? a.getCommand(this.command).modes : this.modes;
- this.setState(!c || c[a.mode] ? b.previousState : CKEDITOR.TRISTATE_DISABLED);
- b.on = 0
- }, this);
- this.onMenu && g.addListener(this.onMenu)
- }
- this.setState(CKEDITOR.TRISTATE_ON);
- b.on = 1;
- setTimeout(function() {
- g.show(CKEDITOR.document.getById(b.id), 4)
- }, 0)
- }
- };
- CKEDITOR.ui.menuButton = CKEDITOR.tools.createClass({
- base: CKEDITOR.ui.button,
- $: function(e) {
- delete e.panel;
- this.base(e);
- this.hasArrow = true;
- this.click = a
- },
- statics: {
- handler: {
- create: function(a) {
- return new CKEDITOR.ui.menuButton(a)
- }
- }
- }
- })
- },
- beforeInit: function(a) {
- a.ui.addHandler(CKEDITOR.UI_MENUBUTTON, CKEDITOR.ui.menuButton.handler)
- }
- }), CKEDITOR.UI_MENUBUTTON = "menubutton", "use strict", CKEDITOR.plugins.add("scayt", {
- requires: "menubutton,dialog",
- tabToOpen: null,
- dialogName: "scaytDialog",
- init: function(a) {
- var e = this,
- b = CKEDITOR.plugins.scayt;
- this.bindEvents(a);
- this.parseConfig(a);
- this.addRule(a);
- CKEDITOR.dialog.add(this.dialogName, CKEDITOR.getUrl(this.path + "dialogs/options.js"));
- this.addMenuItems(a);
- var g = a.lang.scayt,
- c = CKEDITOR.env;
- a.ui.add("Scayt",
- CKEDITOR.UI_MENUBUTTON, {
- label: g.text_title,
- title: a.plugins.wsc ? a.lang.wsc.title : g.text_title,
- modes: {
- wysiwyg: !(c.ie && (c.version < 8 || c.quirks))
- },
- toolbar: "spellchecker,20",
- refresh: function() {
- var c = a.ui.instances.Scayt.getState();
- a.scayt && (c = b.state[a.name] ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF);
- a.fire("scaytButtonState", c)
- },
- onRender: function() {
- var b = this;
- a.on("scaytButtonState", function(a) {
- typeof a.data !== void 0 && b.setState(a.data)
- })
- },
- onMenu: function() {
- var c = a.scayt;
- a.getMenuItem("scaytToggle").label =
- a.lang.scayt[c && b.state[a.name] ? "btn_disable" : "btn_enable"];
- c = {
- scaytToggle: CKEDITOR.TRISTATE_OFF,
- scaytOptions: c ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
- scaytLangs: c ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
- scaytDict: c ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
- scaytAbout: c ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
- WSC: a.plugins.wsc ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED
- };
- a.config.scayt_uiTabs[0] || delete c.scaytOptions;
- a.config.scayt_uiTabs[1] || delete c.scaytLangs;
- a.config.scayt_uiTabs[2] || delete c.scaytDict;
- return c
- }
- });
- if(a.contextMenu && a.addMenuItems) {
- a.contextMenu.addListener(function() {
- var b = a.scayt,
- c;
- if(b) {
- var f = b.getSelectionNode();
- if(f = f ? f.getAttribute(b.getNodeAttribute()) : f) {
- c = e.menuGenerator(a, f, e);
- b.showBanner("." + a.contextMenu._.definition.panel.className.split(" ").join(" ."))
- }
- }
- return c
- });
- a.contextMenu._.onHide = CKEDITOR.tools.override(a.contextMenu._.onHide, function(b) {
- return function() {
- var c = a.scayt;
- c && c.hideBanner();
- return b.apply(this)
- }
- })
- }
- },
- addMenuItems: function(a) {
- var e = this,
- b = CKEDITOR.plugins.scayt;
- a.addMenuGroup("scaytButton");
- var g = a.config.scayt_contextMenuItemsOrder.split("|");
- if(g && g.length)
- for(var c = 0; c < g.length; c++) a.addMenuGroup("scayt_" + g[c], c - 10);
- g = {
- scaytToggle: {
- label: a.lang.scayt.btn_enable,
- group: "scaytButton",
- onClick: function() {
- var c = a.scayt;
- b.state[a.name] = !b.state[a.name];
- b.state[a.name] === true ? c || b.createScayt(a) : c && b.destroy(a)
- }
- },
- scaytAbout: {
- label: a.lang.scayt.btn_about,
- group: "scaytButton",
- onClick: function() {
- a.scayt.tabToOpen =
- "about";
- a.lockSelection();
- a.openDialog(e.dialogName)
- }
- },
- scaytOptions: {
- label: a.lang.scayt.btn_options,
- group: "scaytButton",
- onClick: function() {
- a.scayt.tabToOpen = "options";
- a.lockSelection();
- a.openDialog(e.dialogName)
- }
- },
- scaytLangs: {
- label: a.lang.scayt.btn_langs,
- group: "scaytButton",
- onClick: function() {
- a.scayt.tabToOpen = "langs";
- a.lockSelection();
- a.openDialog(e.dialogName)
- }
- },
- scaytDict: {
- label: a.lang.scayt.btn_dictionaries,
- group: "scaytButton",
- onClick: function() {
- a.scayt.tabToOpen = "dictionaries";
- a.lockSelection();
- a.openDialog(e.dialogName)
- }
- }
- };
- if(a.plugins.wsc) g.WSC = {
- label: a.lang.wsc.toolbar,
- group: "scaytButton",
- onClick: function() {
- var b = CKEDITOR.plugins.scayt,
- c = a.scayt,
- f = a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ? a.container.getText() : a.document.getBody().getText();
- if(f = f.replace(/\s/g, "")) {
- c && (b.state[a.name] && c.setMarkupPaused) && c.setMarkupPaused(true);
- a.lockSelection();
- a.execCommand("checkspell")
- } else alert("Nothing to check!")
- }
- };
- a.addMenuItems(g)
- },
- bindEvents: function(a) {
- function e() {
- var b = a.scayt;
- if(b) {
- b.removeMarkupInSelectionNode();
- b.fire("startSpellCheck")
- }
- }
- var b = CKEDITOR.plugins.scayt,
- g = a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE;
- CKEDITOR.on("dialogDefinition", function(a) {
- if(a.data.name === "scaytDialog") a.data.definition.dialog.on("cancel", function() {
- return false
- }, this, null, -1)
- });
- var c = function() {
- a.scayt && b.destroy(a)
- },
- d = function() {
- b.state[a.name] && !a.readOnly && b.createScayt(a)
- },
- j = function() {
- var b = a.editable();
- b.attachListener(b, "focus", function() {
- var b = CKEDITOR.plugins.scayt && CKEDITOR.plugins.scayt.state[a.name] && a.scayt,
- c, d;
- if((g || b) && a._.savedSelection)
- for(var b = a._.savedSelection.getSelectedElement(), b = !b && a._.savedSelection.getRanges(), f = 0; f < b.length; f++) {
- d = b[f];
- c = d.startContainer.getText().length;
- (c < d.startOffset || c < d.endOffset) && a.unlockSelection(false)
- }
- }, this, null, -10)
- },
- f = function() {
- if(g) {
- a.on("blur", c);
- a.on("focus", d);
- a.focusManager.hasFocus && d()
- } else d();
- j()
- };
- a.on("contentDom", f);
- a.on("beforeCommandExec", function(c) {
- var d;
- if(c.data.name in b.options.disablingCommandExec && a.mode == "wysiwyg") {
- if(d = a.scayt) {
- b.destroy(a);
- a.fire("scaytButtonState", CKEDITOR.TRISTATE_DISABLED)
- }
- } else if(c.data.name === "bold" || c.data.name === "italic" || c.data.name === "underline" || c.data.name === "strike" || c.data.name === "subscript" || c.data.name === "superscript")
- if(d = a.scayt) {
- d.removeMarkupInSelectionNode();
- setTimeout(function() {
- d.fire("startSpellCheck")
- }, 0)
- }
- });
- a.on("beforeSetMode", function(c) {
- if(c.data == "source") {
- if(c = a.scayt) {
- b.destroy(a);
- a.fire("scaytButtonState", CKEDITOR.TRISTATE_DISABLED)
- }
- if(a.document) {
- a.document.getBody().removeAttribute("_jquid");
- a.document.getBody().removeAttribute("dir")
- }
- }
- });
- a.on("afterCommandExec", function(b) {
- var c;
- if(a.mode == "wysiwyg" && (b.data.name == "undo" || b.data.name == "redo"))(c = a.scayt) && setTimeout(function() {
- c.fire("startSpellCheck")
- }, 250)
- });
- a.on("readOnly", function(c) {
- var d;
- if(c) {
- d = a.scayt;
- if(c.editor.readOnly === true) d && d.fire("removeMarkupInDocument", {});
- else if(d) d.fire("startSpellCheck");
- else if(c.editor.mode == "wysiwyg" && b.state[c.editor.name] === true) {
- b.createScayt(a);
- c.editor.fire("scaytButtonState", CKEDITOR.TRISTATE_ON)
- }
- }
- });
- a.on("beforeDestroy", c);
- a.on("setData", function() {
- c();
- a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE && f()
- }, this, null, 50);
- a.on("insertElement", function() {
- CKEDITOR.env.ie ? setTimeout(function() {
- e()
- }, 50) : e()
- }, this, null, 50);
- a.on("insertHtml", function() {
- e()
- }, this, null, 50);
- a.on("insertText", function() {
- e()
- }, this, null, 50);
- a.on("scaytDialogShown", function(b) {
- b.data.selectPage(a.scayt.tabToOpen)
- })
- },
- parseConfig: function(a) {
- var e = CKEDITOR.plugins.scayt;
- e.replaceOldOptionsNames(a.config);
- if(typeof a.config.scayt_autoStartup !==
- "boolean") a.config.scayt_autoStartup = false;
- e.state[a.name] = a.config.scayt_autoStartup;
- if(!a.config.scayt_contextCommands) a.config.scayt_contextCommands = "ignore|ignoreall|add";
- if(!a.config.scayt_contextMenuItemsOrder) a.config.scayt_contextMenuItemsOrder = "suggest|moresuggest|control";
- if(!a.config.scayt_sLang) a.config.scayt_sLang = "en_US";
- if(a.config.scayt_maxSuggestions === void 0 || typeof a.config.scayt_maxSuggestions != "number" || a.config.scayt_maxSuggestions < 0) a.config.scayt_maxSuggestions = 5;
- if(a.config.scayt_customDictionaryIds ===
- void 0 || typeof a.config.scayt_customDictionaryIds !== "string") a.config.scayt_customDictionaryIds = "";
- if(a.config.scayt_userDictionaryName === void 0 || typeof a.config.scayt_userDictionaryName !== "string") a.config.scayt_userDictionaryName = null;
- if(typeof a.config.scayt_uiTabs === "string" && a.config.scayt_uiTabs.split(",").length === 3) {
- var b = [],
- g = [];
- a.config.scayt_uiTabs = a.config.scayt_uiTabs.split(",");
- CKEDITOR.tools.search(a.config.scayt_uiTabs, function(a) {
- if(Number(a) === 1 || Number(a) === 0) {
- g.push(true);
- b.push(Number(a))
- } else g.push(false)
- });
- a.config.scayt_uiTabs = CKEDITOR.tools.search(g, false) === null ? b : [1, 1, 1]
- } else a.config.scayt_uiTabs = [1, 1, 1];
- if(typeof a.config.scayt_serviceProtocol != "string") a.config.scayt_serviceProtocol = null;
- if(typeof a.config.scayt_serviceHost != "string") a.config.scayt_serviceHost = null;
- if(typeof a.config.scayt_servicePort != "string") a.config.scayt_servicePort = null;
- if(typeof a.config.scayt_servicePath != "string") a.config.scayt_servicePath = null;
- if(!a.config.scayt_moreSuggestions) a.config.scayt_moreSuggestions = "on";
- if(typeof a.config.scayt_customerId !==
- "string") a.config.scayt_customerId = "1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2";
- if(typeof a.config.scayt_srcUrl !== "string") {
- e = document.location.protocol;
- e = e.search(/https?:/) != -1 ? e : "http:";
- a.config.scayt_srcUrl = e + "//svc.webspellchecker.net/spellcheck31/lf/scayt3/ckscayt/ckscayt.js"
- }
- if(typeof CKEDITOR.config.scayt_handleCheckDirty !== "boolean") CKEDITOR.config.scayt_handleCheckDirty = true;
- if(typeof CKEDITOR.config.scayt_handleUndoRedo !== "boolean") CKEDITOR.config.scayt_handleUndoRedo =
- true;
- if(a.config.scayt_disableOptionsStorage) {
- var e = CKEDITOR.tools.isArray(a.config.scayt_disableOptionsStorage) ? a.config.scayt_disableOptionsStorage : typeof a.config.scayt_disableOptionsStorage === "string" ? [a.config.scayt_disableOptionsStorage] : void 0,
- c = ["all", "options", "lang", "ignore-all-caps-words", "ignore-domain-names", "ignore-words-with-mixed-cases", "ignore-words-with-numbers"],
- d = ["lang", "ignore-all-caps-words", "ignore-domain-names", "ignore-words-with-mixed-cases", "ignore-words-with-numbers"],
- j = CKEDITOR.tools.search,
- f = CKEDITOR.tools.indexOf;
- a.config.scayt_disableOptionsStorage = function(a) {
- for(var b = [], e = 0; e < a.length; e++) {
- var g = a[e],
- o = !!j(a, "options");
- if(!j(c, g) || o && j(d, function(a) {
- if(a === "lang") return false
- })) return;
- j(d, g) && d.splice(f(d, g), 1);
- if(g === "all" || o && j(a, "lang")) return [];
- g === "options" && (d = ["lang"])
- }
- return b = b.concat(d)
- }(e)
- }
- },
- addRule: function(a) {
- var e = a.dataProcessor,
- b = e && e.htmlFilter,
- g = a._.elementsPath && a._.elementsPath.filters,
- e = e && e.dataFilter,
- c = a.addRemoveFormatFilter,
- d = function(b) {
- var c =
- CKEDITOR.plugins.scayt;
- if(a.scayt && b.hasAttribute(c.options.data_attribute_name)) return false
- },
- j = function(b) {
- var c = CKEDITOR.plugins.scayt,
- d = true;
- a.scayt && b.hasAttribute(c.options.data_attribute_name) && (d = false);
- return d
- };
- g && g.push(d);
- e && e.addRules({
- elements: {
- span: function(b) {
- var c = CKEDITOR.plugins.scayt;
- if(c && c.state[a.name] && b.classes && CKEDITOR.tools.search(b.classes, c.options.misspelled_word_class))
- if(b.classes && b.parent.type === CKEDITOR.NODE_DOCUMENT_FRAGMENT) {
- delete b.attributes.style;
- delete b.name
- } else delete b.classes[CKEDITOR.tools.indexOf(b.classes,
- c.options.misspelled_word_class)];
- return b
- }
- }
- });
- b && b.addRules({
- elements: {
- span: function(b) {
- var c = CKEDITOR.plugins.scayt;
- if(c && c.state[a.name] && b.hasClass(c.options.misspelled_word_class) && b.attributes[c.options.data_attribute_name]) {
- b.removeClass(c.options.misspelled_word_class);
- delete b.attributes[c.options.data_attribute_name];
- delete b.name
- }
- return b
- }
- }
- });
- c && c.call(a, j)
- },
- scaytMenuDefinition: function(a) {
- var e = this,
- a = a.scayt;
- return {
- scayt_ignore: {
- label: a.getLocal("btn_ignore"),
- group: "scayt_control",
- order: 1,
- exec: function(a) {
- a.scayt.ignoreWord()
- }
- },
- scayt_ignoreall: {
- label: a.getLocal("btn_ignoreAll"),
- group: "scayt_control",
- order: 2,
- exec: function(a) {
- a.scayt.ignoreAllWords()
- }
- },
- scayt_add: {
- label: a.getLocal("btn_addWord"),
- group: "scayt_control",
- order: 3,
- exec: function(a) {
- var e = a.scayt;
- setTimeout(function() {
- e.addWordToUserDictionary()
- }, 10)
- }
- },
- option: {
- label: a.getLocal("btn_options"),
- group: "scayt_control",
- order: 4,
- exec: function(a) {
- a.scayt.tabToOpen = "options";
- a.lockSelection();
- a.openDialog(e.dialogName)
- },
- verification: function(a) {
- return a.config.scayt_uiTabs[0] ==
- 1 ? true : false
- }
- },
- language: {
- label: a.getLocal("btn_langs"),
- group: "scayt_control",
- order: 5,
- exec: function(a) {
- a.scayt.tabToOpen = "langs";
- a.lockSelection();
- a.openDialog(e.dialogName)
- },
- verification: function(a) {
- return a.config.scayt_uiTabs[1] == 1 ? true : false
- }
- },
- dictionary: {
- label: a.getLocal("btn_dictionaries"),
- group: "scayt_control",
- order: 6,
- exec: function(a) {
- a.scayt.tabToOpen = "dictionaries";
- a.lockSelection();
- a.openDialog(e.dialogName)
- },
- verification: function(a) {
- return a.config.scayt_uiTabs[2] == 1 ? true : false
- }
- },
- about: {
- label: a.getLocal("btn_about"),
- group: "scayt_control",
- order: 7,
- exec: function(a) {
- a.scayt.tabToOpen = "about";
- a.lockSelection();
- a.openDialog(e.dialogName)
- }
- }
- }
- },
- buildSuggestionMenuItems: function(a, e) {
- var b = {},
- g = {},
- c = a.scayt;
- if(e.length > 0 && e[0] !== "no_any_suggestions")
- for(var d = 0; d < e.length; d++) {
- var j = "scayt_suggest_" + CKEDITOR.plugins.scayt.suggestions[d].replace(" ", "_");
- a.addCommand(j, this.createCommand(CKEDITOR.plugins.scayt.suggestions[d]));
- if(d < a.config.scayt_maxSuggestions) {
- a.addMenuItem(j, {
- label: e[d],
- command: j,
- group: "scayt_suggest",
- order: d + 1
- });
- b[j] = CKEDITOR.TRISTATE_OFF
- } else {
- a.addMenuItem(j, {
- label: e[d],
- command: j,
- group: "scayt_moresuggest",
- order: d + 1
- });
- g[j] = CKEDITOR.TRISTATE_OFF;
- if(a.config.scayt_moreSuggestions === "on") {
- a.addMenuItem("scayt_moresuggest", {
- label: c.getLocal("btn_moreSuggestions"),
- group: "scayt_moresuggest",
- order: 10,
- getItems: function() {
- return g
- }
- });
- b.scayt_moresuggest = CKEDITOR.TRISTATE_OFF
- }
- }
- } else {
- b.no_scayt_suggest = CKEDITOR.TRISTATE_DISABLED;
- a.addCommand("no_scayt_suggest", {
- exec: function() {}
- });
- a.addMenuItem("no_scayt_suggest", {
- label: c.getLocal("btn_noSuggestions") || "no_scayt_suggest",
- command: "no_scayt_suggest",
- group: "scayt_suggest",
- order: 0
- })
- }
- return b
- },
- menuGenerator: function(a, e) {
- var b = a.scayt,
- g = this.scaytMenuDefinition(a),
- c = {},
- d = a.config.scayt_contextCommands.split("|");
- b.fire("getSuggestionsList", {
- lang: b.getLang(),
- word: e
- });
- c = this.buildSuggestionMenuItems(a, CKEDITOR.plugins.scayt.suggestions);
- if(a.config.scayt_contextCommands == "off") return c;
- for(var j in g)
- if(!(CKEDITOR.tools.indexOf(d, j.replace("scayt_", "")) == -1 && a.config.scayt_contextCommands !=
- "all")) {
- c[j] = CKEDITOR.TRISTATE_OFF;
- typeof g[j].verification === "function" && !g[j].verification(a) && delete c[j];
- a.addCommand(j, {
- exec: g[j].exec
- });
- a.addMenuItem(j, {
- label: a.lang.scayt[g[j].label] || g[j].label,
- command: j,
- group: g[j].group,
- order: g[j].order
- })
- }
- return c
- },
- createCommand: function(a) {
- return {
- exec: function(e) {
- e.scayt.replaceSelectionNode({
- word: a
- })
- }
- }
- }
- }), CKEDITOR.plugins.scayt = {
- state: {},
- suggestions: [],
- loadingHelper: {
- loadOrder: []
- },
- isLoading: !1,
- options: {
- disablingCommandExec: {
- source: !0,
- newpage: !0,
- templates: !0
- },
- data_attribute_name: "data-scayt-word",
- misspelled_word_class: "scayt-misspell-word"
- },
- backCompatibilityMap: {
- scayt_service_protocol: "scayt_serviceProtocol",
- scayt_service_host: "scayt_serviceHost",
- scayt_service_port: "scayt_servicePort",
- scayt_service_path: "scayt_servicePath",
- scayt_customerid: "scayt_customerId"
- },
- replaceOldOptionsNames: function(a) {
- for(var e in a)
- if(e in this.backCompatibilityMap) {
- a[this.backCompatibilityMap[e]] = a[e];
- delete a[e]
- }
- },
- createScayt: function(a) {
- var e = this;
- this.loadScaytLibrary(a,
- function(a) {
- var g = {
- lang: a.config.scayt_sLang,
- container: a.editable().$.nodeName == "BODY" ? a.document.getWindow().$.frameElement : a.editable().$,
- customDictionary: a.config.scayt_customDictionaryIds,
- userDictionaryName: a.config.scayt_userDictionaryName,
- localization: a.langCode,
- customer_id: a.config.scayt_customerId,
- debug: a.config.scayt_debug,
- data_attribute_name: e.options.data_attribute_name,
- misspelled_word_class: e.options.misspelled_word_class,
- "options-to-restore": a.config.scayt_disableOptionsStorage,
- focused: a.editable().hasFocus,
- ignoreElementsRegex: a.config.scayt_elementsToIgnore
- };
- if(a.config.scayt_serviceProtocol) g.service_protocol = a.config.scayt_serviceProtocol;
- if(a.config.scayt_serviceHost) g.service_host = a.config.scayt_serviceHost;
- if(a.config.scayt_servicePort) g.service_port = a.config.scayt_servicePort;
- if(a.config.scayt_servicePath) g.service_path = a.config.scayt_servicePath;
- g = new SCAYT.CKSCAYT(g, function() {}, function() {});
- g.subscribe("suggestionListSend", function(a) {
- for(var b = {}, e = [], f = 0; f < a.suggestionList.length; f++)
- if(!b["word_" +
- a.suggestionList[f]]) {
- b["word_" + a.suggestionList[f]] = a.suggestionList[f];
- e.push(a.suggestionList[f])
- }
- CKEDITOR.plugins.scayt.suggestions = e
- });
- a.scayt = g;
- a.fire("scaytButtonState", a.readOnly ? CKEDITOR.TRISTATE_DISABLED : CKEDITOR.TRISTATE_ON)
- })
- },
- destroy: function(a) {
- a.scayt && a.scayt.destroy();
- delete a.scayt;
- a.fire("scaytButtonState", CKEDITOR.TRISTATE_OFF)
- },
- loadScaytLibrary: function(a, e) {
- var b = this;
- if(typeof window.SCAYT === "undefined" || typeof window.SCAYT.CKSCAYT !== "function") {
- this.loadingHelper[a.name] = e;
- this.loadingHelper.loadOrder.push(a.name);
- CKEDITOR.scriptLoader.load(a.config.scayt_srcUrl, function() {
- var a;
- CKEDITOR.fireOnce("scaytReady");
- for(var c = 0; c < b.loadingHelper.loadOrder.length; c++) {
- a = b.loadingHelper.loadOrder[c];
- if(typeof b.loadingHelper[a] === "function") b.loadingHelper[a](CKEDITOR.instances[a]);
- delete b.loadingHelper[a]
- }
- b.loadingHelper.loadOrder = []
- })
- } else if(window.SCAYT && typeof window.SCAYT.CKSCAYT === "function") {
- CKEDITOR.fireOnce("scaytReady");
- a.scayt || typeof e === "function" && e(a)
- }
- }
- }, CKEDITOR.on("scaytReady",
- function() {
- if(CKEDITOR.config.scayt_handleCheckDirty === true) {
- var a = CKEDITOR.editor.prototype;
- a.checkDirty = CKEDITOR.tools.override(a.checkDirty, function(a) {
- return function() {
- var e = null,
- c = this.scayt;
- if(!CKEDITOR.plugins.scayt || !CKEDITOR.plugins.scayt.state[this.name] || !this.scayt) e = a.call(this);
- else if(e = this.status == "ready") var d = c.removeMarkupFromString(this.getSnapshot()),
- c = c.removeMarkupFromString(this._.previousValue),
- e = e && c !== d;
- return e
- }
- });
- a.resetDirty = CKEDITOR.tools.override(a.resetDirty, function(a) {
- return function() {
- var e =
- this.scayt;
- !CKEDITOR.plugins.scayt || !CKEDITOR.plugins.scayt.state[this.name] || !this.scayt ? a.call(this) : this._.previousValue = e.removeMarkupFromString(this.getSnapshot())
- }
- })
- }
- if(CKEDITOR.config.scayt_handleUndoRedo === true) {
- var a = CKEDITOR.plugins.undo.Image.prototype,
- e = typeof a.equalsContent == "function" ? "equalsContent" : "equals";
- a[e] = CKEDITOR.tools.override(a[e], function(a) {
- return function(e) {
- var c = e.editor.scayt,
- d = this.contents,
- j = e.contents,
- f = null;
- if(CKEDITOR.plugins.scayt && CKEDITOR.plugins.scayt.state[e.editor.name] &&
- e.editor.scayt) {
- this.contents = c.removeMarkupFromString(d) || "";
- e.contents = c.removeMarkupFromString(j) || ""
- }
- f = a.apply(this, arguments);
- this.contents = d;
- e.contents = j;
- return f
- }
- })
- }
- }),
- function() {
- var a = {
- preserveState: true,
- editorFocus: false,
- readOnly: 1,
- exec: function(a) {
- this.toggleState();
- this.refresh(a)
- },
- refresh: function(a) {
- if(a.document) {
- var b = this.state == CKEDITOR.TRISTATE_ON ? "attachClass" : "removeClass";
- a.editable()[b]("cke_show_borders")
- }
- }
- };
- CKEDITOR.plugins.add("showborders", {
- modes: {
- wysiwyg: 1
- },
- onLoad: function() {
- var a;
- a = (CKEDITOR.env.ie6Compat ? [".%1 table.%2,", ".%1 table.%2 td, .%1 table.%2 th", "{", "border : #d3d3d3 1px dotted", "}"] : [".%1 table.%2,", ".%1 table.%2 > tr > td, .%1 table.%2 > tr > th,", ".%1 table.%2 > tbody > tr > td, .%1 table.%2 > tbody > tr > th,", ".%1 table.%2 > thead > tr > td, .%1 table.%2 > thead > tr > th,", ".%1 table.%2 > tfoot > tr > td, .%1 table.%2 > tfoot > tr > th", "{", "border : #d3d3d3 1px dotted", "}"]).join("").replace(/%2/g, "cke_show_border").replace(/%1/g, "cke_show_borders ");
- CKEDITOR.addCss(a)
- },
- init: function(e) {
- var b = e.addCommand("showborders", a);
- b.canUndo = false;
- e.config.startupShowBorders !== false && b.setState(CKEDITOR.TRISTATE_ON);
- e.on("mode", function() {
- b.state != CKEDITOR.TRISTATE_DISABLED && b.refresh(e)
- }, null, null, 100);
- e.on("contentDom", function() {
- b.state != CKEDITOR.TRISTATE_DISABLED && b.refresh(e)
- });
- e.on("removeFormatCleanup", function(a) {
- a = a.data;
- e.getCommand("showborders").state == CKEDITOR.TRISTATE_ON && (a.is("table") && (!a.hasAttribute("border") || parseInt(a.getAttribute("border"), 10) <= 0)) &&
- a.addClass("cke_show_border")
- })
- },
- afterInit: function(a) {
- var b = a.dataProcessor,
- a = b && b.dataFilter,
- b = b && b.htmlFilter;
- a && a.addRules({
- elements: {
- table: function(a) {
- var a = a.attributes,
- b = a["class"],
- d = parseInt(a.border, 10);
- if((!d || d <= 0) && (!b || b.indexOf("cke_show_border") == -1)) a["class"] = (b || "") + " cke_show_border"
- }
- }
- });
- b && b.addRules({
- elements: {
- table: function(a) {
- var a = a.attributes,
- b = a["class"];
- b && (a["class"] = b.replace("cke_show_border", "").replace(/\s{2}/, " ").replace(/^\s+|\s+$/, ""))
- }
- }
- })
- }
- });
- CKEDITOR.on("dialogDefinition",
- function(a) {
- var b = a.data.name;
- if(b == "table" || b == "tableProperties") {
- a = a.data.definition;
- b = a.getContents("info").get("txtBorder");
- b.commit = CKEDITOR.tools.override(b.commit, function(a) {
- return function(b, d) {
- a.apply(this, arguments);
- var e = parseInt(this.getValue(), 10);
- d[!e || e <= 0 ? "addClass" : "removeClass"]("cke_show_border")
- }
- });
- if(a = (a = a.getContents("advanced")) && a.get("advCSSClasses")) {
- a.setup = CKEDITOR.tools.override(a.setup, function(a) {
- return function() {
- a.apply(this, arguments);
- this.setValue(this.getValue().replace(/cke_show_border/,
- ""))
- }
- });
- a.commit = CKEDITOR.tools.override(a.commit, function(a) {
- return function(b, d) {
- a.apply(this, arguments);
- parseInt(d.getAttribute("border"), 10) || d.addClass("cke_show_border")
- }
- })
- }
- }
- })
- }(),
- function() {
- CKEDITOR.plugins.add("sourcearea", {
- init: function(e) {
- function b() {
- var a = c && this.equals(CKEDITOR.document.getActive());
- this.hide();
- this.setStyle("height", this.getParent().$.clientHeight + "px");
- this.setStyle("width", this.getParent().$.clientWidth + "px");
- this.show();
- a && this.focus()
- }
- if(e.elementMode != CKEDITOR.ELEMENT_MODE_INLINE) {
- var g =
- CKEDITOR.plugins.sourcearea;
- e.addMode("source", function(c) {
- var g = e.ui.space("contents").getDocument().createElement("textarea");
- g.setStyles(CKEDITOR.tools.extend({
- width: CKEDITOR.env.ie7Compat ? "99%" : "100%",
- height: "100%",
- resize: "none",
- outline: "none",
- "text-align": "left"
- }, CKEDITOR.tools.cssVendorPrefix("tab-size", e.config.sourceAreaTabSize || 4)));
- g.setAttribute("dir", "ltr");
- g.addClass("cke_source cke_reset cke_enable_context_menu");
- e.ui.space("contents").append(g);
- g = e.editable(new a(e, g));
- g.setData(e.getData(1));
- if(CKEDITOR.env.ie) {
- g.attachListener(e, "resize", b, g);
- g.attachListener(CKEDITOR.document.getWindow(), "resize", b, g);
- CKEDITOR.tools.setTimeout(b, 0, g)
- }
- e.fire("ariaWidget", this);
- c()
- });
- e.addCommand("source", g.commands.source);
- e.ui.addButton && e.ui.addButton("Source", {
- label: e.lang.sourcearea.toolbar,
- command: "source",
- toolbar: "mode,10"
- });
- e.on("mode", function() {
- e.getCommand("source").setState(e.mode == "source" ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF)
- });
- var c = CKEDITOR.env.ie && CKEDITOR.env.version == 9
- }
- }
- });
- var a =
- CKEDITOR.tools.createClass({
- base: CKEDITOR.editable,
- proto: {
- setData: function(a) {
- this.setValue(a);
- this.status = "ready";
- this.editor.fire("dataReady")
- },
- getData: function() {
- return this.getValue()
- },
- insertHtml: function() {},
- insertElement: function() {},
- insertText: function() {},
- setReadOnly: function(a) {
- this[(a ? "set" : "remove") + "Attribute"]("readOnly", "readonly")
- },
- detach: function() {
- a.baseProto.detach.call(this);
- this.clearCustomData();
- this.remove()
- }
- }
- })
- }(), CKEDITOR.plugins.sourcearea = {
- commands: {
- source: {
- modes: {
- wysiwyg: 1,
- source: 1
- },
- editorFocus: !1,
- readOnly: 1,
- exec: function(a) {
- a.mode == "wysiwyg" && a.fire("saveSnapshot");
- a.getCommand("source").setState(CKEDITOR.TRISTATE_DISABLED);
- a.setMode(a.mode == "source" ? "wysiwyg" : "source")
- },
- canUndo: !1
- }
- }
- }, CKEDITOR.plugins.add("specialchar", {
- availableLangs: {
- af: 1,
- ar: 1,
- bg: 1,
- ca: 1,
- cs: 1,
- cy: 1,
- da: 1,
- de: 1,
- el: 1,
- en: 1,
- "en-gb": 1,
- eo: 1,
- es: 1,
- et: 1,
- fa: 1,
- fi: 1,
- fr: 1,
- "fr-ca": 1,
- gl: 1,
- he: 1,
- hr: 1,
- hu: 1,
- id: 1,
- it: 1,
- ja: 1,
- km: 1,
- ku: 1,
- lt: 1,
- lv: 1,
- nb: 1,
- nl: 1,
- no: 1,
- pl: 1,
- pt: 1,
- "pt-br": 1,
- ru: 1,
- si: 1,
- sk: 1,
- sl: 1,
- sq: 1,
- sv: 1,
- th: 1,
- tr: 1,
- tt: 1,
- ug: 1,
- uk: 1,
- vi: 1,
- zh: 1,
- "zh-cn": 1
- },
- requires: "dialog",
- init: function(a) {
- var e = this;
- CKEDITOR.dialog.add("specialchar", this.path + "dialogs/specialchar.js");
- a.addCommand("specialchar", {
- exec: function() {
- var b = a.langCode,
- b = e.availableLangs[b] ? b : e.availableLangs[b.replace(/-.*/, "")] ? b.replace(/-.*/, "") : "en";
- CKEDITOR.scriptLoader.load(CKEDITOR.getUrl(e.path + "dialogs/lang/" + b + ".js"), function() {
- CKEDITOR.tools.extend(a.lang.specialchar, e.langEntries[b]);
- a.openDialog("specialchar")
- })
- },
- modes: {
- wysiwyg: 1
- },
- canUndo: false
- });
- a.ui.addButton && a.ui.addButton("SpecialChar", {
- label: a.lang.specialchar.toolbar,
- command: "specialchar",
- toolbar: "insert,50"
- })
- }
- }), CKEDITOR.config.specialChars = "! " # $ % & ' ( ) * + - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ € ‘ ’ “ ” – — ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ ° ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ Œ œ Ŵ Ŷ ŵ ŷ ‚ ‛ „ … ™ ► • → ⇒ ⇔ ♦ ≈".split(" "),
- function() {
- CKEDITOR.plugins.add("stylescombo", {
- requires: "richcombo",
- init: function(a) {
- var e = a.config,
- b = a.lang.stylescombo,
- g = {},
- c = [],
- d = [];
- a.on("stylesSet", function(b) {
- if(b = b.data.styles) {
- for(var f, h, i, k = 0, n = b.length; k < n; k++) {
- f = b[k];
- if(!(a.blockless && f.element in CKEDITOR.dtd.$block)) {
- h = f.name;
- f = new CKEDITOR.style(f);
- if(!a.filter.customConfig || a.filter.check(f)) {
- f._name = h;
- f._.enterMode = e.enterMode;
- f._.type = i = f.assignedTo || f.type;
- f._.weight = k + (i == CKEDITOR.STYLE_OBJECT ? 1 : i == CKEDITOR.STYLE_BLOCK ? 2 : 3) * 1E3;
- g[h] = f;
- c.push(f);
- d.push(f)
- }
- }
- }
- c.sort(function(a, b) {
- return a._.weight - b._.weight
- })
- }
- });
- a.ui.addRichCombo("Styles", {
- label: b.label,
- title: b.panelTitle,
- toolbar: "styles,10",
- allowedContent: d,
- panel: {
- css: [CKEDITOR.skin.getPath("editor")].concat(e.contentsCss),
- multiSelect: true,
- attributes: {
- "aria-label": b.panelTitle
- }
- },
- init: function() {
- var a, d, e, g, k, n;
- k = 0;
- for(n = c.length; k < n; k++) {
- a = c[k];
- d = a._name;
- g = a._.type;
- if(g != e) {
- this.startGroup(b["panelTitle" + g]);
- e = g
- }
- this.add(d, a.type == CKEDITOR.STYLE_OBJECT ? d : a.buildPreview(),
- d)
- }
- this.commit()
- },
- onClick: function(b) {
- a.focus();
- a.fire("saveSnapshot");
- var b = g[b],
- c = a.elementPath();
- a[b.checkActive(c, a) ? "removeStyle" : "applyStyle"](b);
- a.fire("saveSnapshot")
- },
- onRender: function() {
- a.on("selectionChange", function(b) {
- for(var c = this.getValue(), b = b.data.path.elements, d = 0, e = b.length, k; d < e; d++) {
- k = b[d];
- for(var n in g)
- if(g[n].checkElementRemovable(k, true, a)) {
- n != c && this.setValue(n);
- return
- }
- }
- this.setValue("")
- }, this)
- },
- onOpen: function() {
- var c = a.getSelection().getSelectedElement(),
- c = a.elementPath(c),
- d = [0, 0, 0, 0];
- this.showAll();
- this.unmarkAll();
- for(var e in g) {
- var i = g[e],
- k = i._.type;
- i.checkApplicable(c, a, a.activeFilter) ? d[k]++ : this.hideItem(e);
- i.checkActive(c, a) && this.mark(e)
- }
- d[CKEDITOR.STYLE_BLOCK] || this.hideGroup(b["panelTitle" + CKEDITOR.STYLE_BLOCK]);
- d[CKEDITOR.STYLE_INLINE] || this.hideGroup(b["panelTitle" + CKEDITOR.STYLE_INLINE]);
- d[CKEDITOR.STYLE_OBJECT] || this.hideGroup(b["panelTitle" + CKEDITOR.STYLE_OBJECT])
- },
- refresh: function() {
- var b = a.elementPath();
- if(b) {
- for(var c in g)
- if(g[c].checkApplicable(b,
- a, a.activeFilter)) return;
- this.setState(CKEDITOR.TRISTATE_DISABLED)
- }
- },
- reset: function() {
- g = {};
- c = []
- }
- })
- }
- })
- }(),
- function() {
- function a(a) {
- return {
- editorFocus: false,
- canUndo: false,
- modes: {
- wysiwyg: 1
- },
- exec: function(b) {
- if(b.editable().hasFocus) {
- var e = b.getSelection(),
- f;
- if(f = (new CKEDITOR.dom.elementPath(e.getCommonAncestor(), e.root)).contains({
- td: 1,
- th: 1
- }, 1)) {
- var e = b.createRange(),
- g = CKEDITOR.tools.tryThese(function() {
- var b = f.getParent().$.cells[f.$.cellIndex + (a ? -1 : 1)];
- b.parentNode.parentNode;
- return b
- }, function() {
- var b =
- f.getParent(),
- b = b.getAscendant("table").$.rows[b.$.rowIndex + (a ? -1 : 1)];
- return b.cells[a ? b.cells.length - 1 : 0]
- });
- if(!g && !a) {
- for(var i = f.getAscendant("table").$, g = f.getParent().$.cells, i = new CKEDITOR.dom.element(i.insertRow(-1), b.document), k = 0, n = g.length; k < n; k++) i.append((new CKEDITOR.dom.element(g[k], b.document)).clone(false, false)).appendBogus();
- e.moveToElementEditStart(i)
- } else if(g) {
- g = new CKEDITOR.dom.element(g);
- e.moveToElementEditStart(g);
- (!e.checkStartOfBlock() || !e.checkEndOfBlock()) && e.selectNodeContents(g)
- } else return true;
- e.select(true);
- return true
- }
- }
- return false
- }
- }
- }
- var e = {
- editorFocus: false,
- modes: {
- wysiwyg: 1,
- source: 1
- }
- },
- b = {
- exec: function(a) {
- a.container.focusNext(true, a.tabIndex)
- }
- },
- g = {
- exec: function(a) {
- a.container.focusPrevious(true, a.tabIndex)
- }
- };
- CKEDITOR.plugins.add("tab", {
- init: function(c) {
- for(var d = c.config.enableTabKeyTools !== false, j = c.config.tabSpaces || 0, f = ""; j--;) f = f + " ";
- if(f) c.on("key", function(a) {
- if(a.data.keyCode == 9) {
- c.insertText(f);
- a.cancel()
- }
- });
- if(d) c.on("key", function(a) {
- (a.data.keyCode == 9 && c.execCommand("selectNextCell") ||
- a.data.keyCode == CKEDITOR.SHIFT + 9 && c.execCommand("selectPreviousCell")) && a.cancel()
- });
- c.addCommand("blur", CKEDITOR.tools.extend(b, e));
- c.addCommand("blurBack", CKEDITOR.tools.extend(g, e));
- c.addCommand("selectNextCell", a());
- c.addCommand("selectPreviousCell", a(true))
- }
- })
- }(), CKEDITOR.dom.element.prototype.focusNext = function(a, e) {
- var b = e === void 0 ? this.getTabIndex() : e,
- g, c, d, j, f, h;
- if(b <= 0)
- for(f = this.getNextSourceNode(a, CKEDITOR.NODE_ELEMENT); f;) {
- if(f.isVisible() && f.getTabIndex() === 0) {
- d = f;
- break
- }
- f = f.getNextSourceNode(false,
- CKEDITOR.NODE_ELEMENT)
- } else
- for(f = this.getDocument().getBody().getFirst(); f = f.getNextSourceNode(false, CKEDITOR.NODE_ELEMENT);) {
- if(!g)
- if(!c && f.equals(this)) {
- c = true;
- if(a) {
- if(!(f = f.getNextSourceNode(true, CKEDITOR.NODE_ELEMENT))) break;
- g = 1
- }
- } else c && !this.contains(f) && (g = 1);
- if(f.isVisible() && !((h = f.getTabIndex()) < 0)) {
- if(g && h == b) {
- d = f;
- break
- }
- if(h > b && (!d || !j || h < j)) {
- d = f;
- j = h
- } else if(!d && h === 0) {
- d = f;
- j = h
- }
- }
- }
- d && d.focus()
- }, CKEDITOR.dom.element.prototype.focusPrevious = function(a, e) {
- for(var b = e === void 0 ? this.getTabIndex() :
- e, g, c, d, j = 0, f, h = this.getDocument().getBody().getLast(); h = h.getPreviousSourceNode(false, CKEDITOR.NODE_ELEMENT);) {
- if(!g)
- if(!c && h.equals(this)) {
- c = true;
- if(a) {
- if(!(h = h.getPreviousSourceNode(true, CKEDITOR.NODE_ELEMENT))) break;
- g = 1
- }
- } else c && !this.contains(h) && (g = 1);
- if(h.isVisible() && !((f = h.getTabIndex()) < 0))
- if(b <= 0) {
- if(g && f === 0) {
- d = h;
- break
- }
- if(f > j) {
- d = h;
- j = f
- }
- } else {
- if(g && f == b) {
- d = h;
- break
- }
- if(f < b && (!d || f > j)) {
- d = h;
- j = f
- }
- }
- }
- d && d.focus()
- }, CKEDITOR.plugins.add("table", {
- requires: "dialog",
- init: function(a) {
- function e(a) {
- return CKEDITOR.tools.extend(a || {}, {
- contextSensitive: 1,
- refresh: function(a, b) {
- this.setState(b.contains("table", 1) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED)
- }
- })
- }
- if(!a.blockless) {
- var b = a.lang.table;
- a.addCommand("table", new CKEDITOR.dialogCommand("table", {
- context: "table",
- allowedContent: "table{width,height}[align,border,cellpadding,cellspacing,summary];caption tbody thead tfoot;th td tr[scope];" + (a.plugins.dialogadvtab ? "table" + a.plugins.dialogadvtab.allowedContent() : ""),
- requiredContent: "table",
- contentTransformations: [
- ["table{width}: sizeToStyle",
- "table[width]: sizeToAttribute"
- ]
- ]
- }));
- a.addCommand("tableProperties", new CKEDITOR.dialogCommand("tableProperties", e()));
- a.addCommand("tableDelete", e({
- exec: function(a) {
- var b = a.elementPath().contains("table", 1);
- if(b) {
- var d = b.getParent(),
- e = a.editable();
- d.getChildCount() == 1 && (!d.is("td", "th") && !d.equals(e)) && (b = d);
- a = a.createRange();
- a.moveToPosition(b, CKEDITOR.POSITION_BEFORE_START);
- b.remove();
- a.select()
- }
- }
- }));
- a.ui.addButton && a.ui.addButton("Table", {
- label: b.toolbar,
- command: "table",
- toolbar: "insert,30"
- });
- CKEDITOR.dialog.add("table", this.path + "dialogs/table.js");
- CKEDITOR.dialog.add("tableProperties", this.path + "dialogs/table.js");
- a.addMenuItems && a.addMenuItems({
- table: {
- label: b.menu,
- command: "tableProperties",
- group: "table",
- order: 5
- },
- tabledelete: {
- label: b.deleteTable,
- command: "tableDelete",
- group: "table",
- order: 1
- }
- });
- a.on("doubleclick", function(a) {
- if(a.data.element.is("table")) a.data.dialog = "tableProperties"
- });
- a.contextMenu && a.contextMenu.addListener(function() {
- return {
- tabledelete: CKEDITOR.TRISTATE_OFF,
- table: CKEDITOR.TRISTATE_OFF
- }
- })
- }
- }
- }),
- function() {
- function a(a) {
- function b(a) {
- if(!(c.length > 0) && a.type == CKEDITOR.NODE_ELEMENT && o.test(a.getName()) && !a.getCustomData("selected_cell")) {
- CKEDITOR.dom.element.setMarker(d, a, "selected_cell", true);
- c.push(a)
- }
- }
- for(var a = a.getRanges(), c = [], d = {}, f = 0; f < a.length; f++) {
- var e = a[f];
- if(e.collapsed) {
- e = e.getCommonAncestor();
- (e = e.getAscendant("td", true) || e.getAscendant("th", true)) && c.push(e)
- } else {
- var e = new CKEDITOR.dom.walker(e),
- g;
- for(e.guard = b; g = e.next();)
- if(g.type != CKEDITOR.NODE_ELEMENT || !g.is(CKEDITOR.dtd.table))
- if((g =
- g.getAscendant("td", true) || g.getAscendant("th", true)) && !g.getCustomData("selected_cell")) {
- CKEDITOR.dom.element.setMarker(d, g, "selected_cell", true);
- c.push(g)
- }
- }
- }
- CKEDITOR.dom.element.clearAllMarkers(d);
- return c
- }
- function e(b, c) {
- for(var d = a(b), f = d[0], e = f.getAscendant("table"), f = f.getDocument(), g = d[0].getParent(), h = g.$.rowIndex, d = d[d.length - 1], i = d.getParent().$.rowIndex + d.$.rowSpan - 1, d = new CKEDITOR.dom.element(e.$.rows[i]), h = c ? h : i, g = c ? g : d, d = CKEDITOR.tools.buildTableMap(e), e = d[h], h = c ? d[h - 1] : d[h + 1], d = d[0].length,
- f = f.createElement("tr"), i = 0; e[i] && i < d; i++) {
- var j;
- if(e[i].rowSpan > 1 && h && e[i] == h[i]) {
- j = e[i];
- j.rowSpan = j.rowSpan + 1
- } else {
- j = (new CKEDITOR.dom.element(e[i])).clone();
- j.removeAttribute("rowSpan");
- j.appendBogus();
- f.append(j);
- j = j.$
- }
- i = i + (j.colSpan - 1)
- }
- c ? f.insertBefore(g) : f.insertAfter(g)
- }
- function b(c) {
- if(c instanceof CKEDITOR.dom.selection) {
- for(var d = a(c), f = d[0].getAscendant("table"), e = CKEDITOR.tools.buildTableMap(f), c = d[0].getParent().$.rowIndex, d = d[d.length - 1], g = d.getParent().$.rowIndex + d.$.rowSpan - 1, d = [],
- h = c; h <= g; h++) {
- for(var i = e[h], j = new CKEDITOR.dom.element(f.$.rows[h]), k = 0; k < i.length; k++) {
- var n = new CKEDITOR.dom.element(i[k]),
- o = n.getParent().$.rowIndex;
- if(n.$.rowSpan == 1) n.remove();
- else {
- n.$.rowSpan = n.$.rowSpan - 1;
- if(o == h) {
- o = e[h + 1];
- o[k - 1] ? n.insertAfter(new CKEDITOR.dom.element(o[k - 1])) : (new CKEDITOR.dom.element(f.$.rows[h + 1])).append(n, 1)
- }
- }
- k = k + (n.$.colSpan - 1)
- }
- d.push(j)
- }
- e = f.$.rows;
- f = new CKEDITOR.dom.element(e[g + 1] || (c > 0 ? e[c - 1] : null) || f.$.parentNode);
- for(h = d.length; h >= 0; h--) b(d[h]);
- return f
- }
- if(c instanceof CKEDITOR.dom.element) {
- f = c.getAscendant("table");
- f.$.rows.length == 1 ? f.remove() : c.remove()
- }
- return null
- }
- function g(a, b) {
- for(var c = b ? Infinity : 0, d = 0; d < a.length; d++) {
- var f;
- f = a[d];
- for(var e = b, g = f.getParent().$.cells, h = 0, i = 0; i < g.length; i++) {
- var j = g[i],
- h = h + (e ? 1 : j.colSpan);
- if(j == f.$) break
- }
- f = h - 1;
- if(b ? f < c : f > c) c = f
- }
- return c
- }
- function c(b, c) {
- for(var d = a(b), f = d[0].getAscendant("table"), e = g(d, 1), d = g(d), e = c ? e : d, h = CKEDITOR.tools.buildTableMap(f), f = [], d = [], i = h.length, j = 0; j < i; j++) {
- f.push(h[j][e]);
- d.push(c ? h[j][e - 1] : h[j][e +
- 1
- ])
- }
- for(j = 0; j < i; j++)
- if(f[j]) {
- if(f[j].colSpan > 1 && d[j] == f[j]) {
- e = f[j];
- e.colSpan = e.colSpan + 1
- } else {
- e = (new CKEDITOR.dom.element(f[j])).clone();
- e.removeAttribute("colSpan");
- e.appendBogus();
- e[c ? "insertBefore" : "insertAfter"].call(e, new CKEDITOR.dom.element(f[j]));
- e = e.$
- }
- j = j + (e.rowSpan - 1)
- }
- }
- function d(a, b) {
- var c = a.getStartElement();
- if(c = c.getAscendant("td", 1) || c.getAscendant("th", 1)) {
- var d = c.clone();
- d.appendBogus();
- b ? d.insertBefore(c) : d.insertAfter(c)
- }
- }
- function j(b) {
- if(b instanceof CKEDITOR.dom.selection) {
- var b =
- a(b),
- c = b[0] && b[0].getAscendant("table"),
- d;
- a: {
- var e = 0;d = b.length - 1;
- for(var g = {}, h, i; h = b[e++];) CKEDITOR.dom.element.setMarker(g, h, "delete_cell", true);
- for(e = 0; h = b[e++];)
- if((i = h.getPrevious()) && !i.getCustomData("delete_cell") || (i = h.getNext()) && !i.getCustomData("delete_cell")) {
- CKEDITOR.dom.element.clearAllMarkers(g);
- d = i;
- break a
- }
- CKEDITOR.dom.element.clearAllMarkers(g);i = b[0].getParent();
- if(i = i.getPrevious()) d = i.getLast();
- else {
- i = b[d].getParent();
- d = (i = i.getNext()) ? i.getChild(0) : null
- }
- }
- for(i = b.length - 1; i >=
- 0; i--) j(b[i]);
- d ? f(d, true) : c && c.remove()
- } else if(b instanceof CKEDITOR.dom.element) {
- c = b.getParent();
- c.getChildCount() == 1 ? c.remove() : b.remove()
- }
- }
- function f(a, b) {
- var c = a.getDocument(),
- d = CKEDITOR.document;
- if(CKEDITOR.env.ie && CKEDITOR.env.version == 10) {
- d.focus();
- c.focus()
- }
- c = new CKEDITOR.dom.range(c);
- if(!c["moveToElementEdit" + (b ? "End" : "Start")](a)) {
- c.selectNodeContents(a);
- c.collapse(b ? false : true)
- }
- c.select(true)
- }
- function h(a, b, c) {
- a = a[b];
- if(typeof c == "undefined") return a;
- for(b = 0; a && b < a.length; b++) {
- if(c.is &&
- a[b] == c.$) return b;
- if(b == c) return new CKEDITOR.dom.element(a[b])
- }
- return c.is ? -1 : null
- }
- function i(b, c, d) {
- var f = a(b),
- e;
- if((c ? f.length != 1 : f.length < 2) || (e = b.getCommonAncestor()) && e.type == CKEDITOR.NODE_ELEMENT && e.is("table")) return false;
- var g, b = f[0];
- e = b.getAscendant("table");
- var i = CKEDITOR.tools.buildTableMap(e),
- j = i.length,
- k = i[0].length,
- n = b.getParent().$.rowIndex,
- o = h(i, n, b);
- if(c) {
- var y;
- try {
- var z = parseInt(b.getAttribute("rowspan"), 10) || 1;
- g = parseInt(b.getAttribute("colspan"), 10) || 1;
- y = i[c == "up" ? n - z : c == "down" ?
- n + z : n][c == "left" ? o - g : c == "right" ? o + g : o]
- } catch(B) {
- return false
- }
- if(!y || b.$ == y) return false;
- f[c == "up" || c == "left" ? "unshift" : "push"](new CKEDITOR.dom.element(y))
- }
- for(var c = b.getDocument(), A = n, z = y = 0, G = !d && new CKEDITOR.dom.documentFragment(c), D = 0, c = 0; c < f.length; c++) {
- g = f[c];
- var J = g.getParent(),
- C = g.getFirst(),
- F = g.$.colSpan,
- E = g.$.rowSpan,
- J = J.$.rowIndex,
- I = h(i, J, g),
- D = D + F * E,
- z = Math.max(z, I - o + F);
- y = Math.max(y, J - n + E);
- if(!d) {
- F = g;
- (E = F.getBogus()) && E.remove();
- F.trim();
- if(g.getChildren().count()) {
- if(J != A && C && (!C.isBlockBoundary ||
- !C.isBlockBoundary({
- br: 1
- })))(A = G.getLast(CKEDITOR.dom.walker.whitespaces(true))) && (!A.is || !A.is("br")) && G.append("br");
- g.moveChildren(G)
- }
- c ? g.remove() : g.setHtml("")
- }
- A = J
- }
- if(d) return y * z == D;
- G.moveChildren(b);
- b.appendBogus();
- z >= k ? b.removeAttribute("rowSpan") : b.$.rowSpan = y;
- y >= j ? b.removeAttribute("colSpan") : b.$.colSpan = z;
- d = new CKEDITOR.dom.nodeList(e.$.rows);
- f = d.count();
- for(c = f - 1; c >= 0; c--) {
- e = d.getItem(c);
- if(!e.$.cells.length) {
- e.remove();
- f++
- }
- }
- return b
- }
- function k(b, c) {
- var d = a(b);
- if(d.length > 1) return false;
- if(c) return true;
- var d = d[0],
- f = d.getParent(),
- e = f.getAscendant("table"),
- g = CKEDITOR.tools.buildTableMap(e),
- i = f.$.rowIndex,
- j = h(g, i, d),
- k = d.$.rowSpan,
- n;
- if(k > 1) {
- n = Math.ceil(k / 2);
- for(var k = Math.floor(k / 2), f = i + n, e = new CKEDITOR.dom.element(e.$.rows[f]), g = h(g, f), o, f = d.clone(), i = 0; i < g.length; i++) {
- o = g[i];
- if(o.parentNode == e.$ && i > j) {
- f.insertBefore(new CKEDITOR.dom.element(o));
- break
- } else o = null
- }
- o || e.append(f)
- } else {
- k = n = 1;
- e = f.clone();
- e.insertAfter(f);
- e.append(f = d.clone());
- o = h(g, i);
- for(j = 0; j < o.length; j++) o[j].rowSpan++
- }
- f.appendBogus();
- d.$.rowSpan = n;
- f.$.rowSpan = k;
- n == 1 && d.removeAttribute("rowSpan");
- k == 1 && f.removeAttribute("rowSpan");
- return f
- }
- function n(b, c) {
- var d = a(b);
- if(d.length > 1) return false;
- if(c) return true;
- var d = d[0],
- f = d.getParent(),
- e = f.getAscendant("table"),
- e = CKEDITOR.tools.buildTableMap(e),
- g = h(e, f.$.rowIndex, d),
- i = d.$.colSpan;
- if(i > 1) {
- f = Math.ceil(i / 2);
- i = Math.floor(i / 2)
- } else {
- for(var i = f = 1, j = [], k = 0; k < e.length; k++) {
- var n = e[k];
- j.push(n[g]);
- n[g].rowSpan > 1 && (k = k + (n[g].rowSpan - 1))
- }
- for(e = 0; e < j.length; e++) j[e].colSpan++
- }
- e = d.clone();
- e.insertAfter(d);
- e.appendBogus();
- d.$.colSpan = f;
- e.$.colSpan = i;
- f == 1 && d.removeAttribute("colSpan");
- i == 1 && e.removeAttribute("colSpan");
- return e
- }
- var o = /^(?:td|th)$/;
- CKEDITOR.plugins.tabletools = {
- requires: "table,dialog,contextmenu",
- init: function(g) {
- function h(a) {
- return CKEDITOR.tools.extend(a || {}, {
- contextSensitive: 1,
- refresh: function(a, b) {
- this.setState(b.contains({
- td: 1,
- th: 1
- }, 1) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED)
- }
- })
- }
- function l(a, b) {
- var c = g.addCommand(a, b);
- g.addFeature(c)
- }
- var o = g.lang.table;
- l("cellProperties", new CKEDITOR.dialogCommand("cellProperties", h({
- allowedContent: "td th{width,height,border-color,background-color,white-space,vertical-align,text-align}[colspan,rowspan]",
- requiredContent: "table"
- })));
- CKEDITOR.dialog.add("cellProperties", this.path + "dialogs/tableCell.js");
- l("rowDelete", h({
- requiredContent: "table",
- exec: function(a) {
- a = a.getSelection();
- f(b(a))
- }
- }));
- l("rowInsertBefore", h({
- requiredContent: "table",
- exec: function(a) {
- a = a.getSelection();
- e(a, true)
- }
- }));
- l("rowInsertAfter", h({
- requiredContent: "table",
- exec: function(a) {
- a = a.getSelection();
- e(a)
- }
- }));
- l("columnDelete", h({
- requiredContent: "table",
- exec: function(b) {
- for(var b = b.getSelection(), b = a(b), c = b[0], d = b[b.length - 1], b = c.getAscendant("table"), e = CKEDITOR.tools.buildTableMap(b), g, h, i = [], j = 0, k = e.length; j < k; j++)
- for(var m = 0, l = e[j].length; m < l; m++) {
- e[j][m] == c.$ && (g = m);
- e[j][m] == d.$ && (h = m)
- }
- for(j = g; j <= h; j++)
- for(m = 0; m < e.length; m++) {
- d = e[m];
- c = new CKEDITOR.dom.element(b.$.rows[m]);
- d = new CKEDITOR.dom.element(d[j]);
- if(d.$) {
- d.$.colSpan == 1 ? d.remove() : d.$.colSpan = d.$.colSpan -
- 1;
- m = m + (d.$.rowSpan - 1);
- c.$.cells.length || i.push(c)
- }
- }
- h = b.$.rows[0] && b.$.rows[0].cells;
- g = new CKEDITOR.dom.element(h[g] || (g ? h[g - 1] : b.$.parentNode));
- i.length == k && b.remove();
- g && f(g, true)
- }
- }));
- l("columnInsertBefore", h({
- requiredContent: "table",
- exec: function(a) {
- a = a.getSelection();
- c(a, true)
- }
- }));
- l("columnInsertAfter", h({
- requiredContent: "table",
- exec: function(a) {
- a = a.getSelection();
- c(a)
- }
- }));
- l("cellDelete", h({
- requiredContent: "table",
- exec: function(a) {
- a = a.getSelection();
- j(a)
- }
- }));
- l("cellMerge", h({
- allowedContent: "td[colspan,rowspan]",
- requiredContent: "td[colspan,rowspan]",
- exec: function(a) {
- f(i(a.getSelection()), true)
- }
- }));
- l("cellMergeRight", h({
- allowedContent: "td[colspan]",
- requiredContent: "td[colspan]",
- exec: function(a) {
- f(i(a.getSelection(), "right"), true)
- }
- }));
- l("cellMergeDown", h({
- allowedContent: "td[rowspan]",
- requiredContent: "td[rowspan]",
- exec: function(a) {
- f(i(a.getSelection(), "down"), true)
- }
- }));
- l("cellVerticalSplit", h({
- allowedContent: "td[rowspan]",
- requiredContent: "td[rowspan]",
- exec: function(a) {
- f(k(a.getSelection()))
- }
- }));
- l("cellHorizontalSplit",
- h({
- allowedContent: "td[colspan]",
- requiredContent: "td[colspan]",
- exec: function(a) {
- f(n(a.getSelection()))
- }
- }));
- l("cellInsertBefore", h({
- requiredContent: "table",
- exec: function(a) {
- a = a.getSelection();
- d(a, true)
- }
- }));
- l("cellInsertAfter", h({
- requiredContent: "table",
- exec: function(a) {
- a = a.getSelection();
- d(a)
- }
- }));
- g.addMenuItems && g.addMenuItems({
- tablecell: {
- label: o.cell.menu,
- group: "tablecell",
- order: 1,
- getItems: function() {
- var b = g.getSelection(),
- c = a(b);
- return {
- tablecell_insertBefore: CKEDITOR.TRISTATE_OFF,
- tablecell_insertAfter: CKEDITOR.TRISTATE_OFF,
- tablecell_delete: CKEDITOR.TRISTATE_OFF,
- tablecell_merge: i(b, null, true) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
- tablecell_merge_right: i(b, "right", true) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
- tablecell_merge_down: i(b, "down", true) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
- tablecell_split_vertical: k(b, true) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
- tablecell_split_horizontal: n(b, true) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
- tablecell_properties: c.length > 0 ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED
- }
- }
- },
- tablecell_insertBefore: {
- label: o.cell.insertBefore,
- group: "tablecell",
- command: "cellInsertBefore",
- order: 5
- },
- tablecell_insertAfter: {
- label: o.cell.insertAfter,
- group: "tablecell",
- command: "cellInsertAfter",
- order: 10
- },
- tablecell_delete: {
- label: o.cell.deleteCell,
- group: "tablecell",
- command: "cellDelete",
- order: 15
- },
- tablecell_merge: {
- label: o.cell.merge,
- group: "tablecell",
- command: "cellMerge",
- order: 16
- },
- tablecell_merge_right: {
- label: o.cell.mergeRight,
- group: "tablecell",
- command: "cellMergeRight",
- order: 17
- },
- tablecell_merge_down: {
- label: o.cell.mergeDown,
- group: "tablecell",
- command: "cellMergeDown",
- order: 18
- },
- tablecell_split_horizontal: {
- label: o.cell.splitHorizontal,
- group: "tablecell",
- command: "cellHorizontalSplit",
- order: 19
- },
- tablecell_split_vertical: {
- label: o.cell.splitVertical,
- group: "tablecell",
- command: "cellVerticalSplit",
- order: 20
- },
- tablecell_properties: {
- label: o.cell.title,
- group: "tablecellproperties",
- command: "cellProperties",
- order: 21
- },
- tablerow: {
- label: o.row.menu,
- group: "tablerow",
- order: 1,
- getItems: function() {
- return {
- tablerow_insertBefore: CKEDITOR.TRISTATE_OFF,
- tablerow_insertAfter: CKEDITOR.TRISTATE_OFF,
- tablerow_delete: CKEDITOR.TRISTATE_OFF
- }
- }
- },
- tablerow_insertBefore: {
- label: o.row.insertBefore,
- group: "tablerow",
- command: "rowInsertBefore",
- order: 5
- },
- tablerow_insertAfter: {
- label: o.row.insertAfter,
- group: "tablerow",
- command: "rowInsertAfter",
- order: 10
- },
- tablerow_delete: {
- label: o.row.deleteRow,
- group: "tablerow",
- command: "rowDelete",
- order: 15
- },
- tablecolumn: {
- label: o.column.menu,
- group: "tablecolumn",
- order: 1,
- getItems: function() {
- return {
- tablecolumn_insertBefore: CKEDITOR.TRISTATE_OFF,
- tablecolumn_insertAfter: CKEDITOR.TRISTATE_OFF,
- tablecolumn_delete: CKEDITOR.TRISTATE_OFF
- }
- }
- },
- tablecolumn_insertBefore: {
- label: o.column.insertBefore,
- group: "tablecolumn",
- command: "columnInsertBefore",
- order: 5
- },
- tablecolumn_insertAfter: {
- label: o.column.insertAfter,
- group: "tablecolumn",
- command: "columnInsertAfter",
- order: 10
- },
- tablecolumn_delete: {
- label: o.column.deleteColumn,
- group: "tablecolumn",
- command: "columnDelete",
- order: 15
- }
- });
- g.contextMenu && g.contextMenu.addListener(function(a, b, c) {
- return(a = c.contains({
- td: 1,
- th: 1
- },
- 1)) && !a.isReadOnly() ? {
- tablecell: CKEDITOR.TRISTATE_OFF,
- tablerow: CKEDITOR.TRISTATE_OFF,
- tablecolumn: CKEDITOR.TRISTATE_OFF
- } : null
- })
- },
- getSelectedCells: a
- };
- CKEDITOR.plugins.add("tabletools", CKEDITOR.plugins.tabletools)
- }(), CKEDITOR.tools.buildTableMap = function(a) {
- for(var a = a.$.rows, e = -1, b = [], g = 0; g < a.length; g++) {
- e++;
- !b[e] && (b[e] = []);
- for(var c = -1, d = 0; d < a[g].cells.length; d++) {
- var j = a[g].cells[d];
- for(c++; b[e][c];) c++;
- for(var f = isNaN(j.colSpan) ? 1 : j.colSpan, j = isNaN(j.rowSpan) ? 1 : j.rowSpan, h = 0; h < j; h++) {
- b[e + h] || (b[e +
- h] = []);
- for(var i = 0; i < f; i++) b[e + h][c + i] = a[g].cells[d]
- }
- c = c + (f - 1)
- }
- }
- return b
- },
- function() {
- function a(a) {
- function b() {
- for(var d = g(), h = CKEDITOR.tools.clone(a.config.toolbarGroups) || e(a), i = 0; i < h.length; i++) {
- var k = h[i];
- if(k != "/") {
- typeof k == "string" && (k = h[i] = {
- name: k
- });
- var l, p = k.groups;
- if(p)
- for(var t = 0; t < p.length; t++) {
- l = p[t];
- (l = d[l]) && f(k, l)
- }(l = d[k.name]) && f(k, l)
- }
- }
- return h
- }
- function g() {
- var b = {},
- d, f, e;
- for(d in a.ui.items) {
- f = a.ui.items[d];
- e = f.toolbar || "others";
- e = e.split(",");
- f = e[0];
- e = parseInt(e[1] || -1, 10);
- b[f] ||
- (b[f] = []);
- b[f].push({
- name: d,
- order: e
- })
- }
- for(f in b) b[f] = b[f].sort(function(a, b) {
- return a.order == b.order ? 0 : b.order < 0 ? -1 : a.order < 0 ? 1 : a.order < b.order ? -1 : 1
- });
- return b
- }
- function f(b, d) {
- if(d.length) {
- b.items ? b.items.push(a.ui.create("-")) : b.items = [];
- for(var f; f = d.shift();) {
- f = typeof f == "string" ? f : f.name;
- if(!i || CKEDITOR.tools.indexOf(i, f) == -1)(f = a.ui.create(f)) && a.addFeature(f) && b.items.push(f)
- }
- }
- }
- function h(a) {
- var b = [],
- c, d, e;
- for(c = 0; c < a.length; ++c) {
- d = a[c];
- e = {};
- if(d == "/") b.push(d);
- else if(CKEDITOR.tools.isArray(d)) {
- f(e,
- CKEDITOR.tools.clone(d));
- b.push(e)
- } else if(d.items) {
- f(e, CKEDITOR.tools.clone(d.items));
- e.name = d.name;
- b.push(e)
- }
- }
- return b
- }
- var i = a.config.removeButtons,
- i = i && i.split(","),
- k = a.config.toolbar;
- typeof k == "string" && (k = a.config["toolbar_" + k]);
- return a.toolbar = k ? h(k) : b()
- }
- function e(a) {
- return a._.toolbarGroups || (a._.toolbarGroups = [{
- name: "document",
- groups: ["mode", "document", "doctools"]
- }, {
- name: "clipboard",
- groups: ["clipboard", "undo"]
- }, {
- name: "editing",
- groups: ["find", "selection", "spellchecker"]
- }, {
- name: "forms"
- }, "/", {
- name: "basicstyles",
- groups: ["basicstyles", "cleanup"]
- }, {
- name: "paragraph",
- groups: ["list", "indent", "blocks", "align", "bidi"]
- }, {
- name: "links"
- }, {
- name: "insert"
- }, "/", {
- name: "styles"
- }, {
- name: "colors"
- }, {
- name: "tools"
- }, {
- name: "others"
- }, {
- name: "about"
- }])
- }
- var b = function() {
- this.toolbars = [];
- this.focusCommandExecuted = false
- };
- b.prototype.focus = function() {
- for(var a = 0, b; b = this.toolbars[a++];)
- for(var e = 0, f; f = b.items[e++];)
- if(f.focus) {
- f.focus();
- return
- }
- };
- var g = {
- modes: {
- wysiwyg: 1,
- source: 1
- },
- readOnly: 1,
- exec: function(a) {
- if(a.toolbox) {
- a.toolbox.focusCommandExecuted =
- true;
- CKEDITOR.env.ie || CKEDITOR.env.air ? setTimeout(function() {
- a.toolbox.focus()
- }, 100) : a.toolbox.focus()
- }
- }
- };
- CKEDITOR.plugins.add("toolbar", {
- requires: "button",
- init: function(c) {
- var d, e = function(a, b) {
- var g, k = c.lang.dir == "rtl",
- n = c.config.toolbarGroupCycling,
- o = k ? 37 : 39,
- k = k ? 39 : 37,
- n = n === void 0 || n;
- switch(b) {
- case 9:
- case CKEDITOR.SHIFT + 9:
- for(; !g || !g.items.length;) {
- g = b == 9 ? (g ? g.next : a.toolbar.next) || c.toolbox.toolbars[0] : (g ? g.previous : a.toolbar.previous) || c.toolbox.toolbars[c.toolbox.toolbars.length - 1];
- if(g.items.length)
- for(a =
- g.items[d ? g.items.length - 1 : 0]; a && !a.focus;)(a = d ? a.previous : a.next) || (g = 0)
- }
- a && a.focus();
- return false;
- case o:
- g = a;
- do {
- g = g.next;
- !g && n && (g = a.toolbar.items[0])
- } while (g && !g.focus);
- g ? g.focus() : e(a, 9);
- return false;
- case 40:
- if(a.button && a.button.hasArrow) {
- c.once("panelShow", function(a) {
- a.data._.panel._.currentBlock.onKeyDown(40)
- });
- a.execute()
- } else e(a, b == 40 ? o : k);
- return false;
- case k:
- case 38:
- g = a;
- do {
- g = g.previous;
- !g && n && (g = a.toolbar.items[a.toolbar.items.length - 1])
- } while (g && !g.focus);
- if(g) g.focus();
- else {
- d = 1;
- e(a,
- CKEDITOR.SHIFT + 9);
- d = 0
- }
- return false;
- case 27:
- c.focus();
- return false;
- case 13:
- case 32:
- a.execute();
- return false
- }
- return true
- };
- c.on("uiSpace", function(d) {
- if(d.data.space == c.config.toolbarLocation) {
- d.removeListener();
- c.toolbox = new b;
- var g = CKEDITOR.tools.getNextId(),
- i = ['<span id="', g, '" class="cke_voice_label">', c.lang.toolbar.toolbars, "</span>", '<span id="' + c.ui.spaceId("toolbox") + '" class="cke_toolbox" role="group" aria-labelledby="', g, '" onmousedown="return false;">'],
- g = c.config.toolbarStartupExpanded !==
- false,
- k, n;
- c.config.toolbarCanCollapse && c.elementMode != CKEDITOR.ELEMENT_MODE_INLINE && i.push('<span class="cke_toolbox_main"' + (g ? ">" : ' style="display:none">'));
- for(var o = c.toolbox.toolbars, q = a(c), m = 0; m < q.length; m++) {
- var l, p = 0,
- t, s = q[m],
- u;
- if(s) {
- if(k) {
- i.push("</span>");
- n = k = 0
- }
- if(s === "/") i.push('<span class="cke_toolbar_break"></span>');
- else {
- u = s.items || s;
- for(var w = 0; w < u.length; w++) {
- var x = u[w],
- v;
- if(x)
- if(x.type == CKEDITOR.UI_SEPARATOR) n = k && x;
- else {
- v = x.canGroup !== false;
- if(!p) {
- l = CKEDITOR.tools.getNextId();
- p = {
- id: l,
- items: []
- };
- t = s.name && (c.lang.toolbar.toolbarGroups[s.name] || s.name);
- i.push('<span id="', l, '" class="cke_toolbar"', t ? ' aria-labelledby="' + l + '_label"' : "", ' role="toolbar">');
- t && i.push('<span id="', l, '_label" class="cke_voice_label">', t, "</span>");
- i.push('<span class="cke_toolbar_start"></span>');
- var r = o.push(p) - 1;
- if(r > 0) {
- p.previous = o[r - 1];
- p.previous.next = p
- }
- }
- if(v) {
- if(!k) {
- i.push('<span class="cke_toolgroup" role="presentation">');
- k = 1
- }
- } else if(k) {
- i.push("</span>");
- k = 0
- }
- l = function(a) {
- a = a.render(c, i);
- r = p.items.push(a) -
- 1;
- if(r > 0) {
- a.previous = p.items[r - 1];
- a.previous.next = a
- }
- a.toolbar = p;
- a.onkey = e;
- a.onfocus = function() {
- c.toolbox.focusCommandExecuted || c.focus()
- }
- };
- if(n) {
- l(n);
- n = 0
- }
- l(x)
- }
- }
- if(k) {
- i.push("</span>");
- n = k = 0
- }
- p && i.push('<span class="cke_toolbar_end"></span></span>')
- }
- }
- }
- c.config.toolbarCanCollapse && i.push("</span>");
- if(c.config.toolbarCanCollapse && c.elementMode != CKEDITOR.ELEMENT_MODE_INLINE) {
- var y = CKEDITOR.tools.addFunction(function() {
- c.execCommand("toolbarCollapse")
- });
- c.on("destroy", function() {
- CKEDITOR.tools.removeFunction(y)
- });
- c.addCommand("toolbarCollapse", {
- readOnly: 1,
- exec: function(a) {
- var b = a.ui.space("toolbar_collapser"),
- c = b.getPrevious(),
- d = a.ui.space("contents"),
- f = c.getParent(),
- e = parseInt(d.$.style.height, 10),
- g = f.$.offsetHeight,
- h = b.hasClass("cke_toolbox_collapser_min");
- if(h) {
- c.show();
- b.removeClass("cke_toolbox_collapser_min");
- b.setAttribute("title", a.lang.toolbar.toolbarCollapse)
- } else {
- c.hide();
- b.addClass("cke_toolbox_collapser_min");
- b.setAttribute("title", a.lang.toolbar.toolbarExpand)
- }
- b.getFirst().setText(h ? "▲" : "◀");
- d.setStyle("height", e - (f.$.offsetHeight - g) + "px");
- a.fire("resize")
- },
- modes: {
- wysiwyg: 1,
- source: 1
- }
- });
- c.setKeystroke(CKEDITOR.ALT + (CKEDITOR.env.ie || CKEDITOR.env.webkit ? 189 : 109), "toolbarCollapse");
- i.push('<a title="' + (g ? c.lang.toolbar.toolbarCollapse : c.lang.toolbar.toolbarExpand) + '" id="' + c.ui.spaceId("toolbar_collapser") + '" tabIndex="-1" class="cke_toolbox_collapser');
- g || i.push(" cke_toolbox_collapser_min");
- i.push('" onclick="CKEDITOR.tools.callFunction(' + y + ')">', '<span class="cke_arrow">▲</span>',
- "</a>")
- }
- i.push("</span>");
- d.data.html = d.data.html + i.join("")
- }
- });
- c.on("destroy", function() {
- if(this.toolbox) {
- var a, b = 0,
- c, d, e;
- for(a = this.toolbox.toolbars; b < a.length; b++) {
- d = a[b].items;
- for(c = 0; c < d.length; c++) {
- e = d[c];
- e.clickFn && CKEDITOR.tools.removeFunction(e.clickFn);
- e.keyDownFn && CKEDITOR.tools.removeFunction(e.keyDownFn)
- }
- }
- }
- });
- c.on("uiReady", function() {
- var a = c.ui.space("toolbox");
- a && c.focusManager.add(a, 1)
- });
- c.addCommand("toolbarFocus", g);
- c.setKeystroke(CKEDITOR.ALT + 121, "toolbarFocus");
- c.ui.add("-", CKEDITOR.UI_SEPARATOR, {});
- c.ui.addHandler(CKEDITOR.UI_SEPARATOR, {
- create: function() {
- return {
- render: function(a, b) {
- b.push('<span class="cke_toolbar_separator" role="separator"></span>');
- return {}
- }
- }
- }
- })
- }
- });
- CKEDITOR.ui.prototype.addToolbarGroup = function(a, b, g) {
- var f = e(this.editor),
- h = b === 0,
- i = {
- name: a
- };
- if(g) {
- if(g = CKEDITOR.tools.search(f, function(a) {
- return a.name == g
- })) {
- !g.groups && (g.groups = []);
- if(b) {
- b = CKEDITOR.tools.indexOf(g.groups, b);
- if(b >= 0) {
- g.groups.splice(b + 1, 0, a);
- return
- }
- }
- h ? g.groups.splice(0, 0, a) : g.groups.push(a);
- return
- }
- b = null
- }
- b &&
- (b = CKEDITOR.tools.indexOf(f, function(a) {
- return a.name == b
- }));
- h ? f.splice(0, 0, a) : typeof b == "number" ? f.splice(b + 1, 0, i) : f.push(a)
- }
- }(), CKEDITOR.UI_SEPARATOR = "separator", CKEDITOR.config.toolbarLocation = "top", "use strict",
- function() {
- var a = [CKEDITOR.CTRL + 90, CKEDITOR.CTRL + 89, CKEDITOR.CTRL + CKEDITOR.SHIFT + 90],
- e = {
- 8: 1,
- 46: 1
- };
- CKEDITOR.plugins.add("undo", {
- init: function(c) {
- function e(a) {
- j.enabled && a.data.command.canUndo !== false && j.save()
- }
- function g() {
- j.enabled = c.readOnly ? false : c.mode == "wysiwyg";
- j.onChange()
- }
- var j =
- c.undoManager = new b(c),
- n = j.editingHandler = new d(j),
- o = c.addCommand("undo", {
- exec: function() {
- if(j.undo()) {
- c.selectionChange();
- this.fire("afterUndo")
- }
- },
- startDisabled: true,
- canUndo: false
- }),
- q = c.addCommand("redo", {
- exec: function() {
- if(j.redo()) {
- c.selectionChange();
- this.fire("afterRedo")
- }
- },
- startDisabled: true,
- canUndo: false
- });
- c.setKeystroke([
- [a[0], "undo"],
- [a[1], "redo"],
- [a[2], "redo"]
- ]);
- j.onChange = function() {
- o.setState(j.undoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED);
- q.setState(j.redoable() ? CKEDITOR.TRISTATE_OFF :
- CKEDITOR.TRISTATE_DISABLED)
- };
- c.on("beforeCommandExec", e);
- c.on("afterCommandExec", e);
- c.on("saveSnapshot", function(a) {
- j.save(a.data && a.data.contentOnly)
- });
- c.on("contentDom", n.attachListeners, n);
- c.on("instanceReady", function() {
- c.fire("saveSnapshot")
- });
- c.on("beforeModeUnload", function() {
- c.mode == "wysiwyg" && j.save(true)
- });
- c.on("mode", g);
- c.on("readOnly", g);
- if(c.ui.addButton) {
- c.ui.addButton("Undo", {
- label: c.lang.undo.undo,
- command: "undo",
- toolbar: "undo,10"
- });
- c.ui.addButton("Redo", {
- label: c.lang.undo.redo,
- command: "redo",
- toolbar: "undo,20"
- })
- }
- c.resetUndo = function() {
- j.reset();
- c.fire("saveSnapshot")
- };
- c.on("updateSnapshot", function() {
- j.currentImage && j.update()
- });
- c.on("lockSnapshot", function(a) {
- a = a.data;
- j.lock(a && a.dontUpdate, a && a.forceUpdate)
- });
- c.on("unlockSnapshot", j.unlock, j)
- }
- });
- CKEDITOR.plugins.undo = {};
- var b = CKEDITOR.plugins.undo.UndoManager = function(a) {
- this.strokesRecorded = [0, 0];
- this.locked = null;
- this.previousKeyGroup = -1;
- this.limit = a.config.undoStackSize || 20;
- this.strokesLimit = 25;
- this.editor = a;
- this.reset()
- };
- b.prototype = {
- type: function(a, c) {
- var d = b.getKeyGroup(a),
- e = this.strokesRecorded[d] + 1,
- c = c || e >= this.strokesLimit;
- if(!this.typing) {
- this.hasUndo = this.typing = true;
- this.hasRedo = false;
- this.onChange()
- }
- if(c) {
- e = 0;
- this.editor.fire("saveSnapshot")
- } else this.editor.fire("change");
- this.strokesRecorded[d] = e;
- this.previousKeyGroup = d
- },
- keyGroupChanged: function(a) {
- return b.getKeyGroup(a) != this.previousKeyGroup
- },
- reset: function() {
- this.snapshots = [];
- this.index = -1;
- this.currentImage = null;
- this.hasRedo = this.hasUndo = false;
- this.locked = null;
- this.resetType()
- },
- resetType: function() {
- this.strokesRecorded = [0, 0];
- this.typing = false;
- this.previousKeyGroup = -1
- },
- refreshState: function() {
- this.hasUndo = !!this.getNextImage(true);
- this.hasRedo = !!this.getNextImage(false);
- this.resetType();
- this.onChange()
- },
- save: function(a, b, c) {
- var d = this.editor;
- if(this.locked || d.status != "ready" || d.mode != "wysiwyg") return false;
- var e = d.editable();
- if(!e || e.status != "ready") return false;
- e = this.snapshots;
- b || (b = new g(d));
- if(b.contents === false) return false;
- if(this.currentImage)
- if(b.equalsContent(this.currentImage)) {
- if(a ||
- b.equalsSelection(this.currentImage)) return false
- } else c !== false && d.fire("change");
- e.splice(this.index + 1, e.length - this.index - 1);
- e.length == this.limit && e.shift();
- this.index = e.push(b) - 1;
- this.currentImage = b;
- c !== false && this.refreshState();
- return true
- },
- restoreImage: function(a) {
- var b = this.editor,
- c;
- if(a.bookmarks) {
- b.focus();
- c = b.getSelection()
- }
- this.locked = {
- level: 999
- };
- this.editor.loadSnapshot(a.contents);
- if(a.bookmarks) c.selectBookmarks(a.bookmarks);
- else if(CKEDITOR.env.ie) {
- c = this.editor.document.getBody().$.createTextRange();
- c.collapse(true);
- c.select()
- }
- this.locked = null;
- this.index = a.index;
- this.currentImage = this.snapshots[this.index];
- this.update();
- this.refreshState();
- b.fire("change")
- },
- getNextImage: function(a) {
- var b = this.snapshots,
- c = this.currentImage,
- d;
- if(c)
- if(a)
- for(d = this.index - 1; d >= 0; d--) {
- a = b[d];
- if(!c.equalsContent(a)) {
- a.index = d;
- return a
- }
- } else
- for(d = this.index + 1; d < b.length; d++) {
- a = b[d];
- if(!c.equalsContent(a)) {
- a.index = d;
- return a
- }
- }
- return null
- },
- redoable: function() {
- return this.enabled && this.hasRedo
- },
- undoable: function() {
- return this.enabled &&
- this.hasUndo
- },
- undo: function() {
- if(this.undoable()) {
- this.save(true);
- var a = this.getNextImage(true);
- if(a) return this.restoreImage(a), true
- }
- return false
- },
- redo: function() {
- if(this.redoable()) {
- this.save(true);
- if(this.redoable()) {
- var a = this.getNextImage(false);
- if(a) return this.restoreImage(a), true
- }
- }
- return false
- },
- update: function(a) {
- if(!this.locked) {
- a || (a = new g(this.editor));
- for(var b = this.index, c = this.snapshots; b > 0 && this.currentImage.equalsContent(c[b - 1]);) b = b - 1;
- c.splice(b, this.index - b + 1, a);
- this.index = b;
- this.currentImage =
- a
- }
- },
- updateSelection: function(a) {
- if(!this.snapshots.length) return false;
- var b = this.snapshots,
- c = b[b.length - 1];
- if(c.equalsContent(a) && !c.equalsSelection(a)) {
- this.currentImage = b[b.length - 1] = a;
- return true
- }
- return false
- },
- lock: function(a, b) {
- if(this.locked) this.locked.level++;
- else if(a) this.locked = {
- level: 1
- };
- else {
- var c = null;
- if(b) c = true;
- else {
- var d = new g(this.editor, true);
- this.currentImage && this.currentImage.equalsContent(d) && (c = d)
- }
- this.locked = {
- update: c,
- level: 1
- }
- }
- },
- unlock: function() {
- if(this.locked && !--this.locked.level) {
- var a =
- this.locked.update;
- this.locked = null;
- if(a === true) this.update();
- else if(a) {
- var b = new g(this.editor, true);
- a.equalsContent(b) || this.update()
- }
- }
- }
- };
- b.navigationKeyCodes = {
- 37: 1,
- 38: 1,
- 39: 1,
- 40: 1,
- 36: 1,
- 35: 1,
- 33: 1,
- 34: 1
- };
- b.keyGroups = {
- PRINTABLE: 0,
- FUNCTIONAL: 1
- };
- b.isNavigationKey = function(a) {
- return !!b.navigationKeyCodes[a]
- };
- b.getKeyGroup = function(a) {
- var c = b.keyGroups;
- return e[a] ? c.FUNCTIONAL : c.PRINTABLE
- };
- b.getOppositeKeyGroup = function(a) {
- var c = b.keyGroups;
- return a == c.FUNCTIONAL ? c.PRINTABLE : c.FUNCTIONAL
- };
- b.ieFunctionalKeysBug =
- function(a) {
- return CKEDITOR.env.ie && b.getKeyGroup(a) == b.keyGroups.FUNCTIONAL
- };
- var g = CKEDITOR.plugins.undo.Image = function(a, b) {
- this.editor = a;
- a.fire("beforeUndoImage");
- var c = a.getSnapshot();
- CKEDITOR.env.ie && c && (c = c.replace(/\s+data-cke-expando=".*?"/g, ""));
- this.contents = c;
- if(!b) this.bookmarks = (c = c && a.getSelection()) && c.createBookmarks2(true);
- a.fire("afterUndoImage")
- },
- c = /\b(?:href|src|name)="[^"]*?"/gi;
- g.prototype = {
- equalsContent: function(a) {
- var b = this.contents,
- a = a.contents;
- if(CKEDITOR.env.ie && (CKEDITOR.env.ie7Compat ||
- CKEDITOR.env.quirks)) {
- b = b.replace(c, "");
- a = a.replace(c, "")
- }
- return b != a ? false : true
- },
- equalsSelection: function(a) {
- var b = this.bookmarks,
- a = a.bookmarks;
- if(b || a) {
- if(!b || !a || b.length != a.length) return false;
- for(var c = 0; c < b.length; c++) {
- var d = b[c],
- e = a[c];
- if(d.startOffset != e.startOffset || d.endOffset != e.endOffset || !CKEDITOR.tools.arrayCompare(d.start, e.start) || !CKEDITOR.tools.arrayCompare(d.end, e.end)) return false
- }
- }
- return true
- }
- };
- var d = CKEDITOR.plugins.undo.NativeEditingHandler = function(a) {
- this.undoManager = a;
- this.ignoreInputEvent =
- false;
- this.keyEventsStack = new j;
- this.lastKeydownImage = null
- };
- d.prototype = {
- onKeydown: function(c) {
- var d = c.data.getKey();
- if(d !== 229)
- if(CKEDITOR.tools.indexOf(a, c.data.getKeystroke()) > -1) c.data.preventDefault();
- else {
- this.keyEventsStack.cleanUp(c);
- c = this.undoManager;
- this.keyEventsStack.getLast(d) || this.keyEventsStack.push(d);
- this.lastKeydownImage = new g(c.editor);
- if(b.isNavigationKey(d) || this.undoManager.keyGroupChanged(d))
- if(c.strokesRecorded[0] || c.strokesRecorded[1]) {
- c.save(false, this.lastKeydownImage,
- false);
- c.resetType()
- }
- }
- },
- onInput: function() {
- if(this.ignoreInputEvent) this.ignoreInputEvent = false;
- else {
- var a = this.keyEventsStack.getLast();
- a || (a = this.keyEventsStack.push(0));
- this.keyEventsStack.increment(a.keyCode);
- if(this.keyEventsStack.getTotalInputs() >= this.undoManager.strokesLimit) {
- this.undoManager.type(a.keyCode, true);
- this.keyEventsStack.resetInputs()
- }
- }
- },
- onKeyup: function(a) {
- var c = this.undoManager,
- a = a.data.getKey(),
- d = this.keyEventsStack.getTotalInputs();
- this.keyEventsStack.remove(a);
- if(!b.ieFunctionalKeysBug(a) ||
- !this.lastKeydownImage || !this.lastKeydownImage.equalsContent(new g(c.editor, true)))
- if(d > 0) c.type(a);
- else if(b.isNavigationKey(a)) this.onNavigationKey(true)
- },
- onNavigationKey: function(a) {
- var b = this.undoManager;
- (a || !b.save(true, null, false)) && b.updateSelection(new g(b.editor));
- b.resetType()
- },
- ignoreInputEventListener: function() {
- this.ignoreInputEvent = true
- },
- attachListeners: function() {
- var a = this.undoManager.editor,
- c = a.editable(),
- d = this;
- c.attachListener(c, "keydown", function(a) {
- d.onKeydown(a);
- if(b.ieFunctionalKeysBug(a.data.getKey())) d.onInput()
- },
- null, null, 999);
- c.attachListener(c, CKEDITOR.env.ie ? "keypress" : "input", d.onInput, d, null, 999);
- c.attachListener(c, "keyup", d.onKeyup, d, null, 999);
- c.attachListener(c, "paste", d.ignoreInputEventListener, d, null, 999);
- c.attachListener(c, "drop", d.ignoreInputEventListener, d, null, 999);
- c.attachListener(c.isInline() ? c : a.document.getDocumentElement(), "click", function() {
- d.onNavigationKey()
- }, null, null, 999);
- c.attachListener(this.undoManager.editor, "blur", function() {
- d.keyEventsStack.remove(9)
- }, null, null, 999)
- }
- };
- var j = CKEDITOR.plugins.undo.KeyEventsStack =
- function() {
- this.stack = []
- };
- j.prototype = {
- push: function(a) {
- return this.stack[this.stack.push({
- keyCode: a,
- inputs: 0
- }) - 1]
- },
- getLastIndex: function(a) {
- if(typeof a != "number") return this.stack.length - 1;
- for(var b = this.stack.length; b--;)
- if(this.stack[b].keyCode == a) return b;
- return -1
- },
- getLast: function(a) {
- a = this.getLastIndex(a);
- return a != -1 ? this.stack[a] : null
- },
- increment: function(a) {
- this.getLast(a).inputs++
- },
- remove: function(a) {
- a = this.getLastIndex(a);
- a != -1 && this.stack.splice(a, 1)
- },
- resetInputs: function(a) {
- if(typeof a ==
- "number") this.getLast(a).inputs = 0;
- else
- for(a = this.stack.length; a--;) this.stack[a].inputs = 0
- },
- getTotalInputs: function() {
- for(var a = this.stack.length, b = 0; a--;) b = b + this.stack[a].inputs;
- return b
- },
- cleanUp: function(a) {
- a = a.data.$;
- !a.ctrlKey && !a.metaKey && this.remove(17);
- a.shiftKey || this.remove(16);
- a.altKey || this.remove(18)
- }
- }
- }(), CKEDITOR.plugins.add("wsc", {
- requires: "dialog",
- parseApi: function(a) {
- a.config.wsc_onFinish = typeof a.config.wsc_onFinish === "function" ? a.config.wsc_onFinish : function() {};
- a.config.wsc_onClose =
- typeof a.config.wsc_onClose === "function" ? a.config.wsc_onClose : function() {}
- },
- parseConfig: function(a) {
- a.config.wsc_customerId = a.config.wsc_customerId || CKEDITOR.config.wsc_customerId || "1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk";
- a.config.wsc_customDictionaryIds = a.config.wsc_customDictionaryIds || CKEDITOR.config.wsc_customDictionaryIds || "";
- a.config.wsc_userDictionaryName = a.config.wsc_userDictionaryName || CKEDITOR.config.wsc_userDictionaryName || "";
- a.config.wsc_customLoaderScript =
- a.config.wsc_customLoaderScript || CKEDITOR.config.wsc_customLoaderScript;
- CKEDITOR.config.wsc_cmd = a.config.wsc_cmd || CKEDITOR.config.wsc_cmd || "spell";
- CKEDITOR.config.wsc_version = "v4.3.0-26-g5bcf855";
- CKEDITOR.config.wsc_removeGlobalVariable = true
- },
- init: function(a) {
- var e = CKEDITOR.env;
- this.parseConfig(a);
- this.parseApi(a);
- a.addCommand("checkspell", new CKEDITOR.dialogCommand("checkspell")).modes = {
- wysiwyg: !CKEDITOR.env.opera && !CKEDITOR.env.air && document.domain == window.location.hostname && !(e.ie && (e.version <
- 8 || e.quirks))
- };
- typeof a.plugins.scayt == "undefined" && a.ui.addButton && a.ui.addButton("SpellChecker", {
- label: a.lang.wsc.toolbar,
- click: function(a) {
- var e = a.elementMode == CKEDITOR.ELEMENT_MODE_INLINE ? a.container.getText() : a.document.getBody().getText();
- (e = e.replace(/\s/g, "")) ? a.execCommand("checkspell"): alert("Nothing to check!")
- },
- toolbar: "spellchecker,10"
- });
- CKEDITOR.dialog.add("checkspell", this.path + (CKEDITOR.env.ie && CKEDITOR.env.version <= 7 ? "dialogs/wsc_ie.js" : window.postMessage ? "dialogs/wsc.js" : "dialogs/wsc_ie.js"))
- }
- }),
- function() {
- function a(a) {
- var b = this.editor,
- g = a.document,
- f = g.body,
- h = g.getElementById("cke_actscrpt");
- h && h.parentNode.removeChild(h);
- (h = g.getElementById("cke_shimscrpt")) && h.parentNode.removeChild(h);
- (h = g.getElementById("cke_basetagscrpt")) && h.parentNode.removeChild(h);
- f.contentEditable = true;
- if(CKEDITOR.env.ie) {
- f.hideFocus = true;
- f.disabled = true;
- f.removeAttribute("disabled")
- }
- delete this._.isLoadingData;
- this.$ = f;
- g = new CKEDITOR.dom.document(g);
- this.setup();
- this.fixInitialSelection();
- if(CKEDITOR.env.ie) {
- g.getDocumentElement().addClass(g.$.compatMode);
- b.config.enterMode != CKEDITOR.ENTER_P && this.attachListener(g, "selectionchange", function() {
- var a = g.getBody(),
- c = b.getSelection(),
- e = c && c.getRanges()[0];
- e && (a.getHtml().match(/^<p>(?: |<br>)<\/p>$/i) && e.startContainer.equals(a)) && setTimeout(function() {
- e = b.getSelection().getRanges()[0];
- if(!e.startContainer.equals("body")) {
- a.getFirst().remove(1);
- e.moveToElementEditEnd(a);
- e.select()
- }
- }, 0)
- })
- }
- if(CKEDITOR.env.webkit || CKEDITOR.env.ie && CKEDITOR.env.version > 10) g.getDocumentElement().on("mousedown", function(a) {
- a.data.getTarget().is("html") &&
- setTimeout(function() {
- b.editable().focus()
- })
- });
- e(b);
- try {
- b.document.$.execCommand("2D-position", false, true)
- } catch(i) {}(CKEDITOR.env.gecko || CKEDITOR.env.ie && b.document.$.compatMode == "CSS1Compat") && this.attachListener(this, "keydown", function(a) {
- var c = a.data.getKeystroke();
- if(c == 33 || c == 34)
- if(CKEDITOR.env.ie) setTimeout(function() {
- b.getSelection().scrollIntoView()
- }, 0);
- else if(b.window.$.innerHeight > this.$.offsetHeight) {
- var e = b.createRange();
- e[c == 33 ? "moveToElementEditStart" : "moveToElementEditEnd"](this);
- e.select();
- a.data.preventDefault()
- }
- });
- CKEDITOR.env.ie && this.attachListener(g, "blur", function() {
- try {
- g.$.selection.empty()
- } catch(a) {}
- });
- CKEDITOR.env.iOS && this.attachListener(g, "touchend", function() {
- a.focus()
- });
- f = b.document.getElementsByTag("title").getItem(0);
- f.data("cke-title", f.getText());
- if(CKEDITOR.env.ie) b.document.$.title = this._.docTitle;
- CKEDITOR.tools.setTimeout(function() {
- if(this.status == "unloaded") this.status = "ready";
- b.fire("contentDom");
- if(this._.isPendingFocus) {
- b.focus();
- this._.isPendingFocus =
- false
- }
- setTimeout(function() {
- b.fire("dataReady")
- }, 0);
- CKEDITOR.env.ie && setTimeout(function() {
- if(b.document) {
- var a = b.document.$.body;
- a.runtimeStyle.marginBottom = "0px";
- a.runtimeStyle.marginBottom = ""
- }
- }, 1E3)
- }, 0, this)
- }
- function e(a) {
- function b() {
- var d;
- a.editable().attachListener(a, "selectionChange", function() {
- var b = a.getSelection().getSelectedElement();
- if(b) {
- if(d) {
- d.detachEvent("onresizestart", e);
- d = null
- }
- b.$.attachEvent("onresizestart", e);
- d = b.$
- }
- })
- }
- function e(a) {
- a.returnValue = false
- }
- if(CKEDITOR.env.gecko) try {
- var f =
- a.document.$;
- f.execCommand("enableObjectResizing", false, !a.config.disableObjectResizing);
- f.execCommand("enableInlineTableEditing", false, !a.config.disableNativeTableHandles)
- } catch(g) {} else CKEDITOR.env.ie && (CKEDITOR.env.version < 11 && a.config.disableObjectResizing) && b(a)
- }
- function b() {
- var a = [];
- if(CKEDITOR.document.$.documentMode >= 8) {
- a.push("html.CSS1Compat [contenteditable=false]{min-height:0 !important}");
- var b = [],
- e;
- for(e in CKEDITOR.dtd.$removeEmpty) b.push("html.CSS1Compat " + e + "[contenteditable=false]");
- a.push(b.join(",") + "{display:inline-block}")
- } else if(CKEDITOR.env.gecko) {
- a.push("html{height:100% !important}");
- a.push("img:-moz-broken{-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")
- }
- a.push("html{cursor:text;*cursor:auto}");
- a.push("img,input,textarea{cursor:default}");
- return a.join("\n")
- }
- CKEDITOR.plugins.add("wysiwygarea", {
- init: function(a) {
- a.config.fullPage && a.addFeature({
- allowedContent: "html head title; style [media,type]; body (*)[id]; meta link [*]",
- requiredContent: "body"
- });
- a.addMode("wysiwyg",
- function(b) {
- function e(f) {
- f && f.removeListener();
- a.editable(new g(a, h.$.contentWindow.document.body));
- a.setData(a.getData(1), b)
- }
- var f = "document.open();" + (CKEDITOR.env.ie ? "(" + CKEDITOR.tools.fixDomain + ")();" : "") + "document.close();",
- f = CKEDITOR.env.air ? "javascript:void(0)" : CKEDITOR.env.ie ? "javascript:void(function(){" + encodeURIComponent(f) + "}())" : "",
- h = CKEDITOR.dom.element.createFromHtml('<iframe src="' + f + '" frameBorder="0"></iframe>');
- h.setStyles({
- width: "100%",
- height: "100%"
- });
- h.addClass("cke_wysiwyg_frame cke_reset");
- var i = a.ui.space("contents");
- i.append(h);
- if(f = CKEDITOR.env.ie || CKEDITOR.env.gecko) h.on("load", e);
- var k = a.title,
- n = a.fire("ariaEditorHelpLabel", {}).label;
- if(k) {
- CKEDITOR.env.ie && n && (k = k + (", " + n));
- h.setAttribute("title", k)
- }
- if(n) {
- var k = CKEDITOR.tools.getNextId(),
- o = CKEDITOR.dom.element.createFromHtml('<span id="' + k + '" class="cke_voice_label">' + n + "</span>");
- i.append(o, 1);
- h.setAttribute("aria-describedby", k)
- }
- a.on("beforeModeUnload", function(a) {
- a.removeListener();
- o && o.remove()
- });
- h.setAttributes({
- tabIndex: a.tabIndex,
- allowTransparency: "true"
- });
- !f && e();
- if(CKEDITOR.env.webkit) {
- f = function() {
- i.setStyle("width", "100%");
- h.hide();
- h.setSize("width", i.getSize("width"));
- i.removeStyle("width");
- h.show()
- };
- h.setCustomData("onResize", f);
- CKEDITOR.document.getWindow().on("resize", f)
- }
- a.fire("ariaWidget", h)
- })
- }
- });
- CKEDITOR.editor.prototype.addContentsCss = function(a) {
- var b = this.config,
- e = b.contentsCss;
- if(!CKEDITOR.tools.isArray(e)) b.contentsCss = e ? [e] : [];
- b.contentsCss.push(a)
- };
- var g = CKEDITOR.tools.createClass({
- $: function() {
- this.base.apply(this,
- arguments);
- this._.frameLoadedHandler = CKEDITOR.tools.addFunction(function(b) {
- CKEDITOR.tools.setTimeout(a, 0, this, b)
- }, this);
- this._.docTitle = this.getWindow().getFrame().getAttribute("title")
- },
- base: CKEDITOR.editable,
- proto: {
- setData: function(a, d) {
- var e = this.editor;
- if(d) {
- this.setHtml(a);
- this.fixInitialSelection();
- e.fire("dataReady")
- } else {
- this._.isLoadingData = true;
- e._.dataStore = {
- id: 1
- };
- var f = e.config,
- g = f.fullPage,
- i = f.docType,
- k = CKEDITOR.tools.buildStyleHtml(b()).replace(/<style>/, '<style data-cke-temp="1">');
- g || (k = k + CKEDITOR.tools.buildStyleHtml(e.config.contentsCss));
- var n = f.baseHref ? '<base href="' + f.baseHref + '" data-cke-temp="1" />' : "";
- g && (a = a.replace(/<!DOCTYPE[^>]*>/i, function(a) {
- e.docType = i = a;
- return ""
- }).replace(/<\?xml\s[^\?]*\?>/i, function(a) {
- e.xmlDeclaration = a;
- return ""
- }));
- a = e.dataProcessor.toHtml(a);
- if(g) {
- /<body[\s|>]/.test(a) || (a = "<body>" + a);
- /<html[\s|>]/.test(a) || (a = "<html>" + a + "</html>");
- /<head[\s|>]/.test(a) ? /<title[\s|>]/.test(a) || (a = a.replace(/<head[^>]*>/, "$&<title></title>")) : a = a.replace(/<html[^>]*>/,
- "$&<head><title></title></head>");
- n && (a = a.replace(/<head[^>]*?>/, "$&" + n));
- a = a.replace(/<\/head\s*>/, k + "$&");
- a = i + a
- } else a = f.docType + '<html dir="' + f.contentsLangDirection + '" lang="' + (f.contentsLanguage || e.langCode) + '"><head><title>' + this._.docTitle + "</title>" + n + k + "</head><body" + (f.bodyId ? ' id="' + f.bodyId + '"' : "") + (f.bodyClass ? ' class="' + f.bodyClass + '"' : "") + ">" + a + "</body></html>";
- if(CKEDITOR.env.gecko) {
- a = a.replace(/<body/, '<body contenteditable="true" ');
- CKEDITOR.env.version < 2E4 && (a = a.replace(/<body[^>]*>/,
- "$&<\!-- cke-content-start --\>"))
- }
- f = '<script id="cke_actscrpt" type="text/javascript"' + (CKEDITOR.env.ie ? ' defer="defer" ' : "") + ">var wasLoaded=0;function onload(){if(!wasLoaded)window.parent.CKEDITOR.tools.callFunction(" + this._.frameLoadedHandler + ",window);wasLoaded=1;}" + (CKEDITOR.env.ie ? "onload();" : 'document.addEventListener("DOMContentLoaded", onload, false );') + "<\/script>";
- CKEDITOR.env.ie && CKEDITOR.env.version < 9 && (f = f + '<script id="cke_shimscrpt">window.parent.CKEDITOR.tools.enableHtml5Elements(document)<\/script>');
- n && (CKEDITOR.env.ie && CKEDITOR.env.version < 10) && (f = f + '<script id="cke_basetagscrpt">var baseTag = document.querySelector( "base" );baseTag.href = baseTag.href;<\/script>');
- a = a.replace(/(?=\s*<\/(:?head)>)/, f);
- this.clearCustomData();
- this.clearListeners();
- e.fire("contentDomUnload");
- var o = this.getDocument();
- try {
- o.write(a)
- } catch(q) {
- setTimeout(function() {
- o.write(a)
- }, 0)
- }
- }
- },
- getData: function(a) {
- if(a) return this.getHtml();
- var a = this.editor,
- b = a.config,
- e = b.fullPage,
- f = e && a.docType,
- g = e && a.xmlDeclaration,
- i = this.getDocument(),
- e = e ? i.getDocumentElement().getOuterHtml() : i.getBody().getHtml();
- CKEDITOR.env.gecko && b.enterMode != CKEDITOR.ENTER_BR && (e = e.replace(/<br>(?=\s*(:?$|<\/body>))/, ""));
- e = a.dataProcessor.toDataFormat(e);
- g && (e = g + "\n" + e);
- f && (e = f + "\n" + e);
- return e
- },
- focus: function() {
- this._.isLoadingData ? this._.isPendingFocus = true : g.baseProto.focus.call(this)
- },
- detach: function() {
- var a = this.editor,
- b = a.document,
- a = a.window.getFrame();
- g.baseProto.detach.call(this);
- this.clearCustomData();
- b.getDocumentElement().clearCustomData();
- a.clearCustomData();
- CKEDITOR.tools.removeFunction(this._.frameLoadedHandler);
- (b = a.removeCustomData("onResize")) && b.removeListener();
- a.remove()
- }
- }
- })
- }(), CKEDITOR.config.disableObjectResizing = !1, CKEDITOR.config.disableNativeTableHandles = !0, CKEDITOR.config.disableNativeSpellChecker = !0, CKEDITOR.config.contentsCss = CKEDITOR.getUrl("contents.css"), CKEDITOR.config.plugins = "dialogui,dialog,a11yhelp,about,basicstyles,blockquote,clipboard,panel,floatpanel,menu,contextmenu,elementspath,indent,indentlist,list,enterkey,entities,popup,filebrowser,floatingspace,listblock,button,richcombo,format,horizontalrule,htmlwriter,image,fakeobjects,link,magicline,maximize,pastefromword,pastetext,removeformat,resize,menubutton,scayt,showborders,sourcearea,specialchar,stylescombo,tab,table,tabletools,toolbar,undo,wsc,wysiwygarea",
- CKEDITOR.config.skin = "moono",
- function() {
- var a = function(a, b) {
- for(var g = CKEDITOR.getUrl("plugins/" + b), a = a.split(","), c = 0; c < a.length; c++) CKEDITOR.skin.icons[a[c]] = {
- path: g,
- offset: -a[++c],
- bgsize: a[++c]
- }
- };
- CKEDITOR.env.hidpi ? a("about,0,,bold,24,,italic,48,,strike,72,,subscript,96,,superscript,120,,underline,144,,bidiltr,168,,bidirtl,192,,blockquote,216,,copy-rtl,240,,copy,264,,cut-rtl,288,,cut,312,,paste-rtl,336,,paste,360,,codesnippet,384,,bgcolor,408,,textcolor,432,,creatediv,456,,docprops-rtl,480,,docprops,504,,find-rtl,528,,find,552,,replace,576,,flash,600,,button,624,,checkbox,648,,form,672,,hiddenfield,696,,imagebutton,720,,radio,744,,select-rtl,768,,select,792,,textarea-rtl,816,,textarea,840,,textfield-rtl,864,,textfield,888,,horizontalrule,912,,iframe,936,,image,960,,indent-rtl,984,,indent,1008,,outdent-rtl,1032,,outdent,1056,,justifyblock,1080,,justifycenter,1104,,justifyleft,1128,,justifyright,1152,,language,1176,,anchor-rtl,1200,,anchor,1224,,link,1248,,unlink,1272,,bulletedlist-rtl,1296,,bulletedlist,1320,,numberedlist-rtl,1344,,numberedlist,1368,,mathjax,1392,,maximize,1416,,newpage-rtl,1440,,newpage,1464,,pagebreak-rtl,1488,,pagebreak,1512,,pastefromword-rtl,1536,,pastefromword,1560,,pastetext-rtl,1584,,pastetext,1608,,placeholder,1632,,preview-rtl,1656,,preview,1680,,print,1704,,removeformat,1728,,save,1752,,scayt,1776,,selectall,1800,,showblocks-rtl,1824,,showblocks,1848,,smiley,1872,,source-rtl,1896,,source,1920,,sourcedialog-rtl,1944,,sourcedialog,1968,,specialchar,1992,,table,2016,,templates-rtl,2040,,templates,2064,,uicolor,2088,,redo-rtl,2112,,redo,2136,,undo-rtl,2160,,undo,2184,,simplebox,4416,auto,spellchecker,2232,",
- "icons_hidpi.png") : a("about,0,auto,bold,24,auto,italic,48,auto,strike,72,auto,subscript,96,auto,superscript,120,auto,underline,144,auto,bidiltr,168,auto,bidirtl,192,auto,blockquote,216,auto,copy-rtl,240,auto,copy,264,auto,cut-rtl,288,auto,cut,312,auto,paste-rtl,336,auto,paste,360,auto,codesnippet,384,auto,bgcolor,408,auto,textcolor,432,auto,creatediv,456,auto,docprops-rtl,480,auto,docprops,504,auto,find-rtl,528,auto,find,552,auto,replace,576,auto,flash,600,auto,button,624,auto,checkbox,648,auto,form,672,auto,hiddenfield,696,auto,imagebutton,720,auto,radio,744,auto,select-rtl,768,auto,select,792,auto,textarea-rtl,816,auto,textarea,840,auto,textfield-rtl,864,auto,textfield,888,auto,horizontalrule,912,auto,iframe,936,auto,image,960,auto,indent-rtl,984,auto,indent,1008,auto,outdent-rtl,1032,auto,outdent,1056,auto,justifyblock,1080,auto,justifycenter,1104,auto,justifyleft,1128,auto,justifyright,1152,auto,language,1176,auto,anchor-rtl,1200,auto,anchor,1224,auto,link,1248,auto,unlink,1272,auto,bulletedlist-rtl,1296,auto,bulletedlist,1320,auto,numberedlist-rtl,1344,auto,numberedlist,1368,auto,mathjax,1392,auto,maximize,1416,auto,newpage-rtl,1440,auto,newpage,1464,auto,pagebreak-rtl,1488,auto,pagebreak,1512,auto,pastefromword-rtl,1536,auto,pastefromword,1560,auto,pastetext-rtl,1584,auto,pastetext,1608,auto,placeholder,1632,auto,preview-rtl,1656,auto,preview,1680,auto,print,1704,auto,removeformat,1728,auto,save,1752,auto,scayt,1776,auto,selectall,1800,auto,showblocks-rtl,1824,auto,showblocks,1848,auto,smiley,1872,auto,source-rtl,1896,auto,source,1920,auto,sourcedialog-rtl,1944,auto,sourcedialog,1968,auto,specialchar,1992,auto,table,2016,auto,templates-rtl,2040,auto,templates,2064,auto,uicolor,2088,auto,redo-rtl,2112,auto,redo,2136,auto,undo-rtl,2160,auto,undo,2184,auto,simplebox,2208,auto,spellchecker,2232,auto",
- "icons.png")
- }()
- })();
|