U.Word.js 86 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200
  1. //查看指定文件,,判断是否保存或者覆盖,包括创建邀请协作人员,创建编辑历史,创建生成链接.创建热门模板。加载当前word文档的内容。创建光标,监控键盘输入等。这里是iframe中的word起始点。
  2. //监控输入输出,
  3. //添加成员,共同编辑。
  4. Namespace.register("U.Word");
  5. //由于当前文档的js是加载在ifame里面的,获取不到外部的文档(www.1473.cn)信息。所以通过传递参数设置全局变量的形式保存当前文档信息。
  6. //id是word文档id,PID是文档归属的目录id,fileinfo是文档的实体信息fileinfo,OL初始化回调函数,UID是当前文档创建者的id。
  7. U.Word.TF = { "ID": null, "PID": "", "fileinfo": "", "UID": "" };
  8. US = parent.US;
  9. //#region 初始化区域
  10. //链接形式点击查看Word资料,例1: /usercontrols/Word.htm?ID=a0373130-be97-db03-4e74-9967c1038d13
  11. //例2:a0373130-be97-db03-4e74-9967c1038d13.1473.cn
  12. //例3:短域名 example.1473.cn
  13. window.onload = function () {
  14. U.D.FrameTop(); //让弹框置顶。
  15. U.M.OLM(); //屏蔽右键菜单等功能按键判断
  16. var _fileid = U.M.QueryString("ID"); //获取登录着id
  17. if (_fileid) {
  18. parent.U.A.Request("UseStudioDisk.GetOffice", ([_fileid, ""]), U.Word.AsynGOF, ([[$("body")[0], true]]));
  19. };
  20. }
  21. //获取文件异步
  22. U.Word.AsynGOF = function (request, UDOD) {
  23. var _result = request.value.UsOffice || ""; //或者的作用是:右键新建word,没有保存时给""。
  24. //设置内容为空。
  25. //$("body").addAttrArray({ "style": {}, "innerHTML": "" });
  26. U.M.loadHtml(document.body, _result);
  27. return true;
  28. }
  29. //------------------------------------------------------------------------------初始化Word----------------------------------------------------------------------------
  30. //查看指定文件,,判断是否保存或者覆盖,包括创建邀请协作人员,创建编辑历史,创建生成链接.创建热门模板。加载当前word文档的内容。创建光标,监控键盘输入等。这里是iframe中的word起始点。
  31. //fileinfo ? fileinfo.UserDirectoryID : "" 如果有文件id则表示文件已经在数据库存在,如果没有id,表示是新word。
  32. //fileinfo 文件信息
  33. //fileinfo ? fileinfo.UserId : userInfo.userid 如果有文件信息,则所有者为该文件的创建者,否则为自己的用户id。
  34. U.Word.Load = function (fileid, fileinfo, uid, iframe) { //UDID 这个文件的id UDE 这个文件的基本信息 UID 这个文件创始人的id UAE object返回值
  35. //U.Word.Tool(fileinfo); //创建邀请协作人员,创建编辑历史,创建生成链接.创建热门模板的窗体,同时创建了编辑区域
  36. U.Word.Variable(fileid, fileinfo, uid, iframe); //初始化全局变量
  37. U.Word.Panel.Loadeditor(fileinfo); //加载word的编辑器
  38. U.Word.Panel.LoadPlayUser(fileinfo); //加载协助人员窗体
  39. U.Word.Panel.Loadlink(fileinfo); //加载链接窗体
  40. U.Word.Panel.LoadHotTemplates(); //加载热门模板
  41. U.Word.Panel.LoadOfficeHistory(fileinfo, uid); //加载历史记录
  42. U.Word.LoadContent(fileid, uid, fileinfo); //初始化内容 只有加载出word内容的情况下触发
  43. }
  44. /**
  45. * 加载Word编辑区域的内容
  46. *
  47. */
  48. U.Word.LoadContent = function (fileid, uid, fileinfo) {
  49. //如果有文件内容,则hascontent.
  50. var hascontent;
  51. if (fileinfo) {
  52. hascontent = U.Ut.isString(fileinfo.UsOffice);
  53. }
  54. //如果没有加载到,则去数据库加载
  55. if (fileid && !hascontent) { //获取查看的office内容
  56. parent.U.A.Request("UseStudioDisk.GetOffice", ([fileid, ""]), U.Word.AsynLoad, (["", fileid, fileinfo, uid])); //获取office内容
  57. return;
  58. }
  59. //创建光标,监控键盘输入(包含粘贴板,回车,删除,分页等系统操作),等。
  60. U.Word.OLWord(fileinfo); //word加载处理
  61. }
  62. //异步获取Word编辑区域的数据
  63. U.Word.AsynLoad = function (request) { //object 值
  64. var context = request.context, //获取array值
  65. _fileid = context[1], //获取文件id
  66. _fileinfo = context[2], //获取文件信息
  67. _uid = context[3], //用户id
  68. request = request.value; //服务器返回的值。
  69. _fileinfo.UsOffice = request.UsOffice || ""; //word内容
  70. U.Word.LoadContent(_fileid, _uid, _fileinfo); //查看文件
  71. }
  72. /**
  73. * 初始化全局变量
  74. *
  75. */
  76. U.Word.Variable = function (fileid, fileinfo, uid, iframe) {
  77. //由于iframe和www.1473.cn不能相互调用文档信息,所以通过这个形式添加文档的ID和当前创建文档用户的id以及当前文档的信息保存到全局变量中
  78. var _UTE = U.Word.TF;
  79. _UTE.ID = fileid; //文档id
  80. _UTE.UID = uid; //创建用户id
  81. _UTE.ET = fileinfo; //文件信息实体 fileinfo
  82. _UTE.UDED = iframe; //在www.1473.cn的域层的iframe
  83. }
  84. //#region
  85. /**
  86. * 初始化Word,//创建光标,监控键盘输入(包含粘贴板,回车,删除,分页等系统操作),等。
  87. *
  88. * @param {object} 登录用户信息 ,没有有用到,需要删除
  89. * @param {object} 文档信息数组 或 null
  90. * @param {object} 获取存放office元素 ,没有用到,需要删除
  91. * @param {object} office窗体元素(Ifrmae)
  92. * @param {object} office文件在网盘的唯一id
  93. */
  94. U.Word.OLWord = function (fileinfo) {
  95. var i,
  96. _content, //word文件内容保存在这里
  97. _cursor; //光标
  98. //得到可编辑区域变量
  99. var _child = $("#UD_SYQXR").Child();
  100. var _editarea = $(_child[_child.length - 1]).Child()[1]; //可编辑区域,是_content的父亲
  101. //廖泽愈写的,要放到其他位置。视图生成
  102. // U.Word.ViewDisplayon(); //视图关闭
  103. // U.Word.ViewDisplayc();//编辑区关闭后,其他窗体关闭
  104. //新建文件没有文件内容,所以需要判断,以后可以再考虑。
  105. if (!fileinfo) {
  106. _content = _editarea.innerHTML;
  107. }
  108. else {
  109. _content = fileinfo["UsOffice"];
  110. }
  111. // U.Word.AsynGetTemp(_content); //异步加载模板原型
  112. //默认设置可编辑为true
  113. $(_editarea).addAttrArray({
  114. "innerHTML": "",
  115. "contentEditable": "true"
  116. });
  117. //得到整理好的内容,以便插入光标在末尾
  118. _content = U.Word.lastContent(_editarea, _content);
  119. //创建光标的地方
  120. //同时也是出了键盘事件的地方,U.Word.Keyboard是键盘事件,作为回调函数传递给光标进行处理。
  121. ////把键盘事件和光标一起绑定,因为要使用光标的地方全部都要监控键盘输入输出,所以绑定在一起,如果有机会,可以独立。
  122. //监控键盘输入(包含粘贴板,回车,删除,分页等系统操作),等。
  123. _cursor = U.OU.WordFocus(_editarea, _content, U.Word.Keyboard); //编辑绑定
  124. //找到子元素,实质是向子元素追加光标
  125. _editarea = $(_editarea).Child();
  126. //插入光标到指定位置。
  127. _cursor.QX(1, 1, _editarea[_editarea.length - 1]);
  128. //保存光标变量。
  129. _cursor.CreateR();
  130. }
  131. //得到整理好的内容,以便插入光标在末尾
  132. U.Word.lastContent = function (editarea, content) {
  133. var _tmp;
  134. var _content = content;
  135. //如果word有内容,则自动排版分页,目的是得到内容,正常显示,以便创建光标时正常写入,把光标放入最末尾。
  136. if (_content) {//内容插入
  137. _tmp = $($$("div", { "innerHTML": _content })).Child();
  138. for (i = 0; i < _tmp.length; i++) {
  139. if (_tmp[i].className == "U_Boom_CO_Editor_body_main_m") {
  140. _content = "";
  141. if (!i) {
  142. _editarea.innerHTML = $(_tmp[i]).Child()[1].innerHTML;
  143. }
  144. else {
  145. U.Word.Page($(_editarea).Parent(), null, $(_tmp[i]).Child()[1].innerHTML); //生成下一页
  146. }
  147. }
  148. }
  149. }
  150. else { //空文字处理
  151. _content = "<div><br /></div>"; //追加光标其实是追加到div之间。
  152. }
  153. return _content;
  154. }
  155. //#endregion
  156. //#region 保存区域
  157. //关闭保存文件
  158. U.Word.CSave = function (cb) {
  159. if (U.Word.BCWJ()) { //关闭同时保存文件
  160. parent.U.UI.Confirm("是否保存文件", [U.Word.Save, ([cb])], UFN);
  161. }
  162. else { //直接退出
  163. U.M.apply(this, [cb])();
  164. }
  165. }
  166. //保存Word
  167. U.Word.Save = function (cb) {
  168. //判断用户是否登录,只有登录用户才能保存信息
  169. if (!top.U.U.L.DLTC()) {
  170. //获取编辑区域的元素
  171. var _diskdiv, //disk的窗体
  172. _isdisplay, //云盘是否已经隐藏
  173. _isopen, //是否已经打开
  174. _isftp, //判断用户是否为ftp用户
  175. _isgroupuser; //判断用户是否在群里操作群文件
  176. var _wordinfo = U.Word.TF; //word全局变量 包含了uw文件的文件信息 等
  177. var _fileinfo = _wordinfo["fileinfo"]; //uw文件的文件信息
  178. var _uid = _wordinfo.UID;
  179. var _iframe = _wordinfo.UDED;
  180. var _worddiv = $(_iframe).Parent({ usform: "true" });
  181. //获取编辑区域的内容
  182. var _editor = $("#UD_SYQXR")[0];
  183. var _html = _editor.innerHTML.toHtml(); //获取编辑区域的html 这里保存的值包含了分页
  184. if (_uid == _wordinfo["UID"] || (_fileinfo && _fileinfo.GroupID == _uid)) {
  185. _isftp = true;
  186. }
  187. if (_fileinfo) {
  188. _isgroupuser = _$(US.Friend[3]).Select({ "GroupManageID": _fileinfo.UserDirectoryEncrypt, "UserId": US.userInfo.userid })[0];
  189. }
  190. var _userdisk = top.U.Dk.DiskOperatingSwitch(US.userInfo.userid); //获取用户个人网盘的信息 _userdisk.pdiv 是用户的网盘窗体
  191. if (_fileinfo && (_isftp || _isgroupuser)) { //判断文件是否是自己或者是ftp的文件或者是群文件
  192. top.U.Dk.LE.USOS(_fileinfo, _html, null, cb); //保存到数据库
  193. U.Word.Panel.InsertOfficeHistory(_fileinfo.UserDirectoryID, _uid, "uw"); //插入历史记录
  194. }
  195. // else if (fileinfo && (!fileinfo.JD && U.Word.GCoEd(fileinfo, U.M.apply(this, [[U.Word.Save, ([cb])]])))) { //这里会有一种情况就是用户群没有加载成功,去数据库中获取判断用户是否在群里
  196. // U.Alert("权限初始化");
  197. // }
  198. else { //文件不存在 或者文件不属于自己就创建一个新文件保存
  199. _isdisplay = !_userdisk.pdiv || $(_userdisk.pdiv).Parent({ usform: "true" }).style.display == "none"; //判断当前网盘是否是打开状态
  200. _diskdiv = top.U.D.DT.YYDK("Disk", [_uid, _userdisk ? _userdisk[1][1] : US.DG]); //获取弹出的网盘窗体
  201. //新建保存函数
  202. top.U.Dk.RE.CMB("uw", U.M.apply(this, [
  203. [top.U.Dk.LE.NUSOS, (["uw", _html, _wordinfo])], //新建成功后保存uw文件的信息
  204. [U.Word.YBKWJ, ([U.M.apply(this, [[U.Word.BCAWJMXG, ([_worddiv])]])])], //新建文件成功后修改word编辑弹出和全局变量信息
  205. _isdisplay ? [U.D.CloseWindow, ([_diskdiv])] : [U.D.SetDTop, ([_worddiv])], //保存文件需要通过云盘去操作,如果云盘在打开的状态下就不隐藏云盘如果是隐藏的状态下就隐藏云盘
  206. cb //回调函数chuli8
  207. ]), _diskdiv, _uid);
  208. }
  209. }
  210. }
  211. U.Word.BCAWJMXG = function (editordiv, fileinfo) {
  212. editordiv.id = "UD_Word" + fileinfo.UserDirectoryID; //设置元素id 为UD_SYQA + 文件id
  213. $("input", editordiv)[0].value = fileinfo.UserallDirectoryName; //修改文件名
  214. }
  215. /**
  216. * 保存文件信息判断文档保存的状态值
  217. *
  218. * @param {object} 点击的按钮元素
  219. * @return {number} 保存信息的值
  220. 0 无需保存可以直接关闭
  221. 1 新建文件的保存提示
  222. 3 打开文档未编辑的保存
  223. */
  224. U.Word.BCWJ = function () {
  225. var _wordinfo = U.Word.TF, //word对象处理
  226. _uid = US.userInfo.userid, //用户id
  227. _fileinfo = _wordinfo["fileinfo"], //文件信息
  228. _contentdiv = $$("div", { "innerHTML": _fileinfo.UsOffice }), //默认的文档内容
  229. _editor = $("#UD_SYQXR")[0]; //编辑div
  230. if (_fileinfo.UsOffice == null) { //新建文件没有保存的情况
  231. return 1;
  232. }
  233. else if (_wordinfo["ID"] && _fileinfo.UsOffice && _editor.innerHTML != _contentdiv.innerHTML) { //打开文档未编辑的保存
  234. return 3;
  235. }
  236. return 0; //无需保存可以直接关闭
  237. }
  238. //空文件保存异步
  239. U.Word.YBKWJ = function (cb, filesinfo) {
  240. var _fileinfo = filesinfo[1];
  241. _fileinfo["UsOffice"] = $("#UD_SYQXR")[0].innerHTML; //获取这个文件的内容
  242. U.Word.TF.fileinfo = _fileinfo; //设置word文件信息实体
  243. U.Word.TF.PID = _fileinfo.UserDirectoryParentID; //设置目录id
  244. U.Word.TF.ID = _fileinfo.UserDirectoryID; //设置文件的id
  245. U.Word.TF.UID = _fileinfo.UserId || top.US.userInfo.userid; //设置所属人信息
  246. if (U.Ut.isFunction(cb)) { cb(_fileinfo); } //回调函数
  247. }
  248. //#endregion
  249. //#region 文件备份
  250. /**
  251. * 文件备份
  252. *
  253. * @param {object} 文件信息
  254. * @param {object} 指定的Window操作层
  255. */
  256. U.Word.Backup = function () {
  257. var _isuser, //判断是否是本人
  258. _isgroup; //判断是否为群
  259. var _wordinfo = U.Word.TF; //word全局变量 包含当前word的信息
  260. var _fileinfo = _wordinfo.fileinfo; //文件的信息
  261. if (_fileinfo) { //判断是否有文件信息
  262. _isuser = _fileinfo.UserId == US.userInfo.userid; //判断是否是本人
  263. _isgroup = _fileinfo.UserDirectoryEncrypt && _$(US.Friend[3]).Select({ "GroupManageID": _fileinfo.UserDirectoryEncrypt, "UserId": US.userInfo.userid })[0]; //判断是否为群成员备份
  264. if (_isuser || _isgroup) { //判断备份的文件是否为用户自己的文件
  265. U.Dk.DiskOperatingSwitch(US.userInfo.userid); //操作用户切换会当前登录用户
  266. //弹出查看备份选择
  267. U.Dk.VW.CCWPXZK(UDE.UserDirectoryParentID, {
  268. De: U.Word.BackupDe, //删除备份操作
  269. onclick: U.M.apply(null, [ //
  270. [U.Word.OpenBF, ([UW])]
  271. ]),
  272. Bo: {
  273. ok: U.M.apply(null, [
  274. [U.Word.OBackup, ([UDE])]
  275. ])
  276. }
  277. }, "Other", UDE.UserDirectoryID, U.Dk.VW.APWPTP); //弹出网盘选择框
  278. }
  279. else {
  280. U.Alert("无法备份他人文件");
  281. }
  282. }
  283. else { //没有的话保存该文件
  284. U.Word.WBH("", "Save", true);
  285. } //为存储的文件设定为存储模式
  286. }
  287. /**
  288. * 备份删除
  289. *
  290. * @param {object} 文件信息
  291. * @param {object} 当前备份文件的元素
  292. */
  293. U.Word.BackupDe = function (backupdiv, fileinfo) {
  294. U.UI.Confirm("是否删除该备份", [U.M.apply(null, [[U.Word.NBackupDe, ([fileinfo, backupdiv])]])]); //创建提示框 提示是否删除备份
  295. }
  296. /**
  297. * 确定删除该备份
  298. *
  299. * @param {object} 当前备份文件的元素
  300. * @param {object} 文件信息
  301. */
  302. U.Word.NBackupDe = function (backupdiv, fileinfo) {
  303. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "UD_D_DeleteBackupFile", UDE.UserDirectoryID]), U.Word.AsynBackupDe, ([null, backupdiv, fileinfo])); //向后台发送删除备份请求 参数为文件id
  304. }
  305. /**
  306. * 备份已经删除
  307. *
  308. * @param {object} 返回值及回调传参
  309. */
  310. U.Word.AsynBackupDe = function (request) {
  311. var context = request.context, //获取回调传参
  312. _backupdiv = context[1], //当前备份文件的元素
  313. _backuppdiv = $(_backupdiv).Parent(); //获取放置备份文件的父亲层
  314. request = request.value; //函数返回值
  315. U.Alert("备份删除成功"); //提示删除成功
  316. $(_backupdiv).remove(); //删除当前备份文件的元素
  317. if (!$(_backuppdiv).Child().length) { //如果没有备份
  318. $$("div", {
  319. "className": "UD_SYSXZLRSITT",
  320. "innerHTML": "该目录暂无指定的内容"
  321. }, _UDPD); //创建无备份提示
  322. }
  323. }
  324. /**
  325. * 文件备份确定
  326. *
  327. * @param {object} 创建office的容器元素
  328. * @param {string} 用户id
  329. */
  330. U.Word.OBackup = function (fileinfo, dirid) {
  331. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "UD_I_AddBackupFile", fileinfo.UserDirectoryID]), U.Word.AsynOBackup, ([null, fileinfo, dirid]));
  332. }
  333. /**
  334. * 文件备份异步
  335. *
  336. * @param {object} 返回值及回调传参
  337. */
  338. U.Word.AsynOBackup = function (request) {
  339. request = request.value; //返回值
  340. var context = request.context; //回调传参
  341. if (request) {//判断是否备份成功
  342. U.Alert("备份成功");
  343. }
  344. }
  345. /**
  346. * 备份查看
  347. *
  348. * @param {object} 文件信息
  349. * @param {object} 指定的Window操作层
  350. */
  351. U.Word.OpenBF = function (fileinfo) {
  352. U.UI.Confirm("是否选中该备份", [U.Word.OpenNBF, ([fileinfo])]);
  353. }
  354. /**
  355. * 确定获取模板
  356. *
  357. * @param {object} 指定的Window操作层
  358. * @param {object} 文件信息
  359. */
  360. U.Word.OpenNBF = function (fileinfo) {
  361. U.Alert("文件正在加载中"); //提示加载
  362. U.A.Request("UseStudioDisk.GetOffice", ([fileinfo.UserDirectoryID, ""]), U.Word.AsynOpenBF, (["", fileinfo])); //发送获取备份请求
  363. }
  364. /**
  365. * 异步加载
  366. *
  367. * @param {object} 返回值及回调传参
  368. */
  369. U.Word.AsynOpenBF = function (request) {
  370. var _editor = $("#UD_SYQXR")[0], //设置变量
  371. context = request.context, //获取回调传参
  372. _fileinfo = context[1]; //文件信息
  373. _fileinfo.UsOffice = request.value; //设置内容
  374. U.Word.OLWord(_fileinfo);
  375. }
  376. //#endregion
  377. //#region 表格插入
  378. /**
  379. * 插入表格
  380. *
  381. * @param {element} 换页元素
  382. */
  383. U.Word.InsertTable = function () {
  384. var _UDTD, _UDSD, _UDKD, _UDMB
  385. _UDOD = $$("div", { "class": "U_Boom_CO_Popup_16" });
  386. _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16_main" }, _UDOD);
  387. for (var i = 0; i < 7; i++) {
  388. for (var j = 0; j < 8; j++) {
  389. var a = $$("div", { "class": "U_Boom_CO_Popup_16_block", "style": { "top": i * 25 + 'px', "left": j * 26 + 'px' } }, _UDMB);
  390. a.x = j;
  391. a.y = i;
  392. a.onmouseover = function () {
  393. U.Word.SelectTable(this.x, this.y)
  394. }
  395. a.onmousedown = function () {
  396. U.Word.AsynInsertTable(this.x + 1, this.y + 1)
  397. }
  398. }
  399. }
  400. $$("div", { "innerHTML": "直接插入", "style": { "position": "absolute", "top": "180px" } }, _UDMB).onclick = function () {
  401. $(".U_Boom_CO_Popup_16_main")[0].style.display = 'none';
  402. $(".U_Boom_CO_Popup_16_main")[1].style.display = 'block';
  403. };
  404. _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16_main", "style": { "display": "none" } }, _UDOD);
  405. $$("div", { "class": "U_Boom_CO_Popup_16_title", "innerHTML": "表格尺寸" }, _UDMB);
  406. _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
  407. _UDKD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
  408. $$("span", { "innerHTML": "列数:" }, _UDTD);
  409. var _h = $$("input", { "id": "U_w_table_line" }, _UDTD);
  410. $$("span", { "innerHTML": "行数:" }, _UDKD);
  411. var _l = $$("input", { "id": "U_w_table_column" }, _UDKD);
  412. $$("div", { "innerHTML": "表格宽度", "class": "U_Boom_CO_Popup_16_title" }, _UDMB);
  413. _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
  414. _UDSD = $$("span", { "innerHTML": "宽度" }, _UDTD);
  415. $$("span", { "innerHTML": "mm", "style": { "float": "right", "text-indent": "5px" } }, _UDTD);
  416. $$("input", { "id": "U_w_table_width", "value": "1", "style": { "width": "50px" } }, _UDTD);
  417. U.UI.Confirm("插入表格", { "width": "230px", "height": "auto" }, null, [U.Word.AsynInsertTable, ([_h, _l])], _UDOD);
  418. }
  419. /*表格选择插入样式*/
  420. U.Word.SelectTable = function (x, y) {
  421. var xx = (x % 7) + 1;
  422. var yy = (y % 9) + 1;
  423. var a = $(".U_Boom_CO_Popup_16_block");
  424. for (var i = 0; i < a.length; i++) {
  425. a[i].style.borderColor = '#9e9e9e';
  426. }
  427. for (var i = 0; i < yy; i++) {
  428. for (var j = 0; j < xx; j++) {
  429. a[j + 8 * i].style.borderColor = '#38f';
  430. }
  431. }
  432. }
  433. /**
  434. * 插入表格
  435. *
  436. * @param {element} 换页元素
  437. */
  438. U.Word.KeyFlage = null;
  439. U.Word.MouseMenu = $("#UD_SYQER")[0];
  440. U.Word.AsynInsertTable = function (x, y, node) {
  441. var container;
  442. if (!x && !y) {
  443. U.Alert('请输入数据')
  444. } else {
  445. if (typeof x == 'object' || typeof y == 'object') {
  446. x = x.value;
  447. y = y.value;
  448. }
  449. }
  450. if (!node) {
  451. node = $(".U_Boom_CO_Editor_body_main_text")[0]
  452. container = $$("table", { "border": "0", "class": "U_Boom_Table", "cellpadding": "0", "cellspacing": "0" }, node);
  453. } else {
  454. container = node;
  455. }
  456. container = $$("tbody", {}, container);
  457. container.onkeydown = function (e) {
  458. if (e.ctrlKey) {
  459. U.Word.KeyFlage = true;
  460. }
  461. };
  462. container.onkeyup = function () {
  463. U.Word.KeyFlage = null;
  464. };
  465. for (var i = 0; i < y; i++) {
  466. var a = $$("tr", { "class": "U_Boom_Table_Line" }, container);
  467. for (var j = 0; j < x; j++) {
  468. var b = $$("td", { "class": "U_Boom_Table_Column" }, a);
  469. b.onmousedown = function (e) {
  470. if (e.button == 2) {
  471. U.M.RLocate(U.Word.MouseMenu);
  472. } else {
  473. U.Word.MouseMenu.removeAttribute('style');
  474. }
  475. U.Word.EditTable(this, e);
  476. };
  477. b.h = j;
  478. b.l = i;
  479. }
  480. }
  481. if ($("#U_COF")[0]) {
  482. $("#U_COF")[0].style.display = 'none';
  483. }
  484. };
  485. /**
  486. * 调整拖拽表格
  487. *
  488. * @param {element} 换页元素
  489. */
  490. U.Word.ResizeTable = function (control, e) {
  491. e.stopPropagation();
  492. e.preventDefault();
  493. var startX, container = control.parentNode;
  494. var ThisTable = container.parentNode.parentNode.parentNode, count,
  495. offsetX = container.offsetLeft - ThisTable.getBoundingClientRect().left;
  496. offsetY = container.offsetHeight - ThisTable.getBoundingClientRect().top;
  497. startX = e.pageX - ThisTable.getBoundingClientRect().left;
  498. document.onmousemove = function (e) {
  499. var ThisLine = container.parentNode;
  500. var TabelLine = ThisTable.getElementsByClassName("U_Boom_Table_Content");
  501. var TablePreparColumn = [],
  502. TableElseColumn = [];
  503. for (var i = 0; i < ThisLine.childNodes.length; i++) {
  504. if (ThisLine.childNodes[i] == container) {
  505. count = i;
  506. }
  507. }
  508. for (var i = 0; i < TabelLine.length; i++) {
  509. for (var k = 0; k < TabelLine[i].childNodes.length; k++) {
  510. if (k == count) {
  511. TablePreparColumn.push(TabelLine[i].childNodes[k]);
  512. }
  513. if (k > count) {
  514. TableElseColumn.push(TabelLine[i].childNodes[k]);
  515. }
  516. }
  517. }
  518. var endX = e.pageX - ThisTable.getBoundingClientRect().left - offsetX;
  519. var cutX = (endX - startX) / (TableElseColumn.length / TabelLine.length);
  520. for (var j = 0; j < TablePreparColumn.length; j++) {
  521. TablePreparColumn[j].style.width = endX + 'px';
  522. }
  523. for (var l = 0; l < TableElseColumn.length; l++) {
  524. if (cutX > 0) {
  525. TableElseColumn[l].style.width = TableElseColumn[l].offsetWidth - cutX + 'px';
  526. } else {
  527. TableElseColumn[l].style.width = TableElseColumn[l].offsetWidth + Math.abs(cutX) + 'px';
  528. }
  529. TableElseColumn[l].style.background = "yellow";
  530. }
  531. startX = e.pageX - ThisTable.getBoundingClientRect().left;
  532. TablePreparColumn = [];
  533. TableElseColumn = [];
  534. };
  535. document.onmouseup = function () {
  536. document.onmousemove = null;
  537. document.onmouseup = null;
  538. }
  539. };
  540. /**
  541. * 编辑表格
  542. *
  543. * @param {element} 换页元素
  544. */
  545. U.Word.EditTable = function (this_column, e) {
  546. e.stopPropagation();
  547. var Editors = $(".U_Boom_CO_Editor_body_main_text"); //编辑器
  548. var Column = $(".U_Boom_Table_Column");
  549. if (U.Word.KeyFlage) {
  550. this_column.state = true;
  551. this_column.setAttribute("contenteditable", true);
  552. this_column.style.border = "1px solid #38f";
  553. } else {
  554. for (var i = 0; i < Column.length; i++) {
  555. Column[i].state = false;
  556. Column[i].onkeydown = null;
  557. Column[i].setAttribute("contenteditable", false);
  558. Column[i].style.border = "1px solid #ccc";
  559. }
  560. }
  561. this_column.state = true;
  562. this_column.setAttribute("contenteditable", true);
  563. this_column.style.border = "1px solid #38f";
  564. for (var j = 0; j < Editors.length; j++) {
  565. Editors[j].setAttribute("contenteditable", false);
  566. Editors[j].onmousedown = function () {
  567. this.setAttribute("contenteditable", true);
  568. Array.prototype.forEach.call(this.getElementsByTagName('*'), function (elm) {
  569. elm.setAttribute("contenteditable", false);
  570. });
  571. }
  572. }
  573. };
  574. /**
  575. * 合并、拆分单元格
  576. *
  577. * @param {element} 换页元素
  578. */
  579. U.Word.ColumnControl = function (fx) {
  580. var column = $(".U_Boom_Table_Column");
  581. var selectColumn = [];
  582. var OperateColumn = [];
  583. for (var i = 0; i < column.length; i++) {
  584. if (column[i].state) {
  585. selectColumn.push(column[i])
  586. }
  587. }
  588. if (fx == 'split') {
  589. if (selectColumn.length > 1) {
  590. U.Alert('请选择一个单元格');
  591. Array.prototype.forEach.call(column, function (elm) {
  592. elm.removeAttribute('style');
  593. });
  594. } else {
  595. var _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16", "style": { "height": "110px" } });
  596. var UDHD = $$("div", { "class": "U_Boom_CO_Popup_16_main" }, _UDMB);
  597. $$("div", { "class": "U_Boom_CO_Popup_16_title", "innerHTML": "拆分大小" }, UDHD);
  598. var _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
  599. var _UDKD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
  600. $$("span", { "innerHTML": "列数:" }, _UDTD);
  601. var _l = $$("input", { "id": "U_w_table_line", "value": "2" }, _UDTD);
  602. $$("span", { "innerHTML": "行数:" }, _UDKD);
  603. var _h = $$("input", { "id": "U_w_table_column", "value": "2" }, _UDKD);
  604. var _CUM = new U.UI.Confirm("拆分单元格", { "width": "350px", "text-align": "center" }, null, U.M.apply(null, [[U.Word.AsynInsertTable, ([_h, _l, selectColumn[0]])]]), _UDMB); //创建对话框
  605. }
  606. } else {
  607. U.Alert('暂无法使用');
  608. U.Word.KeyFlage = null;
  609. U.Word.MouseMenu.removeAttribute('style');
  610. return false;
  611. /////以后删除
  612. var x = selectColumn[0].h, y = selectColumn[0].l;
  613. var width = 0, content = '';
  614. for (var i = 0; i < selectColumn.length; i++) {
  615. if (selectColumn[i].h == y) {///找出一行中被选中的
  616. OperateColumn.push(selectColumn[i]);
  617. x = selectColumn[i].l, y = selectColumn[i].h;
  618. }
  619. }
  620. for (var j = 1; j < OperateColumn.length; j++) {
  621. width = OperateColumn[j].parentNode.offsetWidth + width;
  622. content = OperateColumn[j].innerHTML + content;
  623. OperateColumn[j].parentNode.remove();
  624. }
  625. OperateColumn[0].parentNode.style.width = OperateColumn[0].offsetWidth + width + 'px';
  626. OperateColumn[0].innerHTML += content;
  627. }
  628. U.Word.KeyFlage = null;
  629. U.Word.MouseMenu.removeAttribute('style');
  630. };
  631. //#endregion
  632. //-----------------------------------------------------------------------------文档级联-------------------------------------------------------------------------------
  633. //用户word文档集
  634. U.Word.WDJ = function () {
  635. var i; //循环初始化
  636. _UAE,
  637. _UDE,
  638. _UDTD,
  639. _UID = US.userInfo.userid,
  640. _UDOD = $("#U_W_GN_N")[0],
  641. _UDSD = $("span", _UDOD.parentNode),
  642. _UGE = US.Disk.diskfileTree,
  643. _UDFD = $$("frag");
  644. _UDOD.innerText = "";
  645. if (_UID) {
  646. _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);
  647. U.Word.TF["PID"] = _UDE[0] ? _UDE[0]["UserDirectoryParentID"] : US["DG"];
  648. _UAE = _UDE[0] ? _$(_UGE[0]).Select({ "UserDirectoryID": _UDE[0]["UserDirectoryParentID"] }, null, 1)[0] : { "UserDirectoryName": "当前文件夹" };
  649. for (i = 0; i < _UDE.length; i++) {
  650. _UDTD = $$("div", { "className": "U_W_GN_NS", "title": _UDE[i].UserallDirectoryName, "onclick": [[U.Word.CWDJ, ([_UDE[i]])]] }, _UDFD);
  651. $$("div", { "className": "UDK_L_DiskGE U_W_GN_NSI" }, _UDTD);
  652. $$("div", { "className": "U_W_GN_NSS", "innerHTML": _UDE[i].UserDirectoryName }, _UDTD);
  653. }
  654. _UDOD.appendChild(_UDFD);
  655. }
  656. _UDSD[0].innerText = _UID ? (_UAE["UserDirectoryName"]) : "(未登录)"; _UDSD[1].innerText = _UID ? "(" + _UDE.length + ")" : ""; //标题变化
  657. }
  658. //word文档集点击
  659. U.Word.CWDJ = function (UDE, TF) {
  660. var _UDT = U.OU.R.GetSelectedText(),
  661. _UDOD = U.OU.R.SO; //获取选择的文字
  662. if (_UDOD && _UDOD.className.indexOf("U_ONOTI") > -1 && TF != false) {
  663. U.UI.Confirm("是否导航该文档", [U.Word.SCLJWZ, ([_UDOD, UDE])], [U.Word.CWDJ, ([UDE, false])]);
  664. }
  665. else {
  666. if (_UDT != "" && TF != false) {
  667. U.UI.Confirm("选中文字区是否生成链接网站", [U.Word.WDJL, ([UDE])], null);
  668. } //添加word链接
  669. else {
  670. if (U.Word.BCWJ()) { U.Word.Save(); }
  671. U.Word.Load(UDE["UserDirectoryID"], UDE);
  672. } //打开一个word
  673. }
  674. }
  675. //生成链接网站
  676. U.Word.SCLJWZ = function (UDOD, UDE) {
  677. (UDOD.className == "U_ONOTIB") && (UDOD = UDOD.parentNode);
  678. $(UDOD).addAttrArray({ "onmouseup": "U.OFD.LJWDS(this,\"" + UDE["UserDirectoryID"] + "\")" });
  679. UDOD.parentNode.innerHTML += "";
  680. UDOD = $("div@ITF=" + UDOD.getAttribute("ITF"))[0];
  681. UDOD = U.OFD.SW(UDOD);
  682. UDOD.innerHTML = "";
  683. $$("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);
  684. UDOD.contentEditable = "false";
  685. }
  686. //生成文件级联
  687. U.Word.WDJL = function (UDE) {
  688. U.OU.OULJ(U.OU.R, "http://disk.1473.cn/?ID=" + UDE["UserDirectoryID"], UDE);
  689. }
  690. //初始化导航
  691. U.Word.LoadDH = function () {
  692. }
  693. //删除导航处理
  694. U.Word.TYDT = function (UDSO) { //导航id
  695. U.UI.Confirm("是否删除导航", [U.Word.TSDH, ([UDSO])]);
  696. }
  697. //提示导航处理
  698. U.Word.TSDH = function (UDSO) {
  699. if ((UDSO.className == "U_ONOTI" || UDSO.className == "U_ONOCC")) {//
  700. var _UDOD = $("#U_ONOC")[0],
  701. _UDCD = $("#U_ONOT")[0],
  702. _GUID = UDSO.getAttribute("ITF"),
  703. _UDSD = $("@ITF=" + _GUID, _UDOD)[0],
  704. _UDED = $("@ITF=" + _GUID, _UDCD)[0]; //获取需要删除的元素
  705. (_UDSD) && (_UDSD.parentNode.removeChild(_UDSD));
  706. (_UDED) && (_UDED.parentNode.removeChild(_UDED)) //删除菜单对应可读
  707. }
  708. else { UDSO.parentNode.removeChild(UDSO); } //不允许删除
  709. }
  710. //------------------------------------------------------------------------------辅助函数------------------------------------------------------------------------------
  711. //Word统一回调
  712. U.Word.TYHD = function (TF, UV) {
  713. switch (TF) {
  714. case "IFD":
  715. U.Word.SCWZ.apply(this, UV);
  716. break; //点击Delete触发 主要是处理导航问题
  717. case "UP":
  718. U.Word.UP.apply(this, UV);
  719. break;
  720. }
  721. }
  722. //变化字体和大小
  723. U.Word.UP = function (UEL) {
  724. var _UKC = event.keyCode;
  725. if (UEL == null || ((_UKC > 268 && _UKC < 272) || (_UKC > 0 && _UKC < 5) || (_UKC > 36 && _UKC < 41))) {
  726. var _UDPD = $("#U_E_AXDZ")[0],
  727. _UDAD = $("#U_E_AXZZ")[0],
  728. _UFS,
  729. _UFF; (UEL == null) && (U.OU.R.CreateR(false), UEL = U.OU.R.Parent());
  730. _UFS = parseInt(UEL.style.fontSize);
  731. _UDPD.innerText = _UFS || 14;
  732. _UFF = UEL.style.fontFamily;
  733. U.OU.SBH(_UDAD, _UFF || "Calibri");
  734. }
  735. }
  736. //删除文字
  737. U.Word.SCWZ = function (UDSO) {
  738. if ((UDSO.className.indexOf("U_ONOTI") > -1 || UDSO.className == "U_ONOCC")) {//清除文字不清除元素
  739. var _UTI = this.GetGBWZ(UDSO),
  740. _UETI = event.keyCode;
  741. if ((_UTI == 0 && _UETI == 8) || (_UTI == UDSO.innerText.length && _UETI == 46)) {
  742. U.OU.R.CreateR(false);
  743. U.OU.R.Replace("");
  744. U.M.StopDefault();
  745. }
  746. else if (UDSO.innerText.length == 1 && ((_UTI == 0 && _UETI == 46) || (_UTI == UDSO.innerText.length && _UETI == 8))) {
  747. UDSO.innerHTML = "";
  748. U.M.StopDefault();
  749. }
  750. }
  751. else if (UDSO.className == "U_ONO" || UDSO.className == "U_ONOT" || UDSO.className == "U_ONOC") {
  752. U.M.StopDefault();
  753. } //防止删除
  754. }
  755. //文字大小和文字样式
  756. U.Word.DXYS = function (UDOD, UDTD, UDE, UDW) {
  757. var i;
  758. var _UDSD = event.srcElement;
  759. if (UDTD != _UDSD) {
  760. for (i in UDE) {
  761. UDE[i] = _UDSD.innerText + UDW;
  762. };
  763. UDOD.innerText = _UDSD.innerText;
  764. U.OU.ChangeStyle(UDE);
  765. U.OU.SDYC();
  766. }
  767. }
  768. //文档视图变化
  769. U.Word.View = function (UTF) {
  770. // var _UDOD = $("#UD_SYQXR_Parent"),
  771. // _UDCD = _UDOD.parentg().Child(),
  772. // _UWH = UTF == "Word" ? ["210mm", "297mm"] : [document.body.offsetWidth - _UDCD[0].offsetWidth - _UDCD[2].offsetWidth - 60 + "px", document.body.offsetHeight - 52 + "px"];
  773. // _UDOD.addAttrArray({ "style": { "maxWidth": _UWH[0], "minHeight": _UWH[1]} });
  774. }
  775. //获取office模板
  776. U.Word.GetTemp = function (UTF) {
  777. var _UDOD = $("#UD_SYQXR")[0];
  778. if (!_UDOD.innerText.length || _UDOD.innerText == $$("div", { "innerHTML": "&#8203;" }).innerText) {
  779. U.Word.GSTemp(UTF);
  780. }
  781. else {
  782. top.U.UI.Confirm("是否覆盖内容", [U.Word.GSTemp, ([UTF])]);
  783. }
  784. }
  785. //加载模板
  786. U.Word.GSTemp = function (UTF) {
  787. U.Alert("模板在加载中");
  788. var _UIS = "";
  789. if (UTF == "Word" || UTF == "Web") {
  790. _UIS = UTF; UTF = UTF == "Word" ? "US_O_Meeting" : "US_O_Website";
  791. }
  792. 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);
  793. }
  794. //获取word
  795. U.Word.AsynGetTemp = function (UTH) {
  796. var i,
  797. _USE,
  798. _UDOD = $("#UD_SYQXR")[0];
  799. UTH = U.Ut.isString(UTH) ? UTH : this.contentWindow ? this.contentWindow.document.body.innerHTML : null;
  800. window.isPrint = false; //回到默认模式
  801. U.D.Office.Editable = true;
  802. U.M.loadHtml(_UDOD, UTH); //编辑绑定
  803. U.Word.View(window.isPrint ? "Word" : "Web"); //加载模板
  804. // _UDOD.contentEditable = U.D.Office.Editable === false ? "false" : "true"; //设置编辑模式
  805. }
  806. //设置是否设为可编辑模式
  807. U.Word.Edit = function () {
  808. var _UDOD = $("#UD_SYQXR")[0];
  809. if (_UDOD) {
  810. _UDOD.contentEditable = U.D.Office.Editable === false ? "false" : "true";
  811. }
  812. }
  813. document.oncontextmenu = U.M.StopDefault; //禁止右键菜单
  814. /**
  815. * word删除页面
  816. *
  817. * @param {element} 换页元素
  818. */
  819. U.Word.DeletePage = function (UDOD) {
  820. var _UDPD = $(UDOD).Parent({ "css": "U_Boom_CO_Editor_body_main_m" }),
  821. _UDTD = $(_UDPD).Child()[0],
  822. _UDCD = $(_UDTD).Child()[0];
  823. if (!_UDCD || U.M.EISE(_UDCD, UDOD)) { //判断是否全部删除,或者是第一行里处理
  824. if (_UDTD.innerText == "" && $(_UDTD).Child().length < 2) { //确定是删除
  825. $(_UDPD).remove();
  826. }
  827. else { //换行到上面一行
  828. $(_UDPD).prev().focus();
  829. }
  830. }
  831. }
  832. //#region 邀请成员
  833. /**
  834. * 初始化查看团队成员
  835. *
  836. * @param {element} 换页元素
  837. */
  838. U.Word.DisPlayUser = function (UDE, UDOD) {
  839. UDOD = UDOD || $("#U_Boom_CO_Editor_body_left_invite_user")[0];
  840. var HYD = UDOD.children[0];
  841. UDOD.innerHTML = ""
  842. $(UDOD).append(HYD);
  843. if (UDE != "") {
  844. var UGF = _$(US.Friend[3]).Select({ "GroupManageID": UDE.UserDirectoryEncrypt || UDE.GroupID });
  845. for (i = 0; i < UGF.length; i++) {
  846. _UDOD = $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a" }, UDOD);
  847. _UDTD = $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a_img", "style": { "background": "" } }, _UDOD);
  848. $$("img", { "src": U.M.GetImgU(UGF[i].UserThumbnailImageHead) }, _UDTD);
  849. $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a_div", "innerHTML": UGF[i].UserNickName }, _UDOD);
  850. }
  851. }
  852. // U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_A_SelectOfficeUser", UDID, S, E]), U.Word.AsynDisPlayUser, ([null, UDOD]));
  853. }
  854. /**
  855. * 弹出添加成员
  856. *
  857. * @param {element} Wrod信息数组
  858. */
  859. U.Word.DisplayInsertUser = function () {
  860. var _UGE = U.Word.TF, //object参数值
  861. _UID = _UGE["UID"],
  862. _UFID = _UGE["ID"],
  863. _UET = _UGE["ET"], //文件实体
  864. _UQID = _UET.UserDirectoryEncrypt || _UET.GroupID;
  865. if (_UQID == US.userInfo.userid) { _UQID = ""; }
  866. if (_UET && _UET.UserDirectoryID) { //是否为已经新建过的uw文件
  867. top.U.F.J.ANewQZ(null, {
  868. fun: U.M.apply(this, [[top.U.F.J.CXNEWTJ,
  869. ([_UQID, _UET.UserDirectoryName || _UET.UserFilesName, "由文档" + (_UET.UserDirectoryName || _UET.UserFilesName) + "发起的互联办公群组。", _UFID, U.M.apply(null, [[U.Word.InsertUser, ([_UET])]])])]])
  870. }); //调用创建群的弹窗函数
  871. //top.U.F.J.CXNEWTJ, ([[U.Word.InsertUser, ([$("#U_Boom_CO_Editor_body_left_invite_user")[0], _UET]), _UET.UserDirectoryName
  872. }
  873. else { //未新建过的文件需要先保存到网盘
  874. U.Word.Save();
  875. }
  876. }
  877. /**
  878. * 添加团队成员
  879. *
  880. * @param {element} 换页元素
  881. */
  882. U.Word.InsertUser = function (UET, GroupID, _FriendUser, groupid, _UGN) {
  883. //找到硬盘复制粘贴的函数, 先调用复制然后调用粘贴
  884. //top.U.Dk.RE.WPFZ(UET, "Copy")
  885. //top.U.Dk.RE.UFStick(GroupID, function () { //粘贴回调
  886. //}, UET.UserId);
  887. if (!(UET.UserDirectoryEncrypt && UET.UserId != UET.UserDirectoryEncrypt)) { //如果是新创建的文件,同时文件不在群里 就把文件拷贝到群里进行处理
  888. /*
  889. //用户id 群id 文件id 群id 判断
  890. U.A.Request("UseStudioDisk.CopyFile", ([US.userInfo.userid, GroupID.GroupManageID, UET.UserFilesID || UET.UserDirectoryID, GroupID.GroupManageID, 1]), function (r) {
  891. //重新打开
  892. U.D.Office.Word();
  893. }, ([]));
  894. */
  895. 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]));
  896. }
  897. //把所有添加进来的好友打印在office窗体里
  898. // U.Word.DisPlayUser(UET)
  899. /*
  900. if (UET[1].UserDirectoryEncrypt) { //判断文件是否已经是群文件
  901. }
  902. else { //如果不是群文件,把当前uw文件复制到群里
  903. // var _UME = top.U.Dk.RE, _UCE = top.U.Dk.HP.MLWJSY(UET), _UGE = top.U.Dk.DiskOperatingSwitch(US.userInfo.userid);
  904. // 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]));
  905. }
  906. */
  907. }
  908. /**
  909. * 异步添加好友
  910. *
  911. * @param {element} 换页元素
  912. */
  913. U.Word.AsynInsertUser = function (UET, _FriendUser, groupid, _UGN, arr) {
  914. //弹出窗体
  915. //console.log(arr);
  916. top.U.D.Office.Word(US.userInfo, arr[0])
  917. 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(), ([""]));
  918. /*
  919. var i, _UDTD,
  920. context = request.context,
  921. _UDOD = context[1],
  922. _UOE = context[2],
  923. _UDE = context[3],
  924. _UDFD = $$("frag");
  925. request = request.value;
  926. if (request > -1) {
  927. for (i = 0; UDE.length; i++) {
  928. _UDTD = $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a" }, _UDFD);
  929. $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a_img" }, _UDTD);
  930. $$("div", { "className": "U_Boom_CO_Editor_body_left_invite_user_a_div", "innerHTML": "邀请" }, _UDTD);
  931. }
  932. $(UDOD).append(_UDFD);
  933. U.Alert("添加成功");
  934. }
  935. */
  936. }
  937. /**
  938. * 移除office用户
  939. *
  940. * @param {element} 换页元素
  941. */
  942. U.Word.DelOfficeUser = function (UDOD, UOE, UDE) {
  943. UDE = U.Ut.isArray(UDE) ? UDE : [UDE];
  944. var _USID = UDE.GZDL("UserId").Join(",");
  945. if (_USID) {
  946. U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_D_DeleteOfficeUser", _USID, UOE.UserFileId, UOE.TemplateId]), U.Word.AsynDelOfficeUser, ([null, UDOD])); //插入协作人员
  947. }
  948. }
  949. /**
  950. * 移除office用户
  951. *
  952. * @param {element} 换页元素
  953. */
  954. U.Word.AsynDelOfficeUser = function (request) {
  955. var context = request.context,
  956. _UDOD = context[1];
  957. if (request.value != -1) {
  958. $(_UDOD).remove();
  959. U.Alert("成功删除");
  960. }
  961. }
  962. //#endregion
  963. //#region
  964. /**
  965. * 初始化加载模板
  966. *
  967. * @param {element} 换页元素
  968. */
  969. U.Word.GetHotTemplates = function (UDID, S, E, UDOD) {
  970. UDOD = UDOD || $("#U_Boom_CO_Editor_body_left_template_hot")[0];
  971. U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_A_SelectHotTemplate", UDID, S, E]), U.Word.AsynGetHotTemplates, ([null, UDOD]));
  972. }
  973. /**
  974. * 获取热门模板
  975. *
  976. * @param {element} 换页元素
  977. */
  978. U.Word.AsynGetHotTemplates = function (request) {
  979. var i, _UDOD,
  980. _UDFD = $$("frag"),
  981. context = request.context,
  982. request = request.value;
  983. context[1].innerHTML = "";
  984. for (i = 0; i < request.length; i++) {
  985. _UDOD = $$("div", { "className": "U_Boom_CO_Editor_body_left_template_user_m", "onclick": [[U.Word.OpenHotTemplates, ([request[i].TemplateId])]] }, _UDFD);
  986. $$("div", { "className": "U_Boom_CO_Editor_body_left_template_user_m_s", "style": { "background-image": "url(" + request[i].UseFilesServerThumbnailName + ")" } }, _UDOD);
  987. $$("div", { "className": "U_Boom_CO_Editor_body_left_template_user_m_x", "innerHTML": request[i]["UserFilesName"] }, _UDOD);
  988. }
  989. $(context[1]).append(_UDFD);
  990. }
  991. /**
  992. * 点击模板处理
  993. * @参数:模板分类id
  994. * @param {element} 换页元素
  995. */
  996. U.Word.OpenHotTemplates = function (ArrTD) {
  997. top.U.Boom.I.GetHomeTemp.particulars(ArrTD);
  998. }
  999. //#endregion
  1000. //#region
  1001. /**
  1002. * 插入历史
  1003. *
  1004. * @param {element} 换页元素
  1005. */
  1006. U.Word.InsertOfficeHistory = function (UFID, UID, UTH, UDOD) {
  1007. var UDOD = UDOD || $("#U_Boom_CO_Editor_body_left_invite_history")[0];
  1008. var UHID = Guid.NewGuid();
  1009. U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_A_InsertOfficeHistory", UHID, UID, UTH, UFID]), U.Word.AsynViewEditHistory, ([null, UDOD, UID]));
  1010. }
  1011. /**
  1012. * 查看编辑历史
  1013. *
  1014. * @param {element} 换页元素
  1015. */
  1016. U.Word.ViewEditHistory = function (UID, UDID, UOID, S, E, UDOD) {//创始人id 文件id 空的id 选取开始 选取长度 获取编辑历史的框
  1017. setInterval(function () {
  1018. UDOD = UDOD || $("#U_Boom_CO_Editor_body_left_invite_history")[0];
  1019. U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_A_SelectOfficeHistory", UDID, UOID, S, E]), U.Word.AsynViewEditHistory, ([null, UDOD, UID]));
  1020. }, 1000)
  1021. }
  1022. /**
  1023. * 查看编辑历史异步
  1024. *
  1025. * @param {element} 换页元素
  1026. */
  1027. U.Word.AsynViewEditHistory = function (request) {
  1028. var i, _UDOD, _UDTD, _UDSD, _UDFDC,
  1029. context = request.context,
  1030. _UDE = request.value,
  1031. _UDFD = $(context[1]),
  1032. _UID = context[2];
  1033. _UDFD[0].innerHTML = "";
  1034. if (_UDE.length == 0 && !$("#U_Boom_CO_Editor_History_N")[0]) {
  1035. $$("div", { "innerHTML": "暂无历史", "style": { "text-align": "center", "margin-top": "50px" } }, _UDFD[0]);
  1036. }
  1037. else {
  1038. // $("#U_Boom_CO_Editor_History_N")[0] && $("#U_Boom_CO_Editor_History_N").remove();
  1039. for (i = 0; i < _UDE.length; i++) {
  1040. _UDOD = $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o" }, _UDFD[0]);
  1041. _UDTD = $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_l" }, _UDOD);
  1042. $$("img", { "src": U.M.GetImgU(_UDE[i].UseFilesServerThumbnailName) }, _UDTD);
  1043. _UDTD = $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_r" }, _UDOD);
  1044. _UDSD = $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_r_s" }, _UDTD);
  1045. $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_r_s_l", "innerHTML": _UDE[i].UserNickName || _UDE[i].UserName }, _UDSD);
  1046. $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_r_s_r", "innerHTML": U.MT.getTDInterval(_UDE[i].CreateTime, "String") + "保存更新" }, _UDSD);
  1047. _UDSD = $$("div", { "className": "U_Boom_CO_Editor_body_right_user_o_r_x" }, _UDTD);
  1048. (_UDE[i].UserId != _UID) && $$("div", { "innerHTML": "对话", "style": { "margin-right": "10px" }, "onclick": [[]] }, _UDSD);
  1049. $$("div", { "innerHTML": "详情", "onclick": [[U.Word.EditHistory, ([_UDE[i]])]] }, _UDSD);
  1050. }
  1051. if (_UDE.length == 1 && (_UDFDC = _UDFD.Child()).length > 0) { _UDFD.append(_UDFDC[_UDFDC.length - 1], "", _UDFDC[0]); }
  1052. }
  1053. }
  1054. /**
  1055. * 打开历史记录
  1056. *
  1057. * @param {element} 换页元素
  1058. */
  1059. //U.Word.Openhistory = function (UDE) {
  1060. // 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"}} }); //创建窗体
  1061. // U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "UD_A_SelectHistoryDetails", UDE.HistoryId]), U.Word.AsynOpenhistory, ([]));
  1062. //}
  1063. /**
  1064. * 打开异步
  1065. *
  1066. * @param {element} 换页元素
  1067. */
  1068. //U.Word.AsynOpenhistory = function (request) {
  1069. // var context = request.context,
  1070. // _UDOD = context[0];
  1071. // request = request.value;
  1072. // if (request != -1) {
  1073. // _UDOD.inenrHTML = request.OfficeContent;
  1074. // }
  1075. //}
  1076. //#endregion
  1077. //#region
  1078. /**
  1079. * 查看链接
  1080. *
  1081. * @param {element} 换页元素
  1082. */
  1083. U.Word.Getlink = function (UDID, UDOD) {
  1084. UDOD = UDOD || $("#U_Boom_CO_Editor_body_left_href_pay_a")[0];
  1085. U.A.Request(US.CD, ([US.DB, "UseStudio_Office", "UD_A_SelectHotTemplate", UDID, UOID, US, UE]), U.Word.AsynGetlink, ([null, UDOD]));
  1086. }
  1087. /**
  1088. * 查看链接异步
  1089. *
  1090. * @param {element} 换页元素
  1091. */
  1092. U.Word.AsynGetlink = function (request) {
  1093. var context = request.context;
  1094. request.value;
  1095. if (request) {
  1096. context[1].innerHTML = request;
  1097. }
  1098. }
  1099. U.Word.SetDNS = function () {
  1100. var _UGE = U.Word.TF, //object参数值
  1101. _UFID = _UGE.ID,
  1102. _USID = _UGE.UID,
  1103. _UFNM = _UGE.ET.UserDirectoryName;
  1104. if (_UFID) {
  1105. var _UDOD = $$("div", { "class": "U_Boom_CO_Popup_18" }),
  1106. _UDSBD, _UDNA, _UDRT, _UDYM, _UDSD = $$("div", { "class": "U_Boom_CO_Popup_18_Set" }, _UDOD),
  1107. _UDQCD, _UDUR, _UDQBD, _UDBG, _UDQD = $$("div", { "class": "U_Boom_CO_Popup_18_Que" }, _UDOD);
  1108. //设置
  1109. $$("div", { "class": "U_Boom_CO_Popup_18_Set_Tag", "innerHTML": "目前默认域名 <span>设置个性域名,让好友同事更快记住链接</span>" }, _UDSD),
  1110. _UDNA = $$("div", { "class": "U_Boom_CO_Popup_18_Set_Name", "innerHTML": "等待域名生成" }, _UDSD),
  1111. _UDSBD = $$("div", { "class": "U_Boom_CO_Popup_18_Btn" }, _UDSD),
  1112. //设置成功
  1113. _UDRT = $$("div", { "class": "U_Boom_CO_Popup_18_Que_Right", "style": { "display": "none" } }, _UDQD);
  1114. $$("div", { "class": "U_Boom_CO_Popup_18_Que_Tag", "innerHTML": "设置成功" }, _UDRT);
  1115. _UDUR = $$("input", { "type": "text", "class": "U_Boom_CO_Popup_18_Que_Url" }, _UDRT);
  1116. //二维码
  1117. _UDQCD = $$("div", { "class": "U_Boom_CO_Popup_18_Que_Code", "style": { "display": "none" } }, _UDQD);
  1118. _UDBG = $$("div", { "class": "U_Boom_CO_Popup_18_Que_QR" }, _UDQCD);
  1119. $$("div", { "class": "U_Boom_CO_Popup_18_Que_Con", "innerHTML": "扫一扫 </br> 分享此文档给好友" }, _UDQCD);
  1120. //域名管理中心
  1121. _UDYM = $$("div", { "class": "U_Boom_CO_Popup_18_Set_Yu" }, _UDOD);
  1122. $$("div", { "class": "U_Boom_CO_Popup_18_Set_Yu_Text", "innerHTML": "对域名不满意?可以到" }, _UDYM),
  1123. $$("div", { "class": "U_Boom_CO_Popup_18_Set_Yu_Ming", "innerHTML": "域名管理中心", "onclick": [[U.Word.Yuming]] }, _UDYM),
  1124. _UDQBD = $$("div", { "class": "U_Boom_CO_Popup_18_Btn", "style": { "display": "none" } }, _UDQD);
  1125. $$("div", { "innerHTML": "取消", "onclick": [[U.Word.Close, ([_UDOD])]] }, _UDSBD),
  1126. $$("div", { "innerHTML": "设置", "onclick": [[U.Word.QDSZ, ([_UDRT, _UDSD, _UDUR, _UDNA, _UDQBD])]] }, _UDSBD),
  1127. $$("div", { "innerHTML": "取消", "onclick": [[U.Word.Close, ([_UDOD])]] }, _UDQBD);
  1128. $$("div", { "innerHTML": "生成二维码", "onclick": [[U.Word.CodeSet, ([_UDUR, _UDBG, _UDQCD])]] }, _UDQBD);
  1129. $$("div", { "innerHTML": "复制链接分享", "onclick": [[U.Word.CopySet, ([_UDUR])]] }, _UDQBD);
  1130. top.U.UI.From({ min: false, max: false, id: "U_Boom_CO_Popup_18", style: { "width": "580px", "height": "auto" }, content: _UDOD, title: "提示", hst: {}, bst: {} });
  1131. U.Word.eaDomain(_UFID, _UDNA, _UDRT, _UDSD, _UDUR, _UDNA, _UDYM, _UDQBD, _USID, _UFNM);
  1132. } else {
  1133. U.Word.Save();
  1134. }
  1135. }
  1136. /*
  1137. * @作用:确定申请域名
  1138. * @参数一:文件ID
  1139. * @参数二:域名生成内容
  1140. * @参数三:设置成功内容
  1141. * @参数四:设置的总体盒子
  1142. * @参数五:域名内容
  1143. * @参数六:域名生成内容
  1144. * @参数七:域名管理中心
  1145. * @参数七:复制二维码按钮
  1146. * @参数八:用户ID
  1147. * @参数九:文件名
  1148. */
  1149. U.Word.eaDomain = function (UDID, UDOD, _UDRT, _UDSD, _UDUR, _UDNA, _UDYM, _UDQBD, _USID, _UFNM) {
  1150. var fid = UDID; //获取文件ID
  1151. var fname = _UFNM; //获取文件名
  1152. var UserID = _USID; //获取用户ID
  1153. var d = new Date(); //获取当前系统时间
  1154. d.setMonth(d.getMonth() + 1); //月数+1
  1155. var yy1 = d.getFullYear(); //获取年份
  1156. var mm1 = d.getMonth() + 1; //因为getMonth()返回值是 0(一月) 到 11(十二月) 之间的一个整数。所以要给其加1
  1157. var dd1 = d.getDate(); //获取哪一天
  1158. if (mm1 < 10) {
  1159. mm1 = '0' + mm1;
  1160. }
  1161. if (dd1 < 10) {
  1162. dd1 = '0' + dd1;
  1163. }
  1164. var ExTime = yy1 + '-' + mm1 + '-' + dd1; //时间组合 年-月-日
  1165. _UDUR.value = Math.ceil(Math.random() * 1000) + ".boomyun.com"; //域名生成规则
  1166. //fid:文件id
  1167. //查询数据库,域名表是否有这个文件,查看该文件是否存在域名
  1168. U.A.Request("http://cd.1473.cn/php", (["db.1473.cn", "UseStudio_DNS", 'GetDnsInfoByFileId', fid]), function (r) {
  1169. if (r.value.length == 0) {
  1170. //fid:文件id fname:文件名 .com:域名类型 ExTime:到期时间 0:类别 _UDUR.value:域名内容 UserID:用户ID 1:是否需要跳转页面展示内容
  1171. //插入域名到数据库
  1172. 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) {
  1173. //fid:文件ID
  1174. //查询域名是否存在
  1175. U.A.Request("http://cd.1473.cn/php", (["db.1473.cn", "UseStudio_DNS", 'GetDnsInfoByFileId', fid]), function (r) {
  1176. _UDNA.innerHTML = r.value[0].Domain; //显示域名至HTML页面
  1177. });
  1178. });
  1179. } else {
  1180. _UDRT.style.display = "block"; //设置成功的页面显示
  1181. _UDSD.style.display = "none"; //点击设置页面隐藏
  1182. _UDQBD.style.display = "block"; //复制生成等按钮显示
  1183. _UDYM.style.display = "block"; //域名管理中心显示
  1184. _UDUR.value = r.value[0].Domain; //获取域名生成内容
  1185. }
  1186. });
  1187. }
  1188. //域名生成二维码
  1189. U.Word.CodeSet = function (_UDUR, _UDBG, _UDQCD) {
  1190. //长 - 宽 - 二维码颜色 - 背景颜色 - 输入的文字或者URL - 生成到的地方
  1191. top.U.QR.Code.generate("180", "180", "black", "white", $(_UDUR)[0].value, $(_UDBG)[0]);
  1192. _UDQCD.style.display = "block"; //二维码显示
  1193. }
  1194. //域名复制链接分享
  1195. /*U.Word.CopySet = function (_UDUR) {
  1196. // $(_UDUR)[0].select();
  1197. //_UDUR.select();
  1198. top.$(".U_Boom_CO_Popup_18_Que_Url")[0].select();
  1199. return document.execCommand('copy');
  1200. U.Alert("复制成功");
  1201. }*/
  1202. //申请域名异步
  1203. /*U.Word.AsyneaDomain = function (request) {
  1204. var context = request.context, _UDID = context[1], _UDOD = context[2]; request = request.value;
  1205. if (request[0]) {
  1206. $(_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" + "')") });
  1207. }
  1208. else { U.Alert("你建站超过指定次数请您重新建立。"); }
  1209. }*/
  1210. /**
  1211. * 确定设置按钮
  1212. *
  1213. * @param {element} 换页元素
  1214. * @参数一:设置成功内容
  1215. * @参数二:设置的总体盒子
  1216. * @参数三:域名内容
  1217. * @参数四:域名生成内容
  1218. * @参数五:复制二维码按钮
  1219. */
  1220. U.Word.QDSZ = function (_UDRT, _UDSD, _UDUR, _UDNA, _UDQBD) {
  1221. _UDRT.style.display = "block";
  1222. _UDSD.style.display = "none";
  1223. _UDQBD.style.display = "block";
  1224. _UDUR.innerHTML = _UDNA.innerHTML; //显示域名内容
  1225. }
  1226. /**
  1227. * 创建链接分享
  1228. *
  1229. * @param {element} 换页元素
  1230. */
  1231. U.Word.Createlink = function (UDE, UDOD) {
  1232. U.A.Request(US.CD, ([US.DB, "UseStudio_Disk", "UD_I_AddDns", UDE.UserFileId, US.userInfo.userid, 1]), U.Word.AsynCreatelink, ([null, UDOD]));
  1233. }
  1234. /**
  1235. * 创建链接分享
  1236. *
  1237. * @param {element} 换页元素
  1238. */
  1239. U.Word.AsynCreatelink = function (request) {
  1240. var context = request.context;
  1241. request.value;
  1242. if (request) {
  1243. context[1].innerHTML = request.UserDomain + ".1473.cn";
  1244. }
  1245. }
  1246. /**
  1247. * 关闭弹窗
  1248. *
  1249. * @param {element} 换页元素
  1250. */
  1251. U.Word.Close = function (UDOD) {
  1252. $(UDOD)[0].parentElement.parentElement.parentElement.style.display = "none";
  1253. }
  1254. //点击弹出域名管理系统
  1255. U.Word.Yuming = function () {
  1256. if (!top.$("#U_Boom_Y_B_Manage_Pop")[0]) {
  1257. top.U.Yuming.MC.StateBox(U.Word.TF["ET"].UserallDirectoryName);
  1258. top.U.D.SetDTop(top.$("#U_Boom_Y_B_Manage_Pop")[0]);
  1259. } else {
  1260. top.$("#U_Boom_Y_B_Manage_Pop")[0].style.display = "block";
  1261. top.U.D.SetDTop(top.$("#U_Boom_Y_B_Manage_Pop")[0]);
  1262. }
  1263. }
  1264. //#endregion
  1265. /**
  1266. * 创建标签
  1267. *
  1268. * @param {element} 换页元素
  1269. */
  1270. //U.Word.CreateLabel = function (UDOD) {
  1271. // var _UDTD = $$("div", { "className": "U_Boom_CO_Editor_head_file_bj" });
  1272. // $$("div", { "className": "U_Boom_CO_Editor_head_file_web" }, _UDTD);
  1273. // $$("div", { "className": "U_Boom_CO_Editor_head_file_x", "title": "关闭" }, _UDTD);
  1274. // UDOD.appendChild(_UDTD);
  1275. //}
  1276. /**
  1277. * 隐藏工具
  1278. *
  1279. * @param {element} 换页元素
  1280. */
  1281. U.Word.CloseRight = function (UDOD, UTF) {
  1282. var i, _UTF = "none",
  1283. _UDPD = $(UDOD).parentg(2),
  1284. _UDAD = _UDPD.parentg().Child();
  1285. _UDPD.css("display", "none");
  1286. for (i = 0; i < _UDAD.length; i++) {
  1287. if (_UDAD[i].style.display != "none") {
  1288. _UTF = "block";
  1289. }
  1290. }
  1291. _UDPD.parentg().css("display", _UTF);
  1292. }
  1293. /**
  1294. * 更多的选择
  1295. *
  1296. */
  1297. U.Word.More = function () {
  1298. var _UDMD, _UDFD, _UDOD = $$("div", {});
  1299. _UDMD = $$("div", { "class": "U_Boom_CO_Popup_17_Main" }, _UDOD);
  1300. $$("div", { "class": "U_Boom_CO_Popup_17_Main_Icon" }, _UDMD)
  1301. $$("span", { "innerHTML": "下载" }, _UDMD);
  1302. _UDFD = $$("div", { "class": "U_Boom_CO_Popup_17_Main" }, _UDOD);
  1303. $$("div", { "class": "U_Boom_CO_Popup_17_Main_Icon", "style": { "background-position": "-44px -81px" } }, _UDFD)
  1304. $$("span", { "innerHTML": "意见反馈" }, _UDFD);
  1305. U.UI.From({ min: false, max: false, id: "U_Boom_CO_Popup_17", style: { "width": "280px", "height": "auto" }, content: _UDOD, title: "更多", hst: {}, bst: {} });
  1306. }
  1307. /**
  1308. * 插入表格
  1309. *
  1310. * @param {element} 换页元素
  1311. */
  1312. U.Word.InsertTable = function () {
  1313. var _UDTD, _UDSD, _UDKD, _UDMB
  1314. _UDOD = $$("div", { "class": "U_Boom_CO_Popup_16" });
  1315. _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16_main" }, _UDOD);
  1316. for (var i = 0; i < 7; i++) {
  1317. for (var j = 0; j < 8; j++) {
  1318. var a = $$("div", { "class": "U_Boom_CO_Popup_16_block", "style": { "top": i * 25 + 'px', "left": j * 26 + 'px' } }, _UDMB);
  1319. a.x = j;
  1320. a.y = i;
  1321. a.onmouseover = function () {
  1322. U.Word.SelectTable(this.x, this.y)
  1323. }
  1324. a.onmousedown = function () {
  1325. U.Word.AsynInsertTable(this.x + 1, this.y + 1)
  1326. }
  1327. }
  1328. }
  1329. $$("div", { "innerHTML": "直接插入", "style": { "position": "absolute", "top": "180px" } }, _UDMB).onclick = function () {
  1330. $(".U_Boom_CO_Popup_16_main")[0].style.display = 'none';
  1331. $(".U_Boom_CO_Popup_16_main")[1].style.display = 'block';
  1332. };
  1333. _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16_main", "style": { "display": "none" } }, _UDOD);
  1334. $$("div", { "class": "U_Boom_CO_Popup_16_title", "innerHTML": "表格尺寸" }, _UDMB);
  1335. _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
  1336. _UDKD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
  1337. $$("span", { "innerHTML": "列数:" }, _UDTD);
  1338. var _h = $$("input", { "id": "U_w_table_line" }, _UDTD);
  1339. $$("span", { "innerHTML": "行数:" }, _UDKD);
  1340. var _l = $$("input", { "id": "U_w_table_column" }, _UDKD);
  1341. $$("div", { "innerHTML": "表格宽度", "class": "U_Boom_CO_Popup_16_title" }, _UDMB);
  1342. _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
  1343. _UDSD = $$("span", { "innerHTML": "宽度" }, _UDTD);
  1344. $$("span", { "innerHTML": "mm", "style": { "float": "right", "text-indent": "5px" } }, _UDTD);
  1345. $$("input", { "id": "U_w_table_width", "value": "1", "style": { "width": "50px" } }, _UDTD);
  1346. U.UI.Confirm("插入表格", { "width": "230px", "height": "auto" }, null, [U.Word.AsynInsertTable, ([_h, _l])], _UDOD);
  1347. }
  1348. /*表格选择插入样式*/
  1349. U.Word.SelectTable = function (x, y) {
  1350. var xx = (x % 7) + 1;
  1351. var yy = (y % 9) + 1;
  1352. var a = $(".U_Boom_CO_Popup_16_block");
  1353. for (var i = 0; i < a.length; i++) {
  1354. a[i].style.borderColor = '#9e9e9e';
  1355. }
  1356. for (var i = 0; i < yy; i++) {
  1357. for (var j = 0; j < xx; j++) {
  1358. a[j + 8 * i].style.borderColor = '#38f';
  1359. }
  1360. }
  1361. }
  1362. /**
  1363. * 插入表格
  1364. *
  1365. * @param {element} 换页元素
  1366. */
  1367. U.Word.KeyFlage = null;
  1368. U.Word.MouseMenu = $("#UD_SYQER")[0];
  1369. U.Word.AsynInsertTable = function (x, y, node) {
  1370. var container;
  1371. if (!x && !y) {
  1372. U.Alert('请输入数据')
  1373. } else {
  1374. if (typeof x == 'object' || typeof y == 'object') {
  1375. x = x.value;
  1376. y = y.value;
  1377. }
  1378. }
  1379. if (!node) {
  1380. node = $(".U_Boom_CO_Editor_body_main_text")[0]
  1381. container = $$("table", { "border": "0", "class": "U_Boom_Table", "cellpadding": "0", "cellspacing": "0" }, node);
  1382. } else {
  1383. container = node;
  1384. }
  1385. container = $$("tbody", {}, container);
  1386. container.onkeydown = function (e) {
  1387. if (e.ctrlKey) {
  1388. U.Word.KeyFlage = true;
  1389. }
  1390. };
  1391. container.onkeyup = function () {
  1392. U.Word.KeyFlage = null;
  1393. };
  1394. for (var i = 0; i < y; i++) {
  1395. var a = $$("tr", { "class": "U_Boom_Table_Line" }, container);
  1396. for (var j = 0; j < x; j++) {
  1397. var b = $$("td", { "class": "U_Boom_Table_Column" }, a);
  1398. b.onmousedown = function (e) {
  1399. if (e.button == 2) {
  1400. U.M.RLocate(U.Word.MouseMenu);
  1401. } else {
  1402. U.Word.MouseMenu.removeAttribute('style');
  1403. }
  1404. U.Word.EditTable(this, e);
  1405. };
  1406. b.h = j;
  1407. b.l = i;
  1408. }
  1409. }
  1410. if ($("#U_COF")[0]) {
  1411. $("#U_COF")[0].style.display = 'none';
  1412. }
  1413. };
  1414. /**
  1415. * 调整拖拽表格
  1416. *
  1417. * @param {element} 换页元素
  1418. */
  1419. U.Word.ResizeTable = function (control, e) {
  1420. e.stopPropagation();
  1421. e.preventDefault();
  1422. var startX, container = control.parentNode;
  1423. var ThisTable = container.parentNode.parentNode.parentNode, count,
  1424. offsetX = container.offsetLeft - ThisTable.getBoundingClientRect().left;
  1425. offsetY = container.offsetHeight - ThisTable.getBoundingClientRect().top;
  1426. startX = e.pageX - ThisTable.getBoundingClientRect().left;
  1427. document.onmousemove = function (e) {
  1428. var ThisLine = container.parentNode;
  1429. var TabelLine = ThisTable.getElementsByClassName("U_Boom_Table_Content");
  1430. var TablePreparColumn = [],
  1431. TableElseColumn = [];
  1432. for (var i = 0; i < ThisLine.childNodes.length; i++) {
  1433. if (ThisLine.childNodes[i] == container) {
  1434. count = i;
  1435. }
  1436. }
  1437. for (var i = 0; i < TabelLine.length; i++) {
  1438. for (var k = 0; k < TabelLine[i].childNodes.length; k++) {
  1439. if (k == count) {
  1440. TablePreparColumn.push(TabelLine[i].childNodes[k]);
  1441. }
  1442. if (k > count) {
  1443. TableElseColumn.push(TabelLine[i].childNodes[k]);
  1444. }
  1445. }
  1446. }
  1447. var endX = e.pageX - ThisTable.getBoundingClientRect().left - offsetX;
  1448. var cutX = (endX - startX) / (TableElseColumn.length / TabelLine.length);
  1449. for (var j = 0; j < TablePreparColumn.length; j++) {
  1450. TablePreparColumn[j].style.width = endX + 'px';
  1451. }
  1452. for (var l = 0; l < TableElseColumn.length; l++) {
  1453. if (cutX > 0) {
  1454. TableElseColumn[l].style.width = TableElseColumn[l].offsetWidth - cutX + 'px';
  1455. } else {
  1456. TableElseColumn[l].style.width = TableElseColumn[l].offsetWidth + Math.abs(cutX) + 'px';
  1457. }
  1458. TableElseColumn[l].style.background = "yellow";
  1459. }
  1460. startX = e.pageX - ThisTable.getBoundingClientRect().left;
  1461. TablePreparColumn = [];
  1462. TableElseColumn = [];
  1463. };
  1464. document.onmouseup = function () {
  1465. document.onmousemove = null;
  1466. document.onmouseup = null;
  1467. }
  1468. };
  1469. /**
  1470. * 编辑表格
  1471. *
  1472. * @param {element} 换页元素
  1473. */
  1474. U.Word.EditTable = function (this_column, e) {
  1475. e.stopPropagation();
  1476. var Editors = $(".U_Boom_CO_Editor_body_main_text"); //编辑器
  1477. var Column = $(".U_Boom_Table_Column");
  1478. if (U.Word.KeyFlage) {
  1479. this_column.state = true;
  1480. this_column.setAttribute("contenteditable", true);
  1481. this_column.style.border = "1px solid #38f";
  1482. } else {
  1483. for (var i = 0; i < Column.length; i++) {
  1484. Column[i].state = false;
  1485. Column[i].onkeydown = null;
  1486. Column[i].setAttribute("contenteditable", false);
  1487. Column[i].style.border = "1px solid #ccc";
  1488. }
  1489. }
  1490. this_column.state = true;
  1491. this_column.setAttribute("contenteditable", true);
  1492. this_column.style.border = "1px solid #38f";
  1493. for (var j = 0; j < Editors.length; j++) {
  1494. Editors[j].setAttribute("contenteditable", false);
  1495. Editors[j].onmousedown = function () {
  1496. this.setAttribute("contenteditable", true);
  1497. Array.prototype.forEach.call(this.getElementsByTagName('*'), function (elm) {
  1498. elm.setAttribute("contenteditable", false);
  1499. });
  1500. }
  1501. }
  1502. };
  1503. /**
  1504. * 合并、拆分单元格
  1505. *
  1506. * @param {element} 换页元素
  1507. */
  1508. U.Word.ColumnControl = function (fx) {
  1509. var column = $(".U_Boom_Table_Column");
  1510. var selectColumn = [];
  1511. var OperateColumn = [];
  1512. for (var i = 0; i < column.length; i++) {
  1513. if (column[i].state) {
  1514. selectColumn.push(column[i])
  1515. }
  1516. }
  1517. if (fx == 'split') {
  1518. if (selectColumn.length > 1) {
  1519. U.Alert('请选择一个单元格');
  1520. Array.prototype.forEach.call(column, function (elm) {
  1521. elm.removeAttribute('style');
  1522. });
  1523. } else {
  1524. var _UDMB = $$("div", { "class": "U_Boom_CO_Popup_16", "style": { "height": "110px" } });
  1525. var UDHD = $$("div", { "class": "U_Boom_CO_Popup_16_main" }, _UDMB);
  1526. $$("div", { "class": "U_Boom_CO_Popup_16_title", "innerHTML": "拆分大小" }, UDHD);
  1527. var _UDTD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
  1528. var _UDKD = $$("div", { "class": "U_Boom_CO_Popup_16_OneLine" }, _UDMB);
  1529. $$("span", { "innerHTML": "列数:" }, _UDTD);
  1530. var _l = $$("input", { "id": "U_w_table_line", "value": "2" }, _UDTD);
  1531. $$("span", { "innerHTML": "行数:" }, _UDKD);
  1532. var _h = $$("input", { "id": "U_w_table_column", "value": "2" }, _UDKD);
  1533. var _CUM = new U.UI.Confirm("拆分单元格", { "width": "350px", "text-align": "center" }, null, U.M.apply(null, [[U.Word.AsynInsertTable, ([_h, _l, selectColumn[0]])]]), _UDMB); //创建对话框
  1534. }
  1535. } else {
  1536. U.Alert('暂无法使用');
  1537. U.Word.KeyFlage = null;
  1538. U.Word.MouseMenu.removeAttribute('style');
  1539. return false;
  1540. /////以后删除
  1541. var x = selectColumn[0].h, y = selectColumn[0].l;
  1542. var width = 0, content = '';
  1543. for (var i = 0; i < selectColumn.length; i++) {
  1544. if (selectColumn[i].h == y) {///找出一行中被选中的
  1545. OperateColumn.push(selectColumn[i]);
  1546. x = selectColumn[i].l, y = selectColumn[i].h;
  1547. }
  1548. }
  1549. for (var j = 1; j < OperateColumn.length; j++) {
  1550. width = OperateColumn[j].parentNode.offsetWidth + width;
  1551. content = OperateColumn[j].innerHTML + content;
  1552. OperateColumn[j].parentNode.remove();
  1553. }
  1554. OperateColumn[0].parentNode.style.width = OperateColumn[0].offsetWidth + width + 'px';
  1555. OperateColumn[0].innerHTML += content;
  1556. }
  1557. U.Word.KeyFlage = null;
  1558. U.Word.MouseMenu.removeAttribute('style');
  1559. };
  1560. /**
  1561. * 插入目录
  1562. *
  1563. * @param {element} 换页元素
  1564. */
  1565. U.Word.InserDirectory = function () {
  1566. // var i, _UDOCD, _UDOD = $$("div", { "class": "U_Boom_CO_Popup_15" });
  1567. // for (i = 0; i < 3; i++) {
  1568. // _UDOCD = $$("div", { "class": "U_Boom_CO_Popup_15_Cat" }, _UDOD);
  1569. // $$("div", { "class": "U_Boom_CO_Popup_15_Cat_Name", "innerHTML": "标题" + (i + 1), "style": { "margin-left": (i * 15) + "px"} }, _UDOCD);
  1570. // $$("div", { "class": "U_Boom_CO_Popup_15_Dash" }, _UDOCD);
  1571. // $$("div", { "class": "U_Boom_CO_Popup_15_Cat_Num", "innerHTML": "1" }, _UDOCD);
  1572. // }
  1573. // _UDOCD = $$("div", { "class": "U_Boom_O_Novel_Cat" }, _UDOD);
  1574. // U.UI.Confirm("自动生成目录", { "width": "330px", "height": "auto" }, null, [U.Word.AsynInserDirectory, ([_UDOD])], _UDOD);
  1575. }
  1576. /**
  1577. * 插入目录
  1578. *
  1579. * @param {element} 换页元素
  1580. */
  1581. U.Word.AsynInserDirectory = function () {
  1582. }
  1583. //#endregion
  1584. //#region 纸张大小
  1585. /**
  1586. * 修改纸张大小弹出
  1587. *
  1588. */
  1589. U.Word.PaperSize = function (UDOD) {
  1590. var i, _UDPD,
  1591. _ClassName = [],
  1592. _UDTD = $("#UD_SYQXR"),
  1593. _UDOD = $$("div", { "class": "U_Boom_CO_Popup_14" }),
  1594. _PaperSize = [
  1595. { "name": "A3", "class": "U_Boom_CO_PaperA3", "size": "29.7厘米 × 42厘米" },
  1596. { "name": "A4", "class": "U_Boom_CO_PaperA4", "size": "21厘米 × 29.7厘米" },
  1597. { "name": "A5", "class": "U_Boom_CO_PaperA5", "size": "14.8厘米 × 21厘米" },
  1598. { "name": "Web", "class": "U_Boom_CO_PaperWeb", "size": "占满屏幕" }
  1599. ];
  1600. $$("div", { "innerHTML": "选择纸张大小", "class": "U_Boom_CO_Popup_14_Title" }, _UDOD);
  1601. for (i = 0; i < _PaperSize.length; i++) {
  1602. _UDPD = $$("div", { "class": "U_Boom_CO_Popup_14_Main", "onclick": [[U.Word.AsynPaperSize, ([_PaperSize[i]["class"]])]] }, _UDOD);
  1603. $$("div", { "innerHTML": _PaperSize[i].name, "class": "U_Boom_CO_Popup_14_Main_Name" }, _UDPD);
  1604. $$("div", { "innerHTML": _PaperSize[i].size }, _UDPD)
  1605. }
  1606. for (i = 0; i < 2; i++) {
  1607. _ClassName.push(_UDTD[0].className);
  1608. _UDTD = _UDTD.childg(0)[0];
  1609. }
  1610. top.U.UI.Confirm("纸张大小", { "width": "330px", "height": "auto" }, [U.Word.AsynPaperSize, ([_UDOD])], [U.Word.CancelPaperSize, ([_ClassName])], _UDOD);
  1611. }
  1612. /**
  1613. * 纸张大小恢复
  1614. *
  1615. */
  1616. U.Word.SetPaperSize = function (ClassName) {
  1617. var i, _UDTD = $("#UD_SYQXR");
  1618. var _user = $("#U_Boom_CO_Editor_body_left")[0].childNodes[1]; //获取邀请协作人员窗体
  1619. var _history = $("#U_Boom_CO_Editor_body_left")[0].childNodes[2]; //获取编辑历史窗体
  1620. var _pay = $("#U_Boom_CO_Editor_body_left")[0].childNodes[3]; //获取生产链接窗体
  1621. var _hot = $("#U_Boom_CO_Editor_body_left")[0].childNodes[4]; //获取热门模板窗体
  1622. for (i = 0; i < ClassName.length; i++) {
  1623. _UDTD[0].className = ClassName[i];
  1624. _user.style.left = _history.style.left = _pay.style.left = _hot.style.left = _UDTD[0].clientWidth + 88 + "px";
  1625. _UDTD = _UDTD.childg(0)[1];
  1626. }
  1627. }
  1628. /**
  1629. * 确定纸张大小恢复
  1630. *
  1631. */
  1632. U.Word.AsynPaperSize = function (className) {
  1633. U.Word.SetPaperSize(["U_Boom_CO_Editor_body_main " + className, "U_Boom_CO_Editor_body_main_text " + className + "C"]);
  1634. $([$("#U_Boom_CO_Editor_body_left")[0], $("#U_Boom_CO_Editor_body_right")[0]]).css("display", className == "U_Boom_CO_PaperWeb" ? "none" : "block");
  1635. }
  1636. //#endregion
  1637. //#region 编辑处理
  1638. /**
  1639. * 键盘输入默认处理类
  1640. *
  1641. 传参规范
  1642. str 字符串类型
  1643. obj 对象类型
  1644. num 数字类型
  1645. arr 数组类型
  1646. cb 回调函数
  1647. 布尔类型
  1648. */
  1649. U.Word.Keyboard = function (UTF, UDE, UTE, UT, UWE) {
  1650. var i, _UTH, _UWH, _UDTD, _UDAD, _UDPD, _UDND, _UDFD;
  1651. if (UTF == "UP") {
  1652. // U.M.StopDefault();
  1653. // _UDTD = UTE.PSO;
  1654. // _UDAD = $(_UDTD).Child();
  1655. // if (_UDAD.length < 1) {
  1656. // UTE.Replace("<div><br /></div>");
  1657. // // U.OU.WordFocus(_UDTD, "<div><br /></div>", U.Word.Keyboard); //初始化焦点使用
  1658. // }
  1659. }
  1660. else if (UTF == "Cut") { //剪切处理
  1661. }
  1662. else if (UTF == "Copy") {
  1663. }
  1664. else if (UTF == "Paste") { //粘贴处理
  1665. // _UTH = U.M.UrlPaste();
  1666. // if (_UTH != "") {
  1667. // U.M.StopDefault();
  1668. // _UDTD = $("#U_Boom_Ed")[0];
  1669. // _UDTD.innerHTML = _UTH;
  1670. // }
  1671. // if (UTE.CTH) {
  1672. // U.M.StopDefault();
  1673. // UTE.Replace(this.CTH);
  1674. // }
  1675. }
  1676. //这里必须是word编辑模式下处理,在互联办公啊,云企建站等等就不做任何有关的处理
  1677. else {
  1678. switch (UTF) {
  1679. case "Backspace": //后退处理
  1680. _UDTD = UTE.PSO;
  1681. _UDAD = $(_UDTD).Child();
  1682. if ((_UDAD.length < 1 || (_UDAD.length == 1 && _UDAD[0].innerText.replace(/\u200b/g, "").length < 2)) || UTE.GetSelectedText() == _UDTD.innerText) {
  1683. U.M.StopDefault();
  1684. this.CreateR(); //重新记录光标
  1685. _UDPD = UTE.Parent(null, true);
  1686. if (!U.Word.delPage(_UDTD, UTE)) {
  1687. UTE.moveRange();
  1688. UTE.Replace("<br />");
  1689. UTE.QX(1, 1, _UDPD);
  1690. }
  1691. }
  1692. break;
  1693. case "Delete": //delte处理
  1694. break;
  1695. case "save": //保存处理
  1696. U.M.StopDefault();
  1697. U.Word.Save();
  1698. break;
  1699. case "replace":
  1700. alert();
  1701. break;
  1702. case "copy": //复制处理
  1703. break;
  1704. case "paste": //粘贴处理
  1705. break;
  1706. case "selectAll": //全选处理
  1707. break;
  1708. case "redo": //前进
  1709. break;
  1710. case "undo": //后退
  1711. break;
  1712. default:
  1713. 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))) { //特殊键处理
  1714. this.CreateR(); //重新记录光标
  1715. _UDPD = $(UTE.Parent(null, true)).Parent({ "tagName": "DIV" }); //获取当前行的元素
  1716. _UTH = UTE.getBoundingClientRect(); //获取光标位置和大小
  1717. //回车、键盘向下处理
  1718. 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))) {
  1719. U.M.StopDefault();
  1720. U.Word.Page($(UTE.PSO).Parent());
  1721. }
  1722. else if ((_UDPD.offsetTop + (_UDPD.offsetHeight * 2) - UTE.PSO.offsetTop) > UTE.PSO.offsetHeight && UTF == "Delete") {
  1723. }
  1724. //向上向左处理
  1725. else if (_UDPD.offsetTop - UTE.PSO.offsetTop < 50 && (UTF == "Up" || (UTF == "Left" && _UTH.right < 70))) {
  1726. U.M.StopDefault();
  1727. U.Word.Page($(UTE.PSO).Parent(), UTF);
  1728. }
  1729. //移动到最后准备输入后,判断是否已经需要换页
  1730. else if ((_UTH.right - _UDPD.offsetLeft - 20) >= UTE.PSO.offsetWidth || UTF == "Enter") {
  1731. // U.M.StopDefault(); //取消浏览器默认行为
  1732. // _UDND = $(_UDPD).next(); //获取当前输入行的下级元素
  1733. // //自动添加回车符号
  1734. // UTE.Replace("<div><br /></div>", null, true);
  1735. //换页处理
  1736. U.Word.Wrap(UTE.PSO, _UDPD);
  1737. }
  1738. // //输入的内容判断处理
  1739. // else if (_UWH["OW"] >= 780) {
  1740. // // _UDND = $(_UDPD).next();
  1741. // // _UDFD = $$("frag");
  1742. // // if (!_UDND) {
  1743. // // _UDND = $$("div");
  1744. // // }
  1745. // // for (i = _UDND.innerHTML.length; i >= 0; i++) {
  1746. // // _UDFD.textContent += _UDND.innerHTML.substring(_UDND.innerHTML.length - 1, _UDND.innerHTML.length);
  1747. // // if (_UDND.offsetWidth <= 780) {
  1748. // // break;
  1749. // // }
  1750. // // }
  1751. // }
  1752. // // _UDND = $(_UDPD).next();
  1753. // // for (i = 0; i < _UDAD.length; i++) {
  1754. // // }
  1755. }
  1756. break;
  1757. }
  1758. }
  1759. //自动生成换行处理
  1760. //U.Word.Wrap(UTE.PSO);
  1761. }
  1762. /**
  1763. * word自动换行
  1764. *
  1765. * @param {element} 换页元素
  1766. */
  1767. U.Word.Wrap = function (UDPD, UDSD) {
  1768. //变量定义
  1769. var i, j, k, _UWH, _UDMD, _UDCD,
  1770. _str = "", //需要换行的文字
  1771. _ptop = UDPD.offsetTop,
  1772. _pheight = UDPD.offsetHeight,
  1773. _height = UDSD.offsetHeight,
  1774. _UDAD = $(UDPD).Child();
  1775. //循环判断元素是否超出位置
  1776. for (i = 0; i < _UDAD.length; i++) {
  1777. _UWH = U.M.GetElementInfo(_UDAD[i]);
  1778. if ((_UWH["OH"] + _UWH["OT"]) - UDPD.offsetTop + _height > UDPD.offsetHeight) {
  1779. _UDMD = U.Word.Page($(UDPD).Parent(), null, null, true); //换页到下级元素
  1780. _UDMD.appendChild(_UDAD[i], _UDMD.firstChild); //插入到最前面
  1781. /*
  1782. _UDCD = $(_UDAD[i].children);
  1783. if (_UDCD.length) { //如果有子元素处理子元素方式
  1784. for (k = _UDCD.length - 1; k >= 0; k--) {
  1785. if (_UDAD[i].children[k].tagName == "DIV") { //div的处理方式
  1786. _UDMD.appendChild(_UDAD[i].children[k], _UDMD.firstChild);
  1787. }
  1788. else if (_UDAD[i].innerText) { //span 等处理方式
  1789. // _str = $$(_UDAD[i].tagName, { className: _UDAD[i].className, "style": { "cssText": _UDAD[i].style.cssText} });
  1790. // for (j = _UDAD[i].innerText.length; i >= 0; j++) {
  1791. // _str.innerText += _UDAD[i].innerText.substring(j, 1)
  1792. // }
  1793. }
  1794. else { //#text 处理方式
  1795. _UDAD[i].textContent;
  1796. }
  1797. }
  1798. }
  1799. else { //直接处理整行
  1800. _UDMD.appendChild(_UDAD[i], _UDMD.firstChild);
  1801. }
  1802. */
  1803. }
  1804. }
  1805. /*
  1806. //变量定义
  1807. var i, j, k, _UWH, _UST, //下面使用到的变量
  1808. _UDTD = $("#U_Boom_Ed")[0], //编辑大小使用元素
  1809. _UDAD = $("div", UDPD); //所有的元素
  1810. //循环查看
  1811. for (i = 0; i < _UDAD.length; i++) {
  1812. _UDTD.innerHTML = "";
  1813. _UDTD = $$("span", { "innerHTML": _UDAD[i].innerHTML }, _UDTD);
  1814. for (k = _UDAD[i].children.length - 1; (U.M.GetElementInfo(_UDAD[i]).OW >= 750 && k >= 0); k--) {
  1815. if (_UDAD[i].children[k].innerText) {
  1816. for (j = 0; j < _UDAD[i].children[k].innerText.length; j++) {
  1817. _UDAD[i].children[k].innerText = "";
  1818. }
  1819. }
  1820. else if (_UDAD[i].children[k].textContent) {
  1821. }
  1822. }
  1823. }
  1824. */
  1825. }
  1826. /**
  1827. * word换页
  1828. *
  1829. * @param {element} 包含头部,尾部和编辑区域的元素
  1830. * @param {bool} 向上或者向下翻页pagedown
  1831. * @param {string} 是否追加元素,插入光标时还需要插入什么元素,
  1832. * @param {bool} 换页是否不聚焦,b如果为true,则聚焦,否则,不聚焦
  1833. */
  1834. U.Word.Page = function (currentpage, pagedown, str, b) {
  1835. //UDOD 包含头部,尾部和编辑区域的元素和_pagediv结构上一模一样。区别在_pagediv可能是下一页,可能是上一页。
  1836. var _pagediv; // 由于是多页,所以需要另外建立一个div,包含下面的头部,内容,底部,和currentpage结构上一样,上一页和下一页的区别。
  1837. var _header; //头部
  1838. var _editor; //编辑区域,没有头部和尾部,这个是返回值。
  1839. var _cursor; //需要插入的光标。
  1840. var _footer; //尾部
  1841. _wordeditor = $(currentpage).Parent(); //生成新页面追加到最大编辑器,所以要找父亲元素
  1842. //向上翻页
  1843. if (pagedown) {
  1844. _pagediv = $(currentpage).prev()[0]; //查找上一个元素
  1845. _editor = $(_pagediv).Child()[1]; //得到编辑元素
  1846. //换页是否插入光标
  1847. if (b !== true) {
  1848. _cursor = U.OU.WordFocus(_editor, false, U.Word.Keyboard); //初始化焦点使用,只是聚焦作用,还没插入光标
  1849. }
  1850. }
  1851. //向下翻页
  1852. else {
  1853. _pagediv = $(currentpage).next()[0]; //查找下一个元素
  1854. //如果不存在下一页,则创建新页
  1855. if (!_pagediv) {
  1856. //
  1857. _pagediv = $$("div", { "className": "U_Boom_CO_Editor_body_main_m" }, _wordeditor); //由于是多页,所以需要另外建立一个div,包含下面的头部,内容,底部
  1858. _header = $$("div", { "className": "U_Boom_CO_Editor_body_main_border" }, _pagediv); //头部信息
  1859. $$("div", { "className": "U_Boom_CO_Editor_body_main_bordero" }, _header); //头部的左上角
  1860. $$("div", { "className": "U_Boom_CO_Editor_body_main_bordert" }, _header); //头部的右上角
  1861. _editor = $$("div", { "className": "U_Boom_CO_Editor_body_main_text", contentEditable: "true", spellcheck: "false", "innerHTML": "", "id": "Txt" + Guid.NewGuid() }, _pagediv); //编辑器区域
  1862. _footer = $$("div", { "className": "U_Boom_CO_Editor_body_main_border" }, _pagediv);
  1863. $$("div", { "className": "U_Boom_CO_Editor_body_main_borders" }, _footer);
  1864. $$("div", { "className": "U_Boom_CO_Editor_body_main_borderf" }, _footer);
  1865. //换页是否插入光标
  1866. if (b !== true) {
  1867. _cursor = U.OU.WordFocus(_editor, str || "<div><br /></div>", U.Word.Keyboard); //初始化焦点使用
  1868. }
  1869. else { //添加不换行处理
  1870. _editor.innerHTML = str || "<div><br /></div>";
  1871. }
  1872. }
  1873. }
  1874. //真正的插入光标
  1875. _editor = $(_editor).Child(); //得到"<div><br /></div>";
  1876. var _line = pagedown ? _editor.length - 1 : 0;//向上翻聚焦到最后一行,向下翻聚焦到第一页
  1877. _editor = _editor[_line]; //获得插入光标位置
  1878. if (b !== true) {
  1879. _cursor.QX(1, 1, _editor);//插入光标
  1880. }
  1881. return _editor;
  1882. }
  1883. /**
  1884. * 移除页面
  1885. *
  1886. * @param {element} 换页元素
  1887. */
  1888. U.Word.delPage = function (UDOD, UTE) {
  1889. var _UDPD = $(UDOD).Parent();
  1890. _UDSD = $(_UDPD).prev()[0];
  1891. if (_UDSD) {
  1892. $(_UDPD).remove();
  1893. _UDMD = $(_UDSD).Child()[1];
  1894. _UDMD = $(_UDMD).Child() || $(_UDMD);
  1895. _UDMD = _UDMD[_UDMD.length - 1];
  1896. _UDMD.focus();
  1897. if (UTE != null) {
  1898. UTE.QX(1, 1, _UDMD); //初始化焦点使用
  1899. UTE.CreateR(false);
  1900. }
  1901. return true;
  1902. }
  1903. return false;
  1904. }
  1905. //#endregion
  1906. //#region 其他功能
  1907. document.oncontextmenu = U.M.StopDefault; //禁止右键菜单
  1908. //新建Word文件
  1909. U.Word.NWWJ = function () {
  1910. top.U.D.Office.Word(top.US.userInfo, null);
  1911. }
  1912. //文件下载成指定的格式
  1913. U.Word.XZZDGS = function () {
  1914. top.U.D.Office.ZDGSXZ(U.Word.TF["ID"], "html", U.Word);
  1915. }
  1916. /**
  1917. * 更多的选择
  1918. *
  1919. */
  1920. U.Word.More = function () {
  1921. var _UDMD, _UDFD, _UDOD = $$("div", {});
  1922. _UDMD = $$("div", { "class": "U_Boom_CO_Popup_17_Main" }, _UDOD);
  1923. $$("div", { "class": "U_Boom_CO_Popup_17_Main_Icon" }, _UDMD)
  1924. $$("span", { "innerHTML": "下载" }, _UDMD);
  1925. _UDFD = $$("div", { "class": "U_Boom_CO_Popup_17_Main" }, _UDOD);
  1926. $$("div", { "class": "U_Boom_CO_Popup_17_Main_Icon", "style": { "background-position": "-44px -81px" } }, _UDFD)
  1927. $$("span", { "innerHTML": "意见反馈" }, _UDFD);
  1928. U.UI.From({ min: false, max: false, id: "U_Boom_CO_Popup_17", style: { "width": "280px", "height": "auto" }, content: _UDOD, title: "更多", hst: {}, bst: {} });
  1929. }
  1930. U.Word.ViewDisplayon = function () {//功能区域关闭
  1931. var UDAA = $("#U_Boom_CO_Editor_body_left")[0].childNodes; //获取功能区域
  1932. var UDWD = $("#U_Boom_CO_Editor_body_left .UD_SYF_S"); //获取功能区域
  1933. var UDOD_yq_colse = $(".UD_SYF_SS"); //获取获取功能区域的关闭按钮
  1934. UDOD_yq_colse[0].onclick = function () {//邀请协作人员关闭
  1935. U.D.CloseWindow(UDWD[0]);
  1936. UDAA[2].style.top = UDAA[2].offsetTop - 270 + "px";
  1937. UDAA[3].style.top = UDAA[3].offsetTop - 270 + "px";
  1938. UDAA[4].style.top = UDAA[4].offsetTop - 270 + "px";
  1939. }
  1940. UDOD_yq_colse[1].onclick = function () {//编辑历史关闭
  1941. U.D.CloseWindow(UDWD[1]);
  1942. UDAA[3].style.top = UDAA[3].offsetTop - 270 + "px";
  1943. UDAA[4].style.top = UDAA[4].offsetTop - 270 + "px";
  1944. }
  1945. UDOD_yq_colse[2].onclick = function () {//生成链接关闭
  1946. U.D.CloseWindow(UDWD[2]);
  1947. UDAA[4].style.top = UDAA[4].offsetTop - 270 + "px";
  1948. }
  1949. UDOD_yq_colse[3].onclick = function () {//热门模板关闭
  1950. U.D.CloseWindow(UDWD[3]);
  1951. }
  1952. }
  1953. U.Word.ViewDisplayc = function () {//点击关闭编辑区域时 视图窗体&&更多窗体&&纸张大小窗体 关闭
  1954. for (var i = 0; i < $(".UD_SYF_SS").length; i++) {
  1955. $(".UD_SYF_SS")[i].onclick = function () {
  1956. this.parentNode.parentNode.style.display = "none";
  1957. $("#ViewDisplaya").hide();
  1958. $("#UD_Temp").hide();
  1959. $("#U_COF").hide();
  1960. $("#EditHistor").hide();
  1961. $("#EditHistorq").hide();
  1962. }
  1963. }
  1964. }
  1965. //#endregion