123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199 |
- //查看指定文件,,判断是否保存或者覆盖,包括创建邀请协作人员,创建编辑历史,创建生成链接.创建热门模板。加载当前word文档的内容。创建光标,监控键盘输入等。这里是iframe中的word起始点。
- //监控输入输出,
- //添加成员,共同编辑。
- Namespace.register("U.Word");
- //由于当前文档的js是加载在ifame里面的,获取不到外部的文档(www.1473.cn)信息。所以通过传递参数设置全局变量的形式保存当前文档信息。
- //id是word文档id,PID是文档归属的目录id,fileinfo是文档的实体信息fileinfo,OL初始化回调函数,UID是当前文档创建者的id。
- U.Word.TF = { "ID": null, "PID": "", "fileinfo": "", "UID": "" };
- US = parent.US;
- //#region 初始化区域
- //链接形式点击查看Word资料,例1: /usercontrols/Word.htm?ID=a0373130-be97-db03-4e74-9967c1038d13
- //例2:a0373130-be97-db03-4e74-9967c1038d13.1473.cn
- //例3:短域名 example.1473.cn
- window.onload = function () {
- U.D.FrameTop(); //让弹框置顶。
- U.M.OLM(); //屏蔽右键菜单等功能按键判断
- var _fileid = U.M.QueryString("ID"); //获取登录着id
- if (_fileid) {
- parent.U.A.Request("UseStudioDisk.GetOffice", ([_fileid, ""]), U.Word.AsynGOF, ([[$("body")[0], true]]));
- };
- }
- //获取文件异步
- U.Word.AsynGOF = function (request, UDOD) {
- var _result = request.value.UsOffice || ""; //或者的作用是:右键新建word,没有保存时给""。
- //设置内容为空。
- //$("body").addAttrArray({ "style": {}, "innerHTML": "" });
- U.M.loadHtml(document.body, _result);
- return true;
- }
- //------------------------------------------------------------------------------初始化Word----------------------------------------------------------------------------
- //查看指定文件,,判断是否保存或者覆盖,包括创建邀请协作人员,创建编辑历史,创建生成链接.创建热门模板。加载当前word文档的内容。创建光标,监控键盘输入等。这里是iframe中的word起始点。
- //fileinfo ? fileinfo.UserDirectoryID : "" 如果有文件id则表示文件已经在数据库存在,如果没有id,表示是新word。
- //fileinfo 文件信息
- //fileinfo ? fileinfo.UserId : userinfo.UserId 如果有文件信息,则所有者为该文件的创建者,否则为自己的用户id。
- U.Word.Load = function (fileid, fileinfo, uid, iframe) { //UDID 这个文件的id UDE 这个文件的基本信息 UID 这个文件创始人的id UAE object返回值
- //U.Word.Tool(fileinfo); //创建邀请协作人员,创建编辑历史,创建生成链接.创建热门模板的窗体,同时创建了编辑区域
- U.Word.Variable(fileid, fileinfo, uid, iframe); //初始化全局变量
- U.Word.Panel.Loadeditor(fileinfo); //加载word的编辑器
- U.Word.Panel.LoadPlayUser(fileinfo); //加载协助人员窗体
- U.Word.Panel.Loadlink(fileinfo); //加载链接窗体
- U.Word.Panel.LoadHotTemplates(); //加载热门模板
- U.Word.Panel.LoadOfficeHistory(fileinfo,uid); //加载历史记录
- U.Word.LoadContent(fileid, uid, fileinfo); //初始化内容 只有加载出word内容的情况下触发
- }
- /**
- * 加载Word编辑区域的内容
- *
- */
- U.Word.LoadContent = function (fileid, uid, fileinfo) {
- //如果有文件内容,则hascontent.
- var hascontent;
- if (fileinfo) {
- hascontent = U.Ut.isString(fileinfo.UsOffice);
- }
- //如果没有加载到,则去数据库加载
- if (fileid && !hascontent) { //获取查看的office内容
- parent.U.A.Request("UseStudioDisk.GetOffice", ([fileid, ""]), U.Word.AsynLoad, (["", fileid, fileinfo, uid])); //获取office内容
- return;
- }
- //创建光标,监控键盘输入(包含粘贴板,回车,删除,分页等系统操作),等。
- U.Word.OLWord(fileinfo); //word加载处理
- }
- //异步获取Word编辑区域的数据
- U.Word.AsynLoad = function (request) { //object 值
- var context = request.context, //获取array值
- _fileid = context[1], //获取文件id
- _fileinfo = context[2], //获取文件信息
- _uid = context[3], //用户id
- request = request.value; //服务器返回的值。
- _fileinfo.UsOffice = request.UsOffice || ""; //word内容
- U.Word.LoadContent(_fileid, _uid, _fileinfo); //查看文件
- }
- /**
- * 初始化全局变量
- *
- */
- U.Word.Variable = function (fileid, fileinfo, uid, iframe) {
- //由于iframe和www.1473.cn不能相互调用文档信息,所以通过这个形式添加文档的ID和当前创建文档用户的id以及当前文档的信息保存到全局变量中
- var _UTE = U.Word.TF;
- _UTE.ID = fileid; //文档id
- _UTE.UID = uid; //创建用户id
- _UTE.ET = fileinfo; //文件信息实体 fileinfo
- _UTE.UDED = iframe; //在www.1473.cn的域层的iframe
- }
- //#region
- /**
- * 初始化Word,//创建光标,监控键盘输入(包含粘贴板,回车,删除,分页等系统操作),等。
- *
- * @param {object} 登录用户信息 ,没有有用到,需要删除
- * @param {object} 文档信息数组 或 null
- * @param {object} 获取存放office元素 ,没有用到,需要删除
- * @param {object} office窗体元素(Ifrmae)
- * @param {object} office文件在网盘的唯一id
- */
- U.Word.OLWord = function (fileinfo) {
- var i,
- _content, //word文件内容保存在这里
- _cursor; //光标
- //得到可编辑区域变量
- var _child = $("#UD_SYQXR").Child();
- var _editarea = $(_child[_child.length - 1]).Child()[1]; //可编辑区域,是_content的父亲
- //廖泽愈写的,要放到其他位置。视图生成
- // U.Word.ViewDisplayon(); //视图关闭
- // U.Word.ViewDisplayc();//编辑区关闭后,其他窗体关闭
- //新建文件没有文件内容,所以需要判断,以后可以再考虑。
- if (!fileinfo) {
- _content = _editarea.innerHTML;
- }
- else {
- _content = fileinfo["UsOffice"];
- }
- // U.Word.AsynGetTemp(_content); //异步加载模板原型
- //默认设置可编辑为true
- $(_editarea).addAttrArray({
- "innerHTML": "",
- "contentEditable": "true"
- });
- //得到整理好的内容,以便插入光标在末尾
- _content = U.Word.lastContent(_editarea, _content);
- //创建光标的地方
- //同时也是出了键盘事件的地方,U.Word.Keyboard是键盘事件,作为回调函数传递给光标进行处理。
- ////把键盘事件和光标一起绑定,因为要使用光标的地方全部都要监控键盘输入输出,所以绑定在一起,如果有机会,可以独立。
- //监控键盘输入(包含粘贴板,回车,删除,分页等系统操作),等。
- _cursor = U.OU.WordFocus(_editarea, _content, U.Word.Keyboard); //编辑绑定
- //找到子元素,实质是向子元素追加光标
- _editarea = $(_editarea).Child();
- //插入光标到指定位置。
- _cursor.QX(1, 1, _editarea[_editarea.length - 1]);
- //保存光标变量。
- _cursor.CreateR();
- }
- //得到整理好的内容,以便插入光标在末尾
- U.Word.lastContent = function (editarea, content) {
- var _tmp;
- var _content = content;
- //如果word有内容,则自动排版分页,目的是得到内容,正常显示,以便创建光标时正常写入,把光标放入最末尾。
- if (_content) {//内容插入
- _tmp = $($$("div", { "innerHTML": _content })).Child();
- for (i = 0; i < _tmp.length; i++) {
- if (_tmp[i].className == "U_Boom_CO_Editor_body_main_m") {
- _content = "";
- if (!i) {
- _editarea.innerHTML = $(_tmp[i]).Child()[1].innerHTML;
- }
- else {
- U.Word.Page($(_editarea).Parent(), null, $(_tmp[i]).Child()[1].innerHTML); //生成下一页
- }
- }
- }
- }
- else { //空文字处理
- _content = "<div><br /></div>"; //追加光标其实是追加到div之间。
- }
- return _content;
- }
- //#endregion
- //#region 保存区域
- //关闭保存文件
- U.Word.CSave = function (cb) {
- if (U.Word.BCWJ()) { //关闭同时保存文件
- parent.U.UI.Confirm("是否保存文件", [U.Word.Save, ([cb])], UFN);
- }
- else { //直接退出
- U.M.apply(this, [cb])();
- }
- }
- //保存Word
- U.Word.Save = function (cb) {
- //判断用户是否登录,只有登录用户才能保存信息
- if (!top.U.U.L.DLTC()) {
- //获取编辑区域的元素
- var _diskdiv, //disk的窗体
- _isdisplay, //云盘是否已经隐藏
- _isopen, //是否已经打开
- _isftp, //判断用户是否为ftp用户
- _isgroupuser; //判断用户是否在群里操作群文件
- var _wordinfo = U.Word.TF; //word全局变量 包含了uw文件的文件信息 等
- var _fileinfo = _wordinfo["fileinfo"]; //uw文件的文件信息
- var _uid = _wordinfo.UID;
- var _iframe = _wordinfo.UDED;
- var _worddiv = $(_iframe).Parent({ usform: "true" });
- //获取编辑区域的内容
- var _editor = $("#UD_SYQXR")[0];
- var _html = _editor.innerHTML.toHtml(); //获取编辑区域的html 这里保存的值包含了分页
- if (_uid == _wordinfo["UID"] || (_fileinfo && _fileinfo.GroupID == _uid)) {
- _isftp = true;
- }
- if (_fileinfo) {
- _isgroupuser = _$(US.Friend[3]).Select({ "GroupManageID": _fileinfo.UserDirectoryEncrypt, "UserId": US.userinfo.UserId })[0];
- }
- var _userdisk = top.U.Dk.DiskOperatingSwitch(US.userinfo.UserId); //获取用户个人网盘的信息 _userdisk.pdiv 是用户的网盘窗体
- if (_fileinfo && (_isftp || _isgroupuser)) { //判断文件是否是自己或者是ftp的文件或者是群文件
- top.U.Dk.LE.USOS(_fileinfo, _html, null, cb); //保存到数据库
- U.Word.Panel.InsertOfficeHistory(_fileinfo.UserDirectoryID, _uid, "uw"); //插入历史记录
- }
- // else if (fileinfo && (!fileinfo.JD && U.Word.GCoEd(fileinfo, U.M.apply(this, [[U.Word.Save, ([cb])]])))) { //这里会有一种情况就是用户群没有加载成功,去数据库中获取判断用户是否在群里
- // U.Alert("权限初始化");
- // }
- else { //文件不存在 或者文件不属于自己就创建一个新文件保存
- _isdisplay = !_userdisk.pdiv || $(_userdisk.pdiv).Parent({ usform: "true" }).style.display == "none"; //判断当前网盘是否是打开状态
- _diskdiv = top.U.D.DT.YYDK("Disk", [_uid, _userdisk ? _userdisk[1][1] : US.DG]); //获取弹出的网盘窗体
- //新建保存函数
- top.U.Dk.RE.CMB("uw", U.M.apply(this, [
- [top.U.Dk.LE.NUSOS, (["uw", _html, _wordinfo])], //新建成功后保存uw文件的信息
- [U.Word.YBKWJ, ([U.M.apply(this, [[U.Word.BCAWJMXG, ([_worddiv])]])])], //新建文件成功后修改word编辑弹出和全局变量信息
- _isdisplay ? [U.D.CloseWindow, ([_diskdiv])] : [U.D.SetDTop, ([_worddiv])], //保存文件需要通过云盘去操作,如果云盘在打开的状态下就不隐藏云盘如果是隐藏的状态下就隐藏云盘
- cb //回调函数chuli8
- ]), _diskdiv, _uid);
- }
- }
- }
- U.Word.BCAWJMXG = function (editordiv, fileinfo) {
- editordiv.id = "UD_Word" + fileinfo.UserDirectoryID; //设置元素id 为UD_SYQA + 文件id
- $("input", editordiv)[0].value = fileinfo.UserallDirectoryName; //修改文件名
- }
- /**
- * 保存文件信息判断文档保存的状态值
- *
- * @param {object} 点击的按钮元素
- * @return {number} 保存信息的值
- 0 无需保存可以直接关闭
- 1 新建文件的保存提示
- 3 打开文档未编辑的保存
- */
- U.Word.BCWJ = function () {
- var _wordinfo = U.Word.TF, //word对象处理
- _uid = US.userinfo.UserId, //用户id
- _fileinfo = _wordinfo["fileinfo"], //文件信息
- _contentdiv = $$("div", { "innerHTML": _fileinfo.UsOffice }), //默认的文档内容
- _editor = $("#UD_SYQXR")[0]; //编辑div
- if (_fileinfo.UsOffice == null) { //新建文件没有保存的情况
- return 1;
- }
- else if (_wordinfo["ID"] && _fileinfo.UsOffice && _editor.innerHTML != _contentdiv.innerHTML) { //打开文档未编辑的保存
- return 3;
- }
- return 0; //无需保存可以直接关闭
- }
- //空文件保存异步
- U.Word.YBKWJ = function (cb, filesinfo) {
- var _fileinfo = filesinfo[1];
- _fileinfo["UsOffice"] = $("#UD_SYQXR")[0].innerHTML; //获取这个文件的内容
- U.Word.TF.fileinfo = _fileinfo; //设置word文件信息实体
- U.Word.TF.PID = _fileinfo.UserDirectoryParentID; //设置目录id
- U.Word.TF.ID = _fileinfo.UserDirectoryID; //设置文件的id
- U.Word.TF.UID = _fileinfo.UserId || top.US.userinfo.UserId; //设置所属人信息
- if (U.Ut.isFunction(cb)) { cb(_fileinfo); } //回调函数
- }
- //#endregion
- //#region 文件备份
- /**
- * 文件备份
- *
- * @param {object} 文件信息
- * @param {object} 指定的Window操作层
- */
- U.Word.Backup = function () {
- var _isuser, //判断是否是本人
- _isgroup; //判断是否为群
- var _wordinfo = U.Word.TF; //word全局变量 包含当前word的信息
- var _fileinfo = _wordinfo.fileinfo; //文件的信息
- if (_fileinfo) { //判断是否有文件信息
- _isuser = _fileinfo.UserId == US.userinfo.UserId; //判断是否是本人
- _isgroup = _fileinfo.UserDirectoryEncrypt && _$(US.Friend[3]).Select({ "GroupManageID": _fileinfo.UserDirectoryEncrypt, "UserId": US.userinfo.UserId })[0]; //判断是否为群成员备份
- if (_isuser || _isgroup) { //判断备份的文件是否为用户自己的文件
- U.Dk.DiskOperatingSwitch(US.userinfo.UserId); //操作用户切换会当前登录用户
- //弹出查看备份选择
- U.Dk.VW.CCWPXZK(UDE.UserDirectoryParentID, {
- De: U.Word.BackupDe, //删除备份操作
- onclick: U.M.apply(null, [ //
- [U.Word.OpenBF, ([UW])]
- ]),
- Bo: {
- ok: U.M.apply(null, [
- [U.Word.OBackup, ([UDE])]
- ])
- }
- }, "Other", UDE.UserDirectoryID, U.Dk.VW.APWPTP); //弹出网盘选择框
- }
- else {
- U.Alert("无法备份他人文件");
- }
- }
- else { //没有的话保存该文件
- U.Word.WBH("", "Save", true);
- } //为存储的文件设定为存储模式
- }
- /**
- * 备份删除
- *
- * @param {object} 文件信息
- * @param {object} 当前备份文件的元素
- */
- U.Word.BackupDe = function (backupdiv, fileinfo) {
- U.UI.Confirm("是否删除该备份", [U.M.apply(null, [[U.Word.NBackupDe, ([fileinfo, backupdiv])]])]); //创建提示框 提示是否删除备份
- }
- /**
- * 确定删除该备份
- *
- * @param {object} 当前备份文件的元素
- * @param {object} 文件信息
- */
- U.Word.NBackupDe = function (backupdiv, fileinfo) {
- U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "UD_D_DeleteBackupFile", UDE.UserDirectoryID]), U.Word.AsynBackupDe, ([null, backupdiv, fileinfo])); //向后台发送删除备份请求 参数为文件id
- }
- /**
- * 备份已经删除
- *
- * @param {object} 返回值及回调传参
- */
- U.Word.AsynBackupDe = function (request) {
- var context = request.context, //获取回调传参
- _backupdiv = context[1], //当前备份文件的元素
- _backuppdiv = $(_backupdiv).Parent(); //获取放置备份文件的父亲层
- request = request.value; //函数返回值
- U.Alert("备份删除成功"); //提示删除成功
- $(_backupdiv).remove(); //删除当前备份文件的元素
- if (!$(_backuppdiv).Child().length) { //如果没有备份
- $$("div", {
- "className": "UD_SYSXZLRSITT",
- "innerHTML": "该目录暂无指定的内容"
- }, _UDPD); //创建无备份提示
- }
- }
- /**
- * 文件备份确定
- *
- * @param {object} 创建office的容器元素
- * @param {string} 用户id
- */
- U.Word.OBackup = function (fileinfo, dirid) {
- U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "UD_I_AddBackupFile", fileinfo.UserDirectoryID]), U.Word.AsynOBackup, ([null, fileinfo, dirid]));
- }
- /**
- * 文件备份异步
- *
- * @param {object} 返回值及回调传参
- */
- U.Word.AsynOBackup = function (request) {
- request = request.value; //返回值
- var context = request.context; //回调传参
- if (request) {//判断是否备份成功
- U.Alert("备份成功");
- }
- }
- /**
- * 备份查看
- *
- * @param {object} 文件信息
- * @param {object} 指定的Window操作层
- */
- U.Word.OpenBF = function (fileinfo) {
- U.UI.Confirm("是否选中该备份", [U.Word.OpenNBF, ([fileinfo])]);
- }
- /**
- * 确定获取模板
- *
- * @param {object} 指定的Window操作层
- * @param {object} 文件信息
- */
- U.Word.OpenNBF = function (fileinfo) {
- U.Alert("文件正在加载中"); //提示加载
- U.A.Request("UseStudioDisk.GetOffice", ([fileinfo.UserDirectoryID, ""]), U.Word.AsynOpenBF, (["", fileinfo])); //发送获取备份请求
- }
- /**
- * 异步加载
- *
- * @param {object} 返回值及回调传参
- */
- U.Word.AsynOpenBF = function (request) {
- var _editor = $("#UD_SYQXR")[0], //设置变量
- context = request.context, //获取回调传参
- _fileinfo = context[1]; //文件信息
- _fileinfo.UsOffice = request.value; //设置内容
- U.Word.OLWord(_fileinfo);
- }
- //#endregion
- //#region 表格插入
- /**
- * 插入表格
- *
- * @param {element} 换页元素
- */
- U.Word.InsertTable = function () {
- var _UDTD, _UDSD, _UDKD, _UDMB
- _UDOD = $$("div", { "class": "U_Boom_CO_Popup_16" });
- _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16_main" }, _UDOD);
- for (var i = 0; i < 7; i++) {
- for (var j = 0; j < 8; j++) {
- var a = $$("div", { "class": "U_Boom_CO_Popup_16_block", "style": { "top": i * 25 + 'px', "left": j * 26 + 'px'} }, _UDMB);
- a.x = j;
- a.y = i;
- a.onmouseover = function () {
- U.Word.SelectTable(this.x, this.y)
- }
- a.onmousedown = function () {
- U.Word.AsynInsertTable(this.x + 1, this.y + 1)
- }
- }
- }
- $$("div", { "innerHTML": "直接插入", "style": { "position": "absolute", "top": "180px"} }, _UDMB).onclick = function () {
- $(".U_Boom_CO_Popup_16_main")[0].style.display = 'none';
- $(".U_Boom_CO_Popup_16_main")[1].style.display = 'block';
- };
- _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16_main", "style": { "display": "none"} }, _UDOD);
- $$("div", { "class": "U_Boom_CO_Popup_16_title", "innerHTML": "表格尺寸" }, _UDMB);
- _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
- _UDKD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
- $$("span", { "innerHTML": "列数:" }, _UDTD);
- var _h = $$("input", { "id": "U_w_table_line" }, _UDTD);
- $$("span", { "innerHTML": "行数:" }, _UDKD);
- var _l = $$("input", { "id": "U_w_table_column" }, _UDKD);
- $$("div", { "innerHTML": "表格宽度", "class": "U_Boom_CO_Popup_16_title" }, _UDMB);
- _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
- _UDSD = $$("span", { "innerHTML": "宽度" }, _UDTD);
- $$("span", { "innerHTML": "mm", "style": { "float": "right", "text-indent": "5px"} }, _UDTD);
- $$("input", { "id": "U_w_table_width", "value": "1", "style": { "width": "50px"} }, _UDTD);
- U.UI.Confirm("插入表格", { "width": "230px", "height": "auto" }, null, [U.Word.AsynInsertTable, ([_h, _l])], _UDOD);
- }
- /*表格选择插入样式*/
- U.Word.SelectTable = function (x, y) {
- var xx = (x % 7) + 1;
- var yy = (y % 9) + 1;
- var a = $(".U_Boom_CO_Popup_16_block");
- for (var i = 0; i < a.length; i++) {
- a[i].style.borderColor = '#9e9e9e';
- }
- for (var i = 0; i < yy; i++) {
- for (var j = 0; j < xx; j++) {
- a[j + 8 * i].style.borderColor = '#38f';
- }
- }
- }
- /**
- * 插入表格
- *
- * @param {element} 换页元素
- */
- U.Word.KeyFlage = null;
- U.Word.MouseMenu = $("#UD_SYQER")[0];
- U.Word.AsynInsertTable = function (x, y, node) {
- var container;
- if (!x && !y) {
- U.Alert('请输入数据')
- } else {
- if (typeof x == 'object' || typeof y == 'object') {
- x = x.value;
- y = y.value;
- }
- }
- if (!node) {
- node = $(".U_Boom_CO_Editor_body_main_text")[0]
- container = $$("table", { "border": "0", "class": "U_Boom_Table", "cellpadding": "0", "cellspacing": "0" }, node);
- } else {
- container = node;
- }
- container = $$("tbody", {}, container);
- container.onkeydown = function (e) {
- if (e.ctrlKey) {
- U.Word.KeyFlage = true;
- }
- };
- container.onkeyup = function () {
- U.Word.KeyFlage = null;
- };
- for (var i = 0; i < y; i++) {
- var a = $$("tr", { "class": "U_Boom_Table_Line" }, container);
- for (var j = 0; j < x; j++) {
- var b = $$("td", { "class": "U_Boom_Table_Column" }, a);
- b.onmousedown = function (e) {
- if (e.button == 2) {
- U.M.RLocate(U.Word.MouseMenu);
- } else {
- U.Word.MouseMenu.removeAttribute('style');
- }
- U.Word.EditTable(this, e);
- };
- b.h = j;
- b.l = i;
- }
- }
- if ($("#U_COF")[0]) {
- $("#U_COF")[0].style.display = 'none';
- }
- };
- /**
- * 调整拖拽表格
- *
- * @param {element} 换页元素
- */
- U.Word.ResizeTable = function (control, e) {
- e.stopPropagation();
- e.preventDefault();
- var startX, container = control.parentNode;
- var ThisTable = container.parentNode.parentNode.parentNode, count,
- offsetX = container.offsetLeft - ThisTable.getBoundingClientRect().left;
- offsetY = container.offsetHeight - ThisTable.getBoundingClientRect().top;
- startX = e.pageX - ThisTable.getBoundingClientRect().left;
- document.onmousemove = function (e) {
- var ThisLine = container.parentNode;
- var TabelLine = ThisTable.getElementsByClassName("U_Boom_Table_Content");
- var TablePreparColumn = [],
- TableElseColumn = [];
- for (var i = 0; i < ThisLine.childNodes.length; i++) {
- if (ThisLine.childNodes[i] == container) {
- count = i;
- }
- }
- for (var i = 0; i < TabelLine.length; i++) {
- for (var k = 0; k < TabelLine[i].childNodes.length; k++) {
- if (k == count) {
- TablePreparColumn.push(TabelLine[i].childNodes[k]);
- }
- if (k > count) {
- TableElseColumn.push(TabelLine[i].childNodes[k]);
- }
- }
- }
- var endX = e.pageX - ThisTable.getBoundingClientRect().left - offsetX;
- var cutX = (endX - startX) / (TableElseColumn.length / TabelLine.length);
- for (var j = 0; j < TablePreparColumn.length; j++) {
- TablePreparColumn[j].style.width = endX + 'px';
- }
- for (var l = 0; l < TableElseColumn.length; l++) {
- if (cutX > 0) {
- TableElseColumn[l].style.width = TableElseColumn[l].offsetWidth - cutX + 'px';
- } else {
- TableElseColumn[l].style.width = TableElseColumn[l].offsetWidth + Math.abs(cutX) + 'px';
- }
- TableElseColumn[l].style.background = "yellow";
- }
- startX = e.pageX - ThisTable.getBoundingClientRect().left;
- TablePreparColumn = [];
- TableElseColumn = [];
- };
- document.onmouseup = function () {
- document.onmousemove = null;
- document.onmouseup = null;
- }
- };
- /**
- * 编辑表格
- *
- * @param {element} 换页元素
- */
- U.Word.EditTable = function (this_column, e) {
- e.stopPropagation();
- var Editors = $(".U_Boom_CO_Editor_body_main_text"); //编辑器
- var Column = $(".U_Boom_Table_Column");
- if (U.Word.KeyFlage) {
- this_column.state = true;
- this_column.setAttribute("contenteditable", true);
- this_column.style.border = "1px solid #38f";
- } else {
- for (var i = 0; i < Column.length; i++) {
- Column[i].state = false;
- Column[i].onkeydown = null;
- Column[i].setAttribute("contenteditable", false);
- Column[i].style.border = "1px solid #ccc";
- }
- }
- this_column.state = true;
- this_column.setAttribute("contenteditable", true);
- this_column.style.border = "1px solid #38f";
- for (var j = 0; j < Editors.length; j++) {
- Editors[j].setAttribute("contenteditable", false);
- Editors[j].onmousedown = function () {
- this.setAttribute("contenteditable", true);
- Array.prototype.forEach.call(this.getElementsByTagName('*'), function (elm) {
- elm.setAttribute("contenteditable", false);
- });
- }
- }
- };
- /**
- * 合并、拆分单元格
- *
- * @param {element} 换页元素
- */
- U.Word.ColumnControl = function (fx) {
- var column = $(".U_Boom_Table_Column");
- var selectColumn = [];
- var OperateColumn = [];
- for (var i = 0; i < column.length; i++) {
- if (column[i].state) {
- selectColumn.push(column[i])
- }
- }
- if (fx == 'split') {
- if (selectColumn.length > 1) {
- U.Alert('请选择一个单元格');
- Array.prototype.forEach.call(column, function (elm) {
- elm.removeAttribute('style');
- });
- } else {
- var _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16", "style": { "height": "110px"} });
- var UDHD = $$("div", { "class": "U_Boom_CO_Popup_16_main" }, _UDMB);
- $$("div", { "class": "U_Boom_CO_Popup_16_title", "innerHTML": "拆分大小" }, UDHD);
- var _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
- var _UDKD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
- $$("span", { "innerHTML": "列数:" }, _UDTD);
- var _l = $$("input", { "id": "U_w_table_line", "value": "2" }, _UDTD);
- $$("span", { "innerHTML": "行数:" }, _UDKD);
- var _h = $$("input", { "id": "U_w_table_column", "value": "2" }, _UDKD);
- var _CUM = new U.UI.Confirm("拆分单元格", { "width": "350px", "text-align": "center" }, null, U.M.apply(null, [[U.Word.AsynInsertTable, ([_h, _l, selectColumn[0]])]]), _UDMB); //创建对话框
- }
- } else {
- U.Alert('暂无法使用');
- U.Word.KeyFlage = null;
- U.Word.MouseMenu.removeAttribute('style');
- return false;
- /////以后删除
- var x = selectColumn[0].h, y = selectColumn[0].l;
- var width = 0, content = '';
- for (var i = 0; i < selectColumn.length; i++) {
- if (selectColumn[i].h == y) {///找出一行中被选中的
- OperateColumn.push(selectColumn[i]);
- x = selectColumn[i].l, y = selectColumn[i].h;
- }
- }
- for (var j = 1; j < OperateColumn.length; j++) {
- width = OperateColumn[j].parentNode.offsetWidth + width;
- content = OperateColumn[j].innerHTML + content;
- OperateColumn[j].parentNode.remove();
- }
- OperateColumn[0].parentNode.style.width = OperateColumn[0].offsetWidth + width + 'px';
- OperateColumn[0].innerHTML += content;
- }
- U.Word.KeyFlage = null;
- U.Word.MouseMenu.removeAttribute('style');
- };
- //#endregion
- //-----------------------------------------------------------------------------文档级联-------------------------------------------------------------------------------
- //用户word文档集
- U.Word.WDJ = function () {
- var i; //循环初始化
- _UAE,
- _UDE,
- _UDTD,
- _UID = US.userinfo.UserId,
- _UDOD = $("#U_W_GN_N")[0],
- _UDSD = $("span", _UDOD.parentNode),
- _UGE = US.Disk.diskfileTree,
- _UDFD = $$("frag");
- _UDOD.innerText = "";
- if (_UID) {
- _UDE = U.Word.TF["ID"] ? _$(_UGE[0]).Select({ "UserDirectoryExtendType": "uw", "UserDirectoryParentID": U.Word.TF["ET"]["UserDirectoryParentID"] || U.Word.TF["PID"] }) : parent.U.Dk.M.GDBFM("uw").slice(0, 10);
- U.Word.TF["PID"] = _UDE[0] ? _UDE[0]["UserDirectoryParentID"] : US["DG"];
- _UAE = _UDE[0] ? _$(_UGE[0]).Select({ "UserDirectoryID": _UDE[0]["UserDirectoryParentID"] }, null, 1)[0] : { "UserDirectoryName": "当前文件夹" };
- for (i = 0; i < _UDE.length; i++) {
- _UDTD = $$("div", { "className": "U_W_GN_NS", "title": _UDE[i].UserallDirectoryName, "onclick": [[U.Word.CWDJ, ([_UDE[i]])]] }, _UDFD);
- $$("div", { "className": "UDK_L_DiskGE U_W_GN_NSI" }, _UDTD);
- $$("div", { "className": "U_W_GN_NSS", "innerHTML": _UDE[i].UserDirectoryName }, _UDTD);
- }
- _UDOD.appendChild(_UDFD);
- }
- _UDSD[0].innerText = _UID ? (_UAE["UserDirectoryName"]) : "(未登录)"; _UDSD[1].innerText = _UID ? "(" + _UDE.length + ")" : ""; //标题变化
- }
- //word文档集点击
- U.Word.CWDJ = function (UDE, TF) {
- var _UDT = U.OU.R.GetSelectedText(),
- _UDOD = U.OU.R.SO; //获取选择的文字
- if (_UDOD && _UDOD.className.indexOf("U_ONOTI") > -1 && TF != false) {
- U.UI.Confirm("是否导航该文档", [U.Word.SCLJWZ, ([_UDOD, UDE])], [U.Word.CWDJ, ([UDE, false])]);
- }
- else {
- if (_UDT != "" && TF != false) {
- U.UI.Confirm("选中文字区是否生成链接网站", [U.Word.WDJL, ([UDE])], null);
- } //添加word链接
- else {
- if (U.Word.BCWJ()) { U.Word.Save(); }
- U.Word.Load(UDE["UserDirectoryID"], UDE);
- } //打开一个word
- }
- }
- //生成链接网站
- U.Word.SCLJWZ = function (UDOD, UDE) {
- (UDOD.className == "U_ONOTIB") && (UDOD = UDOD.parentNode);
- $(UDOD).addAttrArray({ "onmouseup": "U.OFD.LJWDS(this,\"" + UDE["UserDirectoryID"] + "\")" });
- UDOD.parentNode.innerHTML += "";
- UDOD = $("div@ITF=" + UDOD.getAttribute("ITF"))[0];
- UDOD = U.OFD.SW(UDOD);
- UDOD.innerHTML = "";
- $$("div", { "className": "U_ONZT", "innerHTML": "这是一个连接文件,连接文档为<span style='color:Blue'>" + UDE["UserallDirectoryName"] + "</span>,点击可打开原地址文件修改", "onmouseup": "if(U.Word.BCWJ()){U.Word.Save();};U.Word.Load(\"" + UDE["UserDirectoryID"] + "\")" }, UDOD);
- UDOD.contentEditable = "false";
- }
- //生成文件级联
- U.Word.WDJL = function (UDE) {
- U.OU.OULJ(U.OU.R, "http://disk.1473.cn/?ID=" + UDE["UserDirectoryID"], UDE);
- }
- //初始化导航
- U.Word.LoadDH = function () {
- }
- //删除导航处理
- U.Word.TYDT = function (UDSO) { //导航id
- U.UI.Confirm("是否删除导航", [U.Word.TSDH, ([UDSO])]);
- }
- //提示导航处理
- U.Word.TSDH = function (UDSO) {
- if ((UDSO.className == "U_ONOTI" || UDSO.className == "U_ONOCC")) {//
- var _UDOD = $("#U_ONOC")[0],
- _UDCD = $("#U_ONOT")[0],
- _GUID = UDSO.getAttribute("ITF"),
- _UDSD = $("@ITF=" + _GUID, _UDOD)[0],
- _UDED = $("@ITF=" + _GUID, _UDCD)[0]; //获取需要删除的元素
- (_UDSD) && (_UDSD.parentNode.removeChild(_UDSD));
- (_UDED) && (_UDED.parentNode.removeChild(_UDED)) //删除菜单对应可读
- }
- else { UDSO.parentNode.removeChild(UDSO); } //不允许删除
- }
- //------------------------------------------------------------------------------辅助函数------------------------------------------------------------------------------
- //Word统一回调
- U.Word.TYHD = function (TF, UV) {
- switch (TF) {
- case "IFD":
- U.Word.SCWZ.apply(this, UV);
- break; //点击Delete触发 主要是处理导航问题
- case "UP":
- U.Word.UP.apply(this, UV);
- break;
- }
- }
- //变化字体和大小
- U.Word.UP = function (UEL) {
- var _UKC = event.keyCode;
- if (UEL == null || ((_UKC > 268 && _UKC < 272) || (_UKC > 0 && _UKC < 5) || (_UKC > 36 && _UKC < 41))) {
- var _UDPD = $("#U_E_AXDZ")[0],
- _UDAD = $("#U_E_AXZZ")[0],
- _UFS,
- _UFF; (UEL == null) && (U.OU.R.CreateR(false), UEL = U.OU.R.Parent());
- _UFS = parseInt(UEL.style.fontSize);
- _UDPD.innerText = _UFS || 14;
- _UFF = UEL.style.fontFamily;
- U.OU.SBH(_UDAD, _UFF || "Calibri");
- }
- }
- //删除文字
- U.Word.SCWZ = function (UDSO) {
- if ((UDSO.className.indexOf("U_ONOTI") > -1 || UDSO.className == "U_ONOCC")) {//清除文字不清除元素
- var _UTI = this.GetGBWZ(UDSO),
- _UETI = event.keyCode;
- if ((_UTI == 0 && _UETI == 8) || (_UTI == UDSO.innerText.length && _UETI == 46)) {
- U.OU.R.CreateR(false);
- U.OU.R.Replace("");
- U.M.StopDefault();
- }
- else if (UDSO.innerText.length == 1 && ((_UTI == 0 && _UETI == 46) || (_UTI == UDSO.innerText.length && _UETI == 8))) {
- UDSO.innerHTML = "";
- U.M.StopDefault();
- }
- }
- else if (UDSO.className == "U_ONO" || UDSO.className == "U_ONOT" || UDSO.className == "U_ONOC") {
- U.M.StopDefault();
- } //防止删除
- }
- //文字大小和文字样式
- U.Word.DXYS = function (UDOD, UDTD, UDE, UDW) {
- var i;
- var _UDSD = event.srcElement;
- if (UDTD != _UDSD) {
- for (i in UDE) {
- UDE[i] = _UDSD.innerText + UDW;
- };
- UDOD.innerText = _UDSD.innerText;
- U.OU.ChangeStyle(UDE);
- U.OU.SDYC();
- }
- }
- //文档视图变化
- U.Word.View = function (UTF) {
- // var _UDOD = $("#UD_SYQXR_Parent"),
- // _UDCD = _UDOD.parentg().Child(),
- // _UWH = UTF == "Word" ? ["210mm", "297mm"] : [document.body.offsetWidth - _UDCD[0].offsetWidth - _UDCD[2].offsetWidth - 60 + "px", document.body.offsetHeight - 52 + "px"];
- // _UDOD.addAttrArray({ "style": { "maxWidth": _UWH[0], "minHeight": _UWH[1]} });
- }
- //获取office模板
- U.Word.GetTemp = function (UTF) {
- var _UDOD = $("#UD_SYQXR")[0];
- if (!_UDOD.innerText.length || _UDOD.innerText == $$("div", { "innerHTML": "​" }).innerText) {
- U.Word.GSTemp(UTF);
- }
- else {
- top.U.UI.Confirm("是否覆盖内容", [U.Word.GSTemp, ([UTF])]);
- }
- }
- //加载模板
- U.Word.GSTemp = function (UTF) {
- U.Alert("模板在加载中");
- var _UIS = "";
- if (UTF == "Word" || UTF == "Web") {
- _UIS = UTF; UTF = UTF == "Word" ? "US_O_Meeting" : "US_O_Website";
- }
- U.MD.IframeLoad($$("iframe", { "width": 0, "height": 0, top: true, "style": { "display": "none" }, "src": "/usercontrols/US_Office/Office_M/html/" + UTF + ".htm?domain=" + document.domain + "&isEmpty=" + _UIS }, document.body), U.Word.AsynGetTemp);
- }
- //获取word
- U.Word.AsynGetTemp = function (UTH) {
- var i,
- _USE,
- _UDOD = $("#UD_SYQXR")[0];
- UTH = U.Ut.isString(UTH) ? UTH : this.contentWindow ? this.contentWindow.document.body.innerHTML : null;
- window.isPrint = false; //回到默认模式
- U.D.Office.Editable = true;
- U.M.loadHtml(_UDOD, UTH); //编辑绑定
- U.Word.View(window.isPrint ? "Word" : "Web"); //加载模板
- // _UDOD.contentEditable = U.D.Office.Editable === false ? "false" : "true"; //设置编辑模式
- }
- //设置是否设为可编辑模式
- U.Word.Edit = function () {
- var _UDOD = $("#UD_SYQXR")[0];
- if (_UDOD) {
- _UDOD.contentEditable = U.D.Office.Editable === false ? "false" : "true";
- }
- }
- document.oncontextmenu = U.M.StopDefault; //禁止右键菜单
- /**
- * word删除页面
- *
- * @param {element} 换页元素
- */
- U.Word.DeletePage = function (UDOD) {
- var _UDPD = $(UDOD).Parent({ "css": "U_Boom_CO_Editor_body_main_m" }),
- _UDTD = $(_UDPD).Child()[0],
- _UDCD = $(_UDTD).Child()[0];
- if (!_UDCD || U.M.EISE(_UDCD, UDOD)) { //判断是否全部删除,或者是第一行里处理
- if (_UDTD.innerText == "" && $(_UDTD).Child().length < 2) { //确定是删除
- $(_UDPD).remove();
- }
- else { //换行到上面一行
- $(_UDPD).prev().focus();
- }
- }
- }
- //#region 邀请成员
- /**
- * 初始化查看团队成员
- *
- * @param {element} 换页元素
- */
- U.Word.DisPlayUser = function (UDE, UDOD) {
- UDOD = UDOD || $("#U_Boom_CO_Editor_body_left_invite_user")[0];
- var HYD = UDOD.children[0];
- UDOD.innerHTML = ""
- $(UDOD).append(HYD);
- if (UDE != "") {
- var UGF = _$(US.Friend[3]).Select({ "GroupManageID": UDE.UserDirectoryEncrypt || UDE.GroupID });
- for (i = 0; i < UGF.length; i++) {
- _UDOD = $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a" }, UDOD);
- _UDTD = $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a_img", "style": { "background": ""} }, _UDOD);
- $$("img", { "src": U.M.GetImgU(UGF[i].UserThumbnailImageHead) }, _UDTD);
- $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a_div", "innerHTML": UGF[i].UserNickName }, _UDOD);
- }
- }
- // U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_A_SelectOfficeUser", UDID, S, E]), U.Word.AsynDisPlayUser, ([null, UDOD]));
- }
- /**
- * 弹出添加成员
- *
- * @param {element} Wrod信息数组
- */
- U.Word.DisplayInsertUser = function () {
- var _UGE = U.Word.TF, //object参数值
- _UID = _UGE["UID"],
- _UFID = _UGE["ID"],
- _UET = _UGE["ET"], //文件实体
- _UQID = _UET.UserDirectoryEncrypt || _UET.GroupID;
- if (_UQID == US.userinfo.UserId) { _UQID = ""; }
- if (_UET && _UET.UserDirectoryID) { //是否为已经新建过的uw文件
- top.U.F.J.ANewQZ(null, { fun: U.M.apply(this, [[top.U.F.J.CXNEWTJ,
- ([_UQID, _UET.UserDirectoryName || _UET.UserFilesName, "由文档" + (_UET.UserDirectoryName || _UET.UserFilesName) + "发起的互联办公群组。", _UFID, U.M.apply(null, [[U.Word.InsertUser, ([_UET])]])])]])
- }); //调用创建群的弹窗函数
- //top.U.F.J.CXNEWTJ, ([[U.Word.InsertUser, ([$("#U_Boom_CO_Editor_body_left_invite_user")[0], _UET]), _UET.UserDirectoryName
- }
- else { //未新建过的文件需要先保存到网盘
- U.Word.Save();
- }
- }
- /**
- * 添加团队成员
- *
- * @param {element} 换页元素
- */
- U.Word.InsertUser = function (UET, GroupID, _FriendUser, groupid, _UGN) {
- //找到硬盘复制粘贴的函数, 先调用复制然后调用粘贴
- //top.U.Dk.RE.WPFZ(UET, "Copy")
- //top.U.Dk.RE.UFStick(GroupID, function () { //粘贴回调
- //}, UET.UserId);
- if (!(UET.UserDirectoryEncrypt && UET.UserId != UET.UserDirectoryEncrypt)) { //如果是新创建的文件,同时文件不在群里 就把文件拷贝到群里进行处理
- /*
-
- //用户id 群id 文件id 群id 判断
- U.A.Request("UseStudioDisk.CopyFile", ([US.userinfo.UserId, GroupID.GroupManageID, UET.UserFilesID || UET.UserDirectoryID, GroupID.GroupManageID, 1]), function (r) {
- //重新打开
- U.D.Office.Word();
- }, ([]));
- */
- U.A.Request("UseStudioDisk.CopyFile", ([US.userinfo.UserId, GroupID.GroupManageID, UET.UserFilesID || UET.UserDirectoryID, GroupID.GroupManageID, 1]), top.U.Dk.RE.AsynUFStick, (["", GroupID.GroupManageID, [UET], [UET], U.M.apply(null, [[U.Word.AsynInsertUser, ([UET, _FriendUser, groupid, _UGN])]]), US.userinfo.UserId, GroupID.GroupManageID, "Copy", UET.UserDirectoryParentID]));
- }
- //把所有添加进来的好友打印在office窗体里
- // U.Word.DisPlayUser(UET)
- /*
- if (UET[1].UserDirectoryEncrypt) { //判断文件是否已经是群文件
- }
- else { //如果不是群文件,把当前uw文件复制到群里
- // var _UME = top.U.Dk.RE, _UCE = top.U.Dk.HP.MLWJSY(UET), _UGE = top.U.Dk.DiskOperatingSwitch(US.userinfo.UserId);
- // U.A.Request("UseStudioDisk.CopyFile", ([US.userinfo.UserId, UGID, UET[1]["UserDirectoryID"], US.userinfo.UserId, (_UCE[2].length ? _UME.UEI[0][0].UserDirectoryDeep : "")]), top.U.Dk.RE.AsynUFStick, (["", UGID, [UET[1]], _UCE[1], null, _UGE[1][2], UGID, "Copy", UGID]));
- }
- */
- }
- /**
- * 异步添加好友
- *
- * @param {element} 换页元素
- */
- U.Word.AsynInsertUser = function (UET, _FriendUser, groupid, _UGN, arr) {
- //弹出窗体
- //console.log(arr);
- top.U.D.Office.Word(US.userinfo, arr[0])
- U.A.Request(US.CD, ([US.DB, "UseStudio_Friends", "UF_D_A_AFMS", US.userinfo.UserId, _FriendUser, US.userinfo.UserNickName || US.userinfo.UserName, '' + groupid + ',' + _UGN + ',' + UET.UserDirectoryModifyTime + ',' + arr[0].UserDirectoryID + ',' + UET.UserDirectoryName + '.UW', 5, false]), U.M.apply(), ([""]));
- /*
- var i, _UDTD,
- context = request.context,
- _UDOD = context[1],
- _UOE = context[2],
- _UDE = context[3],
- _UDFD = $$("frag");
- request = request.value;
- if (request > -1) {
- for (i = 0; UDE.length; i++) {
- _UDTD = $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a" }, _UDFD);
- $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a_img" }, _UDTD);
- $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a_div", "innerHTML": "邀请" }, _UDTD);
- }
- $(UDOD).append(_UDFD);
- U.Alert("添加成功");
- }
- */
- }
- /**
- * 移除office用户
- *
- * @param {element} 换页元素
- */
- U.Word.DelOfficeUser = function (UDOD, UOE, UDE) {
- UDE = U.Ut.isArray(UDE) ? UDE : [UDE];
- var _USID = UDE.GZDL("UserId").Join(",");
- if (_USID) {
- U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_D_DeleteOfficeUser", _USID, UOE.UserFileId, UOE.TemplateId]), U.Word.AsynDelOfficeUser, ([null, UDOD])); //插入协作人员
- }
- }
- /**
- * 移除office用户
- *
- * @param {element} 换页元素
- */
- U.Word.AsynDelOfficeUser = function (request) {
- var context = request.context,
- _UDOD = context[1];
- if (request.value != -1) {
- $(_UDOD).remove();
- U.Alert("成功删除");
- }
- }
- //#endregion
- //#region
- /**
- * 初始化加载模板
- *
- * @param {element} 换页元素
- */
- U.Word.GetHotTemplates = function (UDID, S, E, UDOD) {
- UDOD = UDOD || $("#U_Boom_CO_Editor_body_left_template_hot")[0];
- U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_A_SelectHotTemplate", UDID, S, E]), U.Word.AsynGetHotTemplates, ([null, UDOD]));
- }
- /**
- * 获取热门模板
- *
- * @param {element} 换页元素
- */
- U.Word.AsynGetHotTemplates = function (request) {
- var i, _UDOD,
- _UDFD = $$("frag"),
- context = request.context,
- request = request.value;
- context[1].innerHTML = "";
- for (i = 0; i < request.length; i++) {
- _UDOD = $$("div", { "className": "U_Boom_CO_Editor_body_left_template_user_m", "onclick": [[U.Word.OpenHotTemplates, ([request[i].TemplateId])]] }, _UDFD);
- $$("div", { "className": "U_Boom_CO_Editor_body_left_template_user_m_s", "style": { "background-image": "url(" + request[i].UseFilesServerThumbnailName + ")"} }, _UDOD);
- $$("div", { "className": "U_Boom_CO_Editor_body_left_template_user_m_x", "innerHTML": request[i]["UserFilesName"] }, _UDOD);
- }
- $(context[1]).append(_UDFD);
- }
- /**
- * 点击模板处理
- * @参数:模板分类id
- * @param {element} 换页元素
- */
- U.Word.OpenHotTemplates = function (ArrTD) {
- top.U.Boom.I.GetHomeTemp.particulars(ArrTD);
- }
- //#endregion
- //#region
- /**
- * 插入历史
- *
- * @param {element} 换页元素
- */
- U.Word.InsertOfficeHistory = function (UFID, UID, UTH, UDOD) {
- var UDOD = UDOD || $("#U_Boom_CO_Editor_body_left_invite_history")[0];
- var UHID = Guid.NewGuid();
- U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_A_InsertOfficeHistory", UHID, UID, UTH, UFID]), U.Word.AsynViewEditHistory, ([null, UDOD, UID]));
- }
- /**
- * 查看编辑历史
- *
- * @param {element} 换页元素
- */
- U.Word.ViewEditHistory = function (UID, UDID, UOID, S, E, UDOD) {//创始人id 文件id 空的id 选取开始 选取长度 获取编辑历史的框
- setInterval(function () {
- UDOD = UDOD || $("#U_Boom_CO_Editor_body_left_invite_history")[0];
- U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_A_SelectOfficeHistory", UDID, UOID, S, E]), U.Word.AsynViewEditHistory, ([null, UDOD, UID]));
- }, 1000)
- }
- /**
- * 查看编辑历史异步
- *
- * @param {element} 换页元素
- */
- U.Word.AsynViewEditHistory = function (request) {
- var i, _UDOD, _UDTD, _UDSD, _UDFDC,
- context = request.context,
- _UDE = request.value,
- _UDFD = $(context[1]),
- _UID = context[2];
- _UDFD[0].innerHTML = "";
- if (_UDE.length == 0 && !$("#U_Boom_CO_Editor_History_N")[0]) {
- $$("div", { "innerHTML": "暂无历史", "style": { "text-align": "center", "margin-top": "50px"} }, _UDFD[0]);
- }
- else {
- // $("#U_Boom_CO_Editor_History_N")[0] && $("#U_Boom_CO_Editor_History_N").remove();
- for (i = 0; i < _UDE.length; i++) {
- _UDOD = $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o" }, _UDFD[0]);
- _UDTD = $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_l" }, _UDOD);
- $$("img", { "src": U.M.GetImgU(_UDE[i].UseFilesServerThumbnailName) }, _UDTD);
- _UDTD = $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_r" }, _UDOD);
- _UDSD = $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_r_s" }, _UDTD);
- $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_r_s_l", "innerHTML": _UDE[i].UserNickName || _UDE[i].UserName }, _UDSD);
- $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_r_s_r", "innerHTML": U.MT.getTDInterval(_UDE[i].CreateTime, "String") + "保存更新" }, _UDSD);
- _UDSD = $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_r_x" }, _UDTD);
- (_UDE[i].UserId != _UID) && $$("div", { "innerHTML": "对话", "style": { "margin-right": "10px" }, "onclick": [[]] }, _UDSD);
- $$("div", { "innerHTML": "详情", "onclick": [[U.Word.EditHistory, ([_UDE[i]])]] }, _UDSD);
- }
- if (_UDE.length == 1 && (_UDFDC = _UDFD.Child()).length > 0) { _UDFD.append(_UDFDC[_UDFDC.length - 1], "", _UDFDC[0]); }
- }
- }
- /**
- * 打开历史记录
- *
- * @param {element} 换页元素
- */
- //U.Word.Openhistory = function (UDE) {
- // U.UI.Form({ draw: false, max: false, id: "U_Boom_CO_History", content: "", title: "历史记录", hst: { style: { "padding": "0 0 0 10px"} }, bst: { "style": { overflow: "hidden"}} }); //创建窗体
- // U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "UD_A_SelectHistoryDetails", UDE.HistoryId]), U.Word.AsynOpenhistory, ([]));
- //}
- /**
- * 打开异步
- *
- * @param {element} 换页元素
- */
- //U.Word.AsynOpenhistory = function (request) {
- // var context = request.context,
- // _UDOD = context[0];
- // request = request.value;
- // if (request != -1) {
- // _UDOD.inenrHTML = request.OfficeContent;
- // }
- //}
- //#endregion
- //#region
- /**
- * 查看链接
- *
- * @param {element} 换页元素
- */
- U.Word.Getlink = function (UDID, UDOD) {
- UDOD = UDOD || $("#U_Boom_CO_Editor_body_left_href_pay_a")[0];
- U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_A_SelectHotTemplate", UDID, UOID, US, UE]), U.Word.AsynGetlink, ([null, UDOD]));
- }
- /**
- * 查看链接异步
- *
- * @param {element} 换页元素
- */
- U.Word.AsynGetlink = function (request) {
- var context = request.context;
- request.value;
- if (request) {
- context[1].innerHTML = request;
- }
- }
- U.Word.SetDNS = function () {
- var _UGE = U.Word.TF, //object参数值
- _UFID = _UGE.ID,
- _USID = _UGE.UID,
- _UFNM = _UGE.ET.UserDirectoryName;
- if (_UFID) {
- var _UDOD = $$("div", { "class": "U_Boom_CO_Popup_18" }),
- _UDSBD, _UDNA, _UDRT, _UDYM, _UDSD = $$("div", { "class": "U_Boom_CO_Popup_18_Set" }, _UDOD),
- _UDQCD, _UDUR, _UDQBD, _UDBG, _UDQD = $$("div", { "class": "U_Boom_CO_Popup_18_Que" }, _UDOD);
- //设置
- $$("div", { "class": "U_Boom_CO_Popup_18_Set_Tag", "innerHTML": "目前默认域名 <span>设置个性域名,让好友同事更快记住链接</span>" }, _UDSD),
- _UDNA = $$("div", { "class": "U_Boom_CO_Popup_18_Set_Name", "innerHTML": "等待域名生成" }, _UDSD),
- _UDSBD = $$("div", { "class": "U_Boom_CO_Popup_18_Btn" }, _UDSD),
- //设置成功
- _UDRT = $$("div", { "class": "U_Boom_CO_Popup_18_Que_Right", "style": { "display": "none"} }, _UDQD);
- $$("div", { "class": "U_Boom_CO_Popup_18_Que_Tag", "innerHTML": "设置成功" }, _UDRT);
- _UDUR = $$("input", { "type": "text", "class": "U_Boom_CO_Popup_18_Que_Url" }, _UDRT);
- //二维码
- _UDQCD = $$("div", { "class": "U_Boom_CO_Popup_18_Que_Code", "style": { "display": "none"} }, _UDQD);
- _UDBG = $$("div", { "class": "U_Boom_CO_Popup_18_Que_QR" }, _UDQCD);
- $$("div", { "class": "U_Boom_CO_Popup_18_Que_Con", "innerHTML": "扫一扫 </br> 分享此文档给好友" }, _UDQCD);
- //域名管理中心
- _UDYM = $$("div", { "class": "U_Boom_CO_Popup_18_Set_Yu" }, _UDOD);
- $$("div", { "class": "U_Boom_CO_Popup_18_Set_Yu_Text", "innerHTML": "对域名不满意?可以到" }, _UDYM),
- $$("div", { "class": "U_Boom_CO_Popup_18_Set_Yu_Ming", "innerHTML": "域名管理中心", "onclick": [[U.Word.Yuming]] }, _UDYM),
- _UDQBD = $$("div", { "class": "U_Boom_CO_Popup_18_Btn", "style": { "display": "none"} }, _UDQD);
- $$("div", { "innerHTML": "取消", "onclick": [[U.Word.Close, ([_UDOD])]] }, _UDSBD),
- $$("div", { "innerHTML": "设置", "onclick": [[U.Word.QDSZ, ([_UDRT, _UDSD, _UDUR, _UDNA, _UDQBD])]] }, _UDSBD),
- $$("div", { "innerHTML": "取消", "onclick": [[U.Word.Close, ([_UDOD])]] }, _UDQBD);
- $$("div", { "innerHTML": "生成二维码", "onclick": [[U.Word.CodeSet, ([_UDUR, _UDBG, _UDQCD])]] }, _UDQBD);
- $$("div", { "innerHTML": "复制链接分享", "onclick": [[U.Word.CopySet, ([_UDUR])]] }, _UDQBD);
- top.U.UI.From({ min: false, max: false, id: "U_Boom_CO_Popup_18", style: { "width": "580px", "height": "auto" }, content: _UDOD, title: "提示", hst: {}, bst: {} });
- U.Word.eaDomain(_UFID, _UDNA, _UDRT, _UDSD, _UDUR, _UDNA, _UDYM, _UDQBD, _USID, _UFNM);
- } else {
- U.Word.Save();
- }
- }
- /*
- * @作用:确定申请域名
- * @参数一:文件ID
- * @参数二:域名生成内容
- * @参数三:设置成功内容
- * @参数四:设置的总体盒子
- * @参数五:域名内容
- * @参数六:域名生成内容
- * @参数七:域名管理中心
- * @参数七:复制二维码按钮
- * @参数八:用户ID
- * @参数九:文件名
- */
- U.Word.eaDomain = function (UDID, UDOD, _UDRT, _UDSD, _UDUR, _UDNA, _UDYM, _UDQBD, _USID, _UFNM) {
- var fid = UDID; //获取文件ID
- var fname = _UFNM; //获取文件名
- var UserID = _USID; //获取用户ID
- var d = new Date(); //获取当前系统时间
- d.setMonth(d.getMonth() + 1); //月数+1
- var yy1 = d.getFullYear(); //获取年份
- var mm1 = d.getMonth() + 1; //因为getMonth()返回值是 0(一月) 到 11(十二月) 之间的一个整数。所以要给其加1
- var dd1 = d.getDate(); //获取哪一天
- if (mm1 < 10) {
- mm1 = '0' + mm1;
- }
- if (dd1 < 10) {
- dd1 = '0' + dd1;
- }
- var ExTime = yy1 + '-' + mm1 + '-' + dd1; //时间组合 年-月-日
- _UDUR.value = Math.ceil(Math.random() * 1000) + ".boomyun.com"; //域名生成规则
- //fid:文件id
- //查询数据库,域名表是否有这个文件,查看该文件是否存在域名
- U.A.Request("http://cd.1473.cn/php", (["db.1473.cn", "UseStudio_DNS", 'GetDnsInfoByFileId', fid]), function (r) {
- if (r.value.length == 0) {
- //fid:文件id fname:文件名 .com:域名类型 ExTime:到期时间 0:类别 _UDUR.value:域名内容 UserID:用户ID 1:是否需要跳转页面展示内容
- //插入域名到数据库
- U.A.Request("http://cd.1473.cn/php", (["db.1473.cn", "UseStudio_DNS", 'DNS_InsertDnsInformation', fid, fname, '.' + 'com', ExTime, '0', _UDUR.value, UserID, "1"]), function (r) {
- //fid:文件ID
- //查询域名是否存在
- U.A.Request("http://cd.1473.cn/php", (["db.1473.cn", "UseStudio_DNS", 'GetDnsInfoByFileId', fid]), function (r) {
- _UDNA.innerHTML = r.value[0].Domain; //显示域名至HTML页面
- });
- });
- } else {
- _UDRT.style.display = "block"; //设置成功的页面显示
- _UDSD.style.display = "none"; //点击设置页面隐藏
- _UDQBD.style.display = "block"; //复制生成等按钮显示
- _UDYM.style.display = "block"; //域名管理中心显示
- _UDUR.value = r.value[0].Domain; //获取域名生成内容
- }
- });
- }
- //域名生成二维码
- U.Word.CodeSet = function (_UDUR, _UDBG, _UDQCD) {
- //长 - 宽 - 二维码颜色 - 背景颜色 - 输入的文字或者URL - 生成到的地方
- top.U.QR.Code.generate("180", "180", "black", "white", $(_UDUR)[0].value, $(_UDBG)[0]);
- _UDQCD.style.display = "block"; //二维码显示
- }
- //域名复制链接分享
- /*U.Word.CopySet = function (_UDUR) {
- // $(_UDUR)[0].select();
- //_UDUR.select();
- top.$(".U_Boom_CO_Popup_18_Que_Url")[0].select();
- return document.execCommand('copy');
- U.Alert("复制成功");
- }*/
- //申请域名异步
- /*U.Word.AsyneaDomain = function (request) {
- var context = request.context, _UDID = context[1], _UDOD = context[2]; request = request.value;
- if (request[0]) {
- $(_UDOD).addAttrArray({ "innerHTML": "http://" + request[0].UserDomain + ".boomyun.com", style: { cursor: "pointer" }, title: "点击跳转", "onclick": U.M.apply(null, "window.open('" + "http://" + request[0].UserDomain + ".boomyun.com" + "')") });
- }
- else { U.Alert("你建站超过指定次数请您重新建立。"); }
- }*/
- /**
- * 确定设置按钮
- *
- * @param {element} 换页元素
- * @参数一:设置成功内容
- * @参数二:设置的总体盒子
- * @参数三:域名内容
- * @参数四:域名生成内容
- * @参数五:复制二维码按钮
- */
- U.Word.QDSZ = function (_UDRT, _UDSD, _UDUR, _UDNA, _UDQBD) {
- _UDRT.style.display = "block";
- _UDSD.style.display = "none";
- _UDQBD.style.display = "block";
- _UDUR.innerHTML = _UDNA.innerHTML; //显示域名内容
- }
- /**
- * 创建链接分享
- *
- * @param {element} 换页元素
- */
- U.Word.Createlink = function (UDE, UDOD) {
- U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "UD_I_AddDns", UDE.UserFileId, US.userinfo.UserId, 1]), U.Word.AsynCreatelink, ([null, UDOD]));
- }
- /**
- * 创建链接分享
- *
- * @param {element} 换页元素
- */
- U.Word.AsynCreatelink = function (request) {
- var context = request.context;
- request.value;
- if (request) {
- context[1].innerHTML = request.UserDomain + ".1473.cn";
- }
- }
- /**
- * 关闭弹窗
- *
- * @param {element} 换页元素
- */
- U.Word.Close = function (UDOD) {
- $(UDOD)[0].parentElement.parentElement.parentElement.style.display = "none";
- }
- //点击弹出域名管理系统
- U.Word.Yuming = function () {
- if (!top.$("#U_Boom_Y_B_Manage_Pop")[0]) {
- top.U.Yuming.MC.StateBox(U.Word.TF["ET"].UserallDirectoryName);
- top.U.D.SetDTop(top.$("#U_Boom_Y_B_Manage_Pop")[0]);
- } else {
- top.$("#U_Boom_Y_B_Manage_Pop")[0].style.display = "block";
- top.U.D.SetDTop(top.$("#U_Boom_Y_B_Manage_Pop")[0]);
- }
- }
- //#endregion
- /**
- * 创建标签
- *
- * @param {element} 换页元素
- */
- //U.Word.CreateLabel = function (UDOD) {
- // var _UDTD = $$("div", { "className": "U_Boom_CO_Editor_head_file_bj" });
- // $$("div", { "className": "U_Boom_CO_Editor_head_file_web" }, _UDTD);
- // $$("div", { "className": "U_Boom_CO_Editor_head_file_x", "title": "关闭" }, _UDTD);
- // UDOD.appendChild(_UDTD);
- //}
- /**
- * 隐藏工具
- *
- * @param {element} 换页元素
- */
- U.Word.CloseRight = function (UDOD, UTF) {
- var i, _UTF = "none",
- _UDPD = $(UDOD).parentg(2),
- _UDAD = _UDPD.parentg().Child();
- _UDPD.css("display", "none");
- for (i = 0; i < _UDAD.length; i++) {
- if (_UDAD[i].style.display != "none") {
- _UTF = "block";
- }
- }
- _UDPD.parentg().css("display", _UTF);
- }
- /**
- * 更多的选择
- *
- */
- U.Word.More = function () {
- var _UDMD, _UDFD, _UDOD = $$("div", {});
- _UDMD = $$("div", { "class": "U_Boom_CO_Popup_17_Main" }, _UDOD);
- $$("div", { "class": "U_Boom_CO_Popup_17_Main_Icon" }, _UDMD)
- $$("span", { "innerHTML": "下载" }, _UDMD);
- _UDFD = $$("div", { "class": "U_Boom_CO_Popup_17_Main" }, _UDOD);
- $$("div", { "class": "U_Boom_CO_Popup_17_Main_Icon", "style": { "background-position": "-44px -81px"} }, _UDFD)
- $$("span", { "innerHTML": "意见反馈" }, _UDFD);
- U.UI.From({ min: false, max: false, id: "U_Boom_CO_Popup_17", style: { "width": "280px", "height": "auto" }, content: _UDOD, title: "更多", hst: {}, bst: {} });
- }
- /**
- * 插入表格
- *
- * @param {element} 换页元素
- */
- U.Word.InsertTable = function () {
- var _UDTD, _UDSD, _UDKD, _UDMB
- _UDOD = $$("div", { "class": "U_Boom_CO_Popup_16" });
- _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16_main" }, _UDOD);
- for (var i = 0; i < 7; i++) {
- for (var j = 0; j < 8; j++) {
- var a = $$("div", { "class": "U_Boom_CO_Popup_16_block", "style": { "top": i * 25 + 'px', "left": j * 26 + 'px'} }, _UDMB);
- a.x = j;
- a.y = i;
- a.onmouseover = function () {
- U.Word.SelectTable(this.x, this.y)
- }
- a.onmousedown = function () {
- U.Word.AsynInsertTable(this.x + 1, this.y + 1)
- }
- }
- }
- $$("div", { "innerHTML": "直接插入", "style": { "position": "absolute", "top": "180px"} }, _UDMB).onclick = function () {
- $(".U_Boom_CO_Popup_16_main")[0].style.display = 'none';
- $(".U_Boom_CO_Popup_16_main")[1].style.display = 'block';
- };
- _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16_main", "style": { "display": "none"} }, _UDOD);
- $$("div", { "class": "U_Boom_CO_Popup_16_title", "innerHTML": "表格尺寸" }, _UDMB);
- _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
- _UDKD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
- $$("span", { "innerHTML": "列数:" }, _UDTD);
- var _h = $$("input", { "id": "U_w_table_line" }, _UDTD);
- $$("span", { "innerHTML": "行数:" }, _UDKD);
- var _l = $$("input", { "id": "U_w_table_column" }, _UDKD);
- $$("div", { "innerHTML": "表格宽度", "class": "U_Boom_CO_Popup_16_title" }, _UDMB);
- _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
- _UDSD = $$("span", { "innerHTML": "宽度" }, _UDTD);
- $$("span", { "innerHTML": "mm", "style": { "float": "right", "text-indent": "5px"} }, _UDTD);
- $$("input", { "id": "U_w_table_width", "value": "1", "style": { "width": "50px"} }, _UDTD);
- U.UI.Confirm("插入表格", { "width": "230px", "height": "auto" }, null, [U.Word.AsynInsertTable, ([_h, _l])], _UDOD);
- }
- /*表格选择插入样式*/
- U.Word.SelectTable = function (x, y) {
- var xx = (x % 7) + 1;
- var yy = (y % 9) + 1;
- var a = $(".U_Boom_CO_Popup_16_block");
- for (var i = 0; i < a.length; i++) {
- a[i].style.borderColor = '#9e9e9e';
- }
- for (var i = 0; i < yy; i++) {
- for (var j = 0; j < xx; j++) {
- a[j + 8 * i].style.borderColor = '#38f';
- }
- }
- }
- /**
- * 插入表格
- *
- * @param {element} 换页元素
- */
- U.Word.KeyFlage = null;
- U.Word.MouseMenu = $("#UD_SYQER")[0];
- U.Word.AsynInsertTable = function (x, y, node) {
- var container;
- if (!x && !y) {
- U.Alert('请输入数据')
- } else {
- if (typeof x == 'object' || typeof y == 'object') {
- x = x.value;
- y = y.value;
- }
- }
- if (!node) {
- node = $(".U_Boom_CO_Editor_body_main_text")[0]
- container = $$("table", { "border": "0", "class": "U_Boom_Table", "cellpadding": "0", "cellspacing": "0" }, node);
- } else {
- container = node;
- }
- container = $$("tbody", {}, container);
- container.onkeydown = function (e) {
- if (e.ctrlKey) {
- U.Word.KeyFlage = true;
- }
- };
- container.onkeyup = function () {
- U.Word.KeyFlage = null;
- };
- for (var i = 0; i < y; i++) {
- var a = $$("tr", { "class": "U_Boom_Table_Line" }, container);
- for (var j = 0; j < x; j++) {
- var b = $$("td", { "class": "U_Boom_Table_Column" }, a);
- b.onmousedown = function (e) {
- if (e.button == 2) {
- U.M.RLocate(U.Word.MouseMenu);
- } else {
- U.Word.MouseMenu.removeAttribute('style');
- }
- U.Word.EditTable(this, e);
- };
- b.h = j;
- b.l = i;
- }
- }
- if ($("#U_COF")[0]) {
- $("#U_COF")[0].style.display = 'none';
- }
- };
- /**
- * 调整拖拽表格
- *
- * @param {element} 换页元素
- */
- U.Word.ResizeTable = function (control, e) {
- e.stopPropagation();
- e.preventDefault();
- var startX, container = control.parentNode;
- var ThisTable = container.parentNode.parentNode.parentNode, count,
- offsetX = container.offsetLeft - ThisTable.getBoundingClientRect().left;
- offsetY = container.offsetHeight - ThisTable.getBoundingClientRect().top;
- startX = e.pageX - ThisTable.getBoundingClientRect().left;
- document.onmousemove = function (e) {
- var ThisLine = container.parentNode;
- var TabelLine = ThisTable.getElementsByClassName("U_Boom_Table_Content");
- var TablePreparColumn = [],
- TableElseColumn = [];
- for (var i = 0; i < ThisLine.childNodes.length; i++) {
- if (ThisLine.childNodes[i] == container) {
- count = i;
- }
- }
- for (var i = 0; i < TabelLine.length; i++) {
- for (var k = 0; k < TabelLine[i].childNodes.length; k++) {
- if (k == count) {
- TablePreparColumn.push(TabelLine[i].childNodes[k]);
- }
- if (k > count) {
- TableElseColumn.push(TabelLine[i].childNodes[k]);
- }
- }
- }
- var endX = e.pageX - ThisTable.getBoundingClientRect().left - offsetX;
- var cutX = (endX - startX) / (TableElseColumn.length / TabelLine.length);
- for (var j = 0; j < TablePreparColumn.length; j++) {
- TablePreparColumn[j].style.width = endX + 'px';
- }
- for (var l = 0; l < TableElseColumn.length; l++) {
- if (cutX > 0) {
- TableElseColumn[l].style.width = TableElseColumn[l].offsetWidth - cutX + 'px';
- } else {
- TableElseColumn[l].style.width = TableElseColumn[l].offsetWidth + Math.abs(cutX) + 'px';
- }
- TableElseColumn[l].style.background = "yellow";
- }
- startX = e.pageX - ThisTable.getBoundingClientRect().left;
- TablePreparColumn = [];
- TableElseColumn = [];
- };
- document.onmouseup = function () {
- document.onmousemove = null;
- document.onmouseup = null;
- }
- };
- /**
- * 编辑表格
- *
- * @param {element} 换页元素
- */
- U.Word.EditTable = function (this_column, e) {
- e.stopPropagation();
- var Editors = $(".U_Boom_CO_Editor_body_main_text"); //编辑器
- var Column = $(".U_Boom_Table_Column");
- if (U.Word.KeyFlage) {
- this_column.state = true;
- this_column.setAttribute("contenteditable", true);
- this_column.style.border = "1px solid #38f";
- } else {
- for (var i = 0; i < Column.length; i++) {
- Column[i].state = false;
- Column[i].onkeydown = null;
- Column[i].setAttribute("contenteditable", false);
- Column[i].style.border = "1px solid #ccc";
- }
- }
- this_column.state = true;
- this_column.setAttribute("contenteditable", true);
- this_column.style.border = "1px solid #38f";
- for (var j = 0; j < Editors.length; j++) {
- Editors[j].setAttribute("contenteditable", false);
- Editors[j].onmousedown = function () {
- this.setAttribute("contenteditable", true);
- Array.prototype.forEach.call(this.getElementsByTagName('*'), function (elm) {
- elm.setAttribute("contenteditable", false);
- });
- }
- }
- };
- /**
- * 合并、拆分单元格
- *
- * @param {element} 换页元素
- */
- U.Word.ColumnControl = function (fx) {
- var column = $(".U_Boom_Table_Column");
- var selectColumn = [];
- var OperateColumn = [];
- for (var i = 0; i < column.length; i++) {
- if (column[i].state) {
- selectColumn.push(column[i])
- }
- }
- if (fx == 'split') {
- if (selectColumn.length > 1) {
- U.Alert('请选择一个单元格');
- Array.prototype.forEach.call(column, function (elm) {
- elm.removeAttribute('style');
- });
- } else {
- var _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16", "style": { "height": "110px"} });
- var UDHD = $$("div", { "class": "U_Boom_CO_Popup_16_main" }, _UDMB);
- $$("div", { "class": "U_Boom_CO_Popup_16_title", "innerHTML": "拆分大小" }, UDHD);
- var _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
- var _UDKD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
- $$("span", { "innerHTML": "列数:" }, _UDTD);
- var _l = $$("input", { "id": "U_w_table_line", "value": "2" }, _UDTD);
- $$("span", { "innerHTML": "行数:" }, _UDKD);
- var _h = $$("input", { "id": "U_w_table_column", "value": "2" }, _UDKD);
- var _CUM = new U.UI.Confirm("拆分单元格", { "width": "350px", "text-align": "center" }, null, U.M.apply(null, [[U.Word.AsynInsertTable, ([_h, _l, selectColumn[0]])]]), _UDMB); //创建对话框
- }
- } else {
- U.Alert('暂无法使用');
- U.Word.KeyFlage = null;
- U.Word.MouseMenu.removeAttribute('style');
- return false;
- /////以后删除
- var x = selectColumn[0].h, y = selectColumn[0].l;
- var width = 0, content = '';
- for (var i = 0; i < selectColumn.length; i++) {
- if (selectColumn[i].h == y) {///找出一行中被选中的
- OperateColumn.push(selectColumn[i]);
- x = selectColumn[i].l, y = selectColumn[i].h;
- }
- }
- for (var j = 1; j < OperateColumn.length; j++) {
- width = OperateColumn[j].parentNode.offsetWidth + width;
- content = OperateColumn[j].innerHTML + content;
- OperateColumn[j].parentNode.remove();
- }
- OperateColumn[0].parentNode.style.width = OperateColumn[0].offsetWidth + width + 'px';
- OperateColumn[0].innerHTML += content;
- }
- U.Word.KeyFlage = null;
- U.Word.MouseMenu.removeAttribute('style');
- };
- /**
- * 插入目录
- *
- * @param {element} 换页元素
- */
- U.Word.InserDirectory = function () {
- // var i, _UDOCD, _UDOD = $$("div", { "class": "U_Boom_CO_Popup_15" });
- // for (i = 0; i < 3; i++) {
- // _UDOCD = $$("div", { "class": "U_Boom_CO_Popup_15_Cat" }, _UDOD);
- // $$("div", { "class": "U_Boom_CO_Popup_15_Cat_Name", "innerHTML": "标题" + (i + 1), "style": { "margin-left": (i * 15) + "px"} }, _UDOCD);
- // $$("div", { "class": "U_Boom_CO_Popup_15_Dash" }, _UDOCD);
- // $$("div", { "class": "U_Boom_CO_Popup_15_Cat_Num", "innerHTML": "1" }, _UDOCD);
- // }
- // _UDOCD = $$("div", { "class": "U_Boom_O_Novel_Cat" }, _UDOD);
- // U.UI.Confirm("自动生成目录", { "width": "330px", "height": "auto" }, null, [U.Word.AsynInserDirectory, ([_UDOD])], _UDOD);
- }
- /**
- * 插入目录
- *
- * @param {element} 换页元素
- */
- U.Word.AsynInserDirectory = function () {
- }
- //#endregion
- //#region 纸张大小
- /**
- * 修改纸张大小弹出
- *
- */
- U.Word.PaperSize = function (UDOD) {
- var i, _UDPD,
- _ClassName = [],
- _UDTD = $("#UD_SYQXR"),
- _UDOD = $$("div", { "class": "U_Boom_CO_Popup_14" }),
- _PaperSize = [
- { "name": "A3", "class": "U_Boom_CO_PaperA3", "size": "29.7厘米 × 42厘米" },
- { "name": "A4", "class": "U_Boom_CO_PaperA4", "size": "21厘米 × 29.7厘米" },
- { "name": "A5", "class": "U_Boom_CO_PaperA5", "size": "14.8厘米 × 21厘米" },
- { "name": "Web", "class": "U_Boom_CO_PaperWeb", "size": "占满屏幕" }
- ];
- $$("div", { "innerHTML": "选择纸张大小", "class": "U_Boom_CO_Popup_14_Title" }, _UDOD);
- for (i = 0; i < _PaperSize.length; i++) {
- _UDPD = $$("div", { "class": "U_Boom_CO_Popup_14_Main", "onclick": [[U.Word.AsynPaperSize, ([_PaperSize[i]["class"]])]] }, _UDOD);
- $$("div", { "innerHTML": _PaperSize[i].name, "class": "U_Boom_CO_Popup_14_Main_Name" }, _UDPD);
- $$("div", { "innerHTML": _PaperSize[i].size }, _UDPD)
- }
- for (i = 0; i < 2; i++) {
- _ClassName.push(_UDTD[0].className);
- _UDTD = _UDTD.childg(0)[0];
- }
- top.U.UI.Confirm("纸张大小", { "width": "330px", "height": "auto" }, [U.Word.AsynPaperSize, ([_UDOD])], [U.Word.CancelPaperSize, ([_ClassName])], _UDOD);
- }
- /**
- * 纸张大小恢复
- *
- */
- U.Word.SetPaperSize = function (ClassName) {
- var i, _UDTD = $("#UD_SYQXR");
- var _user = $("#U_Boom_CO_Editor_body_left")[0].childNodes[1]; //获取邀请协作人员窗体
- var _history = $("#U_Boom_CO_Editor_body_left")[0].childNodes[2]; //获取编辑历史窗体
- var _pay = $("#U_Boom_CO_Editor_body_left")[0].childNodes[3]; //获取生产链接窗体
- var _hot = $("#U_Boom_CO_Editor_body_left")[0].childNodes[4]; //获取热门模板窗体
- for (i = 0; i < ClassName.length; i++) {
- _UDTD[0].className = ClassName[i];
- _user.style.left = _history.style.left = _pay.style.left = _hot.style.left = _UDTD[0].clientWidth + 88 + "px";
- _UDTD = _UDTD.childg(0)[1];
- }
- }
- /**
- * 确定纸张大小恢复
- *
- */
- U.Word.AsynPaperSize = function (className) {
- U.Word.SetPaperSize(["U_Boom_CO_Editor_body_main " + className, "U_Boom_CO_Editor_body_main_text " + className + "C"]);
- $([$("#U_Boom_CO_Editor_body_left")[0], $("#U_Boom_CO_Editor_body_right")[0]]).css("display", className == "U_Boom_CO_PaperWeb" ? "none" : "block");
- }
- //#endregion
- //#region 编辑处理
- /**
- * 键盘输入默认处理类
- *
- 传参规范
- str 字符串类型
- obj 对象类型
- num 数字类型
- arr 数组类型
- cb 回调函数
- 布尔类型
- */
- U.Word.Keyboard = function (UTF, UDE, UTE, UT, UWE) {
- var i, _UTH, _UWH, _UDTD, _UDAD, _UDPD, _UDND, _UDFD;
- if (UTF == "UP") {
- // U.M.StopDefault();
- // _UDTD = UTE.PSO;
- // _UDAD = $(_UDTD).Child();
- // if (_UDAD.length < 1) {
- // UTE.Replace("<div><br /></div>");
- // // U.OU.WordFocus(_UDTD, "<div><br /></div>", U.Word.Keyboard); //初始化焦点使用
- // }
- }
- else if (UTF == "Cut") { //剪切处理
- }
- else if (UTF == "Copy") {
- }
- else if (UTF == "Paste") { //粘贴处理
- // _UTH = U.M.UrlPaste();
- // if (_UTH != "") {
- // U.M.StopDefault();
- // _UDTD = $("#U_Boom_Ed")[0];
- // _UDTD.innerHTML = _UTH;
- // }
- // if (UTE.CTH) {
- // U.M.StopDefault();
- // UTE.Replace(this.CTH);
- // }
- }
- //这里必须是word编辑模式下处理,在互联办公啊,云企建站等等就不做任何有关的处理
- else {
- switch (UTF) {
- case "Backspace": //后退处理
- _UDTD = UTE.PSO;
- _UDAD = $(_UDTD).Child();
- if ((_UDAD.length < 1 || (_UDAD.length == 1 && _UDAD[0].innerText.replace(/\u200b/g, "").length < 2)) || UTE.GetSelectedText() == _UDTD.innerText) {
- U.M.StopDefault();
- this.CreateR(); //重新记录光标
- _UDPD = UTE.Parent(null, true);
- if (!U.Word.delPage(_UDTD, UTE)) {
- UTE.moveRange();
- UTE.Replace("<br />");
- UTE.QX(1, 1, _UDPD);
- }
- }
- break;
- case "Delete": //delte处理
- break;
- case "save": //保存处理
- U.M.StopDefault();
- U.Word.Save();
- break;
- case "replace":
- alert();
- break;
- case "copy": //复制处理
- break;
- case "paste": //粘贴处理
- break;
- case "selectAll": //全选处理
- break;
- case "redo": //前进
- break;
- case "undo": //后退
- break;
- default:
- if (!(UT[1] || UT[2]) && !(UT[0] == 8 || UT[0] == 3 || UT[0] == 46 || (UT[0] > 63231 && UT[0] < 63236) || (UT[0] > 63272 && UT[0] < 63278 && UT[0] != 63274))) { //特殊键处理
- this.CreateR(); //重新记录光标
- _UDPD = $(UTE.Parent(null, true)).Parent({ "tagName": "DIV" }); //获取当前行的元素
- _UTH = UTE.getBoundingClientRect(); //获取光标位置和大小
- //回车、键盘向下处理
- if ((_UDPD.offsetTop + (_UDPD.offsetHeight * 2) - UTE.PSO.offsetTop) > UTE.PSO.offsetHeight && ((UTF == "Down" || UTF == "Enter" || (UTF == "Right" && UTE.GetGBWZ() >= _UDPD.innerText.length)) || (_UTH.right - _UDPD.offsetLeft - 20 >= UTE.PSO.offsetWidth))) {
- U.M.StopDefault();
- U.Word.Page($(UTE.PSO).Parent());
- }
- else if ((_UDPD.offsetTop + (_UDPD.offsetHeight * 2) - UTE.PSO.offsetTop) > UTE.PSO.offsetHeight && UTF == "Delete") {
- }
- //向上向左处理
- else if (_UDPD.offsetTop - UTE.PSO.offsetTop < 50 && (UTF == "Up" || (UTF == "Left" && _UTH.right < 70))) {
- U.M.StopDefault();
- U.Word.Page($(UTE.PSO).Parent(), UTF);
- }
- //移动到最后准备输入后,判断是否已经需要换页
- else if ((_UTH.right - _UDPD.offsetLeft - 20) >= UTE.PSO.offsetWidth || UTF == "Enter") {
- // U.M.StopDefault(); //取消浏览器默认行为
- // _UDND = $(_UDPD).next(); //获取当前输入行的下级元素
- // //自动添加回车符号
- // UTE.Replace("<div><br /></div>", null, true);
- //换页处理
- U.Word.Wrap(UTE.PSO, _UDPD);
- }
- // //输入的内容判断处理
- // else if (_UWH["OW"] >= 780) {
- // // _UDND = $(_UDPD).next();
- // // _UDFD = $$("frag");
- // // if (!_UDND) {
- // // _UDND = $$("div");
- // // }
- // // for (i = _UDND.innerHTML.length; i >= 0; i++) {
- // // _UDFD.textContent += _UDND.innerHTML.substring(_UDND.innerHTML.length - 1, _UDND.innerHTML.length);
- // // if (_UDND.offsetWidth <= 780) {
- // // break;
- // // }
- // // }
- // }
- // // _UDND = $(_UDPD).next();
- // // for (i = 0; i < _UDAD.length; i++) {
- // // }
- }
- break;
- }
- }
- //自动生成换行处理
- //U.Word.Wrap(UTE.PSO);
- }
- /**
- * word自动换行
- *
- * @param {element} 换页元素
- */
- U.Word.Wrap = function (UDPD, UDSD) {
- //变量定义
- var i, j, k, _UWH, _UDMD, _UDCD,
- _str = "", //需要换行的文字
- _ptop = UDPD.offsetTop,
- _pheight = UDPD.offsetHeight,
- _height = UDSD.offsetHeight,
- _UDAD = $(UDPD).Child();
- //循环判断元素是否超出位置
- for (i = 0; i < _UDAD.length; i++) {
- _UWH = U.M.GetElementInfo(_UDAD[i]);
- if ((_UWH["OH"] + _UWH["OT"]) - UDPD.offsetTop + _height > UDPD.offsetHeight) {
- _UDMD = U.Word.Page($(UDPD).Parent(), null, null, true); //换页到下级元素
- _UDMD.appendChild(_UDAD[i], _UDMD.firstChild); //插入到最前面
- /*
- _UDCD = $(_UDAD[i].children);
- if (_UDCD.length) { //如果有子元素处理子元素方式
- for (k = _UDCD.length - 1; k >= 0; k--) {
- if (_UDAD[i].children[k].tagName == "DIV") { //div的处理方式
- _UDMD.appendChild(_UDAD[i].children[k], _UDMD.firstChild);
- }
- else if (_UDAD[i].innerText) { //span 等处理方式
- // _str = $$(_UDAD[i].tagName, { className: _UDAD[i].className, "style": { "cssText": _UDAD[i].style.cssText} });
- // for (j = _UDAD[i].innerText.length; i >= 0; j++) {
- // _str.innerText += _UDAD[i].innerText.substring(j, 1)
- // }
- }
- else { //#text 处理方式
- _UDAD[i].textContent;
- }
- }
- }
- else { //直接处理整行
- _UDMD.appendChild(_UDAD[i], _UDMD.firstChild);
- }
- */
- }
- }
- /*
- //变量定义
- var i, j, k, _UWH, _UST, //下面使用到的变量
- _UDTD = $("#U_Boom_Ed")[0], //编辑大小使用元素
- _UDAD = $("div", UDPD); //所有的元素
- //循环查看
- for (i = 0; i < _UDAD.length; i++) {
- _UDTD.innerHTML = "";
- _UDTD = $$("span", { "innerHTML": _UDAD[i].innerHTML }, _UDTD);
- for (k = _UDAD[i].children.length - 1; (U.M.GetElementInfo(_UDAD[i]).OW >= 750 && k >= 0); k--) {
- if (_UDAD[i].children[k].innerText) {
- for (j = 0; j < _UDAD[i].children[k].innerText.length; j++) {
- _UDAD[i].children[k].innerText = "";
- }
- }
- else if (_UDAD[i].children[k].textContent) {
- }
- }
- }
- */
- }
- /**
- * word换页
- *
- * @param {element} 包含头部,尾部和编辑区域的元素
- * @param {bool} 向上或者向下翻页pagedown
- * @param {string} 是否追加元素,插入光标时还需要插入什么元素,
- * @param {bool} 换页是否不聚焦,b如果为true,则聚焦,否则,不聚焦
- */
- U.Word.Page = function (currentpage, pagedown, str, b) {
- //UDOD 包含头部,尾部和编辑区域的元素和_pagediv结构上一模一样。区别在_pagediv可能是下一页,可能是上一页。
- var _pagediv; // 由于是多页,所以需要另外建立一个div,包含下面的头部,内容,底部,和currentpage结构上一样,上一页和下一页的区别。
- var _header; //头部
- var _editor; //编辑区域,没有头部和尾部,这个是返回值。
- var _cursor; //需要插入的光标。
- var _footer; //尾部
- _wordeditor = $(currentpage).Parent(); //生成新页面追加到最大编辑器,所以要找父亲元素
- //向上翻页
- if (pagedown) {
- _pagediv = $(currentpage).prev()[0]; //查找上一个元素
- _editor = $(_pagediv).Child()[1]; //得到编辑元素
- //换页是否插入光标
- if (b !== true) {
- _cursor = U.OU.WordFocus(_editor, false, U.Word.Keyboard); //初始化焦点使用,只是聚焦作用,还没插入光标
- }
- }
- //向下翻页
- else {
- _pagediv = $(currentpage).next()[0]; //查找下一个元素
- //如果不存在下一页,则创建新页
- if (!_pagediv) {
- //
- _pagediv = $$("div", { "className": "U_Boom_CO_Editor_body_main_m" }, _wordeditor); //由于是多页,所以需要另外建立一个div,包含下面的头部,内容,底部
- _header = $$("div", { "className": "U_Boom_CO_Editor_body_main_border" }, _pagediv); //头部信息
- $$("div", { "className": "U_Boom_CO_Editor_body_main_bordero" }, _header); //头部的左上角
- $$("div", { "className": "U_Boom_CO_Editor_body_main_bordert" }, _header); //头部的右上角
- _editor = $$("div", { "className": "U_Boom_CO_Editor_body_main_text", contentEditable: "true", spellcheck: "false", "innerHTML": "", "id": "Txt" + Guid.NewGuid() }, _pagediv); //编辑器区域
- _footer = $$("div", { "className": "U_Boom_CO_Editor_body_main_border" }, _pagediv);
- $$("div", { "className": "U_Boom_CO_Editor_body_main_borders" }, _footer);
- $$("div", { "className": "U_Boom_CO_Editor_body_main_borderf" }, _footer);
- //换页是否插入光标
- if (b !== true) {
- _cursor = U.OU.WordFocus(_editor, str || "<div><br /></div>", U.Word.Keyboard); //初始化焦点使用
- }
- else { //添加不换行处理
- _editor.innerHTML = str || "<div><br /></div>";
- }
- }
- }
- //真正的插入光标
- _editor = $(_editor).Child(); //得到"<div><br /></div>";
- var _line = pagedown ? _editor.length - 1 : 0;//向上翻聚焦到最后一行,向下翻聚焦到第一页
- _editor = _editor[_line]; //获得插入光标位置
- if (b !== true) {
- _cursor.QX(1, 1, _editor);//插入光标
- }
- return _editor;
- }
- /**
- * 移除页面
- *
- * @param {element} 换页元素
- */
- U.Word.delPage = function (UDOD, UTE) {
- var _UDPD = $(UDOD).Parent();
- _UDSD = $(_UDPD).prev()[0];
- if (_UDSD) {
- $(_UDPD).remove();
- _UDMD = $(_UDSD).Child()[1];
- _UDMD = $(_UDMD).Child() || $(_UDMD);
- _UDMD = _UDMD[_UDMD.length - 1];
- _UDMD.focus();
- if (UTE != null) {
- UTE.QX(1, 1, _UDMD); //初始化焦点使用
- UTE.CreateR(false);
- }
- return true;
- }
- return false;
- }
- //#endregion
- //#region 其他功能
- document.oncontextmenu = U.M.StopDefault; //禁止右键菜单
- //新建Word文件
- U.Word.NWWJ = function () {
- top.U.D.Office.Word(top.US.userinfo, null);
- }
- //文件下载成指定的格式
- U.Word.XZZDGS = function () {
- top.U.D.Office.ZDGSXZ(U.Word.TF["ID"], "html", U.Word);
- }
- /**
- * 更多的选择
- *
- */
- U.Word.More = function () {
- var _UDMD, _UDFD, _UDOD = $$("div", {});
- _UDMD = $$("div", { "class": "U_Boom_CO_Popup_17_Main" }, _UDOD);
- $$("div", { "class": "U_Boom_CO_Popup_17_Main_Icon" }, _UDMD)
- $$("span", { "innerHTML": "下载" }, _UDMD);
- _UDFD = $$("div", { "class": "U_Boom_CO_Popup_17_Main" }, _UDOD);
- $$("div", { "class": "U_Boom_CO_Popup_17_Main_Icon", "style": { "background-position": "-44px -81px"} }, _UDFD)
- $$("span", { "innerHTML": "意见反馈" }, _UDFD);
- U.UI.From({ min: false, max: false, id: "U_Boom_CO_Popup_17", style: { "width": "280px", "height": "auto" }, content: _UDOD, title: "更多", hst: {}, bst: {} });
- }
- U.Word.ViewDisplayon = function () {//功能区域关闭
- var UDAA = $("#U_Boom_CO_Editor_body_left")[0].childNodes; //获取功能区域
- var UDWD = $("#U_Boom_CO_Editor_body_left .UD_SYF_S"); //获取功能区域
- var UDOD_yq_colse = $(".UD_SYF_SS"); //获取获取功能区域的关闭按钮
- UDOD_yq_colse[0].onclick = function () {//邀请协作人员关闭
- U.D.CloseWindow(UDWD[0]);
- UDAA[2].style.top = UDAA[2].offsetTop - 270 + "px";
- UDAA[3].style.top = UDAA[3].offsetTop - 270 + "px";
- UDAA[4].style.top = UDAA[4].offsetTop - 270 + "px";
- }
- UDOD_yq_colse[1].onclick = function () {//编辑历史关闭
- U.D.CloseWindow(UDWD[1]);
- UDAA[3].style.top = UDAA[3].offsetTop - 270 + "px";
- UDAA[4].style.top = UDAA[4].offsetTop - 270 + "px";
- }
- UDOD_yq_colse[2].onclick = function () {//生成链接关闭
- U.D.CloseWindow(UDWD[2]);
- UDAA[4].style.top = UDAA[4].offsetTop - 270 + "px";
- }
- UDOD_yq_colse[3].onclick = function () {//热门模板关闭
- U.D.CloseWindow(UDWD[3]);
- }
- }
- U.Word.ViewDisplayc = function () {//点击关闭编辑区域时 视图窗体&&更多窗体&&纸张大小窗体 关闭
- for (var i = 0; i < $(".UD_SYF_SS").length; i++) {
- $(".UD_SYF_SS")[i].onclick = function () {
- this.parentNode.parentNode.style.display = "none";
- $("#ViewDisplaya").hide();
- $("#UD_Temp").hide();
- $("#U_COF").hide();
- $("#EditHistor").hide();
- $("#EditHistorq").hide();
- }
- }
- }
- //#endregion
|