1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200 |
- //查看指定文件,,判断是否保存或者覆盖,包括创建邀请协作人员,创建编辑历史,创建生成链接.创建热门模板。加载当前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
|